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

📄 parser.h

📁 USBN9603的DEMO程序
💻 H
字号:
/*----------------------------------------------------------------------------
 *  Copyright (c) 2001 by National Semiconductor Corporation
 *  National Semiconductor Corporation
 *
 *  All rights reserved
 *
 *<<<-------------------------------------------------------------------------
 * File Contents:
 *	parser.h - parser states
 *
 *  Project: USB Demo firmware
 *  Author : Yan Nosovitsky
 *  Date   : Oct 2001
 *----------------------------------------------------------------------->>>*/

#ifndef _parser_h_
#define _parser_h_

/*-------------------------------------------------------------------
* This structure represents buffer used in immediate response commands
*-------------------------------------------------------------------*/
typedef struct {
	byte 		buffer[TX_BULK_EP_FIFO_SIZE];  /* the buffer */
	boolean 	getReady;					   /* boolean indicating buffer emptiness */
	boolean 	sendReady;					   /* boolean indicating buffer fullness */
	int 		nextBuf;					   /* index of the next buffer */	
} LocBuff;

/*-------------------------------------------------------------------
* This structure represents last bulk/isochronous command status
*-------------------------------------------------------------------*/
typedef struct {
	union {
		BulkCommand	 bulkCommand;
		IsochCommand isoCommand;
	} command;							/* current command */			
	dword 		dataSize;			 	/* number of bytes to be sent/received in current command */
	dword 		restToRead;				/* remained number of bytes to be received */
	dword 		restToWrite;			/* remained number of bytes to be sent*/
	byte 		data;					/* constant byte of which the data is contained, for get or send commands */
	dword 		numOfErrors;			/* number of errors detected during the command */
	boolean 	zeroPacketNeed;  		/* boolean indicating whether a zero packet needed for end indication*/
	int 		bufferForGetData;		/* index of the "receiving"  buffer (for immediate response commands only) */
	int 		bufferForSendData;		/* index of the "sending"  buffer (for immediate response commands only) */
	LocBuff 	locBuff[4];			    /* recived/sent data buffers (for immediate response commands only) */
	} State;

/*-------------------------------------------------------------------
* This structure represents last interrupt command status
*-------------------------------------------------------------------*/
typedef struct {
	InterruptCommand 	interruptCommand;	/* current interrupt command */
	word 				interruptNum;		/* number of interrupts to be sent in current command */
	word				restToSend;			/* remained number of interrupts to be sent*/
	word				interval;			/* interval between the interrupts */
} InterruptState;

void Bulk_Parser		(USB_request_t *req);
void Iso_Parser			(USB_request_t *req);
void Gen_Parser			(USB_request_t *req);
void Interrupt_Parser	(USB_request_t *req);

void DMA_work();

#endif

⌨️ 快捷键说明

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