diff --git a/sw/bootloader/hal/include/twi_flash.h b/sw/bootloader/hal/include/twi_flash.h index 7a9eadca..f9fd69d6 100644 --- a/sw/bootloader/hal/include/twi_flash.h +++ b/sw/bootloader/hal/include/twi_flash.h @@ -18,21 +18,6 @@ int twi_flash_read_word(uint32_t addr, uint32_t* rdata); int twi_flash_write_word(uint32_t addr, uint32_t wdata); - -/** -* @brief Keeps TWI Peripheral in IDLE for 'tick_count' TWI clock ticks -* -* @param tick_count Amount of TWI NOP ticks to wait -* -*/ -inline void __attribute__ ((always_inline)) twi_flash_delay_twi_tick(int tick_count){ - - for(int i = 0; i < tick_count; i++) - { - while (NEORV32_TWI->CTRL & (1<DCMD = (uint32_t)(TWI_CMD_NOP << TWI_DCMD_CMD_LO); // IDLE for 1 twi tick - } - while (NEORV32_TWI->CTRL & (1 << TWI_CTRL_BUSY)); // wait until FIFO empty -} +void twi_flash_delay_twi_tick(int tick_count); #endif // TWI_FLASH_H diff --git a/sw/bootloader/hal/source/twi_flash.c b/sw/bootloader/hal/source/twi_flash.c index 998ba657..d7a41374 100644 --- a/sw/bootloader/hal/source/twi_flash.c +++ b/sw/bootloader/hal/source/twi_flash.c @@ -226,3 +226,19 @@ int twi_flash_write_word(uint32_t addr, uint32_t wdata) { return 1; #endif } + +/** +* @brief Keeps TWI Peripheral in IDLE for 'tick_count' TWI clock ticks +* +* @param tick_count Amount of TWI NOP ticks to wait +* +*/ +void twi_flash_delay_twi_tick(int tick_count){ + + for(int i = 0; i < tick_count; i++) + { + while (NEORV32_TWI->CTRL & (1<DCMD = (uint32_t)(TWI_CMD_NOP << TWI_DCMD_CMD_LO); // IDLE for 1 twi tick + } + while (NEORV32_TWI->CTRL & (1 << TWI_CTRL_BUSY)); // wait until FIFO empty +}