Revision 5
implemented functions for 1st part
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 |
/* To be implemented by the students */
|
|
7 |
printf("%s is not yet implemented!\n", __func__);
|
|
8 | 8 |
|
9 |
return 1; |
|
9 |
return 1;
|
|
10 | 10 |
} |
11 | 11 |
|
12 | 12 |
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__); |
|
13 |
/* To be implemented by the students */
|
|
14 |
printf("%s is not yet implemented!\n", __func__);
|
|
15 | 15 |
|
16 |
return 1; |
|
16 |
return 1;
|
|
17 | 17 |
} |
18 | 18 |
|
19 | 19 |
int (util_sys_inb)(int port, uint8_t *value) { |
20 |
/* To be implemented by the students */ |
|
21 |
printf("%s is not yet implemented!\n", __func__); |
|
22 |
|
|
23 |
return 1; |
|
20 |
/* To be implemented by the students */ |
|
21 |
uint32_t n = 0; |
|
22 |
int ret = sys_inb(port, &n); |
|
23 |
*value = n; |
|
24 |
return ret; |
|
24 | 25 |
} |
Also available in: Unified diff