Repository navigation
Expand file tree
/
Copy pathinterrupts.H
More file actions
executable file
·81 lines (58 loc) · 2.52 KB
/
Copy pathinterrupts.H
File metadata and controls
executable file
·81 lines (58 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
File: interrupts.H
Author: R. Bettati
Department of Computer Science
Texas A&M University
Date : 11/11/10
Description: High-level interrupt handling.
*/
#ifndef _interrupts_H_ // include file only once
#define _interrupts_H_
/*--------------------------------------------------------------------------*/
/* INCLUDES */
/*--------------------------------------------------------------------------*/
#include "utils.H"
#include "assert.H"
#include "machine.H"
#include "exceptions.H"
/*--------------------------------------------------------------------------*/
/* I n t e r r u p t H a n d l e r */
/*--------------------------------------------------------------------------*/
class InterruptHandler {
private:
/* The Interrupt Handler Table */
const static int IRQ_TABLE_SIZE = 16;
const static int IRQ_BASE = 32;
static InterruptHandler * handler_table[IRQ_TABLE_SIZE];
static BOOLEAN generated_by_slave_PIC(unsigned int int_no);
/* Has the particular interupt been generated by the Slave PIC? */
public:
/* -- POPULATE INTERRUPT-DISPATCHER TABLE */
static void register_handler(unsigned int _irq_code,
InterruptHandler * _handler);
/* This function allows to install an interrupt handler for the given
Interrupt code. The handler is a function pointer defined above.
Interrupt handlers are installed as Interrupt handlers as well.
The 'register_interrupt' function uses irq2isr to map the IRQ
number to the code. */
static void deregister_handler(unsigned int _irq_code);
/* -- INITIALIZER */
static void init_dispatcher();
/* This function is called to initialize the high-level interrupt
handling. No high level interrupt handlers are installed yet.
If an interrupt occurs at this point, the system displays an error
message and terminates. */
static void dispatch_interrupt(REGS * _r);
/* This is the high-level interrupt dispatcher. It dispatches the interrupt
to the previously registered interrupt handler.
This function is called by the low-level function
"lowlevel_dispatch_interrupt(REGS * _r)".*/
/* -- MANAGE INSTANCES OF INTERRUPT HANDLERS */
virtual void handle_interrupt(REGS * _regs) {
assert(FALSE); // pure virtual functions don't link correctly.
}
/* Different interrupt handlers are derived from the base class
InterruptHandler, and their functionality is implemented in
this function.*/
};
#endif