2 * Hyper Operating System Application Framework Library
3 * μTeaboard/ARM7-AT91 用サンプルプログラム
6 * @brief %jp{サンプルプログラム}%en{Sample program}
8 * Copyright (C) 1998-2007 by Project HOS
9 * http://sourceforge.jp/projects/hos/
17 #include "kernel_id.h"
18 #include "system/system/system.h"
19 #include "system/sysapi/sysapi.h"
20 #include "system/file/console.h"
21 #include "system/process/process.h"
22 #include "system/command/command.h"
23 /* #include "driver/ether/lan9118/lan9118drv.h" */
24 #include "driver/tcpip/ipether/ipether.h"
25 #include "driver/tcpip/tcpip/tcpip.h"
26 #include "driver/serial/at91/at91usartdrv.h"
27 #include "driver/console/vt100/vt100drv.h"
28 #include "driver/volume/fat/fatvol.h"
29 #include "application/syscmd/shell/shell.h"
30 #include "application/flashcmd/norflashcmd/norflashcmd.h"
31 #include "application/utility/memdump/memdump.h"
32 #include "application/utility/memwrite/memwrite.h"
33 #include "application/utility/memtest/memtest.h"
34 #include "application/utility/keytest/keytest.h"
35 #include "application/utility/timecmd/timecmd.h"
36 #include "application/netcmd/ethersnoop/ethersnoop.h"
37 #include "application/example/hello/hello.h"
42 long g_SystemHeap[32 * 1024 / sizeof(long)];
46 static const T_IPETHER_INF IpEtherInf =
48 {192, 168, 0, 100}, /* IPアドレス */
49 {255, 255, 255, 0}, /* サブネットマスク */
50 {192, 168, 0, 1}, /* デフォルトゲートウェイアドレス */
54 int Boot_Process(VPARAM Param);
57 void Boot_Task(VP_INT exinf)
59 T_SYSTEM_INITIALIZE_INF SysInf;
62 /*************************/
64 /*************************/
68 /*************************/
70 /*************************/
73 memset(&SysInf, 0, sizeof(SysInf));
74 SysInf.pSysMemBase = g_SystemHeap;
75 SysInf.SysMemSize = sizeof(g_SystemHeap);
76 SysInf.SysMemAlign = 4;
77 SysInf.pIoMemBase = NULL;
78 SysInf.SystemStackSize = 1024;
79 SysInf.pfncBoot = Boot_Process;
80 SysInf.BootParam = (VPARAM)0;
81 SysInf.BootStackSize = 4096;
82 System_Initialize(&SysInf);
87 int Boot_Process(VPARAM Param)
97 /*************************/
99 /*************************/
102 /* LAN9118デバドラ生成 (/dev/eth0 に登録) */
103 Lan9118Drv_Create(&g_Lan9118Drv[0], (void *)0x40000000, 24);
104 File_AddDevice("eth0", (C_DRVOBJ *)&g_Lan9118Drv[0]);
106 /* Ether上にIP層構築 (/dev/ip0 に登録) */
107 IpEther_Create(&g_IpEther[0], "/dev/eth0", &IpEtherInf);
108 File_AddDevice("ip0", (C_DRVOBJ *)&g_IpEther[0]);
110 /* IP層の上にTCP/IP層構築 (/dev/tcpip0 に登録) */
111 TcpIp_Create(&g_TcpIp[0], "/dev/ip0");
112 File_AddDevice("tcpip0", (C_DRVOBJ *)&g_TcpIp[0]);
115 /* AT91 USARTデバドラ生成 (/dev/com0 に登録) */
116 hDriver = At91UsartDrv_Create((void *)0xfffc0000, 2, 32000000, 64);
117 File_AddDevice("com0", hDriver);
119 /* AT91 USARTデバドラ生成 (/dev/com1 に登録) */
120 hDriver = At91UsartDrv_Create((void *)0xfffc4000, 3, 32000000, 64);
121 File_AddDevice("com1", hDriver);
123 /* AT91 USARTデバドラ生成 (/dev/com2 に登録) */
124 hDriver = At91UsartDrv_Create((void *)0xfffc8000, 4, 32000000, 64);
125 File_AddDevice("com2", hDriver);
128 hTty = File_Open("/dev/com0", FILE_OPEN_READ | FILE_OPEN_WRITE);
130 /* シリアル上にコンソールを生成(/dev/con0 に登録) */
131 hDriver = Vt100Drv_Create(hTty);
132 File_AddDevice("con0", hDriver);
135 hCon = File_Open("/dev/con0", FILE_OPEN_READ | FILE_OPEN_WRITE);
138 /*************************/
140 /*************************/
142 Process_SetTerminal(HANDLE_NULL, hTty);
143 Process_SetConIn(HANDLE_NULL, hCon);
144 Process_SetConOut(HANDLE_NULL, hCon);
145 Process_SetStdIn(HANDLE_NULL, hCon);
146 Process_SetStdOut(HANDLE_NULL, hCon);
147 Process_SetStdErr(HANDLE_NULL, hCon);
150 /*************************/
152 /*************************/
154 Command_AddCommand("hsh", Shell_Main);
155 Command_AddCommand("hello", Hello_Main);
156 Command_AddCommand("memdump", MemDump_Main);
157 Command_AddCommand("memwrite", MemWrite_Main);
158 Command_AddCommand("memtest", MemTest_Main);
159 Command_AddCommand("keytest", KeyTest_Main);
160 Command_AddCommand("time", TimeCmd_Main);
161 Command_AddCommand("norflash", NorFlashCmd_Main);
162 Command_AddCommand("ethsnoop", EtherSnoop_Main);
167 "================================================================\n"
168 " Hyper Operating System Application Framework\n"
170 " Copyright (C) 1998-2007 by Project HOS\n"
171 " http://sourceforge.jp/projects/hos/\n"
172 "================================================================\n"
175 /*************************/
177 /*************************/
179 Command_Execute("hsh -i", NULL);