Index: lab3/.depend
===================================================================
--- lab3/.depend	(nonexistent)
+++ lab3/.depend	(revision 30)
@@ -0,0 +1,135 @@
+kbc.d kbc.ln kbc.o: kbc.c /usr/include/lcom/lcf.h /usr/include/stdbool.h \
+  /usr/include/stdio.h /usr/include/sys/cdefs.h \
+  /usr/include/machine/cdefs.h /usr/include/sys/cdefs_elf.h \
+  /usr/include/sys/featuretest.h /usr/include/sys/ansi.h \
+  /usr/include/machine/ansi.h /usr/include/machine/int_types.h \
+  /usr/include/sys/common_int_types.h /usr/include/sys/null.h \
+  /usr/include/stdlib.h /usr/include/sys/types.h \
+  /usr/include/machine/types.h /usr/include/machine/endian.h \
+  /usr/include/sys/endian.h /usr/include/machine/endian_machdep.h \
+  /usr/include/machine/bswap.h /usr/include/machine/byte_swap.h \
+  /usr/include/sys/bswap.h /usr/include/sys/stdint.h \
+  /usr/include/machine/int_mwgwtypes.h \
+  /usr/include/sys/common_int_mwgwtypes.h \
+  /usr/include/machine/int_limits.h /usr/include/sys/common_int_limits.h \
+  /usr/include/machine/int_const.h /usr/include/sys/common_int_const.h \
+  /usr/include/machine/wchar_limits.h /usr/include/sys/fd_set.h \
+  /usr/include/time.h /usr/include/sys/time.h \
+  /usr/include/sys/timespec.h /usr/include/sys/select.h \
+  /usr/include/sys/sigtypes.h /usr/include/unistd.h \
+  /usr/include/sys/unistd.h /usr/include/machine/int86.h \
+  /usr/include/minix/const.h /usr/include/machine/archconst.h \
+  /usr/include/minix/driver.h /usr/include/minix/config.h \
+  /usr/include/minix/sys_config.h /usr/include/minix/type.h \
+  /usr/include/machine/multiboot.h /usr/include/stddef.h \
+  /usr/include/machine/interrupt.h /usr/include/minix/ipc.h \
+  /usr/include/minix/ipcconst.h /usr/include/machine/ipcconst.h \
+  /usr/include/sys/signal.h /usr/include/sys/siginfo.h \
+  /usr/include/machine/signal.h /usr/include/machine/fpu.h \
+  /usr/include/machine/trap.h /usr/include/x86/trap.h \
+  /usr/include/sys/ucontext.h /usr/include/machine/mcontext.h \
+  /usr/include/minix/com.h /usr/include/minix/callnr.h \
+  /usr/include/minix/syslib.h /usr/include/minix/u64.h \
+  /usr/include/minix/devio.h /usr/include/minix/safecopies.h \
+  /usr/include/minix/vm.h /usr/include/minix/endpoint.h \
+  /usr/include/limits.h /usr/include/machine/limits.h \
+  /usr/include/sys/syslimits.h /usr/include/minix/sef.h \
+  /usr/include/minix/sysutil.h /usr/include/string.h \
+  /usr/include/strings.h /usr/include/errno.h /usr/include/sys/errno.h \
+  /usr/include/sys/param.h /usr/include/sys/inttypes.h \
+  /usr/include/machine/int_fmtio.h /usr/include/sys/common_int_fmtio.h \
+  /usr/include/machine/param.h /usr/include/minix/partition.h \
+  /usr/include/sys/mman.h /usr/include/lcom/liblm.h \
+  /usr/include/lcom/lab2.h /usr/include/lcom/timer.h \
+  /usr/include/lcom/utils.h /usr/include/lcom/lab3.h \
+  /usr/include/lcom/types.h kbc.h kbc_func.h
+lab3.d lab3.ln lab3.o: lab3.c /usr/include/lcom/lcf.h /usr/include/stdbool.h \
+  /usr/include/stdio.h /usr/include/sys/cdefs.h \
+  /usr/include/machine/cdefs.h /usr/include/sys/cdefs_elf.h \
+  /usr/include/sys/featuretest.h /usr/include/sys/ansi.h \
+  /usr/include/machine/ansi.h /usr/include/machine/int_types.h \
+  /usr/include/sys/common_int_types.h /usr/include/sys/null.h \
+  /usr/include/stdlib.h /usr/include/sys/types.h \
+  /usr/include/machine/types.h /usr/include/machine/endian.h \
+  /usr/include/sys/endian.h /usr/include/machine/endian_machdep.h \
+  /usr/include/machine/bswap.h /usr/include/machine/byte_swap.h \
+  /usr/include/sys/bswap.h /usr/include/sys/stdint.h \
+  /usr/include/machine/int_mwgwtypes.h \
+  /usr/include/sys/common_int_mwgwtypes.h \
+  /usr/include/machine/int_limits.h /usr/include/sys/common_int_limits.h \
+  /usr/include/machine/int_const.h /usr/include/sys/common_int_const.h \
+  /usr/include/machine/wchar_limits.h /usr/include/sys/fd_set.h \
+  /usr/include/time.h /usr/include/sys/time.h \
+  /usr/include/sys/timespec.h /usr/include/sys/select.h \
+  /usr/include/sys/sigtypes.h /usr/include/unistd.h \
+  /usr/include/sys/unistd.h /usr/include/machine/int86.h \
+  /usr/include/minix/const.h /usr/include/machine/archconst.h \
+  /usr/include/minix/driver.h /usr/include/minix/config.h \
+  /usr/include/minix/sys_config.h /usr/include/minix/type.h \
+  /usr/include/machine/multiboot.h /usr/include/stddef.h \
+  /usr/include/machine/interrupt.h /usr/include/minix/ipc.h \
+  /usr/include/minix/ipcconst.h /usr/include/machine/ipcconst.h \
+  /usr/include/sys/signal.h /usr/include/sys/siginfo.h \
+  /usr/include/machine/signal.h /usr/include/machine/fpu.h \
+  /usr/include/machine/trap.h /usr/include/x86/trap.h \
+  /usr/include/sys/ucontext.h /usr/include/machine/mcontext.h \
+  /usr/include/minix/com.h /usr/include/minix/callnr.h \
+  /usr/include/minix/syslib.h /usr/include/minix/u64.h \
+  /usr/include/minix/devio.h /usr/include/minix/safecopies.h \
+  /usr/include/minix/vm.h /usr/include/minix/endpoint.h \
+  /usr/include/limits.h /usr/include/machine/limits.h \
+  /usr/include/sys/syslimits.h /usr/include/minix/sef.h \
+  /usr/include/minix/sysutil.h /usr/include/string.h \
+  /usr/include/strings.h /usr/include/errno.h /usr/include/sys/errno.h \
+  /usr/include/sys/param.h /usr/include/sys/inttypes.h \
+  /usr/include/machine/int_fmtio.h /usr/include/sys/common_int_fmtio.h \
+  /usr/include/machine/param.h /usr/include/minix/partition.h \
+  /usr/include/sys/mman.h /usr/include/lcom/liblm.h \
+  /usr/include/lcom/lab2.h /usr/include/lcom/timer.h \
+  /usr/include/lcom/utils.h /usr/include/lcom/lab3.h \
+  /usr/include/lcom/types.h kbc.h kbc_func.h
+utils.d utils.ln utils.o: utils.c /usr/include/lcom/lcf.h /usr/include/stdbool.h \
+  /usr/include/stdio.h /usr/include/sys/cdefs.h \
+  /usr/include/machine/cdefs.h /usr/include/sys/cdefs_elf.h \
+  /usr/include/sys/featuretest.h /usr/include/sys/ansi.h \
+  /usr/include/machine/ansi.h /usr/include/machine/int_types.h \
+  /usr/include/sys/common_int_types.h /usr/include/sys/null.h \
+  /usr/include/stdlib.h /usr/include/sys/types.h \
+  /usr/include/machine/types.h /usr/include/machine/endian.h \
+  /usr/include/sys/endian.h /usr/include/machine/endian_machdep.h \
+  /usr/include/machine/bswap.h /usr/include/machine/byte_swap.h \
+  /usr/include/sys/bswap.h /usr/include/sys/stdint.h \
+  /usr/include/machine/int_mwgwtypes.h \
+  /usr/include/sys/common_int_mwgwtypes.h \
+  /usr/include/machine/int_limits.h /usr/include/sys/common_int_limits.h \
+  /usr/include/machine/int_const.h /usr/include/sys/common_int_const.h \
+  /usr/include/machine/wchar_limits.h /usr/include/sys/fd_set.h \
+  /usr/include/time.h /usr/include/sys/time.h \
+  /usr/include/sys/timespec.h /usr/include/sys/select.h \
+  /usr/include/sys/sigtypes.h /usr/include/unistd.h \
+  /usr/include/sys/unistd.h /usr/include/machine/int86.h \
+  /usr/include/minix/const.h /usr/include/machine/archconst.h \
+  /usr/include/minix/driver.h /usr/include/minix/config.h \
+  /usr/include/minix/sys_config.h /usr/include/minix/type.h \
+  /usr/include/machine/multiboot.h /usr/include/stddef.h \
+  /usr/include/machine/interrupt.h /usr/include/minix/ipc.h \
+  /usr/include/minix/ipcconst.h /usr/include/machine/ipcconst.h \
+  /usr/include/sys/signal.h /usr/include/sys/siginfo.h \
+  /usr/include/machine/signal.h /usr/include/machine/fpu.h \
+  /usr/include/machine/trap.h /usr/include/x86/trap.h \
+  /usr/include/sys/ucontext.h /usr/include/machine/mcontext.h \
+  /usr/include/minix/com.h /usr/include/minix/callnr.h \
+  /usr/include/minix/syslib.h /usr/include/minix/u64.h \
+  /usr/include/minix/devio.h /usr/include/minix/safecopies.h \
+  /usr/include/minix/vm.h /usr/include/minix/endpoint.h \
+  /usr/include/limits.h /usr/include/machine/limits.h \
+  /usr/include/sys/syslimits.h /usr/include/minix/sef.h \
+  /usr/include/minix/sysutil.h /usr/include/string.h \
+  /usr/include/strings.h /usr/include/errno.h /usr/include/sys/errno.h \
+  /usr/include/sys/param.h /usr/include/sys/inttypes.h \
+  /usr/include/machine/int_fmtio.h /usr/include/sys/common_int_fmtio.h \
+  /usr/include/machine/param.h /usr/include/minix/partition.h \
+  /usr/include/sys/mman.h /usr/include/lcom/liblm.h \
+  /usr/include/lcom/lab2.h /usr/include/lcom/timer.h \
+  /usr/include/lcom/utils.h /usr/include/lcom/lab3.h \
+  /usr/include/lcom/types.h

