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

📄 usbh_hcds_common.h

📁 epson usb2.0 控制芯片 S1R72V05 固件程序。
💻 H
字号:
/*
 *	description: USBH HCD Common Definition
 *	Maker	   : Hiromichi Kondo
 *	Copyright  : (C)2005,SEIKO EPSON Corp. All Rights Reserved.
 */


#ifndef USBH_HCD_COMMON_H
#define USBH_HCD_COMMON_H

#include <SPRDEF.h>
#include <stddef.h>			/* offsetof */

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



/*****************************************
 * Define definition
 *****************************************/

/*****************************************
* Structure definition
 *****************************************/
typedef struct tagHCD_MANAGER{
	USBH_HCD_CALLBACK pfnInitCallback;
	USBH_HCD_CALLBACK pfnSuspendCallback;
	USBH_HCD_CALLBACK pfnResumeCallback;
	USBH_HCD_CALLBACK pfnDetDevConnectCallback;
	CALLBACK_PROC pfnSavedPortCallback;
	USBH_HCD_USBDEV *psRootDev;
	struct{
		unsigned short hcSuspend:1;
		unsigned short reserved:15;
	}bmFlags;
	unsigned char suspendLevel;
}HCD_MANAGER;

/*****************************************
 * Macro function
 *****************************************/
#define USBH_HCDS_ListEntry(ptr, type, member ) ((type *)(((unsigned long)ptr - offsetof(type, member))))

#define USBH_HCDS_CheckPipeIN(pipe)			((pipe) & USBH_HCD_DIR_IN )
#define USBH_HCDS_CheckPipeOUT(pipe)		(!(USBH_HCDS_CheckPipeIN(pipe)))
#define USBH_HCDS_GetPipeEndpoint(pipe)		((unsigned char)(((pipe) >> 15) & 0x0F))
#define USBH_HCDS_GetPipeEndpointAdrs(pipe)	((unsigned char)(((pipe) >> 15) & 0x8F))
#define USBH_HCDS_GetPipeUSBDevAdrs(pipe)	((unsigned char)(((pipe) >> 8) & 0x7F))
#define USBH_HCDS_GetPipeType(pipe)			((unsigned char)(((pipe) >> 30) & 0x03))
#define USBH_HCDS_GetPipeMaxPacketSize(dev, pipe, pktsize)	\
	if( USBH_HCDS_CheckPipeIN(pipe) == 0 ){ \
		pktsize = (dev)->epMaxPacketOut[USBH_HCDS_GetPipeEndpoint(pipe)]; \
	} else { \
		pktsize = (dev)->epMaxPacketIn[USBH_HCDS_GetPipeEndpoint(pipe)]; \
	}
#define USBH_HCDS_GetToggle(dev, ep, out) \
	if( ep & USBH_HCD_DIR_IN ){ \
		out = (((dev)->toggle[0] >> ((ep) & ~USBH_HCD_DIR_IN)) & 0x01); \
	} else { \
		out = (((dev)->toggle[1] >> (ep)) & 0x01); \
	}

#define USBH_HCDS_SetINToggle(dev, ep, in) \
		((dev)->toggle[0] = ((dev)->toggle[0] & ~(1 << (ep))) | ((in) << (ep)));
#define USBH_HCDS_SetOUTToggle(dev, ep, in) \
		((dev)->toggle[1] = ((dev)->toggle[1] & ~(1 << (ep))) | ((in) << (ep)));


/*****************************************
 * Function prototype declaration
 *****************************************/
void USBH_HCDS_InitListHead( USBH_HCD_LIST_HEAD *psListHead );
void USBH_HCDS_ListAdd( USBH_HCD_LIST_HEAD *psNew, USBH_HCD_LIST_HEAD *psListHead );
void USBH_HCDS_ListAddTail( USBH_HCD_LIST_HEAD *psNew, USBH_HCD_LIST_HEAD *psListHead );
void USBH_HCDS_ListDel( USBH_HCD_LIST_HEAD *psDel );
int USBH_HCDS_ListEmpty( USBH_HCD_LIST_HEAD *psListHead );
extern long USBH_HCDS_ExecCallback(CALLBACK_PROC pfnFunc, unsigned long param0, unsigned long param1, void *pParam);

#ifdef __cplusplus
	}
#endif /* cplusplus */

#endif /* USBH_HCD_COMMON_H */

⌨️ 快捷键说明

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