Project

General

Profile

Revision 380

fixed rtc

View differences:

interrupts_func.c
7 7
#include "hltp.h"
8 8
#include "utils.h"
9 9
#include "errors.h"
10
#include "rtc.h"
10 11

  
11 12
static int timer_subscribed = 0, timer_id;
12 13

  
......
16 17

  
17 18
static int uart_subscribed = 0, uart_id;
18 19

  
20
static int rtc_subscribed = 0, rtc_id;
21

  
19 22
static void (*const ih[])(void) =   {    timer_int_handler,
20 23
                                         kbc_ih,
21 24
                                         NULL,
......
24 27
                                         NULL,
25 28
                                         NULL,
26 29
                                         NULL,
30
                                         rtc_ih,
27 31
                                         NULL,
28 32
                                         NULL,
29 33
                                         NULL,
30
                                         NULL,
31 34
                                         mouse_ih,
32 35
                                         NULL,
33 36
                                         NULL,
......
110 113
        return SBCR_ERROR;
111 114
    }
112 115

  
116
    if (subscribe_rtc_interrupt(RTC_IRQ, &rtc_id)){
117
        printf("%s: failed to enable rtc interrupts.\n", __func__);
118
        if (unsubscribe_all())
119
            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
120
        return SBCR_ERROR;
121
    }
122
    rtc_subscribed = 1;
123
    rtc_set_updates_int(1);
124

  
125

  
126

  
113 127
    /// UART interrupt handling
114 128
    uart_id = 0;
115 129
    uart_set_bits_per_character(COM1_ADDR, 8);
......
170 184
        mouse_subscribed = 0;
171 185
    }
172 186

  
187
    if (rtc_subscribed) {
188
        if (unsubscribe_interrupt(&rtc_id)) {
189
            printf("%s: failed to unsubcribe RTC interrupts.\n", __func__);
190
            r = UNSBCR_ERROR;
191
        }
192
        rtc_subscribed = 0;
193
    }
194

  
173 195
    // Unsubscribe UART interrupts
174 196
    if (uart_subscribed) {
175 197
        if (unsubscribe_interrupt(&uart_id)) {

Also available in: Unified diff