Property changes on: lab3/.depend
___________________________________________________________________
Added: svn:executable
Index: lab3/.gdbinit
===================================================================
Index: lab3/.gdbinit
===================================================================
--- lab3/.gdbinit	(nonexistent)
+++ lab3/.gdbinit	(revision 30)

Property changes on: lab3/.gdbinit
___________________________________________________________________
Added: svn:executable
Index: lab3/Makefile
===================================================================
--- lab3/Makefile	(nonexistent)
+++ lab3/Makefile	(revision 30)
@@ -0,0 +1,17 @@
+# name of the program (Minix service)
+PROG=lab3
+
+# source code files to be compiled
+SRCS = lab3.c kbc.c utils.c
+
+# additional compilation flags
+# "-Wall -Wextra -Werror -I . -std=c11 -Wno-unused-parameter" are already set
+CFLAGS += -pedantic
+CPPFLAGS += -D LAB3
+
+# list of library dependencies (for Lab 2, only LCF library)
+DPADD += ${LIBLCF}
+LDADD += -llcf
+
+# include LCOM's makefile that does all the "heavy lifting"
+.include <minix.lcom.mk>

Property changes on: lab3/Makefile
___________________________________________________________________
Added: svn:executable
Index: lab3/kbc.c
===================================================================
--- lab3/kbc.c	(nonexistent)
+++ lab3/kbc.c	(revision 30)
@@ -0,0 +1,53 @@
+#include <lcom/lcf.h>
+
+#include "kbc.h"
+#include "kbc_func.h"
+
+int (subscribe_kbc_interrupt)(uint8_t interrupt_bit, int *interrupt_id) {
+    if (interrupt_id == NULL) return 1;
+    *interrupt_id = interrupt_bit;
+    return (sys_irqsetpolicy(KBC_IRQ, IRQ_REENABLE | IRQ_EXCLUSIVE, interrupt_id));
+}
+
+int (unsubscribe_kbc_interrupt)(int *interrupt_id) {
+    if (interrupt_id == NULL) return 1;
+    return sys_irqrmpolicy(interrupt_id);
+}
+
+uint8_t scancode[2];
+int two_byte_scancode = 0;
+
+void (kbc_ih)(void) {
+    uint8_t status = 0;
+
+    #ifdef LAB3
+    sys_inb_counter(INCREMENT);
+    #endif
+
+    if (util_sys_inb(STATUS_REG, &status)) return;
+
+    if (status & (TIME_OUT_REC | PARITY_ERROR)) return;
+
+    #ifdef LAB3
+    sys_inb_counter(INCREMENT);
+    #endif
+
+    uint8_t byte = 0;
+
+    if (util_sys_inb(OUTPUT_BUF, &byte)) return;
+
+    if (two_byte_scancode) {
+        scancode[1] = byte;
+        two_byte_scancode = 0;
+    } else {
+        scancode[0] = byte;
+        two_byte_scancode = (byte == TWO_BYTE_CODE);
+    }
+
+}
+
+uint32_t sys_inb_counter(int increment) {
+    static uint32_t counter = 0;
+    if (increment) return ++counter;
+    return counter;
+}

