summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2005-10-23 22:29:08 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2005-10-23 22:29:08 +0000
commit091edfa6a3cd9f94aa02260830951dc1798207d3 (patch)
tree4bb63dec06e773caca0cf9b9b7a3197849f6ae71
parent6d7f1185f88ea5c788d0f7b113db8e2b98ca6336 (diff)
- fix CRC issue (cl632 now removes crc from end of frame)
- make TCL implementation use correct frame type for both 14443a/b git-svn-id: https://svn.gnumonks.org/trunk/librfid@1562 e0336214-984f-0b4b-a45f-81c69e1f0ede
-rw-r--r--rfid_asic_rc632.c10
-rw-r--r--rfid_proto_tcl.c17
2 files changed, 19 insertions, 8 deletions
diff --git a/rfid_asic_rc632.c b/rfid_asic_rc632.c
index eeb6d89..fae4f01 100644
--- a/rfid_asic_rc632.c
+++ b/rfid_asic_rc632.c
@@ -576,7 +576,6 @@ rc632_iso14443a_transcieve_sf(struct rfid_asic_handle *handle,
if (ret < 0)
return ret;
-
ret = rc632_clear_bits(handle, RC632_REG_CONTROL,
RC632_CONTROL_CRYPTO1_ON);
if (ret < 0)
@@ -631,10 +630,13 @@ rc632_iso14443ab_transcieve(struct rfid_asic_handle *handle,
switch (frametype) {
case RFID_14443A_FRAME_REGULAR:
- case RFID_14443B_FRAME_REGULAR:
- channel_red = RC632_CR_TX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE
+ channel_red = RC632_CR_RX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE
|RC632_CR_PARITY_ENABLE|RC632_CR_PARITY_ODD;
break;
+ case RFID_14443B_FRAME_REGULAR:
+ channel_red = RC632_CR_RX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE
+ |RC632_CR_CRC3309;
+ break;
case RFID_MIFARE_FRAME:
channel_red = RC632_CR_PARITY_ENABLE|RC632_CR_PARITY_ODD;
break;
@@ -1255,7 +1257,7 @@ rc632_mifare_transcieve(struct rfid_asic_handle *handle,
RC632_CR_RX_CRC_ENABLE));
#endif
ret = rc632_clear_bits(handle, RC632_REG_CHANNEL_REDUNDANCY,
- RC632_CR_TX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE);
+ RC632_CR_RX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE);
if (ret < 0)
return ret;
diff --git a/rfid_proto_tcl.c b/rfid_proto_tcl.c
index 2451b1d..102c58f 100644
--- a/rfid_proto_tcl.c
+++ b/rfid_proto_tcl.c
@@ -36,6 +36,18 @@
#include "rfid_iso14443_common.h"
+static enum rfid_frametype l2_to_frame(unsigned int layer2)
+{
+ switch (layer2) {
+ case RFID_LAYER2_ISO14443A:
+ return RFID_14443A_FRAME_REGULAR;
+ break;
+ case RFID_LAYER2_ISO14443B:
+ return RFID_14443B_FRAME_REGULAR;
+ break;
+ }
+ return 0;
+}
static unsigned int sfgi_to_sfgt(struct rfid_protocol_handle *h,
unsigned char sfgi)
@@ -502,16 +514,13 @@ tcl_transcieve(struct rfid_protocol_handle *h,
*rx_len = 0;
do_tx:
- ret = h->l2h->l2->fn.transcieve(h->l2h, RFID_14443A_FRAME_REGULAR,
+ ret = h->l2h->l2->fn.transcieve(h->l2h, l2_to_frame(h->l2h->l2->id),
_tx, _tx_len,
rx_buf, &_rx_len, _timeout, 0);
DEBUGP("l2 transcieve finished\n");
if (ret < 0)
goto out_rxb;
- if (_rx_len >= 2)
- _rx_len -= 2; /* CRC is not removed by ASIC ?!? */
-
if ((*rx_buf & 0x01) != h->priv.tcl.toggle) {
DEBUGP("response with wrong toggle bit\n");
goto out_rxb;
personal git repositories of Harald Welte. Your mileage may vary