1 /* Generic Philips CL RC632 Routines
3 * (C) Harald Welte <laforge@gnumonks.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <sys/types.h>
27 #include <rfid/rfid.h>
28 #include <rfid/rfid_asic.h>
29 #include <rfid/rfid_asic_rc632.h>
30 #include <rfid/rfid_reader_cm5121.h>
31 #include <rfid/rfid_layer2_iso14443a.h>
33 #include "rfid_iso14443_common.h"
35 //#include "rc632_14443a.h"
38 #define ENTER() DEBUGP("entering\n")
39 struct rfid_asic rc632;
41 /* Register and FIFO Access functions */
43 rc632_reg_write(struct rfid_asic_handle *handle,
47 return handle->rath->rat->priv.rc632.fn.reg_write(handle->rath, reg, val);
51 rc632_reg_read(struct rfid_asic_handle *handle,
55 return handle->rath->rat->priv.rc632.fn.reg_read(handle->rath, reg, val);
59 rc632_fifo_write(struct rfid_asic_handle *handle,
61 const unsigned char *buf,
64 return handle->rath->rat->priv.rc632.fn.fifo_write(handle->rath,
69 rc632_fifo_read(struct rfid_asic_handle *handle,
73 return handle->rath->rat->priv.rc632.fn.fifo_read(handle->rath, len, buf);
78 rc632_set_bits(struct rfid_asic_handle *handle,
85 ret = rc632_reg_read(handle, reg, &tmp);
89 /* if bits are already set, no need to set them again */
90 if ((tmp & val) == val)
93 return rc632_reg_write(handle, reg, (tmp|val)&0xff);
97 rc632_clear_bits(struct rfid_asic_handle *handle,
104 ret = rc632_reg_read(handle, reg, &tmp);
106 DEBUGP("error during reg_read(%p, %d):%d\n",
110 /* if bits are already cleared, no need to clear them again */
111 if ((tmp & val) == 0)
114 return rc632_reg_write(handle, reg, (tmp & ~val)&0xff);
120 rc632_turn_on_rf(struct rfid_asic_handle *handle)
123 return rc632_set_bits(handle, RC632_REG_TX_CONTROL, 0x03);
127 rc632_turn_off_rf(struct rfid_asic_handle *handle)
130 return rc632_clear_bits(handle, RC632_REG_TX_CONTROL, 0x03);
134 rc632_power_up(struct rfid_asic_handle *handle)
137 return rc632_clear_bits(handle, RC632_REG_CONTROL,
138 RC632_CONTROL_POWERDOWN);
142 rc632_power_down(struct rfid_asic_handle *handle)
144 return rc632_set_bits(handle, RC632_REG_CONTROL,
145 RC632_CONTROL_POWERDOWN);
148 /* Stupid RC623 implementations don't evaluate interrupts but poll the
149 * command register for "status idle" */
151 rc632_wait_idle(struct rfid_asic_handle *handle, u_int64_t timeout)
153 unsigned char cmd = 0xff;
157 ret = rc632_reg_read(handle, RC632_REG_COMMAND, &cmd);
162 /* FIXME: read second time ?? */
168 rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &foo);
170 rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &foo);
175 /* Fixme: Abort after some timeout */
182 rc632_transmit(struct rfid_asic_handle *handle,
183 const unsigned char *buf,
189 ret = rc632_fifo_write(handle, len, buf, 0x03);
193 ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_TRANSMIT);
197 return rc632_wait_idle(handle, timeout);
201 tcl_toggle_pcb(struct rfid_asic_handle *handle)
203 // FIXME: toggle something between 0x0a and 0x0b
208 rc632_transcieve(struct rfid_asic_handle *handle,
209 const unsigned char *tx_buf,
210 unsigned char tx_len,
211 unsigned char *rx_buf,
212 unsigned char *rx_len,
218 ret = rc632_fifo_write(handle, tx_len, tx_buf, 0x03);
222 ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_TRANSCIEVE);
227 tcl_toggle_pcb(handle);
229 ret = rc632_wait_idle(handle, timer);
233 ret = rc632_reg_read(handle, RC632_REG_FIFO_LENGTH, rx_len);
240 DEBUGP("rx_len == 0\n");
242 rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &tmp);
243 rc632_reg_read(handle, RC632_REG_CHANNEL_REDUNDANCY, &tmp);
248 return rc632_fifo_read(handle, *rx_len, rx_buf);
252 rc632_read_eeprom(struct rfid_asic_handle *handle)
254 unsigned char recvbuf[60];
255 unsigned char sndbuf[3];
262 ret = rc632_fifo_write(handle, 3, sndbuf, 0x03);
266 ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_READ_E2);
272 ret = rc632_fifo_read(handle, sizeof(recvbuf), recvbuf);
276 // FIXME: do something with eeprom contents
281 rc632_calc_crc16_from(struct rfid_asic_handle *handle)
283 unsigned char sndbuf[2] = { 0x01, 0x02 };
284 unsigned char crc_lsb = 0x00 , crc_msb = 0x00;
287 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_LSB, 0x12);
291 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_MSB, 0xe0);
295 ret = rc632_fifo_write(handle, sizeof(sndbuf), sndbuf, 3);
299 ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_CALC_CRC);
303 usleep(10000); // FIXME: no checking for cmd completion?
305 ret = rc632_reg_read(handle, RC632_REG_CRC_RESULT_LSB, &crc_lsb);
309 ret = rc632_reg_read(handle, RC632_REG_CRC_RESULT_MSB, &crc_msb);
313 // FIXME: what to do with crc result?
319 rc632_register_dump(struct rfid_asic_handle *handle, unsigned char *buf)
324 for (i = 0; i <= 0x3f; i++) {
325 ret = rc632_reg_read(handle, i, &buf[i]);
326 // do we want error checks?
333 /* generic FIFO access functions (if no more efficient ones provided by
334 * transport driver) */
339 // FIXME: implementation (not needed for CM 5121)
346 // FIXME: implementation (not neded for CM 5121)
351 rc632_init(struct rfid_asic_handle *ah)
355 /* switch off rf (make sure PICCs are reset at init time) */
356 ret = rc632_power_down(ah);
363 ret = rc632_power_up(ah);
367 /* disable register paging */
368 ret = rc632_reg_write(ah, 0x00, 0x00);
372 /* set some sane default values */
373 ret = rc632_reg_write(ah, 0x11, 0x5b);
378 ret = rc632_turn_on_rf(ah);
386 rc632_fini(struct rfid_asic_handle *ah)
391 ret = rc632_turn_off_rf(ah);
395 ret = rc632_power_down(ah);
402 struct rfid_asic_handle *
403 rc632_open(struct rfid_asic_transport_handle *th)
405 struct rfid_asic_handle *h;
407 h = malloc(sizeof(*h));
410 memset(h, 0, sizeof(*h));
415 h->mtu = h->mru = 40; /* FIXME */
417 if (rc632_init(h) < 0) {
426 rc632_close(struct rfid_asic_handle *h)
434 * Philips CL RC632 primitives for ISO 14443-A compliant PICC's
436 * (C) 2005 by Harald Welte <laforge@gnumonks.org>
441 rc632_iso14443a_init(struct rfid_asic_handle *handle)
445 // FIXME: some fifo work (drain fifo?)
447 /* flush fifo (our way) */
448 ret = rc632_reg_write(handle, RC632_REG_CONTROL, 0x01);
450 ret = rc632_reg_write(handle, RC632_REG_TX_CONTROL,
451 (RC632_TXCTRL_TX1_RF_EN |
452 RC632_TXCTRL_TX2_RF_EN |
453 RC632_TXCTRL_TX2_INV |
454 RC632_TXCTRL_FORCE_100_ASK |
455 RC632_TXCTRL_MOD_SRC_INT));
459 ret = rc632_reg_write(handle, RC632_REG_CW_CONDUCTANCE,
460 CM5121_CW_CONDUCTANCE);
464 /* Since FORCE_100_ASK is set (cf mc073930.pdf), this line may be left out? */
465 ret = rc632_reg_write(handle, RC632_REG_MOD_CONDUCTANCE,
466 CM5121_MOD_CONDUCTANCE);
470 ret = rc632_reg_write(handle, RC632_REG_CODER_CONTROL,
471 (RC632_CDRCTRL_TXCD_14443A |
472 RC632_CDRCTRL_RATE_106K));
476 ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH, 0x13);
480 ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH_SOF, 0x3f);
484 ret = rc632_reg_write(handle, RC632_REG_TYPE_B_FRAMING, 0x00);
488 ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL1,
489 (RC632_RXCTRL1_GAIN_35DB |
490 RC632_RXCTRL1_ISO14443 |
491 RC632_RXCTRL1_SUBCP_8));
495 ret = rc632_reg_write(handle, RC632_REG_DECODER_CONTROL,
496 (RC632_DECCTRL_MANCHESTER |
497 RC632_DECCTRL_RXFR_14443A));
501 ret = rc632_reg_write(handle, RC632_REG_BIT_PHASE,
502 CM5121_14443A_BITPHASE);
506 ret = rc632_reg_write(handle, RC632_REG_RX_THRESHOLD,
507 CM5121_14443A_THRESHOLD);
511 ret = rc632_reg_write(handle, RC632_REG_BPSK_DEM_CONTROL, 0x00);
515 ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL2,
516 (RC632_RXCTRL2_DECSRC_INT |
517 RC632_RXCTRL2_CLK_Q));
521 /* Omnikey proprietary driver has 0x03, but 0x06 is the default reset value ?!? */
522 ret = rc632_reg_write(handle, RC632_REG_RX_WAIT, 0x06);
526 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
527 (RC632_CR_PARITY_ENABLE |
528 RC632_CR_PARITY_ODD));
532 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_LSB, 0x63);
536 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_MSB, 0x63);
544 rc632_iso14443a_fini(struct iso14443a_handle *handle_14443)
548 ret = rc632_turn_off_rf(handle);
558 /* issue a 14443-3 A PCD -> PICC command in a short frame, such as REQA, WUPA */
560 rc632_iso14443a_transcieve_sf(struct rfid_asic_handle *handle,
562 struct iso14443a_atqa *atqa)
565 unsigned char tx_buf[1];
566 unsigned char rx_len = 2;
568 memset(atqa, 0, sizeof(atqa));
572 /* transfer only 7 bits of last byte in frame */
573 ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING, 0x07);
578 ret = rc632_clear_bits(handle, RC632_REG_CONTROL,
579 RC632_CONTROL_CRYPTO1_ON);
584 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
585 (RC632_CR_PARITY_ENABLE |
586 RC632_CR_PARITY_ODD));
588 ret = rc632_clear_bits(handle, RC632_REG_CHANNEL_REDUNDANCY,
589 RC632_CR_TX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE);
595 ret = rc632_transcieve(handle, tx_buf, sizeof(tx_buf),
596 (unsigned char *)atqa, &rx_len, 0x32, 0);
598 DEBUGP("error during rc632_transcieve()\n");
602 /* switch back to normal 8bit last byte */
603 ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING, 0x00);
608 DEBUGP("rx_len(%d) != 2\n", rx_len);
615 /* transcieve regular frame */
617 rc632_iso14443a_transcieve(struct rfid_asic_handle *handle,
618 const unsigned char *tx_buf, unsigned int tx_len,
619 unsigned char *rx_buf, unsigned int *rx_len,
620 u_int64_t timeout, unsigned int flags)
623 unsigned char rxl = *rx_len & 0xff;
625 memset(rx_buf, 0, *rx_len);
628 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
629 (RC632_CR_PARITY_ENABLE |
630 RC632_CR_PARITY_ODD |
631 RC632_CR_TX_CRC_ENABLE |
632 RC632_CR_RX_CRC_ENABLE));
634 ret = rc632_set_bits(handle, RC632_REG_CHANNEL_REDUNDANCY,
635 RC632_CR_TX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE);
639 ret = rc632_transcieve(handle, tx_buf, tx_len, rx_buf, &rxl, 0x32, 0);
648 /* transcieve anti collission bitframe */
650 rc632_iso14443a_transcieve_acf(struct rfid_asic_handle *handle,
651 struct iso14443a_anticol_cmd *acf,
652 unsigned int *bit_of_col)
655 unsigned char rx_buf[64];
656 unsigned char rx_len = sizeof(rx_buf);
657 unsigned char rx_align = 0, tx_last_bits, tx_bytes;
659 unsigned char error_flag;
660 *bit_of_col = ISO14443A_BITOFCOL_NONE;
661 memset(rx_buf, 0, sizeof(rx_buf));
663 /* disable mifare cryto */
664 ret = rc632_clear_bits(handle, RC632_REG_CONTROL,
665 RC632_CONTROL_CRYPTO1_ON);
669 /* disable CRC summing */
671 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
672 (RC632_CR_PARITY_ENABLE |
673 RC632_CR_PARITY_ODD));
675 ret = rc632_clear_bits(handle, RC632_REG_CHANNEL_REDUNDANCY,
676 RC632_CR_TX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE);
681 tx_last_bits = acf->nvb & 0x0f; /* lower nibble indicates bits */
682 tx_bytes = acf->nvb >> 4;
685 rx_align = (tx_last_bits+1) % 8;/* rx frame complements tx */
688 //rx_align = 8 - tx_last_bits;/* rx frame complements tx */
690 /* set RxAlign and TxLastBits*/
691 ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING,
692 (rx_align << 4) | (tx_last_bits));
696 ret = rc632_transcieve(handle, (unsigned char *)acf, tx_bytes,
697 rx_buf, &rx_len, 0x32, 0);
701 /* bitwise-OR the two halves of the split byte */
702 acf->uid_bits[tx_bytes-2] = (
703 (acf->uid_bits[tx_bytes-2] & (0xff >> (8-tx_last_bits)))
706 memcpy(&acf->uid_bits[tx_bytes+1-2], &rx_buf[1], rx_len-1);
708 /* determine whether there was a collission */
709 ret = rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &error_flag);
713 if (error_flag & RC632_ERR_FLAG_COL_ERR) {
714 /* retrieve bit of collission */
715 ret = rc632_reg_read(handle, RC632_REG_COLL_POS, &boc);
719 /* bit of collission relative to start of part 1 of
720 * anticollision frame (!) */
721 *bit_of_col = 2*8 + boc;
727 static int rc632_iso14443b_init(struct rfid_asic_handle *handle)
731 // FIXME: some FIFO work
733 /* flush fifo (our way) */
734 ret = rc632_reg_write(handle, RC632_REG_CONTROL, 0x01);
738 ret = rc632_reg_write(handle, RC632_REG_TX_CONTROL,
739 (RC632_TXCTRL_TX1_RF_EN |
740 RC632_TXCTRL_TX2_RF_EN |
741 RC632_TXCTRL_TX2_INV |
742 RC632_TXCTRL_MOD_SRC_INT));
746 ret = rc632_reg_write(handle, RC632_REG_CW_CONDUCTANCE, 0x3f);
750 ret = rc632_reg_write(handle, RC632_REG_MOD_CONDUCTANCE, 0x04);
754 ret = rc632_reg_write(handle, RC632_REG_CODER_CONTROL,
755 (RC632_CDRCTRL_TXCD_NRZ |
756 RC632_CDRCTRL_RATE_14443B));
760 ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH, 0x13);
764 ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH_SOF, 0x3f);
768 ret = rc632_reg_write(handle, RC632_REG_TYPE_B_FRAMING,
769 (RC632_TBFRAMING_SOF_11L_3H |
770 (6 << RC632_TBFRAMING_SPACE_SHIFT) |
771 RC632_TBFRAMING_EOF_11));
775 ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL1,
776 (RC632_RXCTRL1_GAIN_35DB |
777 RC632_RXCTRL1_ISO14443 |
778 RC632_RXCTRL1_SUBCP_8));
782 ret = rc632_reg_write(handle, RC632_REG_DECODER_CONTROL,
783 (RC632_DECCTRL_BPSK |
784 RC632_DECCTRL_RXFR_14443B));
788 ret = rc632_reg_write(handle, RC632_REG_BIT_PHASE,
789 CM5121_14443B_BITPHASE);
793 ret = rc632_reg_write(handle, RC632_REG_RX_THRESHOLD,
794 CM5121_14443B_THRESHOLD);
798 ret = rc632_reg_write(handle, RC632_REG_BPSK_DEM_CONTROL,
799 ((0x2 & RC632_BPSKD_TAUB_MASK)<<RC632_BPSKD_TAUB_SHIFT |
800 (0x3 & RC632_BPSKD_TAUD_MASK)<<RC632_BPSKD_TAUD_SHIFT |
801 RC632_BPSKD_FILTER_AMP_DETECT |
802 RC632_BPSKD_NO_RX_EOF |
803 RC632_BPSKD_NO_RX_EGT));
807 ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL2,
808 (RC632_RXCTRL2_AUTO_PD |
809 RC632_RXCTRL2_DECSRC_INT));
813 ret = rc632_reg_write(handle, RC632_REG_RX_WAIT, 0x03);
817 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
818 (RC632_CR_TX_CRC_ENABLE |
819 RC632_CR_RX_CRC_ENABLE |
824 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_LSB, 0xff);
828 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_MSB, 0xff);
836 rc632_iso15693_init(struct rfid_asic_handle *h)
840 ret = rc632_reg_write(h, RC632_REG_TX_CONTROL,
841 (RC632_TXCTRL_MOD_SRC_INT |
842 RC632_TXCTRL_TX2_INV |
843 RC632_TXCTRL_TX2_RF_EN |
844 RC632_TXCTRL_TX1_RF_EN));
848 ret = rc632_reg_write(h, RC632_REG_CW_CONDUCTANCE, 0x3f);
852 ret = rc632_reg_write(h, RC632_REG_MOD_CONDUCTANCE, 0x03);
856 ret = rc632_reg_write(h, RC632_REG_CODER_CONTROL,
857 (RC632_CDRCTRL_RATE_15693 |
862 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH, 0x3f);
866 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH_SOF, 0x3f);
870 ret = rc632_reg_write(h, RC632_REG_TYPE_B_FRAMING, 0x00);
874 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL1,
875 (RC632_RXCTRL1_SUBCP_16 |
876 RC632_RXCTRL1_ISO15693 |
877 RC632_RXCTRL1_GAIN_35DB));
881 ret = rc632_reg_write(h, RC632_REG_DECODER_CONTROL,
882 (RC632_DECCTRL_RXFR_15693 |
883 RC632_DECCTRL_RX_INVERT));
887 ret = rc632_reg_write(h, RC632_REG_BIT_PHASE, 0xe0);
891 ret = rc632_reg_write(h, RC632_REG_RX_THRESHOLD, 0xff);
895 ret = rc632_reg_write(h, RC632_REG_BPSK_DEM_CONTROL, 0x00);
899 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL2,
900 (RC632_RXCTRL2_AUTO_PD |
901 RC632_RXCTRL2_DECSRC_INT));
905 ret = rc632_reg_write(h, RC632_REG_CHANNEL_REDUNDANCY,
907 RC632_CR_RX_CRC_ENABLE |
908 RC632_CR_TX_CRC_ENABLE));
912 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_LSB, 0xff);
916 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_MSB, 0xff);
924 rc632_iso15693_icode_init(struct rfid_asic_handle *h)
928 ret = rc632_reg_write(h, RC632_REG_TX_CONTROL,
929 (RC632_TXCTRL_MOD_SRC_INT |
930 RC632_TXCTRL_TX2_INV |
931 RC632_TXCTRL_TX2_RF_EN |
932 RC632_TXCTRL_TX1_RF_EN));
936 ret = rc632_reg_write(h, RC632_REG_CW_CONDUCTANCE, 0x3f);
940 ret = rc632_reg_write(h, RC632_REG_MOD_CONDUCTANCE, 0x02);
944 ret = rc632_reg_write(h, RC632_REG_CODER_CONTROL, 0x2c);
948 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH, 0x3f);
952 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH_SOF, 0x3f);
956 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH_SOF, 0x3f);
960 ret = rc632_reg_write(h, RC632_REG_TYPE_B_FRAMING, 0x00);
964 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL1, 0x8b); /* FIXME */
968 ret = rc632_reg_write(h, RC632_REG_DECODER_CONTROL, 0x00);
972 ret = rc632_reg_write(h, RC632_REG_BIT_PHASE, 0x52);
976 ret = rc632_reg_write(h, RC632_REG_RX_THRESHOLD, 0x66);
980 ret = rc632_reg_write(h, RC632_REG_BPSK_DEM_CONTROL, 0x00);
984 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL2,
985 RC632_RXCTRL2_DECSRC_INT);
989 ret = rc632_reg_write(h, RC632_REG_CHANNEL_REDUNDANCY,
990 (RC632_CR_RX_CRC_ENABLE |
991 RC632_CR_TX_CRC_ENABLE));
992 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_LSB, 0xfe);
996 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_MSB, 0xff);
1004 rc632_iso15693_icl_init(struct rfid_asic_handle *h)
1010 ret = rc632_reg_write(h, RC632_REG_TX_CONTROL,
1011 (RC632_TXCTRL_MOD_SRC_INT |
1012 RC632_TXCTRL_TX2_INV |
1013 RC632_TXCTRL_TX2_RF_EN |
1014 RC632_TXCTRL_TX1_RF_EN));
1018 ret = rc632_reg_write(h, RC632_REG_CW_CONDUCTANCE, 0x3f);
1022 ret = rc632_reg_write(h, RC632_REG_MOD_CONDUCTANCE, 0x11);
1026 ret = rc632_reg_write(h, RC632_REG_CODER_CONTROL,
1027 (RC632_CDRCTRL_RATE_15693 |
1028 RC632_CDRCTRL_TXCD_ICODE_STD |
1033 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH, 0x3f);
1037 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH_SOF, 0x3f);
1040 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL1,
1041 (RC632_RXCTRL1_SUBCP_16|
1042 RC632_RXCTRL1_ISO15693|
1043 RC632_RXCTRL1_GAIN_35DB));
1046 ret = rc632_reg_write(h, RC632_REG_DECODER_CONTROL,
1047 (RC632_DECCTRL_RX_INVERT|
1048 RC632_DECCTRL_RXFR_15693));
1052 ret = rc632_reg_write(h, RC632_REG_BIT_PHASE, 0xbd);
1056 ret = rc632_reg_write(h, RC632_REG_RX_THRESHOLD, 0xff);
1060 ret = rc632_reg_write(h, RC632_REG_BPSK_DEM_CONTROL, 0x00);
1064 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL2,
1065 RC632_RXCTRL2_DECSRC_INT);
1069 ret = rc632_reg_write(h, RC632_REG_CHANNEL_REDUNDANCY, 0x00);
1073 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_LSB, 0x12);
1077 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_MSB, 0xe0);
1085 struct rfid_asic rc632 = {
1086 .name = "Philips CL RC632",
1087 .fc = ISO14443_FREQ_CARRIER,
1089 .fn.power_up = &rc632_power_up,
1090 .fn.power_down = &rc632_power_down,
1091 .fn.turn_on_rf = &rc632_turn_on_rf,
1092 .fn.turn_off_rf = &rc632_turn_off_rf,
1093 .fn.transcieve = &rc632_iso14443a_transcieve,
1095 .init = &rc632_iso14443a_init,
1096 .transcieve_sf = &rc632_iso14443a_transcieve_sf,
1097 .transcieve_acf = &rc632_iso14443a_transcieve_acf,
1100 .init = &rc632_iso14443b_init,
1103 .init = &rc632_iso15693_init,