Revision 25
fixed interrupt subscription, implemented interrupt handler
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 |
|
|
8 | 5 |
int(util_get_LSB)(uint16_t val, uint8_t *lsb) { |
9 | 6 |
if (lsb == NULL) return 1; |
10 | 7 |
|
11 |
*lsb = val & LSB;
|
|
8 |
*lsb = (uint8_t)val;
|
|
12 | 9 |
return 0; |
13 | 10 |
} |
14 | 11 |
|
15 | 12 |
int(util_get_MSB)(uint16_t val, uint8_t *msb) { |
16 | 13 |
if (msb == NULL) return 1; |
17 |
*msb = val >> 8;
|
|
14 |
*msb = (uint8_t)(val >> 8);
|
|
18 | 15 |
return 0; |
19 | 16 |
} |
20 | 17 |
|
... | ... | |
22 | 19 |
if(value == NULL) return 1; |
23 | 20 |
uint32_t n = 0; |
24 | 21 |
if(sys_inb(port, &n)) return 1; |
25 |
*value = n & LSB;
|
|
22 |
*value = (uint8_t)n;
|
|
26 | 23 |
return 0; |
27 | 24 |
} |
Also available in: Unified diff