From 5e174a511b37e17cd3fcaedad608ce605ba34ce9 Mon Sep 17 00:00:00 2001 From: "izsh@fail0verflow.com" Date: Sat, 20 Feb 2010 03:07:55 +0000 Subject: [PATCH] marcan's patch until he gets commit access. Remove C library's includes from the firmware side since it's not available anyway and not used --- armsrc/Makefile | 3 +++ armsrc/appmain.c | 4 +++- armsrc/iso15693.c | 2 -- armsrc/legicrf.c | 3 +-- armsrc/stdint.h | 34 ++++++++++++++++++++++++++++++++++ bootrom/Makefile | 3 +++ bootrom/stdint.h | 34 ++++++++++++++++++++++++++++++++++ include/legic_prng.h | 9 +++++++-- 8 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 armsrc/stdint.h create mode 100644 bootrom/stdint.h diff --git a/armsrc/Makefile b/armsrc/Makefile index 47f8c73d..2614b9e9 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -31,6 +31,9 @@ ARMSRC = fpgaloader.c \ legic_prng.c \ crc.c +# stdint.h provided locally until GCC 4.5 becomes C99 compliant +APP_CFLAGS += -I. + # Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC include ../common/Makefile.common diff --git a/armsrc/appmain.c b/armsrc/appmain.c index b231cae1..b517fa6c 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -6,7 +6,6 @@ //----------------------------------------------------------------------------- #include -#include #include "apps.h" #include "legicrf.h" #ifdef WITH_LCD @@ -20,6 +19,9 @@ #define va_end __builtin_va_end int kvsprintf(char const *fmt, void *arg, int radix, va_list ap); + +#define abs(x) ( ((x)<0) ? -(x) : (x) ) + //============================================================================= // A buffer where we can queue things up to be sent through the FPGA, for // any purpose (fake tag, as reader, whatever). We go MSB first, since that diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index 4c9a7d60..acace295 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -10,8 +10,6 @@ //----------------------------------------------------------------------------- #include #include "apps.h" -#include -#include // FROM winsrc\prox.h ////////////////////////////////// #define arraylen(x) (sizeof(x)/sizeof((x)[0])) diff --git a/armsrc/legicrf.c b/armsrc/legicrf.c index 5b0bf37a..a804ded2 100644 --- a/armsrc/legicrf.c +++ b/armsrc/legicrf.c @@ -8,8 +8,7 @@ #include "apps.h" #include "legicrf.h" -#include "unistd.h" -#include "stdint.h" +#include #include "legic_prng.h" #include "crc.h" diff --git a/armsrc/stdint.h b/armsrc/stdint.h new file mode 100644 index 00000000..8e444b6d --- /dev/null +++ b/armsrc/stdint.h @@ -0,0 +1,34 @@ +/* + * bits32/stdint.h + */ + +#ifndef _BITSIZE_STDINT_H +#define _BITSIZE_STDINT_H + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; + +typedef int int_fast16_t; +typedef int int_fast32_t; + +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; + +typedef int intptr_t; +typedef unsigned int uintptr_t; + +#define __INT64_C(c) c ## LL +#define __UINT64_C(c) c ## ULL + +#define __PRI64_RANK "ll" +#define __PRIFAST_RANK "" +#define __PRIPTR_RANK "" + +#endif /* _BITSIZE_STDINT_H */ diff --git a/bootrom/Makefile b/bootrom/Makefile index f88b3cdd..cae1a079 100644 --- a/bootrom/Makefile +++ b/bootrom/Makefile @@ -12,6 +12,9 @@ ASMSRC = ram-reset.s flash-reset.s ARMSRC := $(ARMSRC) $(THUMBSRC) THUMBSRC := +# stdint.h provided locally until GCC 4.5 becomes C99 compliant +APP_CFLAGS = -I. + # Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC include ../common/Makefile.common diff --git a/bootrom/stdint.h b/bootrom/stdint.h new file mode 100644 index 00000000..8e444b6d --- /dev/null +++ b/bootrom/stdint.h @@ -0,0 +1,34 @@ +/* + * bits32/stdint.h + */ + +#ifndef _BITSIZE_STDINT_H +#define _BITSIZE_STDINT_H + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; + +typedef int int_fast16_t; +typedef int int_fast32_t; + +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; + +typedef int intptr_t; +typedef unsigned int uintptr_t; + +#define __INT64_C(c) c ## LL +#define __UINT64_C(c) c ## ULL + +#define __PRI64_RANK "ll" +#define __PRIFAST_RANK "" +#define __PRIPTR_RANK "" + +#endif /* _BITSIZE_STDINT_H */ diff --git a/include/legic_prng.h b/include/legic_prng.h index edcf49cc..77c5ec29 100644 --- a/include/legic_prng.h +++ b/include/legic_prng.h @@ -1,5 +1,10 @@ -#include "unistd.h" -#include "stdint.h" +#ifndef LEGIC_PRNG_H__ +#define LEGIC_PRNG_H__ + +#include extern void legic_prng_init(uint8_t init); extern void legic_prng_forward(int count); extern uint8_t legic_prng_get_bit(); + +#endif + -- 2.39.5