Revision 263
starting uart tests
interrupts_func.c | ||
---|---|---|
5 | 5 |
#include "i8254.h" |
6 | 6 |
#include "keyboard.h" |
7 | 7 |
#include "mouse.h" |
8 |
#include "uart.h" |
|
8 | 9 |
#include "utils.h" |
9 | 10 |
#include "errors.h" |
10 | 11 |
|
... | ... | |
14 | 15 |
|
15 | 16 |
static int mouse_subscribed = 0, mouse_id; |
16 | 17 |
|
18 |
static int uart_subscribed = 0, uart_id; |
|
19 |
|
|
17 | 20 |
static void (*const ih[])(void) = { timer_int_handler, |
18 | 21 |
kbc_ih, |
19 | 22 |
NULL, |
... | ... | |
96 | 99 |
return SBCR_ERROR; |
97 | 100 |
} |
98 | 101 |
|
102 |
/// UART interrupt handling |
|
103 |
uart_id = 0; |
|
104 |
uart_enable_int_rx (COM1_ADDR); |
|
105 |
uart_disable_int_tx(COM1_ADDR); |
|
106 |
if(subscribe_uart_interrupt(COM1_IRQ, &uart_id)) { |
|
107 |
printf("%s: failed to subscribe UART interrupts.\n", __func__); |
|
108 |
return SBCR_ERROR; |
|
109 |
} |
|
110 |
uart_subscribed = 1; |
|
111 |
|
|
99 | 112 |
return SUCCESS; |
100 | 113 |
} |
101 | 114 |
|
... | ... | |
141 | 154 |
mouse_subscribed = 0; |
142 | 155 |
} |
143 | 156 |
|
157 |
// Unsubscribe UART interrupts |
|
158 |
if (uart_subscribed) { |
|
159 |
if (unsubscribe_interrupt(&uart_id)) { |
|
160 |
printf("%s: failed to unsubcribe UART interrupts.\n"); |
|
161 |
r = UNSBCR_ERROR; |
|
162 |
} |
|
163 |
uart_enable_int_rx(COM1_ADDR); |
|
164 |
uart_enable_int_tx(COM1_ADDR); |
|
165 |
uart_subscribed = 0; |
|
166 |
} |
|
167 |
|
|
144 | 168 |
return r; |
145 | 169 |
} |
146 | 170 |
|
Also available in: Unified diff