X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/26331e248f87b8d640054c91b581f482cd89bede..a2907f2e2b2725679d6b3b8d3231f3d94c325014:/include/common.h diff --git a/include/common.h b/include/common.h index b0dd038..dea638a 100644 --- a/include/common.h +++ b/include/common.h @@ -1,6 +1,15 @@ +/* + * (C) Copyright 2014 Leo C. + * + * SPDX-License-Identifier: GPL-2.0 + */ + #ifndef COMMON_H #define COMMON_H +#include +#include + #ifdef __AVR__ #include #include @@ -30,8 +39,6 @@ struct bits { // TODO: stm32 #endif /* __AVR__ */ -#include - #ifdef __FLASH #define FLASH __flash #define MEMX __memx @@ -46,6 +53,12 @@ struct bits { #define FSTR(X) ((const FLASH char[]) { X } ) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#define MIN(a,b) ({ typeof (a) _a = (a); \ + typeof (b) _b = (b); \ + _a < _b ? _a : _b; }) +#define MAX(a,b) ({ typeof (a) _a = (a); \ + typeof (b) _b = (b); \ + _a > _b ? _a : _b; }) #ifdef __AVR__ #define Stat GPIOR0 @@ -53,7 +66,7 @@ struct bits { extern volatile uint_least8_t Stat; #endif /* __AVR__ */ -#define S_10MS_TO (1<<0) +#define S_10MS_TO (1<<0) #define S_MSG_PENDING (1<<1) #define S_CON_PENDING (1<<2)