56441bb23ccabaeb5a9d5776ec472ee472778f05
[librfid] / include / librfid / rfid_system.h
1 /* system / environment specific defines */
2
3 //#define LIBRFID_FIRMWARE
4
5 #ifdef __LIBRFID__
6
7 #ifndef LIBRFID_FIRMWARE
8 /* If we're not doing a firmware compile, then we just use the regular
9  * malloc()/free() functions as expected */
10
11 #define malloc_asic_handle(x)   malloc(x)
12 #define free_asic_handle(x)     free(x)
13
14 #define malloc_layer2_handle(x) malloc(x)
15 #define free_layer2_handle(x)   free(x)
16
17 #define malloc_protocol_handle(x)       malloc(x)
18 #define free_protocol_handle(x) free(x)
19
20 #define malloc_rat_handle(x)    malloc(x)
21 #define free_rat_handle(x)      free(x)
22
23 #define malloc_reader_handle(x) malloc(x)
24 #define free_reader_handle(x)   free(x)
25
26 #else
27 /* If we're actually doing a firmware compile, then we use pre-allocated
28  * handles in order to avoid dynamic memory allocation. */
29
30 #define EMPTY_STATEMENT do {} while(0)
31 extern struct rfid_asic_handle rfid_ah;
32 #define malloc_asic_handle(x)   &rfid_ah
33 #define free_asic_handle(x)     EMPTY_STATEMENT
34
35 extern struct rfid_layer2_handle rfid_l2h;
36 #define malloc_layer2_handle(x) &rfid_l2h
37 #define free_layer2_handle(x)   EMPTY_STATEMENT
38
39 extern struct rfid_protocol_handle rfid_ph;
40 #define malloc_protocol_handle(x)       &rfid_ph
41 #define free_protocol_handle(x)         EMPTY_STATEMENT
42
43 extern struct rfid_asic_transport_handle rfid_ath;
44 #define malloc_rat_handle(x)    &rfid_ath
45 #define free_rat_handle(x)      EMPTY_STATEMENT
46
47 extern struct rfid_reader_handle rfid_rh;
48 #define malloc_reader_handle(x) &rfid_rh
49 #define free_reader_handle(x)   EMPTY_STATEMENT
50
51 #endif /* LIBRFID_FIRMWARE */
52
53 #endif /* __LIBRFID__ */