Need stdio.h for fprintf
[librfid] / include / librfid / rfid.h
1 #ifndef _RFID_H
2 #define _RFID_H
3
4 #include <stddef.h>
5 #include <sys/types.h>
6
7 #ifdef  __MINGW32__
8 #define ENOTSUP         100
9 #define ETIMEDOUT       101
10 typedef unsigned char u_int8_t;
11 typedef unsigned short u_int16_t;
12 typedef unsigned long u_int32_t;
13 typedef unsigned long long u_int64_t;
14 #endif/*__MINGW32__*/
15
16 #ifdef  __LIBRFID__
17
18 #include <librfid/rfid_system.h>
19
20 #ifdef DEBUG_LIBRFID
21
22 #ifdef LIBRFID_FIRMWARE
23 extern void debugp(const char *format, ...);
24 extern const char *hexdump(const void *data, unsigned int len);
25 #define rfid_hexdump(x, y) hexdump(x, y)
26 #define DEBUGP(x, args ...) debugp("%s(%d):%s: " x, __FILE__, __LINE__, __FUNCTION__, ## args)
27 #define DEBUGPC(x, args ...) debugp(x, ## args)
28 #else /* LIBRFID_FIRMWARE */
29 extern const char *rfid_hexdump(const void *data, unsigned int len);
30 #define DEBUGP(x, args ...) fprintf(stderr, "%s(%d):%s: " x, __FILE__, __LINE__, __FUNCTION__, ## args)
31 #define DEBUGPC(x, args ...) fprintf(stderr, x, ## args)
32 #endif /* LIBRFID_FIRMWARE */
33
34 #include <stdio.h>
35
36 #else /* DEBUG */
37 extern const char *rfid_hexdump(const void *data, unsigned int len);
38
39 #define DEBUGP(x, args ...)
40 #define DEBUGPC(x, args ...)
41
42 #endif /* DEBUG */
43
44
45 #ifndef ARRAY_SIZE
46 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
47 #endif
48
49 #endif /* __LIBRFID__ */
50
51 int rfid_init();
52
53 enum rfid_opt_level {
54         RFID_LEVEL_ASIC,
55         RFID_LEVEL_READER,
56         RFID_LEVEL_LAYER2,
57         RFID_LEVEL_LAYER3,
58 };
59
60 enum rfid_frametype {
61         RFID_14443A_FRAME_REGULAR,
62         RFID_14443B_FRAME_REGULAR,
63         RFID_MIFARE_FRAME,
64 };
65
66 #endif /* _RFID_H */