usb_cfgbuf.h

来自「COLDFIRE 5275板极初始化程序」· C头文件 代码 · 共 91 行

H
91
字号
/*
 * File:		usb_cfgbuf.h
 * Purpose:		MCF5275 USB Configuration buffers 
 *              (This is differnent than the USB Device Descriptors)
 */

#ifndef __USB_CFGBUF_H__
#define __USB_CFGBUF_H__

#ifdef __MWERKS__
#pragma options align=packed
#endif

/********************************************************************/
/* Structure for MCF5275 Configuration Bufffers */
typedef struct {
	uint16  Size;
	uint16  Addr_Ptr;
} USB_CFGBUF;
/********************************************************************/
/* Structure for MCF5275 String Bufffers */
typedef struct {
	uint8    Str_Length;
	uint16   Addr_Ptr;
} USB_STRINGBUF;
/********************************************************************/
/* Structure for MCF5275 Endpoint Bufffers */
typedef struct {
	uint8    Ep_num_cfg_inf;
	uint16   Ep_type_dir_pkt;
	uint16   Ep_BuffAdrPtr;
} USB_EPBUF;

/********************************************************************/
/* Structure Configuration Buffers*/
typedef struct {
	USB_CFGBUF    CfgBuf;
	USB_STRINGBUF StringBuf0;
	USB_STRINGBUF StringBuf1;
	USB_STRINGBUF StringBuf2;	
	USB_EPBUF     Ep0Buf;
	USB_EPBUF     Ep1Buf;
	USB_EPBUF     Ep2Buf;
	USB_EPBUF     Ep3Buf;
	USB_EPBUF     AltEp1Buf;
	USB_EPBUF     AltEp2Buf;
} CFG_BUFF_STRUCT;

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

/* defines for bEP_num_cfg_inf */
#define Ep_Num_0			0x00
#define Ep_Num_1			0x10
#define Ep_Num_2			0x20
#define Ep_Num_3			0x30

#define Ep_Config_0			0x00
#define Ep_Config_1			0x04
#define Ep_Config_2			0x08
#define Ep_Config_3			0x0C

#define Ep_Interface_0		0x00
#define Ep_Interface_1		0x01
#define Ep_Interface_2		0x02
#define Ep_Interface_3		0x03

/* defines for wEP_type_dir_pkt */
#define Ep_AltSetting_0		0x0000
#define Ep_AltSetting_1		0x4000
#define Ep_AltSetting_2		0x8000
#define Ep_AltSetting_3		0xC000

#define Ep_Type_Control		0x0000
#define Ep_Type_Isochronous 0x1000
#define Ep_Type_Bulk		0x2000
#define Ep_Type_Interrupt	0x3000

#define Ep_Dir_Out			0x0000
#define Ep_Dir_In			0x0800

#define Ep_MaxPktSize(a)	(((0x03FF)&(a))<<1)

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

#ifdef __MWERKS__
#pragma options align=reset
#endif

#endif /* __USB_CFGBUF_H__ */

⌨️ 快捷键说明

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