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

📄 otgsvc.h

📁 此為philip 1362 USB DOS下的驅動程式包, 已經共測試並內含有說明文件
💻 H
字号:
/*
   //*************************************************************************
   //
   //                  P H I L I P S   P R O P R I E T A R Y
   //
   //           COPYRIGHT (c)   2000-2002 BY PHILIPS SINGAPORE.
   //                     --  ALL RIGHTS RESERVED  --
   //
   // File Name:        OTGSvc.H
   // Author:           ZhenYu Zhang
   // Created:      	Jun. 8, 2000
   // Modified:			May 31, 2002 by wang.zhong.wei@philips.com
   // Revision:         1.0
   //
   //*************************************************************************
   //
	//*************************************************************************
*/


#ifndef __OTGSVC_H__
#define __OTGSVC_H__

#define A_WAIT_VRISE_TIMER	 98 	MS	//max 100MS
#define A_WAIT_BCON_TIMER	1000  	MS	//min 200MS
#define A_AIDL_BDIS_TIMER	1000 	MS	//min 150MS
#define B_ASE0_BRST_TIMER	  5		MS	//3.125-10MS
#define B_DATA_PLS_TIMER	  8		MS	//5-10MS
#define B_VBUS_PLS_TIMER     30    	MS	//max 100MS
#define B_BUS_REQ_TIMER		5200	MS	//min 5000MS
#define A_BCON_LDBC_TIMER	 120	MS	//min 100MS
#define VBUS_DISCHRG_TIMER	  30	MS

#define A_WAIT_VRISE_TIMER_ID		1
#define A_WAIT_BCON_TIMER_ID		2
#define A_AIDL_BDIS_TIMER_ID		3
#define B_ASE0_BRST_TIMER_ID		4
#define B_DATA_PLS_TIMER_ID			5
#define B_VBUS_PLS_TIMER_ID			6
#define B_BUS_REQ_TIMER_ID			7
#define A_BCON_LDBC_TIMER_ID		8

#define OTG_ERR_SRP_FAIL			1
#define OTG_ERR_A_WAIT_VRISE_TMOUT	2
#define OTG_ERR_A_WAIT_BCON_TMOUT	3
#define OTG_ERR_A_AIDL_BDIS_TMOUT	4
#define OTG_ERR_B_ASE0_BRST_TMOUT	5
#define OTG_ERR_A_OVERCURRENT		6
#define OTG_ERR_DEVICE_NOT_RESPOND	7
#define OTG_ERR_DEVICE_NOT_SUPPORT	8
#define OTG_ERR_B_BUS_REQ_TMOUT	  	9
#define OTG_ERR_PLUGA_INSERTED	   10
#define OTG_ERR_PLUGA_REMOVED	   11


enum {
	B_IDLE = 0,
	B_SRP_INIT,
	B_WAIT_ACON,
	B_PERIPHERAL,
	B_HOST,

	A_IDLE,
	A_WAIT_VRISE,
	A_WAIT_BCON,
	A_HOST,
	A_PERIPHERAL,
	A_WAIT_VFALL,
	A_VBUS_ERR         ,
	A_SUSPEND,
};

typedef struct _OTG_TCB{
	UCHAR	FSM;
	UCHAR	err_code;
	UCHAR	id:				1;

//for A-device
	UCHAR   a_vbus_vld:		1;
	UCHAR	a_sess_vld:		1;
	UCHAR	a_srp_det:		1;
	UCHAR	b_conn:			1;
	UCHAR	b_bus_suspend:	1;
	UCHAR	b_bus_resume:	1;

	UCHAR	b_hnp_support:	1;
	UCHAR	b_srp_support:	1;
	UCHAR	a_set_b_hnp_en:	1;

	UCHAR	a_suspend_req:	1;
//	UCHAR	a_clr_err:		1;
	UCHAR	a_host_done:	1;

//for B-device
	UCHAR	b_sess_end:		1;
	UCHAR	b_sess_vld:		1;
	UCHAR	b_se0_srp:		1;
	UCHAR	a_conn:			1;
	UCHAR	a_bus_suspend:	1;
	UCHAR	a_bus_resume:	1;

	UCHAR	a_bus_reset:	1;
	UCHAR	b_srp_done:		1;

	UCHAR	b_hnp_en:		1;
	UCHAR	a_hnp_support:	1;
	UCHAR	a_alt_hnp_support:	1;


//for both A-device and B-device
	UCHAR	bus_req: 		1;
	UCHAR	bus_drop:		1;

	UCHAR	TimeOut:  			1;
	UCHAR	TimerRunning: 		1;
	UCHAR	TimerID;
	USHORT	TimerTick;

	USHORT 	VendorID;
	USHORT	ProductID;
	UCHAR	DevAddr;
}OTG_TCB;

// OTG Hardware Emulation
void OTGCtrl_LocalVBus(BOOL bOn);
void OTGCtrl_LocalPullup(BOOL bOn);
void OTGCtrl_LocalPulldown(BOOL bOn);
void OTGCtrl_LocalSOF(BOOL bOn);

void OTGStatus_Probe(void);

void OTG_StartTimer(ULONG uTime, USHORT uTimerID);
void OTG_StopTimer(void);

void OTG_FSM4DeviceB(void);
void OTG_FSM4DeviceA(void);
void OTG_FSM(void);

void OTG_HW_emulator(void);
void OTGsup_SetVarible(void);

void OTG_Init(void);
void OTG_Acquire(void);
void OTG_Release(void);
void OTG_do_srp(void);

BOOLEAN OTGSup_ADevGiveupMastership(void);

#endif

⌨️ 快捷键说明

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