1 /**
2 ******************************************************************************
3 * File Name : Target/hw_ipcc.c
4 * Description : Hardware IPCC source file for STM32WPAN Middleware.
5 *
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>© Copyright (c) 2020 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 /* Includes ------------------------------------------------------------------*/
21 #include "app_common.h"
22 #include "mbox_def.h"
23
24 /* Global variables ---------------------------------------------------------*/
25 /* Private defines -----------------------------------------------------------*/
26 #define HW_IPCC_TX_PENDING( channel ) ( !(LL_C1_IPCC_IsActiveFlag_CHx( IPCC, channel )) ) && (((~(IPCC->C1MR)) & (channel << 16U)))
27 #define HW_IPCC_RX_PENDING( channel ) (LL_C2_IPCC_IsActiveFlag_CHx( IPCC, channel )) && (((~(IPCC->C1MR)) & (channel << 0U)))
28
29 /* Private macros ------------------------------------------------------------*/
30 /* Private typedef -----------------------------------------------------------*/
31 /* Private variables ---------------------------------------------------------*/
32 static void (*FreeBufCb)( void );
33
34 /* Private function prototypes -----------------------------------------------*/
35 static void HW_IPCC_BLE_EvtHandler( void );
36 static void HW_IPCC_BLE_AclDataEvtHandler( void );
37 static void HW_IPCC_MM_FreeBufHandler( void );
38 static void HW_IPCC_SYS_CmdEvtHandler( void );
39 static void HW_IPCC_SYS_EvtHandler( void );
40 static void HW_IPCC_TRACES_EvtHandler( void );
41
42 #ifdef THREAD_WB
43 static void HW_IPCC_OT_CmdEvtHandler( void );
44 static void HW_IPCC_THREAD_NotEvtHandler( void );
45 static void HW_IPCC_THREAD_CliNotEvtHandler( void );
46 #endif
47
48 #ifdef LLD_TESTS_WB
49 static void HW_IPCC_LLDTESTS_ReceiveCliRspHandler( void );
50 static void HW_IPCC_LLDTESTS_ReceiveM0CmdHandler( void );
51 #endif
52 #ifdef LLD_BLE_WB
53 /*static void HW_IPCC_LLD_BLE_ReceiveCliRspHandler( void );*/
54 static void HW_IPCC_LLD_BLE_ReceiveRspHandler( void );
55 static void HW_IPCC_LLD_BLE_ReceiveM0CmdHandler( void );
56 #endif
57
58 #ifdef MAC_802_15_4_WB
59 static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void );
60 static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void );
61 #endif
62
63 #ifdef ZIGBEE_WB
64 static void HW_IPCC_ZIGBEE_CmdEvtHandler( void );
65 static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void );
66 static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void );
67 #endif
68
69 /* Public function definition -----------------------------------------------*/
70
71 /******************************************************************************
72 * INTERRUPT HANDLER
73 ******************************************************************************/
HW_IPCC_Rx_Handler(void)74 void HW_IPCC_Rx_Handler( void )
75 {
76 if (HW_IPCC_RX_PENDING( HW_IPCC_SYSTEM_EVENT_CHANNEL ))
77 {
78 HW_IPCC_SYS_EvtHandler();
79 }
80 #ifdef MAC_802_15_4_WB
81 else if (HW_IPCC_RX_PENDING( HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ))
82 {
83 HW_IPCC_MAC_802_15_4_NotEvtHandler();
84 }
85 #endif /* MAC_802_15_4_WB */
86 #ifdef THREAD_WB
87 else if (HW_IPCC_RX_PENDING( HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL ))
88 {
89 HW_IPCC_THREAD_NotEvtHandler();
90 }
91 else if (HW_IPCC_RX_PENDING( HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL ))
92 {
93 HW_IPCC_THREAD_CliNotEvtHandler();
94 }
95 #endif /* THREAD_WB */
96 #ifdef LLD_TESTS_WB
97 else if (HW_IPCC_RX_PENDING( HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ))
98 {
99 HW_IPCC_LLDTESTS_ReceiveCliRspHandler();
100 }
101 else if (HW_IPCC_RX_PENDING( HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ))
102 {
103 HW_IPCC_LLDTESTS_ReceiveM0CmdHandler();
104 }
105 #endif /* LLD_TESTS_WB */
106 #ifdef LLD_BLE_WB
107 else if (HW_IPCC_RX_PENDING( HW_IPCC_LLD_BLE_RSP_CHANNEL ))
108 {
109 HW_IPCC_LLD_BLE_ReceiveRspHandler();
110 }
111 else if (HW_IPCC_RX_PENDING( HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ))
112 {
113 HW_IPCC_LLD_BLE_ReceiveM0CmdHandler();
114 }
115 #endif /* LLD_TESTS_WB */
116 #ifdef ZIGBEE_WB
117 else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ))
118 {
119 HW_IPCC_ZIGBEE_StackNotifEvtHandler();
120 }
121 else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ))
122 {
123 HW_IPCC_ZIGBEE_StackM0RequestHandler();
124 }
125 #endif /* ZIGBEE_WB */
126 else if (HW_IPCC_RX_PENDING( HW_IPCC_BLE_EVENT_CHANNEL ))
127 {
128 HW_IPCC_BLE_EvtHandler();
129 }
130 else if (HW_IPCC_RX_PENDING( HW_IPCC_TRACES_CHANNEL ))
131 {
132 HW_IPCC_TRACES_EvtHandler();
133 }
134
135 return;
136 }
137
HW_IPCC_Tx_Handler(void)138 void HW_IPCC_Tx_Handler( void )
139 {
140 if (HW_IPCC_TX_PENDING( HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ))
141 {
142 HW_IPCC_SYS_CmdEvtHandler();
143 }
144 #ifdef MAC_802_15_4_WB
145 else if (HW_IPCC_TX_PENDING( HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ))
146 {
147 HW_IPCC_MAC_802_15_4_CmdEvtHandler();
148 }
149 #endif /* MAC_802_15_4_WB */
150 #ifdef THREAD_WB
151 else if (HW_IPCC_TX_PENDING( HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL ))
152 {
153 HW_IPCC_OT_CmdEvtHandler();
154 }
155 #endif /* THREAD_WB */
156 #ifdef LLD_TESTS_WB
157 // No TX handler for LLD tests
158 #endif /* LLD_TESTS_WB */
159 #ifdef ZIGBEE_WB
160 if (HW_IPCC_TX_PENDING( HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ))
161 {
162 HW_IPCC_ZIGBEE_CmdEvtHandler();
163 }
164 #endif /* ZIGBEE_WB */
165 else if (HW_IPCC_TX_PENDING( HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ))
166 {
167 HW_IPCC_SYS_CmdEvtHandler();
168 }
169 else if (HW_IPCC_TX_PENDING( HW_IPCC_MM_RELEASE_BUFFER_CHANNEL ))
170 {
171 HW_IPCC_MM_FreeBufHandler();
172 }
173 else if (HW_IPCC_TX_PENDING( HW_IPCC_HCI_ACL_DATA_CHANNEL ))
174 {
175 HW_IPCC_BLE_AclDataEvtHandler();
176 }
177
178 return;
179 }
180 /******************************************************************************
181 * GENERAL
182 ******************************************************************************/
HW_IPCC_Enable(void)183 void HW_IPCC_Enable( void )
184 {
185 /**
186 * Such as IPCC IP available to the CPU2, it is required to keep the IPCC clock running
187 when FUS is running on CPU2 and CPU1 enters deep sleep mode
188 */
189 LL_C2_AHB3_GRP1_EnableClock(LL_C2_AHB3_GRP1_PERIPH_IPCC);
190
191 /**
192 * When the device is out of standby, it is required to use the EXTI mechanism to wakeup CPU2
193 */
194 LL_C2_EXTI_EnableEvent_32_63( LL_EXTI_LINE_41 );
195 LL_EXTI_EnableRisingTrig_32_63( LL_EXTI_LINE_41 );
196
197 /**
198 * In case the SBSFU is implemented, it may have already set the C2BOOT bit to startup the CPU2.
199 * In that case, to keep the mechanism transparent to the user application, it shall call the system command
200 * SHCI_C2_Reinit( ) before jumping to the application.
201 * When the CPU2 receives that command, it waits for its event input to be set to restart the CPU2 firmware.
202 * This is required because once C2BOOT has been set once, a clear/set on C2BOOT has no effect.
203 * When SHCI_C2_Reinit( ) is not called, generating an event to the CPU2 does not have any effect
204 * So, by default, the application shall both set the event flag and set the C2BOOT bit.
205 */
206 __SEV( ); /* Set the internal event flag and send an event to the CPU2 */
207 __WFE( ); /* Clear the internal event flag */
208 LL_PWR_EnableBootC2( );
209
210 return;
211 }
212
HW_IPCC_Init(void)213 void HW_IPCC_Init( void )
214 {
215 LL_AHB3_GRP1_EnableClock( LL_AHB3_GRP1_PERIPH_IPCC );
216
217 LL_C1_IPCC_EnableIT_RXO( IPCC );
218 LL_C1_IPCC_EnableIT_TXF( IPCC );
219
220 HAL_NVIC_EnableIRQ(IPCC_C1_RX_IRQn);
221 HAL_NVIC_EnableIRQ(IPCC_C1_TX_IRQn);
222
223 return;
224 }
225
226 /******************************************************************************
227 * BLE
228 ******************************************************************************/
HW_IPCC_BLE_Init(void)229 void HW_IPCC_BLE_Init( void )
230 {
231 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_BLE_EVENT_CHANNEL );
232
233 return;
234 }
235
HW_IPCC_BLE_SendCmd(void)236 void HW_IPCC_BLE_SendCmd( void )
237 {
238 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_BLE_CMD_CHANNEL );
239
240 return;
241 }
242
HW_IPCC_BLE_EvtHandler(void)243 static void HW_IPCC_BLE_EvtHandler( void )
244 {
245 HW_IPCC_BLE_RxEvtNot();
246
247 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_BLE_EVENT_CHANNEL );
248
249 return;
250 }
251
HW_IPCC_BLE_SendAclData(void)252 void HW_IPCC_BLE_SendAclData( void )
253 {
254 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL );
255 LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL );
256
257 return;
258 }
259
HW_IPCC_BLE_AclDataEvtHandler(void)260 static void HW_IPCC_BLE_AclDataEvtHandler( void )
261 {
262 LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL );
263
264 HW_IPCC_BLE_AclDataAckNot();
265
266 return;
267 }
268
HW_IPCC_BLE_AclDataAckNot(void)269 __weak void HW_IPCC_BLE_AclDataAckNot( void ){};
HW_IPCC_BLE_RxEvtNot(void)270 __weak void HW_IPCC_BLE_RxEvtNot( void ){};
271
272 /******************************************************************************
273 * SYSTEM
274 ******************************************************************************/
HW_IPCC_SYS_Init(void)275 void HW_IPCC_SYS_Init( void )
276 {
277 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL );
278
279 return;
280 }
281
HW_IPCC_SYS_SendCmd(void)282 void HW_IPCC_SYS_SendCmd( void )
283 {
284 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL );
285 LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL );
286
287 return;
288 }
289
HW_IPCC_SYS_CmdEvtHandler(void)290 static void HW_IPCC_SYS_CmdEvtHandler( void )
291 {
292 LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL );
293
294 HW_IPCC_SYS_CmdEvtNot();
295
296 return;
297 }
298
HW_IPCC_SYS_EvtHandler(void)299 static void HW_IPCC_SYS_EvtHandler( void )
300 {
301 HW_IPCC_SYS_EvtNot();
302
303 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL );
304
305 return;
306 }
307
HW_IPCC_SYS_CmdEvtNot(void)308 __weak void HW_IPCC_SYS_CmdEvtNot( void ){};
HW_IPCC_SYS_EvtNot(void)309 __weak void HW_IPCC_SYS_EvtNot( void ){};
310
311 /******************************************************************************
312 * MAC 802.15.4
313 ******************************************************************************/
314 #ifdef MAC_802_15_4_WB
HW_IPCC_MAC_802_15_4_Init(void)315 void HW_IPCC_MAC_802_15_4_Init( void )
316 {
317 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
318
319 return;
320 }
321
HW_IPCC_MAC_802_15_4_SendCmd(void)322 void HW_IPCC_MAC_802_15_4_SendCmd( void )
323 {
324 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );
325 LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );
326
327 return;
328 }
329
HW_IPCC_MAC_802_15_4_SendAck(void)330 void HW_IPCC_MAC_802_15_4_SendAck( void )
331 {
332 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
333 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
334
335 return;
336 }
337
HW_IPCC_MAC_802_15_4_CmdEvtHandler(void)338 static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void )
339 {
340 LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );
341
342 HW_IPCC_MAC_802_15_4_CmdEvtNot();
343
344 return;
345 }
346
HW_IPCC_MAC_802_15_4_NotEvtHandler(void)347 static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void )
348 {
349 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
350
351 HW_IPCC_MAC_802_15_4_EvtNot();
352
353 return;
354 }
HW_IPCC_MAC_802_15_4_CmdEvtNot(void)355 __weak void HW_IPCC_MAC_802_15_4_CmdEvtNot( void ){};
HW_IPCC_MAC_802_15_4_EvtNot(void)356 __weak void HW_IPCC_MAC_802_15_4_EvtNot( void ){};
357 #endif
358
359 /******************************************************************************
360 * THREAD
361 ******************************************************************************/
362 #ifdef THREAD_WB
HW_IPCC_THREAD_Init(void)363 void HW_IPCC_THREAD_Init( void )
364 {
365 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL );
366 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL );
367
368 return;
369 }
370
HW_IPCC_OT_SendCmd(void)371 void HW_IPCC_OT_SendCmd( void )
372 {
373 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL );
374 LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL );
375
376 return;
377 }
378
HW_IPCC_CLI_SendCmd(void)379 void HW_IPCC_CLI_SendCmd( void )
380 {
381 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_THREAD_CLI_CMD_CHANNEL );
382
383 return;
384 }
385
HW_IPCC_THREAD_SendAck(void)386 void HW_IPCC_THREAD_SendAck( void )
387 {
388 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL );
389 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL );
390
391 return;
392 }
393
HW_IPCC_THREAD_CliSendAck(void)394 void HW_IPCC_THREAD_CliSendAck( void )
395 {
396 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL );
397 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL );
398
399 return;
400 }
401
HW_IPCC_OT_CmdEvtHandler(void)402 static void HW_IPCC_OT_CmdEvtHandler( void )
403 {
404 LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL );
405
406 HW_IPCC_OT_CmdEvtNot();
407
408 return;
409 }
410
HW_IPCC_THREAD_NotEvtHandler(void)411 static void HW_IPCC_THREAD_NotEvtHandler( void )
412 {
413 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL );
414
415 HW_IPCC_THREAD_EvtNot();
416
417 return;
418 }
419
HW_IPCC_THREAD_CliNotEvtHandler(void)420 static void HW_IPCC_THREAD_CliNotEvtHandler( void )
421 {
422 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL );
423
424 HW_IPCC_THREAD_CliEvtNot();
425
426 return;
427 }
428
HW_IPCC_OT_CmdEvtNot(void)429 __weak void HW_IPCC_OT_CmdEvtNot( void ){};
HW_IPCC_CLI_CmdEvtNot(void)430 __weak void HW_IPCC_CLI_CmdEvtNot( void ){};
HW_IPCC_THREAD_EvtNot(void)431 __weak void HW_IPCC_THREAD_EvtNot( void ){};
432
433 #endif /* THREAD_WB */
434
435 /******************************************************************************
436 * LLD TESTS
437 ******************************************************************************/
438 #ifdef LLD_TESTS_WB
HW_IPCC_LLDTESTS_Init(void)439 void HW_IPCC_LLDTESTS_Init( void )
440 {
441 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL );
442 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL );
443 return;
444 }
445
HW_IPCC_LLDTESTS_SendCliCmd(void)446 void HW_IPCC_LLDTESTS_SendCliCmd( void )
447 {
448 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_LLDTESTS_CLI_CMD_CHANNEL );
449 return;
450 }
451
HW_IPCC_LLDTESTS_ReceiveCliRspHandler(void)452 static void HW_IPCC_LLDTESTS_ReceiveCliRspHandler( void )
453 {
454 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL );
455 HW_IPCC_LLDTESTS_ReceiveCliRsp();
456 return;
457 }
458
HW_IPCC_LLDTESTS_SendCliRspAck(void)459 void HW_IPCC_LLDTESTS_SendCliRspAck( void )
460 {
461 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL );
462 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL );
463 return;
464 }
465
HW_IPCC_LLDTESTS_ReceiveM0CmdHandler(void)466 static void HW_IPCC_LLDTESTS_ReceiveM0CmdHandler( void )
467 {
468 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL );
469 HW_IPCC_LLDTESTS_ReceiveM0Cmd();
470 return;
471 }
472
473
HW_IPCC_LLDTESTS_SendM0CmdAck(void)474 void HW_IPCC_LLDTESTS_SendM0CmdAck( void )
475 {
476 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL );
477 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL );
478 return;
479 }
HW_IPCC_LLDTESTS_ReceiveCliRsp(void)480 __weak void HW_IPCC_LLDTESTS_ReceiveCliRsp( void ){};
HW_IPCC_LLDTESTS_ReceiveM0Cmd(void)481 __weak void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void ){};
482 #endif /* LLD_TESTS_WB */
483
484 /******************************************************************************
485 * LLD BLE
486 ******************************************************************************/
487 #ifdef LLD_BLE_WB
HW_IPCC_LLD_BLE_Init(void)488 void HW_IPCC_LLD_BLE_Init( void )
489 {
490 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL );
491 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL );
492 return;
493 }
494
HW_IPCC_LLD_BLE_SendCliCmd(void)495 void HW_IPCC_LLD_BLE_SendCliCmd( void )
496 {
497 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CLI_CMD_CHANNEL );
498 return;
499 }
500
501 /*static void HW_IPCC_LLD_BLE_ReceiveCliRspHandler( void )
502 {
503 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_CLI_RSP_CHANNEL );
504 HW_IPCC_LLD_BLE_ReceiveCliRsp();
505 return;
506 }*/
507
HW_IPCC_LLD_BLE_SendCliRspAck(void)508 void HW_IPCC_LLD_BLE_SendCliRspAck( void )
509 {
510 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CLI_RSP_CHANNEL );
511 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_CLI_RSP_CHANNEL );
512 return;
513 }
514
HW_IPCC_LLD_BLE_ReceiveM0CmdHandler(void)515 static void HW_IPCC_LLD_BLE_ReceiveM0CmdHandler( void )
516 {
517 //LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL );
518 HW_IPCC_LLD_BLE_ReceiveM0Cmd();
519 return;
520 }
521
522
HW_IPCC_LLD_BLE_SendM0CmdAck(void)523 void HW_IPCC_LLD_BLE_SendM0CmdAck( void )
524 {
525 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL );
526 //LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL );
527 return;
528 }
HW_IPCC_LLD_BLE_ReceiveCliRsp(void)529 __weak void HW_IPCC_LLD_BLE_ReceiveCliRsp( void ){};
HW_IPCC_LLD_BLE_ReceiveM0Cmd(void)530 __weak void HW_IPCC_LLD_BLE_ReceiveM0Cmd( void ){};
531
532 /* Transparent Mode */
HW_IPCC_LLD_BLE_SendCmd(void)533 void HW_IPCC_LLD_BLE_SendCmd( void )
534 {
535 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CMD_CHANNEL );
536 return;
537 }
538
HW_IPCC_LLD_BLE_ReceiveRspHandler(void)539 static void HW_IPCC_LLD_BLE_ReceiveRspHandler( void )
540 {
541 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL );
542 HW_IPCC_LLD_BLE_ReceiveRsp();
543 return;
544 }
545
HW_IPCC_LLD_BLE_SendRspAck(void)546 void HW_IPCC_LLD_BLE_SendRspAck( void )
547 {
548 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL );
549 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL );
550 return;
551 }
552
553 #endif /* LLD_BLE_WB */
554
555 /******************************************************************************
556 * ZIGBEE
557 ******************************************************************************/
558 #ifdef ZIGBEE_WB
HW_IPCC_ZIGBEE_Init(void)559 void HW_IPCC_ZIGBEE_Init( void )
560 {
561 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
562 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
563
564 return;
565 }
566
HW_IPCC_ZIGBEE_SendM4RequestToM0(void)567 void HW_IPCC_ZIGBEE_SendM4RequestToM0( void )
568 {
569 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );
570 LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );
571
572 return;
573 }
574
HW_IPCC_ZIGBEE_SendM4AckToM0Notify(void)575 void HW_IPCC_ZIGBEE_SendM4AckToM0Notify( void )
576 {
577 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
578 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
579
580 return;
581 }
582
HW_IPCC_ZIGBEE_CmdEvtHandler(void)583 static void HW_IPCC_ZIGBEE_CmdEvtHandler( void )
584 {
585 LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );
586
587 HW_IPCC_ZIGBEE_RecvAppliAckFromM0();
588
589 return;
590 }
591
HW_IPCC_ZIGBEE_StackNotifEvtHandler(void)592 static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void )
593 {
594 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
595
596 HW_IPCC_ZIGBEE_RecvM0NotifyToM4();
597
598 return;
599 }
600
HW_IPCC_ZIGBEE_StackM0RequestHandler(void)601 static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void )
602 {
603 LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
604
605 HW_IPCC_ZIGBEE_RecvM0RequestToM4();
606
607 return;
608 }
609
HW_IPCC_ZIGBEE_SendM4AckToM0Request(void)610 void HW_IPCC_ZIGBEE_SendM4AckToM0Request( void )
611 {
612 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
613 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
614
615 return;
616 }
617
HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void)618 __weak void HW_IPCC_ZIGBEE_RecvAppliAckFromM0( void ){};
HW_IPCC_ZIGBEE_RecvM0NotifyToM4(void)619 __weak void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void ){};
HW_IPCC_ZIGBEE_RecvM0RequestToM4(void)620 __weak void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void ){};
621 #endif /* ZIGBEE_WB */
622
623 /******************************************************************************
624 * MEMORY MANAGER
625 ******************************************************************************/
HW_IPCC_MM_SendFreeBuf(void (* cb)(void))626 void HW_IPCC_MM_SendFreeBuf( void (*cb)( void ) )
627 {
628 if ( LL_C1_IPCC_IsActiveFlag_CHx( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL ) )
629 {
630 FreeBufCb = cb;
631 LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL );
632 }
633 else
634 {
635 cb();
636
637 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL );
638 }
639
640 return;
641 }
642
HW_IPCC_MM_FreeBufHandler(void)643 static void HW_IPCC_MM_FreeBufHandler( void )
644 {
645 LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL );
646
647 FreeBufCb();
648
649 LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL );
650
651 return;
652 }
653
654 /******************************************************************************
655 * TRACES
656 ******************************************************************************/
HW_IPCC_TRACES_Init(void)657 void HW_IPCC_TRACES_Init( void )
658 {
659 LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_TRACES_CHANNEL );
660
661 return;
662 }
663
HW_IPCC_TRACES_EvtHandler(void)664 static void HW_IPCC_TRACES_EvtHandler( void )
665 {
666 HW_IPCC_TRACES_EvtNot();
667
668 LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_TRACES_CHANNEL );
669
670 return;
671 }
672
HW_IPCC_TRACES_EvtNot(void)673 __weak void HW_IPCC_TRACES_EvtNot( void ){};
674
675 /******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/
676