Mistake on this page?
Report an issue in GitHub or email us
tl.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file tl.h
4  * @author MCD Application Team
5  * @brief Header for tl module
6  ******************************************************************************
7  * @attention
8  *
9  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10  * All rights reserved.</center></h2>
11  *
12  * This software component is licensed by ST under BSD 3-Clause license,
13  * the "License"; You may not use this file except in compliance with the
14  * License. You may obtain a copy of the License at:
15  * opensource.org/licenses/BSD-3-Clause
16  *
17  ******************************************************************************
18  */
19 
20 
21 /* Define to prevent recursive inclusion -------------------------------------*/
22 #ifndef __TL_H
23 #define __TL_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 
30 /* Includes ------------------------------------------------------------------*/
31 #include "stm32_wpan_common.h"
32 
33 /* Exported defines -----------------------------------------------------------*/
34 #define TL_BLECMD_PKT_TYPE ( 0x01 )
35 #define TL_ACL_DATA_PKT_TYPE ( 0x02 )
36 #define TL_BLEEVT_PKT_TYPE ( 0x04 )
37 #define TL_OTCMD_PKT_TYPE ( 0x08 )
38 #define TL_OTRSP_PKT_TYPE ( 0x09 )
39 #define TL_CLICMD_PKT_TYPE ( 0x0A )
40 #define TL_OTNOT_PKT_TYPE ( 0x0C )
41 #define TL_OTACK_PKT_TYPE ( 0x0D )
42 #define TL_CLINOT_PKT_TYPE ( 0x0E )
43 #define TL_CLIACK_PKT_TYPE ( 0x0F )
44 #define TL_SYSCMD_PKT_TYPE ( 0x10 )
45 #define TL_SYSRSP_PKT_TYPE ( 0x11 )
46 #define TL_SYSEVT_PKT_TYPE ( 0x12 )
47 #define TL_CLIRESP_PKT_TYPE ( 0x15 )
48 #define TL_M0CMD_PKT_TYPE ( 0x16 )
49 #define TL_LOCCMD_PKT_TYPE ( 0x20 )
50 #define TL_LOCRSP_PKT_TYPE ( 0x21 )
51 #define TL_TRACES_APP_PKT_TYPE ( 0x40 )
52 #define TL_TRACES_WL_PKT_TYPE ( 0x41 )
53 
54 #define TL_CMD_HDR_SIZE (4)
55 #define TL_EVT_HDR_SIZE (3)
56 #define TL_EVT_CS_PAYLOAD_SIZE (4)
57 
58 #define TL_BLEEVT_CC_OPCODE (0x0E)
59 #define TL_BLEEVT_CS_OPCODE (0x0F)
60 #define TL_BLEEVT_VS_OPCODE (0xFF)
61 
62 #define TL_BLEEVT_CS_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t))
63 #define TL_BLEEVT_CS_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CS_PACKET_SIZE)
64 
65 /* Exported types ------------------------------------------------------------*/
66 /**< Packet header */
67 typedef PACKED_STRUCT
68 {
69  uint32_t *next;
70  uint32_t *prev;
71 } TL_PacketHeader_t;
72 
73 /*******************************************************************************
74  * Event type
75  */
76 
77 /**
78  * This the payload of TL_Evt_t for a command status event
79  */
80 typedef PACKED_STRUCT
81 {
82  uint8_t status;
83  uint8_t numcmd;
84  uint16_t cmdcode;
85 } TL_CsEvt_t;
86 
87 /**
88  * This the payload of TL_Evt_t for a command complete event
89  */
90 typedef PACKED_STRUCT
91 {
92  uint8_t numcmd;
93  uint16_t cmdcode;
94  uint8_t payload[1];
95 } TL_CcEvt_t;
96 
97 /**
98  * This the payload of TL_Evt_t for an asynchronous event
99  */
100 typedef PACKED_STRUCT
101 {
102  uint16_t subevtcode;
103  uint8_t payload[1];
104 } TL_AsynchEvt_t;
105 
106 typedef PACKED_STRUCT
107 {
108  uint8_t evtcode;
109  uint8_t plen;
110  uint8_t payload[1];
111 } TL_Evt_t;
112 
113 typedef PACKED_STRUCT
114 {
115  uint8_t type;
116  TL_Evt_t evt;
117 } TL_EvtSerial_t;
118 
119 /**
120  * This format shall be used for all events (asynchronous and command response) reported
121  * by the CPU2 except for the command response of a system command where the header is not there
122  * and the format to be used shall be TL_EvtSerial_t.
123  * Note: Be careful that the asynchronous events reported by the CPU2 on the system channel do
124  * include the header and shall use TL_EvtPacket_t format. Only the command response format on the
125  * system channel is different.
126  */
127 typedef PACKED_STRUCT
128 {
129  TL_PacketHeader_t header;
130  TL_EvtSerial_t evtserial;
131 } TL_EvtPacket_t;
132 
133 /*****************************************************************************************
134  * Command type
135  */
136 
137 typedef PACKED_STRUCT
138 {
139  uint16_t cmdcode;
140  uint8_t plen;
141  uint8_t payload[255];
142 } TL_Cmd_t;
143 
144 typedef PACKED_STRUCT
145 {
146  uint8_t type;
147  TL_Cmd_t cmd;
148 } TL_CmdSerial_t;
149 
150 typedef PACKED_STRUCT
151 {
152  TL_PacketHeader_t header;
153  TL_CmdSerial_t cmdserial;
154 } TL_CmdPacket_t;
155 
156 /*****************************************************************************************
157  * HCI ACL DATA type
158  */
159 typedef PACKED_STRUCT
160 {
161  uint8_t type;
162  uint16_t handle;
163  uint16_t length;
164  uint8_t acl_data[1];
165 } TL_AclDataSerial_t;
166 
167 typedef PACKED_STRUCT
168 {
169  TL_PacketHeader_t header;
170  TL_AclDataSerial_t AclDataSerial;
171 } TL_AclDataPacket_t;
172 
173 typedef struct
174 {
175  uint8_t *p_BleSpareEvtBuffer;
176  uint8_t *p_SystemSpareEvtBuffer;
177  uint8_t *p_AsynchEvtPool;
178  uint32_t AsynchEvtPoolSize;
179  uint8_t *p_TracesEvtPool;
180  uint32_t TracesEvtPoolSize;
182 
183 typedef struct
184 {
185  uint8_t *p_ThreadOtCmdRspBuffer;
186  uint8_t *p_ThreadCliRspBuffer;
187  uint8_t *p_ThreadNotAckBuffer;
189 
190 typedef struct
191 {
192  uint8_t *p_LldTestsCliCmdRspBuffer;
193  uint8_t *p_LldTestsM0CmdBuffer;
195 
196 typedef struct
197 {
198  uint8_t *p_LldBleCmdRspBuffer;
199  uint8_t *p_LldBleM0CmdBuffer;
201 
202 typedef struct
203 {
204  uint8_t *p_Mac_802_15_4_CmdRspBuffer;
205  uint8_t *p_Mac_802_15_4_NotAckBuffer;
207 
208 typedef struct
209 {
210  uint8_t *p_ZigbeeOtCmdRspBuffer;
211  uint8_t *p_ZigbeeNotAckBuffer;
212  uint8_t *p_ZigbeeNotifRequestBuffer;
214 
215 /**
216  * @brief Contain the BLE HCI Init Configuration
217  * @{
218  */
219 typedef struct
220 {
221  void (* IoBusEvtCallBack) ( TL_EvtPacket_t *phcievt );
222  void (* IoBusAclDataTxAck) ( void );
223  uint8_t *p_cmdbuffer;
224  uint8_t *p_AclDataBuffer;
226 
227 /**
228  * @brief Contain the SYSTEM HCI Init Configuration
229  * @{
230  */
231 typedef struct
232 {
233  void (* IoBusCallBackCmdEvt) (TL_EvtPacket_t *phcievt);
234  void (* IoBusCallBackUserEvt) (TL_EvtPacket_t *phcievt);
235  uint8_t *p_cmdbuffer;
237 
238 /* Exported constants --------------------------------------------------------*/
239 /* External variables --------------------------------------------------------*/
240 /* Exported macros -----------------------------------------------------------*/
241 /* Exported functions ------------------------------------------------------- */
242 
243 /******************************************************************************
244  * GENERAL
245  ******************************************************************************/
246 void TL_Enable( void );
247 void TL_Init( void );
248 
249 /******************************************************************************
250  * BLE
251  ******************************************************************************/
252 int32_t TL_BLE_Init( void* pConf );
253 int32_t TL_BLE_SendCmd( uint8_t* buffer, uint16_t size );
254 int32_t TL_BLE_SendAclData( uint8_t* buffer, uint16_t size );
255 
256 /******************************************************************************
257  * SYSTEM
258  ******************************************************************************/
259 int32_t TL_SYS_Init( void* pConf );
260 int32_t TL_SYS_SendCmd( uint8_t* buffer, uint16_t size );
261 
262 /******************************************************************************
263  * THREAD
264  ******************************************************************************/
265 void TL_THREAD_Init( TL_TH_Config_t *p_Config );
266 void TL_OT_SendCmd( void );
267 void TL_CLI_SendCmd( void );
268 void TL_OT_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
269 void TL_THREAD_NotReceived( TL_EvtPacket_t * Notbuffer );
270 void TL_THREAD_SendAck ( void );
271 void TL_THREAD_CliSendAck ( void );
272 void TL_THREAD_CliNotReceived( TL_EvtPacket_t * Notbuffer );
273 
274 /******************************************************************************
275  * LLD TESTS
276  ******************************************************************************/
277 void TL_LLDTESTS_Init( TL_LLD_tests_Config_t *p_Config );
278 void TL_LLDTESTS_SendCliCmd( void );
279 void TL_LLDTESTS_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer );
280 void TL_LLDTESTS_SendCliRspAck( void );
281 void TL_LLDTESTS_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer );
282 void TL_LLDTESTS_SendM0CmdAck( void );
283 
284 /******************************************************************************
285  * LLD BLE
286  ******************************************************************************/
287 void TL_LLD_BLE_Init( TL_LLD_BLE_Config_t *p_Config );
288 void TL_LLD_BLE_SendCliCmd( void );
289 void TL_LLD_BLE_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer );
290 void TL_LLD_BLE_SendCliRspAck( void );
291 void TL_LLD_BLE_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer );
292 void TL_LLD_BLE_SendM0CmdAck( void );
293 void TL_LLD_BLE_SendCmd( void );
294 void TL_LLD_BLE_ReceiveRsp( TL_CmdPacket_t * Notbuffer );
295 void TL_LLD_BLE_SendRspAck( void );
296 /******************************************************************************
297  * MEMORY MANAGER
298  ******************************************************************************/
299 void TL_MM_Init( TL_MM_Config_t *p_Config );
300 void TL_MM_EvtDone( TL_EvtPacket_t * hcievt );
301 
302 /******************************************************************************
303  * TRACES
304  ******************************************************************************/
305 void TL_TRACES_Init( void );
306 void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt );
307 
308 /******************************************************************************
309  * MAC 802.15.4
310  ******************************************************************************/
311 void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config );
312 void TL_MAC_802_15_4_SendCmd( void );
313 void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
314 void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer );
315 void TL_MAC_802_15_4_SendAck ( void );
316 
317 /******************************************************************************
318  * ZIGBEE
319  ******************************************************************************/
320 void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config );
321 void TL_ZIGBEE_SendM4RequestToM0( void );
322 void TL_ZIGBEE_SendM4AckToM0Notify ( void );
323 void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer );
324 void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
325 void TL_ZIGBEE_M0RequestReceived(TL_EvtPacket_t * Otbuffer );
326 void TL_ZIGBEE_SendM4AckToM0Request(void);
327 
328 #ifdef __cplusplus
329 } /* extern "C" */
330 #endif
331 
332 #endif /*__TL_H */
333 
334 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Common file to utilities.
Contain the BLE HCI Init Configuration.
Definition: tl.h:219
Contain the SYSTEM HCI Init Configuration.
Definition: tl.h:231
typedef PACKED_STRUCT
< Packet header
Definition: tl.h:68
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.