diff options
Diffstat (limited to 'bsp/mini2440/drivers/board.c')
| -rw-r--r-- | bsp/mini2440/drivers/board.c | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/bsp/mini2440/drivers/board.c b/bsp/mini2440/drivers/board.c index a8592610aa..8029a7c507 100644 --- a/bsp/mini2440/drivers/board.c +++ b/bsp/mini2440/drivers/board.c @@ -8,7 +8,7 @@ * 2006-03-24 Bernard first implementation * 2006-05-05 Bernard add DATA_COUNT definition * 2006-10-05 Alsor.Z for s3c2410x porting - * 2007-11-20 Yi.Qiu add lcd,touch,console + * 2007-11-20 Yi.Qiu add lcd,touch,console */ #include <rtthread.h> @@ -31,23 +31,23 @@ extern void rt_hw_get_clock(void); extern void rt_hw_set_dividor(rt_uint8_t hdivn, rt_uint8_t pdivn); extern void rt_hw_set_clock(rt_uint8_t sdiv, rt_uint8_t pdiv, rt_uint8_t mdiv); -#define UART0 ((struct uartport *)&U0BASE) +#define UART0 ((struct uartport *)&U0BASE) struct serial_int_rx uart0_int_rx; struct serial_device uart0 = { - UART0, - &uart0_int_rx, - RT_NULL + UART0, + &uart0_int_rx, + RT_NULL }; struct rt_device uart0_device; -#define UART2 ((struct uartport *)&U2BASE) +#define UART2 ((struct uartport *)&U2BASE) struct serial_int_rx uart2_int_rx; struct serial_device uart2 = { - UART2, - &uart2_int_rx, - RT_NULL + UART2, + &uart2_int_rx, + RT_NULL }; struct rt_device uart2_device; @@ -56,7 +56,7 @@ struct rt_device uart2_device; */ static void rt_timer_handler(int vector, void *param) { - rt_tick_increase(); + rt_tick_increase(); } /** @@ -64,14 +64,14 @@ static void rt_timer_handler(int vector, void *param) */ static void rt_serial0_handler(int vector, void *param) { - INTSUBMSK |= (BIT_SUB_RXD0); + INTSUBMSK |= (BIT_SUB_RXD0); - rt_hw_serial_isr(&uart0_device); + rt_hw_serial_isr(&uart0_device); - SUBSRCPND |= BIT_SUB_RXD0; + SUBSRCPND |= BIT_SUB_RXD0; - /* Unmask sub interrupt (RXD0) */ - INTSUBMSK &=~(BIT_SUB_RXD0); + /* Unmask sub interrupt (RXD0) */ + INTSUBMSK &=~(BIT_SUB_RXD0); } /** @@ -79,14 +79,14 @@ static void rt_serial0_handler(int vector, void *param) */ static void rt_serial2_handler(int vector, void *param) { - INTSUBMSK |= (BIT_SUB_RXD2); + INTSUBMSK |= (BIT_SUB_RXD2); - rt_hw_serial_isr(&uart2_device); + rt_hw_serial_isr(&uart2_device); - SUBSRCPND |= BIT_SUB_RXD2; + SUBSRCPND |= BIT_SUB_RXD2; - /* Unmask sub interrupt (RXD0) */ - INTSUBMSK &=~(BIT_SUB_RXD2); + /* Unmask sub interrupt (RXD0) */ + INTSUBMSK &=~(BIT_SUB_RXD2); } /** @@ -94,55 +94,55 @@ static void rt_serial2_handler(int vector, void *param) */ static void rt_hw_uart_init(void) { - int i; - /* UART0 port configure */ - GPHCON |= 0xAA; - /* PULLUP is disable */ - GPHUP |= 0xF; + int i; + /* UART0 port configure */ + GPHCON |= 0xAA; + /* PULLUP is disable */ + GPHUP |= 0xF; - /* FIFO enable, Tx/Rx FIFO clear */ - uart0.uart_device->ufcon = 0x0; - /* disable the flow control */ - uart0.uart_device->umcon = 0x0; - /* Normal,No parity,1 stop,8 bit */ - uart0.uart_device->ulcon = 0x3; - /* - * tx=level,rx=edge,disable timeout int.,enable rx error int., - * normal,interrupt or polling - */ - uart0.uart_device->ucon = 0x245; - /* Set uart0 bps */ - uart0.uart_device->ubrd = (rt_int32_t)(PCLK / (BPS * 16)) - 1; - /* output PCLK to UART0/1, PWMTIMER */ - CLKCON |= 0x0D00; + /* FIFO enable, Tx/Rx FIFO clear */ + uart0.uart_device->ufcon = 0x0; + /* disable the flow control */ + uart0.uart_device->umcon = 0x0; + /* Normal,No parity,1 stop,8 bit */ + uart0.uart_device->ulcon = 0x3; + /* + * tx=level,rx=edge,disable timeout int.,enable rx error int., + * normal,interrupt or polling + */ + uart0.uart_device->ucon = 0x245; + /* Set uart0 bps */ + uart0.uart_device->ubrd = (rt_int32_t)(PCLK / (BPS * 16)) - 1; + /* output PCLK to UART0/1, PWMTIMER */ + CLKCON |= 0x0D00; - /* FIFO enable, Tx/Rx FIFO clear */ - uart2.uart_device->ufcon = 0x0; - /* disable the flow control */ - uart2.uart_device->umcon = 0x0; - /* Normal,No parity,1 stop,8 bit */ - uart2.uart_device->ulcon = 0x3; - /* - * tx=level,rx=edge,disable timeout int.,enable rx error int., - * normal,interrupt or polling - */ - uart2.uart_device->ucon = 0x245; - /* Set uart0 bps */ - uart2.uart_device->ubrd = (rt_int32_t)(PCLK / (BPS * 16)) - 1; + /* FIFO enable, Tx/Rx FIFO clear */ + uart2.uart_device->ufcon = 0x0; + /* disable the flow control */ + uart2.uart_device->umcon = 0x0; + /* Normal,No parity,1 stop,8 bit */ + uart2.uart_device->ulcon = 0x3; + /* + * tx=level,rx=edge,disable timeout int.,enable rx error int., + * normal,interrupt or polling + */ + uart2.uart_device->ucon = 0x245; + /* Set uart0 bps */ + uart2.uart_device->ubrd = (rt_int32_t)(PCLK / (BPS * 16)) - 1; - for (i = 0; i < 100; i++); + for (i = 0; i < 100; i++); - /* install uart0 isr */ - INTSUBMSK &= ~(BIT_SUB_RXD0); + /* install uart0 isr */ + INTSUBMSK &= ~(BIT_SUB_RXD0); - /* install uart2 isr */ - INTSUBMSK &= ~(BIT_SUB_RXD2); + /* install uart2 isr */ + INTSUBMSK &= ~(BIT_SUB_RXD2); - rt_hw_interrupt_install(INTUART0, rt_serial0_handler, RT_NULL, "UART0"); - rt_hw_interrupt_umask(INTUART0); + rt_hw_interrupt_install(INTUART0, rt_serial0_handler, RT_NULL, "UART0"); + rt_hw_interrupt_umask(INTUART0); - rt_hw_interrupt_install(INTUART2, rt_serial2_handler, RT_NULL, "UART2"); - rt_hw_interrupt_umask(INTUART2); + rt_hw_interrupt_install(INTUART2, rt_serial2_handler, RT_NULL, "UART2"); + rt_hw_interrupt_umask(INTUART2); } /** @@ -150,22 +150,22 @@ static void rt_hw_uart_init(void) */ static void rt_hw_timer_init(void) { - /* timer4, pre = 15+1 */ - TCFG0 &= 0xffff00ff; - TCFG0 |= 15 << 8; - /* all are interrupt mode,set Timer 4 MUX 1/4 */ - TCFG1 &= 0xfff0ffff; - TCFG1 |= 0x00010000; + /* timer4, pre = 15+1 */ + TCFG0 &= 0xffff00ff; + TCFG0 |= 15 << 8; + /* all are interrupt mode,set Timer 4 MUX 1/4 */ + TCFG1 &= 0xfff0ffff; + TCFG1 |= 0x00010000; - TCNTB4 = (rt_int32_t)(PCLK / (4 *16* RT_TICK_PER_SECOND)) - 1; - /* manual update */ - TCON = TCON & (~(0x0f<<20)) | (0x02<<20); - /* install interrupt handler */ - rt_hw_interrupt_install(INTTIMER4, rt_timer_handler, RT_NULL, "tick"); - rt_hw_interrupt_umask(INTTIMER4); + TCNTB4 = (rt_int32_t)(PCLK / (4 *16* RT_TICK_PER_SECOND)) - 1; + /* manual update */ + TCON = TCON & (~(0x0f<<20)) | (0x02<<20); + /* install interrupt handler */ + rt_hw_interrupt_install(INTTIMER4, rt_timer_handler, RT_NULL, "tick"); + rt_hw_interrupt_umask(INTTIMER4); /* start timer4, reload */ - TCON = TCON & (~(0x0f<<20)) | (0x05<<20); + TCON = TCON & (~(0x0f<<20)) | (0x05<<20); } /** @@ -173,23 +173,23 @@ static void rt_hw_timer_init(void) */ void rt_hw_board_init(void) { - /* initialize the system clock */ - rt_hw_clock_init(); + /* initialize the system clock */ + rt_hw_clock_init(); - /* Get the clock */ - rt_hw_get_clock(); + /* Get the clock */ + rt_hw_get_clock(); - /* initialize led port */ - rt_hw_led_init(); + /* initialize led port */ + rt_hw_led_init(); - /* initialize uart */ - rt_hw_uart_init(); + /* initialize uart */ + rt_hw_uart_init(); - /* initialize mmu */ - rt_hw_mmu_init(); + /* initialize mmu */ + rt_hw_mmu_init(); - /* initialize timer4 */ - rt_hw_timer_init(); + /* initialize timer4 */ + rt_hw_timer_init(); } /*@}*/ |
