]>
Commit | Line | Data |
---|---|---|
d684c216 L |
1 | #ifndef COMMON_H |
2 | #define COMMON_H | |
3 | ||
4 | #ifdef __AVR__ | |
5 | #include <avr/io.h> | |
6 | ||
7 | //TODO: | |
8 | // Known to work: 4.8.4, 4.9.1 | |
9 | // Known to fail: 4.8.3, 4.9.0 | |
10 | #define GCC_BUG_61443 1 | |
11 | ||
12 | #else | |
13 | // TODO: stm32 | |
72f58822 | 14 | #endif /* __AVR__ */ |
d684c216 L |
15 | |
16 | #include <stdio.h> | |
17 | ||
18 | #ifdef __FLASH | |
19 | #define FLASH __flash | |
20 | #else | |
21 | #define FLASH | |
22 | #endif | |
23 | ||
24 | #define stringify(s) tostring(s) | |
25 | #define tostring(s) #s | |
26 | ||
27 | #define FSTR(X) ((const FLASH char[]) { X } ) | |
28 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | |
29 | ||
30 | ||
31 | #ifdef __AVR__ | |
32 | #define Stat GPIOR0 | |
33 | #else | |
34 | extern volatile uint_least8_t Stat; | |
72f58822 | 35 | #endif /* __AVR__ */ |
d684c216 L |
36 | |
37 | #define S_10MS_TO (1<<0) | |
72f58822 | 38 | #define S_Z180_RUNNING (2<<0) |
d684c216 L |
39 | |
40 | static inline | |
41 | void my_puts(const char *s) | |
42 | { | |
43 | fputs(s, stdout); | |
d684c216 L |
44 | } |
45 | ||
46 | static inline | |
47 | void my_puts_P(const char *s) | |
48 | { | |
61b0cfe9 | 49 | #ifdef __AVR__ |
d684c216 | 50 | fputs_P(s, stdout); |
72f58822 | 51 | #else |
72f58822 | 52 | fputs(s, stdout); |
72f58822 | 53 | #endif /* __AVR__ */ |
61b0cfe9 L |
54 | } |
55 | ||
d684c216 L |
56 | #endif /* COMMON_H */ |
57 |