Property changes on: lab3/kbc.c
___________________________________________________________________
Added: svn:executable
Index: lab3/kbc.d
===================================================================
--- lab3/kbc.d	(nonexistent)
+++ lab3/kbc.d	(revision 30)
@@ -0,0 +1,45 @@
+kbc.o: kbc.c /usr/include/lcom/lcf.h /usr/include/stdbool.h \
+  /usr/include/stdio.h /usr/include/sys/cdefs.h \
+  /usr/include/machine/cdefs.h /usr/include/sys/cdefs_elf.h \
+  /usr/include/sys/featuretest.h /usr/include/sys/ansi.h \
+  /usr/include/machine/ansi.h /usr/include/machine/int_types.h \
+  /usr/include/sys/common_int_types.h /usr/include/sys/null.h \
+  /usr/include/stdlib.h /usr/include/sys/types.h \
+  /usr/include/machine/types.h /usr/include/machine/endian.h \
+  /usr/include/sys/endian.h /usr/include/machine/endian_machdep.h \
+  /usr/include/machine/bswap.h /usr/include/machine/byte_swap.h \
+  /usr/include/sys/bswap.h /usr/include/sys/stdint.h \
+  /usr/include/machine/int_mwgwtypes.h \
+  /usr/include/sys/common_int_mwgwtypes.h \
+  /usr/include/machine/int_limits.h /usr/include/sys/common_int_limits.h \
+  /usr/include/machine/int_const.h /usr/include/sys/common_int_const.h \
+  /usr/include/machine/wchar_limits.h /usr/include/sys/fd_set.h \
+  /usr/include/time.h /usr/include/sys/time.h \
+  /usr/include/sys/timespec.h /usr/include/sys/select.h \
+  /usr/include/sys/sigtypes.h /usr/include/unistd.h \
+  /usr/include/sys/unistd.h /usr/include/machine/int86.h \
+  /usr/include/minix/const.h /usr/include/machine/archconst.h \
+  /usr/include/minix/driver.h /usr/include/minix/config.h \
+  /usr/include/minix/sys_config.h /usr/include/minix/type.h \
+  /usr/include/machine/multiboot.h /usr/include/stddef.h \
+  /usr/include/machine/interrupt.h /usr/include/minix/ipc.h \
+  /usr/include/minix/ipcconst.h /usr/include/machine/ipcconst.h \
+  /usr/include/sys/signal.h /usr/include/sys/siginfo.h \
+  /usr/include/machine/signal.h /usr/include/machine/fpu.h \
+  /usr/include/machine/trap.h /usr/include/x86/trap.h \
+  /usr/include/sys/ucontext.h /usr/include/machine/mcontext.h \
+  /usr/include/minix/com.h /usr/include/minix/callnr.h \
+  /usr/include/minix/syslib.h /usr/include/minix/u64.h \
+  /usr/include/minix/devio.h /usr/include/minix/safecopies.h \
+  /usr/include/minix/vm.h /usr/include/minix/endpoint.h \
+  /usr/include/limits.h /usr/include/machine/limits.h \
+  /usr/include/sys/syslimits.h /usr/include/minix/sef.h \
+  /usr/include/minix/sysutil.h /usr/include/string.h \
+  /usr/include/strings.h /usr/include/errno.h /usr/include/sys/errno.h \
+  /usr/include/sys/param.h /usr/include/sys/inttypes.h \
+  /usr/include/machine/int_fmtio.h /usr/include/sys/common_int_fmtio.h \
+  /usr/include/machine/param.h /usr/include/minix/partition.h \
+  /usr/include/sys/mman.h /usr/include/lcom/liblm.h \
+  /usr/include/lcom/lab2.h /usr/include/lcom/timer.h \
+  /usr/include/lcom/utils.h /usr/include/lcom/lab3.h \
+  /usr/include/lcom/types.h kbc.h kbc_func.h

