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:
parent
aed7c18eb5
commit
8eb69b7285
@ -1 +1,5 @@
|
|||||||
USEMODULE += boards_common_atmega
|
USEMODULE += boards_common_atmega
|
||||||
|
|
||||||
|
ifneq (,$(filter eui_provider,$(USEMODULE)))
|
||||||
|
FEATURES_REQUIRED += periph_eeprom
|
||||||
|
endif
|
||||||
|
@ -21,10 +21,44 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
|
#include "periph/eeprom.h"
|
||||||
|
#include "net/eui_provider.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
* @name xtimer configuration values
|
||||||
* @{
|
* @{
|
||||||
|
Loading…
Reference in New Issue
Block a user