Skip to content

Commit e5fac04

Browse files
committed
Add gpio and interrupt settings for uart1 uart2
1 parent 0227b58 commit e5fac04

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

bsp/mini2440/drivers/uart.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,35 @@ static rt_err_t s3c2440_serial_configure(struct rt_serial_device *serial, struct
5050
static rt_err_t s3c2440_serial_control(struct rt_serial_device *serial, int cmd, void *arg)
5151
{
5252
struct hw_uart_device *uart;
53+
int mask;
5354

5455
RT_ASSERT(serial != RT_NULL);
5556
uart = (struct hw_uart_device *)serial->parent.user_data;
5657

58+
if(uart->irqno == INTUART0)
59+
{
60+
mask = BIT_SUB_RXD0;
61+
}
62+
else if(uart->irqno == INTUART1)
63+
{
64+
mask = BIT_SUB_RXD1;
65+
}
66+
else
67+
{
68+
mask = BIT_SUB_RXD2;
69+
}
70+
5771
switch (cmd)
5872
{
5973
case RT_DEVICE_CTRL_CLR_INT:
6074
/* disable rx irq */
61-
INTSUBMSK |= BIT_SUB_RXD0;
75+
INTSUBMSK |= mask;
6276

6377
break;
6478

6579
case RT_DEVICE_CTRL_SET_INT:
6680
/* enable rx irq */
67-
INTSUBMSK &= ~(BIT_SUB_RXD0);
81+
INTSUBMSK &= ~mask;
6882
break;
6983
}
7084

@@ -162,6 +176,11 @@ static struct hw_uart_device _hwserial2 = {
162176

163177
int rt_hw_uart_init(void)
164178
{
179+
/* UART0 UART1 UART2 port configure */
180+
GPHCON |= 0xAAAA;
181+
/* PULLUP is disable */
182+
GPHUP |= 0xFFF;
183+
165184
/* register UART0 device */
166185
rt_hw_serial_register(&_serial0, "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &_hwserial0);
167186
rt_hw_interrupt_install(_hwserial0.irqno, rt_hw_uart_isr, &_serial0, "uart0");

0 commit comments

Comments
 (0)