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