Index: lab3/timer.c
===================================================================
--- lab3/timer.c	(revision 10)
+++ lab3/timer.c	(nonexistent)
@@ -1,164 +0,0 @@
-#include <lcom/lcf.h>
-#include <lcom/timer.h>
-
-#include <stdint.h>
-
-#include "i8254.h"
-
-uint32_t cont=0;
-int hook_id;
-
-
-int (timer_set_frequency)(uint8_t timer, uint32_t freq) {
-  /* To be implemented by the students */
-  uint8_t conf;
-  timer_get_conf(timer,&conf);
-  uint32_t tudo;
-  uint8_t msb,lsb;
-  tudo=(TIMER_FREQ/freq);
-  util_get_MSB(tudo,&msb);
-  util_get_LSB(tudo,&lsb);
-  
-  //printf("%x\n%x\n%x\n%d\n",tudo,msb,lsb,timer);
-
-
-  if(timer==0)
-  {
-    conf=(conf&0xF);
-    conf = (conf  | TIMER_SEL0 | TIMER_LSB_MSB);
-  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
-  if(sys_outb(TIMER_0, lsb)!=0) return 1;
-  if(sys_outb(TIMER_0, msb)!=0) return 1;
-  }
-
-  if(timer==1)
-  {
-    conf=(conf&0xF);
-    conf = (conf | TIMER_SEL1 | TIMER_LSB_MSB);
-  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
-  if(sys_outb(TIMER_1, lsb)!=0) return 1;
-  if(sys_outb(TIMER_1, msb)!=0) return 1;
-  }
-
-  if(timer==2)
-  {
-    conf=(conf&0xF);
-    conf = (conf | TIMER_SEL2 | TIMER_LSB_MSB);
-  if(sys_outb(TIMER_CTRL, conf)!=0) return 1;
-  if(sys_outb(TIMER_2, lsb)!=0) return 1;
-  if(sys_outb(TIMER_2, msb)!=0) return 1;
-  }
-  return 0;
-
-}
-
-int (timer_subscribe_int)(uint8_t *bit_no) {
-    /* To be implemented by the students */
-  //printf("%s is not yet implemented!\n", __func__);
- /*  int policy;
-  sys_irqrmpolicy(&policy); */
-  hook_id=*bit_no;
-  sys_irqsetpolicy(IRQ_TIMER,IRQ_REENABLE,&hook_id);
-
-  return 1;
-}
-
-int (timer_unsubscribe_int)() {
-  /* To be implemented by the students */
-// printf("%s is not yet implemented!\n", __func__);
-
-sys_irqrmpolicy(&hook_id);
-
-  return 1;
-}
-
-void (timer_int_handler)() {
-  /* To be implemented by the students */
-  //printf("%s is not yet implemented!\n", __func__);
-  cont=cont+1;
-}
-
-int (timer_get_conf)(uint8_t timer, uint8_t *st) {
-  /* To be implemented by the students */
-
-  uint8_t rbc = (TIMER_RB_CMD|TIMER_RB_SEL(4)|TIMER_RB_SEL(timer));
-  if(sys_outb(TIMER_CTRL,rbc)!=0) return 1;
-
-  
-  if(timer==0)
-  return (util_sys_inb(TIMER_0,st));
-  if(timer==1)
-  return (util_sys_inb(TIMER_1,st));
-  if(timer==2)
-  return (util_sys_inb(TIMER_2,st));
-
-  return 1;
-
-  //printf("%s is not yet implemented!\n", __func__);
-
-  
-}
-
-int (timer_display_conf)(uint8_t timer, uint8_t st,
-                        enum timer_status_field field) {
-  /* To be implemented by the students */
-  union timer_status_field_val val;
-  
-
-  if(field==tsf_all)
-  {
-    val.byte=st; 
-    
-  }
- if(field==tsf_initial)
-  {
-    //printf("%d\n",tsf_initial);
-
-  if(((st&0x30)>>4)==0)
-  val.in_mode=INVAL_val;
-
-  if(((st&0x30)>>4)==1)
-  val.in_mode=LSB_only;
-
-  if(((st&0x30)>>4)==2)
-  val.in_mode=MSB_only;
-
-  if(((st&0x30)>>4)==3)
-  val.in_mode=MSB_after_LSB;
-  }
-  
-
-  if(field==tsf_mode)
-  {
-    //printf("%x\n",st);
-    val.count_mode=((st&0xE)>>1);
-
-    /* printf("%x\n",val.count_mode);
-    val.count_mode=(val.count_mode>>1);
-    printf("%x\n",val.count_mode); */
-  //val.count_mode=(st&0x1C)/4;
-
- if (val.count_mode==6)
- val.count_mode=2;
-
- if (val.count_mode==7)
- val.count_mode=3;
-
-
-  }
-
-  if(field==tsf_base ) //BCD
-  {
-    //printf("%d\n",tsf_base);
-    if((st&BIT(0))==1)
-    val.bcd=true;
-
-    else val.bcd=false;
-  }
-
-
- return( timer_print_config(timer, field, val));
-  //printf("%s is not yet implemented!\n", __func__);
-
-  //return 0;
-}