Property changes on: lab3/kbc.d
___________________________________________________________________
Added: svn:executable
Index: lab3/kbc.h
===================================================================
--- lab3/kbc.h	(nonexistent)
+++ lab3/kbc.h	(revision 30)
@@ -0,0 +1,41 @@
+#ifndef _KBC_H_
+#define _KBC_H_
+
+/* KBC IRQ Line */
+
+#define KBC_IRQ     1 /* @brief KBC Controller IRQ Line */
+
+/* I/O Ports Addresses */
+
+#define KBC_CMD     0x64 /* @brief Address to send commands to KBC */
+#define KBC_CMD_ARG 0x60 /* @brief Address to write KBC Command Arguments */
+#define STATUS_REG  0x64 /* @brief KBC Status Register address */
+
+#define OUTPUT_BUF  0x60 /* @brief Address of Output Buffer of KBC */
+
+/* KBC Commands */
+#define READ_KBC_CMD    0x20 /* @brief Read KBC Command Byte */
+#define WRITE_KBC_CMD   0x60 /* @brief Write KBC Command Byte */
+#define KBC_SELF_TEST   0xAA /* @brief KBC Diagnostic Tests */
+#define KBC_INT_TEST    0xAB /* @brief Tests Keyboard Clock and Data lines */
+#define KBC_INT_DISABLE 0xAD /* @brief Disable KBC Interface */
+#define KBC_INT_ENABLE  0xAE /* @brief Enable KBC Interface */
+
+/* Status Byte Masking */
+
+#define OUT_BUF_FUL     BIT(0) /* @brief Output Buffer State */
+#define IN_BUF_FULL     BIT(1) /* @brief Input Buffer State */
+#define SYS_FLAG        BIT(2) /* @brief System Flag */
+#define DATA_CMD_WRITE  BIT(3) /* @brief Identifier of type of byte in input buffer */
+#define INH_FLAG        BIT(4) /* @brief Keyboard inihibited */
+#define AUX_MOUSE       BIT(5) /* @brief Mouse Data */
+#define TIME_OUT_REC    BIT(6) /* @brief Time Out Error - Invalid Data */
+#define PARITY_ERROR    BIT(7) /* @brief Parity Error - Invalid Data */
+
+/* Scancode Constants */
+
+#define ESC_BREAK_CODE  0x81    /* @brief ESC Break Code */
+#define TWO_BYTE_CODE   0xE0    /* @brief First byte of a two byte Scancode */
+#define BREAK_CODE_BIT  BIT(7)  /* @brief Bit to distinguish between Make code and Break code */
+
+#endif

