• R/O
  • SSH
  • HTTPS

chnosproject: コミット


コミットメタ情報

リビジョン316 (tree)
日時2012-03-15 21:49:08
作者hikarupsp

ログメッセージ

キーボードのLED制御を追加。Bochsで確認。
FIFOバッファオーバーフロー時にメッセージを表示するように変更。

シート表示にバグがあることが判明したので(シートを移動させるとそれより下のシートが通った時に消えることがる)、修正の必要あり。
保存コミット。

変更サマリ

差分

--- beta/tolset_chn_000/chnos_010/chnos/keyboard.c (revision 315)
+++ beta/tolset_chn_000/chnos_010/chnos/keyboard.c (revision 316)
@@ -7,9 +7,9 @@
77 union STATE_KEYLOCK {
88 uchar keylock;
99 struct STATE_KEYLOCK_KEY {
10+ unsigned scroll : 1;
1011 unsigned num : 1;
1112 unsigned caps : 1;
12- unsigned scroll : 1;
1313 } key;
1414 } state_keylock;
1515
@@ -41,6 +41,7 @@
4141
4242 uint key_decode_phase;
4343 uchar key_decode_buf[4];
44+uchar kbc_retv;
4445
4546 /*キーコード変換テーブル*/
4647 ushort Keyboard_KeyCodeTable[0x80] = {
@@ -338,7 +339,7 @@
338339 {
339340 uint data;
340341
341- data = IO_In8(KEYB_DATA);
342+ data = IO_In8(PORT_KEYDATA);
342343
343344 ProgrammableInterruptController_InterruptRequest_Complete(0x01);
344345
@@ -346,6 +347,10 @@
346347 FIFO32_Put(kbd_fifo, data + kbd_data0);
347348 }
348349
350+ if(data == KEYDATA_ACK || data == KEYDATA_RESEND){
351+ kbc_retv = data;
352+ }
353+
349354 return;
350355 }
351356
@@ -430,6 +435,7 @@
430435 } else{
431436 state_keylock.key.caps = True;
432437 }
438+ KeyboardController_SetLED(state_keylock.keylock);
433439 }
434440 } else if(keyid == (KEYID_MASK_EXTENDED | KEYID_LOCK_NUM)){
435441 if(!(key_decode_buf[0] & KEYID_MASK_BREAK)){
@@ -438,6 +444,7 @@
438444 } else{
439445 state_keylock.key.num = True;
440446 }
447+ KeyboardController_SetLED(state_keylock.keylock);
441448 }
442449 } else if(keyid == (KEYID_MASK_EXTENDED | KEYID_LOCK_SCROOL)){
443450 if(!(key_decode_buf[0] & KEYID_MASK_BREAK)){
@@ -446,6 +453,7 @@
446453 } else{
447454 state_keylock.key.scroll = True;
448455 }
456+ KeyboardController_SetLED(state_keylock.keylock);
449457 }
450458 }
451459 }
@@ -542,3 +550,54 @@
542550
543551 return keyid;
544552 }
553+
554+void KeyboardController_SetLED(uchar leds)
555+{
556+ KeyboardController_SendData(KEYCMD_LED);
557+ KeyboardController_SendData(leds);
558+ return;
559+}
560+
561+void KeyboardController_Wait_SendReady(void)
562+{
563+ for(;;){
564+ if((IO_In8(PORT_KEYSTA) & KEYSTA_SEND_NOTREADY) == 0) {
565+ break;
566+ }
567+ }
568+ return;
569+}
570+
571+void KeyboardController_SendData(uchar data)
572+{
573+ for(;;){
574+ kbc_retv = 0;
575+ KeyboardController_Wait_SendReady();
576+ IO_Out8(PORT_KEYDATA, data);
577+ for(;;){
578+ if(kbc_retv == KEYDATA_ACK){
579+ return;
580+ }
581+ if(kbc_retv == KEYDATA_RESEND){
582+ break;
583+ }
584+ }
585+ }
586+}
587+
588+void KeyboardController_SendCommand(uchar cmd)
589+{
590+ for(;;){
591+ kbc_retv = 0;
592+ KeyboardController_Wait_SendReady();
593+ IO_Out8(PORT_KEYCMD, cmd);
594+ for(;;){
595+ if(kbc_retv == KEYDATA_ACK){
596+ return;
597+ }
598+ if(kbc_retv == KEYDATA_RESEND){
599+ break;
600+ }
601+ }
602+ }
603+}
--- beta/tolset_chn_000/chnos_010/chnos/error.c (revision 315)
+++ beta/tolset_chn_000/chnos_010/chnos/error.c (revision 316)
@@ -152,16 +152,21 @@
152152 Error_Put_String("No More Free Tag(Control:0x%08X).", *va_args);
153153 } else if(error_no == ERROR_INVALID_FREE_MEMORY_INDEX){
154154 Error_Put_String("Invalid Free Memory Index(Control:0x%08X TagIndex:%u).", *va_args, *(va_args + 1));
155+ } else if(error_no == ERROR_FIFO_BUFFER_OVERFLOW){
156+ Error_Put_String("FIFO Buffer Overflow(FIFO:0x%08X).", *va_args);
155157 } else{
156158 Error_Put_String("Unknown Error Number.");
157159 Error_Abort();
158160 }
159161 }
162+ Error_Put_String("Continue.");
163+ Error_Output_Display_GraphicMode_UsedLines = 0;
160164 return 0;
161165 }
162166
163167 void Error_Abort(void)
164168 {
169+ Error_Put_String("Abort.");
165170 IO_CLI();
166171 for(;;){
167172 IO_HLT();
@@ -199,7 +204,7 @@
199204 if(Error_Output_Enable_Display_GraphicMode){
200205 if(Error_Output_Display_GraphicMode_Lines > Error_Output_Display_GraphicMode_UsedLines){
201206 Drawing_Fill_Rectangle(Error_Output_Display_GraphicMode_VRAM, Error_Output_Display_GraphicMode_ResolutionX, 0xc6c6c6, 0, Error_Output_Display_GraphicMode_UsedLines << 4, Error_Output_Display_GraphicMode_ResolutionX - 1, (Error_Output_Display_GraphicMode_UsedLines << 4) + 16 - 1);
202- Drawing_Put_String(Error_Output_Display_GraphicMode_VRAM, Error_Output_Display_GraphicMode_ResolutionX, 0, Error_Output_Display_GraphicMode_UsedLines << 4, 0x000000, s);
207+ Drawing_Put_String(Error_Output_Display_GraphicMode_VRAM, Error_Output_Display_GraphicMode_ResolutionX, 0, Error_Output_Display_GraphicMode_UsedLines << 4, 0xffffff, s);
203208 Error_Output_Display_GraphicMode_UsedLines++;
204209 }
205210 }
--- beta/tolset_chn_000/chnos_010/chnos/core.h (revision 315)
+++ beta/tolset_chn_000/chnos_010/chnos/core.h (revision 316)
@@ -188,6 +188,9 @@
188188 void InterruptHandler21(uint *esp);
189189 void Keyboard_Set_ReceiveFIFO(DATA_FIFO32 *fifo, uint data0);
190190 ushort Keyboard_Decode_KeyCode(uchar keycode);
191+void KeyboardController_SetLED(uchar leds);
192+void KeyboardController_Wait_SendReady(void);
193+void KeyboardController_SendData(uchar data);
191194
192195 /*memory.c メモリ関連*/
193196 uint Memory_Test(uint start, uint end);
@@ -225,6 +228,10 @@
225228 uint Sheet_Slide_Relative(UI_Sheet *sheet, int rpx, int rpy);
226229 uint Sheet_RefreshAllInRange(UI_Sheet *parent, int px0, int py0, int px1, int py1);
227230 uint Sheet_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
231+uint Sheet_RefreshMap(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
232+uint Sheet_RefreshMap_All(UI_Sheet *sheet);
233+uint Sheet_EnableInvisibleColor(UI_Sheet *sheet, uint invcol);
234+uint Sheet_DisableInvisibleColor(UI_Sheet *sheet);
228235
229236 /*sht08.c 8bitカラー シート関連*/
230237 uint Sheet08_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp);
@@ -232,6 +239,7 @@
232239 uint Sheet08_Internal_RefreshSheet_To_08(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
233240 uint Sheet08_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
234241 uint Sheet08_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
242+bool Sheet08_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py);
235243
236244 /*sht16.c 16bitカラー シート関連*/
237245 uint Sheet16_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp);
@@ -239,6 +247,7 @@
239247 uint Sheet16_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
240248 uint Sheet16_Internal_RefreshSheet_To_08(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
241249 uint Sheet16_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
250+bool Sheet16_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py);
242251
243252 /*sht32.c 32bitカラー シート関連*/
244253 uint Sheet32_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp);
@@ -246,6 +255,7 @@
246255 uint Sheet32_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
247256 uint Sheet32_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
248257 uint Sheet32_Internal_RefreshSheet_To_08_xy(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
258+bool Sheet32_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py);
249259
250260 /*shtfunc.c シート内部関数*/
251261 uint Sheet_Internal_GetLocationP(UI_Sheet *sheet, DATA_Location2D *dest);
@@ -261,6 +271,7 @@
261271 uint Sheet_Internal_MapRefresh(UI_Sheet *sheet, int px0, int py0, int px1, int py1, bool nolocationchanged);
262272 uint Sheet_Internal_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
263273 uint Sheet_Internal_SlideSub(UI_Sheet *sheet, int rpx, int rpy);
274+bool Sheet_Internal_IsVisiblePixel_Invalid(UI_Sheet *sheet, int px, int py);
264275
265276 /*system.c システムデータ・初期化関連*/
266277 void Initialise_System(void);
--- beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 315)
+++ beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 316)
@@ -156,9 +156,6 @@
156156 Sheet_SetParent(sheet_desktop, vramsheet);
157157 Sheet_Show(sheet_desktop, 0, 0, 0);
158158
159- Sheet_SetParent(testsheet, vramsheet);
160- Sheet_Show(testsheet, 1, 10, 10);
161-
162159 Sheet_SetParent(testsheet2, vramsheet);
163160 Sheet_Show(testsheet2, 2, 80, 80);
164161
@@ -171,6 +168,9 @@
171168 Sheet_SetParent(sheet32, vramsheet);
172169 Sheet_Show(sheet32, 2, 420, vramsheet->size.y >> 1);
173170
171+ Sheet_SetParent(testsheet, vramsheet);
172+ Sheet_Show(testsheet, 6, 10, 10);
173+
174174 timer1 = Timer_Initialise();
175175 Timer_Config(timer1, 50, mytask->fifo, 11, True);
176176 counter1 = 0;
--- beta/tolset_chn_000/chnos_010/chnos/keyid.h (revision 315)
+++ beta/tolset_chn_000/chnos_010/chnos/keyid.h (revision 316)
@@ -9,9 +9,9 @@
99 //bit09 :Shiftキー状態(0:オフ,1:オン)
1010 //bit10 :Ctrlキー状態(0:オフ,1:オン)
1111 //bit11 :Altキー状態(0:オフ,1:オン)
12-//bit12 :NumLock状態(0:オフ,1:オン)
13-//bit13 :CapsLock状態(0:オフ,1:オン)
14-//bit14 :ScrollLock状態(0:オフ,1:オン)
12+//bit12 :ScrollLock状態(0:オフ,1:オン)
13+//bit13 :NumLock状態(0:オフ,1:オン)
14+//bit14 :CapsLock状態(0:オフ,1:オン)
1515 //bit15 :拡張フラグ(0:ASCII,1:拡張キーコード)
1616
1717 //つまり、FIFOで受け取って、バイアスを引いたら、KEYID_EXTENDEDフラグを調べる。
@@ -24,9 +24,9 @@
2424 #define KEYID_MASK_STATE_SHIFT 0x0200
2525 #define KEYID_MASK_STATE_CTRL 0x0400
2626 #define KEYID_MASK_STATE_ALT 0x0800
27-#define KEYID_MASK_STATE_LOCK_NUM 0x1000
28-#define KEYID_MASK_STATE_LOCK_CAPS 0x2000
29-#define KEYID_MASK_STATE_LOCK_SCROOL 0x4000
27+#define KEYID_MASK_STATE_LOCK_SCROOL 0x1000
28+#define KEYID_MASK_STATE_LOCK_NUM 0x2000
29+#define KEYID_MASK_STATE_LOCK_CAPS 0x4000
3030 #define KEYID_MASK_EXTENDED 0x8000
3131
3232 #define KEYID_ASCII_NUL 0x0000
--- beta/tolset_chn_000/chnos_010/chnos/fifo.c (revision 315)
+++ beta/tolset_chn_000/chnos_010/chnos/fifo.c (revision 316)
@@ -37,6 +37,7 @@
3737 debug("FIFO32_Put:Overflow data.\n");
3838 #endif
3939 fifo->flags.overflow = True;
40+ Error_Report(ERROR_FIFO_BUFFER_OVERFLOW, fifo);
4041 return -1;
4142 }
4243 fifo->buf[fifo->p] = data;
--- beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 315)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 316)
@@ -194,7 +194,7 @@
194194 #define PIC1_ICW4 0x00a1
195195
196196 /*KBD io port*/
197-#define KEYB_DATA 0x0060
197+#define PORT_KEYDATA 0x0060
198198 #define PORT_KEYSTA 0x0064
199199 #define KEYSTA_SEND_NOTREADY 0x02
200200 #define KEYCMD_WRITE_MODE 0x60
@@ -202,6 +202,8 @@
202202 #define PORT_KEYCMD 0x0064
203203 #define KEYCMD_SENDTO_MOUSE 0xd4
204204 #define KEYCMD_LED 0xed
205+#define KEYDATA_ACK 0xfa
206+#define KEYDATA_RESEND 0xfe
205207
206208 /*COM1 io port*/
207209 #define COM1_RX 0x03f8
@@ -288,11 +290,12 @@
288290 #define ERROR_CPU_EXCEPTION_1F 0x0000001f //int *esp
289291 #define ERROR_CPU_EXCEPTIONS 0x0000001f
290292
291-#define ERROR_NO_MORE_SEGMENT 0x00000020 //uint *retaddr
293+#define ERROR_NO_MORE_SEGMENT 0x00000020 //uint *retaddr
292294 #define ERROR_NOT_ENOUGH_FREE_MEMORY 0x00000021 //IO_MemoryControl ctrl, uint size
293295 #define ERROR_MEMORY_FREE_RANGE_OVERLAPPED 0x00000022 //IO_MemoryControl ctrl, uint tagno
294-#define ERROR_NO_MORE_FREE_TAG 0x00000023 //IO_MemoryControl ctrl
296+#define ERROR_NO_MORE_FREE_TAG 0x00000023 //IO_MemoryControl ctrl
295297 #define ERROR_INVALID_FREE_MEMORY_INDEX 0x00000024 //IO_MemoryControl ctrl, uint tagno
298+#define ERROR_FIFO_BUFFER_OVERFLOW 0x00000025 //DATA_FIFO32 *fifo
296299
297300 /*FIFO buffer*/
298301 #define SIGNAL_ARGUMENTS_END 0xfefe1234
--- beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 315)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 316)
@@ -418,6 +418,7 @@
418418 unsigned visible : 1;
419419 unsigned using_map : 1;
420420 unsigned vram_auto_allocated : 1;
421+ unsigned using_invcol : 1;
421422 } bit;
422423 } flags;
423424 void *vram;
@@ -424,8 +425,10 @@
424425 uint *map;
425426 uint vramsize;
426427 uint mapsize;
428+ uint invcol;
427429 uint (*Config_Functions)(struct UI_SHEET *sheet);
428430 uint (*RefreshSheet)(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1);
431+ bool (*IsVisiblePixel)(struct UI_SHEET *sheet, int px, int py);
429432 } UI_Sheet;
430433
431434 /*timer*/
旧リポジトリブラウザで表示