Project

General

Profile

Revision 66

minor change, added errors to lab3

View differences:

lab3/errors.h
1
#ifndef _ERRORS_H_
2
#define _ERRORS_H_
3

  
4
enum errors {
5
    SUCCESS = 0,    /* @brief Sucessful */
6
    NULL_PTR,       /* @brief Null Pointer Error */
7
    LCF_ERROR,      /* @brief Error originated on LCF */
8
    SBCR_ERROR,     /* @brief Error on Subscribing Interrupt */
9
    UNSBCR_ERROR,   /* @brief Error on Unsubscring Interrupt*/
10
    READ_ERROR,     /* @brief Error on Reading from Port */
11
    WRITE_ERROR,    /* @brief Error on Writing to Port */
12
    TIMEOUT_ERROR,  /* @brief Timeout error */
13
};
14

  
15
#endif /* end of include guard: _ERRORS_H_ */
0 16

  
lab3/keyboard.c
5 5
#include "kbc.h"
6 6
#include "kbc_macros.h"
7 7
#include "utils.h"
8
#include "errors.h"
8 9

  
9 10
int (subscribe_keyboard_interrupt)(uint8_t interrupt_bit, int *interrupt_id) {
10
    if (interrupt_id == NULL) return 1;
11
    if (interrupt_id == NULL) return NULL_PTR;
11 12
    *interrupt_id = interrupt_bit;
12
    return (sys_irqsetpolicy(KBC_IRQ, IRQ_REENABLE | IRQ_EXCLUSIVE, interrupt_id));
13
    if(sys_irqsetpolicy(KBC_IRQ, IRQ_REENABLE | IRQ_EXCLUSIVE, interrupt_id)) return SBCR_ERROR;
14
    return SUCCESS;
13 15
}
14 16

  
15 17
int done = 1;

Also available in: Unified diff