student-distrib/i8259.c
void send_eoi(uint32_t irq_num) {
	/* End-of-interrupt byte gets OR'd with
	* the interrupt number and sent out to the PIC
	* to declare the interrupt finished */
	
	// If irq_num 0-7, use master PIC
	if((irq_num >= 0) && (irq_num < 8)) {
		outb((EOI | irq_num), MASTER_8259_PORT);
	} else if ((irq_num >= 8) && (irq_num < 16)) {
		// If irq_num 8-15, use slave PIC
		// irq_num - 8 as slave sees irqs 8-15 as 0-7
		outb((EOI | (irq_num - 8)), SLAVE_8259_PORT);
		
		// Need to also send EOI to master at port slave is attached to, which is irq2 on master, hence the 0x2
		outb((EOI | 0x2), MASTER_8259_PORT);
	} else // Invalid irq, so just return
		return;
}
/* send_eoi(): Send end-of-interrupt signal for the specified IRQ (heffley)
 * Inputs: irq_num, valid 0-15, that tells which irq to signal EOI to
 * Returns: none
 * Effects: Signals EOI for given irq, if on slave, signals to the master irq which is connected to the slave
 */
Send end-of-interrupt signal for the specified IRQ (heffley)
Inputs: irq_num, valid 0-15, that tells which irq to signal EOI to
Returns: none
Effects: Signals EOI for given irq, if on slave, signals to the master irq which is connected to the slave
Send end - of - interrupt signal for the specified IRQ ( heffley ) Inputs : irq_num valid 0 - 15 that tells which irq to signal EOI to Returns : none Effects : Signals EOI for given irq if on slave signals to the master irq which is connected to the slave
void send_eoi(uint32_t irq_num) {
	if((irq_num >= 0) && (irq_num < 8)) {
		outb((EOI | irq_num), MASTER_8259_PORT);
	} else if ((irq_num >= 8) && (irq_num < 16)) {
		outb((EOI | (irq_num - 8)), SLAVE_8259_PORT);
		outb((EOI | 0x2), MASTER_8259_PORT);
	} else 
		return;
}
void send_eoi ( uint32_t irq_num ) { if ( ( irq_num >= 0 ) && ( irq_num < 8 ) ) { outb ( ( EOI | irq_num ) , MASTER_8259_PORT ) ; } else if ( ( irq_num >= 8 ) && ( irq_num < 16 ) ) { outb ( ( EOI | ( irq_num - 8 ) ) , SLAVE_8259_PORT ) ; outb ( ( EOI | 0x2 ) , MASTER_8259_PORT ) ; } else return ; }
send_eoi(): Send end-of-interrupt signal for the specified IRQ (heffley)
 Inputs: irq_num, valid 0-15, that tells which irq to signal EOI to
 Returns: none
 Effects: Signals EOI for given irq, if on slave, signals to the master irq which is connected to the slave
send_eoi () : Send end - of - interrupt signal for the specified IRQ ( heffley ) Inputs : irq_num valid 0 - 15 that tells which irq to signal EOI to Returns : none Effects : Signals EOI for given irq if on slave signals to the master irq which is connected to the slave
/* End-of-interrupt byte gets OR'd with
	* the interrupt number and sent out to the PIC
	* to declare the interrupt finished */ // If irq_num 0-7, use master PIC // If irq_num 8-15, use slave PIC // irq_num - 8 as slave sees irqs 8-15 as 0-7 // Need to also send EOI to master at port slave is attached to, which is irq2 on master, hence the 0x2 // Invalid irq, so just return