Property changes on: lab3/kbc.h
___________________________________________________________________
Added: svn:executable
Index: lab3/kbc_func.h
===================================================================
--- lab3/kbc_func.h	(nonexistent)
+++ lab3/kbc_func.h	(revision 30)
@@ -0,0 +1,37 @@
+#ifndef _KBC_FUNC_H_
+#define _KBC_FUNC_H_
+
+#include <stdint.h>
+
+#define GET         0 /* @brief Argument to get counter without incrementing */
+#define INCREMENT   1 /* @brief Argument for incrementing counter */
+
+/**
+ * @brief Subscribes KBC Interrupts and disables Minix Default Keyboard IH
+ * @param interrupt_bit Bit of Interrupt Vector that will be set when KBC Interrupt is pending
+ * @param interrupt_id KBC Interrupt ID to specify the KBC Interrupt in other calls
+ * @return Whether operation was sucessful or not
+ */
+int (subscribe_kbc_interrupt)(uint8_t interrupt_bit, int *interrupt_id);
+
+/**
+ * @brief Unsubcribes KBC Interrupts
+ * @param interrupt_id KBC Interrupt ID, value via arguments on subscription of the interrupt_id
+ * @see subscribe_kbc_interrupt
+ * @return Whether operation was sucessful or not
+ */
+int (unsubscribe_kbc_interrupt)(int *interrupt_id);
+
+/**
+ * @brief KBC Interrupt Handler
+ */
+void (kbc_ih)(void);
+
+/**
+ * @brief Counter for sys_inb calls
+ * @param increment Whether the value should be incremented or not
+ * @return The current value of the counter
+ */
+uint32_t sys_inb_counter(int get_increment);
+
+#endif

