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

📄 cattypedef.h

📁 16位单片机H8的例子源代码
💻 H
字号:
/*
****************************************************************************
					H I T A C H I    P R O P R I E T A R Y

	COPYRIGHT (c)	2001 BY Semiconductor & Integrated Circuits,Hitachi,Ltd.
						---  ALL RIGHTS RESERVED  ---

	File Name	:CatTypedef.h
	Working		:Standard struct type
	Modified	:Rev 2001_09_28 {Author : T.Ishikawa}
	Created		:Rev 1.0 {Author : T.Ishikawa[2001.Jan.10]}
****************************************************************************
*/

enum	PresentStateType		{WAIT,TRANS_IN,TRANS_OUT};
enum	SetCompleteType			{COMPLETE,INCOMPLETE};
enum	TransModeType			{CONTROL,BULK,INTERRUPT};



typedef	struct BuffType {
	union {
		struct {
			unsigned char*		startPtr;
			unsigned char*		endPtr;
		} WriteType;
		struct {
			unsigned char*		endPtr;
			unsigned char*		startPtr;
		} ReadType;
		struct {
			unsigned long*		startPtr;
			unsigned long*		endPtr;
		} WriteType4;
		struct {
			unsigned long*		endPtr;
			unsigned long*		startPtr;
		} ReadType4;
	} AccessDataType;
	unsigned char*		beginAriaPtr;	/*	start point data buffer area	*/
	unsigned char*		endAriaPtr;		/*	  end point data buffer area	*/
} BuffType;



typedef	struct InterruptType {
	union {
		unsigned long	LONG;
		struct {
			unsigned char		InterruptRegister0;
			unsigned char		InterruptRegister1;
			unsigned char		InterruptRegister2;
			unsigned char		InterruptRegister3;
		} BYTE;
	} INTERRUPT;
} InterruptType;



typedef	struct LinkType {
	/*	interrupt flag information ( these bits are concerned next informations )	*/
	/*	Endpoint Information	*/
	/*	call routine	*/
	const unsigned long			InterruptBitStream;	/*	0x00000000	*/
	const unsigned char			EpInfoNum;			/*	0	*/
	const unsigned char			DataBuffNum;		/*	0	*/
	const void					(*CallOn)();		/*	Act****	*/
} LinkType;



typedef struct EpInfoType {	/*	each Endpoint information	*/
	const unsigned char			epNumber;			/*	Enspoint number	*/
	enum TransModeType			transMode;			/*	transfer type	*/
	volatile unsigned char*		FifoSize;			/*	FIFO size register address
		if Endpoint dose not have FIFO size register, it's writeFifoSizeGVar[] address	*/
	volatile unsigned char*		epdrPtr;			/*	Endpoint data size regizter address	*/
	volatile unsigned long*		epdrLPtr;			/*	Endpoint data size regizter address	*/
	const unsigned char			putEnable;			/*	packet enable bit pattern	*/
	const unsigned char			getFinish;			/*	read finish bit pattern	*/
	const unsigned char			fifoClearEnable;	/*	FIFO clear bit pattern	*/
	const unsigned char			stallEnable;		/*	Endpoint stall bit pattern	*/
	enum PresentStateType		PresentState;		/*	USB transfer state	*/
	unsigned char				MaxPacketSize;		/*	Max packet size	*/
} EpInfoType;



typedef	struct ControlType {	/*	chnage received data	*/
	unsigned char*				beginPtr;	/*	start point	*/
	unsigned char*				endPtr;		/*	end point	*/
} ControlType;



typedef	union RequestType {	/*	bmRequestType definition	*/
	unsigned char byteVal;
	struct bitValType {
		unsigned char			d7:1;		/*	data transfer direction	*/
		unsigned char			d65:2;		/*	command type "standard" "class" "vendor"	*/
		unsigned char			d40:5;		/*	receive side	*/
	} bitValType;
} RequestType;



typedef	union SetupDataType {	/*	Setup Data definition	*/
	unsigned char	byteVal[8];
	struct access0Type {
		RequestType				bmRequest;	/*	request feature	*/
		unsigned char			bRequest;	/*	request number	*/
		unsigned short			wValue;		/*	Word-sized field that varies according to request (Word)	*/
		unsigned short			wIndex;		/*	Word-sized field that varies according to request ; typically used to pass an index or offset (Word)	*/
		unsigned short			wLength;	/*	Number of bytes to transfer if there is a Data Stage (Word)	*/
	} access0Type;
	struct access1Type {
		unsigned char			bmRequest;	/*	request feature	*/
		unsigned char			bRequest;	/*	request number	*/
		unsigned char			wValue_B1;	/*	Word-sized field that varies according to request 1 (Byte)	*/
		unsigned char			wValue_B2;	/*	Word-sized field that varies according to request 2 (Byte)	*/
		unsigned char			wIndex_B1;	/*	Word-sized field that varies according to request 1 ; typically used to pass an index or offset (Byte)	*/
		unsigned char			wIndex_B2;	/*	Word-sized field that varies according to request 2 ; typically used to pass an index or offset (Byte)	*/
		unsigned char			wLength_B1;	/*	Number of bytes to transfer if there is a Data Stage 1 (Byte)	*/
		unsigned char			wLength_B2;	/*	Number of bytes to transfer if there is a Data Stage 2 (Byte)	*/
	} access1Type;
} SetupDataType;



typedef	struct DiscriptorType {	/*	Descriptor	*/
	unsigned short				length;
	unsigned char*				d_data;
} DiscriptorType;

⌨️ 快捷键说明

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