Mistake on this page?
Report an issue in GitHub or email us
lctr_int_conn.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Internal link layer controller connection interface file.
6  *
7  * Copyright (c) 2013-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 LCTR_INT_CONN_H
26 #define LCTR_INT_CONN_H
27 
28 #include "lctr_int.h"
29 #include "lctr_api_conn.h"
30 #include "lctr_pdu_conn.h"
31 #include "lctr_pdu_adv.h"
32 #include "lmgr_api_conn.h"
33 #include "ll_defs.h"
34 #include "sch_api.h"
35 #include "bb_ble_api.h"
36 #include "bb_ble_api_op.h"
37 #include "wsf_cs.h"
38 #include "wsf_msg.h"
39 #include "wsf_timer.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**************************************************************************************************
46  Macros
47 **************************************************************************************************/
48 
49 #define LCTR_MAX_CONS_CRC 2 /*!< Maximum number of consecutive CRC failures. */
50 
51 #define LCTR_DATA_PDU_START_OFFSET 2 /*!< Data PDU start offset in a buffer (match ACL header size). */
52 
53 #define LCTR_DATA_PDU_FC_OFFSET 0 /*!< Flow control fields data PDU offset. */
54 #define LCTR_DATA_PDU_LEN_OFFSET 1 /*!< Length field data PDU offset. */
55 
56 #define LCTR_MAX_INSTANT 32767 /*!< Maximum instant value for connection update. */
57 
58 #define LCTR_CTRL_DATA_HANDLE 0xFF /*!< Connection handle used for LL control PDUs. */
59 
60 #define LCTR_LE_PING_ATTEMPTS 4 /*!< LE Ping attempts. */
61 
62 #define LCTR_CH_SEL_MAX 2 /*!< Total number of channel selection algorithms. */
63 
64 /*! \brief Resolve the connection handle from the context pointer. */
65 #define LCTR_GET_CONN_HANDLE(pCtx) (pCtx - pLctrConnTbl)
66 
67 /*! \brief Resolve connection context from the handle. */
68 #define LCTR_GET_CONN_CTX(h) &(pLctrConnTbl[h])
69 
70 /*! \brief Resolve txPower from phy index. */
71 #define LCTR_GET_TXPOWER(pCtx, phy, option) \
72  (pCtx->phyTxPower[phy - (((phy == LL_PHY_LE_CODED) && (option == BB_PHY_OPTIONS_BLE_S2)) ? 0 : 1)])
73 
74 /*! \brief Set the txpower of a specified PHY. */
75 #define LCTR_SET_TXPOWER(pCtx, phy, pow) (pCtx->phyTxPower[phy - 1] = pow)
76 
77 /*! \brief Low threshold for power monitoring. */
78 #define LCTR_RSSI_LOW_THRESHOLD -65
79 
80 /*! \brief High threshold for power monitoring. */
81 #define LCTR_RSSI_HIGH_THRESHOLD -30
82 
83 /*! \brief Minimum time spent until request. */
84 #define LCTR_PC_MIN_TIME 15
85 
86 /*! \brief Default request of increase/decrease in value. */
87 #define LCTR_PC_REQUEST_VAL 5
88 
89 /*! \brief Special reset terminate reason. */
90 #define LCTR_RESET_TERM_REASON 0xFF
91 
92 /**************************************************************************************************
93  Data Types
94 **************************************************************************************************/
95 
96 /*! \brief Connected states. */
97 enum
98 {
99  LCTR_CONN_STATE_INITIALIZED, /*!< Connection initialized. */
100  LCTR_CONN_STATE_ESTABLISHED_STARTUP, /*!< Connection established before ready to start LLCP. */
101  LCTR_CONN_STATE_ESTABLISHED_READY, /*!< Connection established and ready to start LLCP. */
102  LCTR_CONN_STATE_TERMINATING /*!< Connection terminating. */
103 };
104 
105 /*! \brief LLCP states. */
106 enum
107 {
108  LCTR_LLCP_STATE_IDLE, /*!< LLCP idle state. */
109  LCTR_LLCP_STATE_BUSY, /*!< LLCP busy state. */
110  LCTR_LLCP_STATE_TOTAL /*!< Total number of LLCP states. */
111 };
112 
113 /*! \brief Common LLCP states. */
114 enum
115 {
116  LCTR_CMN_STATE_IDLE, /*!< LLCP idle state. */
117  LCTR_CMN_STATE_BUSY, /*!< LLCP busy state. */
118  LCTR_CMN_STATE_TOTAL /*!< Total number of LLCP states. */
119 };
120 
121 /*! \brief SVT states. */
122 enum
123 {
124  LCTR_SVT_STATE_IDLE, /*!< SVT idle state. */
125  LCTR_SVT_STATE_URGENT, /*!< SVT urgent state. */
126  LCTR_SVT_STATE_FATAL, /*!< SVT fatal state. */
127  LCTR_SVT_STATE_TOTAL /*!< Total number of SVT state. */
128 };
129 
130 /*! \brief Periodic sync source. */
131 enum
132 {
133  LCTR_SYNC_SRC_SCAN, /*!< Periodic sync info from scanner. */
134  LCTR_SYNC_SRC_BCST, /*!< Periodic sync info from broadcaster. */
135  LCTR_SYNC_SRC_TOTAL /*!< Total number of periodic sync source. */
136 };
137 
138 /*! \brief Common LLCP procedure IDs. */
139 enum
140 {
141  /* Common SM LLCP procedures. */
142  LCTR_PROC_CMN_TERM, /*!< Termination procedure. */
143  LCTR_PROC_CMN_CH_MAP_UPD, /*!< Channel map update procedure. */
144  LCTR_PROC_CMN_FEAT_EXCH, /*!< Feature exchange procedure. */
145  LCTR_PROC_CMN_VER_EXCH, /*!< Version exchange procedure. */
146  LCTR_PROC_CMN_DATA_LEN_UPD, /*!< Data length update procedure. */
147  LCTR_PROC_CMN_SET_MIN_USED_CHAN, /*!< Set minimum number of used channels procedure. */
148  LCTR_PROC_CMN_PER_ADV_SYNC_TRSF, /*!< Periodic advertising sync transfer procedure. */
149  LCTR_PROC_CMN_REQ_PEER_SCA, /*!< Request peer SCA procedure. */
150  LCTR_PROC_CMN_TOTAL, /*!< Total number of common procedures. */
151 
152  /* Custom SM LLCP procedures. */
153  LCTR_PROC_CONN_UPD, /*!< Connection update procedure. */
154  LCTR_PROC_CONN_PARAM, /*!< Connection parameter procedure. */
155  LCTR_PROC_ENCRYPT, /*!< Encryption Start or Restart procedure. */
156  LCTR_PROC_LE_PING, /*!< LE Ping procedure. */
157  LCTR_PROC_PHY_UPD, /*!< PHY update procedure. */
158  LCTR_PROC_PHY_UPD_PEER, /*!< Peer-initiated PHY update procedure. */
159  LCTR_PROC_CIS_EST, /*!< CIS establishment procedure. */
160  LCTR_PROC_CIS_EST_PEER, /*!< Peer-initiated CIS establishment procedure. */
161  LCTR_PROC_CIS_TERM, /*!< CIS termination procedure. */
162  LCTR_PROC_CIS_TERM_PEER, /*!< Peer-initiated CIS termination procedure. */
163  LCTR_PROC_PWR_IND, /*!< Power indication prodecure. */
164  LCTR_PROC_PWR_CTRL, /*!< Power control procedure. */
165 
166  LCTR_PROC_INVALID = 0xFF /*!< Invalid ID. */
167 
168  /* Note: additional procedures without instants can be overridden. */
169 };
170 
171 /*! \brief Power control monitor schemes. */
172 enum
173 {
174  LCTR_PC_MONITOR_AUTO, /*!< Automatic monitoring scheme. */
175  LCTR_PC_MONITOR_PATH_LOSS, /*!< Path loss monitoring scheme. */
176 
177  LCTR_PC_MONITOR_SCHEME_TOTAL /*!< Total number of monitoring schemes. */
178 };
179 
180 /*! \brief Power control scheme states. */
181 enum
182 {
183  LCTR_PC_MONITOR_DISABLED, /*!< Disabled monitoring. */
184  LCTR_PC_MONITOR_ENABLED, /*!< Monitoring enabled. */
185  LCTR_PC_MONITOR_READY /*!< Monitoring ready for enable. */
186 };
187 
188 /*! \brief Check if CIS is enabled by the CIS handle signature. */
189 typedef bool_t (*lctrCheckCisEstCisFn_t)(uint16_t cisHandle);
190 /*! \brief Check for CIS termination signature. */
191 typedef bool_t (*lctrCheckTermFn_t)(uint16_t aclHandle);
192 /*! \brief Check if there is a CIS established by the ACL handle signature. */
193 typedef bool_t (*lctrCheckCisEstAclFn_t)(uint16_t aclHandle);
194 
195 /*! \brief Connection context. */
196 typedef struct
197 {
198  bool_t enabled; /*!< Context enabled. */
199  uint8_t state; /*!< Current state. */
200  uint8_t role; /*!< Connection role. */
201  uint32_t opModeFlags; /*!< Operational mode flags. */
202 
203  /* Host/API */
204  uint8_t termReason; /*!< Termination reason code. */
205  uint8_t replyWaitingMsk; /*!< Host reply waiting mask. */
206 
207  /* BB data */
208  BbOpDesc_t connBod; /*!< Connection BOD. */
209  BbBleData_t bleData; /*!< BLE BB operation data. */
210 
211  union
212  {
213  struct
214  {
215  uint16_t totalAcc; /*!< Combined sleep clock inaccuracy. */
216  uint16_t lastActiveEvent; /*!< Last active event counter. */
217  uint32_t txWinSizeUsec; /*!< Tx window size. */
218  uint32_t anchorPointUsec; /*!< Anchor point in microseconds. */
219  uint32_t unsyncedTime; /*!< Unsynced time in BB tick before connection update. */
220  bool_t initAckRcvd; /*!< Ack received from master. */
221  bool_t abortSlvLatency; /*!< If TRUE abort slave latency. */
222 
223  uint8_t consCrcFailed; /*!< Number of consecutive CRC failures. */
224  bool_t syncWithMaster; /*!< Flag indicating synchronize packet received from master. */
225  bool_t rxFromMaster; /*!< At least one successful packet received from master. */
226  uint32_t firstRxStartTsUsec; /*!< Timestamp of the first received frame regardless of CRC error in microseconds. */
227 
228  } slv; /*!< Slave connection specific data. */
229 
230  struct
231  {
232  bool_t sendConnUpdInd; /*!< Send LL_CONNECTION_UPDATE_IND flag. */
233  } mst; /*!< Master connection specific data. */
234  } data; /*!< Role specific data. */
235 
236  /* Connection event parameters */
237  uint16_t maxLatency; /*!< Maximum latency. */
238  uint16_t eventCounter; /*!< Connection event counter. */
239  uint16_t connInterval; /*!< Connection interval. */
240 
241  /* RF parameters */
242  int8_t rssi; /*!< RSSI. */
243  uint8_t lastRxStatus; /*!< Status code of last rx. */
244 
245  /* Channel parameters */
246  uint8_t lastChanIdx; /*!< Current channel index. */
247  uint8_t hopInc; /*!< Hop increment. */
248  uint8_t numUsedChan; /*!< Number of used channels. */
249  uint64_t chanMask; /*!< Channel mask. */
250  uint8_t chanRemapTbl[LL_CHAN_DATA_MAX_IDX + 1];
251  /*!< Channel remapping table. */
252  uint8_t usedChSel; /*!< Used channel selection. */
253  uint16_t chIdentifier; /*!< Channel identifier. */
254  uint32_t crcInit; /*!< CRC initialization value. */
255  uint32_t accessAddr; /*!< Connection access address. */
256  int8_t phyTxPower[LL_PC_PHY_TOTAL];
257  /*!< Saved txPower configuration for PHYs. */
258 
259  /* Flow control */
260  lctrDataPduHdr_t txHdr; /*!< Transmit data PDU header. */
261  lctrDataPduHdr_t rxHdr; /*!< Receive data PDU header. */
262  wsfQueue_t txLeuQ; /*!< Transmit LE-U queue. */
263  wsfQueue_t txArqQ; /*!< Transmit ARQ queue. */
264  wsfQueue_t rxDataQ; /*!< Receive data pending queue. */
265  uint8_t numTxComp; /*!< Number of completed Tx buffers. */
266  uint8_t numRxPend; /*!< Number of Rx pending buffers. */
267  bool_t emptyPduPend; /*!< Empty PDU ACK pending. */
268  bool_t emptyPduFirstAtt; /*!< Empty PDU first attempt. */
269  bool_t forceStartPdu; /*!< Next data will be forced to be a start PDU */
270 
271  /* Supervision */
272  uint16_t supTimeoutMs; /*!< Supervision timeout in milliseconds. */
273  wsfTimer_t tmrSupTimeout; /*!< Supervision timer. */
274  bool_t connEst; /*!< Connection established. */
275  uint8_t svtState; /*!< SVT urgency state. */
276 
277  /* Encryption */
278  bool_t pauseRxData; /*!< Pause Rx data PDUs. */
279  bool_t pauseTxData; /*!< Pause Tx data PDUs. */
280  uint8_t ltk[LL_KEY_LEN]; /*!< Long term key. */
281  uint8_t skd[LL_SKD_LEN]; /*!< Session key diversifier. */
282  uint8_t iv[LL_IV_LEN]; /*!< Initialization vector. */
283  uint8_t rand[LL_RAND_LEN]; /*!< Random number. */
284  uint16_t ediv; /*!< Encrypted diversifier. */
285 
286  uint64_t txPktCounter; /*!< Transmit packet counter. */
287  uint64_t rxPktCounter; /*!< Transmit packet counter. */
288 
289  /* Authentication */
290  uint32_t pingPeriodMs; /*!< Ping period in milliseconds. */
291  wsfTimer_t tmrPingTimeout; /*!< Ping timer. */
292  uint32_t authTimeoutMs; /*!< Authentication payload timeout in milliseconds. */
293  wsfTimer_t tmrAuthTimeout; /*!< Authentication payload timer. */
294 
295  LlEncMode_t newEncMode; /*!< Pending encryption mode. */
296  bool_t pendEncMode; /*!< New encryption mode pending. */
297 
298  bool_t keyUpdFlag; /*!< Flag for key update. */
299 
300  /* Peer device info */
301  uint8_t numSentVerInd; /*!< Number of sent LL_VERSION_IND. */
302  bool_t remoteVerValid; /*!< Peer version data valid. */
303  lctrVerInd_t remoteVer; /*!< Peer version data. */
304  bool_t featExchFlag; /*!< Flag for completed feature exchange. */
305  uint64_t usedFeatSet; /*!< Used feature set. */
306  uint8_t peerSca; /*!< Peer SCA. */
307 
308  int8_t peerTxPower; /*!< Peer reported txPower. */
309  uint8_t peerPwrLimits; /*!< Peer power limits field. */
310  uint8_t peerApr[LL_PC_PHY_TOTAL];
311  /*!< Acceptable reduction of power as calculated by the peer. */
312 
313  /* Data length */
314  lctrDataLen_t localDataPdu; /*!< Local Data PDU parameters. */
315  lctrDataLen_t effDataPdu; /*!< Effective Data PDU parameters. */
316  uint16_t localConnDurUsec; /*!< Local connection event duration. */
317  uint16_t effConnDurUsec; /*!< Effective connection event duration. */
318 
319  /* PHY */
320  uint8_t allPhys; /*!< Default all PHYs. */
321  uint8_t txPhys; /*!< Default transmitter PHYs. */
322  uint8_t rxPhys; /*!< Default receiver PHYs. */
323  uint8_t txPhysPending; /*!< Pending transmitter PHYs. */
324 
325  /* Peer minimum number of used channels */
326  uint8_t peerMinUsedChan[LL_MAX_PHYS];
327  /*!< Peer minimum number of used channels for PHYs. */
328 
329  /* Periodic sync indication */
330  bool_t sendPerSync; /*!< Send LL_PERIODIC_SYNC_IND flag. */
331  uint8_t perSyncSrc; /*!< Periodic sync source. */
332  uint16_t perServiceData; /*!< ID for periodic sync indication. */
333  uint16_t perSyncHandle; /*!< Periodic sync handle. */
334 
335  /* PAST(Periodic advertising sync transfer) parameters. */
336  uint8_t syncMode; /*!< Sync transfer mode. */
337  uint16_t syncSkip; /*!< Sync skip for periodic adv sync transfer. */
338  uint16_t syncTimeout; /*!< Sync timeout for periodic adv sync transfer. */
339 
340  /* LLCP */
341  uint8_t llcpState; /*!< Current LLCP state. */
342  uint8_t encState; /*!< Current encryption state. */
343  uint8_t pingState; /*!< Current ping state. */
344  uint8_t connUpdState; /*!< Connection update state. */
345  uint8_t phyUpdState; /*!< PHY update state. */
346  uint8_t cmnState; /*!< Common LLCP state. */
347  bool_t peerReplyWaiting; /*!< Peer waiting for reply. */
348  bool_t llcpInstantComp; /*!< Procedure instant completed. */
349  bool_t termAckReqd; /*!< Ack required for Rx'ed LL_TERMINATE_IND. */
350  bool_t ackAfterCtrlPdu; /*!< Ack Tx'ed after last Control PDU Rx'ed. */
351  bool_t llcpIsOverridden; /*!< Is the current procedure overridden by other procedure. */
352  bool_t isSlvReadySent; /*!< True if slave ready to initiate startup LLCP procedure is sent. */
353  bool_t isFirstNonCtrlPdu; /*!< True if first non-control PDU from master and slave. */
354  bool_t isSlvPhyUpdInstant; /*!< True if slave is in PHY update instant state. */
355  uint8_t llcpActiveProc; /*!< Current procedure. */
356  uint32_t llcpNotifyMask; /*!< Host notification mask. */
357  uint32_t llcpPendMask; /*!< Pending LLCP procedures. */
358  uint32_t llcpIncompMask; /*!< Incomplete LLCP procedures. */
359  LlConnSpec_t connUpdSpec; /*!< Host connection update specification. */
360  lctrConnUpdInd_t connUpd; /*!< Connection update parameters. */
361  lctrConnParam_t connParam; /*!< Stored peer connection parameter request or response. */
362  lctrChanMapInd_t chanMapUpd; /*!< Channel map parameters. */
363  lctrPhy_t phyReq; /*!< Stored peer PHY request. */
364  lctrPhyUpdInd_t phyUpd; /*!< PHY update parameters. */
365  wsfTimer_t tmrProcRsp; /*!< Procedure response timer. */
366  uint8_t scaUpdAction; /*!< Sca update action variable. */
367  bool_t readRemoteTxPower; /*!< Currently reading remote txPower. */
368  int8_t scaMod; /*!< Local sca override modifier. */
369  uint8_t reqErrCode; /*!< LLCP error code. */
370 
371  /* Power Control */
372  int8_t delta; /*!< Power control delta storage. */
373  bool_t peerReqRecvd; /*!< Peer request received. */
374  uint8_t reqPhy; /*!< PHY of most recent power control request. */
375  bool_t powerRptLocal; /*!< Currently reporting local power changes. */
376  bool_t powerRptRemote; /*!< Currently reporting remote power changes. */
377  uint8_t powerMonitorScheme; /*!< Active power monitoring scheme. */
378  uint8_t monitoringState; /*!< Current state of active power monitoring scheme. */
379  bool_t controllerInitRead; /*!< A controller initiated read command. */
380  union
381  {
382  struct
383  {
384  int8_t highThreshold; /*!< High extreme RSSI threshold. */
385  int8_t lowThreshold; /*!< Low extreme RSSI threshold. */
386  uint8_t minTimeSpent; /*!< Minimum time spent in an extreme RSSI zone to trigger a request. */
387  uint8_t curTimeSpent; /*!< Current time spent in an extreme RSSI zone. */
388  uint8_t requestVal; /*!< Value of increase/decrease in power to request. */
389  } autoMonitor; /*!< Autonomous RSSI monitoring specific data. */
390 
391  struct
392  {
393  uint8_t highThreshold; /*!< Path loss high threshold. */
394  uint8_t highHysteresis; /*!< Path loss high hysteresis. */
395  uint8_t lowThreshold; /*!< Path loss low threshold. */
396  uint8_t lowHysteresis; /*!< Path loss low hysteresis. */
397  uint8_t minTimeSpent; /*!< Minimum time spent to trigger an event. */
398  uint8_t curTimeSpent; /*!< Current time spent in a new path loss zone. */
399  uint8_t curZone; /*!< Current path loss zone. */
400  uint8_t newZone; /*!< New zone. */
401  bool_t initialPathLossRead; /*!< A power control request is required to start path loss monitoring. */
402  } pathLoss; /*!< Path loss parameters. */
403  } pclMonitorParam; /*!< Power control monitoring data. */
404 
405  /* CIS */
406  uint16_t llcpCisHandle; /*!< CIS handle for the LLCP procedure. */
407  lctrCheckTermFn_t checkCisTerm; /*!< Pointer to the check CIS termination function. */
408  lctrCheckCisEstAclFn_t checkCisEstAcl; /*!< Pointer to the check if CIS is established function. */
409  uint8_t cisRssiExtremeTimeSpent; /*!< CIS's current time spent in an extreme zone. */
410 } lctrConnCtx_t;
411 
412 /*! \brief Call signature of a cipher block handler. */
413 typedef void (*lctrCipherBlkHdlr_t)(PalCryptoEnc_t *pEnc, uint8_t id, uint8_t dir);
414 
415 /*! \brief Call signature of a packet encryption handler. */
416 typedef bool_t (*lctrPktEncHdlr_t)(PalCryptoEnc_t *pEnc, uint8_t *pHdr, uint8_t *pBuf, uint8_t *pMic);
417 
418 /*! \brief Call signature of a packet decryption handler. */
419 typedef bool_t (*lctrPktDecHdlr_t)(PalCryptoEnc_t *pEnc, uint8_t *pBuf);
420 
421 /*! \brief Call signature of a set packet count handler. */
422 typedef void (*lctrPktCntHdlr_t)(PalCryptoEnc_t *pEnc, uint64_t pktCnt);
423 
424 /*! \brief Call signature of a LLCP state machine handler. */
425 typedef bool_t (*LctrLlcpHdlr_t)(lctrConnCtx_t *pCtx, uint8_t event);
426 
427 /*! \brief Call signature of a control PDU handler. */
428 typedef void (*lctrCtrlPduHdlr_t)(lctrConnCtx_t *pCtx, uint8_t *pBuf);
429 
430 /*! \brief Call signature of a Channel state machine handler. */
431 typedef uint8_t (*LctrChSelHdlr_t)(lctrConnCtx_t *pCtx, uint16_t numSkip);
432 
433 /*! \brief Call signature of an action handler. */
434 typedef void (*lctrLlcpEh_t)(lctrConnCtx_t *pCtx);
435 
436 /*! \brief Call signature of a power monitor function. */
437 typedef void (*lctrPcMonAct_t)(lctrConnCtx_t *pCtx);
438 
439 /*! \brief Call signature of power change indication handler. */
440 typedef void (*lctrPcPowInd_t)(lctrConnCtx_t *pCtx, uint8_t phy, int8_t delta, int8_t txPower, bool_t phyChange);
441 
442 /*! \brief Call signature of power report notification handler. */
443 typedef void (*lctrPcNotifyPwr_t)(lctrConnCtx_t *pCtx, uint8_t reason, uint8_t phy, int8_t txPower, uint8_t limits, int8_t delta);
444 
445 /*! \brief Call signature of CIS pend disconnect function. */
446 typedef bool_t (*lctrPendCisDisc_t)(lctrConnCtx_t *pCtx);
447 
448 /*! \brief LLCP state machine handlers. */
449 enum
450 {
451  LCTR_LLCP_SM_ENCRYPT, /*!< Encryption LLCP state machine. */
452  LCTR_LLCP_SM_PING, /*!< Ping state machine. */
453  LCTR_LLCP_SM_CONN_UPD, /*!< Connection update state machine. */
454  LCTR_LLCP_SM_PHY_UPD, /*!< PHY update state machine. */
455  LCTR_LLCP_SM_CIS_EST, /*!< CIS establishment state machine. */
456  LCTR_LLCP_SM_CIS_TERM, /*!< CIS termination state machine. */
457  LCTR_LLCP_SM_PC, /*!< Power control state machine. */
458  LCTR_LLCP_SM_CMN, /*!< Common LLCP state machine. */
459  LCTR_LLCP_SM_TOTAL /*!< Total number of LLCP state machine. */
460 };
461 
462 /**************************************************************************************************
463  Global Variables
464 **************************************************************************************************/
465 
466 extern lctrCipherBlkHdlr_t lctrInitCipherBlkHdlr;
467 extern lctrPktEncHdlr_t lctrPktEncryptHdlr;
468 extern lctrPktDecHdlr_t lctrPktDecryptHdlr;
469 extern lctrPktCntHdlr_t lctrSetEncryptPktCountHdlr;
470 extern lctrPktCntHdlr_t lctrSetDecryptPktCountHdlr;
471 extern lctrConnCtx_t *pLctrConnTbl;
472 extern lctrDataPdu_t lctrDataPdu;
473 extern lctrConnMsg_t *pLctrConnMsg;
474 extern const LctrVsHandlers_t *pLctrVsHdlrs;
475 extern lctrCtrlPduHdlr_t lctrCtrlPduHdlr;
476 extern LctrChSelHdlr_t lctrChSelHdlr[LCTR_CH_SEL_MAX];
477 extern lctrCheckCisEstCisFn_t lctrCheckCisEstCisFn;
478 extern lctrLlcpEh_t lctrSendPerSyncFromScanFn;
479 extern lctrLlcpEh_t lctrSendPerSyncFromBcstFn;
480 extern lctrLlcpEh_t lctrStorePeriodicSyncTrsfFn;
481 extern lctrLlcpEh_t lctrSendPeriodicSyncIndFn;
482 extern lctrLlcpEh_t lctrReceivePeriodicSyncIndFn;
483 extern lctrPcMonAct_t lctrPcActTbl[LCTR_PC_MONITOR_SCHEME_TOTAL];
484 extern lctrPcPowInd_t lctrSendPowerChangeIndCback;
485 extern lctrPcNotifyPwr_t lctrNotifyPowerReportIndCback;
486 
487 /**************************************************************************************************
488  Function Declarations
489 **************************************************************************************************/
490 
491 /* Initialization */
492 void lctrConnDefaults(void);
493 
494 /* Builder */
495 lctrConnCtx_t *lctrAllocConnCtx(void);
496 void lctrFreeConnCtx(lctrConnCtx_t *pCtx);
497 uint8_t lctrSelectNextDataChannel(lctrConnCtx_t *pCtx, uint16_t numSkip);
498 uint8_t lctrSelectNextChannel2(lctrConnCtx_t *pCtx, uint16_t numSkip);
499 void lctrBuildRemapTable(lctrConnCtx_t *pCtx);
500 
501 /* Task event handler */
502 void lctrConnTxCompletedHandler(void);
503 void lctrConnRxPendingHandler(void);
504 
505 /* Connection update actions */
506 void lctrStoreConnUpdateSpec(lctrConnCtx_t *pCtx);
507 void lctrSendConnUpdateInd(lctrConnCtx_t *pCtx);
508 void lctrStoreConnUpdate(lctrConnCtx_t *pCtx);
509 void lctrNotifyHostConnUpdateInd(lctrConnCtx_t *pCtx, uint8_t status);
510 void lctrActNotifyHostConnUpdSuccess(lctrConnCtx_t *pCtx);
511 void lctrActHostNegReply(lctrConnCtx_t *pCtx);
512 void lctrActPeerRejectConnParam(lctrConnCtx_t *pCtx);
513 
514 /* Channel map actions */
515 void lctrStoreChanMapUpdate(lctrConnCtx_t *pCtx);
516 void lctrSendChanMapUpdateInd(lctrConnCtx_t *pCtx);
517 void lctrStoreChanMap(lctrConnCtx_t *pCtx);
518 
519 /* Feature exchange actions */
520 void lctrSendFeatureReq(lctrConnCtx_t *pCtx);
521 void lctrSendFeatureRsp(lctrConnCtx_t *pCtx);
522 void lctrStoreUsedFeatures(lctrConnCtx_t *pCtx);
523 
524 /* Version exchange actions */
525 void lctrSendVersionInd(lctrConnCtx_t *pCtx);
526 void lctrStoreRemoteVer(lctrConnCtx_t *pCtx);
527 void lctrNotifyHostReadRemoteVerCnf(lctrConnCtx_t *pCtx);
528 
529 /* Terminate actions */
530 void lctrSendTerminateInd(lctrConnCtx_t *pCtx);
531 void lctrNotifyHostDisconnectInd(lctrConnCtx_t *pCtx);
532 void lctrStoreTerminateReason(lctrConnCtx_t *pCtx);
533 void lctrStoreDisconnectReason(lctrConnCtx_t *pCtx);
534 void lctrStoreConnFailEstablishTerminateReason(lctrConnCtx_t *pCtx);
535 void lctrStoreLlcpTimeoutTerminateReason(lctrConnCtx_t *pCtx);
536 void lctrStoreResetTerminateReason(lctrConnCtx_t *pCtx);
537 void lctrStoreInstantPassedTerminateReason(lctrConnCtx_t *pCtx);
538 void lctrStoreMicFailedTerminateReason(lctrConnCtx_t *pCtx);
539 
540 /* Connection parameter actions */
541 void lctrStoreConnParamReq(lctrConnCtx_t *pCtx);
542 void lctrStoreConnParamRsp(lctrConnCtx_t *pCtx);
543 void lctrStoreConnParamSpec(lctrConnCtx_t *pCtx);
544 void lctrSendConnParamReq(lctrConnCtx_t *pCtx);
545 void lctrSendConnParamRsp(lctrConnCtx_t *pCtx);
546 void lctrNotifyHostConnParamInd(lctrConnCtx_t *pCtx);
547 
548 /* Data length exchange actions */
549 void lctrStoreLocalDataLength(lctrConnCtx_t *pCtx);
550 void lctrSendDataLengthReq(lctrConnCtx_t *pCtx);
551 void lctrSendDataLengthRsp(lctrConnCtx_t *pCtx);
552 void lctrStoreRemoteDataLength(lctrConnCtx_t *pCtx);
553 void lctrNotifyHostDataLengthInd(lctrConnCtx_t *pCtx, uint8_t status);
554 
555 /* Set minimum number of used channels actions */
556 void lctrSendSetMinUsedChanInd(lctrConnCtx_t *pCtx);
557 void lctrStoreSetMinUsedChan(lctrConnCtx_t *pCtx);
558 
559 /* Send periodic sync indication actions */
560 void lctrActStorePeriodicSyncTrsf(lctrConnCtx_t *pCtx);
561 void lctrActSendPeriodicSyncInd(lctrConnCtx_t *pCtx);
562 void lctrActReceivePeriodicSyncInd(lctrConnCtx_t *pCtx);
563 void lctrStorePeriodicSyncTrsf(lctrConnCtx_t *pCtx);
564 void lctrSendPeriodicSyncInd(lctrConnCtx_t *pCtx);
565 void lctrReceivePeriodicSyncInd(lctrConnCtx_t *pCtx);
566 void lctrSendPerSyncFromScan(lctrConnCtx_t *pCtx);
567 void lctrSendPerSyncFromBcst(lctrConnCtx_t *pCtx);
568 
569 /* Request peer SCA actions. */
570 void lctrStoreScaAction(lctrConnCtx_t *pCtx);
571 void lctrSendPeerScaReq(lctrConnCtx_t *pCtx);
572 void lctrSendPeerScaRsp(lctrConnCtx_t *pCtx);
573 void lctrStorePeerSca(lctrConnCtx_t *pCtx);
574 void lctrNotifyHostPeerScaCnf(lctrConnCtx_t *pCtx);
575 
576 /* Unknown/Unsupported */
577 void lctrSendUnknownRsp(lctrConnCtx_t *pCtx);
578 void lctrSendRejectInd(lctrConnCtx_t *pCtx, uint8_t reason, bool_t forceRejectExtInd);
579 
580 /* Tx data path */
581 uint16_t lctrTxFragLen(lctrConnCtx_t *pTx);
582 uint16_t lctrTxInitMem(uint8_t *pFreeMem, uint32_t freeMemSize);
583 uint8_t *lctrTxCtrlPduAlloc(uint8_t pduLen);
584 void lctrTxDataPduQueue(lctrConnCtx_t *pCtx, uint16_t fragLen, lctrAclHdr_t *pAclHdr, uint8_t *pAclBuf);
585 void lctrTxCtrlPduQueue(lctrConnCtx_t *pCtx, uint8_t *pBuf);
586 uint8_t lctrTxQueuePeek(lctrConnCtx_t *pCtx, PalBbBleTxBufDesc_t *bbDescs, bool_t *pMd);
587 bool_t lctrTxQueuePop(lctrConnCtx_t *pCtx);
588 void lctrTxQueuePopCleanup(lctrConnCtx_t *pCtx);
589 uint8_t lctrTxQueueClear(lctrConnCtx_t *pCtx);
590 
591 /* Rx data path */
592 uint8_t *lctrRxPduAlloc(uint16_t maxRxLen);
593 void lctrRxPduFree(uint8_t *pBuf);
594 void lctrRxEnq(uint8_t *pBuf, uint16_t eventCounter, uint16_t connHandle);
595 uint8_t *lctrRxDeq(uint16_t *pConnHandle);
596 void lctrRxConnEnq(lctrConnCtx_t *pCtx, uint8_t *pBuf);
597 uint8_t *lctrRxConnDeqAcl(lctrConnCtx_t *pCtx);
598 uint8_t lctrRxConnClear(lctrConnCtx_t *pCtx);
599 
600 /* LLCP */
601 void lctrStartLlcpTimer(lctrConnCtx_t *pCtx);
602 void lctrStopLlcpTimer(lctrConnCtx_t *pCtx);
603 void lctrStartPendingLlcp(lctrConnCtx_t *pCtx);
604 
605 /* Data path pause */
606 void lctrPauseTxData(lctrConnCtx_t *pCtx);
607 void lctrUnpauseTxData(lctrConnCtx_t *pCtx);
608 void lctrCheckPauseComplete(lctrConnCtx_t *pCtx);
609 void lctrPauseRxData(lctrConnCtx_t *pCtx);
610 void lctrUnpauseRxData(lctrConnCtx_t *pCtx);
611 
612 /* Packet times */
613 void lctrSetPacketTimeRestriction(lctrConnCtx_t *pCtx, uint8_t txPhys);
614 void lctrRemovePacketTimeRestriction(lctrConnCtx_t *pCtx);
615 uint16_t lctrCalcConnDurationUsec(lctrConnCtx_t *pCtx, const lctrDataLen_t *pDataLen);
616 
617 /* Scheduler */
618 BbOpDesc_t *lctrConnResolveConflict(BbOpDesc_t *pNewOp, BbOpDesc_t *pExistOp);
619 
620 /* ISR */
621 uint8_t *lctrProcessRxAck(lctrConnCtx_t *pCtx);
622 void lctrTxPduAck(lctrConnCtx_t *pCtx);
623 bool_t lctrProcessTxAck(lctrConnCtx_t *pCtx);
624 void lctrProcessTxAckCleanup(lctrConnCtx_t *pCtx);
625 uint16_t lctrSetupForTx(lctrConnCtx_t *pCtx, uint8_t rxStatus, bool_t reqTx);
626 void lctrRxPostProcessing(lctrConnCtx_t *pCtx, uint8_t *pRxBuf, uint8_t *pNextRxBuf, bool_t loadRxBuf);
627 
628 /* Helper */
629 void lctrSendConnMsg(lctrConnCtx_t *pCtx, uint8_t event);
630 bool_t lctrExceededMaxDur(lctrConnCtx_t *pCtx, uint32_t ceStart, uint32_t pendDurUsec);
631 uint32_t lctrCalcPingPeriodMs(lctrConnCtx_t *pCtx, uint32_t authTimeoutMs);
632 uint8_t lctrComputeSca(void);
633 uint32_t lctrConnGetAnchorPoint(lctrConnCtx_t *pCtx, uint16_t ceCounter);
634 void lctrInitPhyTxPower(lctrConnCtx_t *pCtx);
635 uint8_t lctrGetPowerLimits(int8_t txPower);
636 
637 /* Reservation */
638 uint32_t lctrGetConnRefTime(uint8_t connHandle, uint32_t *pDurUsec);
639 
640 /*************************************************************************************************/
641 /*!
642  * \brief Set flags for link termination.
643  *
644  * \param pCtx Connection context.
645  */
646 /*************************************************************************************************/
647 static inline void lctrFlagLinkTerm(lctrConnCtx_t *pCtx)
648 {
649  bool_t removeBod = (pCtx->state == LCTR_CONN_STATE_ESTABLISHED_READY);
650 
651  pCtx->state = LCTR_CONN_STATE_TERMINATING; /* signals ISR to terminate link */
652  pCtx->llcpState = LCTR_LLCP_STATE_IDLE; /* signals ISR do not wait to send TERMINATE_IND */
653 
654  if (removeBod)
655  {
656  SchRemove(&pCtx->connBod);
657  }
658 }
659 
660 /*************************************************************************************************/
661 /*!
662  * \brief Service the Control PDU ACK state after a successful reception.
663  *
664  * \param pCtx Connection context.
665  */
666 /*************************************************************************************************/
667 static inline void lctrCheckControlPduAck(lctrConnCtx_t *pCtx)
668 {
669  if (pCtx->rxHdr.llid == LL_LLID_CTRL_PDU)
670  {
671  /* Control PDU received; reset Tx ACK pending state. */
672  pCtx->ackAfterCtrlPdu = FALSE;
673  }
674 }
675 
676 /*************************************************************************************************/
677 /*!
678  * \brief Service the Control PDU ACK state after a successful transmission.
679  *
680  * \param pCtx Connection context.
681  */
682 /*************************************************************************************************/
683 static inline void lctrSetControlPduAck(lctrConnCtx_t *pCtx)
684 {
685  /* Unconditionally set state upon Tx completion. */
686  pCtx->ackAfterCtrlPdu = TRUE;
687 }
688 
689 /*************************************************************************************************/
690 /*!
691  * \brief Set flags for link termination.
692  *
693  * \param pCtx Connection context.
694  *
695  * \return TRUE if connection is terminated, FALSE otherwise.
696  */
697 /*************************************************************************************************/
698 static inline bool_t lctrCheckForLinkTerm(lctrConnCtx_t *pCtx)
699 {
700  if (pCtx->state == LCTR_CONN_STATE_TERMINATING)
701  {
702  /* Peer device is LL_TERMINATE_IND initiator. */
703  if (pCtx->termAckReqd) /* Tx Ack required after Rx of LL_TERMINATE_IND */
704  {
705  if (pCtx->ackAfterCtrlPdu) /* guarantee Ack Tx'ed */
706  {
707  return TRUE;
708  }
709  }
710  /* Local device is LL_TERMINATE_IND initiator. */
711  else if ((pCtx->llcpState == LCTR_LLCP_STATE_IDLE) || /* LL_TERMINATE_IND not pending */
712  (pCtx->txArqQ.pHead == NULL)) /* guarantee LL_TERMINATE_IND is Ack'ed */
713  /* i.e. "WsfQueueEmpty(&pCtx->txArqQ)" (optimized for ISR) */
714  {
715  return TRUE;
716  }
717  }
718 
719  return FALSE;
720 }
721 
722 /*************************************************************************************************/
723 /*!
724  * \brief Increment the Tx/encrypt packet counter.
725  *
726  * \param pCtx Connection context.
727  */
728 /*************************************************************************************************/
729 static inline void lctrIncPacketCounterTx(lctrConnCtx_t *pCtx)
730 {
731  if (lctrSetEncryptPktCountHdlr)
732  {
733  PalCryptoEnc_t * const pEnc = &pCtx->bleData.chan.enc;
734 
735  if ((pEnc->enaEncrypt) &&
737  {
738  pCtx->txPktCounter++;
739  }
740  }
741 }
742 
743 /*************************************************************************************************/
744 /*!
745  * \brief Increment the Rx/decrypt packet counter.
746  *
747  * \param pCtx Connection context.
748  */
749 /*************************************************************************************************/
750 static inline void lctrIncPacketCounterRx(lctrConnCtx_t *pCtx)
751 {
752  if (lctrSetEncryptPktCountHdlr)
753  {
754  PalCryptoEnc_t * const pEnc = &pCtx->bleData.chan.enc;
755 
756  if ((pEnc->enaEncrypt) &&
758  {
759  pCtx->rxPktCounter++;
760  }
761  }
762 }
763 
764 /*************************************************************************************************/
765 /*!
766  * \brief Set the transmit packet counter value in the BB.
767  *
768  * \param pCtx Connection context.
769  */
770 /*************************************************************************************************/
771 static inline void lctrSetBbPacketCounterTx(lctrConnCtx_t *pCtx)
772 {
773  if (lctrSetEncryptPktCountHdlr)
774  {
775  PalCryptoEnc_t * const pEnc = &pCtx->bleData.chan.enc;
776 
777  if (!pEnc->enaEncrypt)
778  {
779  return;
780  }
781 
782  switch (pEnc->nonceMode)
783  {
785  lctrSetEncryptPktCountHdlr(pEnc, pCtx->txPktCounter);
786  break;
788  lctrSetEncryptPktCountHdlr(pEnc, pCtx->eventCounter);
789  break;
790  default:
791  break;
792  }
793  }
794 }
795 
796 /*************************************************************************************************/
797 /*!
798  * \brief Set the receive packet counter value in the BB.
799  *
800  * \param pCtx Connection context.
801  */
802 /*************************************************************************************************/
803 static inline void lctrSetBbPacketCounterRx(lctrConnCtx_t *pCtx)
804 {
805  if (lctrSetDecryptPktCountHdlr)
806  {
807  PalCryptoEnc_t * const pEnc = &pCtx->bleData.chan.enc;
808 
809  if (!pEnc->enaDecrypt)
810  {
811  return;
812  }
813 
814  switch (pEnc->nonceMode)
815  {
817  lctrSetDecryptPktCountHdlr(pEnc, pCtx->rxPktCounter);
818  break;
820  lctrSetDecryptPktCountHdlr(pEnc, pCtx->eventCounter);
821  break;
822  default:
823  break;
824  }
825  }
826 }
827 
828 /*************************************************************************************************/
829 /*!
830  * \brief Check if procedure is active, if not pend the procedure.
831  *
832  * \param pCtx Connection context.
833  * \param proc Procedure ID to check/pend.
834  *
835  * \return TRUE if active procedure, FALSE if pended.
836  */
837 /*************************************************************************************************/
838 static inline bool_t lctrCheckActiveOrPend(lctrConnCtx_t *pCtx, uint8_t proc)
839 {
840  if (pCtx->llcpActiveProc == proc)
841  {
842  return TRUE;
843  }
844  else
845  {
846  pCtx->llcpPendMask |= 1 << proc;
847  return FALSE;
848  }
849 }
850 
851 /*************************************************************************************************/
852 /*!
853  * \brief Store connection timeout termination reason.
854  *
855  * \param pCtx Connection context.
856  */
857 /*************************************************************************************************/
859 {
860  if (pCtx->termReason == LL_ERROR_CODE_CONN_FAILED_TO_ESTABLISH)
861  {
862  pCtx->termReason = LL_ERROR_CODE_CONN_TIMEOUT;
863  }
864 }
865 
866 /*************************************************************************************************/
867 /*!
868  * \brief Increment available Tx data buffers.
869  */
870 /*************************************************************************************************/
871 static inline void lctrDataTxIncAvailBuf(void)
872 {
873  WSF_CS_INIT();
874 
875  WSF_CS_ENTER();
876  lmgrConnCb.availTxBuf++;
877  WSF_CS_EXIT();
878 }
879 
880 /*************************************************************************************************/
881 /*!
882  * \brief Decrement available Tx data buffers.
883  */
884 /*************************************************************************************************/
885 static inline void lctrDataTxDecAvailBuf(void)
886 {
887  WSF_CS_INIT();
888 
889  WSF_CS_ENTER();
890  lmgrConnCb.availTxBuf--;
891  WSF_CS_EXIT();
892 }
893 
894 /*************************************************************************************************/
895 /*!
896  * \brief Increment available Rx data buffers.
897 *
898  * \param numBufs Number of completed packets.
899  */
900 /*************************************************************************************************/
901 static inline void lctrDataRxIncAvailBuf(uint8_t numBufs)
902 {
903  WSF_CS_INIT();
904 
905  WSF_CS_ENTER();
906  lmgrConnCb.availRxBuf += numBufs;
907  WSF_CS_EXIT();
908 }
909 
910 /*************************************************************************************************/
911 /*!
912  * \brief Get connection operational mode flags.
913  *
914  * \param pCtx Connection context to get the flag.
915  * \param flag Flags.
916  *
917  * \return Status error code.
918  *
919  * Set mode flags governing LL operations of a given connection.
920  */
921 /*************************************************************************************************/
922 static inline bool_t lctrGetConnOpFlag(lctrConnCtx_t *pCtx, uint32_t flag)
923 {
924  return (pCtx->opModeFlags & flag) ? TRUE : FALSE;
925 }
926 
927 /*************************************************************************************************/
928 /*!
929  * \brief Get LLCP procedure ID.
930  *
931  * \param event Event.
932  *
933  * \return LLCP procedure event ID.
934  */
935 /*************************************************************************************************/
936 static inline uint8_t lctrGetProcId(uint8_t event)
937 {
938  switch (event)
939  {
942 
945 
948 
950  return LCTR_PROC_CMN_VER_EXCH;
951 
953  return LCTR_PROC_CMN_TERM;
954 
957 
960 
963 
965  return LCTR_PROC_CONN_UPD;
966 
968  return LCTR_PROC_PHY_UPD;
969 
971  return LCTR_PROC_ENCRYPT;
972 
973  default:
974  return LCTR_PROC_INVALID;
975  }
976 }
977 
978 #ifdef __cplusplus
979 };
980 #endif
981 
982 #endif /* LCTR_INT_CONN_H */
uint16_t maxLatency
bool_t(* lctrPktDecHdlr_t)(PalCryptoEnc_t *pEnc, uint8_t *pBuf)
Call signature of a packet decryption handler.
void(* lctrLlcpEh_t)(lctrConnCtx_t *pCtx)
Call signature of an action handler.
Link layer controller connection interface file.
void(* lctrCipherBlkHdlr_t)(PalCryptoEnc_t *pEnc, uint8_t id, uint8_t dir)
Call signature of a cipher block handler.
Data length request or response PDU.
PHY request or response PDU.
bool_t readRemoteTxPower
uint8_t cmnState
bool_t llcpIsOverridden
uint8_t lastRxStatus
wsfQueue_t rxDataQ
bool_t llcpInstantComp
Connection context.
bool_t abortSlvLatency
BLE baseband interface file.
uint8_t powerMonitorScheme
uint16_t perServiceData
bool_t pauseRxData
uint32_t accessAddr
bool_t(* lctrCheckCisEstAclFn_t)(uint16_t aclHandle)
Check if there is a CIS established by the ACL handle signature.
static void lctrIncPacketCounterTx(lctrConnCtx_t *pCtx)
Increment the Tx/encrypt packet counter.
Encryption data.
Definition: pal_crypto.h:73
uint16_t syncTimeout
Encryption mode data structure used in LlGetEncMode() and LlSetEncMode().
Definition: ll_api.h:828
uint8_t encState
LlConnSpec_t connUpdSpec
static void lctrSetBbPacketCounterTx(lctrConnCtx_t *pCtx)
Set the transmit packet counter value in the BB.
lctrConnUpdInd_t connUpd
uint32_t firstRxStartTsUsec
#define LL_RAND_LEN
Definition: ll_defs.h:309
#define LL_MAX_PHYS
Definition: ll_defs.h:364
wsfTimer_t tmrProcRsp
uint8_t lastChanIdx
uint8_t termReason
LlEncMode_t newEncMode
wsfTimer_t tmrAuthTimeout
bool_t featExchFlag
bool_t(* lctrPendCisDisc_t)(lctrConnCtx_t *pCtx)
Call signature of CIS pend disconnect function.
Connection parameter request/response values.
static void lctrDataTxDecAvailBuf(void)
Decrement available Tx data buffers.
uint32_t txWinSizeUsec
uint32_t opModeFlags
Link layer controller advertising channel packet interface file.
Link layer manager connection interface file.
uint16_t perSyncHandle
int8_t peerTxPower
uint8_t highThreshold
uint8_t numRxPend
Critical section macros.
bool_t(* lctrCheckCisEstCisFn_t)(uint16_t cisHandle)
Check if CIS is enabled by the CIS handle signature.
bool_t isSlvPhyUpdInstant
Message passing service.
Link layer controller data channel packet interface file.
static void lctrDataRxIncAvailBuf(uint8_t numBufs)
Increment available Rx data buffers.
bool_t pendEncMode
bool_t peerReplyWaiting
bool_t forceStartPdu
uint64_t chanMask
Data channel PDU header.
Definition: lctr_pdu_conn.h:66
Connection update indication PDU.
Definition: lctr_pdu_conn.h:76
Link layer controller message data.
uint8_t numUsedChan
#define WSF_CS_EXIT(cs)
Exit a critical section.
Definition: wsf_cs.h:74
uint32_t llcpIncompMask
Bluetooth Low Energy protocol specific operation parameters.
Vendor specific PDU handlers.
lctrDataPduHdr_t txHdr
uint8_t txPhysPending
BbBleData_t bleData
uint8_t usedChSel
lctrConnParam_t connParam
int8_t highThreshold
void(* lctrCtrlPduHdlr_t)(lctrConnCtx_t *pCtx, uint8_t *pBuf)
Call signature of a control PDU handler.
bool_t powerRptRemote
uint8_t numSentVerInd
wsfTimer_t tmrPingTimeout
wsfQueue_t txLeuQ
uint8_t consCrcFailed
static bool_t lctrCheckActiveOrPend(lctrConnCtx_t *pCtx, uint8_t proc)
Check if procedure is active, if not pend the procedure.
static bool_t lctrGetConnOpFlag(lctrConnCtx_t *pCtx, uint32_t flag)
Get connection operational mode flags.
PHY update indication PDU.
wsfQueue_t txArqQ
lctrCheckTermFn_t checkCisTerm
uint8_t monitoringState
uint32_t crcInit
void(* lctrPcPowInd_t)(lctrConnCtx_t *pCtx, uint8_t phy, int8_t delta, int8_t txPower, bool_t phyChange)
Call signature of power change indication handler.
bool_t(* lctrPktEncHdlr_t)(PalCryptoEnc_t *pEnc, uint8_t *pHdr, uint8_t *pBuf, uint8_t *pMic)
Call signature of a packet encryption handler.
bool_t ackAfterCtrlPdu
bool_t peerReqRecvd
uint16_t eventCounter
#define LL_KEY_LEN
Definition: ll_defs.h:310
uint8_t llcpActiveProc
uint32_t anchorPointUsec
uint16_t chIdentifier
uint8_t perSyncSrc
static void lctrStoreConnTimeoutTerminateReason(lctrConnCtx_t *pCtx)
Store connection timeout termination reason.
uint8_t svtState
ACL header.
Definition: lctr_pdu_conn.h:58
bool_t sendConnUpdInd
static void lctrDataTxIncAvailBuf(void)
Increment available Tx data buffers.
bool_t rxFromMaster
bool_t termAckReqd
uint8_t scaUpdAction
Queue structure.
Definition: wsf_queue.h:46
PalCryptoEnc_t enc
Definition: pal_bb_ble.h:80
bool_t powerRptLocal
void(* lctrPcMonAct_t)(lctrConnCtx_t *pCtx)
Call signature of a power monitor function.
void * pHead
head of queue
Definition: wsf_queue.h:48
uint16_t totalAcc
uint8_t lowThreshold
BbOpDesc_t connBod
uint16_t syncSkip
uint8_t nonceMode
Definition: pal_crypto.h:81
lctrDataPduHdr_t rxHdr
Version indication control PDU.
bool_t controllerInitRead
static void lctrIncPacketCounterRx(lctrConnCtx_t *pCtx)
Increment the Rx/decrypt packet counter.
uint8_t curTimeSpent
bool_t isSlvReadySent
#define LL_IV_LEN
Definition: ll_defs.h:312
bool_t initialPathLossRead
uint8_t reqErrCode
bool_t pauseTxData
Multi-protocol scheduler interface file.
#define LCTR_CH_SEL_MAX
Definition: lctr_int_conn.h:62
bool_t remoteVerValid
lctrVerInd_t remoteVer
lctrDataLen_t localDataPdu
Link layer constant definitions.
static void lctrFlagLinkTerm(lctrConnCtx_t *pCtx)
Set flags for link termination.
lctrPhyUpdInd_t phyUpd
Connection update indication PDU.
Definition: lctr_pdu_conn.h:87
PalBbBleChan_t chan
uint8_t lowHysteresis
uint32_t llcpPendMask
uint8_t requestVal
static void lctrSetBbPacketCounterRx(lctrConnCtx_t *pCtx)
Set the receive packet counter value in the BB.
bool_t syncWithMaster
static void lctrCheckControlPduAck(lctrConnCtx_t *pCtx)
Service the Control PDU ACK state after a successful reception.
uint32_t pingPeriodMs
uint32_t llcpNotifyMask
uint16_t supTimeoutMs
Timer structure.
Definition: wsf_timer.h:53
bool_t isFirstNonCtrlPdu
Data channel control PDU.
static bool_t lctrCheckForLinkTerm(lctrConnCtx_t *pCtx)
Set flags for link termination.
bool_t sendPerSync
#define LL_SKD_LEN
Definition: ll_defs.h:311
Baseband operation descriptor (BOD).
Definition: bb_api.h:149
uint8_t pingState
uint16_t effConnDurUsec
void(* lctrPcNotifyPwr_t)(lctrConnCtx_t *pCtx, uint8_t reason, uint8_t phy, int8_t txPower, uint8_t limits, int8_t delta)
Call signature of power report notification handler.
uint8_t replyWaitingMsk
uint8_t highHysteresis
wsfTimer_t tmrSupTimeout
lctrCheckCisEstAclFn_t checkCisEstAcl
void(* lctrPktCntHdlr_t)(PalCryptoEnc_t *pEnc, uint64_t pktCnt)
Call signature of a set packet count handler.
uint32_t authTimeoutMs
uint8_t numTxComp
uint8_t peerPwrLimits
lctrPhy_t phyReq
uint64_t rxPktCounter
uint8_t cisRssiExtremeTimeSpent
uint64_t usedFeatSet
uint8_t(* LctrChSelHdlr_t)(lctrConnCtx_t *pCtx, uint16_t numSkip)
Call signature of a Channel state machine handler.
Timer service.
BLE baseband interface file.
bool_t initAckRcvd
uint32_t unsyncedTime
uint16_t lastActiveEvent
lctrDataLen_t effDataPdu
uint8_t phyUpdState
bool_t(* LctrLlcpHdlr_t)(lctrConnCtx_t *pCtx, uint8_t event)
Call signature of a LLCP state machine handler.
static uint8_t lctrGetProcId(uint8_t event)
Get LLCP procedure ID.
Connection specification (LlCreateConn(), LlConnUpdate() and LlExtCreateConn()).
Definition: ll_api.h:624
uint8_t minTimeSpent
Internal link layer controller interface file.
#define WSF_CS_INIT(cs)
Initialize critical section. This macro may define a variable.
Definition: wsf_cs.h:52
uint8_t enaDecrypt
Definition: pal_crypto.h:79
#define LL_CHAN_DATA_MAX_IDX
Definition: ll_defs.h:469
static void lctrSetControlPduAck(lctrConnCtx_t *pCtx)
Service the Control PDU ACK state after a successful transmission.
Transmit buffer descriptor.
Definition: pal_bb_ble.h:131
uint16_t llcpCisHandle
uint8_t connUpdState
bool_t(* lctrCheckTermFn_t)(uint16_t aclHandle)
Check for CIS termination signature.
bool_t emptyPduFirstAtt
lctrChanMapInd_t chanMapUpd
uint8_t llcpState
uint16_t localConnDurUsec
uint64_t txPktCounter
uint16_t connInterval
#define WSF_CS_ENTER(cs)
Enter a critical section.
Definition: wsf_cs.h:63
bool_t emptyPduPend
uint8_t enaEncrypt
Definition: pal_crypto.h:78
int8_t lowThreshold
uint8_t syncMode
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.