Index: lab4/mouse.h
===================================================================
--- lab4/mouse.h	(revision 51)
+++ lab4/mouse.h	(nonexistent)
@@ -1,37 +0,0 @@
-#ifndef _MOUSE_H_
-#define _MOUSE_H_
-
-/* Mouse Data Packet */
-// Byte 0 - Button States
-#define LEFT_BUTTON     BIT(0) /* @brief Left button click event*/
-#define RIGHT_BUTTON    BIT(1) /* @brief Right button click event */
-#define MIDDLE_BUTTON   BIT(2) /* @brief Middle button click event */
-#define FIRST_BYTE_ID   BIT(3) /* @brief Identifier of first byte of packet CAREFUL: Not 100% accurate */
-#define MSB_X_DELTA     BIT(4) /* @brief Most significant bit of X delta */
-#define MSB_Y_DELTA     BIT(5) /* @brief Most significant bit of Y delta */
-#define X_OVERFLOW      BIT(6) /* @brief X delta overflowed */
-#define Y_OVERFLOW      BIT(7) /* @brief Y delta overflowed */
-// Byte 1 - X delta
-// Byte 2 - Y delta
-
-/* Mouse Commands */
-#define RESET           0xFF /* @brief Reset mouse */
-#define RESEND          0xFE /* @brief Resend command */
-#define DEFAULT         0xF6 /* @brief Set default values */
-#define DIS_DATA_REP    0xF5 /* @brief Disable Data Reporting */
-#define ENABLE_DATA_REP 0xF4 /* @brief Enable Data Reporting */
-#define SET_SAMPLE_RT   0xF3 /* @brief Sets state sampling rate */
-#define SET_REMOTE_MD   0xF0 /* @brief Sets Mouse on Remote Mode, data on request */
-#define READ_DATA       0xEB /* @brief Sends data packet request */
-#define SET_STREAM_MD   0xEA /* @brief Sets mouse on Stream Mode, data on events */
-#define STATUS_REQUEST  0xE9 /* @brief Get mouse configuration */
-#define SET_RESOLUTION  0xE8 /* @brief Sets resolution for mouse movement */
-#define SCALING_ACC_MD  0xE7 /* @brief Sets scaling on acceleration mode */
-#define SCALING_LIN_MD  0xE6 /* @brief Sets scaling on linear mode */
-
-/* Mouse Controller Responses */
-#define ACK_OK      0xFA /* @brief Operation sucessful */
-#define ACK_INVALID 0xFE /* @brief Invalid Byte, first occurence */
-#define ACK_ERROR   0xFC /* @brief Invalid Byte on resend */
-
-#endif // _MOUSE_H_

Property changes on: lab4/mouse.h
___________________________________________________________________
Deleted: svn:executable
Index: lab4/kbc.h
===================================================================
--- lab4/kbc.h	(revision 51)
+++ lab4/kbc.h	(nonexistent)
@@ -1,55 +0,0 @@
-#ifndef _KBC_H_
-#define _KBC_H_
-
-/* KBC IRQ Line */
-
-#define KBC_IRQ     1 /* @brief KBC Controller IRQ Line */
-
-/* Delay for KBC */
-#define DELAY           20000 /* @brief KBC Response Delay */
-#define KBC_NUM_TRIES   10    /* @brief Number of tries to issue command before timeout */
-
-/* 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 */
-#define MOUSE_DISABLE   0xA7 /* @brief Disable Mouse */
-#define MOUSE_ENABLE    0xA8 /* @brief Enable Mouse */
-#define MOUSE_INT_TEST  0xA9 /* @brief Tests Mouse data line */
-#define MOUSE_WRITE_B   0xD4 /* @brief Write a byte directly to the mouse */
-
-/* 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 */
-
-/* Command byte masks */
-#define INT_KBD         BIT(0)  /* @brief Enable Keyboard Interrupts */
-#define INT_MOU         BIT(1)  /* @brief Enable Mouse Interrupts */
-#define DIS_KBD         BIT(4)  /* @brief Disable Keyboard */
-#define DIS_MOU         BIT(5)  /* @brief Disable Mouse */
-
-#endif

Property changes on: lab4/kbc.h
___________________________________________________________________
Deleted: svn:executable
Index: lab4/errors.h
===================================================================
--- lab4/errors.h	(revision 51)
+++ lab4/errors.h	(nonexistent)
@@ -1,14 +0,0 @@
-#ifndef _ERRORS_H_
-#define _ERRORS_H_
-
-enum errors {
-    SUCESS = 0,     /* @brief Sucessful */
-    NULL_PTR,       /* @brief Null Pointer Error */
-    LCF_ERROR,      /* @brief Error originated on LCF */
-    SBCR_ERROR,     /* @brief Error on Subscribing Interrupt */
-    USBCR_ERROR,    /* @brief Error on Unsubscring Interrupt*/
-    READ_ERROR,     /* @brief Error on Reading from Port */
-    WRITE_ERROR,    /* @brief Error on Writing to Port */
-};
-
-#endif /* end of include guard: _ERRORS_H_ */

