diff options
Diffstat (limited to 'bsp/lpc824')
| -rw-r--r-- | bsp/lpc824/applications/application.c | 20 | ||||
| -rw-r--r-- | bsp/lpc824/applications/startup.c | 4 | ||||
| -rw-r--r-- | bsp/lpc824/drivers/board.c | 4 | ||||
| -rw-r--r-- | bsp/lpc824/drivers/board.h | 2 | ||||
| -rw-r--r-- | bsp/lpc824/drivers/usart.c | 86 | ||||
| -rw-r--r-- | bsp/lpc824/drivers/usart.h | 2 | ||||
| -rw-r--r-- | bsp/lpc824/rtconfig.h | 20 |
7 files changed, 69 insertions, 69 deletions
diff --git a/bsp/lpc824/applications/application.c b/bsp/lpc824/applications/application.c index f8ef7f40e3..ed7972b4d2 100644 --- a/bsp/lpc824/applications/application.c +++ b/bsp/lpc824/applications/application.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2009-01-05 Bernard the first version - * 2014-04-27 Bernard make code cleanup. + * 2014-04-27 Bernard make code cleanup. */ #include <board.h> @@ -29,26 +29,26 @@ static struct rt_thread led_thread; #endif void rt_init_thread_entry(void* parameter) -{ +{ /* initialization RT-Thread Components */ #ifdef RT_USING_COMPONENTS_INIT rt_components_init(); #endif - + } void rt_led_thread_entry(void *parameter) { /* Initialize GPIO */ - Chip_GPIO_Init(LPC_GPIO_PORT); + Chip_GPIO_Init(LPC_GPIO_PORT); Chip_GPIO_PinSetDIR(LPC_GPIO_PORT, 0, 7, 1); Chip_GPIO_PinSetState(LPC_GPIO_PORT, 0, 7, true); - + while (1) { Chip_GPIO_PinSetState(LPC_GPIO_PORT, 0, 7, true); rt_thread_delay(RT_TICK_PER_SECOND / 2); - + Chip_GPIO_PinSetState(LPC_GPIO_PORT, 0, 7, false); rt_thread_delay(RT_TICK_PER_SECOND / 2); } @@ -64,7 +64,7 @@ int rt_application_init() INIT_STACK_SIZE, RT_THREAD_PRIORITY_MAX/3, 20); #else { - + rt_err_t result; tid = &init_thread; @@ -75,14 +75,14 @@ int rt_application_init() #endif if (tid != RT_NULL) rt_thread_startup(tid); - + #ifdef RT_USING_HEAP tid = rt_thread_create("led", rt_led_thread_entry, RT_NULL, LED_STACK_SIZE, RT_THREAD_PRIORITY_MAX/3, 20); #else { - + rt_err_t result; tid = &led_thread; diff --git a/bsp/lpc824/applications/startup.c b/bsp/lpc824/applications/startup.c index 5e95382ba0..bedc10d9e4 100644 --- a/bsp/lpc824/applications/startup.c +++ b/bsp/lpc824/applications/startup.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -64,7 +64,7 @@ void rtthread_startup(void) #ifdef RT_USING_HEAP rt_system_heap_init((void*)HEAP_BEGIN, (void*)HEAP_END); #endif - + /* init scheduler system */ rt_system_scheduler_init(); diff --git a/bsp/lpc824/drivers/board.c b/bsp/lpc824/drivers/board.c index 51656718b8..0817a3b7e8 100644 --- a/bsp/lpc824/drivers/board.c +++ b/bsp/lpc824/drivers/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -62,7 +62,7 @@ void rt_hw_board_init() #ifdef RT_USING_COMPONENTS_INIT rt_components_board_init(); #endif - + #ifdef RT_USING_CONSOLE rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #endif diff --git a/bsp/lpc824/drivers/board.h b/bsp/lpc824/drivers/board.h index c8d21d94b5..d86369ce31 100644 --- a/bsp/lpc824/drivers/board.h +++ b/bsp/lpc824/drivers/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/lpc824/drivers/usart.c b/bsp/lpc824/drivers/usart.c index 5109164a9a..54a56501c9 100644 --- a/bsp/lpc824/drivers/usart.c +++ b/bsp/lpc824/drivers/usart.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -28,7 +28,7 @@ struct lpc8xx_uart LPC_USART_T * uart_base; IRQn_Type uart_irq; rt_uint8_t rx_buffer[UART_RX_BUFSZ]; - + }; #ifdef RT_USING_UART0 struct lpc8xx_uart uart0_device; @@ -45,10 +45,10 @@ struct lpc8xx_uart uart2_device; void uart_irq_handler(struct lpc8xx_uart* uart) { uint32_t status; - + /* enter interrupt */ rt_interrupt_enter(); - + status = Chip_UART_GetStatus(uart->uart_base); if(status & UART_STAT_RXRDY) // RXIRQ { @@ -57,9 +57,9 @@ void uart_irq_handler(struct lpc8xx_uart* uart) if(uart->parent.rx_indicate != RT_NULL) { uart->parent.rx_indicate(&uart->parent, rt_ringbuffer_data_len(&uart->rx_rb)); - } + } } - + /* leave interrupt */ rt_interrupt_leave(); } @@ -88,15 +88,15 @@ void UART2_IRQHandler(void) static void uart1_io_init(LPC_USART_T * uart_base) { /* Enable the clock to the Switch Matrix */ - Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM); - + Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM); + Chip_Clock_SetUARTClockDiv(1); - + #ifdef RT_USING_UART0 if (uart_base == LPC_USART0) { - Chip_SWM_MovablePinAssign(SWM_U0_TXD_O, 4); - Chip_SWM_MovablePinAssign(SWM_U0_RXD_I, 0); + Chip_SWM_MovablePinAssign(SWM_U0_TXD_O, 4); + Chip_SWM_MovablePinAssign(SWM_U0_RXD_I, 0); } else #endif @@ -104,8 +104,8 @@ static void uart1_io_init(LPC_USART_T * uart_base) #ifdef RT_USING_UART1 if (uart_base == LPC_USART1) { - Chip_SWM_MovablePinAssign(SWM_U1_TXD_O, 4); - Chip_SWM_MovablePinAssign(SWM_U1_RXD_I, 0); + Chip_SWM_MovablePinAssign(SWM_U1_TXD_O, 4); + Chip_SWM_MovablePinAssign(SWM_U1_RXD_I, 0); } else #endif @@ -113,32 +113,32 @@ static void uart1_io_init(LPC_USART_T * uart_base) #ifdef RT_USING_UART2 if (uart_base == LPC_USART2) { - Chip_SWM_MovablePinAssign(SWM_U2_TXD_O, 4); - Chip_SWM_MovablePinAssign(SWM_U2_RXD_I, 0); + Chip_SWM_MovablePinAssign(SWM_U2_TXD_O, 4); + Chip_SWM_MovablePinAssign(SWM_U2_RXD_I, 0); } else #endif { RT_ASSERT((uart_base == USART0) || (uart_base == USART2) || (uart_base == USART2)); } - - /* Disable the clock to the Switch Matrix to save power */ - Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM); + + /* Disable the clock to the Switch Matrix to save power */ + Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM); } static void uart_ll_init(LPC_USART_T * uart) { Chip_UART_Init(uart); Chip_UART_ConfigData(uart, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1); - Chip_Clock_SetUSARTNBaseClockRate((115200 * 6 * 16), true); - Chip_UART_SetBaud(uart, 115200); - Chip_UART_Enable(uart); - Chip_UART_TXEnable(uart); - - // we must NOT enable TX ready/idle IRQ before we want to write data - // otherwise the IRQs will happen as soon as Uart IRQ is enabled in NVIC - Chip_UART_IntDisable(uart, UART_INTEN_TXRDY | UART_INTEN_TXIDLE); - Chip_UART_IntEnable(uart, UART_INTEN_RXRDY); + Chip_Clock_SetUSARTNBaseClockRate((115200 * 6 * 16), true); + Chip_UART_SetBaud(uart, 115200); + Chip_UART_Enable(uart); + Chip_UART_TXEnable(uart); + + // we must NOT enable TX ready/idle IRQ before we want to write data + // otherwise the IRQs will happen as soon as Uart IRQ is enabled in NVIC + Chip_UART_IntDisable(uart, UART_INTEN_TXRDY | UART_INTEN_TXIDLE); + Chip_UART_IntEnable(uart, UART_INTEN_RXRDY); } static rt_err_t rt_uart_init (rt_device_t dev) @@ -146,7 +146,7 @@ static rt_err_t rt_uart_init (rt_device_t dev) struct lpc8xx_uart* uart; RT_ASSERT(dev != RT_NULL); uart = (struct lpc8xx_uart *)dev; - + uart1_io_init(uart->uart_base); uart_ll_init(uart->uart_base); @@ -220,11 +220,11 @@ static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer if (*ptr == '\n') { while (!(Chip_UART_GetStatus(uart->uart_base) & UART_STAT_TXRDY)); - Chip_UART_SendByte(uart->uart_base, '\r'); + Chip_UART_SendByte(uart->uart_base, '\r'); } while (!(Chip_UART_GetStatus(uart->uart_base) & UART_STAT_TXRDY)); - Chip_UART_SendByte(uart->uart_base, *ptr); + Chip_UART_SendByte(uart->uart_base, *ptr); ptr ++; size --; @@ -235,7 +235,7 @@ static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer while (size) { while (!(Chip_UART_GetStatus(uart->uart_base) & UART_STAT_TXRDY)); - Chip_UART_SendByte(uart->uart_base, *ptr); + Chip_UART_SendByte(uart->uart_base, *ptr); ptr++; size--; @@ -258,14 +258,14 @@ int rt_hw_usart_init(void) uart->parent.type = RT_Device_Class_Char; uart->uart_base = LPC_USART0; uart->uart_irq = UART0_IRQn; - + rt_ringbuffer_init(&(uart->rx_rb), uart->rx_buffer, sizeof(uart->rx_buffer)); /* device interface */ - uart->parent.init = rt_uart_init; - uart->parent.open = rt_uart_open; + uart->parent.init = rt_uart_init; + uart->parent.open = rt_uart_open; uart->parent.close = rt_uart_close; - uart->parent.read = rt_uart_read; + uart->parent.read = rt_uart_read; uart->parent.write = rt_uart_write; uart->parent.control = RT_NULL; uart->parent.user_data = RT_NULL; @@ -273,7 +273,7 @@ int rt_hw_usart_init(void) rt_device_register(&uart->parent, "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX); } #endif - + #ifdef RT_USING_UART1 { struct lpc8xx_uart* uart; @@ -285,14 +285,14 @@ int rt_hw_usart_init(void) uart->parent.type = RT_Device_Class_Char; uart->uart_base = LPC_USART1; uart->uart_irq = UART1_IRQn; - + rt_ringbuffer_init(&(uart->rx_rb), uart->rx_buffer, sizeof(uart->rx_buffer)); /* device interface */ - uart->parent.init = rt_uart_init; - uart->parent.open = rt_uart_open; + uart->parent.init = rt_uart_init; + uart->parent.open = rt_uart_open; uart->parent.close = rt_uart_close; - uart->parent.read = rt_uart_read; + uart->parent.read = rt_uart_read; uart->parent.write = rt_uart_write; uart->parent.control = RT_NULL; uart->parent.user_data = RT_NULL; @@ -315,10 +315,10 @@ int rt_hw_usart_init(void) rt_ringbuffer_init(&(uart->rx_rb), uart->rx_buffer, sizeof(uart->rx_buffer)); /* device interface */ - uart->parent.init = rt_uart_init; - uart->parent.open = rt_uart_open; + uart->parent.init = rt_uart_init; + uart->parent.open = rt_uart_open; uart->parent.close = rt_uart_close; - uart->parent.read = rt_uart_read; + uart->parent.read = rt_uart_read; uart->parent.write = rt_uart_write; uart->parent.control = RT_NULL; uart->parent.user_data = RT_NULL; diff --git a/bsp/lpc824/drivers/usart.h b/bsp/lpc824/drivers/usart.h index 1db28e9385..7298cdab8b 100644 --- a/bsp/lpc824/drivers/usart.h +++ b/bsp/lpc824/drivers/usart.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/lpc824/rtconfig.h b/bsp/lpc824/rtconfig.h index e8a551c2a3..d7c9608e28 100644 --- a/bsp/lpc824/rtconfig.h +++ b/bsp/lpc824/rtconfig.h @@ -6,17 +6,17 @@ // <<< Use Configuration Wizard in Context Menu >>> // <h>Basic Configuration // <o>Maximal level of thread priority <8-256> -// <i>Default: 32 +// <i>Default: 32 #define RT_THREAD_PRIORITY_MAX 8 // <o>OS tick per second // <i>Default: 1000 (1ms) -#define RT_TICK_PER_SECOND 100 +#define RT_TICK_PER_SECOND 100 // <o>Alignment size for CPU architecture data access -// <i>Default: 4 +// <i>Default: 4 #define RT_ALIGN_SIZE 4 // <o>the max length of object name<2-16> -// <i>Default: 8 -#define RT_NAME_MAX 8 +// <i>Default: 8 +#define RT_NAME_MAX 8 // <c1>Using RT-Thread components initialization // <i>Using RT-Thread components initialization #define RT_USING_COMPONENTS_INIT @@ -26,7 +26,7 @@ //#define RT_USING_USER_MAIN // </c> // <o>the size of main thread<1-4086> -// <i>Default: 512 +// <i>Default: 512 #define RT_MAIN_THREAD_STACK_SIZE 256 // </h> @@ -64,13 +64,13 @@ #endif // <o>The priority level of timer thread <0-31> // <i>Default: 4 -#define RT_TIMER_THREAD_PRIO 4 +#define RT_TIMER_THREAD_PRIO 4 // <o>The stack size of timer thread <0-8192> // <i>Default: 512 -#define RT_TIMER_THREAD_STACK_SIZE 512 +#define RT_TIMER_THREAD_STACK_SIZE 512 // <o>The soft-timer tick per second <0-1000> // <i>Default: 100 -#define RT_TIMER_TICK_PER_SECOND 100 +#define RT_TIMER_TICK_PER_SECOND 100 // </e> // <h>IPC(Inter-process communication) Configuration @@ -164,7 +164,7 @@ // <o>the history lines of finsh thread <1-32> // <i>the history lines of finsh thread // <i>Default: 5 -#define FINSH_HISTORY_LINES 1 +#define FINSH_HISTORY_LINES 1 // <c1>Using symbol table in finsh shell // <i>Using symbol table in finsh shell #define FINSH_USING_SYMTAB |
