view cp2102/cp210x_defs.h @ 106:de3b299561b3

udev: add rules file that works on my system
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 05 Oct 2023 01:08:28 +0000
parents d4d3531d342a
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