diff --git a/bsp/stm32f10x/applications/startup.c b/bsp/stm32f10x/applications/startup.c index 445e1419bf590c8c9483ba629425c7ec9f44f2a1..57afa388d0f2e58c0c62a1f9c655e81cc88eae72 100644 --- a/bsp/stm32f10x/applications/startup.c +++ b/bsp/stm32f10x/applications/startup.c @@ -15,9 +15,7 @@ #include #include -#include "stm32f10x.h" #include "board.h" -#include "rtc.h" /** * @addtogroup STM32 @@ -68,9 +66,6 @@ void rtthread_startup(void) /* show version */ rt_show_version(); - /* init tick */ - rt_system_tick_init(); - /* init kernel object */ rt_system_object_init(); @@ -89,25 +84,14 @@ void rtthread_startup(void) /* init memory system */ rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END); #endif -#endif -#endif +#endif /* STM32_EXT_SRAM */ +#endif /* RT_USING_HEAP */ /* init scheduler system */ rt_system_scheduler_init(); -#ifdef RT_USING_DFS - /* init sdcard driver */ -#if STM32_USE_SDIO - rt_hw_sdcard_init(); -#else - rt_hw_msd_init(); -#endif -#endif - - rt_hw_rtc_init(); - - /* init all device */ - rt_device_init_all(); + /* init timer thread */ + rt_system_timer_thread_init(); /* init application */ rt_application_init(); @@ -115,12 +99,9 @@ void rtthread_startup(void) #ifdef RT_USING_FINSH /* init finsh */ finsh_system_init(); - finsh_set_device("uart1"); + finsh_set_device(RT_CONSOLE_DEVICE_NAME); #endif - /* init timer thread */ - rt_system_timer_thread_init(); - /* init idle thread */ rt_thread_idle_init(); diff --git a/bsp/stm32f10x/drivers/board.c b/bsp/stm32f10x/drivers/board.c index 010ac851f0b8318b98f185e39753868a4287f59e..dd2b7b19df91695b6de873e6f99e52dcf0740942 100644 --- a/bsp/stm32f10x/drivers/board.c +++ b/bsp/stm32f10x/drivers/board.c @@ -153,7 +153,7 @@ void EXT_SRAM_Configuration(void) * This is the timer interrupt service routine. * */ -void rt_hw_timer_handler(void) +void SysTick_Handler(void) { /* enter interrupt */ rt_interrupt_enter(); @@ -167,7 +167,7 @@ void rt_hw_timer_handler(void) /** * This function will initial STM32 board. */ -void rt_hw_board_init() +void rt_hw_board_init(void) { /* NVIC Configuration */ NVIC_Configuration(); @@ -180,7 +180,7 @@ void rt_hw_board_init() #endif rt_hw_usart_init(); - rt_console_set_device(CONSOLE_DEVICE); + rt_console_set_device(RT_CONSOLE_DEVICE_NAME); } /*@}*/ diff --git a/bsp/stm32f10x/drivers/board.h b/bsp/stm32f10x/drivers/board.h index 6454bf5407817b728778cafd31825594569cd68f..b33e397954f918d57247cc1ea68c88306fa350d0 100644 --- a/bsp/stm32f10x/drivers/board.h +++ b/bsp/stm32f10x/drivers/board.h @@ -16,10 +16,9 @@ #ifndef __BOARD_H__ #define __BOARD_H__ +#include "stm32f10x.h" + /* board configuration */ -// SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card -// Default: 1 -#define STM32_USE_SDIO 1 /* whether use board external SRAM memory */ // Use external SRAM memory on the board @@ -38,38 +37,6 @@ #define STM32_SRAM_SIZE 64 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -// Console on USART: <0=> no console <1=>USART 1 <2=>USART 2 <3=> USART 3 -// Default: 1 -#define STM32_CONSOLE_USART 1 - -// Ethernet Interface: <0=> Microchip ENC28J60 <1=> Davicom DM9000A -// Default: 0 -#define STM32_ETH_IF 1 - -void rt_hw_board_led_on(int n); -void rt_hw_board_led_off(int n); -void rt_hw_board_init(void); - -#if STM32_CONSOLE_USART == 0 -#define CONSOLE_DEVICE "no" -#elif STM32_CONSOLE_USART == 1 -#define CONSOLE_DEVICE "uart1" -#elif STM32_CONSOLE_USART == 2 -#define CONSOLE_DEVICE "uart2" -#elif STM32_CONSOLE_USART == 3 -#define CONSOLE_DEVICE "uart3" -#endif - -void rt_hw_usart_init(void); - -/* SD Card init function */ -void rt_hw_sdcard_init(void); -void rt_hw_msd_init(void); - -/* ETH interface init function */ -void rt_hw_enc28j60_init(void); -void rt_hw_dm9000_init(void); - -#endif +#endif /* __BOARD_H__ */ // <<< Use Configuration Wizard in Context Menu >>> diff --git a/bsp/stm32f10x/drivers/sdcard.c b/bsp/stm32f10x/drivers/sdcard.c index 1ceea2e227a7a34ff4da01435cdcf33c40906adb..630e0fe4dded94b2692e0aa739fd4cad348a2b07 100644 --- a/bsp/stm32f10x/drivers/sdcard.c +++ b/bsp/stm32f10x/drivers/sdcard.c @@ -3236,3 +3236,17 @@ __return: rt_kprintf("sdcard init failed\n"); GPIO_SetBits(GPIOC,GPIO_Pin_6); /* SD card power down */ } + +void SDIO_IRQHandler(void) +{ + extern int SD_ProcessIRQSrc(void); + + /* enter interrupt */ + rt_interrupt_enter(); + + /* Process All SDIO Interrupt Sources */ + SD_ProcessIRQSrc(); + + /* leave interrupt */ + rt_interrupt_leave(); +} diff --git a/bsp/stm32f10x/drivers/stm32f10x_it.c b/bsp/stm32f10x/drivers/stm32f10x_it.c index 86a9eef9edc9a98d5c8d45694ce8747029cacd1a..f521dab52a20ea89f9d42c2d133a51121cb2866d 100644 --- a/bsp/stm32f10x/drivers/stm32f10x_it.c +++ b/bsp/stm32f10x/drivers/stm32f10x_it.c @@ -57,10 +57,10 @@ void NMI_Handler(void) */ void MemManage_Handler(void) { - /* Go to infinite loop when Memory Manage exception occurs */ - while (1) - { - } + /* Go to infinite loop when Memory Manage exception occurs */ + while (1) + { + } } /** @@ -70,10 +70,10 @@ void MemManage_Handler(void) */ void BusFault_Handler(void) { - /* Go to infinite loop when Bus Fault exception occurs */ - while (1) - { - } + /* Go to infinite loop when Bus Fault exception occurs */ + while (1) + { + } } /** @@ -83,10 +83,10 @@ void BusFault_Handler(void) */ void UsageFault_Handler(void) { - /* Go to infinite loop when Usage Fault exception occurs */ - while (1) - { - } + /* Go to infinite loop when Usage Fault exception occurs */ + while (1) + { + } } /** @@ -107,11 +107,10 @@ void DebugMon_Handler(void) { } -void SysTick_Handler(void) -{ - extern void rt_hw_timer_handler(void); - rt_hw_timer_handler(); -} +//void SysTick_Handler(void) +//{ +// // definition in boarc.c +//} /******************************************************************************/ /* STM32F10x Peripherals Interrupt Handlers */ @@ -131,7 +130,7 @@ void DMA1_Channel2_IRQHandler(void) { #ifdef RT_USING_UART3 extern struct rt_device uart3_device; - extern void rt_hw_serial_dma_tx_isr(struct rt_device *device); + extern void rt_hw_serial_dma_tx_isr(struct rt_device *device); /* enter interrupt */ rt_interrupt_enter(); @@ -161,7 +160,7 @@ void USART1_IRQHandler(void) { #ifdef RT_USING_UART1 extern struct rt_device uart1_device; - extern void rt_hw_serial_isr(struct rt_device *device); + extern void rt_hw_serial_isr(struct rt_device *device); /* enter interrupt */ rt_interrupt_enter(); @@ -184,7 +183,7 @@ void USART2_IRQHandler(void) { #ifdef RT_USING_UART2 extern struct rt_device uart2_device; - extern void rt_hw_serial_isr(struct rt_device *device); + extern void rt_hw_serial_isr(struct rt_device *device); /* enter interrupt */ rt_interrupt_enter(); @@ -207,7 +206,7 @@ void USART3_IRQHandler(void) { #ifdef RT_USING_UART3 extern struct rt_device uart3_device; - extern void rt_hw_serial_isr(struct rt_device *device); + extern void rt_hw_serial_isr(struct rt_device *device); /* enter interrupt */ rt_interrupt_enter(); @@ -219,102 +218,30 @@ void USART3_IRQHandler(void) #endif } -#if defined(RT_USING_DFS) && STM32_USE_SDIO -/******************************************************************************* -* Function Name : SDIO_IRQHandler -* Description : This function handles SDIO global interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void SDIO_IRQHandler(void) -{ - extern int SD_ProcessIRQSrc(void); - - /* enter interrupt */ - rt_interrupt_enter(); - - /* Process All SDIO Interrupt Sources */ - SD_ProcessIRQSrc(); - - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif - -#ifdef RT_USING_LWIP -#ifdef STM32F10X_CL +#ifdef RT_USING_LWIP /******************************************************************************* -* Function Name : ETH_IRQHandler -* Description : This function handles ETH interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void ETH_IRQHandler(void) -{ - extern void rt_hw_stm32_eth_isr(void); - - /* enter interrupt */ - rt_interrupt_enter(); - - rt_hw_stm32_eth_isr(); - - /* leave interrupt */ - rt_interrupt_leave(); -} -#else -#if (STM32_ETH_IF == 0) -/******************************************************************************* -* Function Name : EXTI0_IRQHandler -* Description : This function handles External interrupt Line 0 request. +* Function Name : EXTI4_IRQHandler +* Description : This function handles External lines 9 to 5 interrupt request. * Input : None * Output : None * Return : None *******************************************************************************/ -void EXTI2_IRQHandler(void) +void EXTI4_IRQHandler(void) { - extern void enc28j60_isr(void); + extern void rt_dm9000_isr(void); /* enter interrupt */ rt_interrupt_enter(); - enc28j60_isr(); + /* Clear the DM9000A EXTI line pending bit */ + EXTI_ClearITPendingBit(EXTI_Line4); - /* Clear the Key Button EXTI line pending bit */ - EXTI_ClearITPendingBit(EXTI_Line2); + rt_dm9000_isr(); /* leave interrupt */ rt_interrupt_leave(); } -#endif - -#if (STM32_ETH_IF == 1) -/******************************************************************************* -* Function Name : EXTI4_IRQHandler -* Description : This function handles External lines 9 to 5 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void EXTI4_IRQHandler(void) -{ - extern void rt_dm9000_isr(void); - - /* enter interrupt */ - rt_interrupt_enter(); - - /* Clear the DM9000A EXTI line pending bit */ - EXTI_ClearITPendingBit(EXTI_Line4); - - rt_dm9000_isr(); - - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif -#endif -#endif /* end of RT_USING_LWIP */ +#endif /* RT_USING_LWIP */ /** * @}