Property changes on: lab3/timer.c
___________________________________________________________________
Deleted: svn:executable
Index: lab3/lab2.c
===================================================================
--- lab3/lab2.c	(revision 10)
+++ lab3/lab2.c	(nonexistent)
@@ -1,109 +0,0 @@
-#include <lcom/lcf.h>
-#include <lcom/lab2.h>
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "i8254.h"
-//#include "timer.c"
-extern uint32_t cont;
-
-
-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 */
-  uint8_t st;
-  if(timer_get_conf(timer,&st)==1) return 1;
-  if(timer_display_conf(timer,st,field)==1) return 1;
-
-  return 0;
- // printf("%s is not yet implemented!\n", __func__);
-
-}
-
-int(timer_test_time_base)(uint8_t timer, uint32_t freq) {
-  /* To be implemented by the students */
-  if(freq<MIN_FREQ || freq>TIMER_FREQ)
-  {
-    printf("OUT OF RANGE FREQUENCY\n");
-    return 1;
-  }
-  return(timer_set_frequency(timer,freq));
-  //printf("%s is not yet implemented!\n", __func__);
-
-}
-
-int(timer_test_int)(uint8_t time) {
-  /* To be implemented by the students */
-
-  if(time<0) return 1;
-
-  int ipc_status;
-  message msg;
-  uint8_t r;
-  uint8_t bit_no = 0;
-  timer_subscribe_int(&bit_no);
-  while( (cont/DEFAULT_FREQ)<time )
- { /* You may want to use a different condition */
-     /* Get a request message. */
-     // printf("1\n");
-     //printf("cont:%d, time:%d\n\n",cont/60,time);
-     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  & BIT(0)) { /* subscribed interrupt */
-                   timer_int_handler();
-                   if(cont%DEFAULT_FREQ==0)
-                   timer_print_elapsed_time();
-                   //printf("cont:%d\n",cont);
-               }
-                //printf("msg:%x\n",msg.m_notify.interrupts);
-                break;
-            default:
-                //printf("2\n");
-                break; /* no other notifications expected: do nothing */	
-        }
-    } else {
-     // printf("3\n"); /* received a standard message, not a notification */
-        /* no standard messages expected: do nothing */
-    }
- }
- if(timer_unsubscribe_int()!=0) return 1;
-
-
-  //printf("%s is not yet implemented!\n", __func__);
-
-  return 0;
-}
-//dois primeiros bits sao 1, (TIMER_RB_CNTRL|BIT(5))
-//SYS_OUTB para controlo->0x43, Config timer 0, dizer que queremos escrever para o controlo, e depois ler a parte corresponder
-//g9

Property changes on: lab3/lab2.c
___________________________________________________________________
Deleted: svn:executable
