580cc09031d5ec63edaf19e38bd2204e5a0f8708
[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 #else /* DEBUG */
35 extern const char *rfid_hexdump(const void *data, unsigned int len);
36
37 #define DEBUGP(x, args ...)
38 #define DEBUGPC(x, args ...)
39
40 #endif /* DEBUG */
41
42
43 #ifndef ARRAY_SIZE
44 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
45 #endif
46
47 #endif /* __LIBRFID__ */
48
49 int rfid_init();
50
51 enum rfid_opt_level {
52         RFID_LEVEL_ASIC,
53         RFID_LEVEL_READER,
54         RFID_LEVEL_LAYER2,
55         RFID_LEVEL_LAYER3,
56 };
57
58 enum rfid_frametype {
59         RFID_14443A_FRAME_REGULAR,
60         RFID_14443B_FRAME_REGULAR,
61         RFID_MIFARE_FRAME,
62 };
63
64 #endif /* _RFID_H */