view cp2102/cp210x_defs.h @ 53:d4d3531d342a

cp2102-read-eeprom program written, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 11 Sep 2023 18:49:07 +0000
parents a5c4a82d01ab
children
line wrap: on
line source

/*
 * 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

#define	EEPROM_START_ADDR	0x3600

/* 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