예제 #1
0
fastcall void
Timer_InitPIT(uint16 divisor)
{
   IO_Out8(0x43, 0x34);
   IO_Out8(0x40, divisor & 0xFF);
   IO_Out8(0x40, divisor >> 8);
}
예제 #2
0
파일: mouse.c 프로젝트: hikalium/chnos
void Mouse_Send_Command(uint data)
{
    Keyboard_Controller_Wait_SendReady();
    IO_Out8(PORT_KEYCMD, KEYCMD_SENDTO_MOUSE);
    Keyboard_Controller_Wait_SendReady();
    IO_Out8(KEYB_DATA, data);
    return;
}
예제 #3
0
파일: mouse.c 프로젝트: hikalium/chnos
void InterruptHandler2c(int *esp)
{
    int data;

    data = IO_In8(KEYB_DATA);
    IO_Out8(PIC1_OCW2, 0x64);
    IO_Out8(PIC0_OCW2, 0x62);
    FIFO32_Put(sendto_m, data + offset_data_m);
    return;
}
예제 #4
0
파일: timer.c 프로젝트: hikalium/chnos
void InterruptHandler20(int *esp)
{
    UI_Timer *tree, *old;
    bool taskswitch;

    IO_Out8(PIC0_OCW2, 0x60);	/* IRQ-00受付完了をPICに通知 。0x60+番号。*/
    timerctrl.count++;
    taskswitch = false;

    if(timerctrl.count == timerctrl.next->timeout) {	//時間になった
        tree = timerctrl.next;
        timerctrl.next = timerctrl.next->next;
        for(;;) {	//同一タイムアウトを探す。
            if(tree->fifo != 0) {	//FIFOの送信先が有効かチェック
                FIFO32_Put(tree->fifo, tree->data);
            } else if(tree == timerctrl.ts) {
                taskswitch = true;
            }
            old = tree;
            tree = old->tree;
            old->tree = 0;	//同一タイムアウトなし
            old->state = configured;	//設定済み
            if(old->mode == interval) {	//繰り返すなら
                Timer_Run(old);
            }
            if(tree == 0) {	//もう同一タイムアウトはない
                break;
            }
        }
    }
    if(taskswitch) {
        MultiTask_TaskSwitch();
    }
    return;
}
예제 #5
0
파일: timer.c 프로젝트: hikalium/chnos
void Initialise_ProgrammableIntervalTimer(void)
{
    UI_Timer *watch;

    IO_Out8(PIT_CTRL, 0x34);
    IO_Out8(PIT_CNT0, 0x9c);
    IO_Out8(PIT_CNT0, 0x2e);
    System_GateDescriptor_Set(0x20, (uint)asm_InterruptHandler20, 0x02, AR_INTGATE32);
    IO_Out8(PIC0_IMR, IO_In8(PIC0_IMR) & 0xfe);
    timerctrl.count = 0;
    watch = Timer_Get(0, 0);
    watch->timeout = 0xFFFFFFFF;
    watch->count = 0xFFFFFFFF;
    watch->state = inuse;
    timerctrl.next = watch;
    timerctrl.ts = 0;

    return;
}
예제 #6
0
파일: timer.c 프로젝트: hikalium/chnos
UI_TimerControl *Initialize_ProgrammableIntervalTimer(void)
{
	timerctrl = (UI_TimerControl *)System_Memory_Allocate(sizeof(UI_TimerControl));

	timerctrl->tick_10ms = 0;
	timerctrl->TaskSwitch = &Timer_TaskSwitch_Invalid;

//config watch
	timerctrl->timer_root = Timer_Initialize();
	Timer_Config(timerctrl->timer_root, 0xfffffff, Null, 0, True);
	timerctrl->timer_root->timeout = 0xffffffff;
	timerctrl->timer_root->flags.bit.running = True;

//config PIT
	IO_Out8(PIT_CTRL, 0x34);
	IO_Out8(PIT_CNT0, 0x9c);
	IO_Out8(PIT_CNT0, 0x2e);
	System_GateDescriptor_Set(0x20, (uint)asm_InterruptHandler20, 0x02, AR_INTGATE32);
	ProgrammableInterruptController_InterruptMask_Clear(0x00);

	return timerctrl;
}
예제 #7
0
파일: mouse.c 프로젝트: hikalium/chnos
void Initialise_Mouse(DATA_FIFO *sendto, uint offset, UI_MouseInfo *decode)
{
    sendto_m = sendto;
    offset_data_m = offset;
    decode_m = decode;
    Emergency_Out("Mouse Initialise Start");
    decode->phase = 0;
    Mouse_Send_Command(MOUSECMD_RESET);
    Emergency_Out("Mouse Send Command");
    System_GateDescriptor_Set(0x2c, (uint)asm_InterruptHandler2c, 0x02, AR_INTGATE32);
    IO_Out8(PIC1_IMR, IO_In8(PIC1_IMR) & 0xef);
    Emergency_Out("Mouse Set INT");

    return;
}
예제 #8
0
파일: grap_08.c 프로젝트: hikalium/chnos
void Draw_Set_Palette(int start, int end, uchar *rgb)
{
	int i, eflags;

	eflags = IO_Load_EFlags();
	IO_CLI(); 
	IO_Out8(0x03c8, start);
	for (i = start; i <= end; i++) {
		IO_Out8(0x03c9, rgb[0] >> 2);
		IO_Out8(0x03c9, rgb[1] >> 2);
		IO_Out8(0x03c9, rgb[2] >> 2);
		rgb += 3;
	}
	IO_Store_EFlags(eflags);
	return;
}
예제 #9
0
파일: draw08.c 프로젝트: hikalium/chnos
void Drawing08_Set_Palette(uint start, uint end, uchar *rgb)
{
	uint i, eflags;

	eflags = IO_Load_EFlags();
	IO_CLI(); 
	IO_Out8(VGA_VDAC_WRITE_ADR, start);
	for (i = start; i <= end; i++) {
		IO_Out8(VGA_VDAC_DATA, rgb[0] >> 2);
		IO_Out8(VGA_VDAC_DATA, rgb[1] >> 2);
		IO_Out8(VGA_VDAC_DATA, rgb[2] >> 2);
		rgb += 3;
	}
	IO_Store_EFlags(eflags);
	return;
}
예제 #10
0
static void virtio_write8(UINT16 base, UINT16 offset, UINT8 val)
{
	IO_Out8(base+offset, val);
}
예제 #11
0
fastcall void
PCI_ConfigWrite8(const PCIAddress *addr, uint16 offset, uint8 data)
{
   IO_Out32(PCI_REG_CONFIG_ADDRESS, PCIConfigPackAddress(addr, offset));
   IO_Out8(PCI_REG_CONFIG_DATA, data);
}