マイクロカーネル、プリエンプティブマルチタスクを目指しているOSです。
Révision | 5f3d766397f90581327ea60eacc1a68126114c3a (tree) |
---|---|
l'heure | 2014-10-19 22:52:56 |
Auteur | vosystems <doradora.motochan@gmai...> |
Commiter | vosystems |
time.hの関数の実装開始
@@ -38,9 +38,10 @@ SYSTEM_C=System.c | ||
38 | 38 | MESSAGE_C=Message.c |
39 | 39 | TIMER_C=timer.c |
40 | 40 | TASK_C=task.c |
41 | +TIME_C=time.c | |
41 | 42 | |
42 | 43 | #オブジェクト |
43 | -BOOT_OBJ=${BOOT_S:.S=.o} ${BOOT_C:.c=.o} ${VANE_S:.S=.o} ${KEYBOARD_C:.c=.o} ${STDIO_C:.c=.o} ${GDT_IDT_C:.c=.o} ${INTERRUPT_C:.c=.o} ${STRING_C:.c=.o} ${ASM_INTERRUPT_S:.S=.o} ${SCANCODE_C:.c=.o} ${MEMMAN_C:.c=.o} ${FAT_C:.c=.o} ${GRAPHIC_C:.c=.o} ${SYSTEM_C:.c=.o} ${MESSAGE_C:.c=.o} ${TIMER_C:.c=.o} ${TASK_C:.c=.o} | |
44 | +BOOT_OBJ=${BOOT_S:.S=.o} ${BOOT_C:.c=.o} ${VANE_S:.S=.o} ${KEYBOARD_C:.c=.o} ${STDIO_C:.c=.o} ${GDT_IDT_C:.c=.o} ${INTERRUPT_C:.c=.o} ${STRING_C:.c=.o} ${ASM_INTERRUPT_S:.S=.o} ${SCANCODE_C:.c=.o} ${MEMMAN_C:.c=.o} ${FAT_C:.c=.o} ${GRAPHIC_C:.c=.o} ${SYSTEM_C:.c=.o} ${MESSAGE_C:.c=.o} ${TIMER_C:.c=.o} ${TASK_C:.c=.o} ${TIME_C:.c=.o} | |
44 | 45 | |
45 | 46 | kernel: ${BOOT_OBJ} |
46 | 47 | ${LD} ${TARGET} ${BOOT_OBJ} |
@@ -0,0 +1,51 @@ | ||
1 | +TARGET = ../bin/Kernel.vsb | |
2 | + | |
3 | +#宣言 | |
4 | +CC = gcc | |
5 | +RM = /bin/rm | |
6 | +MV = /bin/mv | |
7 | +LD = /usr/bin/ld | |
8 | +LN_S = ln -s | |
9 | +AR = /usr/bin/ar | |
10 | +RANLIB = ranlib | |
11 | +INCLUDES = -I../include | |
12 | +LIBVANE = ../lib/libvanec.a ../lib/libvanego.a | |
13 | +FLAGS = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c | |
14 | +FLAGSC = -m32 -ffreestanding -fno-common -nostdlib -masm=intel -fno-builtin -fomit-frame-pointer -O2 -c | |
15 | +LD = ld -Ttext 0x100000 -T linkerscript -melf_i386 --oformat elf32-i386 -o | |
16 | + | |
17 | +#サフィックス | |
18 | +.S.o: | |
19 | + ${CC} ${INCLUDES} ${FLAGS} $< | |
20 | +.c.o: | |
21 | + ${CC} ${INCLUDES} ${FLAGSC} $< | |
22 | + | |
23 | +#ソースコード | |
24 | +BOOT_C=boot.c | |
25 | +BOOT_S=load.S | |
26 | +VANE_S=Vane.S | |
27 | +KEYBOARD_C=KeyBoard.c | |
28 | +GDT_IDT_C=GDT_IDT.c | |
29 | +INTERRUPT_C=Interrupt.c | |
30 | +STDIO_C=stdio.c | |
31 | +STRING_C=string.c | |
32 | +ASM_INTERRUPT_S=ASM_Interrupt.S | |
33 | +SCANCODE_C=scancode.c | |
34 | +MEMMAN_C=memory.c | |
35 | +FAT_C=FAT.c | |
36 | +GRAPHIC_C=Graphical.c | |
37 | +SYSTEM_C=System.c | |
38 | +MESSAGE_C=Message.c | |
39 | +TIMER_C=timer.c | |
40 | +TASK_C=task.c | |
41 | + | |
42 | +#オブジェクト | |
43 | +BOOT_OBJ=${BOOT_S:.S=.o} ${BOOT_C:.c=.o} ${VANE_S:.S=.o} ${KEYBOARD_C:.c=.o} ${STDIO_C:.c=.o} ${GDT_IDT_C:.c=.o} ${INTERRUPT_C:.c=.o} ${STRING_C:.c=.o} ${ASM_INTERRUPT_S:.S=.o} ${SCANCODE_C:.c=.o} ${MEMMAN_C:.c=.o} ${FAT_C:.c=.o} ${GRAPHIC_C:.c=.o} ${SYSTEM_C:.c=.o} ${MESSAGE_C:.c=.o} ${TIMER_C:.c=.o} ${TASK_C:.c=.o} | |
44 | + | |
45 | +kernel: ${BOOT_OBJ} | |
46 | + ${LD} ${TARGET} ${BOOT_OBJ} | |
47 | + | |
48 | +${BOOT_OBJ}: ${BOOT_SRC} | |
49 | +clean:: | |
50 | + -${RM} -f *~ *.lo *.o make.log *.bak .a.out .core .*.core | |
51 | + |
@@ -86,5 +86,5 @@ void printtime(void) | ||
86 | 86 | { |
87 | 87 | unsigned char s[24], t[7]; |
88 | 88 | readrtc(t); |
89 | - printf("\r%X%X/%X/%X %X:%X:%X", t[6], t[5], t[4], t[3], t[2], t[1], t[0]); | |
89 | + printf("%X%X/%X/%X %X:%X:%X", t[6], t[5], t[4], t[3], t[2], t[1], t[0]); | |
90 | 90 | } |
@@ -0,0 +1,90 @@ | ||
1 | +/* | |
2 | +*System Functions | |
3 | +*(C) 2014 VOSystems. | |
4 | +*/ | |
5 | +#include <stdio.h> | |
6 | + | |
7 | +int vram_start_address; | |
8 | +char vmode; | |
9 | +short scrnX,scrnY; | |
10 | +void init_qemuvga0(int x, int y, int c, int flag); | |
11 | +/*int Check_VESA(void) | |
12 | +{ | |
13 | + in_virtual86mode(); | |
14 | + if(VESA_Check()==0){ | |
15 | + out_virtual86mode(); | |
16 | + return 0; | |
17 | + }else{ | |
18 | + out_virtual86mode(); | |
19 | + return 1; | |
20 | + } | |
21 | +} | |
22 | + | |
23 | +void ScreenVGA_Graphic(void) | |
24 | +{/* | |
25 | + in_virtual86mode(); | |
26 | + scrn320(); | |
27 | + out_virtual86mode(); | |
28 | + vram_start_address=0x000a0000; | |
29 | + scrnX=320; | |
30 | + scrnY=200; | |
31 | + init_qemuvga0(1024,600,32,0x41); | |
32 | +}*/ | |
33 | + | |
34 | +void set_qemuvga0reg(int reg, int dat) | |
35 | +{ | |
36 | + io_out16(0x01ce, reg); | |
37 | + io_out16(0x01cf, dat); | |
38 | + return; | |
39 | +} | |
40 | + | |
41 | +void init_qemuvga0(int x, int y, int c, int flag) | |
42 | +{ | |
43 | + set_qemuvga0reg(0x0004, 0x0000); | |
44 | + set_qemuvga0reg(0x0001, x); | |
45 | + set_qemuvga0reg(0x0002, y); | |
46 | + set_qemuvga0reg(0x0003, c); /* 4, 8, 15, 16, 24, 32 */ | |
47 | + set_qemuvga0reg(0x0005, 0x0000); | |
48 | + set_qemuvga0reg(0x0004, flag); /* リニアアクセスモードでVRAMの初期化をするなら0x41 */ | |
49 | + /* bit7 : VRAM初期化抑制, bit6 : リニアアクセスモード, bit0 : 設定有効 */ | |
50 | + scrnX = x; | |
51 | + scrnY = y; | |
52 | + vmode = c; | |
53 | + if ((flag & 0x40) == 0) { | |
54 | + vram_start_address = 0x000a0000; | |
55 | + } else { | |
56 | + vram_start_address = 0xe0000000; | |
57 | + } | |
58 | + return; | |
59 | +} | |
60 | + | |
61 | +void readrtc(unsigned char *t) | |
62 | +{ | |
63 | + char err; | |
64 | + static unsigned char adr[7] = { 0x00, 0x02, 0x04, 0x07, 0x08, 0x09, 0x32 }; | |
65 | + static unsigned char max[7] = { 0x60, 0x59, 0x23, 0x31, 0x12, 0x99, 0x99 }; | |
66 | + int i; | |
67 | + for (;;) { /* 読み込みが成功するまで繰り返す */ | |
68 | + err = 0; | |
69 | + for (i = 0; i < 7; i++) { | |
70 | + io_out8(0x70, adr[i]); | |
71 | + t[i] = io_in8(0x71); | |
72 | + } | |
73 | + for (i = 0; i < 7; i++) { | |
74 | + io_out8(0x70, adr[i]); | |
75 | + if (t[i] != io_in8(0x71) || (t[i] & 0x0f) > 9 || t[i] > max[i]) { | |
76 | + err = 1; | |
77 | + } | |
78 | + } | |
79 | + if (err == 0) { | |
80 | + return; | |
81 | + } | |
82 | + } | |
83 | +} | |
84 | + | |
85 | +void printtime(void) | |
86 | +{ | |
87 | + unsigned char s[24], t[7]; | |
88 | + readrtc(t); | |
89 | + printf("%X%X/%X/%X %X:%X:%X", t[6], t[5], t[4], t[3], t[2], t[1], t[0]); | |
90 | +} |
@@ -63,6 +63,7 @@ void cstart(unsigned long magic, unsigned long addr) | ||
63 | 63 | printf("VOSystems Console Host [Version 0.1(build 10)]\n"); |
64 | 64 | |
65 | 65 | /*Setting IDT*/ |
66 | + printTASK("Setting IDT....."); | |
66 | 67 | setupInterruptGate(DEF_IDT_INT_NUM_IRQ1,KeyBoard_Interrupt_asm);//Register Keyboard interrupt handler |
67 | 68 | setupInterruptGate(DEF_IDT_INT_NUM_IRQ0,Timer_Interrupt_asm);//Register Timer interrupt handler |
68 | 69 | idtr.size = NUM_IDT * sizeof( GATE_DESCRIPTOR ); |
@@ -72,6 +73,7 @@ void cstart(unsigned long magic, unsigned long addr) | ||
72 | 73 | printOK("Setting IDT....."); |
73 | 74 | |
74 | 75 | /*Setting GDT*/ |
76 | + printTASK("Setting GDT....."); | |
75 | 77 | /*set up null descriptor*/ |
76 | 78 | gdt[NULL_DESCRIPTOR].limitLo = DEF_GDT_NULL_LIMIT; |
77 | 79 | gdt[NULL_DESCRIPTOR].baseLo = DEF_GDT_NULL_BASELO; |
@@ -97,41 +99,49 @@ void cstart(unsigned long magic, unsigned long addr) | ||
97 | 99 | |
98 | 100 | load_gdt(); |
99 | 101 | printOK("Setting GDT....."); |
100 | - | |
102 | + | |
103 | + printTASK("Init PIC....."); | |
101 | 104 | initPIC(); |
102 | 105 | printOK("Init PIC....."); |
103 | 106 | |
107 | + printTASK("Init Keyboard....."); | |
104 | 108 | initKeyboard(); |
105 | 109 | keyboardEnableKBD(); |
106 | 110 | printOK("Init Keyboard....."); |
107 | 111 | |
112 | + printTASK("Init Messaging Buffer....."); | |
108 | 113 | msg_init(&kernel,32,kernelbuf); |
109 | 114 | printOK("Init Messaging Buffer....."); |
110 | 115 | |
116 | + printTASK("Init PIT....."); | |
111 | 117 | setPitCounter(100,DEF_PIT_COM_COUNTER0,DEF_PIT_COM_MODE_SQUAREWAVE); |
112 | 118 | initPit(); |
113 | 119 | printOK("Init PIT....."); |
114 | 120 | |
121 | + printTASK("Starting Memory Manager....."); | |
115 | 122 | memman_init(memman); |
116 | 123 | memman_free(memman,0x00001000,0x0009e000); |
117 | 124 | memman_free(memman,0x00400000,((mbi->mem_lower+mbi->mem_upper)*1024)-0x00400000); |
118 | 125 | printOK("Starting Memory Manager....."); |
119 | 126 | |
127 | + printTASK("Loading Memory Info....."); | |
120 | 128 | if(magic!=MULTIBOOT_BOOTLOADER_MAGIC){ |
121 | 129 | printFAIL("Loading Memory Info....."); |
122 | 130 | |
123 | 131 | }else{ |
124 | 132 | printOK("Loading Memory Info....."); |
125 | - | |
133 | + printINFO("TotalMemory = "); | |
134 | + printf("%d MiB\n",(mbi->mem_lower+mbi->mem_upper+1024)/1024); | |
135 | + printINFO("Free Memory = "); | |
136 | + printf("%d MiB\n",memman_total(memman)/(1024*1024)); | |
126 | 137 | } |
127 | - printf("\n~Memory Information~\nLowMemory = %d KiB , UpperMemory = %d KiB , TotalMemory = %d MiB\n\n",mbi->mem_lower, | |
128 | - mbi->mem_upper,(mbi->mem_lower+mbi->mem_upper+1024)/1024); | |
129 | - | |
130 | - | |
131 | - printf("Free Memory = %d MiB\n\n",memman_total(memman)/(1024*1024)); | |
132 | 138 | |
139 | + printf("%X %d\n",0x99,hex2dec_bcd(0x99)); | |
140 | + | |
133 | 141 | int in=0; |
134 | 142 | while(in!='q'){ |
143 | + putchar('\r'); | |
144 | + printINFO("Now Time and Day = "); | |
135 | 145 | printtime(); |
136 | 146 | if(kbhit()=='q')break; |
137 | 147 | io_hlt(); |
@@ -143,8 +153,9 @@ void cstart(unsigned long magic, unsigned long addr) | ||
143 | 153 | if(strcmp("time",cmd)==0){ |
144 | 154 | int in=0; |
145 | 155 | while(in!='q'){ |
156 | + putchar('\r'); | |
146 | 157 | printtime(); |
147 | - if(kbhit()!=0)in=getch(); | |
158 | + if(kbhit()=='q')break; | |
148 | 159 | io_hlt(); |
149 | 160 | } |
150 | 161 | } |
@@ -0,0 +1,252 @@ | ||
1 | +/*! | |
2 | + boot.c | |
3 | + Kernel and Setting. | |
4 | + (C) 2013-2014 VOSystems. | |
5 | +*/ | |
6 | + | |
7 | +/* | |
8 | + Vane Operating System | |
9 | + Publish under The MIT License | |
10 | + | |
11 | + MIT License | |
12 | + http://opensource.org/licenses/mit-license.php | |
13 | + Copyright (C) 2013-2014 VOSystems. All rights reserved. | |
14 | +*/ | |
15 | + | |
16 | +#include<multiboot.h> | |
17 | +#include<VaneOS.h> | |
18 | +#include<GDT_IDT.h> | |
19 | +#include<KeyBoard.h> | |
20 | +#include<Interrupt.h> | |
21 | +#include<stdio.h> | |
22 | +#include<scancode.h> | |
23 | +#include<memory.h> | |
24 | +#include<Graphic.h> | |
25 | +#include<Message.h> | |
26 | +#include<timer.h> | |
27 | +#include<System.h> | |
28 | + | |
29 | +/*PROTOTYPE*/ | |
30 | +void outPortByte( unsigned short address, unsigned char value ); | |
31 | +unsigned char inPortByte( unsigned short address ); | |
32 | +void initPIC( void ); | |
33 | +int setPitCounter( int freq, unsigned char counter, unsigned char mode ); | |
34 | +void initPit( void ); | |
35 | +void clear_state(void); | |
36 | +void hlt(void); | |
37 | + | |
38 | +/*! | |
39 | + load.S call this function | |
40 | + | |
41 | + Set All & Call shell | |
42 | + (C)2014 VOSystems. | |
43 | + create 2014/09/23 | |
44 | + update 2014/10/15 | |
45 | + author VOSystems | |
46 | +*/ | |
47 | +void cstart(unsigned long magic, unsigned long addr) | |
48 | +{ | |
49 | + /*Common Settings*/ | |
50 | + char cmd[100]={0}; | |
51 | + struct MEMMAN *memman=(struct MEMMAN*)MEMMAN_ADDR; | |
52 | + multiboot_info_t *mbi; | |
53 | + | |
54 | + mbi = (multiboot_info_t *) addr; | |
55 | + | |
56 | + //ClearScreen(); | |
57 | + break_flag=0; system_key_code_flag=0; | |
58 | + screen=(unsigned short*)0xb8000;//VRam Setting | |
59 | + attr=WHITE; | |
60 | + | |
61 | + /*Start Set Main Code*/ | |
62 | + printf("VOSystems Vane Operating System [Version 0.2(build 300)]\n"); | |
63 | + printf("VOSystems Console Host [Version 0.1(build 10)]\n"); | |
64 | + | |
65 | + /*Setting IDT*/ | |
66 | + printTASK("Setting IDT....."); | |
67 | + setupInterruptGate(DEF_IDT_INT_NUM_IRQ1,KeyBoard_Interrupt_asm);//Register Keyboard interrupt handler | |
68 | + setupInterruptGate(DEF_IDT_INT_NUM_IRQ0,Timer_Interrupt_asm);//Register Timer interrupt handler | |
69 | + idtr.size = NUM_IDT * sizeof( GATE_DESCRIPTOR ); | |
70 | + idtr.base = ( GATE_DESCRIPTOR *)idt; | |
71 | + | |
72 | + load_idt(); | |
73 | + printOK("Setting IDT....."); | |
74 | + | |
75 | + /*Setting GDT*/ | |
76 | + printTASK("Setting GDT....."); | |
77 | + /*set up null descriptor*/ | |
78 | + gdt[NULL_DESCRIPTOR].limitLo = DEF_GDT_NULL_LIMIT; | |
79 | + gdt[NULL_DESCRIPTOR].baseLo = DEF_GDT_NULL_BASELO; | |
80 | + gdt[NULL_DESCRIPTOR].baseMid = DEF_GDT_NULL_BASEMID; | |
81 | + gdt[NULL_DESCRIPTOR].flags = DEF_GDT_NULL_FLAGS; | |
82 | + gdt[NULL_DESCRIPTOR].baseHi = DEF_GDT_NULL_BASEHI; | |
83 | + /* set up code descriptor */ | |
84 | + gdt[CODE_DESCRIPTOR].limitLo = DEF_GDT_CODE_LIMIT; | |
85 | + gdt[CODE_DESCRIPTOR].baseLo = DEF_GDT_CODE_BASELO; | |
86 | + gdt[CODE_DESCRIPTOR].baseMid = DEF_GDT_CODE_BASEMID; | |
87 | + gdt[CODE_DESCRIPTOR].flags = DEF_GDT_CODE_FLAGS; | |
88 | + gdt[CODE_DESCRIPTOR].baseHi = DEF_GDT_CODE_BASEHI; | |
89 | + | |
90 | + /* set up data descriptor */ | |
91 | + gdt[DATA_DESCRIPTOR].limitLo = DEF_GDT_DATA_LIMIT; | |
92 | + gdt[DATA_DESCRIPTOR].baseLo = DEF_GDT_DATA_BASELO; | |
93 | + gdt[DATA_DESCRIPTOR].baseMid = DEF_GDT_DATA_BASEMID; | |
94 | + gdt[DATA_DESCRIPTOR].flags = DEF_GDT_DATA_FLAGS; | |
95 | + gdt[DATA_DESCRIPTOR].baseHi = DEF_GDT_DATA_BASEHI; | |
96 | + | |
97 | + gdtr.size = NUM_GDT * sizeof( SEGMENT_DESCRIPTOR ); | |
98 | + gdtr.base = ( SEGMENT_DESCRIPTOR *)gdt; | |
99 | + | |
100 | + load_gdt(); | |
101 | + printOK("Setting GDT....."); | |
102 | + | |
103 | + printTASK("Init PIC....."); | |
104 | + initPIC(); | |
105 | + printOK("Init PIC....."); | |
106 | + | |
107 | + printTASK("Init Keyboard....."); | |
108 | + initKeyboard(); | |
109 | + keyboardEnableKBD(); | |
110 | + printOK("Init Keyboard....."); | |
111 | + | |
112 | + printTASK("Init Messaging Buffer....."); | |
113 | + msg_init(&kernel,32,kernelbuf); | |
114 | + printOK("Init Messaging Buffer....."); | |
115 | + | |
116 | + printTASK("Init PIT....."); | |
117 | + setPitCounter(100,DEF_PIT_COM_COUNTER0,DEF_PIT_COM_MODE_SQUAREWAVE); | |
118 | + initPit(); | |
119 | + printOK("Init PIT....."); | |
120 | + | |
121 | + printTASK("Starting Memory Manager....."); | |
122 | + memman_init(memman); | |
123 | + memman_free(memman,0x00001000,0x0009e000); | |
124 | + memman_free(memman,0x00400000,((mbi->mem_lower+mbi->mem_upper)*1024)-0x00400000); | |
125 | + printOK("Starting Memory Manager....."); | |
126 | + | |
127 | + printTASK("Loading Memory Info....."); | |
128 | + if(magic!=MULTIBOOT_BOOTLOADER_MAGIC){ | |
129 | + printFAIL("Loading Memory Info....."); | |
130 | + | |
131 | + }else{ | |
132 | + printOK("Loading Memory Info....."); | |
133 | + printINFO("TotalMemory = "); | |
134 | + printf("%d MiB\n",(mbi->mem_lower+mbi->mem_upper+1024)/1024); | |
135 | + printINFO("Free Memory = "); | |
136 | + printf("%d MiB\n",memman_total(memman)/(1024*1024)); | |
137 | + } | |
138 | + | |
139 | + printf("%X %d\n",0x12,hex2dec_bcd(0x12)); | |
140 | + | |
141 | + int in=0; | |
142 | + while(in!='q'){ | |
143 | + putchar('\r'); | |
144 | + printINFO("Now Time and Day = "); | |
145 | + printtime(); | |
146 | + if(kbhit()=='q')break; | |
147 | + io_hlt(); | |
148 | + } | |
149 | + putchar('\n'); | |
150 | + | |
151 | + puts("KernelShell/Root/>"); | |
152 | + scanf("%s",&cmd); | |
153 | + if(strcmp("time",cmd)==0){ | |
154 | + int in=0; | |
155 | + while(in!='q'){ | |
156 | + putchar('\r'); | |
157 | + printtime(); | |
158 | + if(kbhit()=='q')break; | |
159 | + io_hlt(); | |
160 | + } | |
161 | + } | |
162 | + printf("%d %d %d",strcmp("time",cmd),strcmp("time\0",cmd),strcmp("time\n",cmd)); | |
163 | + while(1)io_hlt(); | |
164 | + return; | |
165 | +} | |
166 | + | |
167 | +void outPortByte( unsigned short address, unsigned char value ) | |
168 | +{ | |
169 | + __asm__ __volatile__( "out %%dx, %%al" : : "d"(address), "a"(value) ); | |
170 | +} | |
171 | + | |
172 | +unsigned char inPortByte( unsigned short address ) | |
173 | +{ | |
174 | + unsigned char data; | |
175 | + | |
176 | + __asm__ __volatile__( "mov %%dx, %%ax" : : "a"(address) ); | |
177 | + __asm__ __volatile__( "in %al, %dx" ); | |
178 | + __asm__ __volatile__( "mov %%bl, %%al" : "=b"(data) ); | |
179 | + return( data ); | |
180 | +} | |
181 | + | |
182 | +void initPIC( void ) | |
183 | +{ | |
184 | + disable(); | |
185 | + | |
186 | + outPortByte( PORT_MASTER_PIC_COMMAND, PIC_ICW1 ); | |
187 | + outPortByte( PORT_SLAVE_PIC_COMMAND, PIC_ICW1 ); | |
188 | + | |
189 | + outPortByte( PORT_MASTER_PIC_DATA, PIC_MASTER_ICW2 ); | |
190 | + outPortByte( PORT_SLAVE_PIC_DATA, PIC_SLAVE_ICW2 ); | |
191 | + | |
192 | + outPortByte( PORT_MASTER_PIC_DATA, PIC_MASTER_ICW3 ); | |
193 | + outPortByte( PORT_SLAVE_PIC_DATA, PIC_SLAVE_ICW3 ); | |
194 | + | |
195 | + outPortByte( PORT_MASTER_PIC_DATA, PIC_MASTER_ICW4 ); | |
196 | + outPortByte( PORT_SLAVE_PIC_DATA, PIC_SLAVE_ICW4 ); | |
197 | + | |
198 | + outPortByte( PORT_MASTER_PIC_IMR, (~PIC_IMR_MASK_IRQ0) & (~PIC_IMR_MASK_IRQ2 ) ); | |
199 | + outPortByte( PORT_SLAVE_PIC_IMR, PIC_IMR_MASK_IRQ_ALL ); | |
200 | + | |
201 | + outPortByte( PORT_MASTER_PIC_IMR, ( ~PIC_IMR_MASK_IRQ0 ) | |
202 | + & ( ~PIC_IMR_MASK_IRQ1 ) & ( ~PIC_IMR_MASK_IRQ2 ) ); | |
203 | + outPortByte( PORT_SLAVE_PIC_IMR, PIC_IMR_MASK_IRQ_ALL ); | |
204 | + | |
205 | + enable(); | |
206 | +} | |
207 | + | |
208 | +int setPitCounter( int freq, unsigned char counter, unsigned char mode ) | |
209 | +{ | |
210 | + unsigned short count; | |
211 | + unsigned char command; | |
212 | + | |
213 | + /* --------------------------------------------------------------------- */ | |
214 | + /* calculate frequency */ | |
215 | + /* --------------------------------------------------------------------- */ | |
216 | + count = ( unsigned short )( DEF_PIT_CLOCK / freq ); | |
217 | + | |
218 | + /* --------------------------------------------------------------------- */ | |
219 | + /* make initial command */ | |
220 | + /* --------------------------------------------------------------------- */ | |
221 | + command = mode | DEF_PIT_COM_RL_DATA | counter; | |
222 | + | |
223 | + outPortByte( PIT_REG_CONTROL, command ); | |
224 | + | |
225 | + /* --------------------------------------------------------------------- */ | |
226 | + /* send counter value */ | |
227 | + /* --------------------------------------------------------------------- */ | |
228 | + outPortByte( PIT_REG_COUNTER0, ( unsigned char )( count & 0xFF ) ); | |
229 | + outPortByte( PIT_REG_COUNTER0, ( unsigned char )( ( count >> 8 ) & 0xFF ) ); | |
230 | +} | |
231 | + | |
232 | +/* | |
233 | + Funtion :initPit | |
234 | + Input :void | |
235 | + Output :void | |
236 | + Return :void | |
237 | + | |
238 | + Description :initialize pic | |
239 | +*/ | |
240 | +void initPit( void ) | |
241 | +{ | |
242 | + /* --------------------------------------------------------------------- */ | |
243 | + /* set counter0 100Hz */ | |
244 | + /* --------------------------------------------------------------------- */ | |
245 | + setPitCounter( 100, DEF_PIT_COM_COUNTER0, DEF_PIT_COM_MODE_SQUAREWAVE ); | |
246 | + timer.count=0; | |
247 | + int i; | |
248 | + for(i=0;i<MAX_TIMER;i++) | |
249 | + { | |
250 | + timer.timers[i]->flags=0; | |
251 | + } | |
252 | +} |
@@ -213,67 +213,74 @@ void putchar(const char ch) | ||
213 | 213 | return; |
214 | 214 | } |
215 | 215 | |
216 | -void printOK(const char* msg) | |
216 | +void printTASK(const char* msg) | |
217 | 217 | { |
218 | + puts("[....]"); | |
218 | 219 | attr=WHITE; |
219 | 220 | puts(msg); |
220 | - while(X<(80-6))/*80 charactors - [ OK ]*/ | |
221 | - { | |
222 | - puts(" "); | |
223 | - } | |
221 | + return; | |
222 | +} | |
223 | + | |
224 | +void printOK(const char* msg) | |
225 | +{ | |
226 | + putchar('\r'); | |
227 | + attr=WHITE; | |
224 | 228 | puts("[ "); |
225 | 229 | attr=GREEN; |
226 | - puts("OK"); | |
230 | + puts("ok"); | |
231 | + attr=WHITE; | |
232 | + puts(" ]"); | |
233 | + | |
227 | 234 | attr=WHITE; |
228 | - puts(" ]\n"); | |
235 | + puts(msg); | |
236 | + puts("done.\n"); | |
229 | 237 | return; |
230 | 238 | } |
231 | 239 | |
232 | 240 | void printFAIL(const char* msg) |
233 | 241 | { |
242 | + putchar('\r'); | |
234 | 243 | attr=WHITE; |
235 | - puts(msg); | |
236 | - while(X<(80-6))/*80 charactors - [ OK ]*/ | |
237 | - { | |
238 | - puts(" "); | |
239 | - } | |
240 | 244 | puts("["); |
241 | 245 | attr=RED; |
242 | - puts("FAIL"); | |
246 | + puts("fail"); | |
243 | 247 | attr=WHITE; |
244 | - puts("]\n"); | |
248 | + puts("]"); | |
249 | + | |
250 | + attr=WHITE; | |
251 | + puts(msg); | |
252 | + puts("\n"); | |
245 | 253 | return; |
246 | 254 | } |
247 | 255 | |
248 | 256 | void printWARN(const char* msg) |
249 | 257 | { |
258 | + putchar('\r'); | |
250 | 259 | attr=WHITE; |
251 | - puts(msg); | |
252 | - while(X<(80-6))/*80 charactors - [ OK ]*/ | |
253 | - { | |
254 | - puts(" "); | |
255 | - } | |
256 | 260 | puts("["); |
257 | 261 | attr=YELLOW; |
258 | - puts("WARN"); | |
262 | + puts("warn"); | |
263 | + attr=YELLOW; | |
264 | + puts("]"); | |
265 | + | |
259 | 266 | attr=WHITE; |
260 | - puts("]\n"); | |
267 | + puts(msg); | |
268 | + puts("done.\n"); | |
261 | 269 | return; |
262 | 270 | } |
263 | 271 | |
264 | 272 | void printINFO(const char* msg) |
265 | 273 | { |
274 | + putchar('\r'); | |
266 | 275 | attr=WHITE; |
267 | - puts(msg); | |
268 | - while(X<(80-6))/*80 charactors - [ OK ]*/ | |
269 | - { | |
270 | - puts(" "); | |
271 | - } | |
272 | 276 | puts("["); |
273 | 277 | attr=CH_BLUE; |
274 | - puts("WARN"); | |
278 | + puts("info"); | |
275 | 279 | attr=WHITE; |
276 | - puts("]\n"); | |
280 | + puts("]"); | |
281 | + | |
282 | + attr=WHITE; | |
283 | + puts(msg); | |
277 | 284 | return; |
278 | 285 | } |
279 | 286 |
@@ -0,0 +1,373 @@ | ||
1 | +/* | |
2 | +*stdio for Charactor Shell | |
3 | +*(C) 2014 VOSystems. | |
4 | +*/ | |
5 | + | |
6 | +#include<stdio.h> | |
7 | +#include<string.h> | |
8 | +#include<KeyBoard.h> | |
9 | +#include<scancode.h> | |
10 | +#include<stdarg.h> | |
11 | +/* | |
12 | +COLOR | |
13 | + | |
14 | +BRACK, BLUE, GREEN, CIAN, RED, MASENTA | |
15 | +BRAWN, GLAY, D_GLAY, CH_BLUE, CH_GREE | |
16 | +CH_CIAN, PINK, CH_MAS, YELLOW, WHITE | |
17 | +*/ | |
18 | + | |
19 | +#define COLUMNS (80) | |
20 | +#define LINES (24) | |
21 | +#define ATTRIBUTE (7) | |
22 | + | |
23 | +int asm_move_cursol(int ebp); | |
24 | + | |
25 | +unsigned short* screen; | |
26 | +char attr; | |
27 | +unsigned int X,Y; | |
28 | + | |
29 | +int kbhit(void) | |
30 | +{ | |
31 | + return Generate_Scancode_To_ASCII_Code(); | |
32 | +} | |
33 | +void scanf(const char* fmt,...) | |
34 | +{ | |
35 | + va_list arg; | |
36 | + va_start(arg,char*,fmt); | |
37 | + char ch=*fmt++; | |
38 | + unsigned int count=0; | |
39 | + | |
40 | + while(ch!='\0'){ | |
41 | + | |
42 | + if(ch=='%'){ | |
43 | + ch=*fmt++; | |
44 | + | |
45 | + if(ch=='d'){ | |
46 | + int buf=0; char chbuf=0; | |
47 | + count=0; | |
48 | + while(1){ | |
49 | + chbuf=getch(); | |
50 | + buf*=10; | |
51 | + | |
52 | + if(chbuf=='1'){ | |
53 | + buf+=1; | |
54 | + putchar(chbuf); | |
55 | + ++count; | |
56 | + }else if(chbuf=='2'){ | |
57 | + buf+=2; | |
58 | + putchar(chbuf); | |
59 | + ++count; | |
60 | + }else if(chbuf=='3'){ | |
61 | + buf+=3; | |
62 | + putchar(chbuf); | |
63 | + ++count; | |
64 | + }else if(chbuf=='4'){ | |
65 | + buf+=4; | |
66 | + putchar(chbuf); | |
67 | + ++count; | |
68 | + }else if(chbuf=='5'){ | |
69 | + buf+=5; | |
70 | + putchar(chbuf); | |
71 | + ++count; | |
72 | + }else if(chbuf=='6'){ | |
73 | + buf+=6; | |
74 | + putchar(chbuf); | |
75 | + ++count; | |
76 | + }else if(chbuf=='7'){ | |
77 | + buf+=7; | |
78 | + putchar(chbuf); | |
79 | + ++count; | |
80 | + }else if(chbuf=='8'){ | |
81 | + buf+=8; | |
82 | + putchar(chbuf); | |
83 | + ++count; | |
84 | + }else if(chbuf=='9'){ | |
85 | + buf+=9; | |
86 | + putchar(chbuf); | |
87 | + ++count; | |
88 | + }else if(chbuf=='0'){ | |
89 | + buf+=0; | |
90 | + putchar(chbuf); | |
91 | + ++count; | |
92 | + }else if(chbuf=='\b' && count>=0){ | |
93 | + buf/=10; | |
94 | + putchar(chbuf); | |
95 | + --count; | |
96 | + }else{ | |
97 | + buf/=10; | |
98 | + va_arg(arg,int)=buf; | |
99 | + break; | |
100 | + } | |
101 | + } | |
102 | + }else if(ch=='s'){ | |
103 | + char *cmd; cmd=va_arg(arg,char*); | |
104 | + count=0; | |
105 | + do{ | |
106 | + *cmd=getch(); | |
107 | + if(*cmd=='\n'){ | |
108 | + putchar(*cmd); | |
109 | + *cmd='\0'; | |
110 | + break; | |
111 | + | |
112 | + }else if(*cmd==' '){ | |
113 | + putchar(' '); | |
114 | + *cmd='\0'; | |
115 | + break; | |
116 | + | |
117 | + }else if(*cmd=='\b' && count>0){ | |
118 | + *cmd-- = '\0'; | |
119 | + count--; | |
120 | + putchar('\b'); | |
121 | + | |
122 | + }else{ | |
123 | + putchar(*cmd); | |
124 | + count++; | |
125 | + cmd++; | |
126 | + | |
127 | + } | |
128 | + }while(1); | |
129 | + | |
130 | + }else if(ch=='c'){ | |
131 | + va_arg(arg,char)=getchar(); | |
132 | + } | |
133 | + } | |
134 | + ch=*fmt++; | |
135 | + } | |
136 | +} | |
137 | + | |
138 | +char getchar(void) | |
139 | +{ | |
140 | + char code=0; | |
141 | + while(code==0) | |
142 | + { | |
143 | + code=Generate_Scancode_To_ASCII_Code(); | |
144 | + } | |
145 | + putchar(code); | |
146 | + return code; | |
147 | +} | |
148 | + | |
149 | +char getch(void) | |
150 | +{ | |
151 | + char code=0; | |
152 | + while(code==0) | |
153 | + { | |
154 | + code=Generate_Scancode_To_ASCII_Code(); | |
155 | + } | |
156 | + return code; | |
157 | +} | |
158 | + | |
159 | +void ClearScreen(void) | |
160 | +{ | |
161 | + screen=(unsigned short*)0xb8000; | |
162 | + X=0;Y=0; | |
163 | + while(screen<(unsigned short*)0xc0000) | |
164 | + { | |
165 | + *screen++ =NUM_NULL; | |
166 | + } | |
167 | + screen=(unsigned short*)0xb8000; | |
168 | + return; | |
169 | +} | |
170 | + | |
171 | +void puts(const char* msg) | |
172 | +{ | |
173 | + | |
174 | + char ch; | |
175 | + ch=*msg++; | |
176 | + | |
177 | + while(ch!='\0') | |
178 | + { | |
179 | + putchar(ch); | |
180 | + ch=*msg++; | |
181 | + } | |
182 | + return; | |
183 | +} | |
184 | + | |
185 | +void putchar(const char ch) | |
186 | +{ | |
187 | + if(ch=='\n'){ | |
188 | + screen+=(80-X);/*80 charactors * 2byte - X charactors * 2 byte*/ | |
189 | + Y+=1; | |
190 | + X=0; | |
191 | + | |
192 | + }else if(ch=='\t'){ | |
193 | + *screen++ = (((attr)<<8) | ' '); | |
194 | + *screen++ = (((attr)<<8) | ' '); | |
195 | + X+=2; | |
196 | + | |
197 | + }else if(ch=='\r'){ | |
198 | + while(X>0) | |
199 | + { | |
200 | + *screen-- = (unsigned short)NUM_NULL; | |
201 | + --X; | |
202 | + } | |
203 | + | |
204 | + }else if(ch=='\b'){ | |
205 | + screen--; | |
206 | + *screen = (unsigned short)NUM_NULL; | |
207 | + --X; | |
208 | + | |
209 | + }else{ | |
210 | + *screen++ = (((attr)<<8) | ch); | |
211 | + X+=1; | |
212 | + } | |
213 | + return; | |
214 | +} | |
215 | + | |
216 | +void printTASK(const char* msg) | |
217 | +{ | |
218 | + puts("[....]"); | |
219 | + attr=WHITE; | |
220 | + puts(msg); | |
221 | + return; | |
222 | +} | |
223 | + | |
224 | +void printOK(const char* msg) | |
225 | +{ | |
226 | + putchar('\r'); | |
227 | + attr=WHITE; | |
228 | + puts("[ "); | |
229 | + attr=GREEN; | |
230 | + puts("ok"); | |
231 | + attr=WHITE; | |
232 | + puts(" ]"); | |
233 | + | |
234 | + attr=WHITE; | |
235 | + puts(msg); | |
236 | + puts("done.\n"); | |
237 | + return; | |
238 | +} | |
239 | + | |
240 | +void printFAIL(const char* msg) | |
241 | +{ | |
242 | + putchar('\r'); | |
243 | + attr=WHITE; | |
244 | + puts("["); | |
245 | + attr=RED; | |
246 | + puts("fail"); | |
247 | + attr=WHITE; | |
248 | + puts("]"); | |
249 | + | |
250 | + attr=WHITE; | |
251 | + puts(msg); | |
252 | + puts("done.\n"); | |
253 | + return; | |
254 | +} | |
255 | + | |
256 | +void printWARN(const char* msg) | |
257 | +{ | |
258 | + putchar('\r'); | |
259 | + attr=WHITE; | |
260 | + puts("["); | |
261 | + attr=YELLOW; | |
262 | + puts("warn"); | |
263 | + attr=YELLOW; | |
264 | + puts("]"); | |
265 | + | |
266 | + attr=WHITE; | |
267 | + puts(msg); | |
268 | + puts("done.\n"); | |
269 | + return; | |
270 | +} | |
271 | + | |
272 | +void printINFO(const char* msg) | |
273 | +{ | |
274 | + putchar('\r'); | |
275 | + attr=WHITE; | |
276 | + puts("["); | |
277 | + attr=CH_BLUE; | |
278 | + puts("info"); | |
279 | + attr=WHITE; | |
280 | + puts("]"); | |
281 | + | |
282 | + attr=WHITE; | |
283 | + puts(msg); | |
284 | + return; | |
285 | +} | |
286 | + | |
287 | +char * uint_to_str_big_hex(char *buf, unsigned src, int base) { | |
288 | + char *p = buf; | |
289 | + char *p1, *p2; | |
290 | + | |
291 | + do { | |
292 | + *p++ = "0123456789ABCDEF"[src%base]; | |
293 | + } while(src /= base); | |
294 | + | |
295 | + // Terminate BUF | |
296 | + *p = 0; | |
297 | + | |
298 | + // Reverse BUF | |
299 | + for(p1=buf, p2=p-1; p1 < p2; p1++, p2--) { | |
300 | + char tmp = *p1; | |
301 | + *p1 = *p2; | |
302 | + *p2 = tmp; | |
303 | + } | |
304 | + | |
305 | + return buf; | |
306 | +} | |
307 | + | |
308 | +char * uint_to_str_small_hex(char *buf, unsigned src, int base) { | |
309 | + char *p = buf; | |
310 | + char *p1, *p2; | |
311 | + | |
312 | + do { | |
313 | + *p++ = "0123456789abcdef"[src%base]; | |
314 | + } while(src /= base); | |
315 | + | |
316 | + // Terminate BUF | |
317 | + *p = 0; | |
318 | + | |
319 | + // Reverse BUF | |
320 | + for(p1=buf, p2=p-1; p1 < p2; p1++, p2--) { | |
321 | + char tmp = *p1; | |
322 | + *p1 = *p2; | |
323 | + *p2 = tmp; | |
324 | + } | |
325 | + | |
326 | + return buf; | |
327 | +} | |
328 | + | |
329 | +void printf(char* fmt, ...) | |
330 | +{ | |
331 | + char **arg = (char **) &fmt; | |
332 | + char c; | |
333 | + arg++; | |
334 | + | |
335 | + while((c = *fmt++) != 0) { | |
336 | + if(c != '%'){ | |
337 | + putchar(c); | |
338 | + | |
339 | + }else{ | |
340 | + char buf[64]; | |
341 | + char *p; | |
342 | + c = *fmt++; | |
343 | + | |
344 | + if(c=='d'){ | |
345 | + // if value is minus, put '-' in the head | |
346 | + if( 0 > *((int *) arg) ) { | |
347 | + putchar('-'); | |
348 | + *((int *) arg) *= -1; | |
349 | + } | |
350 | + p = uint_to_str_small_hex(buf, *((unsigned *) arg++), 10); | |
351 | + puts(p); | |
352 | + | |
353 | + }else if(c=='x'){ | |
354 | + p = uint_to_str_small_hex(buf, *((unsigned *) arg++), 16); | |
355 | + puts(p); | |
356 | + | |
357 | + }else if(c=='X'){ | |
358 | + p = uint_to_str_big_hex(buf, *((unsigned *) arg++), 16); | |
359 | + puts(p); | |
360 | + | |
361 | + }else if(c=='s'){ | |
362 | + p = *arg++; | |
363 | + puts(p); | |
364 | + }else if(c=='c'){ | |
365 | + p=*arg++; | |
366 | + char send=*p; | |
367 | + putchar(send); | |
368 | + }else{ | |
369 | + putchar(c); | |
370 | + } | |
371 | + } | |
372 | + } | |
373 | +} |
@@ -0,0 +1,50 @@ | ||
1 | +/* | |
2 | + | |
3 | +*/ | |
4 | +#include<string.h> | |
5 | +/* | |
6 | +int strcmp(const char* ch1,const char* ch2) | |
7 | +{ | |
8 | + while(*ch1==*ch2) | |
9 | + { | |
10 | + if(*ch1=='\0' && *ch2=='\0'){ | |
11 | + return 0; | |
12 | + | |
13 | + }else if((*ch1=='\0' || *ch2=='\0') && (*ch1!=*ch2)){ | |
14 | + break; | |
15 | + | |
16 | + } | |
17 | + ++ch1; ++ch2; | |
18 | + } | |
19 | + return 1; | |
20 | +} | |
21 | +*//* | |
22 | +int strcmp(const char *s1, const char *s2) | |
23 | +{ | |
24 | + register const unsigned char *ss1, *ss2; | |
25 | + for (ss1 = (const unsigned char*)s1, ss2 = (const unsigned char*)s2; *ss1 == *ss2 && *ss1 != '\0'; ss1++, ss2++); | |
26 | + return *ss1 - *ss2; | |
27 | +} | |
28 | +*/ | |
29 | +int strcmp(const char *s1, const char *s2) | |
30 | +{ | |
31 | + while (*s1 == *s2++) | |
32 | + { | |
33 | + if (*s1++ == 0) | |
34 | + { | |
35 | + return (0); | |
36 | + } | |
37 | + } | |
38 | + return (*(unsigned char *)s1 - *(unsigned char *)--s2); | |
39 | +} | |
40 | + | |
41 | +void strcpy(char* copy,const char* source) | |
42 | +{ | |
43 | + while(*source!='\0') | |
44 | + { | |
45 | + *copy=*source; | |
46 | + ++copy; ++source; | |
47 | + } | |
48 | + *copy='\0'; | |
49 | + return; | |
50 | +} |
@@ -0,0 +1,46 @@ | ||
1 | +/* | |
2 | +*time lib c functions | |
3 | +*(C) 2014 VOSystems. | |
4 | +*/ | |
5 | + | |
6 | +#include<time.h> | |
7 | +#include<stdio.h> | |
8 | +/* | |
9 | +struct tm* localtime(time_t* timer) | |
10 | +{ | |
11 | + struct tm* local; | |
12 | + | |
13 | +}*/ | |
14 | + | |
15 | +inline int hex2dec_bcd(int hex) | |
16 | +{ | |
17 | + int i,m,n=0; | |
18 | + m=hex/16; | |
19 | + if(0x0<=m && m<=0x9){ | |
20 | + n+=m*10; | |
21 | + | |
22 | + }else{ | |
23 | + n+=0; | |
24 | + | |
25 | + } | |
26 | + m=hex-(m*16); | |
27 | + if(0x0<=m && m<=0x9){ | |
28 | + n+=m; | |
29 | + | |
30 | + }else{ | |
31 | + n+=0; | |
32 | + | |
33 | + } | |
34 | + return n; | |
35 | + /* | |
36 | + int i,m,n; | |
37 | + n=hex; | |
38 | + m=0; | |
39 | + for(i=0xFFFF;i>0;i/=16) | |
40 | + { | |
41 | + m+=n/i; | |
42 | + n-=m*i; | |
43 | + m*=10; | |
44 | + } | |
45 | + return m;*/ | |
46 | +} |
@@ -0,0 +1,46 @@ | ||
1 | +/* | |
2 | +*time lib c functions | |
3 | +*(C) 2014 VOSystems. | |
4 | +*/ | |
5 | + | |
6 | +#include<time.h> | |
7 | +#include<stdio.h> | |
8 | +/* | |
9 | +struct tm* localtime(time_t* timer) | |
10 | +{ | |
11 | + struct tm* local; | |
12 | + | |
13 | +}*/ | |
14 | + | |
15 | +inline int hex2dec_bcd(int hex) | |
16 | +{ | |
17 | + int i,m,n=0; | |
18 | + m=hex/16; | |
19 | + if(0x0<=m && m<=0x9){ | |
20 | + n+=m*10; | |
21 | + | |
22 | + }else{ | |
23 | + n+=0; | |
24 | + | |
25 | + } | |
26 | + m=hex-m; | |
27 | + if(0x0<=m && m<=0x9){ | |
28 | + n+=m; | |
29 | + | |
30 | + }else{ | |
31 | + n+=0; | |
32 | + | |
33 | + } | |
34 | + return n; | |
35 | + /* | |
36 | + int i,m,n; | |
37 | + n=hex; | |
38 | + m=0; | |
39 | + for(i=0xFFFF;i>0;i/=16) | |
40 | + { | |
41 | + m+=n/i; | |
42 | + n-=m*i; | |
43 | + m*=10; | |
44 | + } | |
45 | + return m;*/ | |
46 | +} |
@@ -0,0 +1,19 @@ | ||
1 | +/* | |
2 | +*System Functions | |
3 | +*(C) 2014 VOSystems. | |
4 | +*/ | |
5 | + | |
6 | +#ifndef _SYSTEM_H_VANE_ | |
7 | +#define _SYSTEM_H_VANE_ | |
8 | + | |
9 | +extern int vram_start_address; | |
10 | +extern char vmode; | |
11 | +extern short scrnX,scrnY; | |
12 | + | |
13 | +void init_qemuvga0(int x, int y, int c, int flag); | |
14 | +void set_qemuvga0reg(int reg, int dat); | |
15 | +void init_qemuvga0(int x, int y, int c, int flag); | |
16 | +void readrtc(unsigned char *t); | |
17 | +void printtime(void); | |
18 | + | |
19 | +#endif |
@@ -47,5 +47,6 @@ void puts(const char* msg); | ||
47 | 47 | void putchar(const char); |
48 | 48 | void printOK(const char* msg); |
49 | 49 | int kbhit(void); |
50 | +void printTASK(const char* msg); | |
50 | 51 | |
51 | 52 | #endif |
@@ -46,5 +46,6 @@ void ClearScreen(void); | ||
46 | 46 | void puts(const char* msg); |
47 | 47 | void putchar(const char); |
48 | 48 | void printOK(const char* msg); |
49 | +int kbhit(void); | |
49 | 50 | |
50 | 51 | #endif |
@@ -0,0 +1,19 @@ | ||
1 | +/* | |
2 | +*lib c time header | |
3 | +*(C) 2014 VOSystems. | |
4 | +*/ | |
5 | + | |
6 | +#ifndef _TIME_H_VANE_ | |
7 | +#define _TIME_H_VANE_ | |
8 | + | |
9 | +typedef unsigned long long time_t; | |
10 | + | |
11 | +struct tm | |
12 | +{ | |
13 | + int tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_wday, tm_yday, tm_isdst; | |
14 | + unsigned long tm_year; | |
15 | +}; | |
16 | + | |
17 | +inline int hex2dec_bcd(int hex); | |
18 | + | |
19 | +#endif |
@@ -0,0 +1,18 @@ | ||
1 | +/* | |
2 | +*lib c time header | |
3 | +*(C) 2014 VOSystems. | |
4 | +*/ | |
5 | + | |
6 | +#ifndef _TIME_H_VANE_ | |
7 | +#define _TIME_H_VANE_ | |
8 | + | |
9 | +typedef time_t unsigned long long; | |
10 | +struct tm | |
11 | +{ | |
12 | + int tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_wday, tm_yday, tm_isdst; | |
13 | + unsigned long tm_year; | |
14 | +}; | |
15 | + | |
16 | +inline int hex2dec_bcd(int hex); | |
17 | + | |
18 | +#endif |