@@ -28,7 +28,7 @@ typedef struct eth_mac_internal_s {
2828 arm_device_driver_list_s * dev_driver ;
2929 uint8_t * mtu_ptr ;
3030 uint16_t mtu_size ;
31- uint8_t mac48 [ 6 ];
31+ uint8_t mac48_iid64 [ 8 ];
3232 bool active_data_request ;
3333 int8_t tasklet_id ;
3434 //linked list link
@@ -52,6 +52,8 @@ static int8_t eth_mac_api_init(eth_mac_api_t *api, eth_mac_data_confirm *conf_cb
5252static void data_req (const eth_mac_api_t * api , const eth_data_req_t * data );
5353static int8_t mac48_address_set (const eth_mac_api_t * api , const uint8_t * mac48 );
5454static int8_t mac48_address_get (const eth_mac_api_t * api , uint8_t * mac48_buf );
55+ static int8_t iid64_address_set (const eth_mac_api_t * api , const uint8_t * iid64 );
56+ static int8_t iid64_address_get (const eth_mac_api_t * api , uint8_t * iid64_buf );
5557
5658static int8_t eth_mac_net_phy_rx (const uint8_t * data_ptr , uint16_t data_len , uint8_t link_quality , int8_t dbm , int8_t driver_id );
5759static int8_t eth_mac_net_phy_tx_done (int8_t driver_id , uint8_t tx_handle , phy_link_tx_status_e status , uint8_t cca_retry , uint8_t tx_retry );
@@ -98,6 +100,7 @@ eth_mac_api_t *ethernet_mac_create(int8_t driver_id)
98100 switch (driver -> phy_driver -> link_type ) {
99101
100102 case PHY_LINK_SLIP :
103+ case PHY_LINK_PPP :
101104 //Do not Allocate
102105 address_resolution_needed = false;
103106 buffer_length = 0 ;
@@ -133,19 +136,29 @@ eth_mac_api_t *ethernet_mac_create(int8_t driver_id)
133136 memset (this , 0 , sizeof (eth_mac_api_t ));
134137 this -> mac_initialize = & eth_mac_api_init ;
135138 this -> data_req = & data_req ;
136- this -> mac48_get = & mac48_address_get ;
137- this -> mac48_set = & mac48_address_set ;
139+
140+ if (driver -> phy_driver -> link_type == PHY_LINK_PPP ) {
141+ this -> iid64_get = & iid64_address_get ;
142+ this -> iid64_set = & iid64_address_set ;
143+ } else {
144+ this -> mac48_get = & mac48_address_get ;
145+ this -> mac48_set = & mac48_address_set ;
146+ }
138147
139148 this -> address_resolution_needed = address_resolution_needed ;
140149
141- memset (& mac_store .mac48 , 0 , 6 );
150+ memset (& mac_store .mac48_iid64 , 0 , 8 );
142151 mac_store .active_data_request = false;
143152 mac_store .mac_api = this ;
144153 mac_store .dev_driver = driver ;
145154 mac_store .mtu_ptr = buffer_ptr ;
146155 mac_store .mtu_size = buffer_length ;
147156
148- memcpy (& mac_store .mac48 , mac_store .dev_driver -> phy_driver -> PHY_MAC , 6 );
157+ if (driver -> phy_driver -> link_type == PHY_LINK_PPP ) {
158+ memcpy (& mac_store .mac48_iid64 , mac_store .dev_driver -> phy_driver -> PHY_MAC , 8 );
159+ } else {
160+ memcpy (& mac_store .mac48_iid64 , mac_store .dev_driver -> phy_driver -> PHY_MAC , 6 );
161+ }
149162 if (mac_store .tasklet_id == -1 ) {
150163 mac_store .tasklet_id = eventOS_event_handler_create (& ethernet_mac_tasklet , ETH_INIT_EVENT );
151164 }
@@ -289,7 +302,7 @@ static int8_t eth_mac_net_phy_rx(const uint8_t *data_ptr, uint16_t data_len, uin
289302
290303 data_len -= 4 ;
291304 data_ptr += 4 ;
292- } else if (driver -> phy_driver -> link_type == PHY_LINK_SLIP ) {
305+ } else if (driver -> phy_driver -> link_type == PHY_LINK_SLIP || driver -> phy_driver -> link_type == PHY_LINK_PPP ) {
293306 data_ind -> etehernet_type = ETHERTYPE_IPV6 ;
294307 }
295308
@@ -357,10 +370,10 @@ static int8_t mac48_address_set(const eth_mac_api_t *api, const uint8_t *mac48)
357370 if (!mac48 || !api || mac_store .mac_api != api ) {
358371 return -1 ;
359372 }
360- memcpy (mac_store .mac48 , mac48 , 6 );
373+ memcpy (mac_store .mac48_iid64 , mac48 , 6 );
361374 phy_device_driver_s * driver = mac_store .dev_driver -> phy_driver ;
362375 if (driver -> address_write ) {
363- driver -> address_write (PHY_MAC_48BIT , mac_store .mac48 );
376+ driver -> address_write (PHY_MAC_48BIT , mac_store .mac48_iid64 );
364377 }
365378 return 0 ;
366379}
@@ -370,7 +383,30 @@ static int8_t mac48_address_get(const eth_mac_api_t *api, uint8_t *mac48_buf)
370383 if (!mac48_buf || !api || mac_store .mac_api != api ) {
371384 return -1 ;
372385 }
373- memcpy (& mac_store .mac48 , mac_store .dev_driver -> phy_driver -> PHY_MAC , 6 );
374- memcpy (mac48_buf , mac_store .mac48 , 6 );
386+ memcpy (& mac_store .mac48_iid64 , mac_store .dev_driver -> phy_driver -> PHY_MAC , 6 );
387+ memcpy (mac48_buf , mac_store .mac48_iid64 , 6 );
388+ return 0 ;
389+ }
390+
391+ static int8_t iid64_address_set (const eth_mac_api_t * api , const uint8_t * iid64 )
392+ {
393+ if (!iid64 || !api || mac_store .mac_api != api ) {
394+ return -1 ;
395+ }
396+ memcpy (mac_store .mac48_iid64 , iid64 , 8 );
397+ phy_device_driver_s * driver = mac_store .dev_driver -> phy_driver ;
398+ if (driver -> address_write ) {
399+ driver -> address_write (PHY_MAC_48BIT , mac_store .mac48_iid64 );
400+ }
401+ return 0 ;
402+ }
403+
404+ static int8_t iid64_address_get (const eth_mac_api_t * api , uint8_t * iid64_buf )
405+ {
406+ if (!iid64_buf || !api || mac_store .mac_api != api ) {
407+ return -1 ;
408+ }
409+ memcpy (& mac_store .mac48_iid64 , mac_store .dev_driver -> phy_driver -> PHY_MAC , 8 );
410+ memcpy (iid64_buf , mac_store .mac48_iid64 , 8 );
375411 return 0 ;
376412}
0 commit comments