- fix treatment of rx_length in low-level transceive routines
[librfid] / src / rfid_layer2_iso14443a.c
index 64a860f..839cffe 100644 (file)
 #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
 
-/* Transcieve a 7-bit short frame */
+/* Transceive a 7-bit short frame */
 static int
-iso14443a_transcieve_sf(struct rfid_layer2_handle *handle,
+iso14443a_transceive_sf(struct rfid_layer2_handle *handle,
                         unsigned char cmd,
                         struct iso14443a_atqa *atqa)
 {
        struct rfid_reader *rdr = handle->rh->reader;
 
-       return rdr->iso14443a.transcieve_sf(handle->rh, cmd, atqa);
+       return rdr->iso14443a.transceive_sf(handle->rh, cmd, atqa);
 }
 
 /* Transmit an anticollission bit frame */
 static int
-iso14443a_transcieve_acf(struct rfid_layer2_handle *handle,
+iso14443a_transceive_acf(struct rfid_layer2_handle *handle,
                         struct iso14443a_anticol_cmd *acf,
                         unsigned int *bit_of_col)
 {
        struct rfid_reader *rdr = handle->rh->reader;
 
-       return rdr->iso14443a.transcieve_acf(handle->rh, acf, bit_of_col);
+       return rdr->iso14443a.transceive_acf(handle->rh, acf, bit_of_col);
 }
 
 /* Transmit a regular frame */
 static int 
-iso14443a_transcieve(struct rfid_layer2_handle *handle,
+iso14443a_transceive(struct rfid_layer2_handle *handle,
                     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)
 {
-       return handle->rh->reader->transcieve(handle->rh, frametype, tx_buf,
+       return handle->rh->reader->transceive(handle->rh, frametype, tx_buf,
                                        tx_len, rx_buf, rx_len, timeout, flags);
 }
 
@@ -111,10 +111,10 @@ iso14443a_anticol(struct rfid_layer2_handle *handle)
        memset(&atqa, 0, sizeof(atqa));
        memset(&acf, 0, sizeof(acf));
 
-       ret = iso14443a_transcieve_sf(handle, ISO14443A_SF_CMD_REQA, &atqa);
+       ret = iso14443a_transceive_sf(handle, ISO14443A_SF_CMD_REQA, &atqa);
        if (ret < 0) {
                h->state = ISO14443A_STATE_REQA_SENT;
-               DEBUGP("error during transcieve_sf: %d\n", ret);
+               DEBUGP("error during transceive_sf: %d\n", ret);
                return ret;
        }
        h->state = ISO14443A_STATE_ATQA_RCVD;
@@ -142,7 +142,7 @@ iso14443a_anticol(struct rfid_layer2_handle *handle)
 cascade:
        iso14443a_code_nvb_bits(&acf.nvb, 16);
 
-       ret = iso14443a_transcieve_acf(handle, &acf, &bit_of_col);
+       ret = iso14443a_transceive_acf(handle, &acf, &bit_of_col);
        if (ret < 0)
                return ret;
        DEBUGP("bit_of_col = %u\n", bit_of_col);
@@ -150,14 +150,14 @@ cascade:
        while (bit_of_col != ISO14443A_BITOFCOL_NONE) {
                set_bit_in_field(&acf.uid_bits[0], bit_of_col-16);
                iso14443a_code_nvb_bits(&acf.nvb, bit_of_col);
-               ret = iso14443a_transcieve_acf(handle, &acf, &bit_of_col);
+               ret = iso14443a_transceive_acf(handle, &acf, &bit_of_col);
                DEBUGP("bit_of_col = %u\n", bit_of_col);
                if (ret < 0)
                        return ret;
        }
 
        iso14443a_code_nvb_bits(&acf.nvb, 7*8);
-       ret = iso14443a_transcieve(handle, RFID_14443A_FRAME_REGULAR,
+       ret = iso14443a_transceive(handle, RFID_14443A_FRAME_REGULAR,
                                   (unsigned char *)&acf, 7, 
                                   (unsigned char *) &sak, &rx_len,
                                   TIMEOUT, 0);
@@ -241,7 +241,7 @@ iso14443a_hlta(struct rfid_layer2_handle *handle)
        unsigned char rx_buf[10];
        unsigned int rx_len = sizeof(rx_buf);
 
-       ret = iso14443a_transcieve(handle, RFID_14443A_FRAME_REGULAR,
+       ret = iso14443a_transceive(handle, RFID_14443A_FRAME_REGULAR,
                                   tx_buf, sizeof(tx_buf),
                                   rx_buf, &rx_len, 1000 /* 1ms */, 0);
        if (ret < 0) {
@@ -314,7 +314,7 @@ struct rfid_layer2 rfid_layer2_iso14443a = {
        .fn     = {
                .init           = &iso14443a_init,
                .open           = &iso14443a_anticol,
-               .transcieve     = &iso14443a_transcieve,
+               .transceive     = &iso14443a_transceive,
                .close          = &iso14443a_hlta,
                .fini           = &iso14443a_fini,
                .setopt         = &iso14443a_setopt,