Mistake on this page?
Report an issue in GitHub or email us
lctr_api.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Link layer controller common 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_API_H
26 #define LCTR_API_H
27 
28 #include "ll_api.h"
29 #include "ll_defs.h"
30 #include "bb_api.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*!
37  * \addtogroup LL_LCTR_API
38  * \{
39  */
40 
41 /**************************************************************************************************
42  Constants
43 **************************************************************************************************/
44 
45 /*! \brief Message dispatch handler types. */
46 enum
47 {
48  LCTR_DISP_CONN_IND, /*!< Advertising channel connection indication dispatch handler type. */
49  LCTR_DISP_CONN, /*!< Connection message dispatch handler type. */
50  LCTR_DISP_SCAN, /*!< Scan message dispatch handler type. */
51  LCTR_DISP_INIT, /*!< Initiate message dispatch handler type. */
52  LCTR_DISP_ADV, /*!< Advertising message dispatch handler type. */
53  LCTR_DISP_TEST, /*!< Test message dispatch handler type. */
54  LCTR_DISP_PRIV, /*!< Privacy message dispatch handler type. */
55  LCTR_DISP_EXT_SCAN, /*!< Extended Scan message dispatch handler type. */
56  LCTR_DISP_EXT_ADV, /*!< Extended Advertising message dispatch handler type. */
57  LCTR_DISP_EXT_INIT, /*!< Extended Initiate message dispatch handler type. */
58  LCTR_DISP_PER_ADV, /*!< Periodic Advertising message dispatch handler type. */
59  LCTR_DISP_PER_CREATE_SYNC, /*!< Periodic Create Sync message dispatch handler type. */
60  LCTR_DISP_TRANFER_SYNC, /*!< Periodic Sync Transfer message dispatch handler type. */
61  LCTR_DISP_PER_SCAN, /*!< Periodic Scanning message dispatch handler type. */
62  LCTR_DISP_ACAD, /*!< ACAD message dispatch handler type (currently only used by slave). */
63  LCTR_DISP_CIS, /*!< Connected Isochronous Stream dispatch handler type. */
64  LCTR_DISP_BIG_BCST, /*!< Broadcast Isochronous Group broadcasting message dispatch handler type. */
65  LCTR_DISP_BIG_SYNC, /*!< Broadcast Isochronous Group synchronization message dispatch handler type. */
66  LCTR_DISP_TOTAL, /*!< Total number of dispatch handlers. */
67  /* Special IDs */
68  LCTR_DISP_FIRST_SM = LCTR_DISP_CONN_IND+1, /*!< First state machine. */
69  LCTR_DISP_LAST_SM = LCTR_DISP_TOTAL-1, /*!< Last state machine. */
70  LCTR_DISP_BCST = 0xFF /*!< Broadcast message type. */
71 };
72 
73 /*! \brief Broadcast task messages. */
74 enum
75 {
76  LCTR_MSG_RESET /*!< Reset API message. */
77 };
78 
79 /*! \brief Task event mask bit positions. */
80 enum
81 {
82  LCTR_EVENT_RX_PENDING, /*!< Receive data PDU pending. */
83  LCTR_EVENT_TX_PENDING, /*!< Transmit data PDU pending. */
84  LCTR_EVENT_TX_COMPLETE, /*!< Transmit data PDU completed. */
85  LCTR_EVENT_CIS_TX_PENDING, /*!< Transmit data PDU pending. */
86  LCTR_EVENT_CIS_RX_PENDING, /*!< Receive data PDU pending. */
87  LCTR_EVENT_ISO_TX_COMPLETE, /*!< Transmit ISO SDU completed. */
88  LCTR_EVENT_RX_ADVB, /*!< Receive AdvB PDU completed. */
89  LCTR_EVENT_RX_DIRECT_ADVB, /*!< Receive direct AdvB PDU completed. */
90  LCTR_EVENT_RX_SCAN_REQ, /*!< Receive scan request PDU completed. */
91  LCTR_EVENT_SC_GENERATE_P256_KEY_PAIR, /*!< Generate P-256 public/private key pair. */
92  LCTR_EVENT_SC_GENERATE_DHKEY, /*!< Generate Diffie-Hellman key. */
93  LCTR_EVENT_TOTAL /*!< Total number of event handlers. */
94 };
95 
96 /*! \brief Waiting host reply bitmask. */
97 enum
98 {
99  LCTR_HOST_REPLY_CONN_PARAM_REQ = (1 << 0), /*!< Waiting for host to submit a connection parameter request reply. */
100  LCTR_HOST_REPLY_LTK_REQ = (1 << 1), /*!< Waiting for host to submit a LTK request reply. */
101  LCTR_HOST_REPLY_CIS_REQ = (1 << 2), /*!< Waiting for host to submit a CIS request reply. */
102 };
103 
104 /**************************************************************************************************
105  Data Types
106 **************************************************************************************************/
107 
108 /*! \brief Common message structure passed to event handler. */
109 typedef struct
110 {
111  uint16_t handle; /*!< Handle. */
112  uint8_t dispId; /*!< Dispatch ID. */
113  uint8_t event; /*!< Event ID. */
114 } lctrMsgHdr_t;
115 
116 /*! \brief Channel map update message. */
117 typedef struct
118 {
119  lctrMsgHdr_t hdr; /*!< Message header. */
120  uint64_t chanMap; /*!< Channel map. */
122 
123 /*! \brief BIG created message. */
124 typedef struct
125 {
126  lctrMsgHdr_t hdr; /*!< Message header. */
127  uint8_t bigHandle; /*!< BIG handle. */
129 
130 /*! \brief Connect request PDU. */
131 typedef struct
132 {
133  uint64_t initAddr; /*!< Scanner's address. */
134  uint64_t advAddr; /*!< Advertiser's address. */
135 
136  uint32_t accessAddr; /*!< Connection access address. */
137  uint32_t crcInit; /*!< CRC initialization value. */
138  uint64_t chanMask; /*!< Channel mask. */
139  uint16_t interval; /*!< connInterval value. */
140  uint16_t latency; /*!< connSlaveLatency value. */
141  uint16_t timeout; /*!< connSupervisionTimeout value. */
142  uint8_t txWinSize; /*!< transmitWindowSize value. */
143  uint16_t txWinOffset; /*!< transmitWindowOffset value. */
144  uint8_t hopInc; /*!< hopIncrement value. */
145  uint8_t masterSca; /*!< Master sleep clock accuracy. */
146 } lctrConnInd_t;
147 
148 /*! \brief Connection establish. */
149 typedef struct
150 {
151  lctrMsgHdr_t hdr; /*!< Message header. */
152  lctrConnInd_t connInd; /*!< Connection indication. */
153  uint32_t connIndEndTsUsec; /*!< Connection indication packet end timestamp in microseconds. */
154  uint8_t peerIdAddrType; /*!< Peer identity address type. */
155  uint8_t usedChSel; /*!< Used channel selection. */
156  uint8_t phy; /*!< PHY selection. */
157  bool_t sendAdvSetTerm; /*!< Send Advertising Set Termination event. */
158  uint8_t numExtAdvEvents; /*!< Number of completed extended advertising events. */
159  bool_t isAuxConnReq; /*!< True if AUX_CON_REQ is received, False if CONN_IND is received. */
160  uint64_t peerIdAddr; /*!< Peer identity address. */
161  uint64_t peerRpa; /*!< Peer RPA. */
162  uint64_t localRpa; /*!< Local RPA. */
164 
165 /**************************************************************************************************
166  Global Variables
167 **************************************************************************************************/
168 
169 /*! \brief Call signature for periodic enabled check function */
170 typedef bool_t (*LctrIsPerAdvEnabledFn_t)(uint8_t handle);
171 
172 /*! \brief Function pointer for periodic advertising enable check */
174 
175 /*! \brief Call signature to update CIS channel map */
176 typedef void (*LctrUpdateCisChanMapFn_t)(uint16_t aclHandle);
177 
178 /*! \brief Function pointer to update CIS channel map */
180 
181 /*! \brief Call signature for extended scan enabled check function. */
182 typedef bool_t (*LctrExtCheckFn_t)(uint8_t scanPhy);
183 
184 /*! \brief Function pointer for extended scan enable check. */
186 
187 /*! \brief Function pointer for extended advertising init enable check. */
189 
190 /*! \brief Call signature for periodic sync pending check. */
191 typedef bool_t (*LctrPerSyncPendFn_t)(void);
192 
193 /*! \brief Function pointer for periodic sync pending check. */
195 
196 /*! \brief Runtime configuration. */
197 extern const LlRtCfg_t *pLctrRtCfg;
198 
199 /**************************************************************************************************
200  Function Declarations
201 **************************************************************************************************/
202 
203 /* Initialization */
204 uint16_t LctrInitAdvSetMem(uint8_t *pFreeMem, uint32_t freeMemSize);
205 uint16_t LctrInitExtScanMem(uint8_t *pFreeMem, uint32_t freeMemSize);
206 uint16_t LctrInitConnMem(uint8_t *pFreeMem, uint32_t freeMemSize);
207 void LctrSetSupStates(void);
208 
209 /* Task */
210 void LctrMsgDispatcher(lctrMsgHdr_t *pMsg);
211 void LctrEventHandler(uint8_t event);
212 
213 /* Control */
214 uint8_t LctrSetChannelClass(uint64_t chanMap);
215 
216 /*! \} */ /* LL_LCTR_API */
217 
218 #ifdef __cplusplus
219 };
220 #endif
221 
222 #endif /* LCTR_API_H */
uint8_t peerIdAddrType
Definition: lctr_api.h:154
uint16_t handle
Definition: lctr_api.h:111
Link layer interface file.
const LlRtCfg_t * pLctrRtCfg
Runtime configuration.
lctrMsgHdr_t hdr
Definition: lctr_api.h:119
uint16_t timeout
Definition: lctr_api.h:141
uint8_t masterSca
Definition: lctr_api.h:145
Channel map update message.
Definition: lctr_api.h:117
lctrConnInd_t connInd
Definition: lctr_api.h:152
uint8_t event
Definition: lctr_api.h:113
uint16_t txWinOffset
Definition: lctr_api.h:143
bool_t(* LctrExtCheckFn_t)(uint8_t scanPhy)
Call signature for extended scan enabled check function.
Definition: lctr_api.h:182
Connect request PDU.
Definition: lctr_api.h:131
LctrExtCheckFn_t LctrMstExtScanEnabled
Function pointer for extended scan enable check.
bool_t sendAdvSetTerm
Definition: lctr_api.h:157
uint8_t hopInc
Definition: lctr_api.h:144
LctrPerSyncPendFn_t LctrMstPerSyncPending
Function pointer for periodic sync pending check.
lctrMsgHdr_t hdr
Definition: lctr_api.h:151
LL runtime configuration parameters.
Definition: ll_api.h:124
uint32_t accessAddr
Definition: lctr_api.h:136
uint64_t peerRpa
Definition: lctr_api.h:161
uint64_t peerIdAddr
Definition: lctr_api.h:160
Connection establish.
Definition: lctr_api.h:149
BIG created message.
Definition: lctr_api.h:124
LctrExtCheckFn_t LctrMstExtInitEnabled
Function pointer for extended advertising init enable check.
uint16_t interval
Definition: lctr_api.h:139
void(* LctrUpdateCisChanMapFn_t)(uint16_t aclHandle)
Call signature to update CIS channel map.
Definition: lctr_api.h:176
uint8_t bigHandle
Definition: lctr_api.h:127
LctrUpdateCisChanMapFn_t LctrUpdateCisChanMapFn
Function pointer to update CIS channel map.
uint32_t connIndEndTsUsec
Definition: lctr_api.h:153
uint32_t crcInit
Definition: lctr_api.h:137
bool_t(* LctrPerSyncPendFn_t)(void)
Call signature for periodic sync pending check.
Definition: lctr_api.h:191
bool_t(* LctrIsPerAdvEnabledFn_t)(uint8_t handle)
Call signature for periodic enabled check function.
Definition: lctr_api.h:170
Common message structure passed to event handler.
Definition: lctr_api.h:109
uint64_t chanMap
Definition: lctr_api.h:120
Link layer constant definitions.
uint16_t latency
Definition: lctr_api.h:140
uint64_t chanMask
Definition: lctr_api.h:138
Baseband interface file.
uint64_t advAddr
Definition: lctr_api.h:134
LctrIsPerAdvEnabledFn_t LctrPerAdvEnabled
Function pointer for periodic advertising enable check.
lctrMsgHdr_t hdr
Definition: lctr_api.h:126
uint64_t initAddr
Definition: lctr_api.h:133
uint8_t txWinSize
Definition: lctr_api.h:142
uint8_t dispId
Definition: lctr_api.h:112
uint64_t localRpa
Definition: lctr_api.h:162
uint8_t numExtAdvEvents
Definition: lctr_api.h:158
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.