libsimtrace/card_emu: Wait for TX completion whenever required
This commit is contained in:
parent
3d1bb4f282
commit
02ace4a2af
|
@ -501,6 +501,8 @@ static int tx_byte_atr(struct card_handle *ch)
|
|||
* don't really care what the number of clock cycles or the absolute
|
||||
* wall clock time is */
|
||||
ch->waiting_time = ch->wi * 960;
|
||||
/* we need to wait until the transmitter is idle */
|
||||
card_emu_uart_wait_tx_idle(ch->uart_chan);
|
||||
/* go to next state */
|
||||
card_set_state(ch, ISO_S_WAIT_TPDU);
|
||||
return 0;
|
||||
|
@ -658,9 +660,10 @@ static int tx_byte_pts(struct card_handle *ch)
|
|||
|
||||
/* 2: Transmit the byte */
|
||||
card_emu_uart_tx(ch->uart_chan, byte);
|
||||
/* we need to wait until the transmitter is idle before changing baud rate below */
|
||||
card_emu_uart_wait_tx_idle(ch->uart_chan);
|
||||
|
||||
/* 3: Update the state */
|
||||
|
||||
switch (ch->pts.state) {
|
||||
case PTS_S_WAIT_RESP_PCK:
|
||||
card_emu_uart_wait_tx_idle(ch->uart_chan);
|
||||
|
@ -921,6 +924,9 @@ static int tx_byte_tpdu(struct card_handle *ch)
|
|||
card_emu_uart_tx(ch->uart_chan, byte);
|
||||
card_emu_uart_reset_wt(ch->uart_chan);
|
||||
|
||||
/* we need to wait until the transmitter is idle before disabling TX vi state change below */
|
||||
card_emu_uart_wait_tx_idle(ch->uart_chan);
|
||||
|
||||
/* this must happen _after_ the byte has been transmitted */
|
||||
switch (ch->tpdu.state) {
|
||||
case TPDU_S_WAIT_PB:
|
||||
|
|
Loading…
Reference in New Issue