Browse Source

add soft timer options; update 107 branch.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@221 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 15 years ago
parent
commit
9c4ff0c135

+ 1 - 1
bsp/stm3210/project.Uv2

@@ -219,7 +219,7 @@ Options 1,0,0  // Target 'RT-Thread STM32'
  ADSLDDW ()
  ADSLDDW ()
   OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F103ZE)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F103ZE)
   OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F103ZE)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F103ZE)
   OPTDBG 49150,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
   OPTDBG 49150,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
- FLASH1 { 9,0,0,0,1,0,0,0,5,16,0,0,0,0,0,0,0,0,0,0 }
+ FLASH1 { 9,0,0,0,1,0,0,0,6,16,0,0,0,0,0,0,0,0,0,0 }
  FLASH2 (Segger\JL2CM3.dll)
  FLASH2 (Segger\JL2CM3.dll)
  FLASH3 ("" ())
  FLASH3 ("" ())
  FLASH4 ()
  FLASH4 ()

+ 20 - 3
bsp/stm3210/project_107/application.c

@@ -17,13 +17,12 @@
  */
  */
 /*@{*/
 /*@{*/
 
 
+#include <board.h>
 #include <rtthread.h>
 #include <rtthread.h>
 
 
 #ifdef RT_USING_DFS
 #ifdef RT_USING_DFS
 /* dfs init */
 /* dfs init */
 #include <dfs_init.h>
 #include <dfs_init.h>
-/* dfs filesystem:FAT filesystem init */
-#include <dfs_fat.h>
 /* dfs filesystem:EFS filesystem init */
 /* dfs filesystem:EFS filesystem init */
 #include <dfs_efs.h>
 #include <dfs_efs.h>
 /* dfs Filesystem APIs */
 /* dfs Filesystem APIs */
@@ -33,6 +32,7 @@
 #ifdef RT_USING_LWIP
 #ifdef RT_USING_LWIP
 #include <lwip/sys.h>
 #include <lwip/sys.h>
 #include <lwip/api.h>
 #include <lwip/api.h>
+#include <netif/ethernetif.h>
 #endif
 #endif
 
 
 void rt_init_thread_entry(void* parameter)
 void rt_init_thread_entry(void* parameter)
