Project

General

Profile

Revision 7

Work on utils.c

View differences:

lab2/timer.c
37 37
    if(sys_outb(write_port, cmd)) return 1;
38 38

  
39 39
    int read_port;
40
    switch(timer){
40
    switch(timer) {
41 41
        case 0: read_port = TIMER_0; break;
42 42
        case 1: read_port = TIMER_1; break;
43 43
        case 2: read_port = TIMER_2; break;
lab2/utils.c
3 3
#include <stdint.h>
4 4

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

  
9
    return 1;
9
    *lsb = val;
10
    return 0;
10 11
}
11 12

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

  
16
    return 1;
14
    if (*msb == NULL)
15
        return 1;
16
    *msb = val >> 8;
17
    return 0;
17 18
}
18 19

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

Also available in: Unified diff