打开设置
serial_init_dev 中设置波特率,因为_serial_setbrg调用的是全局的gd->baudrate,所以要打开某个串口是需要先保留gd->baudrate的最先值,完成后在恢复现场。
读写
void _serial_putc (const uchar c, const int dev_index)
{
S3C64XX_UART *const uart = S3C64XX_GetBase_UART(dev_index);
#ifdef CONFIG_MODEM_SUPPORT
if (be_quiet)
return;
#endif
/* wait for room in the tx FIFO */
while (!(uart->UTRSTAT & 0x2));
#ifdef CONFIG_HWFLOW
/* Wait for CTS up */
while(hwflow && !(uart->UMSTAT & 0x1));
#endif
uart->UTXH = c;
}
|
int _serial_getc (const int dev_index)
{
S3C64XX_UART *const uart = S3C64XX_GetBase_UART(dev_index);
/* wait for character to arrive */
while (!(uart->UTRSTAT & 0x1));
return uart->URXH & 0xff;
}
|
阅读(653) | 评论(0) | 转发(0) |