nrfxlib API 2.7.99
Loading...
Searching...
No Matches
nrf_802154_const.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, Nordic Semiconductor ASA
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
40#ifndef NRF_802154_CONST_H_
41#define NRF_802154_CONST_H_
42
43#define RAW_LENGTH_OFFSET 0
44#define RAW_PAYLOAD_OFFSET 1
45
46#define ACK_HEADER_WITH_PENDING 0x12
47#define ACK_HEADER_WITHOUT_PENDING 0x02
48
49#define ACK_REQUEST_OFFSET 1
50#define ACK_REQUEST_BIT (1 << 5)
51
52#define ASN_IN_NONCE_BIT 0x40
53
54#define DEST_ADDR_TYPE_OFFSET 2
55#define DEST_ADDR_TYPE_MASK 0x0c
56#define DEST_ADDR_TYPE_EXTENDED 0x0c
57#define DEST_ADDR_TYPE_NONE 0x00
58#define DEST_ADDR_TYPE_SHORT 0x08
59#define DEST_ADDR_OFFSET 6
60
61#define DSN_OFFSET 3
62#define DSN_SUPPRESS_OFFSET 2
63#define DSN_SUPPRESS_BIT 0x01
64
65#define FRAME_COUNTER_SUPPRESS_BIT 0x20
66
67#define FRAME_PENDING_OFFSET 1
68#define FRAME_PENDING_BIT (1 << 4)
69
70#define FRAME_TYPE_OFFSET 1
71#define FRAME_TYPE_MASK 0x07
72#define FRAME_TYPE_ACK 0x02
73#define FRAME_TYPE_BEACON 0x00
74#define FRAME_TYPE_COMMAND 0x03
75#define FRAME_TYPE_DATA 0x01
76#define FRAME_TYPE_EXTENDED 0x07
77#define FRAME_TYPE_FRAGMENT 0x06
78#define FRAME_TYPE_MULTIPURPOSE 0x05
79
80#define FRAME_VERSION_OFFSET 2
81#define FRAME_VERSION_MASK 0x30
82#define FRAME_VERSION_0 0x00
83#define FRAME_VERSION_1 0x10
84#define FRAME_VERSION_2 0x20
85#define FRAME_VERSION_3 0x30
86
87#define IE_HEADER_LENGTH_MASK 0x3f
88#define IE_PRESENT_OFFSET 2
89#define IE_PRESENT_BIT 0x02
90
91#define KEY_ID_MODE_0 0
92#define KEY_ID_MODE_1 1
93#define KEY_ID_MODE_2 2
94#define KEY_ID_MODE_3 3
95
96#define KEY_ID_MODE_MASK 0x18
97#define KEY_ID_MODE_BIT_OFFSET 3
98#define KEY_ID_MODE_0_MASK 0
99#define KEY_ID_MODE_1_MASK 0x08
100#define KEY_ID_MODE_2_MASK 0x10
101#define KEY_ID_MODE_3_MASK 0x18
102
103#define KEY_SRC_KEY_ID_MODE_0_SIZE 0
104#define KEY_SRC_KEY_ID_MODE_1_SIZE 0
105#define KEY_SRC_KEY_ID_MODE_2_SIZE 4
106#define KEY_SRC_KEY_ID_MODE_3_SIZE 8
107
108#define KEY_IDX_SIZE 1
109
110#define MAC_CMD_COMMAND_ID_SIZE 1
111#define MAC_CMD_ASSOC_REQ 0x01
112#define MAC_CMD_ASSOC_RESP 0x02
113#define MAC_CMD_DISASSOC_NOTIFY 0x03
114#define MAC_CMD_DATA_REQ 0x04
115#define MAC_CMD_PANID_CONFLICT 0x05
116#define MAC_CMD_ORPHAN_NOTIFY 0x06
117#define MAC_CMD_BEACON_REQ 0x07
118#define MAC_CMD_COORD_REALIGN 0x08
119#define MAC_CMD_GTS_REQUEST 0x09
120
121#define PAN_ID_COMPR_OFFSET 1
122#define PAN_ID_COMPR_MASK 0x40
123
124#define PAN_ID_OFFSET 4
125
126#define PHR_OFFSET 0
127#define PHR_LENGTH_MASK 0x7f
128
129#define PSDU_OFFSET 1
130
131#define SECURITY_ENABLED_OFFSET 1
132#define SECURITY_ENABLED_BIT 0x08
133#define SECURITY_LEVEL_MASK 0x07
134#define SECURITY_LEVEL_NONE 0x00
135#define SECURITY_LEVEL_MIC_32 0x01
136#define SECURITY_LEVEL_MIC_64 0x02
137#define SECURITY_LEVEL_MIC_128 0x03
138#define SECURITY_LEVEL_ENC_MIC_32 0x05
139#define SECURITY_LEVEL_ENC_MIC_64 0x06
140#define SECURITY_LEVEL_ENC_MIC_128 0x07
141#define SECURITY_LEVEL_MIC_LEVEL_MASK 0x03
142
143#define SRC_ADDR_TYPE_EXTENDED 0xc0
144#define SRC_ADDR_TYPE_NONE 0x00
145#define SRC_ADDR_TYPE_MASK 0xc0
146#define SRC_ADDR_TYPE_OFFSET 2
147#define SRC_ADDR_TYPE_SHORT 0x80
148
149#define SRC_ADDR_OFFSET_SHORT_DST 8
150#define SRC_ADDR_OFFSET_EXTENDED_DST 14
151
152#define DSN_SIZE 1
153#define FCF_SIZE 2
154#define FCS_SIZE 2
155#define FRAME_COUNTER_SIZE 4
156#define IE_HEADER_SIZE 2
157#define IMM_ACK_LENGTH 5
158#define KEY_ID_MODE_1_SIZE 1
159#define KEY_ID_MODE_2_SIZE 5
160#define KEY_ID_MODE_3_SIZE 9
161#define MAX_PACKET_SIZE 127
162#define MIC_32_SIZE 4
163#define MIC_64_SIZE 8
164#define MIC_128_SIZE 16
165#define PAN_ID_SIZE 2
166#define PHR_SIZE 1
167#define SECURITY_CONTROL_SIZE 1
168
169#define AES_CCM_KEY_SIZE 16
170
171#define EXTENDED_ADDRESS_SIZE 8
172#define SHORT_ADDRESS_SIZE 2
173
174#define TURNAROUND_TIME 192UL
175#define CCA_TIME 128UL
176#define ACK_IFS TURNAROUND_TIME
177#define UNIT_BACKOFF_PERIOD (TURNAROUND_TIME + CCA_TIME)
178
179#define PHY_US_PER_SYMBOL 16
180#define PHY_SYMBOLS_PER_OCTET 2
181#define PHY_SHR_SYMBOLS 10
182
183#define PHY_MIN_RECEIVER_SENSITIVITY -85
184
185#define ED_RESULT_MAX 0xff
186
187#define BROADCAST_ADDRESS ((uint8_t[SHORT_ADDRESS_SIZE]) {0xff, 0xff})
188
189#define MIN_SIFS_PERIOD_US 192
190#define MIN_LIFS_PERIOD_US 640
191#define MAX_SIFS_FRAME_SIZE 18
192
193#define NRF_802154_RESERVED_CSMACA_ID (UINT32_MAX - 2)
194#define NRF_802154_RESERVED_DTX_ID (UINT32_MAX - 3)
195
196#define IE_VENDOR_ID 0x00
197#define IE_VENDOR_SIZE_MIN 3
198#define IE_VENDOR_OUI_OFFSET 0
199
200#define IE_VENDOR_THREAD_SUBTYPE_OFFSET 3
201#define IE_VENDOR_THREAD_DATA_OFFSET 4
202#define IE_VENDOR_THREAD_OUI 0xeab89b
203#define IE_VENDOR_THREAD_SIZE_MIN 4
204
205#define IE_VENDOR_THREAD_ACK_PROBING_ID 0x00
206#define IE_VENDOR_THREAD_ACK_SIZE_MIN 5
207#define IE_VENDOR_THREAD_ACK_SIZE_MAX 6
208#define IE_VENDOR_THREAD_RSSI_TOKEN 0x01
209#define IE_VENDOR_THREAD_MARGIN_TOKEN 0x02
210#define IE_VENDOR_THREAD_LQI_TOKEN 0x03
211#define IE_VENDOR_THREAD_RSSI_FLOOR -130
212#define IE_VENDOR_THREAD_MARGIN_FLOOR 0
213#define IE_VENDOR_THREAD_RSSI_CEIL 0
214#define IE_VENDOR_THREAD_MARGIN_CEIL 130
215#define IE_VENDOR_THREAD_CST_ID 0x02
216#define IE_VENDOR_THREAD_CST_SIZE 8
217#define IE_CSL_SYMBOLS_PER_UNIT 10
218#define IE_CSL_PERIOD_MAX 0xffff
219#define IE_CSL_SIZE_MIN 4
220#define IE_CSL_ID 0x1a
221
222#define IE_HT1 0x7e
223#define IE_HT2 0x7f
224#define IE_LENGTH_MASK 0x7f
225#define IE_LENGTH_OFFSET 0x00
226#define IE_ID_OFFSET_0 0x00
227#define IE_ID_OFFSET_1 0x01
228#define IE_DATA_OFFSET 0x02
229#define IE_HEADER_ELEMENT_ID_OFFSET 0x07
230
231typedef enum
232{
241
242#endif // NRF_802154_CONST_H_
req_originator_t
Definition: nrf_802154_const.h:232
@ REQ_ORIG_IFS
Definition: nrf_802154_const.h:239
@ REQ_ORIG_HIGHER_LAYER
Definition: nrf_802154_const.h:233
@ REQ_ORIG_CSMA_CA
Definition: nrf_802154_const.h:236
@ REQ_ORIG_DELAYED_TRX
Definition: nrf_802154_const.h:238
@ REQ_ORIG_RSCH
Definition: nrf_802154_const.h:235
@ REQ_ORIG_ACK_TIMEOUT
Definition: nrf_802154_const.h:237
@ REQ_ORIG_CORE
Definition: nrf_802154_const.h:234