亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? usbsample.c

?? IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*
	FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.

	This file is part of the FreeRTOS.org distribution.

	FreeRTOS.org is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	FreeRTOS.org is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with FreeRTOS.org; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	A special exception to the GPL can be applied should you wish to distribute
	a combined work that includes FreeRTOS.org, without being obliged to provide
	the source code for any proprietary components.  See the licensing section
	of http://www.FreeRTOS.org for full details of how and when the exception
	can be applied.

    ***************************************************************************
    ***************************************************************************
    *                                                                         *
    * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *
    * and even write all or part of your application on your behalf.          *
    * See http://www.OpenRTOS.com for details of the services we provide to   *
    * expedite your project.                                                  *
    *                                                                         *
    ***************************************************************************
    ***************************************************************************

	Please ensure to read the configuration and relevant port sections of the
	online documentation.

	http://www.FreeRTOS.org - Documentation, latest information, license and
	contact details.

	http://www.SafeRTOS.com - A version that is certified for use in safety
	critical systems.

	http://www.OpenRTOS.com - Commercial support, development, porting,
	licensing and training services.
*/

/*
	Sample interrupt driven USB device driver.  This is a minimal implementation
	for demonstration only.  Although functional, it is not a full and compliant
	implementation.
	
	The USB device enumerates as a simple 3 axis joystick, and once configured
	transmits 3 axis of data which can be viewed from the USB host machine.

	This file implements the USB interrupt service routine, and a demo FreeRTOS
	task.  The interrupt service routine handles the USB hardware - taking a
	snapshot of the USB status at the point of the interrupt.  The task receives
	the status information from the interrupt for processing at the task level.
	
	See the FreeRTOS.org WEB documentation for more information.
*/

/*
	Changes from V2.5.5
	
	+ Descriptors that have a length that is an exact multiple of usbFIFO_LENGTH
	  can now be transmitted.  To this end an extra parameter has been
	  added to the prvSendControlData() function, and the state
	  eSENDING_EVEN_DESCRIPTOR has been introduced.  Thanks to Scott Miller for
	  assisting with this contribution.

	Changes from V2.6.0

	+ Replaced the duplicated RX_DATA_BK0 in the interrupt mask with the
	  RX_DATA_BK1.
*/

/* Standard includes. */
#include <string.h>

/* Demo board includes. */
#include "board.h"

/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"


/* Descriptor type definitions. */
#define usbDESCRIPTOR_TYPE_DEVICE			( 0x01 )
#define usbDESCRIPTOR_TYPE_CONFIGURATION	        ( 0x02 )
#define usbDESCRIPTOR_TYPE_STRING			( 0x03 )

/* USB request type definitions. */
#define usbGET_REPORT_REQUEST				( 0x01 )
#define usbGET_IDLE_REQUEST				( 0x02 )
#define usbGET_PROTOCOL_REQUEST				( 0x03 )
#define usbSET_REPORT_REQUEST				( 0x09 )
#define usbSET_IDLE_REQUEST				( 0x0A )
#define usbSET_PROTOCOL_REQUEST				( 0x0B )
#define usbGET_CONFIGURATION_REQUEST		        ( 0x08 )
#define usbGET_STATUS_REQUEST				( 0x00 )
#define usbCLEAR_FEATURE_REQUEST			( 0x01 )
#define usbSET_FEATURE_REQUEST				( 0x03 )
#define usbSET_ADDRESS_REQUEST				( 0x05 )
#define usbGET_DESCRIPTOR_REQUEST			( 0x06 )
#define usbSET_CONFIGURATION_REQUEST		        ( 0x09 )
#define usbGET_INTERFACE_REQUEST			( 0x0A )
#define usbSET_INTERFACE_REQUEST			( 0x0B )


/* Misc USB definitions. */
#define usbDEVICE_CLASS_VENDOR_SPECIFIC		        ( 0xFF )
#define usbBUS_POWERED					( 0x80 )
#define usbHID_REPORT_DESCRIPTOR			( 0x22 )
#define AT91C_UDP_TRANSCEIVER_ENABLE			( *( ( unsigned long * ) 0xfffb0074 ) )

