diff options
author | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2006-10-14 12:34:38 +0000 |
---|---|---|
committer | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2006-10-14 12:34:38 +0000 |
commit | e404cccecd20a2418c2429cd182c18218e54bd28 (patch) | |
tree | 5a15b5ca51874f0f8e96ccc4ee0457a66de3cec7 /src/rfid_reader_cm5121.c | |
parent | 6e87a007525b313dcf2da194977bb1abdf62026f (diff) |
Prepare RFID compilation in firmware mode
- switch from linked lists to static arrays
- remove all non-handle dynamic allocations (at the expense of stack)
- declare all proto/reader/asic/layer2 structures as const
- wrap all handle allocations in macros that expand to references to
static structures in case of firmware mode
- update copyright notices
- add skeleton code for openpcd-inside-firmware driver
- update TODO with remaining TODO for firmware mode
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1903 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'src/rfid_reader_cm5121.c')
-rw-r--r-- | src/rfid_reader_cm5121.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/rfid_reader_cm5121.c b/src/rfid_reader_cm5121.c index a9907ad..dd15fd6 100644 --- a/src/rfid_reader_cm5121.c +++ b/src/rfid_reader_cm5121.c @@ -27,6 +27,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef LIBRFID_FIRMWARE + #include <stdlib.h> #include <unistd.h> #include <string.h> @@ -314,12 +316,12 @@ cm5121_open(void *data) struct rfid_reader_handle *rh; struct rfid_asic_transport_handle *rath; - rh = malloc(sizeof(*rh)); + rh = malloc_reader_handle(sizeof(*rh)); if (!rh) return NULL; memset(rh, 0, sizeof(*rh)); - rath = malloc(sizeof(*rath)); + rath = malloc_rat_handle(sizeof(*rath)); if (!rath) goto out_rh; memset(rath, 0, sizeof(*rath)); @@ -341,9 +343,9 @@ cm5121_open(void *data) return rh; out_rath: - free(rath); + free_rat_handle(rath); out_rh: - free(rh); + free_reader_handle(rh); return NULL; } @@ -353,11 +355,11 @@ cm5121_close(struct rfid_reader_handle *rh) { struct rfid_asic_transport_handle *rath = rh->ah->rath; rc632_close(rh->ah); - free(rath); - free(rh); + free_rat_handle(rath); + free_reader_handle(rh); } -struct rfid_reader rfid_reader_cm5121 = { +const struct rfid_reader rfid_reader_cm5121 = { .name = "Omnikey CardMan 5121 RFID", .open = &cm5121_open, .close = &cm5121_close, @@ -385,4 +387,4 @@ struct rfid_reader rfid_reader_cm5121 = { }, }; - +#endif /* LIBRFID_FIRMWARE */ |