summaryrefslogtreecommitdiff
path: root/include/librfid/rfid_system.h
blob: 9b07cf727850a3af91741b34e358ad3b6dc282f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* system / environment specific defines */

/* build for openpcd firmware */
//#define LIBRFID_FIRMWARE

/* build without dynamic allocations */
#define LIBRFID_STATIC

#ifdef __LIBRFID__

#ifndef LIBRFID_STATIC
/* If we're not doing a firmware compile, then we just use the regular
 * malloc()/free() functions as expected */

#define malloc_asic_handle(x)	malloc(x)
#define free_asic_handle(x)	free(x)

#define malloc_layer2_handle(x)	malloc(x)
#define free_layer2_handle(x)	free(x)

#define malloc_protocol_handle(x)	malloc(x)
#define free_protocol_handle(x)	free(x)

#define malloc_rat_handle(x)	malloc(x)
#define free_rat_handle(x)	free(x)

#define malloc_reader_handle(x)	malloc(x)
#define free_reader_handle(x)	free(x)

#else
/* If we're actually doing a firmware compile, then we use pre-allocated
 * handles in order to avoid dynamic memory allocation. */

#define EMPTY_STATEMENT	do {} while(0)
extern struct rfid_asic_handle rfid_ah;
#define malloc_asic_handle(x)	&rfid_ah
#define free_asic_handle(x)	EMPTY_STATEMENT

extern struct rfid_layer2_handle rfid_l2h;
#define malloc_layer2_handle(x)	&rfid_l2h
#define free_layer2_handle(x)	EMPTY_STATEMENT

extern struct rfid_protocol_handle rfid_ph;
#define malloc_protocol_handle(x)	&rfid_ph
#define free_protocol_handle(x)		EMPTY_STATEMENT

extern struct rfid_asic_transport_handle rfid_ath;
#define malloc_rat_handle(x)	&rfid_ath
#define free_rat_handle(x)	EMPTY_STATEMENT

extern struct rfid_reader_handle rfid_rh;
#define malloc_reader_handle(x)	&rfid_rh
#define free_reader_handle(x)	EMPTY_STATEMENT

#endif /* LIBRFID_STATIC */

#endif /* __LIBRFID__ */
personal git repositories of Harald Welte. Your mileage may vary