/* Index to the various string. */
#define usbLANGUAGE_STRING			         ( 0 )
#define usbMANUFACTURER_STRING				 ( 1 )
#define usbPRODUCT_STRING				 ( 2 )
#define usbCONFIGURATION_STRING				 ( 3 )
#define usbINTERFACE_STRING				 ( 4 )

/* Data indexes for reading the request from the xISRStatus.ucFifoData[]
into xUSB_REQUEST.  The data order is designed for speed - so looks a
little odd. */
#define usbREQUEST_TYPE_INDEX				( 7 )
#define usbREQUEST_INDEX				( 6 )
#define usbVALUE_HIGH_BYTE				( 4 )
#define usbVALUE_LOW_BYTE				( 5 )
#define usbINDEX_HIGH_BYTE				( 2 )
#define usbINDEX_LOW_BYTE				( 3 )
#define usbLENGTH_HIGH_BYTE				( 0 )
#define usbLENGTH_LOW_BYTE				( 1 )

/* Misc application definitions. */
#define usbINTERRUPT_PRIORITY				( 3 )
#define usbQUEUE_LENGTH					( 0x3 )	/* Must have all bits set! */
#define usbFIFO_LENGTH					( ( unsigned portLONG ) 8 )
#define usbEND_POINT_0					( 0 )
#define usbEND_POINT_1					( 1 )
#define usbXUP						( 1 )
#define usbXDOWN					( 2 )
#define usbYUP						( 3 )
#define usbYDOWN					( 4 )
#define usbMAX_COORD					( 120 )
#define usbMAX_TX_MESSAGE_SIZE				( 128 )
#define usbRX_COUNT_MASK				( ( unsigned portLONG ) 0x7ff )
#define AT91C_UDP_STALLSENT				AT91C_UDP_ISOERROR
#define usbSHORTEST_DELAY				( ( portTickType ) 1 )
#define usbINIT_DELAY					( ( portTickType ) 500 / portTICK_RATE_MS )
#define usbSHORT_DELAY					( ( portTickType ) 50 / portTICK_RATE_MS )
#define usbEND_POINT_RESET_MASK				( ( unsigned portLONG ) 0x0f )
#define usbDATA_INC					( ( portCHAR ) 5 )
#define usbEXPECTED_NUMBER_OF_BYTES			( ( unsigned portLONG ) 8 )

/* Control request types. */
#define usbSTANDARD_DEVICE_REQUEST			( 0 )
#define usbSTANDARD_INTERFACE_REQUEST		        ( 1 )
#define usbSTANDARD_END_POINT_REQUEST		        ( 2 )
#define usbCLASS_INTERFACE_REQUEST			( 5 )

/*-----------------------------------------------------------*/

/* Structure used to take a snapshot of the USB status from within the ISR. */
typedef struct X_ISR_STATUS
{
	unsigned portLONG ulISR;
	unsigned portLONG ulCSR0;
	unsigned portCHAR ucFifoData[ 8 ];
} xISRStatus;

/* Structure used to hold the received requests. */
typedef struct
{
	unsigned portCHAR ucReqType;
	unsigned portCHAR ucRequest;
	unsigned portSHORT usValue;
	unsigned portSHORT usIndex;
	unsigned portSHORT usLength;
} xUSB_REQUEST;

typedef enum
{
	eNOTHING,
	eJUST_RESET,
	eJUST_GOT_CONFIG,
	eJUST_GOT_ADDRESS,
	eSENDING_EVEN_DESCRIPTOR,
	eREADY_TO_SEND
} eDRIVER_STATE;

/* Structure used to control the data being sent to the host. */
typedef struct
{
	unsigned portCHAR ucTxBuffer[ usbMAX_TX_MESSAGE_SIZE ];
	unsigned portLONG ulNextCharIndex;
	unsigned portLONG ulTotalDataLength;
} xTX_MESSAGE;

/*-----------------------------------------------------------*/

/*
 * The USB interrupt service routine.  This takes a snapshot of the USB
 * device at the time of the interrupt, clears the interrupts, and posts
 * the data to the USB processing task.
 */
__arm void vUSB_ISR( void );

