Mistake on this page?
Report an issue in GitHub or email us
pal_bb_154.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief IEEE 802.15.4 MAC Baseband driver interface file.
6  *
7  * Copyright (c) 2016-2019 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 
25 #ifndef PAL_BB_154_H
26 #define PAL_BB_154_H
27 
28 #include "pal_types.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /**************************************************************************************************
35  Macros
36 **************************************************************************************************/
37 
38 /*! \brief Minimum number of receive buffers. */
39 #define PAL_BB_154_MIN_RX_BUF_CNT 2 /*!< PAL_BB_154_MIN_RX_BUF_CNT. */
40 #define PAL_BB_154_RX_BUF_CNT 2 /*!< PAL_BB_154_RX_BUF_CNT. */
41 
42 /*! \brief Driver status flags. */
43 enum
44 {
45  PAL_BB_154_FLAG_RX_ACK_CMPL = (1 << 0), /*!< Rx ack. completed. */
46  PAL_BB_154_FLAG_TX_ACK_CMPL = (1 << 1), /*!< Tx ack. completed. */
47  PAL_BB_154_FLAG_RX_ACK_START = (1 << 2), /*!< Rx ack. started. */
48  PAL_BB_154_FLAG_TX_ACK_START = (1 << 3), /*!< Tx ack. started. */
49 };
50 
51 /*! \brief Operation flags. */
52 enum
53 {
54  PAL_BB_154_FLAG_TX_AUTO_RX_ACK = (1 << 0), /*!< Automatically wait for ACK after transmit completes. */
55  PAL_BB_154_FLAG_RX_AUTO_TX_ACK = (1 << 1), /*!< Automatically send ACK after receive completes. */
56  PAL_BB_154_FLAG_RX_WHILE_ED = (1 << 2), /*!< Receive any packet detected while performing ED. */
57  PAL_BB_154_FLAG_DIS_CCA = (1 << 3), /*!< Disable CCA before transmit. */
58  PAL_BB_154_FLAG_RAW = (1 << 4) /*!< Treat as raw frame */
59 };
60 
61 /*! \brief Receive flags. */
62 enum
63 {
64  PAL_BB_154_RX_FLAG_GO_IDLE = (1 << 0), /*!< Can go idle. */
65  PAL_BB_154_RX_FLAG_SET_ACK_FP = (1 << 1) /*!< Set frame pending in ack. */
66 };
67 
68 /**************************************************************************************************
69  MAC addressing modes
70  802.15.4-2006 Table 80
71 **************************************************************************************************/
72 
73 /*! \brief Addressing mode. */
74 typedef enum
75 {
76  PAL_BB_154_ADDR_MODE_NONE = 0,
77  PAL_BB_154_ADDR_MODE_SHORT = 2,
78  PAL_BB_154_ADDR_MODE_EXTENDED = 3
80 
81 /**************************************************************************************************
82  MAC frame types
83  802.15.4-2006 Table 79
84 **************************************************************************************************/
85 
86 /*! \brief Values of frame type in FC. */
87 typedef enum
88 {
89  PAL_BB_154_FRAME_TYPE_BEACON = 0,
90  PAL_BB_154_FRAME_TYPE_DATA = 1,
91  PAL_BB_154_FRAME_TYPE_ACKNOWLEDGMENT = 2,
92  PAL_BB_154_FRAME_TYPE_MAC_COMMAND = 3,
93  PAL_BB_154_FRAME_TYPE_ILLEGAL4 = 4,
94  PAL_BB_154_FRAME_TYPE_ILLEGAL5 = 5,
95  PAL_BB_154_FRAME_TYPE_ILLEGAL6 = 6,
96  PAL_BB_154_FRAME_TYPE_ILLEGAL7 = 7
98 
99 /**************************************************************************************************
100  MAC command types
101  802.15.4-2006 Table 82
102 **************************************************************************************************/
103 
104 /*! \brief Values of MAC command type. */
105 typedef enum
106 {
107  PAL_BB_154_CMD_FRAME_TYPE_ASSOC_REQ = 1,
108  PAL_BB_154_CMD_FRAME_TYPE_ASSOC_RSP = 2,
109  PAL_BB_154_CMD_FRAME_TYPE_DISASSOC_NTF = 3,
110  PAL_BB_154_CMD_FRAME_TYPE_DATA_REQ = 4,
111  PAL_BB_154_CMD_FRAME_TYPE_PANID_CNFL_NTF = 5,
112  PAL_BB_154_CMD_FRAME_TYPE_ORPHAN_NTF = 6,
113  PAL_BB_154_CMD_FRAME_TYPE_BEACON_REQ = 7,
114  PAL_BB_154_CMD_FRAME_TYPE_COORD_REALIGN = 8,
115  PAL_BB_154_CMD_FRAME_TYPE_GTS_REQ = 9
117 
118 /*! \brief MAC device type (vendor specific). */
119 typedef enum
120 {
121  PAL_BB_154_DEV_TYPE_DEVICE, /*!< Device is not a coordinator */
122  PAL_BB_154_DEV_TYPE_COORD, /*!< Device is a coordinator but not a PAN coordinator */
123  PAL_BB_154_DEV_TYPE_PAN_COORD, /*!< Device is a PAN coordinator */
125 
126 /* \brief Special addresses. */
127 #define PAL_BB_154_BROADCAST_PANID 0xffff
128 #define PAL_BB_154_BROADCAST_ADDR 0xffff
129 #define PAL_BB_154_UNASSIGNED_ADDR 0xffff
130 #define PAL_BB_154_NO_SHT_ADDR 0xfffe
131 #define PAL_BB_154_UNASSIGNED_PAN_ID 0xffff
132 
133 /* \brief Address lengths. */
134 #define PAL_BB_154_SHORT_ADDR_LEN 2
135 #define PAL_BB_154_EXTENDED_ADDR_LEN 8
136 
137 /*! \brief PAL_BB_154_FLAG_TX_RX_AUTO_ACK. */
138 #define PAL_BB_154_FLAG_TX_RX_AUTO_ACK (PAL_BB_154_FLAG_TX_AUTO_RX_ACK | PAL_BB_154_FLAG_RX_AUTO_TX_ACK)
139 
140 /* \brief Symbols to microseconds for 802.15.4-2006 2.4GHz PHY */
141 #define PAL_BB_154_SYMB_TO_US(x) ((x) * 16) /*!< PAL_BB_154_SYMB_TO_US. */
142 #define PAL_BB_154_SYMB_TO_MS(x) (((x) * 16) / 1000) /*!< PAL_BB_154_SYMB_TO_MS. */
143 #define PAL_BB_154_US_TO_SYMB(x) ((x) / 16) /*!< PAL_BB_154_US_TO_SYMB. */
144 
145 /* \brief Transaction persistence time factor */
146 #define PAL_BB_154_TPT_TO_MS(x) (((x) * 15723) >> 10) /*!< 15723/1024 approximates to 15.36 */
147 
148 /*! \brief Energy detect threshold in dBm. */
149 #define PAL_BB_154_ED_THRESHOLD -75 /*!< 10 dBm above 802.15.4 specified -85 dBm */
150 
151 /**************************************************************************************************
152  MAC frame format
153  802.15.4-2006 Section 7.2
154 **************************************************************************************************/
155 
156 /*! \brief Size of frame control in octets. */
157 #define PAL_BB_154_FRAME_CONTROL_LEN 2
158 
159 /*! \brief Size of FCS in octets. */
160 #define PAL_BB_154_FCS_LEN 2
161 
162 /*! \brief FCS initialization value. */
163 #define PAL_BB_154_FCS_INIT_VALUE 0x0000
164 
165 /*! \brief Frame control bits and fields. */
166 #define PAL_BB_154_FC_FRAME_TYPE_SHIFT 0
167 #define PAL_BB_154_FC_FRAME_TYPE_MASK 0x0007 /*!< Bitmask. */
168 #define PAL_BB_154_FC_FRAME_TYPE_CD_MASK 0x0001 /*!< Convenient way of checking if MAC command or data. */
169 #define PAL_BB_154_FC_FRAME_TYPE_CMD_MASK 0x0003 /*!< Convenient way of checking if MAC command. */
170 #define PAL_BB_154_FC_FRAME_TYPE(x) (((x) & PAL_BB_154_FC_FRAME_TYPE_MASK)/*>> PAL_BB_154_FC_FRAME_TYPE_SHIFT*/) /*!< Optimized bit 0. */
171 
172 #define PAL_BB_154_FC_SECURITY_ENABLED_SHIFT 3
173 #define PAL_BB_154_FC_SECURITY_ENABLED_MASK 0x0008
174 #define PAL_BB_154_FC_SECURITY_ENABLED(x) (((x) & PAL_BB_154_FC_SECURITY_ENABLED_MASK) >> PAL_BB_154_FC_SECURITY_ENABLED_SHIFT)
175 
176 #define PAL_BB_154_FC_FRAME_PENDING_SHIFT 4
177 #define PAL_BB_154_FC_FRAME_PENDING_MASK 0x0010
178 #define PAL_BB_154_FC_FRAME_PENDING(x) (((x) & PAL_BB_154_FC_FRAME_PENDING_MASK) >> PAL_BB_154_FC_FRAME_PENDING_SHIFT)
179 
180 #define PAL_BB_154_FC_ACK_REQUEST_SHIFT 5
181 #define PAL_BB_154_FC_ACK_REQUEST_MASK 0x0020
182 #define PAL_BB_154_FC_ACK_REQUEST(x) (((x) & PAL_BB_154_FC_ACK_REQUEST_MASK) >> PAL_BB_154_FC_ACK_REQUEST_SHIFT)
183 
184 #define PAL_BB_154_FC_PAN_ID_COMP_SHIFT 6
185 #define PAL_BB_154_FC_PAN_ID_COMP_MASK 0x0040
186 #define PAL_BB_154_FC_PAN_ID_COMP(x) (((x) & PAL_BB_154_FC_PAN_ID_COMP_MASK) >> PAL_BB_154_FC_PAN_ID_COMP_SHIFT)
187 
188 #define PAL_BB_154_FC_DST_ADDR_MODE_SHIFT 10
189 #define PAL_BB_154_FC_DST_ADDR_MODE_MASK 0x0C00
190 #define PAL_BB_154_FC_DST_ADDR_MODE(x) (((x) & PAL_BB_154_FC_DST_ADDR_MODE_MASK) >> PAL_BB_154_FC_DST_ADDR_MODE_SHIFT)
191 
192 #define PAL_BB_154_FC_FRAME_VERSION_SHIFT 12
193 #define PAL_BB_154_FC_FRAME_VERSION_MASK 0x3000
194 #define PAL_BB_154_FC_FRAME_VERSION(x) (((x) & PAL_BB_154_FC_FRAME_VERSION_MASK) >> PAL_BB_154_FC_FRAME_VERSION_SHIFT)
195 
196 #define PAL_BB_154_FC_SRC_ADDR_MODE_SHIFT 14
197 #define PAL_BB_154_FC_SRC_ADDR_MODE_MASK 0xC000
198 #define PAL_BB_154_FC_SRC_ADDR_MODE(x) (((x) & PAL_BB_154_FC_SRC_ADDR_MODE_MASK) >> PAL_BB_154_FC_SRC_ADDR_MODE_SHIFT)
199 
200 /*! \brief Mask for checking legacy security */
201 #define PAL_BB_154_FC_LEGACY_SEC_TEST(x) (((x) & (PAL_BB_154_FC_SECURITY_ENABLED_MASK | PAL_BB_154_FC_FRAME_VERSION_MASK)) == PAL_BB_154_FC_SECURITY_ENABLED_MASK)
202 
203 /*! \brief Mask for checking frame pending processing based on ack. requested and being a MAC command frame */
204 #define PAL_BB_154_FC_FRAME_TYPE_FP_TEST (PAL_BB_154_FC_ACK_REQUEST_MASK | PAL_BB_154_FC_FRAME_TYPE_CMD_MASK)
205 
206 /*! \brief Mask for checking ack. sending based on ack. requested and being a MAC command or data frame */
207 #define PAL_BB_154_FC_FRAME_TYPE_ACK_TEST (PAL_BB_154_FC_ACK_REQUEST_MASK | PAL_BB_154_FC_FRAME_TYPE_CD_MASK)
208 
209 #define PAL_BB_154_SCAN_MAX_PD_ENTRIES 16 /*!< Note - arbitrary number and could make it easy by sending all beacons using beacon notify indication. */
210 #define PAL_BB_154_SCAN_MAX_ED_ENTRIES 16 /*!< Note - can't have more than 16 for 2.4GHz. */
211 
212 /**************************************************************************************************
213  PHY definitions
214 **************************************************************************************************/
215 
216 /*! \brief Symbol duration in microseconds (2450 MHz O-QPSK). */
217 #define PAL_BB_154_SYMBOL_DURATION 16
218 
219 /*! \brief ED duration in symbols (802.15.4-2006 6.9.7). */
220 #define PAL_BB_154_ED_DURATION 8
221 
222 /*! \brief The number of symbols per octets for the current PHY (2450 MHz O-QPSK). */
223 #define PAL_BB_154_SYMBOLS_PER_OCTET 2
224 
225 /**************************************************************************************************
226  Preamble field length
227  802.15.4-2006 Table 19
228 **************************************************************************************************/
229 
230 /*! \brief Preamble field length in symbols (2450 MHz O-QPSK). */
231 #define PAL_BB_154_PREAMBLE_FIELD_LENGTH 8
232 
233 /*! \brief SFD field length in symbols (2450 MHz O-QPSK). */
234 #define PAL_BB_154_SFD_FIELD_LENGTH 2
235 
236 /**************************************************************************************************
237  PHY constants
238  802.15.4-2006 Table 22
239 **************************************************************************************************/
240 
241 /*! \brief The maximum PSDU size (in octets) the PHY shall be able to receive. */
242 #define PAL_BB_154_aMaxPHYPacketSize 127
243 
244 /*! \brief RX-to-TX or TX-to-RX maximum turnaround time (in symbol periods). */
245 #define PAL_BB_154_aTurnaroundTime 12
246 
247 /**************************************************************************************************
248  MAC sublayer constants
249  802.15.4-2006 Table 85
250 **************************************************************************************************/
251 
252 /*! \brief SHR duration for 802.15.4-2006. (2.4GHz PHY) */
253 #define PAL_BB_154_phySHRDuration 10
254 
255 /*! \brief Symbols per octet for 802.15.4-2006. (2.4GHz PHY) */
256 #define PAL_BB_154_phySymbolsPerOctet 2
257 
258 /*! \brief The number of symbols forming a superframe slot when the superframe order is equal to 0. */
259 #define PAL_BB_154_aBaseSlotDuration 60
260 
261 /*! \brief The number of symbols forming a superframe when the superframe order is equal to 0. */
262 #define PAL_BB_154_aBaseSuperframeDuration (PAL_BB_154_aBaseSlotDuration * PAL_BB_154_aNumSuperframeSlots)
263 
264 /* PAL_BB_154_aExtendedAddress Now a vendor-specific PIB attribute */
265 
266 /*! \brief The number of superframes in which a GTS descriptor exists in the beacon frame of the PAN
267  * coordinator. */
268 #define PAL_BB_154_aGTSDescPersistenceTime 4
269 
270 /*! \brief The maximum number of octets added by the MAC sublayer to the MAC payload of a beacon frame. */
271 #define PAL_BB_154_aMaxBeaconOverhead 75
272 
273 /*! \brief The maximum beacon payload length. */
274 #define PAL_BB_154_aMaxBeaconPayloadLength (PAL_BB_154_aMaxPHYPacketSize - PAL_BB_154_aMaxBeaconOverhead)
275 
276 /*! \brief The number of consecutive lost beacons that will cause the MAC sublayer of a receiving device
277  * to declare a loss of synchronization. */
278 #define PAL_BB_154_aMaxLostBeacons 4
279 
280 /*! \brief The maximum number of octets added by the MAC sublayer to the PSDU without security. */
281 #define PAL_BB_154_aMaxMPDUUnsecuredOverhead 25
282 
283 /*! \brief The maximum size of an MPDU, in octets, that can be followed by a SIFS period. */
284 #define PAL_BB_154_aMaxSIFSFrameSize 18
285 
286 /*! \brief The minimum number of symbols forming the CAP.
287  * This ensures that MAC commands can still be
288  * transferred to devices when GTSs are being used. An exception to this minimum shall be allowed
289  * for the accommodation of the temporary increase in the beacon frame length needed to perform GTS
290  * maintenance. */
291 #define PAL_BB_154_aMinCAPLength 440
292 
293 /*! \brief The minimum number of octets added by the MAC sublayer to the PSDU. */
294 #define PAL_BB_154_aMinMPDUOverhead 9
295 
296 /*! \brief The number of slots contained in any superframe. */
297 #define PAL_BB_154_aNumSuperframeSlots 16
298 
299 /*! \brief The number of symbols forming the basic time period used by the CSMA-CA algorithm. */
300 #define PAL_BB_154_aUnitBackoffPeriod 20
301 
302 #define PAL_BB_154_RX_ACK_TIMEOUT_SYMB PAL_BB_154_aUnitBackoffPeriod + \
303  PAL_BB_154_aTurnaroundTime + \
304  PAL_BB_154_phySHRDuration + \
305  (6 * PAL_BB_154_phySymbolsPerOctet)
306 
307 /**************************************************************************************************
308  Data Types
309 **************************************************************************************************/
310 
311 /*! \brief 802.15.4 channelization parameters. */
312 typedef struct
313 {
314  uint8_t channel; /*!< Channel. */
315  int8_t txPower; /*!< Transmit power, units dBm. */
317 
318 /*! \brief Transmit complete ISR callback signature. */
319 typedef void (*PalBb154TxIsr_t)(uint8_t flags);
320 
321 /*! \brief Frame pending check callback. */
322 typedef bool_t (*PalBb154FPIsr_t)(uint8_t srcAddrMode, uint64_t srcAddr);
323 
324 /*! \brief Receive complete ISR callback signature. */
325 typedef uint8_t (*PalBb154RxIsr_t)(uint8_t *pBuf, uint16_t len, int8_t rssi, uint32_t timestamp, uint8_t flags);
326 
327 /*! \brief CCA or energy detect complete ISR callback signature. */
328 typedef void (*PalBb154EdIsr_t)(int8_t rssi);
329 
330 /*! \brief Driver error callback signature. */
331 typedef void (*PalBb154Err_t)(uint8_t status);
332 
333 /*! \brief Buffer free callback signature. */
334 typedef void *(*PalBb154Alloc_t)(uint16_t len);
335 
336 /*! \brief Buffer free callback signature. */
337 typedef void (*PalBb154Free_t)(void *pBuf);
338 
339 /*! \brief Operation parameters. */
340 typedef struct
341 {
342  uint8_t flags; /*!< Baseband driver operation flags. */
343  PalBb154TxIsr_t txCback; /*!< Transmit complete ISR callback. */
344  PalBb154FPIsr_t fpCback; /*!< Frame pending check callback. */
345  PalBb154RxIsr_t rxCback; /*!< Receive complete ISR callback. */
346  PalBb154EdIsr_t edCback; /*!< ED complete ISR callback. */
347  PalBb154Err_t errCback; /*!< Error callback. */
349 
350 /*! \brief Transmit buffer descriptor. */ /* Note - must be packed so buffer immediately follows length */
351 typedef struct PalBb154TxBufDesc
352 {
353  uint8_t pad[2]; /*!< Padding to make structure uint32 aligned */
354  uint8_t handle; /*!< Handle used for data frames only */
355  uint8_t len; /*!< Length of frame, which is concatenated to this header */
357 
358 /*! \brief PAL_BB_154_TX_FRAME_PTR */
359 #define PAL_BB_154_TX_FRAME_PTR(x) ((uint8_t *)(((PalBb154TxBufDesc_t *)(x))+1))
360 
361 /*! \brief Baseband driver statistics. */
362 typedef struct
363 {
364  uint32_t txSchMiss; /*!< Number of missed Rx. */
365  uint32_t rxSchMiss; /*!< Number of missed Tx. */
366  uint32_t txPkt; /*!< Number of successful Tx. */
367  uint32_t txDmaFail; /*!< Number of Tx DMA failures. */
368  uint32_t rxPkt; /*!< Number of successful Rx. */
369  uint32_t rxPktTimeout; /*!< Number of Rx timeouts. */
370  uint32_t rxFilterFail; /*!< Number of Rx filter failures. */
371  uint32_t rxCrcFail; /*!< Number of CRC failures. */
372  uint32_t rxDmaFail; /*!< Number of Rx DMA failures. */
373  uint32_t edReq; /*!< Number of ED requests. */
374  uint32_t ed; /*!< Number of successful ED. */
375  uint32_t edSchMiss; /*!< Number of missed ED. */
376  uint32_t ccaSchMiss; /*!< Number of missed CCA. */
377  uint32_t txReq; /*!< Number of Tx requests. */
378  uint32_t rxReq; /*!< Number of Rx requests. */
380 
381 /*! \brief MAC PIB for driver. */
382 typedef struct PalBb154DrvPib_tag
383 {
384  uint64_t extAddr; /* Vendor-specific PIB attribute */
385  uint16_t vsCRCOverride; /* Vendor-specific PIB attribute */
386  uint16_t panId;
387  uint16_t shortAddr;
388  uint8_t deviceType; /* Vendor-specific PIB attribute */
389  uint8_t disableCCA; /* Vendor-specific PIB attribute */
390  uint8_t minBE;
391  uint8_t maxBE;
392  uint8_t maxCSMABackoffs;
393  uint8_t maxFrameRetries;
394  uint8_t promiscuousMode;
395  uint8_t rxEnabled;
396  uint8_t rxOnWhenIdle;
398 
399 /**************************************************************************************************
400  Function Declarations
401 **************************************************************************************************/
402 
403 /*************************************************************************************************/
404 /*!
405  * \brief Initialize the 802.15.4 baseband driver.
406  *
407  * One-time initialization of baseband resources. This routine can be used to setup software
408  * driver resources, load RF trim parameters and execute RF calibrations.
409  *
410  * This routine should block until the BB hardware is completely initialized.
411  */
412 /*************************************************************************************************/
413 void PalBb154Init(void);
414 
415 /*************************************************************************************************/
416 /*!
417  * \brief Register callbacks for the 802.15.4 baseband driver.
418  */
419 /*************************************************************************************************/
420 void PalBb154Register(PalBb154Alloc_t allocCback, PalBb154Free_t freeCback);
421 
422 /*************************************************************************************************/
423 /*!
424  * \brief Enable the BB hardware.
425  *
426  * This routine brings the BB hardware out of low power (enable power and clocks). This routine is
427  * called just before a 802.15.4 BOD is executed.
428  */
429 /*************************************************************************************************/
430 void PalBb154Enable(void);
431 
432 /*************************************************************************************************/
433 /*!
434  * \brief Disable the BB hardware.
435  *
436  * This routine signals the BB hardware to go into low power (disable power and clocks). This
437  * routine is called after all 802.15.4 operations are disabled.
438  */
439 /*************************************************************************************************/
440 void PalBb154Disable(void);
441 
442 /*************************************************************************************************/
443 /*!
444  * \brief Set channelization parameters.
445  *
446  * \param pParam Channelization parameters.
447  *
448  * Calling this routine will set parameters for all future transmit, receive, and energy detect
449  * operations until this routine is called again providing new parameters.
450  *
451  * \note \a pParam is not guaranteed to be static and is only valid in the context of the
452  * call to this routine. Therefore parameters requiring persistence should be copied.
453  */
454 /*************************************************************************************************/
455 void PalBb154SetChannelParam(const PalBb154Chan_t *pParam);
456 
457 /*************************************************************************************************/
458 /*!
459  * \brief Reset channelization parameters.
460  *
461  * Calling this routine will reset (clear) the channelization parameters.
462  */
463 /*************************************************************************************************/
464 void PalBb154ResetChannelParam(void);
465 
466 /*************************************************************************************************/
467 /*!
468  * \brief Set the operation parameters.
469  *
470  * \param pOpParam Operations parameters.
471  *
472  * Calling this routine will set parameters for all future transmit, receive, ED, and CCA
473  * operations until this routine is called again providing new parameters.
474  *
475  * \note \a pOpParam is not guaranteed to be static and is only valid in the context of the
476  * call to this routine. Therefore parameters requiring persistence should be copied.
477  */
478 /*************************************************************************************************/
479 void PalBb154SetOpParams(const PalBb154OpParam_t *pOpParam);
480 
481 /*************************************************************************************************/
482 /*!
483  * \brief Get Driver PIB.
484  *
485  * \return Driver PIB pointer.
486  *
487  * Calling this routine retun a pointer to the driver PIB.
488  */
489 /*************************************************************************************************/
491 
492 /*************************************************************************************************/
493 /*!
494  * \brief Flushes PIB attributes to hardware.
495  *
496  * Calling this routine will flush all PIB attributes that have a hardware counterpart to the
497  * respective registers in hardware.
498  */
499 /*************************************************************************************************/
500 void PalBb154FlushPIB(void);
501 
502 /*************************************************************************************************/
503 /*!
504  * \brief Clear all received buffers (active and queued).
505  *
506  * Calling this routine will clear and free the active receive buffer (if any) and all queued
507  * receive buffers. This should only be called when the operation is terminating.
508  */
509 /*************************************************************************************************/
510 void PalBb154ClearRxBufs(void);
511 
512 /*************************************************************************************************/
513 /*!
514  * \brief Reclaim the buffer associated with the received frame.
515  *
516  * \param pRxFrame Pointer to the received frame.
517  *
518  * \return Total number of receive buffers queued.
519  *
520  * Calling this routine will put the buffer associated with the received frame back onto the
521  * receive queue. Note the actual buffer pointer may not be the same as the frame pointer
522  * dependent on driver implementation. If the queue is empty when the driver expects to
523  * transition to the receive state, the driver will instead move into the off state.
524  */
525 /*************************************************************************************************/
526 uint8_t PalBb154ReclaimRxFrame(uint8_t *pRxFrame);
527 
528 /*************************************************************************************************/
529 /*!
530  * \brief Build receive buffer queue
531  *
532  * \param len Length of each receive buffer.
533  * \param num Number of buffers to load into the queue.
534  */
535 /*************************************************************************************************/
536 void PalBb154BuildRxBufQueue(uint8_t num);
537 
538 /*************************************************************************************************/
539 /*!
540  * \brief Get payload pointer.
541  *
542  * \param pFrame Frame buffer pointing to first octet of frame
543  * \param fctl Frame control field
544  *
545  * \return Pointer to frame payload or NULL if illegal addr mode combo.
546  *
547  * Obtains the source and destination addresses from the frame. If either parameter is NULL,
548  * simply skips past the fields
549  */
550 /*************************************************************************************************/
551 uint8_t *PalBb154GetPayloadPtr(uint8_t *pFrame, uint16_t fctl);
552 
553 /*************************************************************************************************/
554 /*!
555  * \brief Transmit a packet.
556  *
557  * \param pDesc Chain of transmit buffer descriptors.
558  * \param cnt Number of descriptors.
559  * \param due Due time for transmit (if \a now is FALSE).
560  * \param now TRUE if packet should be transmitted with minimal delay.
561  */
562 /*************************************************************************************************/
563 void PalBb154Tx(PalBb154TxBufDesc_t *pDesc, uint8_t cnt, uint32_t due, bool_t now);
564 
565 /*************************************************************************************************/
566 /*!
567  * \brief Receive a packet.
568  *
569  * \param due Due time for receive (if \a now is FALSE).
570  * \param now TRUE if packet should be received with minimal delay.
571  * \param timeout Timeout.
572  */
573 /*************************************************************************************************/
574 void PalBb154Rx(uint32_t due, bool_t now, uint32_t timeout);
575 
576 /*************************************************************************************************/
577 /*!
578  * \brief Perform energy detect.
579  *
580  * \param due Due time for energy detect (if \a now is FALSE).
581  * \param now TRUE if energy detect should occur minimal delay.
582  *
583  * Perform energy detect and return energy level to assess channel status.
584  */
585 /*************************************************************************************************/
586 void PalBb154Ed(uint32_t due, bool_t now);
587 
588 /*************************************************************************************************/
589 /*!
590  * \brief Cancel any pending operation.
591  *
592  * \return TRUE if pending operation could be cancelled.
593  *
594  * Cancel any pending operation.
595  */
596 /*************************************************************************************************/
597 bool_t PalBb154Off(void);
598 
599 /*************************************************************************************************/
600 /*!
601  * \brief Convert RSSI to LQI.
602  *
603  * \return LQI value.
604  *
605  * Converts RSSI value into equivalent LQI value from 0 to 0xFF.
606  */
607 /*************************************************************************************************/
608 uint8_t PalBb154RssiToLqi(int8_t rssi);
609 
610 /*************************************************************************************************/
611 /*!
612  * \brief Return the last received RSSI.
613  *
614  * \param pBuf Storage for results -- first element is integer dBm, second is fractional
615  */
616 /*************************************************************************************************/
617 void PalBb154GetLastRssi(uint8_t *pBuf);
618 
619 /*************************************************************************************************/
620 /*!
621  * \brief Enter Continuous Transmit mode.
622  *
623  * \param rfChan Physical channel number
624  * \param modulation Modulation type (0 disables)
625  * \param txPhy PHY type
626  * \param power Pransmit power (dBm)
627  */
628 /*************************************************************************************************/
629 void PalBb154ContinuousTx(uint8_t rfChan, uint8_t modulation, uint8_t txPhy, int8_t power);
630 
631 /*************************************************************************************************/
632 /*!
633  * \brief Enter Continuous Receive mode.
634  *
635  * \param rfChan Physical channel number
636  * \param rxPhy PHY type
637  */
638 /*************************************************************************************************/
639 void PalBb154ContinuousRx(uint8_t rfChan, uint8_t rxPhy);
640 
641 /*************************************************************************************************/
642 /*!
643  * \brief Stop Continous Transmit or Receive mode.
644  */
645 /*************************************************************************************************/
646 void PalBb154ContinuousStop(void);
647 
648 /*************************************************************************************************/
649 /*!
650  * \brief Get baseband driver statistics.
651  *
652  * \param pStats Storage for statistics.
653  */
654 /*************************************************************************************************/
656 
657 #ifdef __cplusplus
658 };
659 #endif
660 
661 #endif /* PAL_BB_154_H */
void PalBb154Init(void)
Initialize the 802.15.4 baseband driver.
uint32_t rxDmaFail
Definition: pal_bb_154.h:372
void PalBb154Ed(uint32_t due, uint8_t now)
Perform energy detect.
uint32_t rxCrcFail
Definition: pal_bb_154.h:371
void(* PalBb154Err_t)(uint8_t status)
Driver error callback signature.
Definition: pal_bb_154.h:331
void PalBb154BuildRxBufQueue(uint8_t num)
Build receive buffer queue.
struct PalBb154TxBufDesc PalBb154TxBufDesc_t
Transmit buffer descriptor.
void PalBb154Register(PalBb154Alloc_t allocCback, PalBb154Free_t freeCback)
Register callbacks for the 802.15.4 baseband driver.
void(* PalBb154EdIsr_t)(int8_t rssi)
CCA or energy detect complete ISR callback signature.
Definition: pal_bb_154.h:328
uint8_t * PalBb154GetPayloadPtr(uint8_t *pFrame, uint16_t fctl)
Get payload pointer.
PalBb154TxIsr_t txCback
Definition: pal_bb_154.h:343
void PalBb154ResetChannelParam(void)
Reset channelization parameters.
uint8_t PalBb154ReclaimRxFrame(uint8_t *pRxFrame)
Reclaim the buffer associated with the received frame.
void PalBb154FlushPIB(void)
Flushes PIB attributes to hardware.
uint32_t edSchMiss
Definition: pal_bb_154.h:375
PalBb154AddrMode_t
Addressing mode.
Definition: pal_bb_154.h:74
struct PalBb154DrvPib_tag PalBb154DrvPib_t
MAC PIB for driver.
802.15.4 channelization parameters.
Definition: pal_bb_154.h:312
MAC PIB for driver.
Definition: pal_bb_154.h:382
void PalBb154Enable(void)
Enable the BB hardware.
void(* PalBb154Free_t)(void *pBuf)
Buffer free callback signature.
Definition: pal_bb_154.h:337
uint32_t rxSchMiss
Definition: pal_bb_154.h:365
Baseband driver statistics.
Definition: pal_bb_154.h:362
uint8_t PalBb154Off(void)
Cancel any pending operation.
uint8_t PalBb154RssiToLqi(int8_t rssi)
Convert RSSI to LQI.
PalBb154Err_t errCback
Definition: pal_bb_154.h:347
PalBb154CmdType_t
Values of MAC command type.
Definition: pal_bb_154.h:105
void PalBb154ContinuousTx(uint8_t rfChan, uint8_t modulation, uint8_t txPhy, int8_t power)
Enter Continuous Transmit mode.
Transmit buffer descriptor.
Definition: pal_bb_154.h:351
uint8_t(* PalBb154RxIsr_t)(uint8_t *pBuf, uint16_t len, int8_t rssi, uint32_t timestamp, uint8_t flags)
Receive complete ISR callback signature.
Definition: pal_bb_154.h:325
PalBb154EdIsr_t edCback
Definition: pal_bb_154.h:346
uint32_t rxFilterFail
Definition: pal_bb_154.h:370
void PalBb154ContinuousRx(uint8_t rfChan, uint8_t rxPhy)
Enter Continuous Receive mode.
void PalBb154ContinuousStop(void)
Stop Continous Transmit or Receive mode.
void PalBb154DrvGetStats(PalBb154DrvStats_t *pStats)
Get baseband driver statistics.
uint32_t ccaSchMiss
Definition: pal_bb_154.h:376
int8_t txPower
Definition: pal_bb_154.h:315
uint32_t txDmaFail
Definition: pal_bb_154.h:367
void PalBb154ClearRxBufs(void)
Clear all received buffers (active and queued).
Platform-independent data types.
Operation parameters.
Definition: pal_bb_154.h:340
PalBb154FPIsr_t fpCback
Definition: pal_bb_154.h:344
void *(* PalBb154Alloc_t)(uint16_t len)
Buffer free callback signature.
Definition: pal_bb_154.h:334
uint8_t(* PalBb154FPIsr_t)(uint8_t srcAddrMode, uint64_t srcAddr)
Frame pending check callback.
Definition: pal_bb_154.h:322
PalBb154DrvPib_t * PalBb154GetDrvPIB(void)
Get Driver PIB.
void(* PalBb154TxIsr_t)(uint8_t flags)
Transmit complete ISR callback signature.
Definition: pal_bb_154.h:319
void PalBb154Disable(void)
Disable the BB hardware.
uint8_t channel
Definition: pal_bb_154.h:314
void PalBb154Rx(uint32_t due, uint8_t now, uint32_t timeout)
Receive a packet.
PalBb154RxIsr_t rxCback
Definition: pal_bb_154.h:345
PalBb154FrameType_t
Values of frame type in FC.
Definition: pal_bb_154.h:87
uint8_t pad[2]
Definition: pal_bb_154.h:353
uint32_t rxPktTimeout
Definition: pal_bb_154.h:369
void PalBb154Tx(PalBb154TxBufDesc_t *pDesc, uint8_t cnt, uint32_t due, uint8_t now)
Transmit a packet.
void PalBb154GetLastRssi(uint8_t *pBuf)
Return the last received RSSI.
uint32_t txSchMiss
Definition: pal_bb_154.h:364
void PalBb154SetOpParams(const PalBb154OpParam_t *pOpParam)
Set the operation parameters.
void PalBb154SetChannelParam(const PalBb154Chan_t *pParam)
Set channelization parameters.
PalBb154DevType_t
MAC device type (vendor specific).
Definition: pal_bb_154.h:119
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.