2 * Sample program for Hyper Operating System V4 Advance
5 * @brief %jp{サンプルプログラム}%en{Sample program}
7 * Copyright (C) 1998-2006 by Project HOS
8 * http://sourceforge.jp/projects/hos/
16 #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 "system/shell/shell.h"
24 #include "driver/serial/renesas/scidrv.h"
25 #include "driver/console/vt100/vt100drv.h"
26 #include "application/example/hello/hello.h"
27 #include "application/filecmd/filelist/filelist.h"
28 #include "application/utility/memdump/memdump.h"
29 #include "application/utility/memwrite/memwrite.h"
30 #include "application/utility/memtest/memtest.h"
31 #include "application/utility/keytest/keytest.h"
33 #include "regs_sh7144.h"
35 int Boot_Process(VPARAM Param);
39 void Boot_Task(VP_INT exinf)
41 T_SYSTEM_INITIALIZE_INF SysInf;
43 /*************************/
45 /*************************/
47 *REG_STANDBY_MSTCR1 &= ~0x0002; /* %jp{SCI1のスタンバイモードを解除} */
48 *REG_PFC_PACRL2 |= 0x0100; /* %jp{端子設定} */
50 *REG_INTC_IPRF = ((*REG_INTC_IPRF & 0xfff0) | 0x0001);
53 /*************************/
55 /*************************/
58 SysInf.pHeapMem = (void *)0x00440000;
59 SysInf.HeapSize = 0x40000;
60 SysInf.SystemStackSize = 1024;
61 SysInf.pfncBoot = Boot_Process;
62 SysInf.BootParam = (VPARAM)0;
63 SysInf.BootStackSize = 4096;
64 System_Initialize(&SysInf);
69 int Boot_Process(VPARAM Param)
76 /*************************/
78 /*************************/
81 hDriver = SciDrv_Create((void *)REG_SCI0_SMR, 128, 24000000L, 64); /* SCI0生成 */
82 File_AddDevice("com0", hDriver); /* /dev/com0 に登録 */
84 hDriver = SciDrv_Create((void *)REG_SCI1_SMR, 132, 24000000L, 64); /* SCI1生成 */
85 File_AddDevice("com1", hDriver); /* /dev/com1 に登録 */
87 hDriver = SciDrv_Create((void *)REG_SCI2_SMR, 168, 24000000L, 64); /* SCI2生成 */
88 File_AddDevice("com2", hDriver); /* /dev/com2 に登録 */
90 hDriver = SciDrv_Create((void *)REG_SCI3_SMR, 172, 24000000L, 64); /* SCI3生成 */
91 File_AddDevice("com3", hDriver); /* /dev/com3 に登録 */
94 hTty = File_Open("/dev/com1", FILE_OPEN_READ | FILE_OPEN_WRITE);
96 /* シリアル上にコンソールを生成( /dev/con1 に登録) */
97 hDriver = Vt100Drv_Create(hTty);
98 File_AddDevice("con1", hDriver);
101 hCon = File_Open("/dev/con1", FILE_OPEN_READ | FILE_OPEN_WRITE);
104 /*************************/
106 /*************************/
108 Process_SetTerminal(HANDLE_NULL, hTty);
109 Process_SetConsole(HANDLE_NULL, hCon);
110 Process_SetStdIn(HANDLE_NULL, hCon);
111 Process_SetStdOut(HANDLE_NULL, hCon);
112 Process_SetStdErr(HANDLE_NULL, hCon);
115 /*************************/
117 /*************************/
118 Command_AddCommand("hsh", Shell_Main);
119 Command_AddCommand("hello", Hello_Main);
120 Command_AddCommand("ls", FileList_Main);
121 Command_AddCommand("memdump", MemDump_Main);
122 Command_AddCommand("memwrite", MemWrite_Main);
123 Command_AddCommand("memtest", MemTest_Main);
124 Command_AddCommand("keytest", KeyTest_Main);
130 "================================================================\n"
131 " Hyper Operating System Application Flamework\n"
133 " Copyright (C) 1998-2007 by Project HOS\n"
134 " http://sourceforge.jp/projects/hos/\n"
135 "================================================================\n"
138 /*************************/
140 /*************************/
142 Command_Execute("hsh -i", NULL);