Index: lab2/Makefile
===================================================================
--- lab2/Makefile	(nonexistent)
+++ lab2/Makefile	(revision 4)
@@ -0,0 +1,16 @@
+# name of the program (Minix service)
+PROG=lab2 
+
+# source code files to be compiled
+SRCS = lab2.c timer.c utils.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: lab2/Makefile
___________________________________________________________________
Added: svn:executable
Index: lab2/i8254.h
===================================================================
--- lab2/i8254.h	(nonexistent)
+++ lab2/i8254.h	(revision 4)
@@ -0,0 +1,57 @@
+#ifndef _LCOM_I8254_H_
+#define _LCOM_I8254_H_
+
+#include <lcom/lcf.h>
+
+/** @defgroup i8254 i8254
+ * @{
+ *
+ * Constants for programming the i8254 Timer. Needs to be completed.
+ */
+
+#define TIMER_FREQ 1193182 /**< @brief clock frequency for timer in PC and AT */
+#define TIMER0_IRQ 0 /**< @brief Timer 0 IRQ line */
+
+/* I/O port addresses */
+
+#define TIMER_0    0x40 /**< @brief Timer 0 count register */
+#define TIMER_1    0x41 /**< @brief Timer 1 count register */
+#define TIMER_2    0x42 /**< @brief Timer 2 count register */
+#define TIMER_CTRL 0x43 /**< @brief Control register */
+
+#define SPEAKER_CTRL 0x61 /**< @brief Register for speaker control  */
+
+/* Timer control */
+
+/* Timer selection: bits 7 and 6 */
+
+#define TIMER_SEL0   0x00              /**< @brief Control Word for Timer 0 */
+#define TIMER_SEL1   BIT(6)            /**< @brief Control Word for Timer 1 */
+#define TIMER_SEL2   BIT(7)            /**< @brief Control Word for Timer 2 */
+#define TIMER_RB_CMD (BIT(7) | BIT(6)) /**< @brief Read Back Command */
+
+/* Register selection: bits 5 and 4 */
+
+#define TIMER_LSB     BIT(4)                  /**< @brief Initialize Counter LSB only */
+#define TIMER_MSB     BIT(5)                  /**< @brief Initialize Counter MSB only */
+#define TIMER_LSB_MSB (TIMER_LSB | TIMER_MSB) /**< @brief Initialize LSB first and MSB afterwards */
+
+/* Operating mode: bits 3, 2 and 1 */
+
+#define TIMER_SQR_WAVE (BIT(2) | BIT(1)) /**< @brief Mode 3: square wave generator */
+#define TIMER_RATE_GEN BIT(2)            /**< @brief Mode 2: rate generator */
+
+/* Counting mode: bit 0 */
+
+#define TIMER_BCD 0x01 /**< @brief Count in BCD */
+#define TIMER_BIN 0x00 /**< @brief Count in binary */
+
+/* READ-BACK COMMAND FORMAT */
+
+#define TIMER_RB_COUNT_  BIT(5)
+#define TIMER_RB_STATUS_ BIT(4)
+#define TIMER_RB_SEL(n)  BIT((n) + 1)
+
+/**@}*/
+
+#endif /* _LCOM_I8254_H */

Property changes on: lab2/i8254.h
___________________________________________________________________
Added: svn:executable
Index: lab2/lab2.c
===================================================================
--- lab2/lab2.c	(nonexistent)
+++ lab2/lab2.c	(revision 4)
@@ -0,0 +1,51 @@
+#include <lcom/lcf.h>
+#include <lcom/lab2.h>
+
+#include <stdbool.h>
+#include <stdint.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/lab2/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/lab2/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(timer_test_read_config)(uint8_t timer, enum timer_status_field field) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+int(timer_test_time_base)(uint8_t timer, uint32_t freq) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+int(timer_test_int)(uint8_t time) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}

Property changes on: lab2/lab2.c
___________________________________________________________________
Added: svn:executable
Index: lab2/timer.c
===================================================================
--- lab2/timer.c	(nonexistent)
+++ lab2/timer.c	(revision 4)
@@ -0,0 +1,47 @@
+#include <lcom/lcf.h>
+#include <lcom/timer.h>
+
+#include <stdint.h>
+
+#include "i8254.h"
+
+int (timer_set_frequency)(uint8_t timer, uint32_t freq) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+int (timer_subscribe_int)(uint8_t *bit_no) {
+    /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+int (timer_unsubscribe_int)() {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+void (timer_int_handler)() {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+}
+
+int (timer_get_conf)(uint8_t timer, uint8_t *st) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+int (timer_display_conf)(uint8_t timer, uint8_t st,
+                        enum timer_status_field field) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}

Property changes on: lab2/timer.c
___________________________________________________________________
Added: svn:executable
Index: lab2/utils.c
===================================================================
--- lab2/utils.c	(nonexistent)
+++ lab2/utils.c	(revision 4)
@@ -0,0 +1,24 @@
+#include <lcom/lcf.h>
+
+#include <stdint.h>
+
+int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+int(util_get_MSB)(uint16_t val, uint8_t *msb) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}
+
+int (util_sys_inb)(int port, uint8_t *value) {
+  /* To be implemented by the students */
+  printf("%s is not yet implemented!\n", __func__);
+
+  return 1;
+}

Property changes on: lab2/utils.c
___________________________________________________________________
Added: svn:executable
