File tree 1 file changed +13
-3
lines changed
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 {
33
33
static int uart_rpi_poll_in (const struct device * dev , unsigned char * c )
34
34
{
35
35
const struct uart_rpi_config * config = dev -> config ;
36
+ uart_hw_t * const uart_hw = config -> uart_regs ;
36
37
37
- if (! uart_is_readable ( config -> uart_dev ) ) {
38
+ if (uart_hw -> fr & UART_UARTFR_RXFE_BITS ) {
38
39
return -1 ;
39
40
}
40
41
41
- * c = (unsigned char )uart_get_hw ( config -> uart_dev ) -> dr ;
42
+ * c = (unsigned char )uart_hw -> dr ;
42
43
return 0 ;
43
44
}
44
45
45
46
static void uart_rpi_poll_out (const struct device * dev , unsigned char c )
46
47
{
47
48
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
+ }
48
54
49
- uart_putc_raw ( config -> uart_dev , c ) ;
55
+ uart_hw -> dr = c ;
50
56
}
51
57
52
58
static int uart_rpi_init (const struct device * dev )
@@ -62,6 +68,10 @@ static int uart_rpi_init(const struct device *dev)
62
68
return ret ;
63
69
}
64
70
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
+ */
65
75
baudrate = uart_init (uart_inst , data -> baudrate );
66
76
/* Check if baudrate adjustment returned by 'uart_init' function is a positive value */
67
77
if (baudrate <= 0 ) {
You can’t perform that action at this time.
0 commit comments