Esempio n. 1
0
PUBLIC void keyboard_handler(int irq)
{
	u8 scan_code = in_byte(KB_DATA);
//	disp_int(scan_code);
//	disp_str(" ");
	VirtualKey key = '\0';
	bool make = !(scan_code & FLAG_BREAK);
	bool two_byte_code = FALSE;
	
	//若扫描码为0xe0则则直接插入缓冲区,然后返回
	if(scan_code == 0xe0){
		insert_kbuf(scan_code);
		return;
	}

	//先得到virtualkey
	if(keymap[(scan_code & 0x7f) * MAP_COLS + 2] == 0)
	{
		key = keymap[(scan_code & 0x7f) * MAP_COLS];
	}
	else{
		if(get_head_pre() == 0xe0){
			key = keymap[(scan_code & 0x7f) * MAP_COLS + 2];
			two_byte_code = TRUE;
		}
		else
			key = keymap[(scan_code & 0x7f) * MAP_COLS];
	}

	//只有普通键(非装饰键)的扫描码装入vk缓冲区
	if(make && !is_decorative_key(key)){
		insert_vkbuf(key);
	}
	if(two_byte_code)
		insert_kbuf_revocation();
	

//若为装饰键则要修改状态
	int i = 0;
	for(i = 0; i < NUM_DECORATIVE_KEY; i++){
		if(key == decorativeKey[i]){
			if(make)
				*(decorativeKeyStatus[i]) = VKEY_STATE_PRESSED;
			else
				*(decorativeKeyStatus[i]) = VKEY_STATE_RELEASED;
		}
	}

	kernelUnBlock(readKeyBlockEip);
//	u8 scan_code = in_byte(KB_DATA);
//
//	if (kb_in.count < KB_IN_BYTES) {
//		*(kb_in.p_head) = scan_code;
//		kb_in.p_head++;
//		if(kb_in.p_head == kb_in.buf + KB_IN_BYTES){
//			kb_in.p_head = kb_in.buf;
//		}
//		kb_in.count++;
//	}
}
Esempio n. 2
0
/**********************************************************
			hd_handler
***********************************************************
 interrupt handler

@param irq IRQ nr of the disk interrupt
***********************************************************/
PUBLIC void hd_handler(int irq)
{
//	disp_str("hd handler!!  ");
	hd_status = in_byte(REG_STATUS);
//	disp_int((void*)hd_handler);
//	disp_str("\nhd_status=");
//	disp_int(hd_status);
//	disp_str("\n");
//
//	disp_int(hdIdentifyBlockEip);
	kernelUnBlock(hdIdentifyBlockEip);
}
Esempio n. 3
0
PUBLIC int sysUnBlock(u32 pid)
{
	kernelUnBlock(pid);
}