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

📄 dorequest.c

📁 16位单片机H8的例子源代码
💻 C
字号:
/*
****************************************************************************
					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	:DoRequest.c
	Working		:Executing Setup Commands
	Created		:Rev 2001_09_28 {Author : T.Ishikawa}
****************************************************************************
*/

#ifndef SysMemMap
#include	"SysMemMap.h"
#endif	/*	SysMemMap	*/

#ifndef CatProType
#include	"CatProType.h"
#endif	/*	CatProType	*/



/*	Prototype	*/
void				DecStandardCommands(void);
void				DecVenderCommands(void);



/*	Contents	*/
/***************************************************************************
Function Name	:DecStandardCommands(void)
Working			:Executing Standard Setup Commands
Return Value	:void
Modified		:{Author : T.Ishikawa[2001.Jan.10]}
Modified		:{Author : T.Takenaga[1999.Jan.22]}
Modified		:{Author : T.Ishikawa[1998.Mar.11]}
Created			:{Author : T.Ishikawa[1997.Dec.11]}
***************************************************************************/
void	DecStandardCommands(void) {

	unsigned char	EpInfoNumberLVar;

	switch((ep0PacketGVar.access1Type.bmRequest & 0x60)) {
	/*	What is command type ?	*/
		case	0x00:
		/*	standard commands	*/
			if(ep0PacketGVar.access1Type.bRequest == 6) {
			/*	Get Descriptor	*/
				if (ep0PacketGVar.access1Type.wValue_B2 == 1) {
				/*	Device Descriptor	*/
					dataBuffGPtr[0].AccessDataType.ReadType.startPtr = deviceDiscriptorGVar[0].d_data;
					dataBuffGPtr[0].AccessDataType.ReadType.endPtr = dataBuffGPtr[0].AccessDataType.ReadType.startPtr + (unsigned short)ConvReflexn(&ep0PacketGVar.access1Type.wLength_B1,2);
					dataBuffGPtr[0].endAriaPtr = deviceDiscriptorGVar[0].d_data + deviceDiscriptorGVar[0].length;
					if (dataBuffGPtr[0].AccessDataType.ReadType.endPtr > dataBuffGPtr[0].endAriaPtr) {
						dataBuffGPtr[0].AccessDataType.ReadType.endPtr = dataBuffGPtr[0].endAriaPtr;
					}
				}
				else if (ep0PacketGVar.access1Type.wValue_B2 == 3) {
				/*	String Descriptor	*/
					dataBuffGPtr[0].AccessDataType.ReadType.startPtr = stringDiscriptorGVar[ep0PacketGVar.access1Type.wValue_B1].d_data;
					dataBuffGPtr[0].AccessDataType.ReadType.endPtr = dataBuffGPtr[0].AccessDataType.ReadType.startPtr + (unsigned short)ConvReflexn(&ep0PacketGVar.access1Type.wLength_B1,2);
					dataBuffGPtr[0].endAriaPtr = stringDiscriptorGVar[0].d_data + stringDiscriptorGVar[0].length;
					if (dataBuffGPtr[0].AccessDataType.ReadType.endPtr > dataBuffGPtr[0].endAriaPtr) {
						dataBuffGPtr[0].AccessDataType.ReadType.endPtr = dataBuffGPtr[0].endAriaPtr;
					}
				}
				else {
				/*	Configuration Descriptor	*/
					dataBuffGPtr[0].AccessDataType.ReadType.startPtr = configurationDiscriptorGVar[0].d_data;
					dataBuffGPtr[0].AccessDataType.ReadType.endPtr = dataBuffGPtr[0].AccessDataType.ReadType.startPtr + (unsigned short)ConvReflexn(&ep0PacketGVar.access1Type.wLength_B1,2);
					dataBuffGPtr[0].endAriaPtr = configurationDiscriptorGVar[0].d_data + configurationDiscriptorGVar[0].length;
					if (dataBuffGPtr[0].AccessDataType.ReadType.endPtr > dataBuffGPtr[0].endAriaPtr) {
						dataBuffGPtr[0].AccessDataType.ReadType.endPtr = dataBuffGPtr[0].endAriaPtr;
					}
				}
			}
#if SET_ENABLE_CPU == 7622
		/*	Don't open	*/
#else
			else if (ep0PacketGVar.access1Type.bRequest == 7) {
			/*	Set Descriptor	*/
				dataBuffGPtr[0].AccessDataType.WriteType.startPtr = &controlBeginGVar;
				dataBuffGPtr[0].AccessDataType.WriteType.endPtr = &controlBeginGVar;
				if (ep0PacketGVar.access1Type.wValue_B2 == 1) {
				/*	Device Descriptor	*/
					transStageGPtr.beginPtr = deviceDiscriptorGVar[0].d_data;
					transStageGPtr.endPtr = (unsigned char*)((deviceDiscriptorGVar[0].d_data) + (deviceDiscriptorGVar[0].length));
				}
				else {
				/*	Configuration Descriptor	*/
					transStageGPtr.beginPtr = configurationDiscriptorGVar[0].d_data;
					transStageGPtr.endPtr = (unsigned char*)((configurationDiscriptorGVar[0].d_data) + (configurationDiscriptorGVar[0].length));
				}
			}
			else {
			}
#endif	/*	SET_ENABLE_CPU	*/
			break;
#ifdef ClassCommand	/*	in case of using class commands	*/
		case	0x20:
		/*	class commands	*/
#ifdef PrinterClass	/*	in case of using Printer Class commands	*/
			DecPrinterClassCommands();	/*	Printer Class commands	*/
#endif	/*	PrinterClass	*/
#ifdef BOT_MSClass	/*	in case of using Bulk-Only Transport Mass Storage Class comannds	*/
			DecBOTClassCommands();	/*	Bulk-Only Transport Mass Storage Class comannds	*/
#endif	/*	BOT_MSClass	*/
			break;
#endif	/*	ClassCommand	*/
#ifdef VenderCommand	/*	in case of using Vendor commands	*/
		case	0x40:
		/*	Vendor commands	*/
			DecVenderCommands();
			break;
#endif	/*	VendorCommands	*/
		default:
		/*	 the other case	*/
			error();
			break;
	}

	/*	set firmware state by Data Stage direction	*/
	if ((ep0PacketGVar.access1Type.bmRequest & 0x80) == 0x80) {
	/*	data transfer direction is Function to Host	*/
		EpInfo[0].PresentState = TRANS_IN;
	}
	else {
	/*	data transfer direction is Host to Function	*/
		EpInfo[0].PresentState = TRANS_OUT;
	}
}



/***************************************************************************
Function Name	:DecVenderCommands(void)
Working			:Executing Vendor Commands
Return Value	:void
Created			:{Author : }
***************************************************************************/
void	DecVenderCommands(void) {

}

⌨️ 快捷键说明

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