Project

General

Profile

Revision 3

returns sys

View differences:

lab2/lab2.c
60 60
int(timer_test_int)(uint8_t time) {
61 61
  /* To be implemented by the students */
62 62

  
63
  if(time<0) return 1;
63
  if(time<0) 
64
  {
65
    printf("INVALID TIME!");
66
  return 1;
67
  }
64 68

  
65 69
  int ipc_status;
66 70
  message msg;
lab2/timer.c
58 58
 /*  int policy;
59 59
  sys_irqrmpolicy(&policy); */
60 60
  hook_id=*bit_no;
61
  sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id);
61
  if(sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id)!=0) return 1;
62 62

  
63
  return 1;
63
  return 0;
64 64
}
65 65

  
66 66
int (timer_unsubscribe_int)() {
67 67
  /* To be implemented by the students */
68 68
// printf("%s is not yet implemented!\n", __func__);
69 69

  
70
sys_irqrmpolicy(&hook_id);
70
  if(sys_irqrmpolicy(&hook_id)!=0) return 1;
71 71

  
72
  return 1;
72
  return 0;
73 73
}
74 74

  
75 75
void (timer_int_handler)() {
lab2/utils.c
20 20
int (util_sys_inb)(int port, uint8_t *value) {
21 21
  /* To be implemented by the students */
22 22
  uint32_t b32;
23
 sys_inb(port,&b32);
23
 if(sys_inb(port,&b32)!=0)return 1;
24 24
 //printf("%x",b32);
25 25
 *value=b32&0xFF;
26 26
 //printf("%x\n",*value);

Also available in: Unified diff