int serial_getc(serial_t *obj) { while (!serial_readable(obj)); uint8_t data; uint32_t uart_addrs[] = UART_BASE_ADDRS; UART_HAL_Getchar(uart_addrs[obj->index], &data); return data; }
/* Function below will be removed when the UART PD driver support the poll mode later. */ static uint32_t UART_DRV_ReceivePollBlocking( uint32_t instance, uint8_t *buf, uint32_t count, uint32_t timeout) { uint32_t size = count; uint32_t baseAddr = g_uartBaseAddr[s_debugConsole.instance]; for (; size > 0; --size) { while (!UART_HAL_IsRxDataRegFull(baseAddr)) {} UART_HAL_Getchar(baseAddr, buf++); } return count; }