Skip to content

Commit aa10d28

Browse files
committed
[Opta] Set default Eth MAC Address from OTP
1 parent d18d04d commit aa10d28

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

variants/OPTA/pins_arduino.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ static const uint8_t SCK = PIN_SPI_SCK;
146146
uint16_t _getVid_();
147147
uint16_t _getPid_();
148148

149+
// Retrieve (Arduino OUI) Ethernet MAC Address from QSPIF OTP
150+
uint8_t _getSecureEthMac_(uint8_t *);
151+
149152
#define BOARD_NAME "Arduino Opta"
150153

151154
#define DFU_MAGIC_SERIAL_ONLY_RESET 0xb0

variants/OPTA/variant.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,21 @@ uint16_t _getPid_() {
322322
#endif
323323
}
324324

325+
uint8_t _getSecureEthMac_(uint8_t *mac_address) {
326+
if (!has_otp_info) {
327+
getSecureFlashData();
328+
}
329+
memcpy(mac_address, ((OptaBoardInfo*)_boardInfo)->mac_address, 6);
330+
331+
return 6;
332+
}
333+
334+
uint8_t mbed_otp_mac_address(char *mac)
335+
{
336+
auto ret = _getSecureEthMac_(reinterpret_cast<uint8_t *>(mac));
337+
return ret;
338+
}
339+
325340
#define BOARD_REVISION(x,y) (x << 8 | y)
326341

327342
void initVariant() {

0 commit comments

Comments
 (0)