diff options
Diffstat (limited to 'bsp/sep6200')
| -rw-r--r-- | bsp/sep6200/application/application.c | 40 | ||||
| -rw-r--r-- | bsp/sep6200/application/startup.c | 54 | ||||
| -rw-r--r-- | bsp/sep6200/drivers/board.c | 110 | ||||
| -rw-r--r-- | bsp/sep6200/rtconfig.h | 72 |
4 files changed, 138 insertions, 138 deletions
diff --git a/bsp/sep6200/application/application.c b/bsp/sep6200/application/application.c index ea1889d33e..5a032933b4 100644 --- a/bsp/sep6200/application/application.c +++ b/bsp/sep6200/application/application.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Change Logs: - * Date Author Notes + * Date Author Notes * 2013-7-14 Peng Fan Simple application */ @@ -45,31 +45,31 @@ void rt_test2_thread_entry(void *parameter) int rt_application_init(void) { - rt_thread_t init_thread; - rt_thread_t test1_thread; - rt_thread_t test2_thread; + rt_thread_t init_thread; + rt_thread_t test1_thread; + rt_thread_t test2_thread; - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - RT_INIT_THREAD_STACK_SIZE, 8, 20); + init_thread = rt_thread_create("init", + rt_init_thread_entry, RT_NULL, + RT_INIT_THREAD_STACK_SIZE, 8, 20); - test1_thread = rt_thread_create("test1", - rt_test1_thread_entry, RT_NULL, - 512, 200, 20); - test2_thread = rt_thread_create("test2", - rt_test2_thread_entry, RT_NULL, - 512, 200, 20); + test1_thread = rt_thread_create("test1", + rt_test1_thread_entry, RT_NULL, + 512, 200, 20); + test2_thread = rt_thread_create("test2", + rt_test2_thread_entry, RT_NULL, + 512, 200, 20); - if (init_thread != RT_NULL) - rt_thread_startup(init_thread); + if (init_thread != RT_NULL) + rt_thread_startup(init_thread); - if (test1_thread != RT_NULL) - rt_thread_startup(test1_thread); + if (test1_thread != RT_NULL) + rt_thread_startup(test1_thread); - if (test2_thread != RT_NULL) - rt_thread_startup(test2_thread); + if (test2_thread != RT_NULL) + rt_thread_startup(test2_thread); - return 0; + return 0; } /*@}*/ diff --git a/bsp/sep6200/application/startup.c b/bsp/sep6200/application/startup.c index 8805642d23..4a839d41a6 100644 --- a/bsp/sep6200/application/startup.c +++ b/bsp/sep6200/application/startup.c @@ -40,50 +40,50 @@ extern void sd_init(void); void rtthread_startup() { - /* init hardware interrupt */ - rt_hw_interrupt_init(); + /* init hardware interrupt */ + rt_hw_interrupt_init(); - /* init board */ - rt_hw_board_init(); + /* init board */ + rt_hw_board_init(); - /* show version */ - rt_show_version(); + /* show version */ + rt_show_version(); - /* init tick */ - rt_system_tick_init(); + /* init tick */ + rt_system_tick_init(); - /* init kernel object */ - rt_system_object_init(); + /* init kernel object */ + rt_system_object_init(); - /* init timer system */ - rt_system_timer_init(); + /* init timer system */ + rt_system_timer_init(); - /* init heap memory system */ - rt_system_heap_init(&__bss_end, (void*)0x45000000); + /* init heap memory system */ + rt_system_heap_init(&__bss_end, (void*)0x45000000); - /* init scheduler system */ - rt_system_scheduler_init(); + /* init scheduler system */ + rt_system_scheduler_init(); - /* init application */ - rt_application_init(); + /* init application */ + rt_application_init(); #ifdef RT_USING_FINSH - /* init finsh */ - finsh_system_init(); + /* init finsh */ + finsh_system_init(); #ifdef RT_USING_DEVICE - finsh_set_device("uart0"); + finsh_set_device("uart0"); #endif #endif rt_system_timer_thread_init(); - /* init idle thread */ - rt_thread_idle_init(); + /* init idle thread */ + rt_thread_idle_init(); - /* start scheduler */ - rt_system_scheduler_start(); + /* start scheduler */ + rt_system_scheduler_start(); - /* never reach here */ - return ; + /* never reach here */ + return ; } diff --git a/bsp/sep6200/drivers/board.c b/bsp/sep6200/drivers/board.c index 6b68d0297b..3a1ade2752 100644 --- a/bsp/sep6200/drivers/board.c +++ b/bsp/sep6200/drivers/board.c @@ -22,14 +22,14 @@ void rt_hw_serial_putc(const char c); -#define UART0 ((struct uartport *)SEP6200_UART0_BASE) +#define UART0 ((struct uartport *)SEP6200_UART0_BASE) struct rt_device uart0_device; struct serial_int_rx uart0_int_rx; struct serial_device uart0 = { - UART0, - &uart0_int_rx, + UART0, + &uart0_int_rx, RT_NULL }; @@ -38,13 +38,13 @@ struct serial_device uart0 = */ void rt_timer_handler(int vector, void *param) { - rt_uint32_t clear_int; + rt_uint32_t clear_int; - /* clear timer interrupt */ - if (read_reg(SEP6200_TIMER_T2IMSR) & 0x1) - clear_int = read_reg(SEP6200_TIMER_T2ISCR); + /* clear timer interrupt */ + if (read_reg(SEP6200_TIMER_T2IMSR) & 0x1) + clear_int = read_reg(SEP6200_TIMER_T2ISCR); - rt_tick_increase(); + rt_tick_increase(); } /* @@ -52,47 +52,47 @@ void rt_timer_handler(int vector, void *param) */ void rt_serial_handler(int vector, void *param) { - rt_uint32_t num; - switch (vector) { - case INTSRC_UART0: + rt_uint32_t num; + switch (vector) { + case INTSRC_UART0: /*No interrupt*/ - if ((*(RP)SEP6200_UART0_IIR & 0x1)) - return; + if ((*(RP)SEP6200_UART0_IIR & 0x1)) + return; /*Get the serial interrupt num*/ - num = (*(RP)SEP6200_UART0_IIR >> 1) & 0x7; + num = (*(RP)SEP6200_UART0_IIR >> 1) & 0x7; /*Receive or timeout*/ if ((num == 6) || (num == 2)) - rt_hw_serial_isr(&uart0_device); - break; - /*1,2,3 not implemented now, do in future*/ - case INTSRC_UART1: - break; - case INTSRC_UART2: - break; - case INTSRC_UART3: - break; - } + rt_hw_serial_isr(&uart0_device); + break; + /*1,2,3 not implemented now, do in future*/ + case INTSRC_UART1: + break; + case INTSRC_UART2: + break; + case INTSRC_UART3: + break; + } } /* * This function will init timer2 for system ticks */ -#define BUS4_FREQ 320000000UL -#define TIMER_CLK BUS4_FREQ +#define BUS4_FREQ 320000000UL +#define TIMER_CLK BUS4_FREQ #define HZ 100 void rt_hw_timer_init(void) { - *(RP)SEP6200_TIMER_T2LCR = (TIMER_CLK + HZ / 2) / HZ; - *(RP)SEP6200_TIMER_T2CR = 0x6; + *(RP)SEP6200_TIMER_T2LCR = (TIMER_CLK + HZ / 2) / HZ; + *(RP)SEP6200_TIMER_T2CR = 0x6; - rt_hw_interrupt_install(INTSRC_TIMER1, rt_timer_handler, RT_NULL, "timer"); - rt_hw_interrupt_umask(INTSRC_TIMER1); + rt_hw_interrupt_install(INTSRC_TIMER1, rt_timer_handler, RT_NULL, "timer"); + rt_hw_interrupt_umask(INTSRC_TIMER1); - /* start the timer */ - *(RP)SEP6200_TIMER_T2CR |= 0x1; + /* start the timer */ + *(RP)SEP6200_TIMER_T2CR |= 0x1; } /* @@ -101,35 +101,35 @@ void rt_hw_timer_init(void) #define UART_CLK 60000000UL void rt_hw_uart_init(void) { - const rt_uint32_t uartclk = UART_CLK; + const rt_uint32_t uartclk = UART_CLK; - *(RP)(SEP6200_UART0_LCR) = 0x83; - *(RP)(SEP6200_UART0_DLBH) = (uartclk/16/115200) >> 8; - *(RP)(SEP6200_UART0_DLBL) = (uartclk/16/115200) & 0xff; - *(RP)(SEP6200_UART0_LCR) = 0x83 & (~(0x1 << 7)); + *(RP)(SEP6200_UART0_LCR) = 0x83; + *(RP)(SEP6200_UART0_DLBH) = (uartclk/16/115200) >> 8; + *(RP)(SEP6200_UART0_DLBL) = (uartclk/16/115200) & 0xff; + *(RP)(SEP6200_UART0_LCR) = 0x83 & (~(0x1 << 7)); - *(RP)(SEP6200_UART0_FCR) = 0x0; - *(RP)(SEP6200_UART0_MCR) = 0x0; + *(RP)(SEP6200_UART0_FCR) = 0x0; + *(RP)(SEP6200_UART0_MCR) = 0x0; - *(RP)(SEP6200_UART0_IER) = 0x0; - /* Enable rx interrupt*/ - *(RP)(SEP6200_UART0_IER) |= 0x1; - /* Disable tx interrupt*/ - *(RP)(SEP6200_UART0_IER) &= ~(0x1 << 1); + *(RP)(SEP6200_UART0_IER) = 0x0; + /* Enable rx interrupt*/ + *(RP)(SEP6200_UART0_IER) |= 0x1; + /* Disable tx interrupt*/ + *(RP)(SEP6200_UART0_IER) &= ~(0x1 << 1); - rt_hw_interrupt_install(INTSRC_UART0, rt_serial_handler, RT_NULL, "uart0"); - rt_hw_interrupt_umask(INTSRC_UART0); + rt_hw_interrupt_install(INTSRC_UART0, rt_serial_handler, RT_NULL, "uart0"); + rt_hw_interrupt_umask(INTSRC_UART0); - rt_hw_serial_register(&uart0_device, "uart0", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM, - &uart0); + rt_hw_serial_register(&uart0_device, "uart0", + RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM, + &uart0); } void rt_hw_board_init(void) { int i = 0; - rt_hw_uart_init(); - rt_hw_timer_init(); + rt_hw_uart_init(); + rt_hw_timer_init(); } /* @@ -137,12 +137,12 @@ void rt_hw_board_init(void) */ void rt_hw_serial_putc(const char c) { - if (c == '\n') - rt_hw_serial_putc('\r'); + if (c == '\n') + rt_hw_serial_putc('\r'); - while (!((*(RP)SEP6200_UART0_LSR) & 0x40)); + while (!((*(RP)SEP6200_UART0_LSR) & 0x40)); - *(RP)(SEP6200_UART0_TXFIFO) = c; + *(RP)(SEP6200_UART0_TXFIFO) = c; } /** diff --git a/bsp/sep6200/rtconfig.h b/bsp/sep6200/rtconfig.h index c078a6b5a2..84c0ba574b 100644 --- a/bsp/sep6200/rtconfig.h +++ b/bsp/sep6200/rtconfig.h @@ -14,16 +14,16 @@ /* #define RT_DEBUG_IPC 1 */ /* RT_NAME_MAX*/ -#define RT_NAME_MAX 8 +#define RT_NAME_MAX 8 /* RT_ALIGN_SIZE*/ -#define RT_ALIGN_SIZE 4 +#define RT_ALIGN_SIZE 4 /* PRIORITY_MAX */ -#define RT_THREAD_PRIORITY_MAX 256 +#define RT_THREAD_PRIORITY_MAX 256 /* Tick per Second */ -#define RT_TICK_PER_SECOND 100 +#define RT_TICK_PER_SECOND 100 /* SECTION: RT_DEBUG */ /* Thread Debug */ @@ -38,9 +38,9 @@ /* Using Software Timer */ #define RT_USING_TIMER_SOFT -#define RT_TIMER_THREAD_PRIO 8 -#define RT_TIMER_THREAD_STACK_SIZE 512 -#define RT_TIMER_TICK_PER_SECOND 10 +#define RT_TIMER_THREAD_PRIO 8 +#define RT_TIMER_THREAD_STACK_SIZE 512 +#define RT_TIMER_TICK_PER_SECOND 10 /* SECTION: IPC */ /* Using Semaphore */ @@ -78,7 +78,7 @@ /* SECTION: Console options */ /* the buffer size of console */ -#define RT_CONSOLEBUF_SIZE 128 +#define RT_CONSOLEBUF_SIZE 128 /* SECTION: finsh, a C-Express shell */ /* Using FinSH as Shell*/ @@ -105,11 +105,11 @@ /* #define DFS_USING_WORKDIR */ /* the max number of mounted filesystem */ -#define DFS_FILESYSTEMS_MAX 2 -/* the max number of opened files */ -#define DFS_FD_MAX 16 -/* the max number of cached sector */ -#define DFS_CACHE_MAX_NUM 4 +#define DFS_FILESYSTEMS_MAX 2 +/* the max number of opened files */ +#define DFS_FD_MAX 16 +/* the max number of cached sector */ +#define DFS_CACHE_MAX_NUM 4 /* SECTION: lwip, a lighwight TCP/IP protocol stack */ /* Using lighweight TCP/IP protocol stack */ @@ -132,13 +132,13 @@ #define RT_LWIP_TCP /* the number of simulatenously active TCP connections*/ -#define RT_LWIP_TCP_PCB_NUM 5 +#define RT_LWIP_TCP_PCB_NUM 5 /* TCP sender buffer space */ -#define RT_LWIP_TCP_SND_BUF 1024*10 +#define RT_LWIP_TCP_SND_BUF 1024*10 /* TCP receive window. */ -#define RT_LWIP_TCP_WND 1024 +#define RT_LWIP_TCP_WND 1024 /* Enable SNMP protocol */ /* #define RT_LWIP_SNMP */ @@ -147,50 +147,50 @@ /* #define RT_LWIP_DHCP */ /* ip address of target */ -#define RT_LWIP_IPADDR0 192 -#define RT_LWIP_IPADDR1 168 -#define RT_LWIP_IPADDR2 1 -#define RT_LWIP_IPADDR3 30 +#define RT_LWIP_IPADDR0 192 +#define RT_LWIP_IPADDR1 168 +#define RT_LWIP_IPADDR2 1 +#define RT_LWIP_IPADDR3 30 /* gateway address of target */ -#define RT_LWIP_GWADDR0 192 -#define RT_LWIP_GWADDR1 168 -#define RT_LWIP_GWADDR2 1 -#define RT_LWIP_GWADDR3 1 +#define RT_LWIP_GWADDR0 192 +#define RT_LWIP_GWADDR1 168 +#define RT_LWIP_GWADDR2 1 +#define RT_LWIP_GWADDR3 1 /* mask address of target */ -#define RT_LWIP_MSKADDR0 255 -#define RT_LWIP_MSKADDR1 255 -#define RT_LWIP_MSKADDR2 255 -#define RT_LWIP_MSKADDR3 0 +#define RT_LWIP_MSKADDR0 255 +#define RT_LWIP_MSKADDR1 255 +#define RT_LWIP_MSKADDR2 255 +#define RT_LWIP_MSKADDR3 0 /* the number of blocks for pbuf */ -#define RT_LWIP_PBUF_NUM 16 +#define RT_LWIP_PBUF_NUM 16 /* thread priority of tcpip thread */ -#define RT_LWIP_TCPTHREAD_PRIORITY 128 +#define RT_LWIP_TCPTHREAD_PRIORITY 128 /* mail box size of tcpip thread to wait for */ -#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8 +#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8 /* thread stack size of tcpip thread */ -#define RT_LWIP_TCPTHREAD_STACKSIZE 4096 +#define RT_LWIP_TCPTHREAD_STACKSIZE 4096 /* thread priority of ethnetif thread */ -#define RT_LWIP_ETHTHREAD_PRIORITY 144 +#define RT_LWIP_ETHTHREAD_PRIORITY 144 /* mail box size of ethnetif thread to wait for */ -#define RT_LWIP_ETHTHREAD_MBOX_SIZE 32 +#define RT_LWIP_ETHTHREAD_MBOX_SIZE 32 /* thread stack size of ethnetif thread */ -#define RT_LWIP_ETHTHREAD_STACKSIZE 1024 +#define RT_LWIP_ETHTHREAD_STACKSIZE 1024 /* SECTION: RTGUI support */ /* using RTGUI support */ /* #define RT_USING_RTGUI */ /* name length of RTGUI object */ -#define RTGUI_NAME_MAX 16 +#define RTGUI_NAME_MAX 16 /* support 16 weight font */ #define RTGUI_USING_FONT16 /* support 16 weight font */ |
