]>
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 | ||
72f58822 | 46 | #ifdef __AVR__ |
d684c216 L |
47 | static inline |
48 | void my_puts_P(const char *s) | |
49 | { | |
50 | fputs_P(s, stdout); | |
d684c216 L |
51 | } |
52 | ||
72f58822 L |
53 | #else |
54 | static inline | |
55 | void my_puts_P(const char *s) | |
56 | { | |
57 | fputs(s, stdout); | |
58 | } | |
59 | #endif /* __AVR__ */ | |
d684c216 L |
60 | #endif /* COMMON_H */ |
61 |