diff options
Diffstat (limited to 'avr/common.h')
-rw-r--r-- | avr/common.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/avr/common.h b/avr/common.h new file mode 100644 index 0000000..a92f62c --- /dev/null +++ b/avr/common.h @@ -0,0 +1,61 @@ +#ifndef COMMON_H +#define COMMON_H + +#ifdef __AVR__ +#include <avr/io.h> + +//TODO: +// Known to work: 4.8.4, 4.9.1 +// Known to fail: 4.8.3, 4.9.0 +#define GCC_BUG_61443 1 + +#else +// TODO: stm32 +#endif /* __AVR__ */ + +#include <stdio.h> + +#ifdef __FLASH +#define FLASH __flash +#else +#define FLASH +#endif + +#define stringify(s) tostring(s) +#define tostring(s) #s + +#define FSTR(X) ((const FLASH char[]) { X } ) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + + +#ifdef __AVR__ +#define Stat GPIOR0 +#else +extern volatile uint_least8_t Stat; +#endif /* __AVR__ */ + +#define S_10MS_TO (1<<0) +#define S_Z180_RUNNING (2<<0) + +static inline +void my_puts(const char *s) +{ + fputs(s, stdout); +} + +#ifdef __AVR__ +static inline +void my_puts_P(const char *s) +{ + fputs_P(s, stdout); +} + +#else +static inline +void my_puts_P(const char *s) +{ + fputs(s, stdout); +} +#endif /* __AVR__ */ +#endif /* COMMON_H */ + |