📄 lib_host20.h
字号:
#define HOST20_CONFIGURATION_NUM_MAX 0X02
#define HOST20_INTERFACE_NUM_MAX 0X05
#define HOST20_ENDPOINT_NUM_MAX 0X05
#define HOST20_CLASS_NUM_MAX 0x01
#define HOST20_CONFIGURATION_LENGTH 0X09
#define HOST20_INTERFACE_LENGTH 0X09
#define HOST20_ENDPOINT_LENGTHX 0X07
#define HOST20_CLASS_LENGTHX 0X09
typedef struct
{
//<3>.Define for ED-OTG
UINT8 bED_OTG_Length;
UINT8 bED_OTG_bDescriptorType;
UINT8 bED_OTG_bAttributes;
}OTGH_Descriptor_OTG_Struct;
typedef struct
{
//<3>.Define for ED-1
UINT8 bED_Length;
UINT8 bED_bDescriptorType;
UINT8 bED_EndpointAddress;
UINT8 bED_bmAttributes;
UINT8 bED_wMaxPacketSizeLowByte;
UINT8 bED_wMaxPacketSizeHighByte;
UINT8 bED_Interval;
}OTGH_Descriptor_EndPoint_Struct;
typedef struct
{
UINT8 bClass_LENGTH;
UINT8 bClaNumberss;
UINT8 bClassVerLowByte;
UINT8 bClassVerHighByte;
UINT8 bCityNumber;
UINT8 bFollowDescriptorNum;
UINT8 bReport;
UINT8 bLengthLowByte;
UINT8 bLengthHighByte;
}OTGH_Descriptor_Class_Struct;
typedef struct
{
//<2>.Define for Interface-1
UINT8 bINTERFACE_LENGTH; // bLength
UINT8 bDT_INTERFACE; // bDescriptorType INTERFACE
UINT8 bInterfaceNumber; // bInterfaceNumber
UINT8 bAlternateSetting; // bAlternateSetting
UINT8 bEP_NUMBER; // bNumEndpoints(excluding endpoint zero)
UINT8 bInterfaceClass; // bInterfaceClass
UINT8 bInterfaceSubClass; // bInterfaceSubClass
UINT8 bInterfaceProtocol; // bInterfaceProtocol
UINT8 bInterface; // iInterface
OTGH_Descriptor_Class_Struct sClass[HOST20_CLASS_NUM_MAX];
OTGH_Descriptor_EndPoint_Struct sED[HOST20_ENDPOINT_NUM_MAX];
}OTGH_Descriptor_Interface_Struct;
typedef struct
{
UINT8 bCONFIG_LENGTH; // bLength
UINT8 bDT_CONFIGURATION; // bDescriptorType CONFIGURATION
UINT8 bTotalLengthLowByte; // wTotalLength, include all descriptors
UINT8 bTotalLengthHighByte;
UINT8 bINTERFACE_NUMBER; // bNumInterface
UINT8 bConfigurationValue; // bConfigurationValue
UINT8 bConfiguration; // iConfiguration
UINT8 bAttribute; // bmAttribute
UINT8 bMaxPower; // iMaxPower (2mA units)
OTGH_Descriptor_Interface_Struct sInterface[HOST20_INTERFACE_NUM_MAX];
}OTGH_Descriptor_Configuration_Only_Struct;
//Support Configuration x2
// Interface x5
// EndPoint x5
// OTG X1
typedef struct
{
//<1>.Basic Information
UINT8 bDeviceOnHub;
UINT8 bOnHubPortNumber;
UINT8 bAdd;
UINT8 bConnectStatus;
UINT8 bPortEnableDisableStatus;
UINT8 bSpeed; //0=>Low Speed / 1=>Full Speed / 2 => High Speed
UINT8 bPortReset;
UINT8 bSuspend;
volatile UINT8 bRemoteWakeUpDetected;
UINT8 bSendOK;
UINT8 bSendStatusError;
qTD_Structure *psSendLastqTD;
UINT8 *bDataBuffer;
//<2>.Descriptor Information
OTGH_Descriptor_Device_Struct sDD;
OTGH_Descriptor_Configuration_Only_Struct saCD[HOST20_CONFIGURATION_NUM_MAX];
OTGH_Descriptor_OTG_Struct sOTG;
UINT8 bReportDescriptor[0x74];
UINT8 bStringLanguage[10];
UINT8 bStringManufacture[0xFF];
UINT8 bStringProduct[0xFF];
UINT8 bStringSerialN[0xFF];
//<3>.For ISO Information
UINT8 bISOTransferEnable;
UINT32 wISOiTDAddress[1024];
}Host20_Attach_Device_Structure;
#define HOST20_Attach_Device_Speed_Full 0x00
#define HOST20_Attach_Device_Speed_Low 0x01
#define HOST20_Attach_Device_Speed_High 0x02
//<3.7>.Control Command Structure
typedef struct {
UINT8 bmRequestType; //(In/Out),(Standard...),(Device/Interface...)
UINT8 bRequest; //GetStatus .....
UINT8 wValueLow; //Byte2
UINT8 wValueHigh; //Byte3
UINT8 wIndexLow; //Byte4
UINT8 wIndexHigh; //Byte5
UINT8 wLengthLow; //Byte6
UINT8 wLengthHigh; //Byte7
} Host20_Control_Command_Structure;
#define HOST20_CONTROL_GetStatus 0x00
#define HOST20_CONTROL_ClearFeature 0x01
#define HOST20_CONTROL_SetFeature 0x03
#define HOST20_CONTROL_SetAddress 0x05
#define HOST20_CONTROL_GetDescriptor 0x06
#define HOST20_CONTROL_SetDescriptor 0x07
#define HOST20_CONTROL_GetConfiguration 0x08
#define HOST20_CONTROL_GetInterface 0x0A
#define HOST20_CONTROL_SetInterface 0x0B
#define HOST20_CONTROL_SyncFrame 0x0C
#define HOST20_HID_GetReport 0x01
#define HOST20_HID_GetIdle 0x02
#define HOST20_HID_GetProtocol 0x03
#define HOST20_HID_SetReport 0x09
#define HOST20_HID_SetIdle 0x0A
#define HOST20_HID_SetProtocol 0x0B
//<3.8>.BufferPointerArray
typedef struct {
UINT32 BufferPointerArray[8];
} Host20_BufferPointerArray_Structure;
//<3.8>.ISO_FrameBufferMode
typedef struct {
UINT32 wFrameBufferAddress;
UINT32 wFrameBufferAddressOffset;
UINT32 wSize;
UINT32 wReceiveCounter;
UINT32 CurrentiTDNum;
} Host20_ISO_FixBufferMode_Structure;
//=================== 4.Extern Function Definition =======================================================
//========================================================================================================
extern UINT8 flib_OTGH_Init(UINT32 wTimeWaitForConnect_ms,UINT8 wForDevice_B,UINT8 bDeviceA_HNP2);
extern UINT8 flib_Host20_Close(UINT8 bForDeviceB);
extern UINT8 flib_Host20_ISR(void);
extern UINT8 flib_Host20_PortBusReset(void);
extern UINT8 flib_Host20_Suspend(void);
extern UINT8 flib_Host20_Resume(void);
extern void flib_Host20_RemoteWakeUp(void);
extern UINT8 flib_Host20_Waiting_Result(void);
extern UINT8 flib_Host20_Issue_Control (UINT8 bEdNum,UINT8* pbCmd,UINT16 hwDataSize,UINT8* pbData);
extern UINT8 flib_Host20_Issue_Bulk(UINT8 bArrayListNum,UINT16 hwSize,UINT32 *pwBufferArray,UINT32 wOffset,UINT8 bDirection);
extern void flib_Host20_Issue_ISO (UINT8 bCheckResult,UINT32 wEndPt,UINT32 wMaxPacketSize,UINT32 wSize,UINT32 *pwBufferArray,UINT32 wOffset,UINT8 bDirection,UINT8 bMult);
extern void flib_Host20_Issue_Interrupt(UINT8 bArrayListNum,UINT16 hwSize,UINT32 *pwBufferArray,UINT32 wOffset,UINT8 bDirection);
extern UINT8 flib_Host20_Enumerate (UINT8 bNormalEnumerate,UINT8 bAddress);
extern void flib_DumpDeviceDescriptor (OTGH_Descriptor_Device_Struct *sDevice);
extern void flib_PrintDeviceInfo (void);
extern void flib_PrintDeviceInfo_ByInput (Host20_Attach_Device_Structure *psAttachDevice);
extern void flib_Host20_TimerISR(void);
extern void flib_Host20_TimerEnable(UINT32 wTime_ms);
extern void flib_Host20_InitStructure(void);
extern UINT32 flib_Host20_GetStructure(UINT8 Type);
extern void flib_Host20_ReleaseStructure(UINT8 Type,UINT32 pwAddress);
extern void flib_Host20_QHD_Control_Init(void);
extern void flib_Host20_Allocate_QHD(qHD_Structure *psQHTemp,UINT8 bNextType,UINT8 bAddress,UINT8 bHead,UINT8 bEndPt, UINT32 wMaxPacketSize);
extern UINT8 flib_Host20_Send_qTD(qTD_Structure *spHeadqTD ,qHD_Structure *spTempqHD,UINT32 wTimeOutSec);
extern UINT8 flib_Host20_Issue_Control_Turbo (UINT8 bEdNum,UINT8* pbCmd,UINT32 wDataSize,UINT32 *pwPageAddress,UINT32 wCurrentOffset);
extern void flib_Host20_Control_Command_Request(Host20_Control_Command_Structure *pbCMD,UINT8 bmRequestType_Temp,UINT8 bRequest_Temp,UINT16 wValue_Temp,UINT16 wIndex_Temp,UINT16 wLength_Temp);
extern void flib_DumpString (UINT8 *pbTemp,UINT8 bSize);
extern void flib_Host20_Interrupt_Init(UINT32 wForceInterval,UINT8 bS_Mask,UINT8 bMult);
extern void flib_Host20_Asynchronous_Enable(void);
extern void flib_Host20_Asynchronous_Disable(void);
extern UINT8 flib_OTGH_Checking_RemoteWakeUp(void);
extern UINT8 flib_OTGH_RemoteWakeEnable(void);
extern void flib_Host20_StopRun_Setting(UINT8 bOption);
extern void flib_Host20_Asynchronous_Setting(UINT8 bOption);
extern void flib_Host20_Periodic_Setting(UINT8 bOption);
extern void flib_Host20_TimerEnable_UnLock(UINT32 wTime_Tick);
extern void flib_Host20_TimerDisable_UnLock(void);
extern void flib_Host20_Issue_ISO_FixBufferMode_ISR(void);
extern void flib_Host20_Issue_ISO_FixBufferMode_Init(UINT32 wEndPt,UINT32 wMaxPacketSize,UINT8 *pbBuffer,UINT32 wOffset,UINT8 bDirection);
extern void flib_Host20_ISO_Init (void);
extern UINT8 flib_Host20_Issue_Control_ByMode (UINT8 bEdNum,UINT8* pbCmd,UINT16 hwDataSize,UINT8* pbData,UINT8 bModeSelect);
//john : remove force speed
//extern void flib_Host20_ForceSpeed(UINT8 bSpeedType);
extern void flib_Host20_Issue_ISO_FixBufferMode_Close(void);
extern void flib_Host20_Issue_ISO_siTD(UINT8 bCheckResult,UINT32 wEndPt,UINT32 wMaxPacketSize,UINT32 wSize
,UINT32 *pwBufferArray,UINT32 wOffset,UINT8 bDirection,UINT8 bMult);
extern void flib_Host20_RemoteWakeUp_Processing(void);
//=================== 5.Call Extern Function Definition =======================================================
//========================================================================================================
extern void flib_Debug_LED_Init(void);
extern void flib_Debug_LED_On_All(void);
extern void flib_Debug_LED_Off_All(void);
//=================== 6.Extern Variable Definition =======================================================
//========================================================================================================
extern UINT8 OTGH_GETDESCRIPTOR_DEVICE[];
extern UINT8 OTGH_GETDESCRIPTOR_CONFIG[];
extern UINT8 OTGH_SETADDRESS[] ;
extern UINT8 OTGH_SETCONFIGURATION[] ;
extern UINT8 OTGH_GETDESCRIPTOR_OTG[] ;
extern UINT8 OTGH_SET_FEATURE_OTG[] ;
extern UINT8 OTGH_SETDESCRIPTOR_DEVICE[] ;
extern UINT8 OTGH_GETDESCRIPTOR_STR70[] ;
extern UINT8 OTGH_SETDESCRIPTOR_STR70[] ;
extern UINT8 OTGH_GETDESCRIPTOR_STR80[] ;
extern UINT8 OTGH_SETDESCRIPTOR_STR80[] ;
extern UINT32 waIntervalMap[] ;
extern volatile UINT32 wOTG_Timer_Counter;
extern qHD_Structure *psHost20_qHD_List_Control[3];
extern qHD_Structure *psHost20_qHD_List_Bulk[3];
extern qHD_Structure *psHost20_qHD_List_Interrupt[3];
extern UINT8 Host20_qTD_Manage[Host20_qTD_MAX]; //1=>Free 2=>used
extern UINT8 Host20_iTD_Manage[Host20_iTD_MAX]; //1=>Free 2=>used
extern UINT8 Host20_DataPage_Manage[Host20_Page_MAX]; //1=>Free 2=>used
extern Host20_Init_Condition_Structure sInitCondition;
extern volatile Host20_Attach_Device_Structure sAttachDevice;
extern volatile UINT32 wOTG_Timer_Counter;
extern Periodic_Frame_List_Structure *psHost20_FramList;
extern volatile UINT32 gwLastiTDSendOK;
extern Host20_ISO_FixBufferMode_Structure sISOFixBufferMode;
extern UINT8 bForceSpeed;//0=>All Clear 1=>Full Speed 2=>High Speed
extern Host20_Attach_Device_Structure *psDevice_AP;
#endif //LIB_HOST20__H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -