diff options
author | laforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2006-10-15 20:21:40 +0000 |
---|---|---|
committer | laforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2006-10-15 20:21:40 +0000 |
commit | 28eb4a57d93f2cf13d3693ce4dba677f22cbf1cc (patch) | |
tree | 3cc72ad1aeb7c543f91989d4cb055f06d81cd33f /firmware/include | |
parent | b2f42e7acf929490965348e826b5fa86c51515f5 (diff) |
- add svn:ignore property to make 'svn st' output more realistic
- remove old copy+paste+edit port of parts of librfid
- add ability to directly link librfid.a from mainline librfid
- make usb string descriptors optional again (config.h)
- fix TC_CDIV to reset correctly on swtrig (For OpenPICC)
- temporarily re-implement ep0_send_data() in pcd_enumerate.c
- make UDP_PUPv4 switching conditional to PCD
- introduce DEBUG_UNBUFFERED define in dbgu.c
- fix some signed/unsigned/typecast related compiler warnings
- remove dead code from src/os/led.c
- implement a 'mdelay' and 'usleep' stub function (FIXME!)
- rename rc632_... functions into opcd_rc632_... to avoid confusion
- introduce new 'main_librfid' TARGET
- make main_{reqa,analog} work with librfid rather than old code
- introduce mroe debugging options for FIQ handler code in Cstartup_app
- lots of PICC work that doesn't need comments now
git-svn-id: https://svn.openpcd.org:2342/trunk@266 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'firmware/include')
-rw-r--r-- | firmware/include/librfid/rfid.h | 24 | ||||
-rw-r--r-- | firmware/include/librfid/rfid_layer2.h | 76 | ||||
-rw-r--r-- | firmware/include/librfid/rfid_layer2_iso14443a.h | 87 | ||||
-rw-r--r-- | firmware/include/librfid/rfid_layer2_iso14443b.h | 85 | ||||
-rw-r--r-- | firmware/include/librfid/rfid_layer2_iso15693.h | 55 | ||||
-rw-r--r-- | firmware/include/librfid/rfid_protocol_mifare_classic.h | 28 | ||||
-rw-r--r-- | firmware/include/openpcd.h | 4 | ||||
-rw-r--r-- | firmware/include/openpicc_regs.h | 1 |
8 files changed, 5 insertions, 355 deletions
diff --git a/firmware/include/librfid/rfid.h b/firmware/include/librfid/rfid.h deleted file mode 100644 index 308f46e..0000000 --- a/firmware/include/librfid/rfid.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _RFID_H -#define _RFID_H - -#include <os/dbgu.h> - -#define rfid_hexdump hexdump - -enum rfid_frametype { - RFID_14443A_FRAME_REGULAR, - RFID_14443B_FRAME_REGULAR, - RFID_MIFARE_FRAME, -}; - -struct rfid_asic_handle { -}; - -struct rfid_asic { -}; - -#define RAH NULL - -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - -#endif diff --git a/firmware/include/librfid/rfid_layer2.h b/firmware/include/librfid/rfid_layer2.h deleted file mode 100644 index 3dd54a2..0000000 --- a/firmware/include/librfid/rfid_layer2.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _RFID_LAYER2_H -#define _RFID_LAYER2_H - -#include <sys/types.h> -#include <librfid/rfid.h> - -struct rfid_layer2_handle; -struct rfid_reader_handle; - -enum rfid_layer2_id { - RFID_LAYER2_NONE, - RFID_LAYER2_ISO14443A, - RFID_LAYER2_ISO14443B, - RFID_LAYER2_ISO15693, -}; - -struct rfid_layer2_handle *rfid_layer2_init(struct rfid_reader_handle *rh, - unsigned int id); -int rfid_layer2_open(struct rfid_layer2_handle *l2h); -int rfid_layer2_transceive(struct rfid_layer2_handle *l2h, - 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); -int rfid_layer2_close(struct rfid_layer2_handle *l2h); -int rfid_layer2_fini(struct rfid_layer2_handle *l2h); -int rfid_layer2_getopt(struct rfid_layer2_handle *ph, int optname, - void *optval, unsigned int *optlen); -int rfid_layer2_setopt(struct rfid_layer2_handle *ph, int optname, - const void *optval, unsigned int optlen); - -#ifdef __LIBRFID__ - -#include <librfid/rfid_layer2_iso14443a.h> -#include <librfid/rfid_layer2_iso14443b.h> -#include <librfid/rfid_layer2_iso15693.h> - -struct rfid_layer2 { - unsigned int id; - char *name; - - struct { - struct rfid_layer2_handle *(*init)(struct rfid_reader_handle *h); - int (*open)(struct rfid_layer2_handle *h); - int (*transceive)(struct rfid_layer2_handle *h, - 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); - int (*close)(struct rfid_layer2_handle *h); - int (*fini)(struct rfid_layer2_handle *h); - int (*getopt)(struct rfid_layer2_handle *h, - int optname, void *optval, unsigned int *optlen); - int (*setopt)(struct rfid_layer2_handle *h, - int optname, const void *optval, - unsigned int optlen); - } fn; - struct rfid_layer2 *next; -}; - -struct rfid_layer2_handle { - struct rfid_reader_handle *rh; - unsigned char uid[10]; /* triple size 14443a id is 10 bytes */ - unsigned int uid_len; - union { - struct iso14443a_handle iso14443a; - struct iso14443b_handle iso14443b; - struct iso15693_handle iso15693; - } priv; - struct rfid_layer2 *l2; -}; - -#endif /* __LIBRFID__ */ - -#endif diff --git a/firmware/include/librfid/rfid_layer2_iso14443a.h b/firmware/include/librfid/rfid_layer2_iso14443a.h deleted file mode 100644 index e1ecd36..0000000 --- a/firmware/include/librfid/rfid_layer2_iso14443a.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef _RFID_ISO14443A_H -#define _RFID_ISO14443A_H - - -enum rfid_14443a_opt { - RFID_OPT_14443A_SPEED_RX = 0x00000001, - RFID_OPT_14443A_SPEED_TX = 0x00000002, -}; - -enum rfid_14443_opt_speed { - RFID_14443A_SPEED_106K = 0x01, - RFID_14443A_SPEED_212K = 0x02, - RFID_14443A_SPEED_424K = 0x04, - RFID_14443A_SPEED_848K = 0x08, -}; - -#include <sys/types.h> - -/* protocol definitions */ - -/* ISO 14443-3, Chapter 6.3.1 */ -enum iso14443a_sf_cmd { - ISO14443A_SF_CMD_REQA = 0x26, - ISO14443A_SF_CMD_WUPA = 0x52, - ISO14443A_SF_CMD_OPT_TIMESLOT = 0x35, /* Annex C */ - /* 40 to 4f and 78 to 7f: proprietary */ -}; - -struct iso14443a_atqa { - u_int8_t bf_anticol:5, - rfu1:1, - uid_size:2; - u_int8_t proprietary:4, - rfu2:4; -} __attribute__ ((packed)); - -#define ISO14443A_HLTA 0x5000 - -/* ISO 14443-3, Chapter 6.3.2 */ -struct iso14443a_anticol_cmd { - unsigned char sel_code; - unsigned char nvb; - unsigned char uid_bits[5]; -} __attribute__ ((packed)); - -enum iso14443a_anticol_sel_code { - ISO14443A_AC_SEL_CODE_CL1 = 0x93, - ISO14443A_AC_SEL_CODE_CL2 = 0x95, - ISO14443A_AC_SEL_CODE_CL3 = 0x97, -}; - -#define ISO14443A_BITOFCOL_NONE 0xffffffff - -struct iso14443a_handle { - unsigned int state; - unsigned int level; - unsigned int tcl_capable; -}; - -enum iso14443a_level { - ISO14443A_LEVEL_NONE, - ISO14443A_LEVEL_CL1, - ISO14443A_LEVEL_CL2, - ISO14443A_LEVEL_CL3, -}; - -enum iso14443a_state { - ISO14443A_STATE_ERROR, - ISO14443A_STATE_NONE, - ISO14443A_STATE_REQA_SENT, - ISO14443A_STATE_ATQA_RCVD, - ISO14443A_STATE_NO_BITFRAME_ANTICOL, - ISO14443A_STATE_ANTICOL_RUNNING, - ISO14443A_STATE_SELECTED, -}; - -/* Section 6.1.2 values in usec, rounded up to next usec */ -#define ISO14443A_FDT_ANTICOL_LAST1 92 /* 1236 / fc = 91.15 usec */ -#define ISO14443A_FDT_ANTICOL_LAST0 87 /* 1172 / fc = 86.43 usec */ - -#define ISO14443_CARRIER_FREQ 13560000 -#define ISO14443A_FDT_OTHER_LAST1(n) (((n*128+84)*1000000)/ISO14443_CARRIER_FREQ) - -#include <librfid/rfid_layer2.h> -struct rfid_layer2 rfid_layer2_iso14443a; - -#endif /* _ISO14443A_H */ diff --git a/firmware/include/librfid/rfid_layer2_iso14443b.h b/firmware/include/librfid/rfid_layer2_iso14443b.h deleted file mode 100644 index 037c117..0000000 --- a/firmware/include/librfid/rfid_layer2_iso14443b.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef _RFID_LAYER2_ISO14443B_H -#define _RFID_LAYER2_ISO14443B_H - -#ifdef __LIBRFID__ - -struct iso14443b_atqb { - unsigned char fifty; - unsigned char pupi[4]; - unsigned char app_data[4]; - struct { - unsigned char bit_rate_capability; - unsigned char protocol_type:4, - max_frame_size:4; - unsigned char fo:2, - adc:2, - fwi:4; - } protocol_info; -} __attribute__((packed)); - -struct iso14443b_attrib_hdr { - unsigned char one_d; - unsigned char identifier[4]; - struct { - unsigned char rfu:2, - sof:1, - eof:1, - min_tr1:2, - min_tr0:2; - } param1; - struct { - unsigned char fsdi:4, - spd_out:2, - spd_in:2; - } param2; - struct { - unsigned char protocol_type:4, - rfu:4; - } param3; - struct { - unsigned char cid:4, - rfu:4; - } param4; -} __attribute__((packed)); - -struct iso14443b_handle { - unsigned int tcl_capable; /* do we support T=CL */ - - unsigned int cid; /* Card ID */ - - unsigned int fsc; /* max. frame size card */ - unsigned int fsd; /* max. frame size reader */ - - unsigned int fwt; /* frame waiting time (in usec) */ - - unsigned int mbl; /* maximum buffer length */ - - unsigned int tr0; /* pcd-eof to picc-subcarrier-on */ - unsigned int tr1; /* picc-subcarrier-on to picc-sof */ - - unsigned int flags; - unsigned int state; -}; - -enum { - ISO14443B_CID_SUPPORTED = 0x01, - ISO14443B_NAD_SUPPORTED = 0x02, -}; - -enum { - ISO14443B_STATE_ERROR, - ISO14443B_STATE_NONE, - ISO14443B_STATE_REQB_SENT, - ISO14443B_STATE_ATQB_RCVD, - ISO14443B_STATE_ATTRIB_SENT, - ISO14443B_STATE_SELECTED, - ISO14443B_STATE_HLTB_SENT, - ISO14443B_STATE_HALTED, -}; - -#include <librfid/rfid_layer2.h> -struct rfid_layer2 rfid_layer2_iso14443b; - -#endif /* __LIBRFID__ */ - -#endif diff --git a/firmware/include/librfid/rfid_layer2_iso15693.h b/firmware/include/librfid/rfid_layer2_iso15693.h deleted file mode 100644 index d91b4ec..0000000 --- a/firmware/include/librfid/rfid_layer2_iso15693.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _RFID_ISO15693_H -#define _RFID_ISO15693_H - -#include <sys/types.h> - -/* -07h = TagIt -04h = I.CODE -05h = Infineon -02h = ST -*/ - -/* protocol definitions */ - -struct iso15693_handle; - -struct iso15693_transport { - unsigned char *name; - - struct { - int (*init)(struct iso15693_handle *handle); - int (*fini)(struct iso15693_handle *handle); - -#if 0 - int (*transceive_sf)(struct iso14443a_handle *handle, - unsigned char cmd, - struct iso14443a_atqa *atqa); - int (*transceive_acf)(struct iso14443a_handle *handle, - struct iso14443a_anticol_cmd *acf, - unsigned int *bit_of_col); -#endif - int (*transceive)(struct iso15693_handle *handle, - const unsigned char *tx_buf, - unsigned int tx_len, - unsigned char *rx_buf, - unsigned int *rx_len); - } fn; - - union { - } priv; -}; - -struct iso15693_handle { - unsigned int state; -}; - -enum iso15693_state { - ISO15693_STATE_ERROR, - ISO15693_STATE_NONE, -}; - -#include <librfid/rfid_layer2.h> -extern struct rfid_layer2 rfid_layer2_iso15693; - -#endif /* _ISO15693_H */ diff --git a/firmware/include/librfid/rfid_protocol_mifare_classic.h b/firmware/include/librfid/rfid_protocol_mifare_classic.h deleted file mode 100644 index e6b2400..0000000 --- a/firmware/include/librfid/rfid_protocol_mifare_classic.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _MIFARE_CLASSIC_H - -#define MIFARE_CL_KEYA_DEFAULT "\xa0\xa1\xa2\xa3\xa4\xa5" -#define MIFARE_CL_KEYB_DEFAULT "\xb0\xb1\xb2\xb3\xb4\xb5" - -#define MIFARE_CL_KEYA_DEFAULT_INFINEON "\xff\xff\xff\xff\xff\xff" -#define MIFARE_CL_KEYB_DEFAULT_INFINEON MIFARE_CL_KEYA_DEFAULT_INFINEON - -#define MIFARE_CL_PAGE_MAX 0xff - -#define RFID_CMD_MIFARE_AUTH1A 0x60 -#define RFID_CMD_MIFARE_AUTH1B 0x61 - -#ifdef __LIBRFID__ - -extern struct rfid_protocol rfid_protocol_mfcl; - - -#define MIFARE_CL_CMD_WRITE16 0xA0 -#define MIFARE_CL_CMD_READ 0x30 - -#define MIFARE_CL_RESP_ACK 0x0a -#define MIFARE_CL_RESP_NAK 0x00 - - -#endif /* __LIBRFID__ */ - -#endif /* _MIFARE_CLASSIC_H */ diff --git a/firmware/include/openpcd.h b/firmware/include/openpcd.h index b59a245..8c8b956 100644 --- a/firmware/include/openpcd.h +++ b/firmware/include/openpcd.h @@ -32,6 +32,7 @@ enum openpcd_cmd_class { OPENPCD_CMD_CLS_SSC = 0x3, OPENPCD_CMD_CLS_PWM = 0x4, OPENPCD_CMD_CLS_ADC = 0x5, + OPENPCD_CMD_CLS_LIBRFID = 0x6, /* PICC (transponder) side */ OPENPCD_CMD_CLS_PICC = 0xe, @@ -81,6 +82,9 @@ enum openpcd_cmd_class { /* CMD_CLS_ADC */ #define OPENPCD_CMD_ADC_READ (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_ADC)) +/* CMD_CLS_LIBRFID */ +#define OPENPCD_CMD_LRFID_DETECT_IRQ (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_LIBRFID)) + /* CMD_CLS_USBTEST */ #define OPENPCD_CMD_USBTEST_IN (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_USBTEST)) #define OPENPCD_CMD_USBTEST_OUT (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_USBTEST)) diff --git a/firmware/include/openpicc_regs.h b/firmware/include/openpicc_regs.h index 2df0618..659a82c 100644 --- a/firmware/include/openpicc_regs.h +++ b/firmware/include/openpicc_regs.h @@ -27,6 +27,7 @@ enum opicc_reg { OPICC_REG_14443A_FDT0, /* Frame delay time if last bit 0 */ OPICC_REG_14443A_FDT1, /* Frame delay time if last bit 1 */ OPICC_REG_14443A_STATE, /* see 'enum opicc_14443a_state' */ + OPICC_REG_14443A_ATQA, /* The ATQA template for 14443A */ OPICC_REG_RX_CLK_DIV, /* Clock divider for Rx sample clock */ OPICC_REG_RX_CLK_PHASE, /* Phase shift of Rx sample clock */ |