- fix CRC issue (cl632 now removes crc from end of frame)
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>
Sun, 23 Oct 2005 22:29:08 +0000 (22:29 +0000)
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>
Sun, 23 Oct 2005 22:29:08 +0000 (22:29 +0000)
- 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

rfid_asic_rc632.c
rfid_proto_tcl.c

index eeb6d89..fae4f01 100644 (file)
@@ -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;
 
index 2451b1d..102c58f 100644 (file)
 
 #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;