2009-04-29 12:47:41 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
Public platform independent Near Field Communication (NFC) library
|
|
|
|
Copyright (C) 2009, Roel Verdult
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
2009-06-26 09:05:25 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
2009-04-29 12:47:41 +00:00
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2009-06-26 09:05:25 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
2009-04-29 12:47:41 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2009-02-12 12:39:05 +00:00
|
|
|
#ifndef _LIBNFC_DEFINES_H_
|
|
|
|
#define _LIBNFC_DEFINES_H_
|
|
|
|
|
2009-05-27 12:18:21 +00:00
|
|
|
// #define DEBUG /* DEBUG flag can also be enabled using ./configure --enable-debug */
|
2009-04-29 12:47:41 +00:00
|
|
|
|
|
|
|
typedef void* dev_spec; // Device connection specification
|
2009-05-27 12:18:21 +00:00
|
|
|
#define INVALID_DEVICE_INFO 0
|
2009-02-12 12:39:05 +00:00
|
|
|
#define MAX_FRAME_LEN 264
|
2009-04-29 12:47:41 +00:00
|
|
|
#define DEVICE_NAME_LENGTH 256
|
2009-06-11 08:34:43 +00:00
|
|
|
#define MAX_DEVICES 16
|
2009-02-12 12:39:05 +00:00
|
|
|
|
2009-04-29 12:47:41 +00:00
|
|
|
// Useful macros
|
2009-08-28 10:46:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
// #define DBG(x, args...) printf("DBG %s:%d: " x "\n", __FILE__, __LINE__,## args )
|
|
|
|
#define DBG(x, ...) printf("DBG %s:%d: " x "\n", __FILE__, __LINE__, ## __VA_ARGS__ )
|
|
|
|
#else
|
|
|
|
#define DBG(...) {}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define INFO(x, ...) printf("INFO: " x "\n", ## __VA_ARGS__ )
|
|
|
|
#define WARN(x, ...) printf("WARNING: " x "\n", ## __VA_ARGS__ )
|
|
|
|
#define ERR(x, ...) printf("ERROR: " x "\n", ## __VA_ARGS__ )
|
|
|
|
|
2009-09-03 15:24:12 +00:00
|
|
|
#if defined __cplusplus
|
|
|
|
#define LIBNFC_EXPORT extern "C"
|
|
|
|
#else
|
|
|
|
#ifdef _WIN32
|
|
|
|
#ifdef nfc_EXPORTS
|
|
|
|
#define LIBNFC_EXPORT __declspec( dllexport )
|
|
|
|
#else
|
|
|
|
#define LIBNFC_EXPORT __declspec( dllimport )
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define LIBNFC_EXPORT
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2009-07-16 12:09:06 +00:00
|
|
|
//#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
|
|
|
//#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
2009-04-29 12:47:41 +00:00
|
|
|
#define INNER_XOR8(n) {n ^= (n >> 4); n ^= (n >> 2); n ^= (n >> 1); n &= 0x01; }
|
|
|
|
#define INNER_XOR32(n) {n ^= (n >> 16); n ^= (n >> 8); INNER_XOR8(n); }
|
|
|
|
#define INNER_XOR64(n) {n ^= (n >> 32); INNER_XOR32(n); }
|
2009-02-12 12:39:05 +00:00
|
|
|
|
|
|
|
#endif // _LIBNFC_DEFINES_H_
|