mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-06-07 08:14:48 +00:00
Add PIC defines
This commit is contained in:
parent
c451c90414
commit
7f0d391858
@ -48,7 +48,6 @@ Changes include:
|
||||
- Fwd -> Forward
|
||||
- Glbls -> Globals
|
||||
- Hndlr -> Handler
|
||||
- Ints -> Interrupts
|
||||
- Lst -> List
|
||||
- Ms -> Mouse
|
||||
- Msg -> Message
|
||||
|
Binary file not shown.
Binary file not shown.
@ -46,14 +46,14 @@ interrupt U0 IRQComm3()
|
||||
{
|
||||
CommHandler(2);
|
||||
CommHandler(4);
|
||||
OutU8(0x20,0x20);
|
||||
OutU8(PIC1,PIC_EOI);
|
||||
}
|
||||
|
||||
interrupt U0 IRQComm4()
|
||||
{
|
||||
CommHandler(1);
|
||||
CommHandler(3);
|
||||
OutU8(0x20,0x20);
|
||||
OutU8(PIC1,PIC_EOI);
|
||||
}
|
||||
|
||||
U0 CommInit()
|
||||
@ -93,7 +93,7 @@ public CComm *CommInit8n1(I64 port,I64 baud)
|
||||
OutU8(c->base+UART_MCR,4);
|
||||
OutU8(c->base+UART_IER,0); //Disable all IRQ
|
||||
OutU8(c->base+UART_MCR,0xA); //out2 and rts
|
||||
OutU8(0x21,InU8(0x21) & (0xFF-0x18)); //Enable 8259 IRQ 3 & 4
|
||||
OutU8(PIC1_DATA,InU8(PIC1_DATA) & (0xFF-0x18));//Enable 8259 IRQ 3 & 4
|
||||
OutU8(c->base+UART_IER,1); //RX but no THR empty
|
||||
POPFD
|
||||
|
||||
|
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
@ -128,23 +128,23 @@ U8 *IntEntrySet(I64 irq,U0 (*fp_new_handler)(),I64 type=IDTET_IRQ,I64 dpl=0)
|
||||
|
||||
U0 IntsInit()
|
||||
{//Init 8259
|
||||
OutU8(0x20,0x11); //IW1
|
||||
OutU8(0xA0,0x11); //IW1
|
||||
OutU8(0x21,0x20); //IW2
|
||||
OutU8(0xA1,0x28); //IW2
|
||||
OutU8(0x21,0x04); //IW3
|
||||
OutU8(0xA1,0x02); //IW3
|
||||
OutU8(0x21,0x0D); //IW4
|
||||
OutU8(0xA1,0x09); //IW4
|
||||
OutU8(0x21,0xFA); //Mask all but IRQ0 (timer) and IRQ2 Cascade.
|
||||
OutU8(0xA1,0xFF);
|
||||
OutU8(PIC1,0x11); //IW1
|
||||
OutU8(PIC2,0x11); //IW1
|
||||
OutU8(PIC1_DATA,0x20); //IW2
|
||||
OutU8(PIC2_DATA,0x28); //IW2
|
||||
OutU8(PIC1_DATA,0x04); //IW3
|
||||
OutU8(PIC2_DATA,0x02); //IW3
|
||||
OutU8(PIC1_DATA,0x0D); //IW4
|
||||
OutU8(PIC2_DATA,0x09); //IW4
|
||||
OutU8(PIC1_DATA,0xFA); //Mask all but IRQ0 (timer) and IRQ2 Cascade.
|
||||
OutU8(PIC2_DATA,0xFF);
|
||||
}
|
||||
|
||||
interrupt U0 IntNop()
|
||||
{//Make unplanned IRQs stop by all means!
|
||||
OutU8(0xA0,0x20);
|
||||
OutU8(0x20,0x20);
|
||||
*(dev.uncached_alias+LAPIC_EOI)(U32 *)=0;
|
||||
OutU8(PIC2,PIC_EOI);
|
||||
OutU8(PIC1,PIC_EOI);
|
||||
*(dev.uncached_alias + LAPIC_EOI)(U32 *) = 0;
|
||||
}
|
||||
|
||||
interrupt U0 IntDivZero()
|
||||
|
@ -55,11 +55,11 @@ U0 IntCore0TimerHandler(CTask *)
|
||||
LBtr(&sys_semas[SEMA_SYS_TIMER],0);
|
||||
for (i=1;i<mp_count;i++)
|
||||
MPInt(I_TIMER,i);
|
||||
OutU8(0x20,0x20); //Acknowledge PIC Interrupt
|
||||
OutU8(PIC1,PIC_EOI); //Acknowledge PIC Interrupt
|
||||
}
|
||||
|
||||
I64 SysTimerRead()
|
||||
{//System timer count with overflow already handled.
|
||||
{//System timer count with overflow already handled.
|
||||
I64 i,res;
|
||||
PUSHFD
|
||||
CLI
|
||||
@ -69,7 +69,7 @@ I64 SysTimerRead()
|
||||
OutU8(PIT_CMD, PIT_CMDF_CHANNEL0); //Latch Timer0
|
||||
if ((i=InU8(PIT0) + InU8(PIT0) << 8) == SYS_TIMER0_PERIOD)
|
||||
{
|
||||
if (InU8(0x20) & 1)
|
||||
if (InU8(PIC1) & 1)
|
||||
i=-1;
|
||||
}
|
||||
res=counts.timer+SYS_TIMER0_PERIOD-i;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -495,8 +495,16 @@ class CKernel
|
||||
#define RLF_ONCE_USER 0x100000
|
||||
|
||||
#help_index "Processor"
|
||||
#define LAPIC_BASE 0xFEE00000
|
||||
|
||||
//Programmable Interrupt Controller
|
||||
#define PIC1 0x20
|
||||
#define PIC1_DATA 0x21
|
||||
#define PIC2 0xA0
|
||||
#define PIC2_DATA 0xA1
|
||||
#define PIC_EOI 0x20 //End of interrupt
|
||||
|
||||
//Local Advanced Programmable Interrupt Controller
|
||||
#define LAPIC_BASE 0xFEE00000
|
||||
#define LAPIC_APIC_ID (LAPIC_BASE+0x020)
|
||||
#define LAPIC_APIC_VERSION (LAPIC_BASE+0x030)
|
||||
#define LAPIC_TASK_PRIORITY (LAPIC_BASE+0x080)
|
||||
@ -551,7 +559,7 @@ class CAP16BitInit
|
||||
|
||||
#help_index "Time/PIT"
|
||||
#help_file "::/Doc/PIT.DD"
|
||||
//Programmable Interval Timer
|
||||
//Programmable Interval Timer
|
||||
#define PIT0 0x40
|
||||
#define PIT2 0x42
|
||||
#define PIT_CMD 0x43
|
||||
|
@ -411,7 +411,7 @@ U0 KbdPacketRead()
|
||||
interrupt U0 IRQKbd()
|
||||
{
|
||||
CLD
|
||||
OutU8(0x20,0x20);
|
||||
OutU8(PIC1,PIC_EOI);
|
||||
kbd.irqs_working=TRUE;
|
||||
if (mouse_hard.install_in_progress) {
|
||||
kbd.reset=TRUE;
|
||||
@ -435,7 +435,7 @@ U0 KbdInit()
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
IntEntrySet(0x21,&IRQKbd);
|
||||
OutU8(0x21,InU8(0x21)&~2);
|
||||
OutU8(PIC1_DATA,InU8(PIC1_DATA)&~2);
|
||||
}
|
||||
|
||||
U0 KbdHandler()
|
||||
|
@ -90,8 +90,8 @@ U0 MouseHardPacketRead()
|
||||
interrupt U0 IRQMouseHard()
|
||||
{
|
||||
CLD
|
||||
OutU8(0xA0,0x20);
|
||||
OutU8(0x20,0x20);
|
||||
OutU8(PIC2,PIC_EOI);
|
||||
OutU8(PIC1,PIC_EOI);
|
||||
mouse_hard.irqs_working=TRUE;
|
||||
if (mouse_hard.install_in_progress || !mouse_hard.installed) {
|
||||
kbd.reset=TRUE;
|
||||
@ -296,13 +296,13 @@ Bool MouseHardDriverInstall(I64 dummy=0) //can be spawned
|
||||
no_warn dummy;
|
||||
I64 i;
|
||||
mouse_hard.install_in_progress=TRUE;
|
||||
OutU8(0xA1,InU8(0xA1)|0x10);
|
||||
OutU8(PIC2_DATA,InU8(PIC2_DATA)|0x10);
|
||||
mouse_hard.installed=mouse_hard.irqs_working=FALSE;
|
||||
IntEntrySet(0x2C,&IRQMouseHard);
|
||||
for(i=0;i<5;i++)
|
||||
mouse_hard.bttns[i]=0;
|
||||
if (i=MouseHardReset)
|
||||
OutU8(0xA1,InU8(0xA1)&~0x10);
|
||||
OutU8(PIC2_DATA,InU8(PIC2_DATA)&~0x10);
|
||||
KbdMouseReset;
|
||||
mouse_hard.install_attempts++;
|
||||
mouse_hard.installed=mouse_hard.event=i;
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user