Property changes on: lab3/kbc_func.h
___________________________________________________________________
Added: svn:executable
Index: lab3/lab3
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-executable
Index: lab3/lab3
===================================================================
--- lab3/lab3	(nonexistent)
+++ lab3/lab3	(revision 30)

Property changes on: lab3/lab3
___________________________________________________________________
Added: svn:executable
Added: svn:mime-type
## -0,0 +1 ##
+application/x-executable
\ No newline at end of property
Index: lab3/lab3.c
===================================================================
--- lab3/lab3.c	(nonexistent)
+++ lab3/lab3.c	(revision 30)
@@ -0,0 +1,102 @@
+#include <lcom/lcf.h>
+
+#include <lcom/lab3.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "kbc.h"
+#include "kbc_func.h"
+
+int main(int argc, char *argv[]) {
+  // sets the language of LCF messages (can be either EN-US or PT-PT)
+  lcf_set_language("EN-US");
+
+  // enables to log function invocations that are being "wrapped" by LCF
+  // [comment this out if you don't want/need it]
+  lcf_trace_calls("/home/lcom/labs/lab3/trace.txt");
+
+  // enables to save the output of printf function calls on a file
+  // [comment this out if you don't want/need it]
+  lcf_log_output("/home/lcom/labs/lab3/output.txt");
+
+  // handles control over to LCF
+  // [LCF handles command line arguments and invokes the right function]
+  if (lcf_start(argc, argv))
+    return 1;
+
+  // LCF clean up tasks
+  // [must be the last statement before return]
+  lcf_cleanup();
+
+  return 0;
+}
+
+extern uint8_t scancode[2];
+extern int two_byte_scancode;
+
+int(kbd_test_scan)() {
+
+    int ipc_status, r;
+    message msg;
+
+    uint8_t kbc_irq_bit = BIT(1);
+    int kbc_id = 0;
+
+    int got_esc_breakcode = 0;
+
+    if (subscribe_kbc_interrupt(kbc_irq_bit, &kbc_id)) return 1;
+
+    while (!got_esc_breakcode) {
+        /* Get a request message. */
+        if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
+            printf("driver_receive failed with %d", r);
+            continue;
+        }
+        if (is_ipc_notify(ipc_status)) { /* received notification */
+            switch (_ENDPOINT_P(msg.m_source)) {
+                case HARDWARE: /* hardware interrupt notification */
+                    if (msg.m_notify.interrupts & kbc_irq_bit) { /* subscribed interrupt */
+
+                        kbc_ih();
+
+                        if (!two_byte_scancode) { /* finished processing a scancode */
+                            if (scancode[0] == TWO_BYTE_CODE)
+                                kbd_print_scancode(!(scancode[1] & BREAK_CODE_BIT), 2, scancode);
+                            else
+                                kbd_print_scancode(!(scancode[0] & BREAK_CODE_BIT), 1, scancode);
+                        }
+
+                        if (scancode[0] == ESC_BREAK_CODE)
+                            got_esc_breakcode = 1;
+
+                    }
+                    break;
+                default:
+                    break; /* no other notifications expected: do nothing */
+            }
+        } else { /* received standart message, not a notification */
+            /* no standart message expected: do nothing */
+        }
+    }
+
+    if (unsubscribe_kbc_interrupt(&kbc_id)) return 1;
+
+    if (kbd_print_no_sysinb(sys_inb_counter(GET))) return 1;
+
+    return 0;
+}
+
+int(kbd_test_poll)() {
+  /* To be completed by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+int(kbd_test_timed_scan)(uint8_t n) {
+  /* To be completed by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}

Property changes on: lab3/lab3.c
___________________________________________________________________
Added: svn:executable
Index: lab3/lab3.d
===================================================================
--- lab3/lab3.d	(nonexistent)
+++ lab3/lab3.d	(revision 30)
@@ -0,0 +1,45 @@
+lab3.o: lab3.c /usr/include/lcom/lcf.h /usr/include/stdbool.h \
+  /usr/include/stdio.h /usr/include/sys/cdefs.h \
+  /usr/include/machine/cdefs.h /usr/include/sys/cdefs_elf.h \
+  /usr/include/sys/featuretest.h /usr/include/sys/ansi.h \
+  /usr/include/machine/ansi.h /usr/include/machine/int_types.h \
+  /usr/include/sys/common_int_types.h /usr/include/sys/null.h \
+  /usr/include/stdlib.h /usr/include/sys/types.h \
+  /usr/include/machine/types.h /usr/include/machine/endian.h \
+  /usr/include/sys/endian.h /usr/include/machine/endian_machdep.h \
+  /usr/include/machine/bswap.h /usr/include/machine/byte_swap.h \
+  /usr/include/sys/bswap.h /usr/include/sys/stdint.h \
+  /usr/include/machine/int_mwgwtypes.h \
+  /usr/include/sys/common_int_mwgwtypes.h \
+  /usr/include/machine/int_limits.h /usr/include/sys/common_int_limits.h \
+  /usr/include/machine/int_const.h /usr/include/sys/common_int_const.h \
+  /usr/include/machine/wchar_limits.h /usr/include/sys/fd_set.h \
+  /usr/include/time.h /usr/include/sys/time.h \
+  /usr/include/sys/timespec.h /usr/include/sys/select.h \
+  /usr/include/sys/sigtypes.h /usr/include/unistd.h \
+  /usr/include/sys/unistd.h /usr/include/machine/int86.h \
+  /usr/include/minix/const.h /usr/include/machine/archconst.h \
+  /usr/include/minix/driver.h /usr/include/minix/config.h \
+  /usr/include/minix/sys_config.h /usr/include/minix/type.h \
+  /usr/include/machine/multiboot.h /usr/include/stddef.h \
+  /usr/include/machine/interrupt.h /usr/include/minix/ipc.h \
+  /usr/include/minix/ipcconst.h /usr/include/machine/ipcconst.h \
+  /usr/include/sys/signal.h /usr/include/sys/siginfo.h \
+  /usr/include/machine/signal.h /usr/include/machine/fpu.h \
+  /usr/include/machine/trap.h /usr/include/x86/trap.h \
+  /usr/include/sys/ucontext.h /usr/include/machine/mcontext.h \
+  /usr/include/minix/com.h /usr/include/minix/callnr.h \
+  /usr/include/minix/syslib.h /usr/include/minix/u64.h \
+  /usr/include/minix/devio.h /usr/include/minix/safecopies.h \
+  /usr/include/minix/vm.h /usr/include/minix/endpoint.h \
+  /usr/include/limits.h /usr/include/machine/limits.h \
+  /usr/include/sys/syslimits.h /usr/include/minix/sef.h \
+  /usr/include/minix/sysutil.h /usr/include/string.h \
+  /usr/include/strings.h /usr/include/errno.h /usr/include/sys/errno.h \
+  /usr/include/sys/param.h /usr/include/sys/inttypes.h \
+  /usr/include/machine/int_fmtio.h /usr/include/sys/common_int_fmtio.h \
+  /usr/include/machine/param.h /usr/include/minix/partition.h \
+  /usr/include/sys/mman.h /usr/include/lcom/liblm.h \
+  /usr/include/lcom/lab2.h /usr/include/lcom/timer.h \
+  /usr/include/lcom/utils.h /usr/include/lcom/lab3.h \
+  /usr/include/lcom/types.h kbc.h kbc_func.h

Property changes on: lab3/lab3.d
___________________________________________________________________
Added: svn:executable
Index: lab3/output.txt
===================================================================
Index: lab3/output.txt
===================================================================
--- lab3/output.txt	(nonexistent)
+++ lab3/output.txt	(revision 30)

Property changes on: lab3/output.txt
___________________________________________________________________
Added: svn:executable
Index: lab3/trace.txt
===================================================================
Index: lab3/trace.txt
===================================================================
--- lab3/trace.txt	(nonexistent)
+++ lab3/trace.txt	(revision 30)

Property changes on: lab3/trace.txt
___________________________________________________________________
Added: svn:executable
Index: lab3/utils.c
===================================================================
--- lab3/utils.c	(nonexistent)
+++ lab3/utils.c	(revision 30)
@@ -0,0 +1,11 @@
+#include <lcom/lcf.h>
+
+#include <stdint.h>
+
+int (util_sys_inb)(int port, uint8_t *value) {
+    if(value == NULL) return 1;
+    uint32_t n = 0;
+    if(sys_inb(port, &n)) return 1;
+    *value = n;
+    return 0;
+}

Property changes on: lab3/utils.c
___________________________________________________________________
Added: svn:executable
Index: lab3/utils.d
===================================================================
--- lab3/utils.d	(nonexistent)
+++ lab3/utils.d	(revision 30)
@@ -0,0 +1,45 @@
+utils.o: utils.c /usr/include/lcom/lcf.h /usr/include/stdbool.h \
+  /usr/include/stdio.h /usr/include/sys/cdefs.h \
+  /usr/include/machine/cdefs.h /usr/include/sys/cdefs_elf.h \
+  /usr/include/sys/featuretest.h /usr/include/sys/ansi.h \
+  /usr/include/machine/ansi.h /usr/include/machine/int_types.h \
+  /usr/include/sys/common_int_types.h /usr/include/sys/null.h \
+  /usr/include/stdlib.h /usr/include/sys/types.h \
+  /usr/include/machine/types.h /usr/include/machine/endian.h \
+  /usr/include/sys/endian.h /usr/include/machine/endian_machdep.h \
+  /usr/include/machine/bswap.h /usr/include/machine/byte_swap.h \
+  /usr/include/sys/bswap.h /usr/include/sys/stdint.h \
+  /usr/include/machine/int_mwgwtypes.h \
+  /usr/include/sys/common_int_mwgwtypes.h \
+  /usr/include/machine/int_limits.h /usr/include/sys/common_int_limits.h \
+  /usr/include/machine/int_const.h /usr/include/sys/common_int_const.h \
+  /usr/include/machine/wchar_limits.h /usr/include/sys/fd_set.h \
+  /usr/include/time.h /usr/include/sys/time.h \
+  /usr/include/sys/timespec.h /usr/include/sys/select.h \
+  /usr/include/sys/sigtypes.h /usr/include/unistd.h \
+  /usr/include/sys/unistd.h /usr/include/machine/int86.h \
+  /usr/include/minix/const.h /usr/include/machine/archconst.h \
+  /usr/include/minix/driver.h /usr/include/minix/config.h \
+  /usr/include/minix/sys_config.h /usr/include/minix/type.h \
+  /usr/include/machine/multiboot.h /usr/include/stddef.h \
+  /usr/include/machine/interrupt.h /usr/include/minix/ipc.h \
+  /usr/include/minix/ipcconst.h /usr/include/machine/ipcconst.h \
+  /usr/include/sys/signal.h /usr/include/sys/siginfo.h \
+  /usr/include/machine/signal.h /usr/include/machine/fpu.h \
+  /usr/include/machine/trap.h /usr/include/x86/trap.h \
+  /usr/include/sys/ucontext.h /usr/include/machine/mcontext.h \
+  /usr/include/minix/com.h /usr/include/minix/callnr.h \
+  /usr/include/minix/syslib.h /usr/include/minix/u64.h \
+  /usr/include/minix/devio.h /usr/include/minix/safecopies.h \
+  /usr/include/minix/vm.h /usr/include/minix/endpoint.h \
+  /usr/include/limits.h /usr/include/machine/limits.h \
+  /usr/include/sys/syslimits.h /usr/include/minix/sef.h \
+  /usr/include/minix/sysutil.h /usr/include/string.h \
+  /usr/include/strings.h /usr/include/errno.h /usr/include/sys/errno.h \
+  /usr/include/sys/param.h /usr/include/sys/inttypes.h \
+  /usr/include/machine/int_fmtio.h /usr/include/sys/common_int_fmtio.h \
+  /usr/include/machine/param.h /usr/include/minix/partition.h \
+  /usr/include/sys/mman.h /usr/include/lcom/liblm.h \
+  /usr/include/lcom/lab2.h /usr/include/lcom/timer.h \
+  /usr/include/lcom/utils.h /usr/include/lcom/lab3.h \
+  /usr/include/lcom/types.h

Property changes on: lab3/utils.d
___________________________________________________________________
Added: svn:executable
Index: lab3/utils.h
===================================================================
--- lab3/utils.h	(nonexistent)
+++ lab3/utils.h	(revision 30)
@@ -0,0 +1,12 @@
+#ifndef _UTILS_H_
+#define _UTILS_H_
+
+/**
+ * @brief Reads byte from port
+ * @param port Adress Port to read from
+ * @param value Address to be stored the value read
+ * @return Whether operation was sucessful or not
+ */
+int (util_sys_inb)(int port, uint8_t *value);
+
+#endif

Property changes on: lab3/utils.h
___________________________________________________________________
Added: svn:executable
