File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -33,20 +33,26 @@ struct uart_rpi_data {
3333static int uart_rpi_poll_in (const struct device * dev , unsigned char * c )
3434{
3535 const struct uart_rpi_config * config = dev -> config ;
36+ uart_hw_t * const uart_hw = config -> uart_regs ;
3637
37- if (! uart_is_readable ( config -> uart_dev ) ) {
38+ if (uart_hw -> fr & UART_UARTFR_RXFE_BITS ) {
3839 return -1 ;
3940 }
4041
41- * c = (unsigned char )uart_get_hw ( config -> uart_dev ) -> dr ;
42+ * c = (unsigned char )uart_hw -> dr ;
4243 return 0 ;
4344}
4445
4546static void uart_rpi_poll_out (const struct device * dev , unsigned char c )
4647{
4748 const struct uart_rpi_config * config = dev -> config ;
49+ uart_hw_t * const uart_hw = config -> uart_regs ;
50+
51+ while (uart_hw -> fr & UART_UARTFR_TXFF_BITS ) {
52+ /* Wait */
53+ }
4854
49- uart_putc_raw ( config -> uart_dev , c ) ;
55+ uart_hw -> dr = c ;
5056}
5157
5258static int uart_rpi_init (const struct device * dev )
@@ -62,6 +68,10 @@ static int uart_rpi_init(const struct device *dev)
6268 return ret ;
6369 }
6470
71+ /*
72+ * uart_init() may be replaced by register based API once rpi-pico platform
73+ * has a clock controller driver and a reset controller driver
74+ */
6575 baudrate = uart_init (uart_inst , data -> baudrate );
6676 /* Check if baudrate adjustment returned by 'uart_init' function is a positive value */
6777 if (baudrate <= 0 ) {
You can’t perform that action at this time.
0 commit comments