Skip to content

Commit

Permalink
fix: include a timeout when waiting for the cmd_resp
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Jan 11, 2024
1 parent e1874c7 commit 8b33eb7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/utility/STM32_WPAN/shci_tl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "stm_list.h"
#include "shci_tl.h"
#include "stm32_def.h"
#include "wiring_time.h"

/* Private typedef -----------------------------------------------------------*/
typedef enum
Expand Down Expand Up @@ -251,10 +252,11 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt)
/* Weak implementation ----------------------------------------------------------------*/
__WEAK void shci_cmd_resp_wait(uint32_t timeout)
{
(void)timeout;

while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);

for (unsigned long start = millis(); (millis() - start) < timeout;) {
if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) {
break;
}
}
return;
}

Expand Down

0 comments on commit 8b33eb7

Please sign in to comment.