@@ -73,7 +73,24 @@ void rt_init_thread_entry(void* parameter)
 #ifdef RT_USING_LWIP
 #ifdef RT_USING_LWIP
 	{
 	{
 		extern void lwip_sys_init(void);
 		extern void lwip_sys_init(void);
-		
+
+		/* register ethernetif device */
+		eth_system_device_init();
+
+#ifdef STM32F10X_CL
+		rt_hw_stm32_eth_init();
+#else
+	/* STM32F103 */
+	#if STM32_ETH_IF == 0
+			rt_hw_enc28j60_init();
+	#elif STM32_ETH_IF == 1
+			rt_hw_dm9000_init();
+	#endif
+#endif
+
+		/* re-init device driver */
+		rt_device_init_all();
+
 		/* init lwip system */
 		/* init lwip system */
 		lwip_sys_init();
 		lwip_sys_init();
 		rt_kprintf("TCP/IP initialized!\n");
 		rt_kprintf("TCP/IP initialized!\n");

+ 10 - 0
bsp/stm3210/project_107/board.h

@@ -42,14 +42,24 @@
 // 	<i>Default: 1
 // 	<i>Default: 1
 #define STM32_CONSOLE_USART		2
 #define STM32_CONSOLE_USART		2
 
 
+// <o> Ethernet Interface: <0=> Microchip ENC28J60 <1=> Davicom DM9000A
+// 	<i>Default: 0
+#define STM32_ETH_IF			0
+
 void rt_hw_board_led_on(int n);
 void rt_hw_board_led_on(int n);
 void rt_hw_board_led_off(int n);
 void rt_hw_board_led_off(int n);
 void rt_hw_board_init(void);
 void rt_hw_board_init(void);
 
 
 void rt_hw_usart_init(void);
 void rt_hw_usart_init(void);
+
+/* SD Card init function */
 void rt_hw_sdcard_init(void);
 void rt_hw_sdcard_init(void);
 void rt_hw_msd_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
 
 
 // <<< Use Configuration Wizard in Context Menu >>>
 // <<< Use Configuration Wizard in Context Menu >>>

+ 8 - 0
bsp/stm3210/project_107/rtconfig.h

@@ -24,6 +24,12 @@
 /* Using Hook */
 /* Using Hook */
 #define RT_USING_HOOK
 #define RT_USING_HOOK
 
 
+/* 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
+
 /* SECTION: IPC */
 /* SECTION: IPC */
 /* Using Semaphore*/
 /* Using Semaphore*/
 #define RT_USING_SEMAPHORE
 #define RT_USING_SEMAPHORE
@@ -69,6 +75,8 @@
 /* SECTION: device filesystem */
 /* SECTION: device filesystem */
 #define RT_USING_DFS
 #define RT_USING_DFS
 #define RT_USING_DFS_EFSL
 #define RT_USING_DFS_EFSL
+/* #define RT_USING_DFS_ELMFAT */
+
 /* the max number of mounted filesystem */
 /* the max number of mounted filesystem */
 #define DFS_FILESYSTEMS_MAX			2
 #define DFS_FILESYSTEMS_MAX			2
 /* the max number of opened files 		*/
 /* the max number of opened files 		*/

+ 12 - 7
bsp/stm3210/project_full/application.c

@@ -73,18 +73,23 @@ void rt_init_thread_entry(void* parameter)
 #ifdef RT_USING_LWIP
 #ifdef RT_USING_LWIP
 	{
 	{
 		extern void lwip_sys_init(void);
 		extern void lwip_sys_init(void);
-#ifdef RT_USING_LWIP
-		eth_system_device_init();
 
 
 		/* register ethernetif device */
 		/* register ethernetif device */
-#if STM32_ETH_IF == 0
-		rt_hw_enc28j60_init();
-#elif STM32_ETH_IF == 1
-		rt_hw_dm9000_init();
+		eth_system_device_init();
+
+#ifdef STM32F10X_CL
+		rt_hw_stm32_eth_init();
+#else
+	/* STM32F103 */
+	#if STM32_ETH_IF == 0
+			rt_hw_enc28j60_init();
+	#elif STM32_ETH_IF == 1
+			rt_hw_dm9000_init();
+	#endif
 #endif
 #endif
+
 		/* re-init device driver */
 		/* re-init device driver */
 		rt_device_init_all();
 		rt_device_init_all();
-#endif
 
 
 		/* init lwip system */
 		/* init lwip system */
 		lwip_sys_init();
 		lwip_sys_init();

+ 2 - 2
bsp/stm3210/project_full/project.Uv2

@@ -217,9 +217,9 @@ Options 1,0,0  // Target 'RT-Thread STM32'
  ADSLDMC (--keep __fsym_* --keep __vsym_*)
  ADSLDMC (--keep __fsym_* --keep __vsym_*)
  ADSLDIF ()
  ADSLDIF ()
  ADSLDDW ()
  ADSLDDW ()
-  OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F107xCSchedule)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F107xC)
+  OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F103ZE)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F103ZE)
   OPTDBG 49150,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
   OPTDBG 49150,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
- FLASH1 { 9,0,0,0,1,0,0,0,5,16,0,0,0,0,0,0,0,0,0,0 }
+ FLASH1 { 9,0,0,0,1,0,0,0,6,16,0,0,0,0,0,0,0,0,0,0 }
  FLASH2 (Segger\JL2CM3.dll)
  FLASH2 (Segger\JL2CM3.dll)
  FLASH3 ("" ())
  FLASH3 ("" ())
  FLASH4 ()
  FLASH4 ()

+ 9 - 0
bsp/stm3210/project_full/rtconfig.h

@@ -24,6 +24,12 @@
 /* Using Hook */
 /* Using Hook */
 #define RT_USING_HOOK
 #define RT_USING_HOOK
 
 
+/* 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
+
 /* SECTION: IPC */
 /* SECTION: IPC */
 /* Using Semaphore*/
 /* Using Semaphore*/
 #define RT_USING_SEMAPHORE
 #define RT_USING_SEMAPHORE
