⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbh_usbd_api.h

📁 epson usb2.0 控制芯片 S1R72V05 固件程序。
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 *	description: USBH USBD APIs Definition(global)
 *	Maker	  : Toshiyuki Sakai
 *	Copyright  : (C)2005,SEIKO EPSON Corp. All Rights Reserved.
 */


#ifndef USBH_USBD_H
#define USBH_USBD_H

#ifdef __cplusplus
	extern "C" {
#endif /* cplusplus */

#include "SPRDEF.h"
#include "usb_descinfo.h"


/* Return value of API */
#define USBH_USBD_STATUS_SUCCESS				USBH_HCD_STATUS_SUCCESS
#define USBH_USBD_STATUS_NO_DEVICE				USBH_HCD_STATUS_NO_DEVICE
#define USBH_USBD_STATUS_UNSUCCESSFUL			USBH_HCD_STATUS_UNSUCCESSFUL
#define USBH_USBD_STATUS_INVALID_PARAMETER		USBH_HCD_STATUS_INVALID_PARAMETER
#define USBH_USBD_STATUS_MEM_ERROR				USBH_HCD_STATUS_MEM_ERROR
#define USBH_USBD_STATUS_PIPE_ERROR				USBH_HCD_STATUS_PIPE_ERROR

/* Message to notify other modules */
#define USBH_USBD_MSG_INIT_CMP					(1)
#define USBH_USBD_MSG_ENTRYC_OK					(2)
#define USBH_USBD_MSG_ENTRYC_NG					(3)
#define USBH_USBD_MSG_SETCON_OK					(4)
#define USBH_USBD_MSG_SETCON_NG					(5)
#define USBH_USBD_MSG_SUBMIT_OK					(6)
#define USBH_USBD_MSG_SUBMIT_NG					(7)
#define USBH_USBD_MSG_UNLINK_OK					(8)
#define USBH_USBD_MSG_UNLINK_NG					(9)
#define USBH_USBD_MSG_RESET_CMP					(10)
#define USBH_USBD_MSG_PORTSUSPEND_CMP			(11)
#define USBH_USBD_MSG_PORTRESUME_CMP			(12)
#define USBH_USBD_MSG_CONNECT_OK				(13)
#define USBH_USBD_MSG_DISCONNECT_CMP			(15)
#define USBH_USBD_MSG_VBUSERR_CMP				(16)
#define USBH_USBD_MSG_VBUSERRRECOVERY_CMP		(18)
#define USBH_USBD_MSG_RETURN_VALUE				(19)

/* wPortStatus */
#define	PORT_CONNECTION							(0x0001)
#define	PORT_ENABLE								(0x0002)
#define	PORT_SUSPEND							(0x0004)
#define	PORT_OVER_CURRENT						(0x0008)
#define	PORT_RESET								(0x0010)
#define	PORT_POWER								(0x0100)
#define	PORT_LOW_SPEED							(0x0200)
#define	PORT_HIGH_SPEED							(0x0400)
#define	PORT_TEST								(0x0800)
#define	PORT_INDICATOR							(0x1000)

/* wPortChange */
#define	C_PORT_CONNECTION						(0x0001)
#define	C_PORT_ENABLE							(0x0002)
#define	C_PORT_SUSPEND							(0x0004)
#define	C_PORT_OVER_CURRENT						(0x0008)
#define	C_PORT_RESET							(0x0010)

/* Max number in related devices */
#define USBH_USBD_DEVICE_MAX					(16)		/* (0-15)USB Address Max Value( Depend on kinds of machine )			 */
															/* Max connect number of USB devices: 16 ( including root hub )			 */
#define	USBH_USBD_URB_MAX						(27)		/* Max number of URB: 24 + 3 ( 3 * max registration number of class driver + interrupt of hub for URB )	 */
#define	USBH_USBD_IF_CTBL_MAX					(32)		/* Max registration number of interface descriptor: 32 ( 2 * max connect number of USB devices )		 */
#define	USBH_USBD_EP_CTBL_MAX					(64)		/* Max registration number of endpoint descriptor: 64 ( 2 * max registration number of interface descriptor	 */
#define	USBH_USBD_CLASSDRIVERNUM				(8)			/* Max registration number of class driver: 8 ( 7 + margin 1 )			 */

/* USBH_HCD_SubmitURB() */
#define USBH_USBD_PIPE_ISOCHRONOUS				(0)
#define USBH_USBD_PIPE_INTERRUPT				(1)
#define USBH_USBD_PIPE_CONTROL					(2)
#define USBH_USBD_PIPE_BULK						(3)
#define USBH_USBD_DIR_IN						(0x80)
#define USBH_USBD_DIR_OUT						(0x00)
#define USBH_USBD_URB_SHORT_NOT_OK				(0x0001)
#define USBH_USBD_URB_ASYNC_UNLINK				(0x0010)
#define USBH_USBD_URB_ZERO_PACKET				(0x0040)
#define USBH_USBD_URB_REQ_DMA					(0x8000)
#define USBH_USBD_URB_STRG_MODE					(0x4000)
#define USBH_USBD_URB_DIRECT_COPY				(0x2000)
#define USBH_USBD_URBSTS_SUCCESS				(0)			/* URB finish normally */
#define USBH_USBD_URBSTS_OVERFLOW				(1)			/* Overflow */
#define USBH_USBD_URBSTS_REMOTEIO				(2)			/* Case of USB_SHORT_NOT_OK is specified in transmission flag */
															/* Receive data shorter than length of transfer buffer */
#define USBH_USBD_URBSTS_PIPE					(3)			/* Error on pipe(STALL, Complete-split miss) */
#define USBH_USBD_URBSTS_INPROGRESS				(4)			/* URB in progress */
#define USBH_USBD_URBSTS_PROTO					(5)			/* Protocol error ( CRC error, timeout etc. ) */
#define USBH_USBD_URBSTS_CONNRESET				(6)			/* URB is canceled by executing USBH_USBD_SubmitURB() */
#define USBH_USBD_URBSTS_NOENT					(7)			/* URB is canceled by executing USBH_USBD_UnlinkURB() */

#define MASK_EP_NUMBER							(0x7F)
#define	FUNC_ADDR_MIN							(0)
#define	FUNC_ADDR_MAX							(15)
#define	EP_NUMBER_MIN							(0)
#define	EP_NUMBER_MAX							(15)
#define	ROOTHUB_ADDR							(FUNC_ADDR_MAX+1)
#define	DEVICE_START_ADDR						(FUNC_ADDR_MIN+1)

#define	USBH_USBD_DEVTYPE						(0x01)		/* Device descriptor type						 */
#define	USBH_USBD_CFGTYPE						(0x02)		/* Configuration descriptor type					 */
#define	USBH_USBD_STGTYPE						(0x03)		/* String descriptor type						 */
#define	USBH_USBD_ENPTYPE						(0x05)		/* Endpoint descriptor type						 */
#define	USBH_USBD_DQFTYPE						(0x06)		/* Device_qualifier descriptor type				 */
#define	USBH_USBD_OSCTYPE						(0x07)		/* Other_speed_configuration descriptor type		 */

#define	USBH_USBD_MAXPACKETSIZE			(64)
#define	USBH_USBD_DTYPE_PORT			(0x80)
#define	USBH_USBD_DTYPE_HUB				(0x81)
/* SetFeature */
#define	USBH_USBD_PORT_SUSPEND			(0x02)
#define	USBH_USBD_PORT_RESET			(0x04)
#define	USBH_USBD_PORT_POWER			(0x08)
#define	USBH_USBD_PORT_TEST				(0x15)
#define	USBH_USBD_PORT_INDICATOR		(0x16)
/* ClearFeature */
#define	USBH_USBD_CLRF_PORT_ENABLE			(0x01)
#define	USBH_USBD_CLRF_C_PORT_CONNECTION	(0x10)
#define	USBH_USBD_CLRF_C_PORT_RESET			(0x14)
#define	USBH_USBD_CLRF_C_PORT_ENABLE		(0x11)
#define	USBH_USBD_CLRF_C_PORT_SUSPEND		(0x12)
#define	USBH_USBD_CLRF_C_PORT_OVER_CURRENT	(0x13)
/* ClearFeature(HUB) */
#define	USBH_USBD_C_HUB_LOCAL_POWER		(0x00)
#define	USBH_USBD_C_HUB_OVER_CURRENT	(0x01)
/* GetDescriptor: DescriptorType */
#define	USBH_USBD_DTYPE_DEVICE			(0x01)
#define	USBH_USBD_DTYPE_CONFIG			(0x02)
#define	USBH_USBD_DTYPE_STRING			(0x03)
#define	USBH_USBD_DTYPE_INTERF			(0x04)
#define	USBH_USBD_DTYPE_ENDPOT			(0x05)
#define	USBH_USBD_DTYPE_QUALIF			(0x06)
#define	USBH_USBD_DTYPE_OTRSPD			(0x07)
#define	USBH_USBD_DTYPE_HUBVAL			(0x29)

/* Device Class Code */
#define USBH_HSBD_HUB_CLASS_CODE		(0x09)		/* Hub Class Code */
#define USBH_HSBD_HUB_CLASS_ID			(0x8B)

						/* bmRequestType: D7										*/
						/* 			   0: from host to device, 1: from device to host */
						/* 			 : D6...5 kind								*/
						/* 			   0=Standard								*/
						/* 			   1=class									*/
						/* 			   2=Vendor									*/
						/* 			   3=reserve									*/
						/* 			 : D4...receiving destination				*/
						/* 			   0=device									*/
						/* 			   1=interface								*/
						/* 			   2=endpoint								*/
						/* 			   3=other									*/
						/* 			   4=reserve									*/
//	UCHAR	bmRequestType;
										/* --<Standard request>--------------------*/
#define	REQTYPE_GET_STATUES		0x80	/* Get Status request					*/
#define	REQTYPE_CLR_FEATURE		0x00	/* Clear Feature request					*/
#define	REQTYPE_SET_FEATURE		0x00	/* Set Feature request					*/
#define	REQTYPE_SET_ADDRESS		0x00	/* Set Address request					*/
#define	REQTYPE_GET_DESCRIP		0x80	/* Get Descriptor request				*/
#define	REQTYPE_SET_DESCRIP		0x00	/* Set Descriptor request is not supported*/
#define	REQTYPE_GET_CONFIGU		0x80	/* Get Configuration request				*/
#define	REQTYPE_SET_CONFIGU		0x00	/* Set Configuration request				*/
#define	REQTYPE_GET_INTERFA		0x81	/* Get Interface request					*/
#define	REQTYPE_SET_INTERFA		0x01	/* Set Interface request					*/
#define	REQTYPE_SYNCH_FRAME		0x00	/* Synch Frame request					*/
										/* -<Class definition request>-----------*/
#define	REQTYPE_GET_ST__HUB		0xA0	/* Get Status(Hub) request				*/
#define	REQTYPE_GET_ST_PORT		0xA3	/* Get Status(Port) request				*/
#define	REQTYPE_CLR_ST__HUB		0x20	/* Clear Feature(Hub) request			*/
#define	REQTYPE_CLR_ST_PORT		0x23	/* Clear Feature(Port) request			*/
#define	REQTYPE_SET_FT__HUB		0x20	/* Set Feature(Hub) request				*/
#define	REQTYPE_SET_FT_PORT		0x23	/* Set Feature(Port) request				*/
#define	REQTYPE_GET_DC__HUB		0xA0	/* Get Descriptor(Hub) request			*/
#define	REQTYPE_CLR_TT_BUFF		0x23	/* Clear TT Buffer request				*/
#define	REQTYPE_RST______TT		0x23	/* Reset TT request						*/
#define	REQTYPE_GET_TT_STAT		0xA3	/* Get TT State request					*/
#define	REQTYPE_STP______TT		0x23	/* Stop TT request						*/
#define	REQTYPE_BO_MASS_RST		0x21	/* BulkOnly Mass Storage Reset request	*/
#define	REQTYPE_GET_MAX_LUN		0xA1	/* Get Max LUN request					*/

//	UCHAR	bRequest;
										/* -<Standard request>-------------------*/
#define	BMREQ_GET_STATUES		0x00	/* Get Status request					*/
#define	BMREQ_CLR_FEATURE		0x01	/* Clear Feature request					*/
#define	BMREQ_SET_FEATURE		0x03	/* Set Feature request					*/
#define	BMREQ_SET_ADDRESS		0x05	/* Set Address request					*/
#define	BMREQ_GET_DESCRIP		0x06	/* Get Descriptor request				*/
#define	BMREQ_SET_DESCRIP		0x07	/* Set Descriptor request is not supported*/
#define	BMREQ_GET_CONFIGU		0x08	/* Get Configuration request				*/
#define	BMREQ_SET_CONFIGU		0x09	/* Set Configuration request				*/
#define	BMREQ_GET_INTERFA		0x0A	/* Get Interface request					*/
#define	BMREQ_SET_INTERFA		0x0B	/* Set Interface request					*/
#define	BMREQ_SYNCH_FRAME		0x0C	/* Synch Frame request					*/
										/* --<Class definition request>-----------*/
#define	BMREQ_GET_ST__HUB		0x00	/* Get Status(Hub) request				*/
#define	BMREQ_GET_ST_PORT		0x00	/* Get Status(Port) request				*/
#define	BMREQ_CLR_ST__HUB		0x01	/* Clear Feature(Hub) request			*/
#define	BMREQ_CLR_ST_PORT		0x01	/* Clear Feature(Port) request			*/
#define	BMREQ_SET_FT__HUB		0x03	/* Set Feature(Hub) request				*/
#define	BMREQ_SET_FT_PORT		0x03	/* Set Feature(Port) request				*/
#define	BMREQ_GET_DC__HUB		0x06	/* Get Descriptor(Hub) request			*/
#define	BMREQ_CLR_TT_BUFF		0x08	/* Clear TT Buffer request				*/
#define	BMREQ_RST______TT		0x09	/* Reset TT request						*/
#define	BMREQ_GET_TT_STAT		0x0A	/* Get TT State request					*/
#define	BMREQ_STP______TT		0x0B	/* Stop TT request						*/
#define	BMREQ_BO_MASS_RST		0xFF	/* BulkOnly Mass Storage Reset request	*/
#define	BMREQ_GET_MAX_LUN		0xFE	/* Get Max LUN request					*/


//	UCHAR	wIndexL;
										/* --<Class definition request>-----------*/
#define	WINDEXL_CLR_TT_BUFF		0x01	/* Clear TT Buffer request				*/
#define	WINDEXL_RST______TT		0x01	/* Reset TT request						*/
#define	WINDEXL_STP______TT		0x01	/* Stop TT request						*/


//	UCHAR	wLengthL;
										/* --<Standard request>-------------------*/
#define	WLENGL_GET_STATUES		0x04	/* Get Status request					*/
#define	WLENGL_GET_DESCRIP		0x40	/* Get Descriptor request				*/
#define	WLENGL_GET_CONFIGU		0x01	/* Get Configuration request				*/
#define	WLENGL_GET_INTERFA		0x01	/* Get Interface request					*/
										/* -<Class definition request>-----------*/
#define	WLENGL_GET_ST__HUB		0x04	/* Get Status(Hub) request				*/
#define	WLENGL_GET_ST_PORT		0x04	/* Get Status(Port) request				*/
#define	WLENGL_GET_DC__HUB		0x09	/* Get Descriptor(Hub) request			*/
#define	WLENGL_GET_MAX_LUN		0x01	/* Get Max LUN request					*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -