Project

General

Profile

Revision 10

Working function kbc_test_scan()

View differences:

keyboard.c
1
#include <lcom/lcf.h>
1
#include "keyboard.h"
2 2

  
3
#include <lcom/lab3.h>
4

  
5
#include <stdbool.h>
6
#include <stdint.h>
7
#include "i8042.h"
8

  
9

  
10
u8int_t scan_code=0;            // make code or break code
3
uint8_t scan_code=0;            // make code or break code
11 4
int keyboard_id = KEYBOARD_IRQ; 	// KEYBOARD_IRQ is defined in interrupt.h in .minix-src folder
12 5
uint32_t cnt = 0;									// counter of sys_inb calls
13 6
					
......
24 17
  cnt++;
25 18
  #endif
26 19
  
27

  
28 20
  return 0;
29 21
}
30 22

  
31 23
void (kbc_ih)(void){
32
  u8int_t status_reg;
24
  uint8_t status_reg;
33 25

  
34
  if(util_sys_inb(STATUS_REG,status_reg)!=0){ //checks if there is an error
26
  if(util_sys_inb(STATUS_REG,&status_reg)!=0){ //checks if there is an error
35 27
    return;
36 28
  }
37 29
  if(((status_reg & STAT_REG_OBF)==0) ||((status_reg&(STAT_REG_PAR|STAT_REG_TIMEOUT))!=0)){ //checks if there is a parity or timeout error (mask -> 0xC0, bit 7 and 6 set) and checks if output buffer is empty
38 30
    return;
39 31
  }
40
  util_sys_inb(OUTPUT_BUF,status_code);
32
  util_sys_inb(OUTPUT_BUF,&scan_code);
41 33

  
42 34
}
43 35

  

Also available in: Unified diff