Loading...
Searching...
No Matches
cc2538_eui_primary.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 ML!PA Consulting GmbH
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef CC2538_EUI_PRIMARY_H
20#define CC2538_EUI_PRIMARY_H
21
22#include "net/eui64.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#define CC2538_EUI64_LOCATION_PRI (0x00280028)
29#define CC2538_EUI64_LOCATION_SEC (0x0027FFCC)
39static inline int cc2538_get_eui64_primary(uint8_t index, eui64_t *addr)
40{
41 (void)index;
42
43 /*
44 * The primary EUI-64 seems to be written to memory in a non-sequential
45 * byte order, with both 4-byte halves of the address flipped.
46 */
47 addr->uint8[7] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[4];
48 addr->uint8[6] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[5];
49 addr->uint8[5] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[6];
50 addr->uint8[4] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[7];
51 addr->uint8[3] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[0];
52 addr->uint8[2] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[1];
53 addr->uint8[1] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[2];
54 addr->uint8[0] = ((uint8_t*)CC2538_EUI64_LOCATION_PRI)[3];
55
56 return 0;
57}
58
63#ifndef CC2538_EUI64_CUSTOM
64#define EUI64_PROVIDER_FUNC cc2538_get_eui64_primary
65#define EUI64_PROVIDER_TYPE NETDEV_CC2538
66#define EUI64_PROVIDER_INDEX 0
67#endif /* !CC2538_EUI64_CUSTOM */
70#ifdef __cplusplus
71} /* end extern "C" */
72#endif
73
74#endif /* CC2538_EUI_PRIMARY_H */
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