mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-24 14:17:51 -04:00
[sw/bootloader] removed inline attribute for twi_flash_delay_twi_tick
This commit is contained in:
parent
23ca1ae782
commit
540073097f
2 changed files with 17 additions and 16 deletions
|
@ -18,21 +18,6 @@
|
||||||
|
|
||||||
int twi_flash_read_word(uint32_t addr, uint32_t* rdata);
|
int twi_flash_read_word(uint32_t addr, uint32_t* rdata);
|
||||||
int twi_flash_write_word(uint32_t addr, uint32_t wdata);
|
int twi_flash_write_word(uint32_t addr, uint32_t wdata);
|
||||||
|
void twi_flash_delay_twi_tick(int tick_count);
|
||||||
/**
|
|
||||||
* @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<<TWI_CTRL_TX_FULL)); // wait for free TX entry
|
|
||||||
NEORV32_TWI->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
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // TWI_FLASH_H
|
#endif // TWI_FLASH_H
|
||||||
|
|
|
@ -226,3 +226,19 @@ int twi_flash_write_word(uint32_t addr, uint32_t wdata) {
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#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<<TWI_CTRL_TX_FULL)); // wait for free TX entry
|
||||||
|
NEORV32_TWI->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
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue