wait for UART Tx completion before switching baud rate at PTS

This commit is contained in:
Harald Welte
2016-03-20 14:57:53 +01:00
parent c8beefbf85
commit c58bba0833
3 changed files with 8 additions and 0 deletions

View File

@@ -454,6 +454,7 @@ static int tx_byte_pts(struct card_handle *ch)
switch (ch->pts.state) {
case PTS_S_WAIT_RESP_PCK:
card_emu_uart_wait_tx_idle(ch->uart_chan);
/* update baud rate generator with Fi/Di */
emu_update_fidi(ch);
/* Wait for the next TPDU */

View File

@@ -35,3 +35,4 @@ void card_emu_report_status(struct card_handle *ch);
int card_emu_uart_update_fidi(uint8_t uart_chan, unsigned int fidi);
int card_emu_uart_tx(uint8_t uart_chan, uint8_t byte);
void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx);
void card_emu_uart_wait_tx_idle(uint8_t uart_chan);

View File

@@ -97,6 +97,12 @@ static void wait_tx_idle(Usart *usart)
}
}
void card_emu_uart_wait_tx_idle(uint8_t uart_chan)
{
Usart *usart = get_usart_by_chan(uart_chan);
wait_tx_idle(usart);
}
/* call-back from card_emu.c to enable/disable transmit and/or receive */
void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx)
{