OSDN Git Service

(none)
[hos/hos-v4a.git] / aplfw / sample / sh / cq7144a / sample.c
1 /**
2  *  Sample program for Hyper Operating System V4 Advance
3  *
4  * @file  sample.c
5  * @brief %jp{サンプルプログラム}%en{Sample program}
6  *
7  * Copyright (C) 1998-2006 by Project HOS
8  * http://sourceforge.jp/projects/hos/
9  */
10
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <string.h>
15 #include "kernel.h"
16 #include "kernel_id.h"
17 #include "system/system/system.h"
18 #include "system/sysapi/sysapi.h"
19 #include "system/file/console.h"
20 #include "system/process/process.h"
21 #include "system/command/command.h"
22 #include "system/shell/shell.h"
23 #include "driver/serial/renesas/scidrv.h"
24 #include "driver/console/vt100/vt100drv.h"
25 #include "application/example/hello/hello.h"
26 #include "application/filecmd/filelist/filelist.h"
27 #include "application/utility/memdump/memdump.h"
28 #include "application/utility/memwrite/memwrite.h"
29 #include "application/utility/memtest/memtest.h"
30 #include "application/utility/keytest/keytest.h"
31 #include "regs_sh7144.h"
32
33
34 C_SCIDRV        g_SciDrv[4];
35 C_VT100DRV      g_Vt100Drv[1];
36
37
38
39 void Sample_Task(VP_INT exinf)
40 {
41         HANDLE                  hTty;
42         HANDLE                  hCon;
43         
44         
45         /*************************/
46         /*    固有初期設定       */
47         /*************************/
48         
49         *REG_STANDBY_MSTCR1 &= ~0x0002; /* %jp{SCI1のスタンバイモードを解除} */
50         *REG_PFC_PACRL2 |= 0x0100;              /* %jp{端子設定} */
51         
52         *REG_INTC_IPRF = ((*REG_INTC_IPRF & 0xfff0) | 0x0001);
53         
54         /*************************/
55         /*       初期化          *
56         /*************************/
57         
58         /* システム初期化 */
59         System_Initialize((void *)0x00440000, 0x40000);
60         
61         
62         /*************************/
63         /*   デバイスドライバ    */
64         /*************************/
65         
66         /* SCIデバドラ生成 */
67         SciDrv_Create(&g_SciDrv[0], (void *)REG_SCI0_SMR, 128, 24000000L, 64);  /* SCI0 */
68         SciDrv_Create(&g_SciDrv[1], (void *)REG_SCI1_SMR, 132, 24000000L, 64);  /* SCI1 */
69         SciDrv_Create(&g_SciDrv[2], (void *)REG_SCI2_SMR, 168, 24000000L, 64);  /* SCI2 */
70         SciDrv_Create(&g_SciDrv[3], (void *)REG_SCI3_SMR, 172, 24000000L, 64);  /* SCI3 */
71         
72         File_AddDevice("com0", (C_DRVOBJ *)&g_SciDrv[0]);       /* SCI0 を /dev/com0 に登録 */
73         File_AddDevice("com1", (C_DRVOBJ *)&g_SciDrv[1]);       /* SCI1 を /dev/com0 に登録 */
74         File_AddDevice("com2", (C_DRVOBJ *)&g_SciDrv[2]);       /* SCI2 を /dev/com0 に登録 */
75         File_AddDevice("com3", (C_DRVOBJ *)&g_SciDrv[3]);       /* SCI3 を /dev/com0 に登録 */
76         
77         /* シリアルを開く */
78         hTty = File_Open("/dev/com1", FILE_OPEN_READ | FILE_OPEN_WRITE);
79         
80         /* シリアル上にコンソールを生成( /dev/con0 に登録) */
81         Vt100Drv_Create(&g_Vt100Drv[0], hTty);
82         File_AddDevice("con1", (C_DRVOBJ *)&g_Vt100Drv[0]);
83         
84         /* コンソールを開く */
85         hCon = File_Open("/dev/con1", FILE_OPEN_READ | FILE_OPEN_WRITE);
86         
87         
88         /*************************/
89         /*     コマンド登録      */
90         /*************************/
91         Command_AddCommand("hsh",      Shell_Main);
92         Command_AddCommand("hello",    Hello_Main);
93         Command_AddCommand("ls",       FileList_Main);
94         Command_AddCommand("memdump",  MemDump_Main);
95         Command_AddCommand("memwrite", MemWrite_Main);
96         Command_AddCommand("memtest",  MemTest_Main);
97         Command_AddCommand("keytest",  KeyTest_Main);
98         
99         
100         /*************************/
101         /*  システムプロセス起動 */
102         /*************************/
103         System_Boot(hTty, hCon, "hsh", 4096);
104 }
105
106
107
108 /* end of file */