Contiki-NG
ieee-addr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /*---------------------------------------------------------------------------*/
32 /**
33  * \addtogroup cc26xx
34  * @{
35  *
36  * \defgroup cc26xx-ieee-addr CC13xx/CC26xx IEEE Address Control
37  *
38  * Driver for the retrieval of an IEEE address from flash
39  *
40  * The user can specify a hardcoded IEEE address through the
41  * IEEE_ADDR_CONF_HARDCODED configuration macro.
42  *
43  * If the user does not hard-code an address, then one will be read from either
44  * the primary location (InfoPage) or from the secondary location (on flash).
45  *
46  * In order to allow the user to easily program nodes with addresses, the
47  * secondary location is given priority: If it contains a valid address then
48  * it will be chosen in favour of the one on InfoPage.
49  *
50  * In this context, an address is valid if at least one of the 8 bytes does not
51  * equal 0xFF. If all 8 bytes are 0xFF, then the primary location will be used.
52  *
53  * In all cases, the address is assumed to be written little-endian.
54  *
55  * Lastly, it is possible to override the 2 LSB's of the address by using the
56  * NODE_ID make variable.
57  * @{
58  *
59  * \file
60  * Header file with register and macro declarations for the cc26xx IEEE address
61  * driver
62  */
63 /*---------------------------------------------------------------------------*/
64 #ifndef IEEE_ADDR_H_
65 #define IEEE_ADDR_H_
66 /*---------------------------------------------------------------------------*/
67 #include "contiki.h"
68 
69 #include <stdint.h>
70 /*---------------------------------------------------------------------------*/
71 /**
72  * \name IEEE address locations
73  *
74  * The address of the secondary location can be configured by the platform
75  * or example
76  *
77  * @{
78  */
79 #define IEEE_ADDR_LOCATION_PRIMARY 0x500012F0 /**< Primary IEEE address location */
80 
81 #ifdef IEEE_ADDR_CONF_LOCATION_SECONDARY
82 #define IEEE_ADDR_LOCATION_SECONDARY IEEE_ADDR_CONF_LOCATION_SECONDARY
83 #else
84 #define IEEE_ADDR_LOCATION_SECONDARY 0x0001FFC8 /**< Secondary IEEE address location */
85 #endif
86 /** @} */
87 /*---------------------------------------------------------------------------*/
88 /**
89  * \brief Copy the node's IEEE address to a destination memory area
90  * \param dst A pointer to the destination area where the IEEE address is to be
91  * written
92  * \param len The number of bytes to write to destination area
93  *
94  * This function will copy \e len LS bytes and it will invert byte order in
95  * the process. The factory address on devices is normally little-endian,
96  * therefore you should expect dst to store the address in a big-endian order.
97  */
98 void ieee_addr_cpy_to(uint8_t *dst, uint8_t len);
99 /*---------------------------------------------------------------------------*/
100 #endif /* IEEE_ADDR_H_ */
101 /*---------------------------------------------------------------------------*/
102 /**
103  * @}
104  * @}
105  */
void ieee_addr_cpy_to(uint8_t *dst, uint8_t len)
Copy the node&#39;s IEEE address to a destination memory area.
Definition: ieee-addr.c:46