summaryrefslogtreecommitdiff
path: root/include/librfid/rfid_reader.h
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2008-01-29 16:29:21 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2008-01-29 16:29:21 +0000
commitda4aa962e17978a70bf1cf4fc3d1b46b620bc3bf (patch)
treece482cb98a3318224d0fd40f951688cfd6bf1140 /include/librfid/rfid_reader.h
parent2b0914e033eb2644fe576b7b4c03309830abd2ec (diff)
* implement rfid_reader_{get,set}opt()
* move get/set environment and get firmware api version to reader_{get,set}opt() * merge rc632 power_up and power_down functions in new power function * merge rc632 layer 2 protocol init functions into one * rename parameters of rfid_layer2_{get,set}opt() * move rf_power() function of reader to new setopt() interface * merge reader layer 2 protocol init functiosn into one * move most of the iso15693 anticol implementation from asic into layer2 code * make most iso15693 parameters configurable via layer2_{get,set}opt() * implement AFI for iso15693 inventory request * introduce new generic 'rc632 asic based reader' functions * use those functions from openpcd, cm5121 and spidev readers * use new register initialization script data structure for rc632 init functions * TODO update git-svn-id: https://svn.gnumonks.org/trunk/librfid@2064 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'include/librfid/rfid_reader.h')
-rw-r--r--include/librfid/rfid_reader.h54
1 files changed, 33 insertions, 21 deletions
diff --git a/include/librfid/rfid_reader.h b/include/librfid/rfid_reader.h
index 8dc7860..1c53677 100644
--- a/include/librfid/rfid_reader.h
+++ b/include/librfid/rfid_reader.h
@@ -7,39 +7,46 @@
struct rfid_reader_handle;
+/* 0...0xffff = global options, 0x10000...0x1ffff = private options */
+#define RFID_OPT_RDR_PRIV 0x00010000
+enum rfid_reader_opt {
+ RFID_OPT_RDR_FW_VERSION = 0x0001,
+ RFID_OPT_RDR_RF_KILL = 0x0002,
+};
+
+
struct rfid_reader {
char *name;
unsigned int id;
unsigned int l2_supported;
unsigned int proto_supported;
- int (*get_api_version)(
- struct rfid_reader_handle *h,
- u_int8_t *version);
+ int (*reset)(struct rfid_reader_handle *h);
- int (*get_environment)(
- struct rfid_reader_handle *rh,
- unsigned char num_bytes,
- unsigned char *buf);
+ /* open the reader */
+ struct rfid_reader_handle * (*open)(void *data);
- int (*set_environment)(
- struct rfid_reader_handle *rh,
- unsigned char num_bytes,
- const unsigned char *buf);
+ /* Initialize the reader for a given layer 2 */
+ int (*init)(struct rfid_reader_handle *h, enum rfid_layer2_id);
- int (*reset)(struct rfid_reader_handle *h);
+ /* completely close the reader */
+ void (*close)(struct rfid_reader_handle *h);
+
+ int (*getopt)(struct rfid_reader_handle *rh, int optname,
+ void *optval, unsigned int *optlen);
+
+ int (*setopt)(struct rfid_reader_handle *rh, int optname,
+ const void *optval, unsigned int optlen);
+
+ /* transceive one frame */
int (*transceive)(struct rfid_reader_handle *h,
enum rfid_frametype frametype,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
u_int64_t timeout, unsigned int flags);
- struct rfid_reader_handle * (*open)(void *data);
- void (*close)(struct rfid_reader_handle *h);
- int (*rf_power)(struct rfid_reader_handle *h, int on);
struct rfid_14443a_reader {
- int (*init)(struct rfid_reader_handle *h);
int (*transceive_sf)(struct rfid_reader_handle *h,
unsigned char cmd,
struct iso14443a_atqa *atqa);
@@ -52,15 +59,14 @@ struct rfid_reader {
unsigned int speed;
} iso14443a;
struct rfid_14443b_reader {
- int (*init)(struct rfid_reader_handle *rh);
unsigned int speed;
} iso14443b;
struct rfid_15693_reader {
- int (*init)(struct rfid_reader_handle *rh);
int (*transceive_ac)(struct rfid_reader_handle *h,
- struct iso15693_anticol_cmd *acf,
- unsigned char *uuid,
- char *bit_of_col);
+ const struct iso15693_anticol_cmd *acf,
+ unsigned int acf_len,
+ struct iso15693_anticol_resp *resp,
+ unsigned int *rx_len, char *bit_of_col);
} iso15693;
struct rfid_mifare_classic_reader {
int (*setkey)(struct rfid_reader_handle *h, const unsigned char *key);
@@ -89,4 +95,10 @@ extern struct rfid_reader_handle *
rfid_reader_open(void *data, unsigned int id);
extern void rfid_reader_close(struct rfid_reader_handle *rh);
+
+extern int rfid_reader_getopt(struct rfid_reader_handle *rh, int optname,
+ void *optval, unsigned int *optlen);
+extern int rfid_reader_setopt(struct rfid_reader_handle *rh, int optname,
+ const void *optval, unsigned int optlen);
+
#endif
personal git repositories of Harald Welte. Your mileage may vary