File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,13 @@ WEAK int mbed_uid(char *uid) {
84
84
static uint8_t manual_mac_address_set = 0 ;
85
85
static char manual_mac_address [6 ];
86
86
87
- void mbed_set_mac_address (const char * mac ) {
87
+ void mbed_set_mac_address (const char * mac , uint8_t coerce_mac_control_bits ) {
88
88
memcpy (manual_mac_address , mac , 6 );
89
89
manual_mac_address_set = 1 ;
90
+ if (coerce_mac_control_bits ) {
91
+ manual_mac_address [0 ] |= 0x02 ; // force bit 1 to a "1" = "Locally Administered"
92
+ manual_mac_address [0 ] &= 0xFE ; // force bit 0 to a "0" = Unicast
93
+ }
90
94
}
91
95
92
96
WEAK void mbed_mac_address (char * mac ) {
Original file line number Diff line number Diff line change @@ -104,8 +104,11 @@ int mbed_interface_uid(char *uid);
104
104
* mbed_mac_address() will readback this configured value
105
105
*
106
106
* @param mac A 6-byte array containing the desired MAC address to be set
107
+ * @param coerce_mac_control_bits An 8-bit int that is used as a boolean flag to either coerce
108
+ * the provided MAC address to be Locally Administered and Unicast or to use the
109
+ * provided MAC address unmodified
107
110
*/
108
- void mbed_set_mac_address (const char * mac );
111
+ void mbed_set_mac_address (const char * mac , uint8_t coerce_mac_control_bits );
109
112
110
113
/** This returns a unique 6-byte MAC address, based on the interface UID
111
114
* If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
You can’t perform that action at this time.
0 commit comments