summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/librfid/rfid_system.h8
-rw-r--r--src/ccid/ccid-driver.c6
-rw-r--r--src/ccid/rfid_reader_cm5121_ccid_direct.c6
-rw-r--r--src/rfid.c2
-rw-r--r--src/rfid_layer2_iso15693.c10
-rw-r--r--src/rfid_reader_cm5121.c9
-rw-r--r--src/rfid_reader_openpcd.c11
7 files changed, 44 insertions, 8 deletions
diff --git a/include/librfid/rfid_system.h b/include/librfid/rfid_system.h
index 56441bb..9b07cf7 100644
--- a/include/librfid/rfid_system.h
+++ b/include/librfid/rfid_system.h
@@ -1,10 +1,14 @@
/* system / environment specific defines */
+/* build for openpcd firmware */
//#define LIBRFID_FIRMWARE
+/* build without dynamic allocations */
+#define LIBRFID_STATIC
+
#ifdef __LIBRFID__
-#ifndef LIBRFID_FIRMWARE
+#ifndef LIBRFID_STATIC
/* If we're not doing a firmware compile, then we just use the regular
* malloc()/free() functions as expected */
@@ -48,6 +52,6 @@ extern struct rfid_reader_handle rfid_rh;
#define malloc_reader_handle(x) &rfid_rh
#define free_reader_handle(x) EMPTY_STATEMENT
-#endif /* LIBRFID_FIRMWARE */
+#endif /* LIBRFID_STATIC */
#endif /* __LIBRFID__ */
diff --git a/src/ccid/ccid-driver.c b/src/ccid/ccid-driver.c
index edca5ca..e440167 100644
--- a/src/ccid/ccid-driver.c
+++ b/src/ccid/ccid-driver.c
@@ -71,6 +71,10 @@
level exchange and does fully automatic initialization.
*/
+#include <librfid/rfid.h>
+
+#ifndef LIBRFID_FIRMWARE
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -2446,3 +2450,5 @@ main (int argc, char **argv)
*/
#endif /*TEST*/
#endif /*HAVE_LIBUSB*/
+
+#endif /* LIBRFID_FIRMWARE */
diff --git a/src/ccid/rfid_reader_cm5121_ccid_direct.c b/src/ccid/rfid_reader_cm5121_ccid_direct.c
index c6b2d15..3327a08 100644
--- a/src/ccid/rfid_reader_cm5121_ccid_direct.c
+++ b/src/ccid/rfid_reader_cm5121_ccid_direct.c
@@ -3,6 +3,10 @@
#include <unistd.h>
#include <stdio.h>
+#include <librfid/rfid.h>
+
+#ifndef LIBRFID_FIRMWARE
+
#include <librfid/rfid_asic.h>
#include "ccid-driver.h"
@@ -34,3 +38,5 @@ int cm5121_source_init(struct rfid_asic_transport_handle *rath)
}
return 0;
}
+
+#endif /* LIBRFID_FIRMWARE */
diff --git a/src/rfid.c b/src/rfid.c
index ec0ce1f..10abb99 100644
--- a/src/rfid.c
+++ b/src/rfid.c
@@ -23,7 +23,7 @@
#include <librfid/rfid_protocol_mifare_ul.h>
#include <librfid/rfid_protocol_mifare_classic.h>
-#ifdef LIBRFID_FIRMWARE
+#ifdef LIBRFID_STATIC
struct rfid_asic_handle rfid_ah;
struct rfid_layer2_handle rfid_l2h;
struct rfid_protocol_handle rfid_ph;
diff --git a/src/rfid_layer2_iso15693.c b/src/rfid_layer2_iso15693.c
index 8ab0b1e..a9767b7 100644
--- a/src/rfid_layer2_iso15693.c
+++ b/src/rfid_layer2_iso15693.c
@@ -259,6 +259,13 @@ iso14443a_hlta(struct rfid_layer2_handle *handle)
}
#endif
+
+static int
+iso15693_anticol(struct rfid_layer2_handle *handle)
+{
+ return -1;
+}
+
static struct rfid_layer2_handle *
iso15693_init(struct rfid_reader_handle *rh)
{
@@ -270,7 +277,6 @@ iso15693_init(struct rfid_reader_handle *rh)
h->l2 = &rfid_layer2_iso15693;
h->rh = rh;
h->priv.iso15693.state = ISO15693_STATE_NONE;
-
ret = h->rh->reader->iso15693.init(h->rh);
if (ret < 0) {
free_layer2_handle(h);
@@ -293,7 +299,7 @@ const struct rfid_layer2 rfid_layer2_iso15693 = {
.name = "ISO 15693",
.fn = {
.init = &iso15693_init,
- //.open = &iso15693_anticol,
+ .open = &iso15693_anticol,
//.transceive = &iso15693_transceive,
//.close = &iso14443a_hlta,
.fini = &iso15693_fini,
diff --git a/src/rfid_reader_cm5121.c b/src/rfid_reader_cm5121.c
index dd15fd6..a62cc4c 100644
--- a/src/rfid_reader_cm5121.c
+++ b/src/rfid_reader_cm5121.c
@@ -26,15 +26,15 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#ifndef LIBRFID_FIRMWARE
-
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <librfid/rfid.h>
+
+#ifndef LIBRFID_FIRMWARE
+
#include <librfid/rfid_reader.h>
#include <librfid/rfid_asic.h>
#include <librfid/rfid_asic_rc632.h>
@@ -381,6 +381,9 @@ const struct rfid_reader rfid_reader_cm5121 = {
.iso14443b = {
.init = &cm5121_14443b_init,
},
+ .iso15693 = {
+ .init = &cm5121_15693_init,
+ },
.mifare_classic = {
.setkey = &cm5121_mifare_setkey,
.auth = &cm5121_mifare_auth,
diff --git a/src/rfid_reader_openpcd.c b/src/rfid_reader_openpcd.c
index 15486b6..dc9db10 100644
--- a/src/rfid_reader_openpcd.c
+++ b/src/rfid_reader_openpcd.c
@@ -226,12 +226,14 @@ const struct rfid_asic_transport openpcd_rat = {
static int openpcd_reg_write(struct rfid_asic_transport_handle *rath,
unsigned char reg, unsigned char value)
{
+ return rc632_reg_write(rath, reg, value);
}
static int openpcd_reg_read(struct rfid_asic_transport_handle *rath,
unsigned char reg,
unsigned char *value)
{
+ return rc632_reg_write(rath, reg, value);
}
@@ -239,6 +241,7 @@ static int openpcd_fifo_read(struct rfid_asic_transport_handle *rath,
unsigned char num_bytes,
unsigned char *buf)
{
+ return rc632_reg_write(rath, num_bytes, buf);
}
static int openpcd_fifo_write(struct rfid_asic_transport_handle *rath,
@@ -246,6 +249,7 @@ static int openpcd_fifo_write(struct rfid_asic_transport_handle *rath,
const unsigned char *bytes,
unsigned char flags)
{
+ return rc632_fifo_write(rath, len, bytes, flags);
}
const struct rfid_asic_transport openpcd_rat = {
@@ -365,6 +369,7 @@ openpcd_open(void *data)
snd_hdr = (struct openpcd_hdr *)snd_buf;
rcv_hdr = (struct openpcd_hdr *)rcv_buf;
+#ifndef LIBRFID_FIRMWARE
usb_init();
if (usb_find_busses() < 0)
return NULL;
@@ -388,6 +393,7 @@ openpcd_open(void *data)
usb_close(hdl);
return NULL;
}
+#endif
rh = malloc_reader_handle(sizeof(*rh));
if (!rh)
@@ -426,7 +432,9 @@ openpcd_close(struct rfid_reader_handle *rh)
free_rat_handle(rath);
free_reader_handle(rh);
+#ifndef LIBRFID_FIRMWARE
usb_close(hdl);
+#endif
}
const struct rfid_reader rfid_reader_openpcd = {
@@ -452,6 +460,9 @@ const struct rfid_reader rfid_reader_openpcd = {
.iso14443b = {
.init = &openpcd_14443b_init,
},
+ .iso15693 = {
+ .init = &openpcd_15693_init,
+ },
.mifare_classic = {
.setkey = &openpcd_mifare_setkey,
.auth = &openpcd_mifare_auth,
personal git repositories of Harald Welte. Your mileage may vary