MentOS  0.8.0
The Mentoring Operating System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Functions | Variables
pic8259.c File Reference

pic8259 definitions. More...

Macros

#define __DEBUG_HEADER__   "[PIC ]"
 Change header.
 
#define __DEBUG_LEVEL__   LOGLEVEL_NOTICE
 Set log level.
 
#define EOI   0x20
 End-of-interrupt command code.
 
#define MASTER_PORT_COMMAND   0x20
 IO base address for master PIC.
 
#define MASTER_PORT_DATA   (MASTER_PORT_COMMAND + 1)
 I/O address for data to master.
 
#define SLAVE_PORT_COMMAND   0xA0
 IO base address for slave PIC.
 
#define SLAVE_PORT_DATA   (SLAVE_PORT_COMMAND + 1)
 I/O address for data to slave.
 
#define ICW1_ICW4   0x01
 ICW4 (not) needed.
 
#define ICW1_SINGLE   0x02
 Single (cascade) mode.
 
#define ICW1_INTERVAL4   0x04
 Call address interval 4 (8).
 
#define ICW1_LEVEL   0x08
 Level triggered (edge) mode.
 
#define ICW1_INIT   0x10
 Initialization - required.
 
#define ICW4_8086   0x01
 8086/88 (MCS-80/85) mode
 
#define ICW4_AUTO   0x02
 Auto (normal) EOI.
 
#define ICW4_BUF_SLAVE   0x08
 Buffered mode/slave.
 
#define ICW4_BUF_MASTER   0x0C
 Buffered mode/master.
 
#define ICW4_SFNM   0x10
 Special fully nested (not).
 
#define PIC_READ_IRR   0x0A
 OCW3 irq ready next CMD read.
 
#define PIC_READ_ISR   0x0B
 OCW3 irq service next CMD read.
 

Functions

void pic8259_init_irq (void)
 Function that initializes the processor pic 8259 that will manage the interruptions.
 
int pic8259_irq_enable (uint32_t irq)
 This function, enable irqs on the pic. More...
 
int pic8259_irq_disable (uint32_t irq)
 This function, disable irqs on the pic. More...
 
void pic8259_send_eoi (uint32_t irq)
 This is issued to the PIC chips at the end of an IRQ-based interrupt routine. More...
 

Variables

static byte_t master_cur_mask
 The current mask of the master.
 
static byte_t slave_cur_mask
 The current mask of the slave.
 

Detailed Description

pic8259 definitions.

Function Documentation

◆ pic8259_irq_disable()

int pic8259_irq_disable ( uint32_t  irq)

This function, disable irqs on the pic.

This function provide a tool for enabling irq from the pic processor.

Parameters
irqNumber of irq to enable.
Returns
0 If all OK, -1 on errors.

◆ pic8259_irq_enable()

int pic8259_irq_enable ( uint32_t  irq)

This function, enable irqs on the pic.

This function provide a tool for enabling irq from the pic processor.

Parameters
irqNumber of irq to enable.
Returns
0 If all OK, -1 on errors.

◆ pic8259_send_eoi()

void pic8259_send_eoi ( uint32_t  irq)

This is issued to the PIC chips at the end of an IRQ-based interrupt routine.

Parameters
irqThe interrupt number.