X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/0c728c8de88d86247d2a75348e71f5af37838c28..976db69ffa80c4d499e53f6f22c26d784fdac0a1:/include/common.h diff --git a/include/common.h b/include/common.h index 10c4417..e89b91f 100644 --- a/include/common.h +++ b/include/common.h @@ -1,12 +1,25 @@ /* * (C) Copyright 2014 Leo C. * - * SPDX-License-Identifier: GPL-2.0+ + * SPDX-License-Identifier: GPL-2.0 */ #ifndef COMMON_H #define COMMON_H +#include +#include +#include +#include +#include +#include +#include "errnum.h" + +#define GCC_VERSION (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) + +#define USED __attribute__((used)) +#define UNUSED __attribute__((unused)) + #ifdef __AVR__ #include #include @@ -27,17 +40,20 @@ struct bits { #define SBIT(port,pin) ((*(volatile struct bits*)&port).b##pin) -//TODO: +//GCC bug PR61443 // Known to work: 4.8.4, 4.9.1 // Known to fail: 4.8.3, 4.9.0 + +#if (GCC_VERSION < 40804) || (GCC_VERSION == 40900) #define GCC_BUG_61443 1 +#endif /* PR61443 */ + +#define DEVICE_NAME __AVR_DEVICE_NAME__ #else // TODO: stm32 #endif /* __AVR__ */ -#include - #ifdef __FLASH #define FLASH __flash #define MEMX __memx @@ -65,23 +81,24 @@ struct bits { extern volatile uint_least8_t Stat; #endif /* __AVR__ */ -#define S_10MS_TO (1<<0) -#define S_MSG_PENDING (1<<1) -#define S_CON_PENDING (1<<2) +#define S_10MS_TO (1<<0) +#define S_MSG_PENDING (1<<1) +#define S_CON_PENDING (1<<3) +#define S_RESET_POLARITY (1<<4) static inline -void my_puts(const char *s) +int my_puts(const char *s) { - fputs(s, stdout); + return fputs(s, stdout); } static inline -void my_puts_P(const char *s) +int my_puts_P(const char *s) { #ifdef __AVR__ - fputs_P(s, stdout); + return fputs_P(s, stdout); #else - fputs(s, stdout); + return fputs(s, stdout); #endif /* __AVR__ */ }