/*
 * Called after the bus reset interrupt - this function readies all the
 * end points for communication.
 */
static void prvResetEndPoints( void );

/*
 * Setup the USB hardware, install the interrupt service routine and
 * initialise all the state variables.
 */
static void vInitUSBInterface( void );

/*
 * Decode and act upon an interrupt generated by the control end point.
 */
static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage );

/*
 * For simplicity requests are separated into device, interface, class
 * interface and end point requests.
 *
 * Decode and handle standard device requests originating on the control
 * end point.
 */
static void prvHandleStandardDeviceRequest( xUSB_REQUEST *pxRequest );

/*
 * For simplicity requests are separated into device, interface, class
 * interface and end point requests.
 *
 * Decode and handle standard interface requests originating on the control
 * end point.
 */
static void prvHandleStandardInterfaceRequest( xUSB_REQUEST *pxRequest );

/*
 * For simplicity requests are separated into device, interface, class
 * interface and end point requests.
 *
 * Decode and handle standard end point requests originating on the control
 * end point.
 */
static void prvHandleStandardEndPointRequest( xUSB_REQUEST *pxRequest );

/*
 * For simplicity requests are separated into device, interface, class
 * interface and end point requests.
 *
 * Decode and handle the class interface requests.
 */
static void prvHandleClassInterfaceRequest( xUSB_REQUEST *pxRequest );

/*
 * Setup the Tx buffer to send data in response to a control request.
 *
 * The data to be transmitted is buffered, the state variables are updated,
 * then prvSendNextSegment() is called to start the transmission off.  Once
 * the first segment has been sent the remaining segments are transmitted
 * in response to TXCOMP interrupts until the entire buffer has been
 * sent.
 */
static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT usRequestedLength, unsigned portLONG ulLengthLeftToSend, portLONG lSendingDescriptor );

/*
 * Examine the Tx buffer to see if there is any more data to be transmitted.
 *
 * If there is data to be transmitted then send the next segment.  A segment
 * can have a maximum of 8 bytes (this is defined as the maximum for the end
 * point by the descriptor).  The final segment may be less than 8 bytes if
 * the total data length was not an exact multiple of 8.
 */
static void prvSendNextSegment( void );

/*
 * A stall condition is forced each time the host makes a request that is not
 * supported by this minimal implementation.
 *
 * A stall is forced by setting the appropriate bit in the end points control
 * and status register.
 */
static void prvSendStall( void );

/*
 * A NULL (or zero length packet) is transmitted in acknowledge the reception
 * of certain events from the host.
 */
static void prvUSBTransmitNull( void );

/*
 * When the host requests a descriptor this function is called to determine
 * which descriptor is being requested and start its transmission.
 */
static void prvGetStandardInterfaceDescriptor( xUSB_REQUEST *pxRequest );

/*
 * This demo USB device enumerates as a simple 3 axis joystick.  Once
 * configured this function is periodically called to generate some sample
 * joystick data.
 *
 * The x and y axis are made to move in a square.  The z axis is made to
 * repeatedly increment up to its maximum.
 */
static void prvTransmitSampleValues( void );

/*
 * The created task to handle the USB demo functionality.
 */
void vUSBDemoTask( void *pvParameters );

/*-----------------------------------------------------------*/

/*
	- DESCRIPTOR DEFINITIONS -
*/

/* String descriptors used during the enumeration process.
These take the form:

{
	Length of descriptor,
	Descriptor type,
	Data
}
*/
const portCHAR pxLanguageStringDescriptor[] =
{
	4,
	usbDESCRIPTOR_TYPE_STRING,
	0x09, 0x04
};

const portCHAR pxManufacturerStringDescriptor[] =
{
	18,
	usbDESCRIPTOR_TYPE_STRING,

	'F', 0x00,
	'r', 0x00,
	'e', 0x00,
	'e', 0x00,
	'R', 0x00,
	'T', 0x00,
	'O', 0x00,
	'S', 0x00	
};

