Skip to content

Commit 7512953

Browse files
committed
fix: include a timeout when waiting for the cmd_resp
Signed-off-by: Frederic Pillon <[email protected]>
1 parent d758a66 commit 7512953

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: src/utility/STM32Cube_FW/shci_tl.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "stm_list.h"
2424
#include "shci_tl.h"
2525
#include "stm32_def.h"
26+
#include "wiring_time.h"
2627

2728
/* Private typedef -----------------------------------------------------------*/
2829
typedef enum
@@ -250,11 +251,12 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt)
250251
/* Weak implementation ----------------------------------------------------------------*/
251252
__WEAK void shci_cmd_resp_wait(uint32_t timeout)
252253
{
253-
(void)timeout;
254-
255254
CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT;
256-
while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);
257-
255+
for (unsigned long start = millis(); (millis() - start) < timeout;) {
256+
if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) {
257+
break;
258+
}
259+
}
258260
return;
259261
}
260262

0 commit comments

Comments
 (0)