Skip to content

Commit a3c689a

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

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

+6-3
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
@@ -234,10 +235,12 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt)
234235
/* Weak implementation ----------------------------------------------------------------*/
235236
__WEAK void shci_cmd_resp_wait(uint32_t timeout)
236237
{
237-
(void)timeout;
238-
239238
CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT;
240-
while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);
239+
for (unsigned long start = millis(); (millis() - start) < timeout;) {
240+
if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) {
241+
break;
242+
}
243+
}
241244
}
242245

243246
__WEAK void shci_cmd_resp_release(uint32_t flag)

0 commit comments

Comments
 (0)