📄 parser.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 command
*-------------------------------------------------------------------*/
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 */
} BulkBuff;
/*-------------------------------------------------------------------
* This structure represents last bulk command status
*-------------------------------------------------------------------*/
typedef struct {
BulkCommand bulkCommand; /* current bulk 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 BULK_GET_DATA and BULK_SEND_DATA 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 BULK_SEND_IMM_BACK command only) */
int bufferForSendData; /* index of the "sending" buffer (for BULK_SEND_IMM_BACK command only) */
BulkBuff bulkBuff[2]; /* recived/sent data buffers (for BULK_SEND_IMM_BACK only) */
} BulkState;
/*-------------------------------------------------------------------
* 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;
byte Bulk_Parser (USB_request_t *req);
byte Gen_Parser (USB_request_t *req);
byte Interrupt_Parser (USB_request_t *req);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -