From 833802c921a53d1ee6a71049943edaebd1466d1b Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Wed, 6 Jul 2016 14:44:33 -0400 Subject: Add reentrancy protection to fmc_read_32. --- stm-fmc.c | 107 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 50 insertions(+), 57 deletions(-) diff --git a/stm-fmc.c b/stm-fmc.c index 698f7af..01e642c 100644 --- a/stm-fmc.c +++ b/stm-fmc.c @@ -39,8 +39,6 @@ static SRAM_HandleTypeDef _fmc_fpga_inst; static HAL_StatusTypeDef _fmc_init_params(void); -static int _fmc_nwait_idle(void); - HAL_StatusTypeDef fmc_init(void) { @@ -59,83 +57,78 @@ HAL_StatusTypeDef fmc_init(void) } +static int _fmc_nwait_idle(void) +{ + int cnt; + + // poll NWAIT (number of iterations is limited) + for (cnt=0; cnt= FMC_FPGA_NWAIT_MAX_POLL_TICKS) return -1; - - // ok - return 0; -} - void fmc_init_gpio(void) { GPIO_InitTypeDef GPIO_InitStruct; -- cgit v1.2.3