Make iso7816_tx_is_idle() more readable

let's use #defines and existing inline function where appropriate
This commit is contained in:
Harald Welte 2023-11-08 19:49:06 +01:00
parent c8f3e6653f
commit 1f67f0f691
1 changed files with 5 additions and 2 deletions

View File

@ -94,14 +94,17 @@ static inline void iso7816_tx_program_puts(PIO pio, uint sm, const uint8_t *s, s
static inline bool iso7816_tx_is_idle(PIO pio, uint sm)
{
uint32_t flag = (1 << (PIO_FDEBUG_TXSTALL_LSB + sm));
/* how do we know once the PIO unit has completed tx of a character?
- state machine TX fifo must be empty (FSTAT:TXEMPTY), AND
- FDEBUG:TXSTALL bit must be set
*/
/* clear the sticky STALL flag */
pio->fdebug |= (sm << 24);
if (pio->fstat & (sm << 24) && pio->fdebug & (sm << 24))
pio->fdebug |= flag;
if (pio_sm_is_tx_fifo_empty(pio, sm) && pio->fdebug & flag)
return true;
else
return false;