Property changes on: lab4/errors.h
___________________________________________________________________
Deleted: svn:executable
Index: lab4/utils.c
===================================================================
--- lab4/utils.c	(revision 51)
+++ lab4/utils.c	(nonexistent)
@@ -1,13 +0,0 @@
-#include "errors.h"
-
-#include <lcom/lcf.h>
-
-#include <stdint.h>
-
-int (util_sys_inb)(int port, uint8_t *value) {
-    if(value == NULL) return NULL_PTR;
-    uint32_t n = 0;
-    if(sys_inb(port, &n)) return READ_ERROR;
-    *value = n;
-    return SUCCESS;
-}

Property changes on: lab4/utils.c
___________________________________________________________________
Deleted: svn:executable
Index: lab4/Makefile
===================================================================
--- lab4/Makefile	(revision 51)
+++ lab4/Makefile	(nonexistent)
@@ -1,16 +0,0 @@
-# name of the program (Minix service)
-PROG=lab4
-
-# source code files to be compiled
-SRCS = lab4.c
-
-# additional compilation flags
-# "-Wall -Wextra -Werror -I . -std=c11 -Wno-unused-parameter" are already set
-CFLAGS += -pedantic
-
-# 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: lab4/Makefile
___________________________________________________________________
Deleted: svn:executable
Index: lab4/lab4.c
===================================================================
--- lab4/lab4.c	(revision 51)
+++ lab4/lab4.c	(nonexistent)
@@ -1,52 +0,0 @@
-#include <lcom/lcf.h>
-
-#include <stdint.h>
-#include <stdio.h>
-
-// Any header files included below this line should have been created by you
-
-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/lab4/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/lab4/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;
-}
-
-
-int (mouse_test_packet)(uint32_t cnt) {
-}
-
-int (mouse_test_remote)(uint16_t period, uint8_t cnt) {
-    /* To be completed */
-    printf("%s(%u, %u): under construction\n", __func__, period, cnt);
-    return 1;
-}
-
-int (mouse_test_async)(uint8_t idle_time) {
-    /* To be completed */
-    printf("%s(%u): under construction\n", __func__, idle_time);
-    return 1;
-}
-
-int (mouse_test_gesture)() {
-    /* To be completed */
-    printf("%s: under construction\n", __func__);
-    return 1;
-}

Property changes on: lab4/lab4.c
___________________________________________________________________
Deleted: svn:executable
Index: lab4/mouse_func.c
===================================================================
--- lab4/mouse_func.c	(nonexistent)
+++ lab4/mouse_func.c	(revision 52)
@@ -0,0 +1,19 @@
+#include "mouse_func.h"
+#include "errors.h"
+#include "kbc.h"
+#include "mouse.h"
+
+#include <lcom/lcf.h>
+
+int (subscribe_mouse_interrupt)(uint8_t interrupt_bit, int *interrupt_id) {
+    if (interrupt_id == NULL) return NULL_PTR;
+    *interrupt_id = interrupt_bit;
+    if (sys_irqsetpolicy(MOUSE_IRQ, IRQ_REENABLE | IRQ_EXCLUSIVE, interrupt_id)) return SBCR_ERROR;
+    return SUCCESS;
+}
+
+int (unsubscribe_interrupt)(int *interrupt_id) {
+    if (interrupt_id == NULL) return NULL_PTR;
+    if (sys_irqrmpolicy(interrupt_id)) return UNSBCR_ERROR;
+    return SUCCESS;
+}

Property changes on: lab4/mouse_func.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: lab4/mouse_func.h
===================================================================
--- lab4/mouse_func.h	(nonexistent)
+++ lab4/mouse_func.h	(revision 52)
@@ -0,0 +1,26 @@
+##ifndef _MOUSE_FUNC_H_
+#define _MOUSE_FUNC_H_
+
+#include <stdint.h>
+
+/**
+ * @brief Subscribes Mouse Interrupts and disables Minix Default IH
+ * @param interrupt_bit Bit of Interrupt Vector that will be set when Mouse Interrupt is pending
+ * @param interrupt_id Mouse Interrupt ID to specify the Mouse Interrupt in other calls
+ * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
+ * @see {_ERRORS_H_::errors}
+ */
+int (subscribe_mouse_interrupt)(uint8_t interrupt_bit, int *interrupt_id);
+
+/**
+ * @brief Unsubcribes Interrupts
+ * @param interrupt_id Interrupt ID, value via arguments on subscription of the interrupt_id
+ * @see subscribe_kbc_interrupt, subscribe_timer_interrupt
+ * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
+ * @see {_ERRORS_H_::errors}
+ */
+int (unsubscribe_interrupt)(int *interrupt_id);
+
+
+
+#endif /* end of include guard: _MOUSE_FUNC_H_ */

Property changes on: lab4/mouse_func.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
