diff options
| author | Jonne <[email protected]> | 2020-04-11 21:12:15 +0800 |
|---|---|---|
| committer | Jonne <[email protected]> | 2020-04-11 21:14:12 +0800 |
| commit | e5fac04e7deb0f1ba777660e46d5ce0c421f83ca (patch) | |
| tree | 61a39805cf29b6de940c4f587c6f62b7f50dd6f6 | |
| parent | 0227b5823e39087f4d2f466dc7eec4c8a004bf48 (diff) | |
Add gpio and interrupt settings for uart1 uart2
| -rw-r--r-- | bsp/mini2440/drivers/uart.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/bsp/mini2440/drivers/uart.c b/bsp/mini2440/drivers/uart.c index f7bf1d9461..cd18c343d4 100644 --- a/bsp/mini2440/drivers/uart.c +++ b/bsp/mini2440/drivers/uart.c @@ -50,21 +50,35 @@ static rt_err_t s3c2440_serial_configure(struct rt_serial_device *serial, struct static rt_err_t s3c2440_serial_control(struct rt_serial_device *serial, int cmd, void *arg) { struct hw_uart_device *uart; + int mask; RT_ASSERT(serial != RT_NULL); uart = (struct hw_uart_device *)serial->parent.user_data; + if(uart->irqno == INTUART0) + { + mask = BIT_SUB_RXD0; + } + else if(uart->irqno == INTUART1) + { + mask = BIT_SUB_RXD1; + } + else + { + mask = BIT_SUB_RXD2; + } + switch (cmd) { case RT_DEVICE_CTRL_CLR_INT: /* disable rx irq */ - INTSUBMSK |= BIT_SUB_RXD0; + INTSUBMSK |= mask; break; case RT_DEVICE_CTRL_SET_INT: /* enable rx irq */ - INTSUBMSK &= ~(BIT_SUB_RXD0); + INTSUBMSK &= ~mask; break; } @@ -162,6 +176,11 @@ static struct hw_uart_device _hwserial2 = { int rt_hw_uart_init(void) { + /* UART0 UART1 UART2 port configure */ + GPHCON |= 0xAAAA; + /* PULLUP is disable */ + GPHUP |= 0xFFF; + /* register UART0 device */ rt_hw_serial_register(&_serial0, "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &_hwserial0); rt_hw_interrupt_install(_hwserial0.irqno, rt_hw_uart_isr, &_serial0, "uart0"); |
