Project

General

Profile

Revision 2

utilis done

View differences:

lab2/timer.c
16 16
  uint32_t tudo;
17 17
  uint8_t msb,lsb;
18 18
  tudo=(TIMER_FREQ/freq);
19
  msb=(tudo&0xFF00)>>8;
20
  lsb=tudo&0xFF;
19
  util_get_MSB(tudo,&msb);
20
  util_get_LSB(tudo,&lsb);
21
  
21 22
  //printf("%x\n%x\n%x\n%d\n",tudo,msb,lsb,timer);
22 23

  
23 24

  
......
149 150
  if(field==tsf_base ) //BCD
150 151
  {
151 152
    //printf("%d\n",tsf_base);
152
    if((st&0x1)==1)
153
    if((st&BIT(0))==1)
153 154
    val.bcd=true;
154 155

  
155 156
    else val.bcd=false;
lab2/utils.c
4 4

  
5 5
int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
6 6
  /* To be implemented by the students */
7
  printf("%s is not yet implemented!\n", __func__);
8

  
9
  return 1;
7
  //printf("%s is not yet implemented!\n", __func__);
8
  *lsb=val&0xFF;
9
  return 0;
10 10
}
11 11

  
12 12
int(util_get_MSB)(uint16_t val, uint8_t *msb) {
13 13
  /* To be implemented by the students */
14
  printf("%s is not yet implemented!\n", __func__);
14
  //printf("%s is not yet implemented!\n", __func__);
15
  *msb=(val&0xFF00)>>8;
15 16

  
16
  return 1;
17
  return 0;
17 18
}
18 19

  
19 20
int (util_sys_inb)(int port, uint8_t *value) {

Also available in: Unified diff