Rev 1888 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1888 | Rev 1930 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
- | 35 | #include <ddi/irq.h> |
|
35 | #include <interrupt.h> |
36 | #include <interrupt.h> |
36 | #include <arch/interrupt.h> |
37 | #include <arch/interrupt.h> |
37 | #include <arch/types.h> |
38 | #include <arch/types.h> |
38 | #include <arch.h> |
39 | #include <arch.h> |
39 | #include <time/clock.h> |
40 | #include <time/clock.h> |
40 | #include <ipc/sysipc.h> |
41 | #include <ipc/sysipc.h> |
- | 42 | #include <arch/drivers/pic.h> |
|
- | 43 | #include <arch/mm/tlb.h> |
|
- | 44 | #include <print.h> |
|
41 | 45 | ||
42 | 46 | ||
43 | void start_decrementer(void) |
47 | void start_decrementer(void) |
44 | { |
48 | { |
45 | asm volatile ( |
49 | asm volatile ( |
Line 48... | Line 52... | ||
48 | : "r" (1000) |
52 | : "r" (1000) |
49 | ); |
53 | ); |
50 | } |
54 | } |
51 | 55 | ||
52 | 56 | ||
- | 57 | /** Handler of external interrupts */ |
|
- | 58 | static void exception_external(int n, istate_t *istate) |
|
- | 59 | { |
|
- | 60 | int inum; |
|
- | 61 | ||
- | 62 | while ((inum = pic_get_pending()) != -1) { |
|
- | 63 | irq_t *irq = irq_dispatch_and_lock(inum); |
|
- | 64 | if (irq) { |
|
- | 65 | /* |
|
- | 66 | * The IRQ handler was found. |
|
- | 67 | */ |
|
- | 68 | irq->handler(irq, irq->arg); |
|
- | 69 | spinlock_unlock(&irq->lock); |
|
- | 70 | } else { |
|
- | 71 | /* |
|
- | 72 | * Spurious interrupt. |
|
- | 73 | */ |
|
- | 74 | #ifdef CONFIG_DEBUG |
|
- | 75 | printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum); |
|
- | 76 | #endif |
|
- | 77 | } |
|
- | 78 | pic_ack_interrupt(inum); |
|
- | 79 | } |
|
- | 80 | } |
|
- | 81 | ||
- | 82 | ||
53 | static void exception_decrementer(int n, istate_t *istate) |
83 | static void exception_decrementer(int n, istate_t *istate) |
54 | { |
84 | { |
55 | clock(); |
85 | clock(); |
56 | start_decrementer(); |
86 | start_decrementer(); |
57 | } |
87 | } |
58 | 88 | ||
59 | 89 | ||
60 | /* Initialize basic tables for exception dispatching */ |
90 | /* Initialize basic tables for exception dispatching */ |
61 | void interrupt_init(void) |
91 | void interrupt_init(void) |
62 | { |
92 | { |
- | 93 | exc_register(VECTOR_EXTERNAL, "external", exception_external); |
|
63 | exc_register(VECTOR_DECREMENTER, "timer", exception_decrementer); |
94 | exc_register(VECTOR_DECREMENTER, "timer", exception_decrementer); |
64 | } |
95 | } |
65 | 96 | ||
66 | - | ||
67 | /* Reregister irq to be IPC-ready */ |
- | |
68 | void irq_ipc_bind_arch(unative_t irq) |
- | |
69 | { |
- | |
70 | panic("not implemented\n"); |
- | |
71 | /* TODO */ |
- | |
72 | } |
- | |
73 | - | ||
74 | /** @} |
97 | /** @} |
75 | */ |
98 | */ |