Project

General

Profile

Revision 20

timer_test_int prototype

View differences:

utils.c
2 2

  
3 3
#include <stdint.h>
4 4

  
5
/* Byte Masks */
6
#define LSB 0xFF /**< @brief mask to filter least significant byte */
7

  
5 8
int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
6
    if (lsb == NULL)
7
        return 1;
9
    if (lsb == NULL) return 1;
8 10

  
9
    *lsb = val;
11
    *lsb = val & LSB;
10 12
    return 0;
11 13
}
12 14

  
13 15
int(util_get_MSB)(uint16_t val, uint8_t *msb) {
14
    if (msb == NULL)
15
        return 1;
16
    if (msb == NULL) return 1;
16 17
    *msb = val >> 8;
17 18
    return 0;
18 19
}
19 20

  
20 21
int (util_sys_inb)(int port, uint8_t *value) {
21
    /* To be implemented by the students */
22 22
    if(value == NULL) return 1;
23 23
    uint32_t n = 0;
24 24
    if(sys_inb(port, &n)) return 1;
25
    *value = n;
25
    *value = n & LSB;
26 26
    return 0;
27 27
}

Also available in: Unified diff