ARM专辑-152M-pdf.zip

源代码在线查看: common.h

软件大小: 74715 K
上传用户: QQ
关键词: M-pdf ARM 152 zip
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				   //*************************************************************************
				   //
				   //                  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
				   // Author:           ZhenYu Zhang	
				   // Created:          Feb. 1, 1999
				   // Modified:
				   // Revision: 		0.0
				   //
				   //*************************************************************************
				   //
				   //*************************************************************************
				
				#ifndef __COMMON_H__
				#define __COMMON_H__
				
				#include "BasicTyp.h"
				
				
				   //*************************************************************************
				   // macros
				   //*************************************************************************
				
				#define SWAP(x)   ((((x) & 0xFF) > 8) & 0xFF))
				
				#define MSB(x)    (((x) >> 8) & 0xFF)
				#define LSB(x)    ((x) & 0xFF)
				
				#define FALSE   0
				#define TRUE    1
				 
				
				#define LOBYTE(x)  (INT8)((x) >> 8)	//C51 byte ording uses Big Endian(Motorola)
				#define HIBYTE(x)  (INT8)((x) & 0x00ff) //High byte is stored first
				
				/*
				// MAX_CONTROLDATA_SIZE is between ADSC command and 50ms*384Bytes/ms=18KBytes
				// MaxSize for RBC command is 16 Bytes
				*/
				typedef union _bit_flags
				{
					struct _flags
					{
						unsigned timer               	: 1;    //MCUBF_Timer
						unsigned setup_overwritten  	: 1;    //D12BF_SetupOverwritten
						unsigned configuration			: 1;    //D12BF_Configuration    
				        unsigned DCPRequst_Dir          : 1;    //REQBF_DCPRequest_dir ==1 Read(from Dev to Host)
				        unsigned DCPRequst_EPDir        : 1;    //REQBF_DCPRequest_EPdir ==1 for In Endpoint
				        unsigned Stall_DCPRequest       : 1;    //REQBF_StallDCPRequest
				        unsigned BO_Stalled             : 1;    //BOTBF_StallSrcAtBulkOut
				        unsigned BI_Stalled             : 1;    //BOTBF_StallSrcAtBulkIn
				
				        unsigned Abort_BOT              : 1;    //Abort BOT Xfer
				        unsigned ATABF_IsAttached       : 1;	//HardDisk is Attached
				        unsigned ATABF_IsSupportMultiSector: 1; //MultiBlock support  
				        unsigned ATABF_IDEXfer_dir      : 1;     // ATABF_Xfer_dir==1 Read(from Dev to Host)
				        unsigned ATABF_IsSkipSetParameters: 1;   
				        unsigned Reserved               : 3;  
					
				    } bits;
				
				    INT16 value;
				} BITFLAGS;
				
				typedef struct _device_request		//设备请求
				{
					INT8 bmRequestType;
					INT8 bRequest;
					INT16 wValue;
					INT16 wIndex;
					INT16 wLength;
				} DEVICE_REQUEST;//8
				
				
				#define MAX_CONTROLDATA_SIZE	8
				
				typedef struct _control_xfer
				{
					INT16 wLength;
					INT16 wCount;
					INT8 * pData;
					INT8 dataBuffer[MAX_CONTROLDATA_SIZE];
				} CONTROL_XFER, * PCONTROL_XFER;
				
				
				
				//*************************************************************************
				// basic FSM state
				//*************************************************************************
				
				
				// FSM for Device
				
				#define USBFSM4DEV_ATTACHED             0
				#define USBFSM4DEV_POWRED               1
				#define USBFSM4DEV_DEFAULT              2
				#define USBFSM4DEV_ADDRESS              3
				#define USBFSM4DEV_CONFIGURED           4
				#define USBFSM4DEV_SUSPENDED            5
				#define USBFSM4DEV_RESET                USBFSM_DEFAULT
				
				
				// FSM for Default Control Pipe
				// One-Hot dinfition4DCPFSM
				#define USBFSM4DCP_IDLE             0x00
				#define USBFSM4DCP_SETUPPROC        0x01
				#define USBFSM4DCP_DATAIN           0x02
				#define USBFSM4DCP_DATAOUT          0x04
				#define USBFSM4DCP_HANDSHAKE4CO     0x08
				#define USBFSM4DCP_HANDSHAKE4CI     0x10
				#define USBFSM4DCP_STALL            0x80
				
				// FSM for Bulk-Only Transfer
				// One-Hot dinfition4BOTFSM
				#define USBFSM4BOT_STALL            0x80
				#define USBFSM4BOT_IDLE             0x01
				#define USBFSM4BOT_CBWPROC          0x02
				#define USBFSM4BOT_DATAIN           0x04
				#define USBFSM4BOT_DATAOUT          0x08
				#define USBFSM4BOT_CSWPROC          0x10
				#define USBFSM4BOT_CSW              0x20
				
				// One-Hot dinfition4XferSpace
				#define DCPXFERSPACE_MASK           0xF0
				#define DCPXFERSPACE_UNKNOWN        0x00
				#define DCPXFERSPACE_MCUCODE        0x01
				#define DCPXFERSPACE_MCURAM         0x02
				#define DCPXFERSPACE_EEROM          0x04
				#define DCPXFERSPACE_ATAPORT        0x08
				
				#define BOTXFERSPACE_MASK           0x0F
				#define BOTXFERSPACE_UNKNOWN        0x00
				#define BOTXFERSPACE_MCURAM         0x10
				#define BOTXFERSPACE_ATAPORT        0x20
				#define BOTXFERSPACE_MCUCODE        0x40
				
				#define STALLSRC_BULKIN             0x1
				#define STALLSRC_BULKOUT            0x2
				
				#endif
							

相关资源