summaryrefslogtreecommitdiff
path: root/bsp/wh44b0
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/wh44b0
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/wh44b0')
-rw-r--r--bsp/wh44b0/application.c2
-rw-r--r--bsp/wh44b0/board.c228
-rw-r--r--bsp/wh44b0/rtconfig.h34
-rw-r--r--bsp/wh44b0/startup.c76
4 files changed, 170 insertions, 170 deletions
diff --git a/bsp/wh44b0/application.c b/bsp/wh44b0/application.c
index 3c74a8df9e..42c9b56fa8 100644
--- a/bsp/wh44b0/application.c
+++ b/bsp/wh44b0/application.c
@@ -20,7 +20,7 @@
/* application start function */
int rt_application_init()
{
- return 0; /* empty */
+ return 0; /* empty */
}
/** @} */
diff --git a/bsp/wh44b0/board.c b/bsp/wh44b0/board.c
index e1fc3e31ee..628f85abd8 100644
--- a/bsp/wh44b0/board.c
+++ b/bsp/wh44b0/board.c
@@ -32,82 +32,82 @@ extern void rt_serial_putc(const char ch);
void rt_timer_handler(int vector)
{
#ifdef BOARD_DEBUG
- rt_kprintf("timer handler, increase a tick\n");
+ rt_kprintf("timer handler, increase a tick\n");
#endif
- rt_tick_increase();
+ rt_tick_increase();
}
void rt_hw_port_init(void)
{
- /* PORT A GROUP */
- /* BIT 9 8 7 6 5 4 3 2 1 0 */
- /* A24 A23 A22 A21 A20 A19 A18 A17 A16 A0 */
- /* 1 1 1 1 1 1 1 1 1 1 */
- PCONA = 0x1ff;
- PDATA = 0x2db;
+ /* PORT A GROUP */
+ /* BIT 9 8 7 6 5 4 3 2 1 0 */
+ /* A24 A23 A22 A21 A20 A19 A18 A17 A16 A0 */
+ /* 1 1 1 1 1 1 1 1 1 1 */
+ PCONA = 0x1ff;
+ PDATA = 0x2db;
- /* PORT B GROUP */
- /* BIT 10 9 8 7 6 5 4 3 2 1 0 */
- /* /CS5 /CS4 /CS3 /CS2 /CS1 nWBE3 nWBE2 /SRAS /SCAS SCLS SCKE */
- /* NC NC RTL8019 USBD12 NV_Flash NC NC Sdram Sdram Sdram Sdram*/
- /* 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1 */
- PDATB = 0x4f;
- PCONB = 0x7cf;
+ /* PORT B GROUP */
+ /* BIT 10 9 8 7 6 5 4 3 2 1 0 */
+ /* /CS5 /CS4 /CS3 /CS2 /CS1 nWBE3 nWBE2 /SRAS /SCAS SCLS SCKE */
+ /* NC NC RTL8019 USBD12 NV_Flash NC NC Sdram Sdram Sdram Sdram*/
+ /* 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1 */
+ PDATB = 0x4f;
+ PCONB = 0x7cf;
- /* PORT C GROUP */
- /* BUSWIDTH=16 */
- /* PC15 14 13 12 11 10 9 8 */
- /* o o RXD1 TXD1 o o o o */
- /* NC NC Uart1 Uart1 NC NC NC NC */
- /* 01 01 11 11 01 01 01 00 */
+ /* PORT C GROUP */
+ /* BUSWIDTH=16 */
+ /* PC15 14 13 12 11 10 9 8 */
+ /* o o RXD1 TXD1 o o o o */
+ /* NC NC Uart1 Uart1 NC NC NC NC */
+ /* 01 01 11 11 01 01 01 00 */
- /* PC7 6 5 4 3 2 1 0 */
- /* o o o o o o o o */
- /* NC NC NC NC NFALE NFCLE NFCE NFRB*/
- /* 01 01 01 01 01 01 01 00 */
- PDATC = 0x3001; /* All IO is low */
- PCONC = 0x5f555555;
- PUPC = 0x3000; /* PULL UP RESISTOR should be enabled to I/O */
+ /* PC7 6 5 4 3 2 1 0 */
+ /* o o o o o o o o */
+ /* NC NC NC NC NFALE NFCLE NFCE NFRB*/
+ /* 01 01 01 01 01 01 01 00 */
+ PDATC = 0x3001; /* All IO is low */
+ PCONC = 0x5f555555;
+ PUPC = 0x3000; /* PULL UP RESISTOR should be enabled to I/O */
- /* PORT D GROUP */
- /* PORT D GROUP(I/O OR LCD) */
- /* BIT7 6 5 4 3 2 1 0 */
- /* VF VM VLINE VCLK VD3 VD2 VD1 VD0 */
- /* 01 01 01 01 01 01 01 01 */
- PDATD= 0x0;
- PCOND= 0xaaaa;
- PUPD = 0x00; /* These pins must be set only after CPU's internal LCD controller is enable */
-
- /* PORT E GROUP */
- /* Bit 8 7 6 5 4 3 2 1 0 */
- /* ENDLAN LED3 LED2 LED1 LED0 BEEP RXD0 TXD0 CLKOUT */
- /* 00 01 01 01 01 01 10 10 11 */
- PCONE = 0x556b; /*0->input, 1 2->TXD0 RXD0, 3 4->input, 5->led, 6->buzzer, 7->led, 8->CODECLK */
- PDATE = 0x57;
- PUPE = 0x006; /* disable all pull-up */
-
- /* PORT F GROUP */
- /* Bit8 7 6 5 4 3 2 1 0 */
- /* IISCLK IISDI IISDO IISLRCK Input Input Input IICSDA IICSCL */
- /* 100 010 010 001 00 01 01 10 10 */
- PDATF = 0x2f;
- PCONF = 0x24900a;
- PUPF = 0x1d3;
+ /* PORT D GROUP */
+ /* PORT D GROUP(I/O OR LCD) */
+ /* BIT7 6 5 4 3 2 1 0 */
+ /* VF VM VLINE VCLK VD3 VD2 VD1 VD0 */
+ /* 01 01 01 01 01 01 01 01 */
+ PDATD= 0x0;
+ PCOND= 0xaaaa;
+ PUPD = 0x00; /* These pins must be set only after CPU's internal LCD controller is enable */
- /* PORT G GROUP */
- /* BIT7 6 5 4 3 2 1 0 */
- /* INT7 INT6 INT5 INT4 INT3 INT2 INT1 INT0 */
- /* S3 S4 S5 S6 NIC EXT IDE USB */
- /* 11 11 11 11 11 11 11 11 */
- PDATG = 0xfc;
- PCONG = 0x000f; /* eint1 is eth interrupt in WH44B0 */
- PUPG = 0x00; /* should be enabled */
+ /* PORT E GROUP */
+ /* Bit 8 7 6 5 4 3 2 1 0 */
+ /* ENDLAN LED3 LED2 LED1 LED0 BEEP RXD0 TXD0 CLKOUT */
+ /* 00 01 01 01 01 01 10 10 11 */
+ PCONE = 0x556b; /*0->input, 1 2->TXD0 RXD0, 3 4->input, 5->led, 6->buzzer, 7->led, 8->CODECLK */
+ PDATE = 0x57;
+ PUPE = 0x006; /* disable all pull-up */
- SPUCR=0x7; /* D15-D0 pull-up disable */
+ /* PORT F GROUP */
+ /* Bit8 7 6 5 4 3 2 1 0 */
+ /* IISCLK IISDI IISDO IISLRCK Input Input Input IICSDA IICSCL */
+ /* 100 010 010 001 00 01 01 10 10 */
+ PDATF = 0x2f;
+ PCONF = 0x24900a;
+ PUPF = 0x1d3;
- /* all external interrupts are triggered by low level */
- EXTINT=0x0;
+ /* PORT G GROUP */
+ /* BIT7 6 5 4 3 2 1 0 */
+ /* INT7 INT6 INT5 INT4 INT3 INT2 INT1 INT0 */
+ /* S3 S4 S5 S6 NIC EXT IDE USB */
+ /* 11 11 11 11 11 11 11 11 */
+ PDATG = 0xfc;
+ PCONG = 0x000f; /* eint1 is eth interrupt in WH44B0 */
+ PUPG = 0x00; /* should be enabled */
+
+ SPUCR=0x7; /* D15-D0 pull-up disable */
+
+ /* all external interrupts are triggered by low level */
+ EXTINT=0x0;
}
/**
@@ -115,90 +115,90 @@ void rt_hw_port_init(void)
*/
void rt_hw_board_init()
{
- /* init port setting */
- rt_hw_port_init();
+ /* init port setting */
+ rt_hw_port_init();
- /* set timer0 register */
- /* stop timer */
- TCON &= ~(0x00000001);
+ /* set timer0 register */
+ /* stop timer */
+ TCON &= ~(0x00000001);
- /* dead zone = 0, pre = 150 */
- TCFG0 = 0x00000095;
- /* all are interrupt mode */
- TCFG1 = 0x00000003;
+ /* dead zone = 0, pre = 150 */
+ TCFG0 = 0x00000095;
+ /* all are interrupt mode */
+ TCFG1 = 0x00000003;
- TCNTB0 = DATA_COUNT;
- TCMPB0 = 0;
+ TCNTB0 = DATA_COUNT;
+ TCMPB0 = 0;
- /* manual update */
- TCON |= 0x00000002;
+ /* manual update */
+ TCON |= 0x00000002;
- /* auto reload on,output inverter off */
- TCON &= ~(0x0000000f);
- TCON |= (0x00000008);
+ /* auto reload on,output inverter off */
+ TCON &= ~(0x0000000f);
+ TCON |= (0x00000008);
- /* install timer handler */
- rt_hw_interrupt_install(INT_TIMER0, rt_timer_handler, RT_NULL);
- rt_hw_interrupt_umask(INT_TIMER0);
+ /* install timer handler */
+ rt_hw_interrupt_install(INT_TIMER0, rt_timer_handler, RT_NULL);
+ rt_hw_interrupt_umask(INT_TIMER0);
- /* start timer */
- TCON |=(0x00000001);
+ /* start timer */
+ TCON |=(0x00000001);
}
void rt_hw_led_set(rt_uint32_t led)
{
- if((led & 0x01)==0x01) /* D1 */
- PDATC = PDATC | (1<<1) ;
- else
- PDATC = PDATC & (~(1<<1)) ;
-
- if((led & 0x02)==0x02) /* D2 */
- PDATC = PDATC | (1<<2) ;
- else
- PDATC = PDATC & (~(1<<2)) ;
+ if((led & 0x01)==0x01) /* D1 */
+ PDATC = PDATC | (1<<1) ;
+ else
+ PDATC = PDATC & (~(1<<1)) ;
+
+ if((led & 0x02)==0x02) /* D2 */
+ PDATC = PDATC | (1<<2) ;
+ else
+ PDATC = PDATC & (~(1<<2)) ;
- if((led & 0x04)==0x04) /* D3 */
- PDATC = PDATC | (1<<3) ;
- else
- PDATC = PDATC & (~(1<<3)) ;
+ if((led & 0x04)==0x04) /* D3 */
+ PDATC = PDATC | (1<<3) ;
+ else
+ PDATC = PDATC & (~(1<<3)) ;
}
/* led loop */
void rt_hw_led_flash(void)
{
- register int i;
+ register int i;
+
+ rt_hw_led_set(0x01);
+ for ( i = 0; i < 2000000; i++);
+
+ rt_hw_led_set(0x02);
+ for ( i = 0; i < 2000000; i++);
- rt_hw_led_set(0x01);
- for ( i = 0; i < 2000000; i++);
-
- rt_hw_led_set(0x02);
- for ( i = 0; i < 2000000; i++);
-
- rt_hw_led_set(0x04);
- for ( i = 0; i < 2000000; i++);
+ rt_hw_led_set(0x04);
+ for ( i = 0; i < 2000000; i++);
}
#ifdef RT_USING_FINSH
extern void finsh_notify(void);
void rt_serial_isr(int vector)
{
- finsh_notify();
+ finsh_notify();
}
void rt_hw_finsh_init()
{
- /* install UART isr */
- rt_hw_interrupt_install(INT_URXD0, rt_serial_isr, RT_NULL);
- rt_hw_interrupt_umask(INT_URXD0);
+ /* install UART isr */
+ rt_hw_interrupt_install(INT_URXD0, rt_serial_isr, RT_NULL);
+ rt_hw_interrupt_umask(INT_URXD0);
}
#endif
void rt_hw_console_output(const char* string)
{
- while (*string)
- {
- rt_serial_putc(*string++);
- }
+ while (*string)
+ {
+ rt_serial_putc(*string++);
+ }
}
/*@}*/
diff --git a/bsp/wh44b0/rtconfig.h b/bsp/wh44b0/rtconfig.h
index 32364bbc4a..0f981e1be7 100644
--- a/bsp/wh44b0/rtconfig.h
+++ b/bsp/wh44b0/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 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*/
@@ -59,7 +59,7 @@
/* SECTION: Console options */
/* the buffer size of console*/
-#define RT_CONSOLEBUF_SIZE 128
+#define RT_CONSOLEBUF_SIZE 128
/* SECTION: FinSH shell options */
/* Using FinSH as Shell*/
@@ -99,21 +99,21 @@
/* #define RT_LWIP_DHCP */
/* ip address of target*/
-#define RT_LWIP_IPADDR0 192
-#define RT_LWIP_IPADDR1 168
-#define RT_LWIP_IPADDR2 0
-#define RT_LWIP_IPADDR3 30
+#define RT_LWIP_IPADDR0 192
+#define RT_LWIP_IPADDR1 168
+#define RT_LWIP_IPADDR2 0
+#define RT_LWIP_IPADDR3 30
/* gateway address of target*/
-#define RT_LWIP_GWADDR0 192
-#define RT_LWIP_GWADDR1 168
-#define RT_LWIP_GWADDR2 0
-#define RT_LWIP_GWADDR3 1
+#define RT_LWIP_GWADDR0 192
+#define RT_LWIP_GWADDR1 168
+#define RT_LWIP_GWADDR2 0
+#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
#endif
diff --git a/bsp/wh44b0/startup.c b/bsp/wh44b0/startup.c
index 4ea7a4f03d..1f92b416c1 100644
--- a/bsp/wh44b0/startup.c
+++ b/bsp/wh44b0/startup.c
@@ -44,74 +44,74 @@ extern int rt_application_init(void);
*/
void rtthread_startup(void)
{
- /* enable cpu cache */
- rt_hw_cpu_icache_enable();
+ /* enable cpu cache */
+ rt_hw_cpu_icache_enable();
- /* 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();
- /* init hardware serial */
- rt_serial_init();
+ /* init hardware serial */
+ rt_serial_init();
- rt_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 memory system */
+ /* init memory system */
#ifdef RT_USING_HEAP
#ifdef __CC_ARM
- rt_system_heap_init((void*)&Image$$RW_RAM1$$ZI$$Limit, (void*)0xD000000);
+ rt_system_heap_init((void*)&Image$$RW_RAM1$$ZI$$Limit, (void*)0xD000000);
#else
- rt_system_heap_init((void*)&__bss_end, (void*)0xD000000);
+ rt_system_heap_init((void*)&__bss_end, (void*)0xD000000);
#endif
#endif
- /* init scheduler system */
- rt_system_scheduler_init();
+ /* init scheduler system */
+ rt_system_scheduler_init();
#ifdef RT_USING_HOOK
- /* set idle thread hook */
- rt_thread_idle_sethook(rt_hw_led_flash);
+ /* set idle thread hook */
+ rt_thread_idle_sethook(rt_hw_led_flash);
#endif
- /* init application */
- rt_application_init();
+ /* init application */
+ rt_application_init();
#ifdef RT_USING_FINSH
- /* init the finsh input */
- rt_hw_finsh_init();
+ /* init the finsh input */
+ rt_hw_finsh_init();
- /* init finsh */
- finsh_system_init();
+ /* init finsh */
+ finsh_system_init();
#endif
- /* init idle thread */
- rt_thread_idle_init();
+ /* init idle thread */
+ rt_thread_idle_init();
- /* unmask interrupt */
- rt_hw_interrupt_umask(INT_GLOBAL);
+ /* unmask interrupt */
+ rt_hw_interrupt_umask(INT_GLOBAL);
- /* start scheduler */
- rt_system_scheduler_start();
+ /* start scheduler */
+ rt_system_scheduler_start();
- /* never reach here */
- return ;
+ /* never reach here */
+ return ;
}
int main(void)
{
- /* invoke rtthread startup */
- rtthread_startup();
+ /* invoke rtthread startup */
+ rtthread_startup();
}
/*@}*/