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

📄 common.h

📁 ISP1181MCU_FW_Ver1.01.zip是基于飞利浦ISP1181的USB HOST开发板固件源代码
💻 H
字号:
/*
   //*************************************************************************
   //
   //                  P H I L I P S   P R O P R I E T A R Y
   //
   //           COPYRIGHT (c)   1999 BY PHILIPS SINGAPORE.
   //                     --  ALL RIGHTS RESERVED  --
   //
   // File Name:        Common.H
   // Created:          Feb. 1, 2000
   // Modified:
   // Revision: 		1.01
   //
   //*************************************************************************
   //
   //*************************************************************************
   */
#ifndef __COMMON_H__
#define __COMMON_H__

#include "BasicTyp.h"
/*
   //*************************************************************************
   // macros
   //*************************************************************************
*/
/*
#define SWAP(x)   (x)

#define MSB(x)    (((x) >> 8) & 0xFF)
#define LSB(x)    ((x) & 0xFF)

#define RaiseIRQL() disable()
#define LowerIRQL() enable()  


#define NULL_LENGTH 0xff
*/

/*
   //*************************************************************************
   // structure and union definitions
   //*************************************************************************
*/
typedef union _D13FLAGS {
	struct _D13FSM_FLAGS
	{

// Byte 0
		IRQL_1 UCHAR    bus_reset           : 1;
        IRQL_1 UCHAR    suspend             : 1;
        IRQL_1 UCHAR    At_IRQL1		    : 1; //in_isr

		IRQL_0 UCHAR    configuration		: 1;
		IRQL_0 UCHAR    remote_wakeup		: 1;

		IRQL_1 UCHAR    verbose				: 1;    /* Debug info*/
		IRQL_1 UCHAR    timer               : 1;
		IRQL_1 UCHAR    ep02done            : 1;

// Byte 1
		IRQL_1 UCHAR    DCP_state			: 4;    /* Default Control Pipe FSM state */
		IRQL_1 UCHAR	setup_dma			: 1;
		IRQL_1 UCHAR	dma_disable			: 1;		
		IRQL_1 UCHAR	dma_state			: 2;
	} bits;

	USHORT value;

} D13FLAGS;

typedef struct _device_request{
	UCHAR bmRequestType;
	UCHAR bRequest;
	USHORT wValue;
	USHORT wIndex;
	USHORT wLength;
} DEVICE_REQUEST;

// ******************************************************************************

// added for reuse D12 test software

typedef struct _IO_REQUEST {
	unsigned short	uAddressL;
	unsigned char	bAddressH;
	unsigned short	uSize;
	unsigned char	bCommand;
} IO_REQUEST, *PIO_REQUEST;

//*******************************************************************************


/*
// MAX_CONTROLDATA_SIZE is between ADSC command and 50ms*384Bytes/ms=18KBytes
// MaxSize for RBC command is 16 Bytes
*/
#define MAX_CONTROLDATA_SIZE	16

typedef struct _CONTROL_XFER
{
	IRQL_1 BOOLEAN          Abort;      //Indicate this transfer shall be aborted ASAP
	IRQL_1 DEVICE_REQUEST   DeviceRequest;
	IRQL_1 USHORT  		    wLength;
	IRQL_1 USHORT  		    wCount;
	IRQL_1 ADDRESS          Addr;
	IRQL_1 UCHAR            dataBuffer[MAX_CONTROLDATA_SIZE];

} CONTROL_XFER, * PCONTROL_XFER;


/*
//*************************************************************************
// basic FSM state
//*************************************************************************
*/

#define USBFSM_ATTACHED             0
#define USBFSM_POWRED               1
#define USBFSM_DEFAULT              2
#define USBFSM_ADDRESS              3
#define USBFSM_CONFIGURED           4
#define USBFSM_SUSPENDED            5

#define USBFSM_RESET                USBFSM_DEFAULT


/*
// Normal FSM for Set Command
//  IDLE -> SETUP[IRQL-1] -> DataOut[IRQL_1] -> RequestProc[IRQL_0] -> Status Stage
// Normal FSM for Get Command
//  IDLE -> SETUP[IRQL-1] -> RequestProc[IRQL_0] -> DataIn[IRQL-1]-> Status Stage
*/
#define USBFSM_STALL                7
#define USBFSM_IDLE                 0
#define USBFSM_XMIT                 1
#define USBFSM_RCV                  2
#define USBFSM_INPROCESS            3
#define USBFSM_STATUS               4
#define USBFSM_ABORT                5

// FSM for Device


// FSM for Default Control Pipe
#define USBFSM4DCP_IDLE             0x0
#define USBFSM4DCP_DATAIN           0x1
#define USBFSM4DCP_DATAOUT          0x2
#define USBFSM4DCP_REQUESTPROC      0x3
#define USBFSM4DCP_HANDSHAKE        0x4
#define USBFSM4DCP_SETUPPROC        0x5
#define USBFSM4DCP_STALL            0x6

#endif

⌨️ 快捷键说明

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