fix various compile warnings. code cleanup
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>
Sat, 30 Sep 2006 13:26:32 +0000 (13:26 +0000)
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>
Sat, 30 Sep 2006 13:26:32 +0000 (13:26 +0000)
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1891 e0336214-984f-0b4b-a45f-81c69e1f0ede

include/librfid/rfid_asic_rc632.h
include/librfid/rfid_reader.h
src/Makefile.am
src/cm5121_source.h [new file with mode: 0644]
src/rfid.c
src/rfid_asic_rc632.c
src/rfid_reader_cm5121.c

index ec9b4e4..642c940 100644 (file)
@@ -37,16 +37,16 @@ struct rfid_asic_rc632 {
                int (*turn_off_rf)(struct rfid_asic_handle *h);
                int (*transceive)(struct rfid_asic_handle *h,
                                  enum rfid_frametype,
-                                 const u_int32_t *tx_buf,
+                                 const u_int8_t *tx_buf,
                                  unsigned int tx_len,
-                                 u_int32_t *rx_buf,
+                                 u_int8_t *rx_buf,
                                  unsigned int *rx_len,
                                  u_int64_t timeout,
                                  unsigned int flags);
                struct {
                        int (*init)(struct rfid_asic_handle *h);
                        int (*transceive_sf)(struct rfid_asic_handle *h,
-                                            u_int32_t cmd,
+                                            u_int8_t cmd,
                                             struct iso14443a_atqa *atqa);
                        int (*transceive_acf)(struct rfid_asic_handle *h,
                                              struct iso14443a_anticol_cmd *cmd,
@@ -151,10 +151,11 @@ int
 rc632_register_dump(struct rfid_asic_handle *handle, u_int32_t *buf);
 
 
-struct rfid_asic_handle * rc632_open(struct rfid_asic_transport_handle *th);
-
 
 extern struct rfid_asic rc632;
 #endif
 
+extern struct rfid_asic_handle * rc632_open(struct rfid_asic_transport_handle *th);
+extern void rc632_close(struct rfid_asic_handle *h);
+
 #endif
index f604852..ce29981 100644 (file)
@@ -38,7 +38,7 @@ struct rfid_reader {
                int (*init)(struct rfid_reader_handle *rh);
        } iso15693;
        struct rfid_mifare_classic_reader {
-               int (*setkey)(struct rfid_reader_handle *h, unsigned char *key);
+               int (*setkey)(struct rfid_reader_handle *h, const unsigned char *key);
                int (*auth)(struct rfid_reader_handle *h, u_int8_t cmd,
                            u_int32_t serno, u_int8_t block);
        } mifare_classic;
@@ -61,6 +61,8 @@ struct rfid_reader_handle {
 };
 
 
+extern int rfid_reader_register(struct rfid_reader *r);
+
 extern struct rfid_reader_handle *
 rfid_reader_open(void *data, unsigned int id);
 
index 48cb4a4..04d17d4 100644 (file)
@@ -1,6 +1,8 @@
 LIBVERSION= 0:0:0
 INCLUDES = $(all_includes) -I$(top_srcdir)/include -D__LIBRFID__
 
+AM_CFLAGS = -std=gnu99
+
 lib_LTLIBRARIES = librfid.la
 
 CORE=rfid.c rfid_layer2.c rfid_protocol.c rfid_reader.c
diff --git a/src/cm5121_source.h b/src/cm5121_source.h
new file mode 100644 (file)
index 0000000..8646703
--- /dev/null
@@ -0,0 +1,2 @@
+
+extern int cm5121_source_init(struct rfid_asic_transport_handle *rath);
index ea6c0aa..b90043f 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <librfid/rfid_reader.h>
 #include <librfid/rfid_reader_cm5121.h>
 #include <librfid/rfid_reader_openpcd.h>
 #include <librfid/rfid_protocol.h>
index 39e1273..05ed2cd 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <limits.h>
 #include <sys/types.h>
 
 #include <librfid/rfid.h>
@@ -171,7 +172,7 @@ static int best_prescaler(u_int64_t timeout, u_int8_t *prescaler,
        u_int8_t best_prescaler, best_divisor, i;
        int64_t smallest_diff;
 
-       smallest_diff = 0x7fffffffffffffff;
+       smallest_diff = LLONG_MAX;
        best_prescaler = 0;
 
        for (i = 0; i < 21; i++) {
@@ -232,7 +233,7 @@ rc632_timer_set(struct rfid_asic_handle *handle,
 }
 
 /* Wait until RC632 is idle or TIMER IRQ has happened */
-static rc632_wait_idle_timer(struct rfid_asic_handle *handle)
+static int rc632_wait_idle_timer(struct rfid_asic_handle *handle)
 {
        int ret;
        u_int8_t irq, cmd;
@@ -1002,8 +1003,7 @@ static struct tx_config tx_configs[] = {
 };
 
 static int rc632_iso14443a_set_speed(struct rfid_asic_handle *handle,
-                                    unsigned int tx,
-                                    u_int8_t rate)
+                                    unsigned int tx, unsigned int rate)
 {
        int rc;
        u_int8_t reg;
index d61b5f7..ab1e701 100644 (file)
@@ -38,6 +38,8 @@
 #include <librfid/rfid_asic_rc632.h>
 #include <librfid/rfid_reader_cm5121.h>
 
+#include "cm5121_source.h"
+
 /* FIXME */
 #include "rc632.h"