FreeCalypso > hg > fc-usbser-tools
diff cp2102/cp210x_defs.h @ 50:a5c4a82d01ab
cp2102-read-partno program written, compiles
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 11 Sep 2023 17:41:24 +0000 |
parents | |
children | d4d3531d342a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cp2102/cp210x_defs.h Mon Sep 11 17:41:24 2023 +0000 @@ -0,0 +1,35 @@ +/* + * Definitions for talking to CP2102 and perhaps other CP210x chips, + * taken from Python-based cp210x-program-1.0 tool from 2014, + * translated from Python to C. + */ + +#define CP210x_CONFIG 0xFF + +#define REG_VENDOR_ID 0x3701 +#define REG_PRODUCT_ID 0x3702 +#define REG_PRODUCT_STRING 0x3703 +#define REG_SERIAL_NUMBER 0x3704 +#define REG_CFG_ATTRIBUTES 0x3705 +#define REG_MAX_POWER 0x3706 +#define REG_VERSION 0x3707 +#define REG_UNKNOWN 0x3708 +#define REG_EEPROM 0x3709 +#define REG_LOCK_VALUE 0x370A +#define REG_PART_NUMBER 0x370B + +#define SIZE_EEPROM 0x0400 +#define SIZE_PRODUCT_STRING 255 +#define SIZE_SERIAL_NUMBER 128 +#define SIZE_BAUDRATES 32 +#define SIZE_BAUDRATE_CFG 10 +#define SIZE_BAUDRATE_TABLE (SIZE_BAUDRATES * SIZE_BAUDRATE_CFG) +#define SIZE_VENDOR_STRING 50 + +/* a little bit adapted from libftdi */ + +#define DEVICE_OUT_REQTYPE (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT) +#define DEVICE_IN_REQTYPE (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN) + +#define USB_READ_TIMEOUT 5000 +#define USB_WRITE_TIMEOUT 5000