]> Devi Nivas Git - cs3210-lab0.git/commitdiff
comments; rename irq_ to pic_
authorrsc <rsc>
Tue, 28 Aug 2007 19:04:36 +0000 (19:04 +0000)
committerrsc <rsc>
Tue, 28 Aug 2007 19:04:36 +0000 (19:04 +0000)
console.c
defs.h
ide.c
init.c
ioapic.c
kbd.c
mp.c
picirq.c
timer.c

index 22b4b23dddfc3ff42628e6d15769a597dd4785aa..236beaa9942367140f319545b0edf8e2d6f32d6a 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1,3 +1,7 @@
+// Console input and output.
+// Input is from the keyboard only.
+// Output is written to the screen and the printer port.
+
 #include "types.h"
 #include "defs.h"
 #include "param.h"
@@ -278,7 +282,7 @@ console_init(void)
   devsw[CONSOLE].read = console_read;
   //use_console_lock = 1;
 
-  irq_enable(IRQ_KBD);
+  pic_enable(IRQ_KBD);
   ioapic_enable(IRQ_KBD, 0);
 }
 
diff --git a/defs.h b/defs.h
index 35323ea507930a0f7522b146a4d73a1a5a558222..fa9c502a02446f87edb7fb59fec3577637873e02 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -85,7 +85,7 @@ void            mp_init(void);
 void            mp_startthem(void);
 
 // picirq.c
-void            irq_enable(int);
+void            pic_enable(int);
 void            pic_init(void);
 
 // pipe.c
diff --git a/ide.c b/ide.c
index 78c3123dde95d884d74171223ead79980795e993..74457978442d0a7fb3e18b97d3ab94c0f17cf1f5 100644 (file)
--- a/ide.c
+++ b/ide.c
@@ -47,7 +47,7 @@ ide_init(void)
   int i;
 
   initlock(&ide_lock, "ide");
-  irq_enable(IRQ_IDE);
+  pic_enable(IRQ_IDE);
   ioapic_enable(IRQ_IDE, ncpu - 1);
   ide_wait_ready(0);
   
diff --git a/init.c b/init.c
index d3e118287c1906c3219b0f265ab54c8356ce0237..e15cccf62fcadcfde3c3e5294c8327313485fecb 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1,10 +1,10 @@
+// init: The initial user-level program
+
 #include "types.h"
 #include "stat.h"
 #include "user.h"
 #include "fcntl.h"
 
-// init: The initial user-level program
-
 char *sh_args[] = { "sh", 0 };
 
 int
index 8da31512213cd00767d9d74b6ddb287fed3247c5..65eec1fb28bea9c1fb0c47426b60b0f68081d33a 100644 (file)
--- a/ioapic.c
+++ b/ioapic.c
@@ -1,5 +1,6 @@
 // The I/O APIC manages hardware interrupts for an SMP system.
 // http://www.intel.com/design/chipsets/datashts/29056601.pdf
+// See also picirq.c.
 
 #include "types.h"
 #include "defs.h"
diff --git a/kbd.c b/kbd.c
index a4a4a4ed5ad00b1ab2ddebb512bf9af04f46129c..24839494d880147942d6054df4241245f77529c1 100644 (file)
--- a/kbd.c
+++ b/kbd.c
@@ -48,4 +48,3 @@ kbd_intr(void)
 {
   console_intr(kbd_getc);
 }
-
diff --git a/mp.c b/mp.c
index cc2ab067fd371943ce68f2a5717c08d75d20f640..af9e72b1eba9c2e7414715f0ab054acdc44d747d 100644 (file)
--- a/mp.c
+++ b/mp.c
@@ -1,3 +1,5 @@
+// Multiprocessor bootstrap.
+// Search memory for MP description structures.
 // http://developer.intel.com/design/pentium/datashts/24201606.pdf
 
 #include "types.h"
index 7c5f71307dbb3f4db8e2d183ecf18041cdcbe025..1cc99530a9fd2f5b9e6eff93f25349dbdfd4c427 100644 (file)
--- a/picirq.c
+++ b/picirq.c
@@ -1,8 +1,10 @@
+// Intel 8259A programmable interrupt controllers.
+
 #include "types.h"
 #include "x86.h"
 #include "traps.h"
 
-// I/O Addresses of the two 8259A programmable interrupt controllers
+// I/O Addresses of the two programmable interrupt controllers
 #define IO_PIC1         0x20    // Master (IRQs 0-7)
 #define IO_PIC2         0xA0    // Slave (IRQs 8-15)
 
 
 // Current IRQ mask.
 // Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
-static ushort irq_mask_8259A = 0xFFFF & ~(1<<IRQ_SLAVE);
+static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);
 
 static void
-irq_setmask_8259A(ushort mask)
+pic_setmask(ushort mask)
 {
-  irq_mask_8259A = mask;
-
-  outb(IO_PIC1+1, (char)mask);
-  outb(IO_PIC2+1, (char)(mask >> 8));
+  irqmask = mask;
+  outb(IO_PIC1+1, mask);
+  outb(IO_PIC2+1, mask >> 8);
 }
 
 void
-irq_enable(int irq)
+pic_enable(int irq)
 {
-  irq_setmask_8259A(irq_mask_8259A & ~(1<<irq));
+  pic_setmask(irqmask & ~(1<<irq));
 }
 
 // Initialize the 8259A interrupt controllers.
@@ -78,6 +79,6 @@ pic_init(void)
   outb(IO_PIC2, 0x68);             // OCW3
   outb(IO_PIC2, 0x0a);             // OCW3
 
-  if(irq_mask_8259A != 0xFFFF)
-    irq_setmask_8259A(irq_mask_8259A);
+  if(irqmask != 0xFFFF)
+    pic_setmask(irqmask);
 }
diff --git a/timer.c b/timer.c
index ba4e6c41e45d8cf0a3fbd7b54d8944dae8b2d975..89700dc4a9ca84921d589316173928c080ed9442 100644 (file)
--- a/timer.c
+++ b/timer.c
@@ -28,5 +28,5 @@ timer_init(void)
   outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
   outb(IO_TIMER1, TIMER_DIV(100) % 256);
   outb(IO_TIMER1, TIMER_DIV(100) / 256);
-  irq_enable(IRQ_TIMER);
+  pic_enable(IRQ_TIMER);
 }