diff options
author | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2006-09-22 20:56:54 +0000 |
---|---|---|
committer | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2006-09-22 20:56:54 +0000 |
commit | 341afde582ea832a5573b4df2e584a1ddae2efb9 (patch) | |
tree | 83be5ea57822b463b77ca225a3a7a54c1c7d6f14 /include | |
parent | 19bdabf2438557c6d9164f30f5fa5c8a914c83e1 (diff) |
update to new (four-byte, explicit response_request flag) revision of openpcd usb protocol
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1884 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'include')
-rw-r--r-- | include/librfid/rfid_reader_openpcd.h | 85 |
1 files changed, 70 insertions, 15 deletions
diff --git a/include/librfid/rfid_reader_openpcd.h b/include/librfid/rfid_reader_openpcd.h index 3f8a071..e345132 100644 --- a/include/librfid/rfid_reader_openpcd.h +++ b/include/librfid/rfid_reader_openpcd.h @@ -6,30 +6,85 @@ #include <sys/types.h> struct openpcd_hdr { - u_int8_t cmd; /* command */ + u_int8_t cmd; /* command. high nibble: class, + * low nibble: cmd */ u_int8_t flags; u_int8_t reg; /* register */ u_int8_t val; /* value (in case of write *) */ - u_int16_t len; - u_int16_t res; u_int8_t data[0]; -} __attribute__((packed)); +} __attribute__ ((packed)); -#define OPENPCD_REG_MAX 0x3f +#define OPCD_REV_LEN 16 +struct openpcd_compile_version { + char svnrev[OPCD_REV_LEN]; + char by[OPCD_REV_LEN]; + char date[OPCD_REV_LEN]; +} __attribute__ ((packed)); -#define OPENPCD_CMD_WRITE_REG 0x01 -#define OPENPCD_CMD_WRITE_FIFO 0x02 -#define OPENPCD_CMD_WRITE_VFIFO 0x03 -#define OPENPCD_CMD_REG_BITS_CLEAR 0x04 -#define OPENPCD_CMD_REG_BITS_SET 0x05 +#define OPENPCD_FLAG_RESPOND 0x01 /* Response requested */ +#define OPENPCD_FLAG_ERROR 0x80 /* An error occurred */ -#define OPENPCD_CMD_READ_REG 0x11 -#define OPENPCD_CMD_READ_FIFO 0x12 -#define OPENPCD_CMD_READ_VFIFO 0x13 +enum openpcd_cmd_class { + OPENPCD_CMD_CLS_GENERIC = 0x0, + /* PCD (reader) side */ + OPENPCD_CMD_CLS_RC632 = 0x1, + //OPENPCD_CMD_CLS_LED = 0x2, + OPENPCD_CMD_CLS_SSC = 0x3, + OPENPCD_CMD_CLS_PWM = 0x4, + OPENPCD_CMD_CLS_ADC = 0x5, + /* PICC (transponder) side */ + OPENPCD_CMD_CLS_PICC = 0xe, -#define OPENPCD_CMD_SET_LED 0x21 + OPENPCD_CMD_CLS_USBTEST = 0xf, +}; + +#define OPENPCD_REG_MAX 0x3f + +#define OPENPCD_CMD_CLS(x) (x >> 4) +#define OPENPCD_CMD(x) (x & 0xf) + +#define OPENPCD_CLS2CMD(x) (x << 4) + +#define OPENPCD_CMD_GET_VERSION (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC)) +#define OPENPCD_CMD_SET_LED (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC)) + +/* CMD_CLS_RC632 */ +#define OPENPCD_CMD_WRITE_REG (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_WRITE_FIFO (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_WRITE_VFIFO (0x3|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_REG_BITS_CLEAR (0x4|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_REG_BITS_SET (0x5|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_READ_REG (0x6|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_READ_FIFO (0x7|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_READ_VFIFO (0x8|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_DUMP_REGS (0x9|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) +#define OPENPCD_CMD_IRQ (0xa|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632)) + +/* CMD_CLS_SSC */ +#define OPENPCD_CMD_SSC_READ (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_SSC)) +#define OPENPCD_CMD_SSC_WRITE (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_SSC)) + +/* CMD_CLS_PWM */ +#define OPENPCD_CMD_PWM_ENABLE (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM)) +#define OPENPCD_CMD_PWM_DUTY_SET (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM)) +#define OPENPCD_CMD_PWM_DUTY_GET (0x3|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM)) +#define OPENPCD_CMD_PWM_FREQ_SET (0x4|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM)) +#define OPENPCD_CMD_PWM_FREQ_GET (0x5|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PWM)) + +/* CMD_CLS_PICC */ +#define OPENPCD_CMD_PICC_REG_WRITE (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PICC)) +#define OPENPCD_CMD_PICC_REG_READ (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_PICC)) + +/* CMD_CLS_ADC */ +#define OPENPCD_CMD_ADC_READ (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_ADC)) + +/* 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)) + +/* FIXME */ +#define OPENPCD_CMD_PIO_IRQ (0x3|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_USBTEST)) -#define OPENPCD_CMD_IRQ 0x40 /* IRQ reported by RC632 */ #define OPENPCD_VENDOR_ID 0x2342 #define OPENPCD_PRODUCT_ID 0x0001 |