1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/derfmega256: define EUI-64 provider

This commit is contained in:
Benjamin Valentin 2020-07-10 21:44:39 +02:00
parent aed7c18eb5
commit 8eb69b7285
2 changed files with 38 additions and 0 deletions

View File

@ -1 +1,5 @@
USEMODULE += boards_common_atmega
ifneq (,$(filter eui_provider,$(USEMODULE)))
FEATURES_REQUIRED += periph_eeprom
endif

View File

@ -21,10 +21,44 @@
#include "cpu.h"
#include "periph/eeprom.h"
#include "net/eui_provider.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name MAC configuration
* Offset of the MAC address in the EEPROM
*/
#define EEPROM_MAC_ADDR (0x1fe4)
/**
* @brief Constant in EEPROM provides a EUI-64, this is also printed on the board
*/
static inline int _eeprom_mac_get_eui64(const void *arg, eui64_t *addr)
{
(void) arg;
if (eeprom_read(EEPROM_MAC_ADDR, addr, sizeof(eui64_t)) != sizeof(eui64_t)) {
return -1;
}
addr->uint64.u64 = byteorder_htonll(addr->uint64.u64).u64;
return 0;
}
/**
* @name EUI-64 sources on the board
* @{
*/
#define EUI64_PROVIDER_FUNC _eeprom_mac_get_eui64
#define EUI64_PROVIDER_TYPE NETDEV_AT86RF2XX
#define EUI64_PROVIDER_INDEX 0
/** @} */
/**
* @name xtimer configuration values
* @{