summaryrefslogtreecommitdiff
path: root/bsp/nuvoton_m451
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-05-28 16:20:08 +0800
committerGitHub <[email protected]>2021-05-28 16:20:08 +0800
commit92beddf3bccf6346e26aa097f82464456fb8e6bd (patch)
tree197e4a108118dda016ea02274172f0c40e7ee8ed /bsp/nuvoton_m451
parentb18a99b44240ec3152011e159cc24a5af8dff0ce (diff)
parent03f4d40e30f3c94e1db0b3a65b3610dee695694a (diff)
Merge pull request #4737 from mysterywolf/3,1,xformatv3.1.5
[lts 3.1.x] format codes
Diffstat (limited to 'bsp/nuvoton_m451')
-rw-r--r--bsp/nuvoton_m451/applications/application.c18
-rw-r--r--bsp/nuvoton_m451/applications/startup.c60
-rw-r--r--bsp/nuvoton_m451/drivers/board.c40
-rw-r--r--bsp/nuvoton_m451/drivers/board.h2
-rw-r--r--bsp/nuvoton_m451/drivers/led.h2
-rw-r--r--bsp/nuvoton_m451/drivers/usart.c10
-rw-r--r--bsp/nuvoton_m451/rtconfig.h34
7 files changed, 83 insertions, 83 deletions
diff --git a/bsp/nuvoton_m451/applications/application.c b/bsp/nuvoton_m451/applications/application.c
index ba1d5748c3..9c1e57f36d 100644
--- a/bsp/nuvoton_m451/applications/application.c
+++ b/bsp/nuvoton_m451/applications/application.c
@@ -24,18 +24,18 @@
static void led_thread_entry(void* parameter)
{
rt_hw_led_init();
- while(1)
- {
+ while(1)
+ {
rt_hw_led_on();
rt_thread_delay(RT_TICK_PER_SECOND);
rt_hw_led_off();
rt_thread_delay(RT_TICK_PER_SECOND);
- }
+ }
}
static void rt_init_thread_entry(void* parameter)
{
- rt_thread_t led_thread;
+ rt_thread_t led_thread;
/* Initialization RT-Thread Components */
#ifdef RT_USING_COMPONENTS_INIT
@@ -44,15 +44,15 @@ static void rt_init_thread_entry(void* parameter)
/* Create led thread */
led_thread = rt_thread_create("led",
- led_thread_entry, RT_NULL,
- 256, 20, 20);
+ led_thread_entry, RT_NULL,
+ 256, 20, 20);
if(led_thread != RT_NULL)
- rt_thread_startup(led_thread);
+ rt_thread_startup(led_thread);
}
int rt_application_init()
{
- rt_thread_t init_thread;
+ rt_thread_t init_thread;
#if (RT_THREAD_PRIORITY_MAX == 32)
init_thread = rt_thread_create("init",
@@ -64,7 +64,7 @@ int rt_application_init()
512, 80, 20);
#endif
if(init_thread != RT_NULL)
- rt_thread_startup(init_thread);
+ rt_thread_startup(init_thread);
return 0;
}
diff --git a/bsp/nuvoton_m451/applications/startup.c b/bsp/nuvoton_m451/applications/startup.c
index b1f57ceb90..8e8422915e 100644
--- a/bsp/nuvoton_m451/applications/startup.c
+++ b/bsp/nuvoton_m451/applications/startup.c
@@ -51,11 +51,11 @@ extern int __bss_end;
*******************************************************************************/
void assert_failed(uint8_t* file, uint32_t line)
{
- rt_kprintf("\n\r Wrong parameter value detected on\r\n");
- rt_kprintf(" file %s\r\n", file);
- rt_kprintf(" line %d\r\n", line);
+ rt_kprintf("\n\r Wrong parameter value detected on\r\n");
+ rt_kprintf(" file %s\r\n", file);
+ rt_kprintf(" line %d\r\n", line);
- while (1) ;
+ while (1) ;
}
/**
@@ -63,31 +63,31 @@ void assert_failed(uint8_t* file, uint32_t line)
*/
void rtthread_startup(void)
{
- /* 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();
#ifdef RT_USING_HEAP
rt_system_heap_init((void*)M451_SRAM_BEGIN, (void*)M451_SRAM_END);
#endif
- /* init scheduler system */
- rt_system_scheduler_init();
+ /* init scheduler system */
+ rt_system_scheduler_init();
+
+ /* init application */
+ rt_application_init();
- /* init application */
- rt_application_init();
-
/* Set finsh device */
#ifdef RT_USING_FINSH
finsh_system_init();
@@ -97,25 +97,25 @@ void rtthread_startup(void)
/* init timer thread */
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 ;
}
int main(void)
{
- /* disable interrupt first */
- rt_hw_interrupt_disable();
+ /* disable interrupt first */
+ rt_hw_interrupt_disable();
- /* startup RT-Thread RTOS */
- rtthread_startup();
+ /* startup RT-Thread RTOS */
+ rtthread_startup();
- return 0;
+ return 0;
}
/*@}*/
diff --git a/bsp/nuvoton_m451/drivers/board.c b/bsp/nuvoton_m451/drivers/board.c
index 39dbd04c62..9ab8d97b27 100644
--- a/bsp/nuvoton_m451/drivers/board.c
+++ b/bsp/nuvoton_m451/drivers/board.c
@@ -38,11 +38,11 @@ void NVIC_Configuration(void)
*/
static void delay(__IO uint32_t nCount)
{
- /* Decrement nCount value */
- while (nCount != 0)
- {
- nCount--;
- }
+ /* Decrement nCount value */
+ while (nCount != 0)
+ {
+ nCount--;
+ }
}
static void rt_hw_system_init(void)
@@ -52,7 +52,7 @@ static void rt_hw_system_init(void)
/*---------------------------------------------------------------------------------------------------------*/
/* Unlock protected registers */
SYS_UnlockReg();
-
+
/* Enable HIRC clock (Internal RC 22.1184MHz) */
CLK_EnableXtalRC(CLK_PWRCTL_HIRCEN_Msk);
@@ -73,7 +73,7 @@ static void rt_hw_system_init(void)
/* Set SysTick clock source to HCLK source divide 2 */
CLK_SetSysTickClockSrc(CLK_CLKSEL0_STCLKSEL_HCLK_DIV2);
-
+
/* Lock protected registers */
SYS_LockReg();
}
@@ -84,34 +84,34 @@ static void rt_hw_system_init(void)
*/
void SysTick_Handler(void)
{
- /* enter interrupt */
- rt_interrupt_enter();
+ /* enter interrupt */
+ rt_interrupt_enter();
- rt_tick_increase();
+ rt_tick_increase();
- /* leave interrupt */
- rt_interrupt_leave();
+ /* leave interrupt */
+ rt_interrupt_leave();
}
/**
* This function will initial Nuvoton board.
*/
void rt_hw_board_init()
{
- /* NVIC Configuration */
- NVIC_Configuration();
+ /* NVIC Configuration */
+ NVIC_Configuration();
/* Configure the system clock */
rt_hw_system_init();
- /* Configure the SysTick */
- SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
+ /* Configure the SysTick */
+ SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
- /* Initial usart deriver, and set console device */
- rt_hw_usart_init();
+ /* Initial usart deriver, and set console device */
+ rt_hw_usart_init();
#ifdef RT_USING_CONSOLE
- rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
- /* Call components board initial (use INIT_BOARD_EXPORT()) */
+ /* Call components board initial (use INIT_BOARD_EXPORT()) */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
diff --git a/bsp/nuvoton_m451/drivers/board.h b/bsp/nuvoton_m451/drivers/board.h
index 3aba14d32e..93588253c0 100644
--- a/bsp/nuvoton_m451/drivers/board.h
+++ b/bsp/nuvoton_m451/drivers/board.h
@@ -18,7 +18,7 @@
/* board configuration */
// <o> Internal SRAM memory size[Kbytes]
-// <i>Default: 64
+// <i>Default: 64
#define M451_SRAM_SIZE 32
#define M451_SRAM_END (0x20000000 + M451_SRAM_SIZE * 1024)
diff --git a/bsp/nuvoton_m451/drivers/led.h b/bsp/nuvoton_m451/drivers/led.h
index e4c1eb7ce9..730e82c0c6 100644
--- a/bsp/nuvoton_m451/drivers/led.h
+++ b/bsp/nuvoton_m451/drivers/led.h
@@ -15,7 +15,7 @@
#include <rtthread.h>
#include "M451Series.h"
-void rt_hw_led_on(void);
+void rt_hw_led_on(void);
void rt_hw_led_off(void);
int rt_hw_led_init(void);
diff --git a/bsp/nuvoton_m451/drivers/usart.c b/bsp/nuvoton_m451/drivers/usart.c
index 1ee0ded403..e0644a4828 100644
--- a/bsp/nuvoton_m451/drivers/usart.c
+++ b/bsp/nuvoton_m451/drivers/usart.c
@@ -20,20 +20,20 @@ static rt_err_t m451_configure(struct rt_serial_device *serial, struct serial_co
if (uart == UART0) {
/* Enable UART module clock */
CLK_EnableModuleClock(UART0_MODULE);
-
+
/* Select UART module clock source as HXT and UART module clock divider as 1 */
CLK_SetModuleClock(UART0_MODULE, CLK_CLKSEL1_UARTSEL_HXT, CLK_CLKDIV0_UART(1));
-
+
/* Set PD multi-function pins for UART0 RXD(PD.0) and TXD(PD.1) */
SYS->GPD_MFPL &= ~(SYS_GPD_MFPL_PD0MFP_Msk | SYS_GPD_MFPL_PD1MFP_Msk);
SYS->GPD_MFPL |= (SYS_GPD_MFPL_PD0MFP_UART0_RXD | SYS_GPD_MFPL_PD1MFP_UART0_TXD);
-
+
/* Reset UART module */
SYS_ResetModule(UART0_RST);
-
+
/* Configure UART0 and set UART0 Baudrate */
UART_Open(UART0, cfg->baud_rate);
-
+
/* Enable Interrupt */
UART_EnableInt(UART0, UART_INTEN_RDAIEN_Msk);
}
diff --git a/bsp/nuvoton_m451/rtconfig.h b/bsp/nuvoton_m451/rtconfig.h
index b47eb84c59..61f0496a22 100644
--- a/bsp/nuvoton_m451/rtconfig.h
+++ b/bsp/nuvoton_m451/rtconfig.h
@@ -3,16 +3,16 @@
#define __RTTHREAD_CFG_H__
/* 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 32
+#define RT_THREAD_PRIORITY_MAX 32
//#define IDLE_THREAD_STACK_SIZE 128
/* Tick per Second */
-#define RT_TICK_PER_SECOND 1000
+#define RT_TICK_PER_SECOND 1000
/* SECTION: RT_DEBUG */
/* Thread Debug */
@@ -26,9 +26,9 @@
/* Using Software Timer */
/* #define RT_USING_TIMER_SOFT */
-#define RT_TIMER_THREAD_PRIO 4
-#define RT_TIMER_THREAD_STACK_SIZE 512
-#define RT_TIMER_TICK_PER_SECOND 10
+#define RT_TIMER_THREAD_PRIO 4
+#define RT_TIMER_THREAD_STACK_SIZE 512
+#define RT_TIMER_TICK_PER_SECOND 10
/* SECTION: IPC */
/* Using Semaphore*/
@@ -71,9 +71,9 @@
/* SECTION: Console options */
#define RT_USING_CONSOLE
/* the buffer size of console*/
-#define RT_CONSOLEBUF_SIZE 128
+#define RT_CONSOLEBUF_SIZE 128
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
-#define RT_CONSOLE_DEVICE_NAME "uart0"
+#define RT_CONSOLE_DEVICE_NAME "uart0"
@@ -82,9 +82,9 @@
/* configure finsh parameters */
/*
#define FINSH_THREAD_PRIORITY 25
-#define FINSH_THREAD_STACK_SIZE 1024
+#define FINSH_THREAD_STACK_SIZE 1024
#define FINSH_USING_HISTORY 0
-#define FINSH_HISTORY_LINES 1
+#define FINSH_HISTORY_LINES 1
*/
/* Using symbol table */
#define FINSH_USING_SYMTAB
@@ -100,17 +100,17 @@
/* Reentrancy (thread safe) of the FatFs module. */
#define RT_DFS_ELM_REENTRANT
/* Number of volumes (logical drives) to be used. */
-#define RT_DFS_ELM_DRIVES 2
-/* #define RT_DFS_ELM_USE_LFN 1 */
-#define RT_DFS_ELM_MAX_LFN 255
+#define RT_DFS_ELM_DRIVES 2
+/* #define RT_DFS_ELM_USE_LFN 1 */
+#define RT_DFS_ELM_MAX_LFN 255
/* Maximum sector size to be handled. */
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
#define RT_USING_DFS_ROMFS
/* the max number of mounted filesystem */
-#define DFS_FILESYSTEMS_MAX 2
-/* the max number of opened files */
-#define DFS_FD_MAX 4
+#define DFS_FILESYSTEMS_MAX 2
+/* the max number of opened files */
+#define DFS_FD_MAX 4
#endif