@@ -67,6 +73,9 @@
 
 
 /* SECTION: device filesystem */
 /* SECTION: device filesystem */
 #define RT_USING_DFS
 #define RT_USING_DFS
+#define RT_USING_DFS_EFSL
+/* #define RT_USING_DFS_ELMFAT */
+
 /* the max number of mounted filesystem */
 /* the max number of mounted filesystem */
 #define DFS_FILESYSTEMS_MAX			2
 #define DFS_FILESYSTEMS_MAX			2
 /* the max number of opened files 		*/
 /* the max number of opened files 		*/

+ 6 - 0
bsp/stm3210/project_full/startup.c

@@ -99,11 +99,14 @@ void rtthread_startup(void)
 
 
 	/* init hardware serial device */
 	/* init hardware serial device */
 	rt_hw_usart_init();
 	rt_hw_usart_init();
+
+#ifdef RT_USING_DFS
 	/* init sdcard driver */
 	/* init sdcard driver */
 #if STM32_USE_SDIO
 #if STM32_USE_SDIO
 	rt_hw_sdcard_init();
 	rt_hw_sdcard_init();
 #else
 #else
 	rt_hw_msd_init();
 	rt_hw_msd_init();
+#endif
 #endif
 #endif
 
 
     rt_hw_rtc_init();
     rt_hw_rtc_init();
@@ -120,6 +123,9 @@ void rtthread_startup(void)
 	finsh_set_device("uart1");
 	finsh_set_device("uart1");
 #endif
 #endif
 
 
+    /* init timer thread */
+    rt_system_timer_thread_init();
+
 	/* init idle thread */
 	/* init idle thread */
 	rt_thread_idle_init();
 	rt_thread_idle_init();
 
 

+ 24 - 2
bsp/stm3210/project_full/stm32f10x_it.c

@@ -250,6 +250,7 @@ void USART3_IRQHandler(void)
 #endif
 #endif
 }
 }
 
 
+#if defined(RT_USING_DFS) && STM32_USE_SDIO
 /*******************************************************************************
 /*******************************************************************************
 * Function Name  : SDIO_IRQHandler
 * Function Name  : SDIO_IRQHandler
 * Description    : This function handles SDIO global interrupt request.
 * Description    : This function handles SDIO global interrupt request.
@@ -259,7 +260,6 @@ void USART3_IRQHandler(void)
 *******************************************************************************/
 *******************************************************************************/
 void SDIO_IRQHandler(void)
 void SDIO_IRQHandler(void)
 {
 {
-#ifdef RT_USING_DFS
     extern int SD_ProcessIRQSrc(void);
     extern int SD_ProcessIRQSrc(void);
 
 
     /* enter interrupt */
     /* enter interrupt */
@@ -270,10 +270,31 @@ void SDIO_IRQHandler(void)
 
 
     /* leave interrupt */
     /* leave interrupt */
     rt_interrupt_leave();
     rt_interrupt_leave();
-#endif
 }
 }
+#endif
 
 
 #ifdef RT_USING_LWIP
 #ifdef RT_USING_LWIP
+#ifdef STM32F10X_CL
+/*******************************************************************************
+* 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)
 #if (STM32_ETH_IF == 0)
 /*******************************************************************************
 /*******************************************************************************
 * Function Name  : EXTI0_IRQHandler
 * Function Name  : EXTI0_IRQHandler
@@ -323,6 +344,7 @@ void EXTI9_5_IRQHandler(void)
 	rt_interrupt_leave();
 	rt_interrupt_leave();
 }
 }
 #endif
 #endif
+#endif
 #endif /* end of RT_USING_LWIP */
 #endif /* end of RT_USING_LWIP */
 
 
 /**
 /**

+ 3 - 0
bsp/stm3210/startup.c

@@ -123,6 +123,9 @@ void rtthread_startup(void)
 	finsh_set_device("uart1");
 	finsh_set_device("uart1");
 #endif
 #endif
 
 
+    /* init timer thread */
+    rt_system_timer_thread_init();
+
 	/* init idle thread */
 	/* init idle thread */
 	rt_thread_idle_init();
 	rt_thread_idle_init();