Project

General

Profile

Revision 7

2 func finished sys_inb count finished

View differences:

lab3/Makefile
7 7
# additional compilation flags
8 8
# "-Wall -Wextra -Werror -I . -std=c11 -Wno-unused-parameter" are already set
9 9
CFLAGS += -pedantic
10
CPPFLAGS += -D LAB3
10 11

  
11 12
# list of library dependencies (for Lab 2, only LCF library)
12 13
DPADD += ${LIBLCF}
lab3/lab3.c
7 7
#include <stdint.h>
8 8
//#include <timer.c>
9 9

  
10

  
10 11
#define IRQ_KB 1
11 12
#define DELAY_US 20000
12 13
#define EXIT_CODE 0x81
......
50 51
  scan_arr[0] = scancode & 0xFF;
51 52
  scan_arr[1] = scancode & 0xFF00;
52 53
  int flag = 0;
54
  uint32_t cnt=0;
53 55

  
54 56
  printf("%d\n",
55 57
         sys_irqsetpolicy(IRQ_KB, IRQ_REENABLE | IRQ_EXCLUSIVE, &hook_id));
......
65 67
  sys_outb(0x64, scancode); */
66 68

  
67 69
  printf("%x\n", scancode);
68
  kbc_ih();
70
  //kbc_ih();
69 71
  printf("\n");
70 72
  while (scancode !=
71 73
         EXIT_CODE) { /* You may want to use a different condition */
......
81 83
      case HARDWARE: /* hardware interrupt notification */
82 84
        if (msg.m_notify.interrupts & BIT(0)) { /* subscribed interrupt */
83 85

  
86
          #ifdef LAB3 
87
          cnt++; 
88
          #endif
84 89
          sys_inb(0x64, &scancode);
85 90
          if (scancode & 0x01) {
91
            #ifdef LAB3 
92
            cnt++; 
93
            #endif
86 94
            sys_inb(0x60, &scancode);
87 95
          if (scancode != 0xe0 && flag == 0) {
88 96
            // tickdelay(micros_to_ticks(DELAY_US));
......
114 122
      /* no standard messages expected: do nothing */
115 123
    }
116 124
  }
125
  kbd_print_no_sysinb(cnt);
117 126
  if (sys_irqrmpolicy(&hook_id) != 0)
118 127
    return 1;
119 128

  
......
124 133
  /* To be completed by the students */
125 134
  uint8_t scan_arr[2] = {0, 0};
126 135
  int flag = 0;
136
  uint32_t cnt=0;
127 137
  while(scancode != EXIT_CODE)
128 138
  {
129 139
    tickdelay(micros_to_ticks(DELAY_US));
140
    #ifdef LAB3 
141
    cnt++; 
142
    #endif
130 143
    sys_inb(0x64, &scancode);
131 144
          if (scancode & 0x01) {
145
            #ifdef LAB3 
146
            cnt++;
147
             #endif
132 148
            sys_inb(0x60, &scancode);
133 149
          if (scancode != 0xe0 && flag == 0) {
134 150
            scan_arr[0] = scancode;
......
148 164
        }
149 165

  
150 166
  }
167
  kbd_print_no_sysinb(cnt);
151 168

  
152 169
  return 1;
153 170
}

Also available in: Unified diff