(libnfc-less-bitutils-more-ponies) Get rid of bitutils.[hc] (part 1).

- New API function append_iso14443a_crc();
  - Add a PRINT_HEX macro for driver debugging (replaces print_hex function from bitutils.c);
  - Move bit-mirroring related functions to libnfc/mirror-subr.[hc];
  - Move iso14443 related functions to libnfc/iso14443-subr.c;
  - Move libnfc/bitutils.c hex-dumping code to examples/nfc-utils.c;
  - Replace calls to swap_endian32() and swap_endian64() functions with calls to bswap32() and bswap64 provided by endian.h.

And while I am here:
  - Fix the DBG macro so that it does not throw warning at compile time.
This commit is contained in:
Romain Tartiere 2010-04-16 16:38:57 +00:00
parent 5302930b09
commit 10baef235f
24 changed files with 328 additions and 343 deletions

View file

@ -31,7 +31,10 @@
// Useful macros
#ifdef DEBUG
// #define DBG(x, args...) printf("DBG %s:%d: " x "\n", __FILE__, __LINE__,## args )
#define DBG(x, ...) fprintf(stderr, "DBG %s:%d: " x "\n", __FILE__, __LINE__, ## __VA_ARGS__ )
#define DBG(...) do { \
warnx ("DBG %s:%d", __FILE__, __LINE__); \
warnx (" " __VA_ARGS__ ); \
} while (0)
#else
#define DBG(...) {}
#endif

View file

@ -84,6 +84,7 @@ NFC_EXPORT const char* nfc_device_name(nfc_device_t* pnd);
/* Misc. functions */
NFC_EXPORT void iso14443a_crc(byte_t* pbtData, size_t szLen, byte_t* pbtCrc);
NFC_EXPORT void append_iso14443a_crc(byte_t* pbtData, size_t szLen);
NFC_EXPORT const char* nfc_version(void);
#ifdef __cplusplus