提交 5d45949e 编写于 作者: qiuyiuestc's avatar qiuyiuestc

prepare for RT-Thread/LM3S 0.3.0 version

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@274 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 0b26d44a
...@@ -37,8 +37,9 @@ if rtconfig.RT_USING_LWIP: ...@@ -37,8 +37,9 @@ if rtconfig.RT_USING_LWIP:
src_bsp = ['application.c', 'startup.c', 'board.c'] src_bsp = ['application.c', 'startup.c', 'board.c']
src_drv = []
if rtconfig.RT_USING_DFS: if rtconfig.RT_USING_DFS:
src_drv = ['sdcard.c'] src_drv += ['sdcard.c']
if rtconfig.RT_USING_LWIP: if rtconfig.RT_USING_LWIP:
src_drv += ['luminaryif.c'] src_drv += ['luminaryif.c']
......
...@@ -50,12 +50,27 @@ void rt_hw_timer_handler(void) ...@@ -50,12 +50,27 @@ void rt_hw_timer_handler(void)
} }
/** /**
* This function will initial STM32 board. * This is the ethernet interrupt service routine.
*
*/
void rt_hw_eth_handler(void)
{
#ifdef RT_USING_LWIP
/* luminary ethernet interface */
extern void luminaryif_isr(void);
luminaryif_isr();
#endif
}
/**
* This function will initial LM3S board.
*/ */
void rt_hw_board_init() void rt_hw_board_init()
{ {
/* set ldo */
SysCtlLDOSet(SYSCTL_LDO_2_50V);
/* set clock */ /* set clock */
SysCtlClockSet(SYSCTL_SYSDIV_2 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_6MHZ); SYSCTL_XTAL_6MHZ);
/* init systick */ /* init systick */
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2006-10-08 Bernard add board.h to this bsp * 2006-10-08 Bernard add board.h to this bsp
* 2009-12-25 yi.qiu add LM3S configration
*/ */
// <<< Use Configuration Wizard in Context Menu >>>
#ifndef __BOARD_H__ #ifndef __BOARD_H__
#define __BOARD_H__ #define __BOARD_H__
......
...@@ -15,112 +15,121 @@ GRPOPT 1,(Startup),1,0,0 ...@@ -15,112 +15,121 @@ GRPOPT 1,(Startup),1,0,0
GRPOPT 2,(Kernel),0,0,0 GRPOPT 2,(Kernel),0,0,0
GRPOPT 3,(finsh),0,0,0 GRPOPT 3,(finsh),0,0,0
GRPOPT 4,(LM3S),0,0,0 GRPOPT 4,(LM3S),0,0,0
GRPOPT 5,(driverlib),1,0,0 GRPOPT 5,(driverlib),0,0,0
GRPOPT 6,(Filesystem),1,0,0 GRPOPT 6,(Filesystem),0,0,0
GRPOPT 7,(LwIP),0,0,0 GRPOPT 7,(LwIP),1,0,0
GRPOPT 8,(Utils),1,0,0 GRPOPT 8,(Utils),1,0,0
OPTFFF 1,1,1,201326592,0,0,0,0,<.\application.c><application.c> OPTFFF 1,1,1,0,0,1,1,0,<.\application.c><application.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,88,0,0,0,116,0,0,0,236,2,0,0,123,1,0,0 }
OPTFFF 1,2,1,2,0,10,18,0,<.\board.c><board.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,161,2,0,0,71,1,0,0 } OPTFFF 1,2,1,486539264,0,63,63,0,<.\board.c><board.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,183,2,0,0,100,1,0,0 }
OPTFFF 1,3,1,0,0,0,0,0,<.\startup.c><startup.c> OPTFFF 1,3,1,0,0,130,135,0,<.\startup.c><startup.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,161,2,0,0,71,1,0,0 }
OPTFFF 1,4,5,0,0,0,0,0,<.\rtconfig.h><rtconfig.h> OPTFFF 1,4,5,469762048,0,115,128,0,<.\rtconfig.h><rtconfig.h> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,139,2,0,0,42,1,0,0 }
OPTFFF 1,5,1,922746880,0,0,0,0,<.\sdcard.c><sdcard.c> OPTFFF 1,5,1,922746880,0,0,0,0,<.\sdcard.c><sdcard.c>
OPTFFF 1,6,1,0,0,0,0,0,<.\luminaryif.c><luminaryif.c> OPTFFF 1,6,1,1006632960,0,1,1,0,<.\luminaryif.c><luminaryif.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 2,7,1,0,0,0,0,0,<..\..\src\clock.c><clock.c> OPTFFF 1,7,5,0,0,0,0,0,<.\board.h><board.h>
OPTFFF 2,8,1,0,0,0,0,0,<..\..\src\device.c><device.c> OPTFFF 2,8,1,0,0,0,0,0,<..\..\src\clock.c><clock.c>
OPTFFF 2,9,1,0,0,0,0,0,<..\..\src\idle.c><idle.c> OPTFFF 2,9,1,0,0,0,0,0,<..\..\src\device.c><device.c>
OPTFFF 2,10,1,0,0,0,0,0,<..\..\src\ipc.c><ipc.c> OPTFFF 2,10,1,0,0,51,60,0,<..\..\src\idle.c><idle.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 2,11,1,0,0,0,0,0,<..\..\src\irq.c><irq.c> OPTFFF 2,11,1,0,0,0,0,0,<..\..\src\ipc.c><ipc.c>
OPTFFF 2,12,1,0,0,0,0,0,<..\..\src\mem.c><mem.c> OPTFFF 2,12,1,0,0,0,0,0,<..\..\src\irq.c><irq.c>
OPTFFF 2,13,1,0,0,0,0,0,<..\..\src\mempool.c><mempool.c> OPTFFF 2,13,1,0,0,0,0,0,<..\..\src\mem.c><mem.c>
OPTFFF 2,14,1,0,0,0,0,0,<..\..\src\object.c><object.c> OPTFFF 2,14,1,0,0,0,0,0,<..\..\src\mempool.c><mempool.c>
OPTFFF 2,15,1,0,0,0,0,0,<..\..\src\scheduler.c><scheduler.c> OPTFFF 2,15,1,0,0,0,0,0,<..\..\src\object.c><object.c>
OPTFFF 2,16,1,0,0,0,0,0,<..\..\src\slab.c><slab.c> OPTFFF 2,16,1,0,0,0,0,0,<..\..\src\scheduler.c><scheduler.c>
OPTFFF 2,17,1,0,0,0,0,0,<..\..\src\thread.c><thread.c> OPTFFF 2,17,1,0,0,0,0,0,<..\..\src\slab.c><slab.c>
OPTFFF 2,18,1,0,0,0,0,0,<..\..\src\timer.c><timer.c> OPTFFF 2,18,1,0,0,0,0,0,<..\..\src\thread.c><thread.c>
OPTFFF 2,19,1,0,0,0,0,0,<..\..\src\kservice.c><kservice.c> OPTFFF 2,19,1,0,0,0,0,0,<..\..\src\timer.c><timer.c>
OPTFFF 3,20,1,0,0,0,0,0,<..\..\finsh\symbol.c><symbol.c> OPTFFF 2,20,1,0,0,0,0,0,<..\..\src\kservice.c><kservice.c>
OPTFFF 3,21,1,0,0,0,0,0,<..\..\finsh\cmd.c><cmd.c> OPTFFF 3,21,1,0,0,0,0,0,<..\..\finsh\symbol.c><symbol.c>
OPTFFF 3,22,1,0,0,0,0,0,<..\..\finsh\finsh_compiler.c><finsh_compiler.c> OPTFFF 3,22,1,0,0,0,0,0,<..\..\finsh\cmd.c><cmd.c>
OPTFFF 3,23,1,0,0,0,0,0,<..\..\finsh\finsh_error.c><finsh_error.c> OPTFFF 3,23,1,0,0,0,0,0,<..\..\finsh\finsh_compiler.c><finsh_compiler.c>
OPTFFF 3,24,1,0,0,0,0,0,<..\..\finsh\finsh_heap.c><finsh_heap.c> OPTFFF 3,24,1,0,0,0,0,0,<..\..\finsh\finsh_error.c><finsh_error.c>
OPTFFF 3,25,1,0,0,0,0,0,<..\..\finsh\finsh_init.c><finsh_init.c> OPTFFF 3,25,1,0,0,0,0,0,<..\..\finsh\finsh_heap.c><finsh_heap.c>
OPTFFF 3,26,1,0,0,0,0,0,<..\..\finsh\finsh_node.c><finsh_node.c> OPTFFF 3,26,1,0,0,0,0,0,<..\..\finsh\finsh_init.c><finsh_init.c>
OPTFFF 3,27,1,0,0,0,0,0,<..\..\finsh\finsh_ops.c><finsh_ops.c> OPTFFF 3,27,1,0,0,0,0,0,<..\..\finsh\finsh_node.c><finsh_node.c>
OPTFFF 3,28,1,0,0,0,0,0,<..\..\finsh\finsh_parser.c><finsh_parser.c> OPTFFF 3,28,1,0,0,0,0,0,<..\..\finsh\finsh_ops.c><finsh_ops.c>
OPTFFF 3,29,1,0,0,0,0,0,<..\..\finsh\finsh_token.c><finsh_token.c> OPTFFF 3,29,1,0,0,0,0,0,<..\..\finsh\finsh_parser.c><finsh_parser.c>
OPTFFF 3,30,1,0,0,0,0,0,<..\..\finsh\finsh_var.c><finsh_var.c> OPTFFF 3,30,1,0,0,0,0,0,<..\..\finsh\finsh_token.c><finsh_token.c>
OPTFFF 3,31,1,0,0,0,0,0,<..\..\finsh\finsh_vm.c><finsh_vm.c> OPTFFF 3,31,1,0,0,0,0,0,<..\..\finsh\finsh_var.c><finsh_var.c>
OPTFFF 3,32,1,0,0,0,0,0,<..\..\finsh\shell.c><shell.c> OPTFFF 3,32,1,0,0,0,0,0,<..\..\finsh\finsh_vm.c><finsh_vm.c>
OPTFFF 4,33,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\cpu.c><cpu.c> OPTFFF 3,33,1,0,0,0,0,0,<..\..\finsh\shell.c><shell.c>
OPTFFF 4,34,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\interrupt.c><interrupt.c> OPTFFF 4,34,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\cpu.c><cpu.c>
OPTFFF 4,35,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\stack.c><stack.c> OPTFFF 4,35,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\interrupt.c><interrupt.c>
OPTFFF 4,36,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\context_rvds.S><context_rvds.S> OPTFFF 4,36,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\stack.c><stack.c>
OPTFFF 4,37,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S> OPTFFF 4,37,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\context_rvds.S><context_rvds.S>
OPTFFF 4,38,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\serial.c><serial.c> OPTFFF 4,38,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S>
OPTFFF 4,39,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault.c><fault.c> OPTFFF 4,39,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\serial.c><serial.c>
OPTFFF 4,40,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault_rvds.S><fault_rvds.S> OPTFFF 4,40,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault.c><fault.c>
OPTFFF 5,41,4,0,0,0,0,0,<E:\SVN-Google-Source\bsp\lm3s\Libraries\driverlib\rvmdk\driverlib.lib><driverlib.lib> OPTFFF 4,41,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault_rvds.S><fault_rvds.S>
OPTFFF 6,42,1,1,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c> OPTFFF 5,42,4,0,0,0,0,0,<E:\SVN-Google-Source\bsp\lm3s\Libraries\driverlib\rvmdk\driverlib.lib><driverlib.lib>
OPTFFF 6,43,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c> OPTFFF 6,43,1,1,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
OPTFFF 6,44,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c> OPTFFF 6,44,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
OPTFFF 6,45,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c> OPTFFF 6,45,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
OPTFFF 6,46,1,0,0,1,1,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,135,2,0,0,41,1,0,0 } OPTFFF 6,46,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
OPTFFF 6,47,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c> OPTFFF 6,47,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
OPTFFF 6,48,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c> OPTFFF 6,48,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
OPTFFF 6,49,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c> OPTFFF 6,49,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
OPTFFF 6,50,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c> OPTFFF 6,50,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
OPTFFF 6,51,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c> OPTFFF 6,51,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
OPTFFF 6,52,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c> OPTFFF 6,52,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
OPTFFF 6,53,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c> OPTFFF 6,53,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
OPTFFF 6,54,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c> OPTFFF 6,54,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
OPTFFF 6,55,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c> OPTFFF 6,55,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
OPTFFF 6,56,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c> OPTFFF 6,56,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
OPTFFF 6,57,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c> OPTFFF 6,57,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
OPTFFF 6,58,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c> OPTFFF 6,58,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
OPTFFF 7,59,1,1,0,0,0,0,<..\..\net\lwip\src\core\dhcp.c><dhcp.c> OPTFFF 6,59,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
OPTFFF 7,60,1,0,0,0,0,0,<..\..\net\lwip\src\core\dns.c><dns.c> OPTFFF 7,60,1,1,0,0,0,0,<..\..\net\lwip\src\core\dhcp.c><dhcp.c>
OPTFFF 7,61,1,0,0,0,0,0,<..\..\net\lwip\src\core\init.c><init.c> OPTFFF 7,61,1,0,0,0,0,0,<..\..\net\lwip\src\core\dns.c><dns.c>
OPTFFF 7,62,1,0,0,0,0,0,<..\..\net\lwip\src\core\netif.c><netif.c> OPTFFF 7,62,1,0,0,247,247,0,<..\..\net\lwip\src\core\init.c><init.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,139,2,0,0,42,1,0,0 }
OPTFFF 7,63,1,0,0,0,0,0,<..\..\net\lwip\src\core\pbuf.c><pbuf.c> OPTFFF 7,63,1,0,0,0,0,0,<..\..\net\lwip\src\core\netif.c><netif.c>
OPTFFF 7,64,1,0,0,0,0,0,<..\..\net\lwip\src\core\raw.c><raw.c> OPTFFF 7,64,1,0,0,0,0,0,<..\..\net\lwip\src\core\pbuf.c><pbuf.c>
OPTFFF 7,65,1,0,0,0,0,0,<..\..\net\lwip\src\core\stats.c><stats.c> OPTFFF 7,65,1,0,0,0,0,0,<..\..\net\lwip\src\core\raw.c><raw.c>
OPTFFF 7,66,1,0,0,0,0,0,<..\..\net\lwip\src\core\sys.c><sys.c> OPTFFF 7,66,1,0,0,0,0,0,<..\..\net\lwip\src\core\stats.c><stats.c>
OPTFFF 7,67,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp.c><tcp.c> OPTFFF 7,67,1,0,0,0,0,0,<..\..\net\lwip\src\core\sys.c><sys.c>
OPTFFF 7,68,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_in.c><tcp_in.c> OPTFFF 7,68,1,0,0,381,381,0,<..\..\net\lwip\src\core\tcp.c><tcp.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,88,0,0,0,116,0,0,0,227,2,0,0,158,1,0,0 }
OPTFFF 7,69,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_out.c><tcp_out.c> OPTFFF 7,69,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_in.c><tcp_in.c>
OPTFFF 7,70,1,0,0,0,0,0,<..\..\net\lwip\src\core\udp.c><udp.c> OPTFFF 7,70,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_out.c><tcp_out.c>
OPTFFF 7,71,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\autoip.c><autoip.c> OPTFFF 7,71,1,0,0,0,0,0,<..\..\net\lwip\src\core\udp.c><udp.c>
OPTFFF 7,72,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\icmp.c><icmp.c> OPTFFF 7,72,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\autoip.c><autoip.c>
OPTFFF 7,73,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\igmp.c><igmp.c> OPTFFF 7,73,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\icmp.c><icmp.c>
OPTFFF 7,74,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet.c><inet.c> OPTFFF 7,74,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\igmp.c><igmp.c>
OPTFFF 7,75,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c> OPTFFF 7,75,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet.c><inet.c>
OPTFFF 7,76,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip.c><ip.c> OPTFFF 7,76,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
OPTFFF 7,77,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c> OPTFFF 7,77,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip.c><ip.c>
OPTFFF 7,78,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c> OPTFFF 7,78,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
OPTFFF 7,79,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_in.c><msg_in.c> OPTFFF 7,79,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
OPTFFF 7,80,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_out.c><msg_out.c> OPTFFF 7,80,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_in.c><msg_in.c>
OPTFFF 7,81,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_lib.c><api_lib.c> OPTFFF 7,81,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_out.c><msg_out.c>
OPTFFF 7,82,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_msg.c><api_msg.c> OPTFFF 7,82,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_lib.c><api_lib.c>
OPTFFF 7,83,1,0,0,0,0,0,<..\..\net\lwip\src\api\err.c><err.c> OPTFFF 7,83,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_msg.c><api_msg.c>
OPTFFF 7,84,1,0,0,0,0,0,<..\..\net\lwip\src\api\netbuf.c><netbuf.c> OPTFFF 7,84,1,0,0,0,0,0,<..\..\net\lwip\src\api\err.c><err.c>
OPTFFF 7,85,1,0,0,0,0,0,<..\..\net\lwip\src\api\netdb.c><netdb.c> OPTFFF 7,85,1,0,0,0,0,0,<..\..\net\lwip\src\api\netbuf.c><netbuf.c>
OPTFFF 7,86,1,0,0,0,0,0,<..\..\net\lwip\src\api\netifapi.c><netifapi.c> OPTFFF 7,86,1,0,0,0,0,0,<..\..\net\lwip\src\api\netdb.c><netdb.c>
OPTFFF 7,87,1,0,0,0,0,0,<..\..\net\lwip\src\api\tcpip.c><tcpip.c> OPTFFF 7,87,1,0,0,0,0,0,<..\..\net\lwip\src\api\netifapi.c><netifapi.c>
OPTFFF 7,88,1,0,0,0,0,0,<..\..\net\lwip\src\netif\etharp.c><etharp.c> OPTFFF 7,88,1,1,0,0,0,0,<..\..\net\lwip\src\api\tcpip.c><tcpip.c>
OPTFFF 7,89,1,0,0,0,0,0,<..\..\net\lwip\src\netif\ethernetif.c><ethernetif.c> OPTFFF 7,89,1,0,0,0,0,0,<..\..\net\lwip\src\netif\etharp.c><etharp.c>
OPTFFF 7,90,1,0,0,0,0,0,<..\..\net\lwip\src\netif\loopif.c><loopif.c> OPTFFF 7,90,1,0,0,0,0,0,<..\..\net\lwip\src\netif\ethernetif.c><ethernetif.c>
OPTFFF 7,91,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c> OPTFFF 7,91,1,0,0,0,0,0,<..\..\net\lwip\src\netif\loopif.c><loopif.c>
OPTFFF 7,92,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c> OPTFFF 7,92,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
OPTFFF 7,93,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c><sockets.c> OPTFFF 7,93,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c>
OPTFFF 7,94,1,0,0,0,0,0,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c> OPTFFF 7,94,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c><sockets.c>
OPTFFF 8,95,1,0,0,0,0,0,<..\..\net\apps\chargen.c><chargen.c> OPTFFF 7,95,1,0,0,0,0,0,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c>
OPTFFF 8,96,1,0,0,0,0,0,<..\..\net\apps\ftpd.c><ftpd.c> OPTFFF 8,96,1,0,0,0,0,0,<..\..\net\apps\chargen.c><chargen.c>
OPTFFF 8,97,1,0,0,0,0,0,<..\..\net\apps\sntp.c><sntp.c> OPTFFF 8,97,1,671088640,0,1,14,0,<..\..\net\apps\ftpd.c><ftpd.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,183,2,0,0,100,1,0,0 }
OPTFFF 8,98,1,0,0,0,0,0,<..\..\net\apps\tcpecho.c><tcpecho.c> OPTFFF 8,98,1,0,0,0,0,0,<..\..\net\apps\sntp.c><sntp.c>
OPTFFF 8,99,1,486539264,0,0,0,0,<..\..\net\apps\tftp.c><tftp.c> OPTFFF 8,99,1,0,0,46,46,0,<..\..\net\apps\tcpecho.c><tcpecho.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 8,100,1,0,0,0,0,0,<..\..\net\apps\udpecho.c><udpecho.c> OPTFFF 8,100,1,486539264,0,0,0,0,<..\..\net\apps\tftp.c><tftp.c>
OPTFFF 8,101,1,0,0,0,0,0,<..\..\net\apps\udpecho.c><udpecho.c>
OPTFFF 8,102,1,0,0,0,0,0,<..\..\net\apps\tcpclient.c><tcpclient.c>
OPTFFF 8,103,1,0,0,0,0,0,<..\..\net\apps\tcpserver.c><tcpserver.c>
OPTFFF 8,104,1,0,0,0,0,0,<..\..\net\apps\udpclient.c><udpclient.c>
OPTFFF 8,105,1,0,0,0,0,0,<..\..\net\apps\udpserver.c><udpserver.c>
OPTFFF 8,106,1,369098754,0,1,16,0,<..\..\net\apps\netio.c><netio.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,183,2,0,0,100,1,0,0 }
ExtF <E:\SVN-Google-Source\net\apps\ping.c> 153,153,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,88,0,0,0,116,0,0,0,227,2,0,0,158,1,0,0 }
ExtF <E:\SVN-Google-Source\src\kservice.h> 80,84,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,170,2,0,0,36,1,0,0 }
ExtF <E:\SVN-Google-Source\net\lwip\src\lwipopts.h> 13,13,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,139,2,0,0,42,1,0,0 }
TARGOPT 1, (RT-Thread/LM3S) TARGOPT 1, (RT-Thread/LM3S)
ADSCLK=6000000 ADSCLK=6000000
......
...@@ -18,6 +18,7 @@ File 1,1,<.\startup.c><startup.c> ...@@ -18,6 +18,7 @@ File 1,1,<.\startup.c><startup.c>
File 1,5,<.\rtconfig.h><rtconfig.h> File 1,5,<.\rtconfig.h><rtconfig.h>
File 1,1,<.\sdcard.c><sdcard.c> File 1,1,<.\sdcard.c><sdcard.c>
File 1,1,<.\luminaryif.c><luminaryif.c> File 1,1,<.\luminaryif.c><luminaryif.c>
File 1,5,<.\board.h><board.h>
File 2,1,<..\..\src\clock.c><clock.c> File 2,1,<..\..\src\clock.c><clock.c>
File 2,1,<..\..\src\device.c><device.c> File 2,1,<..\..\src\device.c><device.c>
File 2,1,<..\..\src\idle.c><idle.c> File 2,1,<..\..\src\idle.c><idle.c>
...@@ -112,6 +113,11 @@ File 8,1,<..\..\net\apps\sntp.c><sntp.c> ...@@ -112,6 +113,11 @@ File 8,1,<..\..\net\apps\sntp.c><sntp.c>
File 8,1,<..\..\net\apps\tcpecho.c><tcpecho.c> File 8,1,<..\..\net\apps\tcpecho.c><tcpecho.c>
File 8,1,<..\..\net\apps\tftp.c><tftp.c> File 8,1,<..\..\net\apps\tftp.c><tftp.c>
File 8,1,<..\..\net\apps\udpecho.c><udpecho.c> File 8,1,<..\..\net\apps\udpecho.c><udpecho.c>
File 8,1,<..\..\net\apps\tcpclient.c><tcpclient.c>
File 8,1,<..\..\net\apps\tcpserver.c><tcpserver.c>
File 8,1,<..\..\net\apps\udpclient.c><udpclient.c>
File 8,1,<..\..\net\apps\udpserver.c><udpserver.c>
File 8,1,<..\..\net\apps\netio.c><netio.c>
Options 1,0,0 // Target 'RT-Thread/LM3S' Options 1,0,0 // Target 'RT-Thread/LM3S'
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
#define RT_LWIP_ETH_PAD_SIZE 2 #define RT_LWIP_ETH_PAD_SIZE 2
/* TCP sender buffer space*/ /* TCP sender buffer space*/
#define RT_LWIP_TCP_SND_BUF 2048 #define RT_LWIP_TCP_SND_BUF 1024*8
/* Enable SNMP protocol*/ /* Enable SNMP protocol*/
/* #define RT_LWIP_SNMP */ /* #define RT_LWIP_SNMP */
......
...@@ -21,7 +21,7 @@ CPU='lm3s' ...@@ -21,7 +21,7 @@ CPU='lm3s'
#EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin' #EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
PLATFORM = 'armcc' PLATFORM = 'armcc'
EXEC_PATH = 'E:/Keil' EXEC_PATH = 'E:/Keil'
BUILD = 'debug' BUILD = 'release'
if PLATFORM == 'gcc': if PLATFORM == 'gcc':
# toolchains # toolchains
......
...@@ -65,7 +65,7 @@ __heap_limit ...@@ -65,7 +65,7 @@ __heap_limit
IMPORT rt_hw_pend_sv IMPORT rt_hw_pend_sv
IMPORT rt_hw_timer_handler IMPORT rt_hw_timer_handler
IMPORT rt_hw_uart_isr_1 IMPORT rt_hw_uart_isr_1
IMPORT luminaryif_isr IMPORT rt_hw_eth_handler
IMPORT rt_hw_hard_fault IMPORT rt_hw_hard_fault
;****************************************************************************** ;******************************************************************************
...@@ -148,7 +148,7 @@ __Vectors ...@@ -148,7 +148,7 @@ __Vectors
DCD IntDefaultHandler ; CAN0 DCD IntDefaultHandler ; CAN0
DCD IntDefaultHandler ; CAN1 DCD IntDefaultHandler ; CAN1
DCD IntDefaultHandler ; CAN2 DCD IntDefaultHandler ; CAN2
DCD luminaryif_isr ; Ethernet DCD rt_hw_eth_handler ; Ethernet
DCD IntDefaultHandler ; Hibernate DCD IntDefaultHandler ; Hibernate
DCD IntDefaultHandler ; USB0 DCD IntDefaultHandler ; USB0
DCD IntDefaultHandler ; PWM Generator 3 DCD IntDefaultHandler ; PWM Generator 3
......
/**
* @file
* MetIO Server
*
*/
/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/
#include "lwip/opt.h"
#if LWIP_TCP
#include "lwip/tcp.h"
/*
* This implements a netio server.
* The client sends a command word (4 bytes) then a data length word (4 bytes).
* If the command is "receive", the server is to consume "data length" bytes into
* a circular buffer until the first byte is non-zero, then it is to consume
* another command/data pair.
* If the command is "send", the server is to send "data length" bytes from a circular
* buffer with the first byte being zero, until "some time" (6 seconds in the
* current netio126.zip download) has passed and then send one final buffer with
* the first byte being non-zero. Then it is to consume another command/data pair.
*/
/* See http://www.nwlab.net/art/netio/netio.html to get the netio tool */
/* implementation options */
#define NETIO_BUF_SIZE (4 * 1024)
#define NETIO_USE_STATIC_BUF 0
/* NetIO server state definition */
#define NETIO_STATE_WAIT_FOR_CMD 0
#define NETIO_STATE_RECV_DATA 1
#define NETIO_STATE_SEND_DATA 2
#define NETIO_STATE_SEND_DATA_LAST 3
#define NETIO_STATE_DONE 4
struct netio_state {
u32_t state;
u32_t cmd;
u32_t data_len;
u32_t cntr;
u8_t * buf_ptr;
u32_t buf_pos;
u32_t first_byte;
u32_t time_stamp;
};
/* NetIO command protocol definition */
#define NETIO_CMD_QUIT 0
#define NETIO_CMD_C2S 1
#define NETIO_CMD_S2C 2
#define NETIO_CMD_RES 3
static err_t netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err);
static void
netio_close(void *arg, struct tcp_pcb *pcb)
{
err_t err;
struct netio_state *ns = arg;
ns->state = NETIO_STATE_DONE;
tcp_recv(pcb, NULL);
err = tcp_close(pcb);
if (err != ERR_OK) {
/* closing failed, try again later */
tcp_recv(pcb, netio_recv);
} else {
/* closing succeeded */
#if NETIO_USE_STATIC_BUF != 1
if(ns->buf_ptr != NULL){
mem_free(ns->buf_ptr);
}
#endif
tcp_arg(pcb, NULL);
tcp_poll(pcb, NULL, 0);
tcp_sent(pcb, NULL);
if (arg != NULL) {
mem_free(arg);
}
}
}
static err_t
netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
struct netio_state *ns = arg;
u8_t * data_ptr;
u32_t data_cntr;
struct pbuf *q = p;
u16_t len;
if (p != NULL) {
tcp_recved(pcb, p->tot_len);
}
if (err == ERR_OK && q != NULL) {
while (q != NULL) {
data_cntr = q->len;
data_ptr = q->payload;
while (data_cntr--) {
if (ns->state == NETIO_STATE_DONE){
netio_close(ns, pcb);
break;
} else if (ns->state == NETIO_STATE_WAIT_FOR_CMD) {
if (ns->cntr < 4) {
/* build up the CMD field */
ns->cmd <<= 8;
ns->cmd |= *data_ptr++;
ns->cntr++;
} else if (ns->cntr < 8) {
/* build up the DATA field */
ns->data_len <<= 8;
ns->data_len |= *data_ptr++;
ns->cntr++;
if (ns->cntr == 8) {
/* now we have full command and data words */
ns->cntr = 0;
ns->buf_pos = 0;
ns->buf_ptr[0] = 0;
if (ns->cmd == NETIO_CMD_C2S) {
ns->state = NETIO_STATE_RECV_DATA;
} else if (ns->cmd == NETIO_CMD_S2C) {
ns->state = NETIO_STATE_SEND_DATA;
/* start timer */
ns->time_stamp = rt_tick_get();
/* send first round of data */
len = tcp_sndbuf(pcb);
len = LWIP_MIN(len, ns->data_len - ns->cntr);
len = LWIP_MIN(len, NETIO_BUF_SIZE - ns->buf_pos);
do {
err = tcp_write(pcb, ns->buf_ptr + ns->buf_pos, len, TCP_WRITE_FLAG_COPY);
if (err == ERR_MEM) {
len /= 2;
}
} while ((err == ERR_MEM) && (len > 1));
ns->buf_pos += len;
ns->cntr += len;
} else {
/* unrecognized command, punt */
ns->cntr = 0;
ns->buf_pos = 0;
ns->buf_ptr[0] = 0;
netio_close(ns, pcb);
break;
}
}
} else {
/* in trouble... shouldn't be in this state! */
}
} else if (ns->state == NETIO_STATE_RECV_DATA) {
if(ns->cntr == 0){
/* save the first byte of this new round of data
* this will not match ns->buf_ptr[0] in the case that
* NETIO_BUF_SIZE is less than ns->data_len.
*/
ns->first_byte = *data_ptr;
}
ns->buf_ptr[ns->buf_pos++] = *data_ptr++;
ns->cntr++;
if (ns->buf_pos == NETIO_BUF_SIZE) {
/* circularize the buffer */
ns->buf_pos = 0;
}
if(ns->cntr == ns->data_len){
ns->cntr = 0;
if (ns->first_byte != 0) {
/* if this last round did not start with 0,
* go look for another command */
ns->state = NETIO_STATE_WAIT_FOR_CMD;
ns->data_len = 0;
ns->cmd = 0;
/* TODO LWIP_DEBUGF( print out some throughput calculation results... ); */
} else {
/* stay here and wait on more data */
}
}
} else if (ns->state == NETIO_STATE_SEND_DATA
|| ns->state == NETIO_STATE_SEND_DATA_LAST) {
/* I don't think this should happen... */
} else {
/* done / quit */
netio_close(ns, pcb);
break;
} /* end of ns->state condition */
} /* end of while data still in this pbuf */
q = q->next;
}
pbuf_free(p);
} else {
/* error or closed by other side */
if (p != NULL) {
pbuf_free(p);
}
/* close the connection */
netio_close(ns, pcb);
}
return ERR_OK;
}
static err_t
netio_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
{
struct netio_state *ns = arg;
err_t err = ERR_OK;
if (ns->cntr >= ns->data_len && ns->state == NETIO_STATE_SEND_DATA) {
/* done with this round of sending */
ns->buf_pos = 0;
ns->cntr = 0;
/* check if timer expired */
if (rt_tick_get() - ns->time_stamp > 600) {
ns->buf_ptr[0] = 1;
ns->state = NETIO_STATE_SEND_DATA_LAST;
} else {
ns->buf_ptr[0] = 0;
}
}
if(ns->state == NETIO_STATE_SEND_DATA_LAST || ns->state == NETIO_STATE_SEND_DATA){
len = tcp_sndbuf(pcb);
len = LWIP_MIN(len, ns->data_len - ns->cntr);
len = LWIP_MIN(len, NETIO_BUF_SIZE - ns->buf_pos);
if(ns->cntr < ns->data_len){
do {
err = tcp_write(pcb, ns->buf_ptr + ns->buf_pos, len, TCP_WRITE_FLAG_COPY);
if (err == ERR_MEM) {
len /= 2;
}
} while ((err == ERR_MEM) && (len > 1));
ns->buf_pos += len;
if(ns->buf_pos >= NETIO_BUF_SIZE){
ns->buf_pos = 0;
}
ns->cntr += len;
}
}
if(ns->cntr >= ns->data_len && ns->state == NETIO_STATE_SEND_DATA_LAST){
/* we have buffered up all our data to send this last round, go look for a command */
ns->state = NETIO_STATE_WAIT_FOR_CMD;
ns->cntr = 0;
/* TODO LWIP_DEBUGF( print out some throughput calculation results... ); */
}
return ERR_OK;
}
static err_t
netio_poll(void *arg, struct tcp_pcb *pcb)
{
struct netio_state * ns = arg;
if(ns->state == NETIO_STATE_SEND_DATA){
} else if(ns->state == NETIO_STATE_DONE){
netio_close(ns, pcb);
}
return ERR_OK;
}
#if NETIO_USE_STATIC_BUF == 1
static u8_t netio_buf[NETIO_BUF_SIZE];
#endif
static err_t
netio_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
struct netio_state * ns;
LWIP_UNUSED_ARG(err);
ns = mem_malloc(sizeof(struct netio_state));
if(ns == NULL){
return ERR_MEM;
}
ns->state = NETIO_STATE_WAIT_FOR_CMD;
ns->data_len = 0;
ns->cmd = 0;
ns->cntr = 0;
ns->buf_pos = 0;
#if NETIO_USE_STATIC_BUF == 1
ns->buf_ptr = netio_buf;
#else
ns->buf_ptr = mem_malloc(NETIO_BUF_SIZE);
if(ns->buf_ptr == NULL){
mem_free(ns);
return ERR_MEM;
}
#endif
ns->buf_ptr[0] = 0;
tcp_arg(pcb, ns);
tcp_sent(pcb, netio_sent);
tcp_recv(pcb, netio_recv);
tcp_poll(pcb, netio_poll, 4); /* every 2 seconds */
return ERR_OK;
}
void netio_init(void)
{
struct tcp_pcb *pcb;
pcb = tcp_new();
tcp_bind(pcb, IP_ADDR_ANY, 18767);
pcb = tcp_listen(pcb);
tcp_accept(pcb, netio_accept);
}
#endif /* LWIP_TCP */
#ifdef RT_USING_FINSH
#include <finsh.h>
FINSH_FUNCTION_EXPORT(netio_init, netio server);
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册