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