Loading...
Searching...
No Matches
cc2538_eui_primary.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
18#include "net/eui64.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#define CC2538_EUI64_LOCATION_PRI (0x00280028)
25#define CC2538_EUI64_LOCATION_SEC (0x0027FFCC)
26
35static inline int cc2538_get_eui64_primary(uint8_t index, eui64_t *addr)
36{
37 (void)index;
38
39 /*
40 * The primary EUI-64 seems to be written to memory in a non-sequential
41 * byte order, with both 4-byte halves of the address flipped.
42 */
43 addr->uint8[7] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[4];
44 addr->uint8[6] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[5];
45 addr->uint8[5] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[6];
46 addr->uint8[4] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[7];
47 addr->uint8[3] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[0];
48 addr->uint8[2] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[1];
49 addr->uint8[1] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[2];
50 addr->uint8[0] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[3];
51
52 return 0;
53}
54
59#ifndef CC2538_EUI64_CUSTOM
60#define EUI64_PROVIDER_FUNC cc2538_get_eui64_primary
61#define EUI64_PROVIDER_TYPE NETDEV_CC2538
62#define EUI64_PROVIDER_INDEX 0
63#endif /* !CC2538_EUI64_CUSTOM */
65
66#ifdef __cplusplus
67} /* end extern "C" */
68#endif
69
static int cc2538_get_eui64_primary(uint8_t index, eui64_t *addr)
Get the primary (burned-in) EUI-64 of the device.
#define CC2538_EUI64_LOCATION_PRI
Primary EUI-64 address location.
EUI-64 data type definition.
Data type to represent an EUI-64.
Definition eui64.h:55
uint8_t uint8[8]
split into 8 8-bit words.
Definition eui64.h:57