• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

マイクロカーネル、プリエンプティブマルチタスクを目指しているOSです。


Commit MetaInfo

Révisionf823880a02b3896ebbfcd35d1db339b83851cace (tree)
l'heure2014-10-18 22:31:03
Auteurvosystems <doradora.motochan@gmai...>
Commitervosystems

Message de Log

Add NewFiles

Change Summary

Modification

Binary files /dev/null and b/BIN_HISTORY/2014.10.18.vsb differ
--- /dev/null
+++ b/Kernel/task.c
@@ -0,0 +1,237 @@
1+/*
2+*Multi Task management system source
3+*(C) 2014 VOSystems.
4+*/
5+
6+#include<VaneOS.h>
7+#include<task.h>
8+#include<Message.h>
9+#include<timer.h>
10+#include<memory.h>
11+
12+struct TASKCTL *taskctl;
13+struct TIMER *task_timer;
14+
15+struct TASK *task_now(void);
16+void task_add(struct TASK *task);
17+void task_remove(struct TASK *task);
18+void task_switchsub(void);
19+void task_idle(void);
20+struct TASK *task_init(struct MEMMAN *memman);
21+struct TASK* task_alloc(void);
22+void task_run(struct TASK *task, int level, int priority);
23+void task_sleep(struct TASK *task);
24+void task_switch(void);
25+
26+void set_segmdesc(SEGMENT_DESCRIPTOR *sd, unsigned int limit, int base, int ar)
27+{
28+ if (limit > 0xfffff) {
29+ ar |= 0x8000; /* G_bit = 1 */
30+ limit /= 0x1000;
31+ }
32+ sd->limitLo = limit & 0xffff;
33+ sd->baseLo = base & 0xffff;
34+ sd->baseMid = (base >> 16) & 0xff;
35+ //sd->access_right = ar & 0xff;
36+ //sd->limitHi = ((limit >> 16) & 0x0f) | ((ar >> 8) & 0xf0);
37+ sd->baseHi = (base >> 24) & 0xff;
38+ return;
39+}
40+
41+
42+struct TASK *task_now(void)
43+{
44+ struct TASKLEVEL *tl = &taskctl->level[taskctl->now_lv];
45+ return tl->tasks[tl->now];
46+}
47+
48+void task_add(struct TASK *task)
49+{
50+ struct TASKLEVEL *tl = &taskctl->level[task->level];
51+ tl->tasks[tl->running] = task;
52+ tl->running++;
53+ task->flags = 2; /* “®ì’† */
54+ return;
55+}
56+
57+void task_remove(struct TASK *task)
58+{
59+ int i;
60+ struct TASKLEVEL *tl = &taskctl->level[task->level];
61+
62+ /* task‚ª‚Ç‚±‚É‚¢‚é‚©‚ð’T‚· */
63+ for (i = 0; i < tl->running; i++) {
64+ if (tl->tasks[i] == task) {
65+ /* ‚±‚±‚É‚¢‚œ */
66+ break;
67+ }
68+ }
69+
70+ tl->running--;
71+ if (i < tl->now) {
72+ tl->now--; /* ‚ž‚ê‚é‚̂ŁA‚±‚ê‚à‚ ‚킹‚Ä‚š‚­ */
73+ }
74+ if (tl->now >= tl->running) {
75+ /* now‚ª‚š‚©‚µ‚È’l‚É‚È‚Á‚Ä‚¢‚œ‚çAC³‚·‚é */
76+ tl->now = 0;
77+ }
78+ task->flags = 1; /* ƒXƒŠ[ƒv’† */
79+
80+ /* ‚ž‚炵 */
81+ for (; i < tl->running; i++) {
82+ tl->tasks[i] = tl->tasks[i + 1];
83+ }
84+
85+ return;
86+}
87+
88+void task_switchsub(void)
89+{
90+ int i;
91+ /* ˆê”ԏã‚̃Œƒxƒ‹‚ð’T‚· */
92+ for (i = 0; i < MAX_TASKLEVELS; i++) {
93+ if (taskctl->level[i].running > 0) {
94+ break; /* Œ©‚‚©‚Á‚œ */
95+ }
96+ }
97+ taskctl->now_lv = i;
98+ taskctl->lv_change = 0;
99+ return;
100+}
101+
102+void task_idle(void)
103+{
104+ for (;;) {
105+ io_hlt();
106+ }
107+}
108+
109+struct TASK *task_init(struct MEMMAN *memman)
110+{
111+ int i;
112+ struct TASK *task, *idle;
113+ SEGMENT_DESCRIPTOR *gdt = (SEGMENT_DESCRIPTOR *) ADR_GDT;
114+
115+ taskctl = (struct TASKCTL *) memman_alloc_4k(memman, sizeof (struct TASKCTL));
116+ for (i = 0; i < MAX_TASKS; i++) {
117+ taskctl->tasks0[i].flags = 0;
118+ taskctl->tasks0[i].sel = (TASK_GDT0 + i) * 8;
119+ taskctl->tasks0[i].tss.ldtr = (TASK_GDT0 + MAX_TASKS + i) * 8;
120+ set_segmdesc(gdt + TASK_GDT0 + i, 103, (int) &taskctl->tasks0[i].tss, AR_TSS32);
121+ set_segmdesc(gdt + TASK_GDT0 + MAX_TASKS + i, 15, (int) taskctl->tasks0[i].ldt, AR_LDT);
122+ }
123+ for (i = 0; i < MAX_TASKLEVELS; i++) {
124+ taskctl->level[i].running = 0;
125+ taskctl->level[i].now = 0;
126+ }
127+
128+ task = task_alloc();
129+ task->flags = 2; /* “®ì’†ƒ}[ƒN */
130+ task->priority = 2; /* 0.02•b */
131+ task->level = 0; /* Å‚ƒŒƒxƒ‹ */
132+ task_add(task);
133+ task_switchsub(); /* ƒŒƒxƒ‹Ý’è */
134+ load_tr(task->sel);
135+ task_timer = timer_alloc();
136+ timer_settime(task_timer, task->priority);
137+
138+ idle = task_alloc();
139+ idle->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024;
140+ idle->tss.eip = (int) &task_idle;
141+ idle->tss.es = 1 * 8;
142+ idle->tss.cs = 2 * 8;
143+ idle->tss.ss = 1 * 8;
144+ idle->tss.ds = 1 * 8;
145+ idle->tss.fs = 1 * 8;
146+ idle->tss.gs = 1 * 8;
147+ task_run(idle, MAX_TASKLEVELS - 1, 1);
148+
149+ return task;
150+}
151+
152+struct TASK* task_alloc(void)
153+{
154+ int i;
155+ struct TASK *task;
156+ for (i = 0; i < MAX_TASKS; i++) {
157+ if (taskctl->tasks0[i].flags == 0) {
158+ task = &taskctl->tasks0[i];
159+ task->flags = 1; /* Žg—p’†ƒ}[ƒN */
160+ task->tss.eflags = 0x00000202; /* IF = 1; */
161+ task->tss.eax = 0; /* ‚Æ‚è‚ ‚Š‚ž0‚É‚µ‚Ä‚š‚­‚±‚Æ‚É‚·‚é */
162+ task->tss.ecx = 0;
163+ task->tss.edx = 0;
164+ task->tss.ebx = 0;
165+ task->tss.ebp = 0;
166+ task->tss.esi = 0;
167+ task->tss.edi = 0;
168+ task->tss.es = 0;
169+ task->tss.ds = 0;
170+ task->tss.fs = 0;
171+ task->tss.gs = 0;
172+ task->tss.iomap = 0x40000000;
173+ task->tss.ss0 = 0;
174+ return task;
175+ }
176+ }
177+ return 0; /* ‚à‚€‘S•”Žg—p’† */
178+}
179+
180+void task_run(struct TASK *task, int level, int priority)
181+{
182+ if (level < 0) {
183+ level = task->level; /* ƒŒƒxƒ‹‚ð•ÏX‚µ‚È‚¢ */
184+ }
185+ if (priority > 0) {
186+ task->priority = priority;
187+ }
188+
189+ if (task->flags == 2 && task->level != level) { /* “®ì’†‚̃Œƒxƒ‹‚̕ύX */
190+ task_remove(task); /* ‚±‚ê‚ðŽÀs‚·‚é‚Æflags‚Í1‚É‚È‚é‚̂ʼnº‚Ìif‚àŽÀs‚³‚ê‚é */
191+ }
192+ if (task->flags != 2) {
193+ /* ƒXƒŠ[ƒv‚©‚ç‹N‚±‚³‚ê‚éê‡ */
194+ task->level = level;
195+ task_add(task);
196+ }
197+
198+ taskctl->lv_change = 1; /* ŽŸ‰ñƒ^ƒXƒNƒXƒCƒbƒ`‚Ì‚Æ‚«‚ɃŒƒxƒ‹‚ðŒ©’Œ‚· */
199+ return;
200+}
201+
202+void task_sleep(struct TASK *task)
203+{
204+ struct TASK *now_task;
205+ if (task->flags == 2) {
206+ /* “®ì’†‚Ÿ‚Á‚œ‚ç */
207+ now_task = task_now();
208+ task_remove(task); /* ‚±‚ê‚ðŽÀs‚·‚é‚Æflags‚Í1‚É‚È‚é */
209+ if (task == now_task) {
210+ /* Ž©•ªŽ©g‚̃XƒŠ[ƒv‚Ÿ‚Á‚œ‚̂ŁAƒ^ƒXƒNƒXƒCƒbƒ`‚ª•K—v */
211+ task_switchsub();
212+ now_task = task_now(); /* Ý’èŒã‚ł́AuŒ»Ý‚̃^ƒXƒNv‚ð‹³‚Š‚Ä‚à‚ç‚€ */
213+ farjmp(0, now_task->sel);
214+ }
215+ }
216+ return;
217+}
218+
219+void task_switch(void)
220+{
221+ struct TASKLEVEL *tl = &taskctl->level[taskctl->now_lv];
222+ struct TASK *new_task, *now_task = tl->tasks[tl->now];
223+ tl->now++;
224+ if (tl->now == tl->running) {
225+ tl->now = 0;
226+ }
227+ if (taskctl->lv_change != 0) {
228+ task_switchsub();
229+ tl = &taskctl->level[taskctl->now_lv];
230+ }
231+ new_task = tl->tasks[tl->now];
232+ timer_settime(task_timer, new_task->priority);
233+ if (new_task != now_task) {
234+ farjmp(0, new_task->sel);
235+ }
236+ return;
237+}
--- /dev/null
+++ b/Kernel/timer.c
@@ -0,0 +1,54 @@
1+/*
2+*Timer main source
3+*(C) 2014 VOSystems.
4+*/
5+#include<stdio.h>
6+#include<timer.h>
7+
8+timer_mgr timer;
9+
10+void settimer(unsigned int timeout,struct msg* msg,unsigned char data)
11+{
12+ int i;
13+ io_cli();
14+ for(i=0;timer.timers[i]->timeout==0;i++);
15+ timer.timers[i-1]->timeout=timeout;
16+ timer.timers[i-1]->msg=msg;
17+ timer.timers[i-1]->data=data;
18+ io_sti();
19+ return;
20+}
21+
22+struct timer* timer_alloc(void)
23+{
24+ int i;
25+ for(i=0;i<MAX_TIMER;i++)
26+ {
27+ if(timer.timers[i]->flags==0)
28+ {
29+ timer.timers[i]->flags=TIMER_FLAGS_ALLOC;
30+ return &timer.timers[i];
31+ }
32+ }
33+ return NULL;
34+}
35+
36+inline void timer_free(struct timer* timer)
37+{
38+ timer->flags=0;
39+ return;
40+}
41+
42+inline void timer_init(struct timer* timer,struct msg_data* fifo,unsigned char data)
43+{
44+ timer->msg=fifo;
45+ timer->data=data;
46+ return;
47+}
48+
49+inline void timer_settime(struct timer* timer,unsigned int timeout,int data)
50+{
51+ timer->timeout=timeout;
52+ timer->data=data;
53+ return;
54+}
Binary files /dev/null and b/bin/Kernel.vsb differ
--- /dev/null
+++ b/include/GDT_IDT.h~
@@ -0,0 +1,162 @@
1+#ifndef _GDT_IDT_VANE_
2+#define _GDT_IDT_VANE_
3+
4+void setupInterruptGate( int int_num, void *interrupt_handler );
5+void setupGateDescriptor( int int_num,int base,unsigned short selector,unsigned char flags );
6+void load_gdt(void);
7+void load_idt(void);
8+
9+
10+/*GDT Segment Descriptor*/
11+typedef struct
12+{
13+ unsigned short limitLo;
14+ unsigned short baseLo;
15+ unsigned char baseMid;
16+ unsigned short flags;
17+ unsigned char baseHi;
18+} __attribute__ ((packed)) SEGMENT_DESCRIPTOR;
19+
20+
21+typedef struct
22+{
23+ unsigned short size;
24+ SEGMENT_DESCRIPTOR* base;
25+} __attribute__ ((packed)) GDTR;
26+
27+/*IDT*/
28+typedef struct
29+{
30+ unsigned short baseLo;
31+ unsigned short selector;
32+ unsigned char reserved;
33+ unsigned char flags;
34+ unsigned short baseHi;
35+} __attribute__ ((packed)) GATE_DESCRIPTOR;
36+
37+typedef struct
38+{
39+ unsigned short size;
40+ GATE_DESCRIPTOR* base;
41+} __attribute__ ((packed)) IDTR;
42+
43+/*EXTERN*/
44+extern IDTR idtr;
45+extern GATE_DESCRIPTOR idt[ NUM_IDT ];
46+extern SEGMENT_DESCRIPTOR gdt[ NUM_GDT ];
47+extern GDTR gdtr;
48+
49+/*DEFINES*/
50+/*IDT*/
51+
52+#define NUM_IDT 256
53+
54+#define DEF_IDT_FLAGS_INTGATE_16BIT 0x06
55+#define DEF_IDT_FLAGS_TSKGATE 0x05
56+#define DEF_IDT_FLAGS_CALL_GATE 0x0C
57+#define DEF_IDT_FLAGS_INTGATE_32BIT 0x0E
58+#define DEF_IDT_FLAGS_TRPGATE 0x0F
59+#define DEF_IDT_FLAGS_DPL_LV0 0x00
60+#define DEF_IDT_FLAGS_DPL_LV1 0x20
61+#define DEF_IDT_FLAGS_DPL_LV2 0x40
62+#define DEF_IDT_FLAGS_DPL_LV3 0x60
63+#define DEF_IDT_FLAGS_PRESENT 0x80
64+
65+#define DEF_IDT_INT_NUM_IRQ1 33
66+#define DEF_IDT_INT_NUM_IRQ0 32
67+#define DEF_IDT_INT_NUM_SYSC 0x30
68+#define DEF_IDT_INT_NUM_V86I 0x31
69+#define DEF_IDT_INT_NUM_V86O 0x32
70+
71+#define DEF_IDT_INT_SELECTOR 0x08
72+
73+/*GDT*/
74+#define NUM_GDT 3
75+#define NULL_DESCRIPTOR 0
76+#define CODE_DESCRIPTOR 1
77+#define DATA_DESCRIPTOR 2
78+#define TEMP_DESCRIPTOR 3
79+#define TASK_CODE_DESCRIPTOR 3
80+#define TASK_DATA_DESCRIPTOR 4
81+#define KTSS_DESCRIPTOR 5
82+
83+/* Null Descriptor */
84+#define DEF_GDT_NULL_LIMIT 0x0000
85+#define DEF_GDT_NULL_BASELO 0x0000
86+#define DEF_GDT_NULL_BASEMID 0x00
87+#define DEF_GDT_NULL_FLAGS 0x0000
88+#define DEF_GDT_NULL_BASEHI 0x00
89+
90+/* Code Descriptor */
91+#define DEF_GDT_CODE_LIMIT 0xFFFF
92+#define DEF_GDT_CODE_BASELO 0x0000
93+#define DEF_GDT_CODE_BASEMID 0x00
94+#define DEF_GDT_CODE_FLAGS_BL 0x9A
95+#define DEF_GDT_CODE_FLAGS_BH 0xCF
96+#define DEF_GDT_CODE_FLAGS 0xCF9A
97+#define DEF_GDT_CODE_BASEHI 0x00
98+
99+/* Data Descriptor */
100+#define DEF_GDT_DATA_LIMIT 0xFFFF
101+#define DEF_GDT_DATA_BASELO 0x0000
102+#define DEF_GDT_DATA_BASEMID 0x00
103+#define DEF_GDT_DATA_FLAGS 0xCF92
104+#define DEF_GDT_DATA_FLAGS_BL 0x92
105+#define DEF_GDT_DATA_FLAGS_BH 0xCF
106+#define DEF_GDT_DATA_BASEHI 0x00
107+
108+/*PIC*/
109+#define PORT_MASTER_PIC_COMMAND 0x0020
110+#define PORT_MASTER_PIC_STATUS 0x0020
111+#define PORT_MASTER_PIC_DATA 0x0021
112+#define PORT_MASTER_PIC_IMR 0x0021
113+#define PORT_SLAVE_PIC_COMMAND 0x00A0
114+#define PORT_SLAVE_PIC_STATUS 0x00A0
115+#define PORT_SLAVE_PIC_DATA 0x00A1
116+#define PORT_SLAVE_PIC_IMR 0x00A1
117+#define PIC_ICW1 0x11
118+#define PIC_MASTER_ICW2 0x20
119+#define PIC_SLAVE_ICW2 0x28
120+#define PIC_MASTER_ICW3 0x04
121+#define PIC_SLAVE_ICW3 0x02
122+#define PIC_MASTER_ICW4 0x01
123+#define PIC_SLAVE_ICW4 0x01
124+
125+/*IRQ*/
126+#define PIC_IMR_MASK_IRQ0 0x01
127+#define PIC_IMR_MASK_IRQ1 0x02
128+#define PIC_IMR_MASK_IRQ2 0x04
129+#define PIC_IMR_MASK_IRQ3 0x08
130+#define PIC_IMR_MASK_IRQ4 0x10
131+#define PIC_IMR_MASK_IRQ5 0x20
132+#define PIC_IMR_MASK_IRQ6 0x40
133+#define PIC_IMR_MASK_IRQ7 0x80
134+#define PIC_IMR_MASK_IRQ_ALL 0xFF
135+
136+/*PIT*/
137+#define PIT_REG_COUNTER0 0x0040
138+#define PIT_REG_COUNTER1 0x0041
139+#define PIT_REG_COUNTER2 0x0042
140+#define PIT_REG_CONTROL 0x0043
141+#define DEF_PIT_CLOCK 1193181.67
142+#define DEF_PIT_COM_MASK_BINCOUNT 0x01
143+#define DEF_PIT_COM_MASK_MODE 0x0E
144+#define DEF_PIT_COM_MASK_RL 0x30
145+#define DEF_PIT_COM_MASK_COUNTER 0xC0
146+#define DEF_PIT_COM_BINCOUNT_BIN 0x00
147+#define DEF_PIT_COM_BINCOUNT_BCD 0x01
148+#define DEF_PIT_COM_MODE_TERMINAL 0x00
149+#define DEF_PIT_COM_MODE_PROGONE 0x02
150+#define DEF_PIT_COM_MODE_RATEGEN 0x04
151+#define DEF_PIT_COM_MODE_SQUAREWAVE 0x06
152+#define DEF_PIT_COM_MODE_SOFTTRIG 0x08
153+#define DEF_PIT_COM_MODE_HARDTRIG 0x0A
154+#define DEF_PIT_COM_RL_LATCH 0x00
155+#define DEF_PIT_COM_RL_LSBONLY 0x10
156+#define DEF_PIT_COM_RL_MSBONLY 0x20
157+#define DEF_PIT_COM_RL_DATA 0x30
158+#define DEF_PIT_COM_COUNTER0 0x00
159+#define DEF_PIT_COM_COUNTER1 0x40
160+#define DEF_PIT_COM_COUNTER2 0x80
161+
162+#endif
--- /dev/null
+++ b/include/KeyBoard.h~
@@ -0,0 +1,187 @@
1+/*!
2+ KeyBoard.h
3+ Keyboard type load header
4+ (C) 2014 VOSystems.
5+*/
6+
7+#ifndef _KEYBOARD_H_VANE_
8+#define _KEYBOARD_H_VANE_
9+
10+/*Typedef*/
11+typedef struct
12+{
13+ int caps_on;
14+ int alt_on;
15+ int shift_on;
16+ int ctrl_on;
17+ int numlock_on;
18+ int scrolllock_on;
19+ int insert_on;
20+} KEY_STATE;
21+typedef int STATUS;
22+typedef enum
23+{
24+ E_KBD_NONE_LED = 0x00000000,
25+ E_KBD_SCROLL_LOCK_LED = 0x00000001,
26+ E_KBD_NUM_LOCK_LED = 0x00000002,
27+ E_KBD_CAPS_LOCK_LED = 0x00000004
28+} E_KBD_LED;
29+
30+/*Extern*/
31+extern int keyboard_disable;
32+extern unsigned char scan_code;
33+extern int system_key_code_flag,break_flag;
34+extern unsigned long long input;
35+
36+/*PROTOTYPE*/
37+void outPortByte( unsigned short address, unsigned char value );
38+unsigned char inPortByte( unsigned short address );
39+unsigned char readKbdCtrlStatus(void);
40+STATUS writeKbdCtrlCommand(unsigned char command);
41+unsigned char readKbdEncBuffer(void);
42+STATUS writeKbdEncCommand(unsigned char command);
43+STATUS keyboardSetLED( E_KBD_LED led );
44+STATUS keyboardSelfTest( void );
45+STATUS waitKbdOutputBufferFull( void );
46+STATUS keyboardDisableKBD( void );
47+STATUS keyboardEnableKBD( void );
48+STATUS initKeyboard( void );
49+char Generate_Scancode_To_ASCII_Code(void);
50+
51+/*DESCRIPTION KEYBOARD ENCODE*/
52+#define DEF_PORT_KBD_ENCODER 0x0060
53+#define DEF_PORT_KBD_ENC_BUFFER DEF_PORT_KBD_ENCODER
54+#define DEF_PORT_KBD_ENC_COMMAND DEF_PORT_KBD_ENCODER
55+
56+/*DESCRIPTION KEYBOARD CONTROLER*/
57+#define DEF_PORT_KBD_CONTROLLER 0x0064
58+#define DEF_PORT_KBD_CTRL_STATUS DEF_PORT_KBD_CONTROLLER
59+#define DEF_PORT_KBD_CTRL_COMMAND DEF_PORT_KBD_CONTROLLER
60+
61+/*DEFINE STATUS REGISTOR*/
62+#define DEF_KBD_STS_OBF 0x01
63+#define DEF_KBD_STS_IBF 0x02
64+#define DEF_KBD_STS_F0 0x04
65+#define DEF_KBD_STS_F1 0x08
66+#define DEF_KBD_STS_ST4 0x10
67+#define DEF_KBD_STS_ST5 0x20
68+#define DEF_KBD_STS_ST6 0x40
69+#define DEF_KBD_STS_ST7 0x80
70+
71+/*Key Board Status*/
72+#define DEF_KBD_OK 0
73+#define DEF_KBD_ERROR (-1)
74+#define MAX_RETRY 0x01000000
75+
76+/*Key Board Status*/
77+#define DEF_KBD_ENC_COM_SETLED 0xED
78+#define DEF_KBD_ENC_COM_ECHO 0xEE
79+#define DEF_KBD_ENC_COM_GETSET_SCANCODE 0xF0
80+#define DEF_KBD_ENC_COM_GET_KBD_ID 0xF2
81+#define DEF_KBD_ENC_COM_SET_TYPEMATIC 0xF3
82+#define DEF_KBD_ENC_COM_ENABLE_KBD 0xF4
83+#define DEF_KBD_ENC_COM_DISABLE_KBD 0xF5
84+#define DEF_KBD_ENC_COM_SET_DEFAULT 0xF6
85+#define DEF_KBD_ENC_COM_SET_ALL_REPEAT 0xF7
86+#define DEF_KBD_ENC_COM_SET_ALL_BREAK 0xF8
87+#define DEF_KBD_ENC_COM_CLEAR_ALL_REP_BRK 0xF9
88+#define DEF_KBD_ENC_COM_SET_ALL_REP_BRK 0xFA
89+#define DEF_KBD_ENC_COM_SET_REPEAT 0xFB
90+#define DEF_KBD_ENC_COM_SET_BREAK 0xFC
91+#define DEF_KBD_ENC_COM_CLEAR_REP_BRK 0xFD
92+#define DEF_KBD_ENC_COM_REQ_RESEND 0xFE
93+#define DEF_KBD_ENC_COM_RESET_SELFTEST 0xFF
94+
95+/* Standard Commands */
96+#define DEF_KBD_CTRL_COM_READ_CCB 0x20
97+#define DEF_KBD_CTRL_COM_WRITE_CCB 0x60
98+#define DEF_KBD_CTRL_COM_DISABLE_MOUSE 0xA7
99+#define DEF_KBD_CTRL_COM_ENABLE_MOUSE 0xA8
100+#define DEF_KBD_CTRL_COM_TEST_MOUSE 0xA9
101+#define DEF_KBD_CTRL_COM_SELF_TEST 0xAA
102+#define DEF_KBD_CTRL_COM_TEST_IF 0xAB
103+#define DEF_KBD_CTRL_COM_DISABLE_KBD 0xAD
104+#define DEF_KBD_CTRL_COM_ENABLE_KBD 0xAE
105+#define DEF_KBD_CTRL_COM_READ_IN_PORT 0xC0
106+#define DEF_KBD_CTRL_COM_READ_OUT_PORT 0xD0
107+#define DEF_KBD_CTRL_COM_WRITE_OUT_PORT 0xD1
108+#define DEF_KBD_CTRL_COM_WRITE_MOUSE 0xD4
109+#define DEF_KBD_CTRL_COM_READ_TEST_PORT 0xE0
110+#define DEF_KBD_CTRL_COM_SYSTEM_RESET 0xFE
111+
112+/* Vendo-Specific Commands */
113+#define DEF_KBD_CTRL_COM_READ_RAM_0x20 0x20
114+#define DEF_KBD_CTRL_COM_READ_RAM_0x21 0x21
115+#define DEF_KBD_CTRL_COM_READ_RAM_0x22 0x22
116+#define DEF_KBD_CTRL_COM_READ_RAM_0x23 0x23
117+#define DEF_KBD_CTRL_COM_READ_RAM_0x24 0x24
118+#define DEF_KBD_CTRL_COM_READ_RAM_0x25 0x25
119+#define DEF_KBD_CTRL_COM_READ_RAM_0x26 0x26
120+#define DEF_KBD_CTRL_COM_READ_RAM_0x27 0x27
121+#define DEF_KBD_CTRL_COM_READ_RAM_0x28 0x28
122+#define DEF_KBD_CTRL_COM_READ_RAM_0x29 0x29
123+#define DEF_KBD_CTRL_COM_READ_RAM_0x2A 0x2A
124+#define DEF_KBD_CTRL_COM_READ_RAM_0x2B 0x2B
125+#define DEF_KBD_CTRL_COM_READ_RAM_0x2C 0x2C
126+#define DEF_KBD_CTRL_COM_READ_RAM_0x2D 0x2D
127+#define DEF_KBD_CTRL_COM_READ_RAM_0x2E 0x2E
128+#define DEF_KBD_CTRL_COM_READ_RAM_0x2F 0x2F
129+#define DEF_KBD_CTRL_COM_READ_RAM_0x30 0x30
130+#define DEF_KBD_CTRL_COM_READ_RAM_0x31 0x31
131+#define DEF_KBD_CTRL_COM_READ_RAM_0x32 0x32
132+#define DEF_KBD_CTRL_COM_READ_RAM_0x33 0x33
133+#define DEF_KBD_CTRL_COM_READ_RAM_0x34 0x34
134+#define DEF_KBD_CTRL_COM_READ_RAM_0x35 0x35
135+#define DEF_KBD_CTRL_COM_READ_RAM_0x36 0x36
136+#define DEF_KBD_CTRL_COM_READ_RAM_0x37 0x37
137+#define DEF_KBD_CTRL_COM_READ_RAM_0x38 0x38
138+#define DEF_KBD_CTRL_COM_READ_RAM_0x39 0x39
139+#define DEF_KBD_CTRL_COM_READ_RAM_0x3A 0x3A
140+#define DEF_KBD_CTRL_COM_READ_RAM_0x3B 0x3B
141+#define DEF_KBD_CTRL_COM_READ_RAM_0x3C 0x3C
142+#define DEF_KBD_CTRL_COM_READ_RAM_0x3D 0x3D
143+#define DEF_KBD_CTRL_COM_READ_RAM_0x3E 0x3E
144+#define DEF_KBD_CTRL_COM_READ_RAM_0x3F 0x3F
145+
146+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x60 0x60
147+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x61 0x61
148+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x62 0x62
149+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x63 0x36
150+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x64 0x46
151+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x65 0x56
152+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x66 0x66
153+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x67 0x67
154+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x68 0x68
155+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x69 0x69
156+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6A 0x6A
157+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6B 0x6B
158+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6C 0x6C
159+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6D 0x6D
160+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6E 0x6E
161+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6F 0x6F
162+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x70 0x70
163+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x71 0x71
164+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x72 0x72
165+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x73 0x73
166+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x74 0x74
167+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x75 0x75
168+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x76 0x76
169+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x77 0x77
170+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x78 0x78
171+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x79 0x79
172+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7A 0x7A
173+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7B 0x7B
174+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7C 0x7C
175+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7D 0x7D
176+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7E 0x7E
177+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7F 0x7F
178+
179+/*Self Status Command*/
180+#define DEF_KBD_CTRL_STS_SELF_TEST_OK 0x55
181+#define DEF_KBD_CTRL_STS_SELF_TEST_NG 0xFC
182+
183+
184+
185+
186+
187+#endif
--- /dev/null
+++ b/include/Message.h
@@ -0,0 +1,17 @@
1+/*
2+*Messaging Service Header
3+*(C) 2014 VOSystems.
4+*/
5+#ifndef _MSG_H_VANE_
6+#define _MSG_H_VANE_
7+
8+extern int buf_separate_keyboard;
9+
10+struct msg_data
11+{
12+ int *buf;
13+ int w,r,size,free,flags;
14+};
15+#define FLAGS_OVERRUN 0x0001
16+
17+#endif
--- /dev/null
+++ b/include/Message.h~
@@ -0,0 +1,17 @@
1+/*
2+*Messaging Service Header
3+*(C) 2014 VOSystems.
4+*/
5+#ifndef _MSG_H_VANE_
6+#define _MSG_H_VANE_
7+
8+extern int buf_separate_keyboard;
9+
10+struct msg_data
11+{
12+ int *buf;
13+ int w,r,size,free,flags;
14+};
15+#define FLAGS_OVERRUN 0x0001
16+
17+#endif
--- /dev/null
+++ b/include/scancode.h~
@@ -0,0 +1,256 @@
1+/*
2+
3+*/
4+
5+#ifndef _SCANCODE_H_VANE_
6+#define _SCANCODE_H_VANE_
7+
8+char Generate_Scancode_To_ASCII_Code(void);
9+
10+extern struct msg_data keyboard;
11+extern int keybuf[32];
12+
13+/*Flag Code*/
14+#define BREAK_FLAG 0xf0
15+#define SPECIAL_FLAG 0xe0
16+
17+#define BREAK_NORMAL(make_code) (make_code + 0x80)
18+/*Common*/
19+#define SC_A 0x1e
20+#define SC_B 0x30
21+#define SC_C 0x2e
22+#define SC_D 0x20
23+#define SC_E 0x12
24+#define SC_F 0x21
25+#define SC_G 0x22
26+#define SC_H 0x23
27+#define SC_I 0x17
28+#define SC_J 0x24
29+#define SC_K 0x25
30+#define SC_L 0x26
31+#define SC_M 0x32
32+#define SC_N 0x31
33+#define SC_O 0x18
34+#define SC_P 0x19
35+#define SC_Q 0x10
36+#define SC_R 0x13
37+#define SC_S 0x1f
38+#define SC_T 0x14
39+#define SC_U 0x16
40+#define SC_V 0x2f
41+#define SC_W 0x11
42+#define SC_X 0x2d
43+#define SC_Y 0x15
44+#define SC_Z 0x15
45+
46+#define SC_0 0x0b
47+#define SC_1 0x02
48+#define SC_2 0x03
49+#define SC_3 0x04
50+#define SC_4 0x05
51+#define SC_5 0x06
52+#define SC_6 0x07
53+#define SC_7 0x08
54+#define SC_8 0x09
55+#define SC_9 0x0a
56+
57+#define SC_ZEN_HAN_KAKU 0x29
58+#define SC_ECOAL 0x0c
59+#define SC_TILDA 0x0d
60+#define SC_YEN 0x7d
61+#define SC_GAUS_RIGHT 0x2b
62+#define SC_BS 0x0e
63+#define SC_SP 0x39
64+#define SC_TB 0xof
65+#define SC_CAPS 0x3a
66+#define SC_LEFT_SHIFT 0x2a
67+#define SC_LEFT_CTRL 0x1d
68+#define SC_LEFT_ALT 0x38
69+#define SC_RIGHT_SHIFT 0x36
70+
71+#define SC_ENTER 0x1c
72+#define SC_ESC 0x01
73+
74+#define SC_F1 0x3b
75+#define SC_F2 0x3c
76+#define SC_F3 0x3d
77+#define SC_F4 0x3e
78+#define SC_F5 0x3f
79+#define SC_F6 0x40
80+#define SC_F7 0x41
81+#define SC_F8 0x42
82+#define SC_F9 0x43
83+#define SC_F10 0x44
84+#define SC_F11 0x57
85+#define SC_F12 0x58
86+
87+#define SC_SCR 0x46
88+#define SC_AT_MARK 0x9a
89+
90+#define SC_NUM_LOCK 0x45
91+#define SC_NUM_KEY_AST 0x37
92+#define SC_NUM_KEY_MINUS 0x4a
93+#define SC_NUM_KEY_PLUS 0x79
94+#define SC_NUM_KEY_PIRIOD 0x53
95+#define SC_NUM_KEY_0 0x52
96+#define SC_NUM_KEY_1 0x4f
97+#define SC_NUM_KEY_2 0x50
98+#define SC_NUM_KEY_3 0x51
99+#define SC_NUM_KEY_4 0x4b
100+#define SC_NUM_KEY_5 0x4c
101+#define SC_NUM_KEY_6 0x4d
102+#define SC_NUM_KEY_7 0x47
103+#define SC_NUM_KEY_8 0x48
104+#define SC_NUM_KEY_9 0x49
105+
106+#define SC_GAUS_LEFT 0x1b
107+#define SC_SEMI_COLON 0x27
108+#define SC_COMMA 0x28
109+#define SC_PILIOD 0x33
110+#define SC_SLASH 0x34
111+#define SC_MUHENNKANN 0x35
112+#define SC_HENNKANN 0x7b
113+#define SC_KATAKANA_HIRAGANA 0x79
114+
115+
116+/*Break*/
117+#define BREAK_LEFT_WIN 0xe0f01f
118+#define BREAK_RIGHT_CTRL 0xe0f014
119+#define BREAK_RIGHT_WIN 0xe0f027
120+#define BREAK_RIGHT_ALT 0xe0f011
121+#define BREAK_APP 0xe0f02f
122+
123+#define BREAK_PRISC 0xe0f012e0f07c
124+#define BREAK_PAUSE 0xe1f01477e1f0f014f077
125+#define BREAK_INSERT 0xe0f070
126+#define BREAK_HOME 0xe0f06c
127+#define BREAK_PAGE_UP 0xe0f07d
128+#define BREAK_DEL 0xe0f071
129+#define BREAK_END 0xe0f075
130+#define BREAK_PAGE_DOWN 0xe0f07a
131+#define BREAK_ARROW_UP 0xe0f075
132+#define BREAK_ARROW_LEFT 0xe0f06b
133+#define BREAK_ARROW_DOWN 0xe0f072
134+#define BREAK_ARROW_RIGHT 0xe0f074
135+
136+#define BREAK_NUM_LOCK_AND_INS 0xe0f070e0f012
137+#define BREAK_NUM_LOCK_AND_HOME 0xe0f006e0f012
138+#define BREAK_NUM_LOCK_AND_PAGE_UP 0xe0f07de0f012
139+#define BREAK_NUM_LOCK_AND_DEL 0xe0f071e0f012
140+#define BREAK_NUM_LOCK_AND_END 0xe0f069e0f012
141+#define BREAK_NUM_LOCK_AND_PAGE_DOWN 0xe0f07ae0f012
142+#define BREAK_NUM_LOCK_AND_ARROW_UP 0xe0f075e0f012
143+#define BREAK_NUM_LOCK_AND_ARROW_LEFT 0xe0f06be0f012
144+#define BREAK_NUM_LOCK_AND_ARROW_DOWN 0xe0f072e0f012
145+#define BREAK_NUM_LOCK_AND_ARROW_RIGHT 0xe0f074e0f012
146+
147+#define BREAK_LEFT_SHIFT_AND_INS 0xe0f070e012
148+#define BREAK_LEFT_SHIFT_AND_HOME 0xe0f06ce012
149+#define BREAK_LEFT_SHIFT_AND_PAGE_UP 0xe0f07de012
150+#define BREAK_LEFT_SHIFT_AND_DEL 0xe0f071e012
151+#define BREAK_LEFT_SHIFT_AND_END 0xe0f069e012
152+#define BREAK_LEFT_SHIFT_AND_PAGE_DOWN 0xe0f07ae012
153+#define BREAK_LEFT_SHIFT_AND_ARROW_UP 0xe0f075e012
154+#define BREAK_LEFT_SHIFT_AND_ARROW_LEFT 0xe0f06be012
155+#define BREAK_LEFT_SHIFT_AND_ARROW_DOWN 0xe0f072e012
156+#define BREAK_LEFT_SHIFT_AND_ARROW_RIGHT 0xe0f074e012
157+
158+#define BREAK_RIGHT_SHIFT_AND_INS 0xe0f070e059
159+#define BREAK_RIGHT_SHIFT_AND_HOME 0xe0f06ce059
160+#define BREAK_RIGHT_SHIFT_AND_PAGE_UP 0xe0f07de059
161+#define BREAK_RIGHT_SHIFT_AND_DEL 0xe0f071e059
162+#define BREAK_RIGHT_SHIFT_AND_END 0xe0f069e059
163+#define BREAK_RIGHT_SHIFT_AND_PAGE_DOWN 0xe0f07ae059
164+#define BREAK_RIGHT_SHIFT_AND_ARROW_UP 0xe0f075e059
165+#define BREAK_RIGHT_SHIFT_AND_ARROW_LEFT 0xe0f06be059
166+#define BREAK_RIGHT_SHIFT_AND_ARROW_DOWN 0xe0f072e059
167+#define BREAK_RIGHT_SHIFT_AND_ARROW_RIGHT 0xe0f074e059
168+
169+#define BREAK_LR_SHIFT_AND_INS 0xe0f070e059e012
170+#define BREAK_LR_SHIFT_AND_HOME 0xe0f06ce059e012
171+#define BREAK_LR_SHIFT_AND_PAGE_UP 0xe0f07de059e012
172+#define BREAK_LR_SHIFT_AND_DEL 0xe0f071e059e012
173+#define BREAK_LR_SHIFT_AND_END 0xe0f069e059e012
174+#define BREAK_LR_SHIFT_AND_PAGE_DOWN 0xe0f07ae059e012
175+#define BREAK_LR_SHIFT_AND_ARROW_UP 0xe0f075e059e012
176+#define BREAK_LR_SHIFT_AND_ARROW_LEFT 0xe0f06be059e012
177+#define BREAK_LR_SHIFT_AND_ARROW_DOWN 0xe0f072e059e012
178+#define BREAK_LR_SHIFT_AND_ARROW_RIGHT 0xe0f074e059e012
179+
180+#define BREAK_NUM_KEY_SLASH 0xe0f04a
181+#define BREAK_NUM_KEY_LEFT_SHIFT_AND_SLASH 0xe0f04ae012
182+#define BREAK_NUM_KEY_RIGHT_SHIFT_AND_SLASH 0xe0f04ae059
183+#define BREAK_NUM_KEY_LR_SHIFT_AND_SLASH 0xe0f04ae059e012
184+
185+
186+/*Make*/
187+#define MAKE_RIGHT_CTRL 0xe014
188+#define MAKE_RIGHT_WIN 0xe027
189+#define MAKE_RIGHT_ALT 0xe011
190+#define MAKE_APP 0xe02f
191+
192+#define MAKE_LEFT_WIN 0xe01f
193+#define MAKE_PRISC 0xe012e07c
194+#define MAKE_PAUSE 0xe11477e1f014f077
195+#define MAKE_INSERT 0xe070
196+#define MAKE_HOME 0xe06c
197+#define MAKE_PAGE_UP 0xe07d
198+#define MAKE_DEL 0xe071
199+#define MAKE_END 0xe075
200+#define MAKE_PAGE_DOWN 0xe07a
201+#define MAKE_ARROW_UP 0xe075
202+#define MAKE_ARROW_LEFT 0xe06b
203+#define MAKE_ARROW_DOWN 0xe072
204+#define MAKE_ARROW_RIGHT 0xe074
205+
206+#define MAKE_NUM_LOCK_AND_INS 0xe012e070
207+#define MAKE_NUM_LOCK_AND_HOME 0xe012e06c
208+#define MAKE_NUM_LOCK_AND_PAGE_UP 0xe012e07d
209+#define MAKE_NUM_LOCK_AND_DEL 0xe012e071
210+#define MAKE_NUM_LOCK_AND_END 0xe012e069
211+#define MAKE_NUM_LOCK_AND_PAGE_DOWN 0xe012e07a
212+#define MAKE_NUM_LOCK_AND_ARROW_UP 0xe012e075
213+#define MAKE_NUM_LOCK_AND_ARROW_LEFT 0xe012e06b
214+#define MAKE_NUM_LOCK_AND_ARROW_DOWN 0xe012e072
215+#define MAKE_NUM_LOCK_AND_ARROW_RIGHT 0xe012e074
216+
217+#define MAKE_LEFT_SHIFT_AND_INS 0xe0f012e070
218+#define MAKE_LEFT_SHIFT_AND_HOME 0xe0f012e06c
219+#define MAKE_LEFT_SHIFT_AND_PAGE_UP 0xe0f012e07d
220+#define MAKE_LEFT_SHIFT_AND_DEL 0xe0f012e071
221+#define MAKE_LEFT_SHIFT_AND_END 0xe0f012e069
222+#define MAKE_LEFT_SHIFT_AND_PAGE_DOWN 0xe0f012e07a
223+#define MAKE_LEFT_SHIFT_AND_ARROW_UP 0xe0f012e075
224+#define MAKE_LEFT_SHIFT_AND_ARROW_LEFT 0xe0f012e06b
225+#define MAKE_LEFT_SHIFT_AND_ARROW_DOWN 0xe0f012e072
226+#define MAKE_LEFT_SHIFT_AND_ARROW_RIGHT 0xe0f012e074
227+
228+#define MAKE_RIGHT_SHIFT_AND_INS 0xe0f059e070
229+#define MAKE_RIGHT_SHIFT_AND_HOME 0xe0f059e06c
230+#define MAKE_RIGHT_SHIFT_AND_PAGE_UP 0xe0f059e07d
231+#define MAKE_RIGHT_SHIFT_AND_DEL 0xe0f059e071
232+#define MAKE_RIGHT_SHIFT_AND_END 0xe0f059e069
233+#define MAKE_RIGHT_SHIFT_AND_PAGE_DOWN 0xe0f059e07a
234+#define MAKE_RIGHT_SHIFT_AND_ARROW_UP 0xe0f059e075
235+#define MAKE_RIGHT_SHIFT_AND_ARROW_LEFT 0xe0f059e06b
236+#define MAKE_RIGHT_SHIFT_AND_ARROW_DOWN 0xe0f059e072
237+#define MAKE_RIGHT_SHIFT_AND_ARROW_RIGHT 0xe0f059e074
238+
239+#define MAKE_LR_SHIFT_AND_INS 0xe0f012e0f059e070
240+#define MAKE_LR_SHIFT_AND_HOME 0xe0f012e0f059e06c
241+#define MAKE_LR_SHIFT_AND_PAGE_UP 0xe0f012e0f059e07d
242+#define MAKE_LR_SHIFT_AND_DEL 0xe0f012e0f059e071
243+#define MAKE_LR_SHIFT_AND_END 0xe0f012e0f059e069
244+#define MAKE_LR_SHIFT_AND_PAGE_DOWN 0xe0f012e0f059e07a
245+#define MAKE_LR_SHIFT_AND_ARROW_UP 0xe0f012e0f059e075
246+#define MAKE_LR_SHIFT_AND_ARROW_LEFT 0xe0f012e0f059e06b
247+#define MAKE_LR_SHIFT_AND_ARROW_DOWN 0xe0f012e0f059e072
248+#define MAKE_LR_SHIFT_AND_ARROW_RIGHT 0xe0f012e0f059e074
249+#define MAKE_NUM_KEY_SLASH 0xe04a
250+#define MAKE_NUM_KEY_LEFT_SHIFT_AND_SLASH 0xe0f012e04a
251+#define MAKE_NUM_KEY_RIGHT_SHIFT_AND_SLASH 0xe0f059e04a
252+#define MAKE_NUM_KEY_LR_SHIFT_AND_SLASH 0xe0f012e0f059e04a
253+#define MAKE_NUM_KEY_ENTER 0xe05a
254+
255+
256+#endif
--- /dev/null
+++ b/include/stdio.h~
@@ -0,0 +1,52 @@
1+#ifndef _STDIO_H_VANE_
2+#define _STDIO_H_VANE_
3+
4+extern unsigned short* screen;
5+extern char attr;
6+extern unsigned int X,Y;
7+
8+#define BRACK 0x00
9+#define BLUE 0x01
10+#define GREEN 0x02
11+#define CIAN 0x03
12+#define RED 0x04
13+#define MASENTA 0x05
14+#define BRAWN 0x06
15+#define GLAY 0x07
16+#define D_GLAY 0x08
17+#define CH_BLUE 0x09
18+#define CH_GREE 0x0a
19+#define CH_CIAN 0x0b
20+#define PINK 0x0c
21+#define CH_MAS 0x0d
22+#define YELLOW 0x0e
23+#define WHITE 0x0f
24+
25+#define CHAR_BYTE 1
26+#define SHORT_BYTE 2
27+#define INT_BYTE 4
28+#define LONG_BYTE 4
29+#define LONG_LONG_BYTE 8
30+#define DOUBLE_BYTE 8
31+#define FLOAT_BYTE 4
32+
33+#if (!defined(NULL))
34+ #define NULL ((void *) 0)
35+#endif
36+
37+#define NUM_NULL 0
38+/*
39+#include <stdarg.h>
40+
41+int sprintf(char *s, const char *format, ...);
42+int vsprintf(char *s, const char *format, va_list arg);
43+*/
44+char getchar(void);
45+char getch(void);
46+
47+void ClearScreen(void);
48+void puts(const char* msg);
49+void putchar(const char);
50+void printOK(const char* msg);
51+
52+#endif
--- /dev/null
+++ b/include/task.h
@@ -0,0 +1,53 @@
1+/*
2+*Multi Task Common Header
3+*(C) 2014 VOSystems.
4+*/
5+
6+#ifndef _TASK_H_VANE_
7+#define _TASK_H_VANE_
8+
9+#include<Message.h>
10+#include<GDT_IDT.h>
11+
12+#define MAX_TASKS 1000
13+#define TASK_GDT0 3
14+#define MAX_TASKS_LV 100
15+#define MAX_TASKLEVELS 10
16+#define ADR_GDT 0x00270000
17+#define AR_TSS32 0x0089
18+#define AR_LDT 0x0082
19+
20+struct TSS32 {
21+ int backlink, esp0, ss0, esp1, ss1, esp2, ss2, cr3;
22+ int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;
23+ int es, cs, ss, ds, fs, gs;
24+ int ldtr, iomap;
25+};
26+
27+struct TASK {
28+ int sel, flags;
29+ int level, priority;
30+ struct msg_data fifo;
31+ struct TSS32 tss;
32+ SEGMENT_DESCRIPTOR ldt[2];
33+ struct CONSOLE *cons;
34+ int ds_base, cons_stack;
35+ //struct FILEHANDLE *fhandle;
36+ int *fat;
37+ char *cmdline;
38+ unsigned char langmode, langbyte1;
39+};
40+
41+struct TASKLEVEL {
42+ int running;
43+ int now;
44+ struct TASK *tasks[MAX_TASKS_LV];
45+};
46+
47+struct TASKCTL {
48+ int now_lv;
49+ char lv_change;
50+ struct TASKLEVEL level[MAX_TASKLEVELS];
51+ struct TASK tasks0[MAX_TASKS];
52+};
53+#endif
--- /dev/null
+++ b/include/task.h~
@@ -0,0 +1,52 @@
1+/*
2+*Multi Task Common Header
3+*(C) 2014 VOSystems.
4+*/
5+
6+#ifndef _TASK_H_VANE_
7+#define _TASK_H_VANE_
8+
9+#include<Message.h>
10+#include<GDT_IDT.h>
11+
12+#define MAX_TASKS 1000
13+#define TASK_GDT0 3
14+#define MAX_TASKS_LV 100
15+#define MAX_TASKLEVELS 10
16+#define ADR_GDT 0x00270000
17+#define AR_TSS32 0x0089
18+
19+struct TSS32 {
20+ int backlink, esp0, ss0, esp1, ss1, esp2, ss2, cr3;
21+ int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;
22+ int es, cs, ss, ds, fs, gs;
23+ int ldtr, iomap;
24+};
25+
26+struct TASK {
27+ int sel, flags;
28+ int level, priority;
29+ struct msg_data fifo;
30+ struct TSS32 tss;
31+ SEGMENT_DESCRIPTOR ldt[2];
32+ struct CONSOLE *cons;
33+ int ds_base, cons_stack;
34+ //struct FILEHANDLE *fhandle;
35+ int *fat;
36+ char *cmdline;
37+ unsigned char langmode, langbyte1;
38+};
39+
40+struct TASKLEVEL {
41+ int running;
42+ int now;
43+ struct TASK *tasks[MAX_TASKS_LV];
44+};
45+
46+struct TASKCTL {
47+ int now_lv;
48+ char lv_change;
49+ struct TASKLEVEL level[MAX_TASKLEVELS];
50+ struct TASK tasks0[MAX_TASKS];
51+};
52+#endif
--- /dev/null
+++ b/include/timer.h
@@ -0,0 +1,28 @@
1+/*
2+*Timer common header
3+*(C) 2014 VOSystems.
4+*/
5+
6+#ifndef _TIMER_H_VANE_
7+#define _TIMER_H_VANE_
8+
9+#define MAX_TIMER 1024
10+#define TIMER_FLAGS_ALLOC 1
11+#define TIMER_FLAGS_USING 2
12+
13+struct timer
14+{
15+ unsigned int timeout,flags;
16+ struct msg_data *msg;
17+ int data;
18+};
19+
20+typedef struct
21+{
22+ unsigned int count,next,using;
23+ struct timer *timers[MAX_TIMER];
24+}timer_mgr;
25+
26+extern timer_mgr timer;
27+
28+#endif
--- /dev/null
+++ b/include/timer.h~
@@ -0,0 +1,28 @@
1+/*
2+*Timer common header
3+*(C) 2014 VOSystems.
4+*/
5+
6+#ifndef _TIMER_H_VANE_
7+#define _TIMER_H_VANE_
8+
9+#define MAX_TIMER 1024
10+#define TIMER_FLAGS_ALLOC 1
11+#define TIMER_FLAGS_USING 2
12+
13+struct timer
14+{
15+ unsigned int timeout,flags;
16+ struct msg_data *msg;
17+ int data;
18+};
19+
20+typedef struct
21+{
22+ unsigned int count,next,using;
23+ struct timer timers[MAX_TIMER];
24+}timer_mgr;
25+
26+extern timer_mgr timer;
27+
28+#endif