summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2005-11-08 13:04:32 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2005-11-08 13:04:32 +0000
commit1fcc35aad699f3d40ca786b99c7255cf8aa55892 (patch)
tree88fb669ab0ab13822d4fcef8bf854d30e97dd9b6
parentb40ece7ac6d4c72cf8a648fd1b7eee30130eac77 (diff)
move include directory for pkginclude compliance
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1664 e0336214-984f-0b4b-a45f-81c69e1f0ede
-rw-r--r--include/Makefile.am2
-rw-r--r--include/librfid/Makefile.am (renamed from include/rfid/Makefile.am)0
-rw-r--r--include/librfid/rfid.h (renamed from include/rfid/rfid.h)0
-rw-r--r--include/librfid/rfid_asic.h (renamed from include/rfid/rfid_asic.h)2
-rw-r--r--include/librfid/rfid_asic_rc632.h (renamed from include/rfid/rfid_asic_rc632.h)2
-rw-r--r--include/librfid/rfid_layer2.h (renamed from include/rfid/rfid_layer2.h)8
-rw-r--r--include/librfid/rfid_layer2_iso14443a.h (renamed from include/rfid/rfid_layer2_iso14443a.h)2
-rw-r--r--include/librfid/rfid_layer2_iso14443b.h (renamed from include/rfid/rfid_layer2_iso14443b.h)2
-rw-r--r--include/librfid/rfid_layer2_iso15693.h (renamed from include/rfid/rfid_layer2_iso15693.h)2
-rw-r--r--include/librfid/rfid_protocol.h (renamed from include/rfid/rfid_protocol.h)8
-rw-r--r--include/librfid/rfid_protocol_mifare_classic.h (renamed from include/rfid/rfid_protocol_mifare_classic.h)0
-rw-r--r--include/librfid/rfid_protocol_mifare_ul.h (renamed from include/rfid/rfid_protocol_mifare_ul.h)0
-rw-r--r--include/librfid/rfid_protocol_tcl.h (renamed from include/rfid/rfid_protocol_tcl.h)0
-rw-r--r--include/librfid/rfid_reader.h (renamed from include/rfid/rfid_reader.h)4
-rw-r--r--include/librfid/rfid_reader_cm5121.h (renamed from include/rfid/rfid_reader_cm5121.h)0
-rw-r--r--src/rfid.c10
-rw-r--r--src/rfid_asic_rc632.c12
-rw-r--r--src/rfid_asic_rc632_14443a.c394
-rw-r--r--src/rfid_asic_rc632_14443b.c69
-rw-r--r--src/rfid_asic_rc632_mifare.c25
-rw-r--r--src/rfid_layer2.c4
-rw-r--r--src/rfid_layer2_iso14443a.c8
-rw-r--r--src/rfid_layer2_iso14443b.c8
-rw-r--r--src/rfid_layer2_iso15693.c8
-rw-r--r--src/rfid_proto_mifare_classic.c10
-rw-r--r--src/rfid_proto_mifare_ul.c8
-rw-r--r--src/rfid_proto_tcl.c16
-rw-r--r--src/rfid_protocol.c4
-rw-r--r--src/rfid_reader.c4
-rw-r--r--src/rfid_reader_cm5121.c10
-rw-r--r--src/rfid_reader_cm5121_ccid_direct.c2
-rw-r--r--src/rfid_reader_cm5121_openct.c2
-rw-r--r--utils/openct-escape.c20
33 files changed, 79 insertions, 567 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index df5706a..dfaa277 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = rfid
+SUBDIRS = librfid
diff --git a/include/rfid/Makefile.am b/include/librfid/Makefile.am
index 59ce8cb..59ce8cb 100644
--- a/include/rfid/Makefile.am
+++ b/include/librfid/Makefile.am
diff --git a/include/rfid/rfid.h b/include/librfid/rfid.h
index 6717ef8..6717ef8 100644
--- a/include/rfid/rfid.h
+++ b/include/librfid/rfid.h
diff --git a/include/rfid/rfid_asic.h b/include/librfid/rfid_asic.h
index 6511615..3686a7c 100644
--- a/include/rfid/rfid_asic.h
+++ b/include/librfid/rfid_asic.h
@@ -3,7 +3,7 @@
enum rfid_frametype;
-#include <rfid/rfid_asic_rc632.h>
+#include <librfid/rfid_asic_rc632.h>
struct rfid_asic_transport {
char *name;
diff --git a/include/rfid/rfid_asic_rc632.h b/include/librfid/rfid_asic_rc632.h
index e156814..893e73b 100644
--- a/include/rfid/rfid_asic_rc632.h
+++ b/include/librfid/rfid_asic_rc632.h
@@ -4,7 +4,7 @@
struct rfid_asic_transport_handle;
#include <sys/types.h>
-#include <rfid/rfid_asic.h>
+#include <librfid/rfid_asic.h>
struct rfid_asic_rc632_transport {
struct {
diff --git a/include/rfid/rfid_layer2.h b/include/librfid/rfid_layer2.h
index 54c3c46..4622a02 100644
--- a/include/rfid/rfid_layer2.h
+++ b/include/librfid/rfid_layer2.h
@@ -2,7 +2,7 @@
#define _RFID_LAYER2_H
#include <sys/types.h>
-#include <rfid/rfid.h>
+#include <librfid/rfid.h>
struct rfid_layer2_handle;
struct rfid_reader_handle;
@@ -31,9 +31,9 @@ int rfid_layer2_setopt(struct rfid_layer2_handle *ph, int optname,
#ifdef __LIBRFID__
-#include <rfid/rfid_layer2_iso14443a.h>
-#include <rfid/rfid_layer2_iso14443b.h>
-#include <rfid/rfid_layer2_iso15693.h>
+#include <librfid/rfid_layer2_iso14443a.h>
+#include <librfid/rfid_layer2_iso14443b.h>
+#include <librfid/rfid_layer2_iso15693.h>
struct rfid_layer2 {
unsigned int id;
diff --git a/include/rfid/rfid_layer2_iso14443a.h b/include/librfid/rfid_layer2_iso14443a.h
index fc79bca..50a6f43 100644
--- a/include/rfid/rfid_layer2_iso14443a.h
+++ b/include/librfid/rfid_layer2_iso14443a.h
@@ -75,7 +75,7 @@ enum iso14443a_state {
ISO14443A_STATE_SELECTED,
};
-#include <rfid/rfid_layer2.h>
+#include <librfid/rfid_layer2.h>
struct rfid_layer2 rfid_layer2_iso14443a;
#endif /* __LIBRFID__ */
diff --git a/include/rfid/rfid_layer2_iso14443b.h b/include/librfid/rfid_layer2_iso14443b.h
index 2bf8255..5d6d979 100644
--- a/include/rfid/rfid_layer2_iso14443b.h
+++ b/include/librfid/rfid_layer2_iso14443b.h
@@ -77,7 +77,7 @@ enum {
ISO14443B_STATE_HALTED,
};
-#include <rfid/rfid_layer2.h>
+#include <librfid/rfid_layer2.h>
struct rfid_layer2 rfid_layer2_iso14443b;
#endif /* __LIBRFID__ */
diff --git a/include/rfid/rfid_layer2_iso15693.h b/include/librfid/rfid_layer2_iso15693.h
index 6ca1a7b..ea7f87a 100644
--- a/include/rfid/rfid_layer2_iso15693.h
+++ b/include/librfid/rfid_layer2_iso15693.h
@@ -49,7 +49,7 @@ enum iso15693_state {
ISO15693_STATE_NONE,
};
-#include <rfid/rfid_layer2.h>
+#include <librfid/rfid_layer2.h>
extern struct rfid_layer2 rfid_layer2_iso15693;
#endif /* _ISO15693_H */
diff --git a/include/rfid/rfid_protocol.h b/include/librfid/rfid_protocol.h
index bd9570f..65bda4c 100644
--- a/include/rfid/rfid_protocol.h
+++ b/include/librfid/rfid_protocol.h
@@ -1,7 +1,7 @@
#ifndef _RFID_PROTOCOL_H
#define _RFID_PROTOCOL_H
-#include <rfid/rfid_layer2.h>
+#include <librfid/rfid_layer2.h>
struct rfid_protocol_handle;
@@ -68,9 +68,9 @@ struct rfid_protocol {
int rfid_protocol_register(struct rfid_protocol *p);
-#include <rfid/rfid_protocol_tcl.h>
-#include <rfid/rfid_protocol_mifare_ul.h>
-#include <rfid/rfid_protocol_mifare_classic.h>
+#include <librfid/rfid_protocol_tcl.h>
+#include <librfid/rfid_protocol_mifare_ul.h>
+#include <librfid/rfid_protocol_mifare_classic.h>
struct rfid_protocol_handle {
struct rfid_layer2_handle *l2h;
diff --git a/include/rfid/rfid_protocol_mifare_classic.h b/include/librfid/rfid_protocol_mifare_classic.h
index e6b2400..e6b2400 100644
--- a/include/rfid/rfid_protocol_mifare_classic.h
+++ b/include/librfid/rfid_protocol_mifare_classic.h
diff --git a/include/rfid/rfid_protocol_mifare_ul.h b/include/librfid/rfid_protocol_mifare_ul.h
index cc93b6b..cc93b6b 100644
--- a/include/rfid/rfid_protocol_mifare_ul.h
+++ b/include/librfid/rfid_protocol_mifare_ul.h
diff --git a/include/rfid/rfid_protocol_tcl.h b/include/librfid/rfid_protocol_tcl.h
index f754ad9..f754ad9 100644
--- a/include/rfid/rfid_protocol_tcl.h
+++ b/include/librfid/rfid_protocol_tcl.h
diff --git a/include/rfid/rfid_reader.h b/include/librfid/rfid_reader.h
index 78d07e4..3581cc1 100644
--- a/include/rfid/rfid_reader.h
+++ b/include/librfid/rfid_reader.h
@@ -1,8 +1,8 @@
#ifndef _RFID_READER_H
#define _RFID_READER_H
-#include <rfid/rfid_asic.h>
-#include <rfid/rfid_layer2_iso14443a.h>
+#include <librfid/rfid_asic.h>
+#include <librfid/rfid_layer2_iso14443a.h>
struct rfid_reader_handle;
diff --git a/include/rfid/rfid_reader_cm5121.h b/include/librfid/rfid_reader_cm5121.h
index 8d9a312..8d9a312 100644
--- a/include/rfid/rfid_reader_cm5121.h
+++ b/include/librfid/rfid_reader_cm5121.h
diff --git a/src/rfid.c b/src/rfid.c
index be72f12..6fba46a 100644
--- a/src/rfid.c
+++ b/src/rfid.c
@@ -15,11 +15,11 @@
#include <stdio.h>
#include <string.h>
-#include <rfid/rfid_reader_cm5121.h>
-#include <rfid/rfid_protocol.h>
-#include <rfid/rfid_protocol_tcl.h>
-#include <rfid/rfid_protocol_mifare_ul.h>
-#include <rfid/rfid_protocol_mifare_classic.h>
+#include <librfid/rfid_reader_cm5121.h>
+#include <librfid/rfid_protocol.h>
+#include <librfid/rfid_protocol_tcl.h>
+#include <librfid/rfid_protocol_mifare_ul.h>
+#include <librfid/rfid_protocol_mifare_classic.h>
const char *
rfid_hexdump(const void *data, unsigned int len)
diff --git a/src/rfid_asic_rc632.c b/src/rfid_asic_rc632.c
index 6de9c11..0c38052 100644
--- a/src/rfid_asic_rc632.c
+++ b/src/rfid_asic_rc632.c
@@ -25,12 +25,12 @@
#include <errno.h>
#include <sys/types.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_asic.h>
-#include <rfid/rfid_asic_rc632.h>
-#include <rfid/rfid_reader_cm5121.h>
-#include <rfid/rfid_layer2_iso14443a.h>
-#include <rfid/rfid_protocol_mifare_classic.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_asic.h>
+#include <librfid/rfid_asic_rc632.h>
+#include <librfid/rfid_reader_cm5121.h>
+#include <librfid/rfid_layer2_iso14443a.h>
+#include <librfid/rfid_protocol_mifare_classic.h>
#include "rfid_iso14443_common.h"
#include "rc632.h"
diff --git a/src/rfid_asic_rc632_14443a.c b/src/rfid_asic_rc632_14443a.c
deleted file mode 100644
index 4c8a37b..0000000
--- a/src/rfid_asic_rc632_14443a.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Philips CL RC632 primitives for ISO 14443-A compliant PICC's
- *
- * (C) 2005 by Harald Welte <laforge@gnumonks.org>
- *
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <rfid/rfid.h>
-#include <rfid/rfid_asic_rc632.h>
-#include <rfid/rfid_layer2_iso14443a.h>
-
-#include "rc632.h"
-
-#include "cm5121_rfid.h" /* FIXME: this needs to be modular */
-
-static int
-rc632_iso14443a_init(struct rfid_asic_handle *handle)
-{
- int ret;
-
-#if 0
- ret = rc632_power_up(handle);
- if (ret < 0)
- return ret;
-
- ret = rc632_turn_on_rf(handle);
- if (ret < 0)
- return ret;
-#endif
-
- // FIXME: some fifo work (drain fifo?)
-
- /* flush fifo (our way) */
- ret = rc632_reg_write(handle, RC632_REG_CONTROL, 0x01);
-
- ret = rc632_reg_write(handle, RC632_REG_TX_CONTROL,
- (RC632_TXCTRL_TX1_RF_EN |
- RC632_TXCTRL_TX2_RF_EN |
- RC632_TXCTRL_TX2_INV |
- RC632_TXCTRL_FORCE_100_ASK |
- RC632_TXCTRL_MOD_SRC_INT));
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_CW_CONDUCTANCE,
- CM5121_CW_CONDUCTANCE);
- if (ret < 0)
- return ret;
-
- /* Since FORCE_100_ASK is set (cf mc073930.pdf), this line may be left out? */
- ret = rc632_reg_write(handle, RC632_REG_MOD_CONDUCTANCE,
- CM5121_MOD_CONDUCTANCE);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_CODER_CONTROL,
- (RC632_CDRCTRL_TXCD_14443A |
- RC632_CDRCTRL_RATE_106K));
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH, 0x13);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH_SOF, 0x3f);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_TYPE_B_FRAMING, 0x00);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL1,
- (RC632_RXCTRL1_GAIN_35DB |
- RC632_RXCTRL1_ISO14443 |
- RC632_RXCTRL1_SUBCP_8));
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_DECODER_CONTROL,
- (RC632_DECCTRL_MANCHESTER |
- RC632_DECCTRL_RXFR_14443A));
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_BIT_PHASE,
- CM5121_14443A_BITPHASE);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_RX_THRESHOLD,
- CM5121_14443A_THRESHOLD);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_BPSK_DEM_CONTROL, 0x00);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL2,
- (RC632_RXCTRL2_DECSRC_INT |
- RC632_RXCTRL2_CLK_Q));
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_RX_WAIT, 0x03);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
- (RC632_CR_PARITY_ENABLE |
- RC632_CR_PARITY_ODD));
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_LSB, 0x63);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_MSB, 0x63);
- if (ret < 0)
- return ret;
-
- return 0;
-}
-
-static int
-rc632_iso14443a_fini(struct iso14443a_handle *handle_14443)
-{
-
-#if 0
- ret = rc632_turn_off_rf(handle);
- if (ret < 0)
- return ret;
-#endif
-
-
- return 0;
-}
-
-#if 0
-int
-rc632_iso14443a_select(struct rc632_handle *handle,
- unsigned char *retptr,
- )
-{
- int ret;
- unsigned char tx_buf[7];
- unsigned char rx_buf[64];
- unsigned char rx_len = 1;
-
- memset(rx_buf, 0, sizeof(rx_buf));
-
- tx_buf[0] = arg_8;
- tx_buf[1] = 0x70;
- (u_int32_t *)tx_buf[2] = arg_4;
- tx_buf[6] = arg4+4;
-
- /* disable mifare cryto */
- ret = rc632_clear_bit(handle, RC632_REG_CONTROL,
- RC632_CONTROL_CRYPTO1_ON);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
- (RC632_CR_PARITY_ENABLE |
- RC632_CR_PARITY_ODD |
- RC632_CR_TX_CRC_ENABLE |
- RC632_CR_RX_CRC_ENABLE));
- if (ret < 0)
- return ret;
-
- ret = rc632_transcieve(handle, tx_buf, sizeof(tx_buf),
- rx_buf, &rx_len, 0x32, 0);
-
- if (ret < 0 || rx_len != 1)
- return ret;
-
- *retptr = rx_buf[0];
-
- return 0;
-}
-
-/* issue a 14443-3 A PCD -> PICC command, such as REQA, WUPA */
-int
-rc632_iso14443a_req(sutruct rc632_handle *handle, unsigned char req,
- unsigned char *resp)
-{
- int ret;
- unsigned char tx_buf[1];
- unsigned char rx_buf[0x40];
- unsigned char rx_len = 2;
-
- memset(rx_buf, 0, sizeof(rx_buf));
-
- tx_buf[0] = req;
-
- /* transfer only 7 bits of last byte in frame */
- ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING, 0x07);
- if (ret < 0)
- return ret;
-
-
- ret = rc632_clear_bits(handle, RC632_REG_CONTROL,
- RC632_CONTROL_CRYPTO1_ON);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
- (RC632_CR_PARITY_ENABLE |
- RC632_CR_PARITY_ODD));
- if (ret < 0)
- return ret;
-
- ret = rc632_transcieve(handle, tx_buf, sizeof(tx_buf), rx_buf,
- &rx_len, 0x32, 0);
- if (ret < 0)
- return ret;
-
- /* switch back to normal 8bit last byte */
- ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING, 0x00);
- if (ret < 0)
- return ret;
-
- if ((rx_len != 2) || (rx_buf[1] != 0xf0))
- return -1;
-
- resp[0] = rx_buf[0];
- resp[1] = rx_buf[1];
-
- return 0;
-}
-#endif
-
-/* issue a 14443-3 A PCD -> PICC command in a short frame, such as REQA, WUPA */
-static int
-rc632_iso14443a_transcieve_sf(struct rfid_asic_handle *handle,
- unsigned char cmd,
- struct iso14443a_atqa *atqa)
-{
- int ret;
- unsigned char tx_buf[1];
- unsigned char rx_len = 2;
-
- memset(atqa, 0, sizeof(atqa));
-
- tx_buf[0] = cmd;
-
- /* transfer only 7 bits of last byte in frame */
- ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING, 0x07);
- if (ret < 0)
- return ret;
-
-
- ret = rc632_clear_bits(handle, RC632_REG_CONTROL,
- RC632_CONTROL_CRYPTO1_ON);
- if (ret < 0)
- return ret;
-
- ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
- (RC632_CR_PARITY_ENABLE |
- RC632_CR_PARITY_ODD));
- if (ret < 0)
- return ret;
-
- ret = rc632_transcieve(handle, tx_buf, sizeof(tx_buf),
- (unsigned char *)atqa, &rx_len, 0x32, 0);
- if (ret < 0) {
- DEBUGP("error during rc632_transcieve()\n");
- return ret;
- }
-
- /* switch back to normal 8bit last byte */
- ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING, 0x00);
- if (ret < 0)
- return ret;
-
- if (rx_len != 2) {
- DEBUGP("rx_len(%d) != 2\n", rx_len);
- return -1;
- }
-
- return 0;
-}
-
-/* transcieve regular frame */
-static int
-rc632_iso14443a_transcieve(struct rfid_asic_handle *handle,
- const unsigned char *tx_buf, unsigned int tx_len,
- unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
-{
- int ret;
- unsigned char rxl = *rx_len & 0xff;
-
- memset(rx_buf, 0, *rx_len);
-
- ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
- (RC632_CR_PARITY_ENABLE |
- RC632_CR_PARITY_ODD |
- RC632_CR_TX_CRC_ENABLE |
- RC632_CR_RX_CRC_ENABLE));
- if (ret < 0)
- return ret;
-
- ret = rc632_transcieve(handle, tx_buf, tx_len, rx_buf, &rxl, 0x32, 0);
- *rx_len = rxl;
- if (ret < 0)
- return ret;
-
-
- return 0;
-}
-
-/* transcieve anti collission bitframe */
-static int
-rc632_iso14443a_transcieve_acf(struct rfid_asic_handle *handle,
- struct iso14443a_anticol_cmd *acf,
- unsigned int *bit_of_col)
-{
- int ret;
- unsigned char rx_buf[64];
- unsigned char rx_len = sizeof(rx_buf);
- unsigned char rx_align = 0, tx_last_bits, tx_bytes;
- unsigned char boc;
- unsigned char error_flag;
- *bit_of_col = ISO14443A_BITOFCOL_NONE;
- memset(rx_buf, 0, sizeof(rx_buf));
-
- /* disable mifare cryto */
- ret = rc632_clear_bits(handle, RC632_REG_CONTROL,
- RC632_CONTROL_CRYPTO1_ON);
- if (ret < 0)
- return ret;
-
- /* disalbe CRC summing */
- ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
- (RC632_CR_PARITY_ENABLE |
- RC632_CR_PARITY_ODD));
- if (ret < 0)
- return ret;
-
- tx_last_bits = acf->nvb & 0x0f; /* lower nibble indicates bits */
- tx_bytes = acf->nvb >> 4;
- if (tx_last_bits) {
- tx_bytes++;
- rx_align = (tx_last_bits+1) % 8;/* rx frame complements tx */
- }
-
- //rx_align = 8 - tx_last_bits;/* rx frame complements tx */
-
- /* set RxAlign and TxLastBits*/
- ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING,
- (rx_align << 4) | (tx_last_bits));
- if (ret < 0)
- return ret;
-
- ret = rc632_transcieve(handle, (unsigned char *)acf, tx_bytes,
- rx_buf, &rx_len, 0x32, 0);
- if (ret < 0)
- return ret;
-
- /* bitwise-OR the two halves of the split byte */
- acf->uid_bits[tx_bytes-2] = (
- (acf->uid_bits[tx_bytes-2] & (0xff >> (8-tx_last_bits)))
- | rx_buf[0]);
- /* copy the rest */
- memcpy(&acf->uid_bits[tx_bytes+1-2], &rx_buf[1], rx_len-1);
-
- /* determine whether there was a collission */
- ret = rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &error_flag);
- if (ret < 0)
- return ret;
-
- if (error_flag & RC632_ERR_FLAG_COL_ERR) {
- /* retrieve bit of collission */
- ret = rc632_reg_read(handle, RC632_REG_COLL_POS, &boc);
- if (ret < 0)
- return ret;
-
- /* bit of collission relative to start of part 1 of
- * anticollision frame (!) */
- *bit_of_col = 2*8 + boc;
- }
-
- return 0;
-}
-
-
diff --git a/src/rfid_asic_rc632_14443b.c b/src/rfid_asic_rc632_14443b.c
deleted file mode 100644
index 62aa224..0000000
--- a/src/rfid_asic_rc632_14443b.c
+++ /dev/null
@@ -1,69 +0,0 @@
-
-#include "rc632.h"
-
-int rc632_iso14443b_init(struct rc632_handle *handle)
-{
- // FIXME: some FIFO work
- //
- ret = rc632_reg_write(handle, RC632_REG_TX_CONTROL,
- (RC632_TXCTRL_TX1_RF_EN |
- RC632_TXCTRL_TX2_RF_EN |
- RC632_TXCTRL_TX2_INV |
- RC632_TXCTRL_MOD_SRC_INT));
-
- ret = rc632_reg_write(handle, RC632_REG_CW_CONDUCTANCE, 0x3f);
-
- ret = rc632_reg_write(handle, RC632_REG_MOD_CONDUCTANCE, 0x04);
-
- ret = rc632_reg_write(handle, RC632_REG_CODE_CONTROL,
- (RC632_CDRCTRL_TXCD_NRZ |
- RC632_CDRCTRL_RATE_14443B));
-
- ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH, 0x13);
-
- ret = rc632_reg_write(handle, RC632_REG_SOF_WIDTH, 0x3f);
-
- ret = rc632_reg_write(handle, RC632_REG_TYPE_B_FRAMING,
- (RC632_TBFRAMING_SOF_11L_3H |
- (6 << RC632_TBFRAMING_SPACE_SHIFT) |
- RC632_TBFRAMING_EOF_11));
-
- ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL1,
- (RC632_RXCTRL1_GAIN_35DB |
- RC632_RXCTRL1_ISO14443 |
- RC632_RXCTRL1_SUBCP_8));
-
- ret = rc632_reg_write(handle, RC632_REG_DECODE_CONTROL,
- (RC632_DECCTRL_BPSK |
- RC632_DECCTRL_RXFR_14443B));
-
- ret = rc632_reg_write(handle, RC632_REG_BIT_PHASE,
- CM5121_14443B_BITPHASE);
-
- ret = rc632_reg_write(handle, RC632_REG_RX_THRESHOLD,
- CM5121_14443B_THRESHOLD);
-
- ret = rc632_reg_write(handle, RC632_REG_BPSK_DEM_CONTROL,
- ((0x10 & RC632_BPSKD_TAUB_MASK)<<RC632_BPSKD_TAUB_SHIFT |
- (0x11 & RC632_BPSKD_TAUD_MASK)<<RC632_BPSKD_TAUD_SHIFT |
- RC632_BPSKD_FILTER_AMP_DETECT |
- RC632_BPSKD_NO_RX_EOF |
- RC632_BPSKD_NO_RX_EGT));
-
- ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL2,
- (RC632_RXCTRL2_AUTO_PD |
- RC632_RXCTRL2_DECSRC_INT));
-
- ret = rc632_reg_write(handle, RC632_REG_RX_WAIT, 0x03);
-
- ret = rc632_reg_write(handle, RC632_REG_CHANNEL_RDUNDANCY,
- (RC632_CR_TX_CRC_ENABLE |
- RC632_CR_RX_CRC_ENABLE |
- RC632_CR_CR3309));
-
- ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_LSB, 0xff);
-
- ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_MSB, 0xff);
-
-}
-
diff --git a/src/rfid_asic_rc632_mifare.c b/src/rfid_asic_rc632_mifare.c
deleted file mode 100644
index 9bfb0ae..0000000
--- a/src/rfid_asic_rc632_mifare.c
+++ /dev/null
@@ -1,25 +0,0 @@
-
-int
-rc632_mifare_read16()
-{
- unsigned char sndbuf[2];
- unsigned char recvbuf[0x40];
- unsigned char recvlen = sizeof(recvbuf);
-
- int ret;
-
- sndbuf[0] = 0x30;
- sndbuf[1] = arg_4;
-
- memset(recvbuf, 0, sizeof(recvbuf));
-
- ret = rc632_transcieve(handle, sndbuf, sizeof(sndbuf),
- recvbuf, &recvlen, 0x32, 0);
- if (ret < 0)
- return ret;
-
- if (recvlen != 0x10)
- return -1;
-
- return 0;
-}
diff --git a/src/rfid_layer2.c b/src/rfid_layer2.c
index 01443d8..8d1544a 100644
--- a/src/rfid_layer2.c
+++ b/src/rfid_layer2.c
@@ -21,8 +21,8 @@
#include <stdio.h>
#include <errno.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_layer2.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_layer2.h>
static struct rfid_layer2 *rfid_layer2_list;
diff --git a/src/rfid_layer2_iso14443a.c b/src/rfid_layer2_iso14443a.c
index 64a860f..da2628f 100644
--- a/src/rfid_layer2_iso14443a.c
+++ b/src/rfid_layer2_iso14443a.c
@@ -24,10 +24,10 @@
#include <string.h>
#include <errno.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_reader.h>
-#include <rfid/rfid_layer2_iso14443a.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_reader.h>
+#include <librfid/rfid_layer2_iso14443a.h>
#define TIMEOUT 1236
diff --git a/src/rfid_layer2_iso14443b.c b/src/rfid_layer2_iso14443b.c
index f874071..7c92562 100644
--- a/src/rfid_layer2_iso14443b.c
+++ b/src/rfid_layer2_iso14443b.c
@@ -23,10 +23,10 @@
#include <unistd.h>
#include <string.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_reader.h>
-#include <rfid/rfid_layer2_iso14443b.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_reader.h>
+#include <librfid/rfid_layer2_iso14443b.h>
#include "rfid_iso14443_common.h"
diff --git a/src/rfid_layer2_iso15693.c b/src/rfid_layer2_iso15693.c
index 15ff18a..1a93a19 100644
--- a/src/rfid_layer2_iso15693.c
+++ b/src/rfid_layer2_iso15693.c
@@ -23,10 +23,10 @@
#include <unistd.h>
#include <string.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_reader.h>
-#include <rfid/rfid_layer2_iso15693.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_reader.h>
+#include <librfid/rfid_layer2_iso15693.h>
#if 0
/* Transcieve a 7-bit short frame */
diff --git a/src/rfid_proto_mifare_classic.c b/src/rfid_proto_mifare_classic.c
index d6de606..e2ee80c 100644
--- a/src/rfid_proto_mifare_classic.c
+++ b/src/rfid_proto_mifare_classic.c
@@ -25,12 +25,12 @@
#include <string.h>
#include <errno.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_protocol.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_protocol_mifare_classic.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_protocol.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_protocol_mifare_classic.h>
-#include <rfid/rfid_reader.h>
+#include <librfid/rfid_reader.h>
#include "rfid_iso14443_common.h"
diff --git a/src/rfid_proto_mifare_ul.c b/src/rfid_proto_mifare_ul.c
index 7649b99..747f38c 100644
--- a/src/rfid_proto_mifare_ul.c
+++ b/src/rfid_proto_mifare_ul.c
@@ -25,10 +25,10 @@
#include <string.h>
#include <errno.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_protocol.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_protocol_mifare_ul.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_protocol.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_protocol_mifare_ul.h>
#include "rfid_iso14443_common.h"
diff --git a/src/rfid_proto_tcl.c b/src/rfid_proto_tcl.c
index 0587611..8f8eae9 100644
--- a/src/rfid_proto_tcl.c
+++ b/src/rfid_proto_tcl.c
@@ -25,14 +25,14 @@
#include <string.h>
#include <errno.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_protocol_tcl.h>
-#include <rfid/rfid_protocol.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_layer2_iso14443b.h>
-
-#include <rfid/rfid_asic.h>
-#include <rfid/rfid_reader.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_protocol_tcl.h>
+#include <librfid/rfid_protocol.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_layer2_iso14443b.h>
+
+#include <librfid/rfid_asic.h>
+#include <librfid/rfid_reader.h>
#include "rfid_iso14443_common.h"
diff --git a/src/rfid_protocol.c b/src/rfid_protocol.c
index abbd04d..c401a2c 100644
--- a/src/rfid_protocol.c
+++ b/src/rfid_protocol.c
@@ -21,8 +21,8 @@
#include <unistd.h>
#include <errno.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_protocol.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_protocol.h>
static struct rfid_protocol *rfid_protocol_list;
diff --git a/src/rfid_reader.c b/src/rfid_reader.c
index 9e46a29..9486cae 100644
--- a/src/rfid_reader.c
+++ b/src/rfid_reader.c
@@ -20,8 +20,8 @@
#include <stdlib.h>
#include <stdio.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_reader.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_reader.h>
static struct rfid_reader *rfid_reader_list;
diff --git a/src/rfid_reader_cm5121.c b/src/rfid_reader_cm5121.c
index 8baf013..5ccce98 100644
--- a/src/rfid_reader_cm5121.c
+++ b/src/rfid_reader_cm5121.c
@@ -32,11 +32,11 @@
#include <string.h>
#include <errno.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_reader.h>
-#include <rfid/rfid_asic.h>
-#include <rfid/rfid_asic_rc632.h>
-#include <rfid/rfid_reader_cm5121.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_reader.h>
+#include <librfid/rfid_asic.h>
+#include <librfid/rfid_asic_rc632.h>
+#include <librfid/rfid_reader_cm5121.h>
/* FIXME */
#include "rc632.h"
diff --git a/src/rfid_reader_cm5121_ccid_direct.c b/src/rfid_reader_cm5121_ccid_direct.c
index 7f53bb7..3161059 100644
--- a/src/rfid_reader_cm5121_ccid_direct.c
+++ b/src/rfid_reader_cm5121_ccid_direct.c
@@ -3,7 +3,7 @@
#include <unistd.h>
#include <stdio.h>
-#include <rfid/rfid_asic.h>
+#include <librfid/rfid_asic.h>
#include "ccid/ccid-driver.h"
diff --git a/src/rfid_reader_cm5121_openct.c b/src/rfid_reader_cm5121_openct.c
index 9d96638..4bc879c 100644
--- a/src/rfid_reader_cm5121_openct.c
+++ b/src/rfid_reader_cm5121_openct.c
@@ -2,7 +2,7 @@
#include <stdio.h>
-#include <rfid/rfid_asic.h>
+#include <librfid/rfid_asic.h>
#include <openct/openct.h>
/* FIXME: get rid of this global crap. In fact this needs to become part of
diff --git a/utils/openct-escape.c b/utils/openct-escape.c
index 0f9a68a..bc7883e 100644
--- a/utils/openct-escape.c
+++ b/utils/openct-escape.c
@@ -18,13 +18,13 @@
#include <stdlib.h>
#include <string.h>
-#include <rfid/rfid.h>
-#include <rfid/rfid_reader.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_protocol.h>
-#include <rfid/rfid_reader_cm5121.h>
-#include <rfid/rfid_protocol_mifare_classic.h>
-#include <rfid/rfid_protocol_mifare_ul.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_reader.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_protocol.h>
+
+#include <librfid/rfid_protocol_mifare_classic.h>
+#include <librfid/rfid_protocol_mifare_ul.h>
static struct rfid_reader_handle *rh;
static struct rfid_layer2_handle *l2h;
@@ -125,9 +125,9 @@ static int iso7816_get_challenge(unsigned char len)
int
iso7816_select_application(void)
{
- char cmd[] = { 0x00, 0xa4, 0x04, 0x0c, 0x07,
+ unsigned char cmd[] = { 0x00, 0xa4, 0x04, 0x0c, 0x07,
0xa0, 0x00, 0x00, 0x02, 0x47, 0x10, 0x01 };
- char resp[7];
+ unsigned char resp[7];
unsigned int rlen = sizeof(resp);
int rv;
@@ -308,7 +308,7 @@ int main(int argc, char **argv)
iso7816_select_ef(0x0101);
#if 1
for (i = 0; i < 4; i++)
- iso7816_get_challenge(0x60);
+ iso7816_get_challenge(0x06);
#endif
break;
case RFID_PROTOCOL_MIFARE_UL:
personal git repositories of Harald Welte. Your mileage may vary