Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c')
-rw-r--r--Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c b/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c
index 51245af90..7ab1e068f 100644
--- a/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c
+++ b/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c
@@ -73,7 +73,21 @@ void shci_user_evt_proc(void)
TL_EvtPacket_t *phcievtbuffer;
tSHCI_UserEvtRxParam UserEvtRxParam;
- while((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
+ /**
+ * Up to release version v1.2.0, a while loop was implemented to read out events from the queue as long as
+ * it is not empty. However, in a bare metal implementation, this leads to calling in a "blocking" mode
+ * shci_user_evt_proc() as long as events are received without giving the opportunity to run other tasks
+ * in the background.
+ * From now, the events are reported one by one. When it is checked there is still an event pending in the queue,
+ * a request to the user is made to call again shci_user_evt_proc().
+ * This gives the opportunity to the application to run other background tasks between each event.
+ */
+
+ /**
+ * It is more secure to use LST_remove_head()/LST_insert_head() compare to LST_get_next_node()/LST_remove_node()
+ * in case the user overwrite the header where the next/prev pointers are located
+ */
+ if((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
{
LST_remove_head ( &SHciAsynchEventQueue, (tListNode **)&phcievtbuffer );
@@ -99,6 +113,12 @@ void shci_user_evt_proc(void)
}
}
+ if((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
+ {
+ shci_notify_asynch_evt((void*) &SHciAsynchEventQueue);
+ }
+
+
return;
}