Project

General

Profile

Revision 19

implemented timer_subscribe_int and timer_unsubscribe_int. WARNING, timer_unsubscribe_int changed prototype

View differences:

lab2/timer.c
49 49
}
50 50

  
51 51
int (timer_subscribe_int)(uint8_t *bit_no) {
52
    /* To be implemented by the students */
53
    printf("%s is not yet implemented!\n", __func__);
54

  
55
    return 1;
52
    int hook_id = 2;
53
    if(sys_irqsetpolicy(TIMER0_IRQ, IRQ_REENABLE, &hook_id)) return 1;
54
    *bit_no = hook_id;
55
    return 0;
56 56
}
57 57

  
58
int (timer_unsubscribe_int)() {
59
    /* To be implemented by the students */
60
    printf("%s is not yet implemented!\n", __func__);
61

  
62
    return 1;
58
int (timer_unsubscribe_int)(uint8_t *bit_no) {
59
    int hook_id = *bit_no;
60
    if(sys_irqrmpolicy(&hook_id)) return 1;
61
    *bit_no = hook_id;
62
    return 0;
63 63
}
64 64

  
65 65
void (timer_int_handler)() {

Also available in: Unified diff