Loading...
Searching...
No Matches
eui_provider_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 ML!PA Consulting GmbH
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17#include "net/eui64.h"
18#include "periph/eeprom.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
28#define EEPROM_MAC_ADDR (0x1fe4)
29
33static inline int _eeprom_mac_get_eui64(uint8_t index, eui64_t *addr)
34{
35 (void)index;
36
37 if (eeprom_read(EEPROM_MAC_ADDR, addr, sizeof(eui64_t)) != sizeof(eui64_t)) {
38 return -1;
39 }
40
41 addr->uint64.u64 = byteorder_htonll(addr->uint64.u64).u64;
42
43 return 0;
44}
45
50#define EUI64_PROVIDER_FUNC _eeprom_mac_get_eui64
51#define EUI64_PROVIDER_TYPE NETDEV_AT86RF2XX
52#define EUI64_PROVIDER_INDEX 0
54
55#ifdef __cplusplus
56}
57#endif
58
static network_uint64_t byteorder_htonll(uint64_t v)
Convert from host byte order to network byte order, 64 bit.
Definition byteorder.h:498
static int _eeprom_mac_get_eui64(uint8_t index, eui64_t *addr)
Constant in EEPROM provides a EUI-64, this is also printed on the board.
Low-level eeprom driver interface.
EUI-64 data type definition.
size_t eeprom_read(uint32_t pos, void *data, size_t len)
Read len bytes from the given position.
uint64_t u64
64 bit representation
Definition byteorder.h:96
Data type to represent an EUI-64.
Definition eui64.h:55
network_uint64_t uint64
represented as 64 bit value
Definition eui64.h:56