Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
ieee_802_15_4.h
Go to the documentation of this file.
1 
5 /*
6  * Copyright (c) 2019, Cascoda Ltd.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
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  * 3. Neither the name of the copyright holder nor the
17  * names of its contributors may be used to endorse or promote products
18  * derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
43 #ifndef IEEE_802_15_4_H
44 #define IEEE_802_15_4_H
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
51 {
58 
64 
66 #if CASCODA_CA_VER >= 8212
67  MAX_DATA_SIZE = 121,
68 #else
70 #endif // CASCODA_CA_VER >= 8212
71 
74  M_ValidChannels = 0x07FFF800,
75 
77  MAC_BROADCAST_ADDRESS = 0xFFFF
78 };
79 
81 typedef enum mac_status
82 {
83  MAC_SUCCESS = 0x00,
84  MAC_ERROR = 0x01,
85  MAC_CANCELLED = 0x02,
94  MAC_DENIED = 0xE2,
101  MAC_NO_ACK = 0xE9,
103  MAC_NO_DATA = 0xEB,
123 #if CASCODA_CA_VER >= 8212
124  MAC_UNAVAILABLE_DEVICE = 0xDA,
125  MAC_SCHEDULING_FAILURE = 0xFE,
126 #endif // CASCODA_CA_VER >= 8212
128 
131 {
135  MAC_MODE_LONG_ADDR = 0x03
136 };
137 
140 {
141 #if CASCODA_CA_VER >= 8212
142  TXOPT0_ACKREQ = 0x01,
143  TXOPT0_GTS = 0x02,
144  TXOPT0_INDIRECT = 0x04,
145  TXOPT0_SCH = 0x08,
146  TXOPT0_SPECIFIC_CHANNEL = 0x10,
147  TXOPT0_NS_SECURE_INDIRECT = 0x20,
148  TXOPT0_NS_FPEND = 0x40,
149  TXOPT0_NS_THREADNONCE = 0x80,
150 
151  // Tx options for v2015 only:
152  TXOPT1_2015_FRAME = 0x01,
153  TXOPT1_SN_SUPP = 0x02,
154  TXOPT1_PANID_SUPP = 0x04,
155  TXOPT1_SENDMPF = 0x08,
156  TXOPT1_CSLIE = 0x10,
157 #else
158  TXOPT_ACKREQ = 0x01,
159  TXOPT_GTS = 0x02,
160  TXOPT_INDIRECT = 0x04,
162  TXOPT_NS_FPEND = 0x40,
164 #endif // CASCODA_CA_VER >= 8212
165 };
166 
173 {
175  ACTIVE_SCAN = 0x01,
176  PASSIVE_SCAN = 0x02,
177  ORPHAN_SCAN = 0x03
178 };
179 
182 {
197  SCAN_DURATION_252S = 14
198 };
199 
202 {
207 };
208 
211 {
220  CMD_GTS_REQ = 9
221 };
222 
225 {
229 };
230 
233 {
236 };
237 
240 {
244  phyCCAMode = 0x03,
249 
252 
262  macBSN = 0x49,
265  macDSN = 0x4c,
266  macGTSPermit = 0x4d,
268  macMinBE = 0x4f,
269  macPANId = 0x50,
276  macMaxBE = 0x57,
283 #if CASCODA_CA_VER >= 8211
284  macMinLIFSPeriod = 0x5E,
285  macMinSIFSPeriod = 0x5F,
286 #endif // CASCODA_CA_VER >= 8211
287 
288 #if CASCODA_CA_VER >= 8212
289  macTimestamp = 0x60,
290  macCslPeriod = 0x61,
291  macCslMargin = 0x62,
292  macCslNextTimestamp = 0x63,
293 #endif // CASCODA_CA_VER >= 8212
294 
296 #if CASCODA_CA_VER >= 8212
297  macPibLast = macCslNextTimestamp,
298 #elif CASCODA_CA_VER >= 8211
299  macPibLast = macMinSIFSPeriod,
300 #endif // CASCODA_CA_VER >= 8212
301 
302  macKeyTable = 0x71,
306 
307 #if CASCODA_CA_VER >= 8212
308  macKeyLookupTable = 0x75,
309  macKeyLookupTableEntries = 0x76,
310  macCommandIdSecurityLevelTable = 0x79,
311  macCommandIdSecurityLevelTableEntries = 0x7a,
312  macIESecurityLevelTable = 0x7b,
313  macIESecurityLevelTableEntries = 0x7c,
314  macSecurityLevelExemptionTable = 0x7d,
315  macSecurityLevelExemptionTableEntries = 0x7e,
316  macFrameCounter = 0x7f,
318  macAutoRequestLookupDataIndex = 0x81,
319  macUseAutoReqForEnhAck = 0x82,
320  macEnhAckIeSec = 0x83,
321  macIndicateSecurityDroppedFrames = 0x84,
322 
324  macSecPibLast = macIndicateSecurityDroppedFrames,
325 
326  macExtendedAddress = 0xFF /* Non-standard IEEE address */
327 #else
338 
341 
342  nsIEEEAddress = 0xFF /* Non-standard IEEE address */
343 #endif // CASCODA_CA_VER >= 8212
344 };
345 
346 #ifdef __cplusplus
347 }
348 #endif
349 
354 #endif // IEEE_802_15_4_H
mac_constants
Definition: ieee_802_15_4.h:51
mac_status
MAC Status Codes (see 802.15.4 2006 spec table 78)
Definition: ieee_802_15_4.h:82
mlme_scan_type
MAC ScanType Parameter for MLME_SCAN Request and Confirm.
Definition: ieee_802_15_4.h:173
ca821x_scan_durations
Real time translations for MLME-SCAN ScanDuration (per channel)
Definition: ieee_802_15_4.h:182
mac_frame_type
Enumeration of different MAC Frame Types.
Definition: ieee_802_15_4.h:202
mac_disassociate_reason
Reason for disassociation (see 802.15.4-2006 7.3.3.2)
Definition: ieee_802_15_4.h:233
enum mac_status ca_mac_status
MAC Status Codes (see 802.15.4 2006 spec table 78)
mac_association_status
Association status (see 802.15.4-2006 Table 83)
Definition: ieee_802_15_4.h:225
pib_attribute
PHY/MAC PIB Attribute Enumerations.
Definition: ieee_802_15_4.h:240
mac_cmd_frame_id
MAC Command Frame Identifiers.
Definition: ieee_802_15_4.h:211
MAC_TXOPT
Enumeration of different MAC TxOptions.
Definition: ieee_802_15_4.h:140
mac_addr_mode
MAC Address Mode Definitions.
Definition: ieee_802_15_4.h:131
@ aTurnaroundTime
Definition: ieee_802_15_4.h:55
@ aSymbolPeriod_us
Definition: ieee_802_15_4.h:56
@ aMaxMACPayloadSize
Definition: ieee_802_15_4.h:54
@ aMaxPHYPacketSize
Definition: ieee_802_15_4.h:52
@ MAC_BROADCAST_ADDRESS
Definition: ieee_802_15_4.h:77
@ M_ValidChannels
Definition: ieee_802_15_4.h:74
@ aNumSuperframeSlots
Definition: ieee_802_15_4.h:57
@ aMaxBeaconPayloadLength
Definition: ieee_802_15_4.h:62
@ aBaseSuperframeDuration
Definition: ieee_802_15_4.h:60
@ aUnitBackoffPeriod
Definition: ieee_802_15_4.h:63
@ MAX_ATTRIBUTE_SIZE
Definition: ieee_802_15_4.h:65
@ MAX_FRAME_DURATION
Definition: ieee_802_15_4.h:76
@ aBaseSlotDuration
Definition: ieee_802_15_4.h:59
@ M_MinimumChannel
Definition: ieee_802_15_4.h:72
@ aMaxMACSafePayloadSize
Definition: ieee_802_15_4.h:53
@ M_MaximumChannel
Definition: ieee_802_15_4.h:73
@ aMaxBeaconOverhead
Definition: ieee_802_15_4.h:61
@ MAX_DATA_SIZE
Definition: ieee_802_15_4.h:69
@ MAC_LIMIT_REACHED
Definition: ieee_802_15_4.h:118
@ MAC_NO_SHORT_ADDRESS
Definition: ieee_802_15_4.h:104
@ MAC_NO_ACK
Definition: ieee_802_15_4.h:101
@ MAC_UNAVAILABLE_KEY
Definition: ieee_802_15_4.h:111
@ MAC_PAN_ID_CONFLICT
Definition: ieee_802_15_4.h:106
@ MAC_COUNTER_ERROR
Definition: ieee_802_15_4.h:87
@ MAC_DISABLE_TRX_FAILURE
Definition: ieee_802_15_4.h:95
@ MAC_UNSUPPORTED_LEGACY
Definition: ieee_802_15_4.h:90
@ MAC_TX_ACTIVE
Definition: ieee_802_15_4.h:110
@ MAC_ON_TIME_TOO_LONG
Definition: ieee_802_15_4.h:114
@ MAC_SYSTEM_ERROR
Definition: ieee_802_15_4.h:122
@ MAC_REALIGNMENT
Definition: ieee_802_15_4.h:107
@ MAC_ERROR
Definition: ieee_802_15_4.h:84
@ MAC_PAST_TIME
Definition: ieee_802_15_4.h:115
@ MAC_SCAN_IN_PROGRESS
Definition: ieee_802_15_4.h:120
@ MAC_FRAME_TOO_LONG
Definition: ieee_802_15_4.h:97
@ MAC_IMPROPER_KEY_TYPE
Definition: ieee_802_15_4.h:88
@ MAC_CANCELLED
Definition: ieee_802_15_4.h:85
@ MAC_BEACON_LOST
Definition: ieee_802_15_4.h:92
@ MAC_OUT_OF_CAP
Definition: ieee_802_15_4.h:105
@ MAC_IMPROPER_SECURITY_LEVEL
Definition: ieee_802_15_4.h:89
@ MAC_READ_ONLY
Definition: ieee_802_15_4.h:119
@ MAC_DENIED
Definition: ieee_802_15_4.h:94
@ MAC_SECURITY_ERROR
Definition: ieee_802_15_4.h:96
@ MAC_SUCCESS
Definition: ieee_802_15_4.h:83
@ MAC_NO_DATA
Definition: ieee_802_15_4.h:103
@ MAC_UNSUPPORTED_SECURITY
Definition: ieee_802_15_4.h:91
@ MAC_SUPERFRAME_OVERLAP
Definition: ieee_802_15_4.h:121
@ MAC_INVALID_ADDRESS
Definition: ieee_802_15_4.h:113
@ MAC_TRANSACTION_EXPIRED
Definition: ieee_802_15_4.h:108
@ MAC_UNSUPPORTED_ATTRIBUTE
Definition: ieee_802_15_4.h:112
@ MAC_CHANNEL_ACCESS_FAILURE
Definition: ieee_802_15_4.h:93
@ MAC_INVALID_GTS
Definition: ieee_802_15_4.h:98
@ MAC_READY_FOR_POLL
Definition: ieee_802_15_4.h:86
@ MAC_INVALID_HANDLE
Definition: ieee_802_15_4.h:99
@ MAC_INVALID_PARAMETER
Definition: ieee_802_15_4.h:100
@ MAC_TRANSACTION_OVERFLOW
Definition: ieee_802_15_4.h:109
@ MAC_TRACKING_OFF
Definition: ieee_802_15_4.h:116
@ MAC_NO_BEACON
Definition: ieee_802_15_4.h:102
@ MAC_INVALID_INDEX
Definition: ieee_802_15_4.h:117
@ ORPHAN_SCAN
Definition: ieee_802_15_4.h:177
@ PASSIVE_SCAN
Definition: ieee_802_15_4.h:176
@ ENERGY_DETECT
Definition: ieee_802_15_4.h:174
@ ACTIVE_SCAN
Definition: ieee_802_15_4.h:175
@ SCAN_DURATION_138MS
Definition: ieee_802_15_4.h:186
@ SCAN_DURATION_998MS
Definition: ieee_802_15_4.h:189
@ SCAN_DURATION_126S
Definition: ieee_802_15_4.h:196
@ SCAN_DURATION_77MS
Definition: ieee_802_15_4.h:185
@ SCAN_DURATION_31S
Definition: ieee_802_15_4.h:194
@ SCAN_DURATION_8S
Definition: ieee_802_15_4.h:192
@ SCAN_DURATION_30MS
Definition: ieee_802_15_4.h:183
@ SCAN_DURATION_46MS
Definition: ieee_802_15_4.h:184
@ SCAN_DURATION_16S
Definition: ieee_802_15_4.h:193
@ SCAN_DURATION_252S
Definition: ieee_802_15_4.h:197
@ SCAN_DURATION_2S
Definition: ieee_802_15_4.h:190
@ SCAN_DURATION_63S
Definition: ieee_802_15_4.h:195
@ SCAN_DURATION_4S
Definition: ieee_802_15_4.h:191
@ SCAN_DURATION_261MS
Definition: ieee_802_15_4.h:187
@ SCAN_DURATION_507MS
Definition: ieee_802_15_4.h:188
@ MAC_FRAME_TYPE_BEACON
Definition: ieee_802_15_4.h:203
@ MAC_FRAME_TYPE_ACK
Definition: ieee_802_15_4.h:205
@ MAC_FRAME_TYPE_COMMAND
Definition: ieee_802_15_4.h:206
@ MAC_FRAME_TYPE_DATA
Definition: ieee_802_15_4.h:204
@ DISASSOC_REASON_EVICT
The coordinator wishes the device to leave the PAN.
Definition: ieee_802_15_4.h:234
@ DISASSOC_REASON_LEAVE
The device wishes to leave the PAN.
Definition: ieee_802_15_4.h:235
@ ASSOC_STATUS_AT_CAPACITY
Definition: ieee_802_15_4.h:227
@ ASSOC_STATUS_SUCCESS
Definition: ieee_802_15_4.h:226
@ ASSOC_STATUS_ACCESS_DENIED
Definition: ieee_802_15_4.h:228
@ macBSN
Definition: ieee_802_15_4.h:262
@ macPANCoordShortAddress
Definition: ieee_802_15_4.h:337
@ macDefaultKeySource
Definition: ieee_802_15_4.h:335
@ macSecPibFirst
Definition: ieee_802_15_4.h:339
@ phyChannelsSupport
Definition: ieee_802_15_4.h:242
@ macBattLifeExtPeriods
Definition: ieee_802_15_4.h:257
@ macRxOnWhenIdle
Definition: ieee_802_15_4.h:271
@ macMinBE
Definition: ieee_802_15_4.h:268
@ macSecurityLevelTableEntries
Definition: ieee_802_15_4.h:329
@ macBeaconTxTime
Definition: ieee_802_15_4.h:261
@ macAutoRequest
Definition: ieee_802_15_4.h:255
@ phyCurrentPage
Definition: ieee_802_15_4.h:245
@ phyCurrentChannel
Definition: ieee_802_15_4.h:241
@ macAckWaitDuration
Definition: ieee_802_15_4.h:253
@ macDeviceTableEntries
Definition: ieee_802_15_4.h:305
@ macDSN
Definition: ieee_802_15_4.h:265
@ macMaxFrameTotalWaitTime
Definition: ieee_802_15_4.h:277
@ macAutoRequestKeySource
Definition: ieee_802_15_4.h:333
@ macResponseWaitTime
Definition: ieee_802_15_4.h:279
@ macPromiscuousMode
Definition: ieee_802_15_4.h:270
@ macMaxFrameRetries
Definition: ieee_802_15_4.h:278
@ phyPibFirst
Definition: ieee_802_15_4.h:250
@ macBattLifeExt
Definition: ieee_802_15_4.h:256
@ phyTransmitPower
Definition: ieee_802_15_4.h:243
@ macFrameCounter
Definition: ieee_802_15_4.h:330
@ nsIEEEAddress
Definition: ieee_802_15_4.h:342
@ macAutoRequestKeyIndex
Definition: ieee_802_15_4.h:334
@ macTransactionPersistenceTime
Definition: ieee_802_15_4.h:274
@ macTimestampSupported
Definition: ieee_802_15_4.h:281
@ macAssociationPermit
Definition: ieee_802_15_4.h:254
@ phyPibLast
Definition: ieee_802_15_4.h:251
@ macAssociatedPANCoord
Definition: ieee_802_15_4.h:275
@ macPANId
Definition: ieee_802_15_4.h:269
@ macDeviceTable
Definition: ieee_802_15_4.h:304
@ phySHRDuration
Definition: ieee_802_15_4.h:247
@ phyCCAMode
Definition: ieee_802_15_4.h:244
@ macSyncSymbolOffset
Definition: ieee_802_15_4.h:280
@ macSecurityEnabled
Definition: ieee_802_15_4.h:282
@ macCoordExtendedAddress
Definition: ieee_802_15_4.h:263
@ macShortAddress
Definition: ieee_802_15_4.h:272
@ macPibFirst
Definition: ieee_802_15_4.h:295
@ macBeaconPayloadLength
Definition: ieee_802_15_4.h:259
@ macPANCoordExtendedAddress
Definition: ieee_802_15_4.h:336
@ macBeaconOrder
Definition: ieee_802_15_4.h:260
@ macCoordShortAddress
Definition: ieee_802_15_4.h:264
@ macSuperframeOrder
Definition: ieee_802_15_4.h:273
@ macSecPibLast
Definition: ieee_802_15_4.h:340
@ macAutoRequestSecurityLevel
Definition: ieee_802_15_4.h:331
@ macMaxBE
Definition: ieee_802_15_4.h:276
@ macGTSPermit
Definition: ieee_802_15_4.h:266
@ macSecurityLevelTable
Definition: ieee_802_15_4.h:328
@ macAutoRequestKeyIdMode
Definition: ieee_802_15_4.h:332
@ macKeyTable
Definition: ieee_802_15_4.h:302
@ macKeyTableEntries
Definition: ieee_802_15_4.h:303
@ macBeaconPayload
Definition: ieee_802_15_4.h:258
@ macMaxCSMABackoffs
Definition: ieee_802_15_4.h:267
@ phySymbolsPerOctet
Definition: ieee_802_15_4.h:248
@ phyMaxFrameDuration
Definition: ieee_802_15_4.h:246
@ CMD_ASSOCIATION_RSP
Definition: ieee_802_15_4.h:213
@ CMD_DATA_REQ
Definition: ieee_802_15_4.h:215
@ CMD_ASSOCIATION_REQ
Definition: ieee_802_15_4.h:212
@ CMD_BEACON_REQ
Definition: ieee_802_15_4.h:218
@ CMD_DISASSOCIATION_NFY
Definition: ieee_802_15_4.h:214
@ CMD_ORPHAN_NFY
Definition: ieee_802_15_4.h:217
@ CMD_PANID_CONFLICT_NFY
Definition: ieee_802_15_4.h:216
@ CMD_COORD_REALIGN
Definition: ieee_802_15_4.h:219
@ CMD_GTS_REQ
Definition: ieee_802_15_4.h:220
@ TXOPT_GTS
Use guaranteed time slot (Not supported)
Definition: ieee_802_15_4.h:159
@ TXOPT_NS_SECURE_INDIRECT
Nonstandard, only send the indirect message in reply to a secure poll.
Definition: ieee_802_15_4.h:161
@ TXOPT_NS_THREADNONCE
Nonstandard, use Thread-specific nonce for mode2 frames.
Definition: ieee_802_15_4.h:163
@ TXOPT_ACKREQ
Request acknowledgement from receiving node.
Definition: ieee_802_15_4.h:158
@ TXOPT_NS_FPEND
Nonstandard, set the frame pending bit on the outgoing frame.
Definition: ieee_802_15_4.h:162
@ TXOPT_INDIRECT
Transmit indirectly.
Definition: ieee_802_15_4.h:160
@ MAC_MODE_RESERVED
reserved
Definition: ieee_802_15_4.h:133
@ MAC_MODE_NO_ADDR
no address
Definition: ieee_802_15_4.h:132
@ MAC_MODE_LONG_ADDR
64-bit extended address
Definition: ieee_802_15_4.h:135
@ MAC_MODE_SHORT_ADDR
16-bit short address
Definition: ieee_802_15_4.h:134