const portCHAR pxProductStringDescriptor[] =
{
	44,
	usbDESCRIPTOR_TYPE_STRING,

	'C', 0x00,
	'D', 0x00,
	'A', 0x00,
	'C', 0x00,
	//'l', 0x00,
	//'T', 0x00,
	//'O', 0x00,
	//'S', 0x00,
	'-', 0x00,
	'T', 0x00,
	//'r', 0x00,
	//'g', 0x00,
	//' ', 0x00,
	'S', 0x00,
	'B', 0x00,
	'C', 0x00,
	//'s', 0x00,
	//'t', 0x00,
	//'i', 0x00,
	//'c', 0x00,
	//'k', 0x00
};

const portCHAR pxConfigurationStringDescriptor[] =
{
	38,
	usbDESCRIPTOR_TYPE_STRING,

	'C', 0x00,
	'o', 0x00,
	'n', 0x00,
	'f', 0x00,
	'i', 0x00,
	'g', 0x00,
	'u', 0x00,
	'r', 0x00,
	'a', 0x00,
	't', 0x00,
	'i', 0x00,
	'o', 0x00,
	'n', 0x00,
	' ', 0x00,
	'N', 0x00,
	'a', 0x00,
	'm', 0x00,
	'e', 0x00
};

const portCHAR pxInterfaceStringDescriptor[] =
{
	30,
	usbDESCRIPTOR_TYPE_STRING,

	'I', 0x00,
	'n', 0x00,
	't', 0x00,
	'e', 0x00,
	'r', 0x00,
	'f', 0x00,
	'a', 0x00,
	'c', 0x00,
	'e', 0x00,
	' ', 0x00,
	'N', 0x00,
	'a', 0x00,
	'm', 0x00,

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩在线播放| 亚洲免费观看高清| 欧美在线免费视屏| 激情综合网天天干| 夜夜嗨av一区二区三区网页| 久久综合色婷婷| 欧美色成人综合| 高清在线观看日韩| 日韩不卡手机在线v区| 国产精品久久毛片| 欧美v亚洲v综合ⅴ国产v| 色婷婷综合久色| 成人永久aaa| 奇米精品一区二区三区在线观看| 国产精品久久久久影视| 欧美大片一区二区| 欧美区视频在线观看| 99视频精品在线| 国产综合久久久久久鬼色 | 91亚洲国产成人精品一区二区三 | 国产一区二区三区免费播放| 亚洲一区视频在线| 国产精品少妇自拍| 久久尤物电影视频在线观看| 欧美理论片在线| 在线视频观看一区| 99久久精品免费看| 国产成人精品一区二区三区网站观看| 手机精品视频在线观看| 一区二区在线观看免费| 国产精品久久久久精k8| 欧美韩国日本不卡| 久久奇米777| 日韩精品一区二区三区在线| 欧美老肥妇做.爰bbww| 日本韩国一区二区| 91免费精品国自产拍在线不卡| 国产aⅴ综合色| 国产精品伊人色| 国产乱对白刺激视频不卡| 蜜臂av日日欢夜夜爽一区| 三级一区在线视频先锋 | 国产精品三级视频| 国产色91在线| 久久久精品国产99久久精品芒果 | 91福利小视频| 91免费看视频| 欧美午夜精品一区| 在线观看一区日韩| 在线亚洲免费视频| 欧美亚洲一区二区三区四区| 欧美日韩在线三级| 欧美日韩成人在线| 日韩一级片网站| 欧美成va人片在线观看| 精品国产乱码久久久久久蜜臀| 欧美不卡视频一区| 国产日产欧美一区| 国产精品久久久久影院老司 | 国产婷婷色一区二区三区| 久久精品亚洲精品国产欧美kt∨| 国产午夜精品理论片a级大结局| 国产精品网站一区| 亚洲免费观看高清完整版在线观看 | 成人性色生活片| 9l国产精品久久久久麻豆| 一本色道久久综合狠狠躁的推荐| 欧美专区日韩专区| 欧美一区二区三级| 日本一区二区综合亚洲| 一区二区成人在线| 男人的天堂亚洲一区| 国产自产视频一区二区三区| 北岛玲一区二区三区四区| 色悠久久久久综合欧美99| 制服丝袜亚洲色图| 国产三级一区二区三区| 亚洲最新视频在线观看| 久久精品国产秦先生| av网站免费线看精品| 欧美人伦禁忌dvd放荡欲情| 精品人伦一区二区色婷婷| 国产精品美女久久久久久2018| 性做久久久久久久久| 国产aⅴ综合色| 欧美高清hd18日本| 中文一区在线播放| 日韩黄色免费网站| 国产成人高清在线| 欧美美女激情18p| 亚洲国产精品成人综合色在线婷婷| 一区二区三区四区在线播放| 麻豆精品在线看| 91免费视频网址| 精品毛片乱码1区2区3区| 亚洲日本丝袜连裤袜办公室| 日本欧美一区二区三区乱码| www.99精品| 欧美xxx久久| 亚洲一区二区三区四区不卡| 国产精品一区二区三区网站| 欧美日韩黄色影视| 中文字幕在线播放不卡一区| 麻豆国产91在线播放| 91国偷自产一区二区三区观看| 久久先锋影音av| 午夜久久久久久久久久一区二区| 国产99久久久国产精品| 91精品国产黑色紧身裤美女| 亚洲精品国产视频| 成人午夜av在线| 精品国产乱码久久久久久图片| 亚洲成人免费看| 日本韩国欧美一区二区三区| 欧美极品xxx| 国产一区不卡在线| 日韩欧美一级片| 三级久久三级久久久| 欧美性色黄大片| 亚洲人成网站精品片在线观看| 国v精品久久久网| 久久亚洲精品国产精品紫薇| 久久激情五月婷婷| 欧美一级在线观看| 日韩在线一区二区三区| 欧美日韩一区精品| 亚洲国产日韩a在线播放性色| 色av一区二区| 亚洲精品一卡二卡| 色综合久久综合网欧美综合网 | 91精品视频网| 亚洲第一福利一区| 欧美在线综合视频| 亚洲精品久久久蜜桃| 色94色欧美sute亚洲线路一ni| 中文字幕一区二区三区在线播放| 国产精品亚洲成人| 国产欧美精品国产国产专区 | 亚洲超碰97人人做人人爱| 欧美亚洲一区二区在线| 国产精品国产成人国产三级| 成人app在线观看| 综合电影一区二区三区| 成人app软件下载大全免费| 国产精品蜜臀在线观看| 风流少妇一区二区| 国产精品免费人成网站| 国产91精品欧美| 国产精品免费久久久久| 国内精品视频666| 久久久青草青青国产亚洲免观| 国模一区二区三区白浆| 久久久久久久免费视频了| www.亚洲激情.com| 国产精品九色蝌蚪自拍| 91视频免费看| 中文字幕一区二区三区av| 岛国精品在线观看| 国产性天天综合网| 国产成人亚洲综合色影视| 日本一区二区三区国色天香 | 国产一区啦啦啦在线观看| 日韩亚洲国产中文字幕欧美| 日韩不卡一二三区| 91麻豆精品久久久久蜜臀| 三级一区在线视频先锋| 91精品国产一区二区人妖| 亚洲人成人一区二区在线观看| 色婷婷亚洲综合| 免费成人av在线| 精品成a人在线观看| av欧美精品.com| 樱桃国产成人精品视频| 欧美大肚乱孕交hd孕妇| 成人午夜在线免费| 亚洲三级在线看| 日韩一区二区在线免费观看| 久久99热狠狠色一区二区| 国产精品美日韩| 欧美主播一区二区三区美女| 激情六月婷婷综合| 精品va天堂亚洲国产| 丰满少妇在线播放bd日韩电影| 亚洲精品久久嫩草网站秘色| 制服丝袜在线91| 成人深夜视频在线观看| 亚洲精品亚洲人成人网| 精品嫩草影院久久| 久久国产精品99久久人人澡| 亚洲色图欧美激情| 26uuu色噜噜精品一区二区| www.亚洲色图.com| 久久国产精品免费| 国产精品美女久久久久久久网站| 6080午夜不卡| 国产毛片一区二区| 日韩av网站在线观看| 成人免费视频在线观看| 91精品久久久久久久99蜜桃 | 中文字幕制服丝袜一区二区三区|