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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? usbsample.c

?? FreeRTOS V4.2.1,增加了AVR32 UC3 和 LPC2368 的支持
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
	FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 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.

	***************************************************************************
	See http://www.FreeRTOS.org for documentation, latest information, license 
	and contact details.  Please ensure to read the configuration and relevant 
	port sections of the online documentation.

	Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along
	with commercial development and support options.
	***************************************************************************
*/

/*
	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,

	'F', 0x00,
	'r', 0x00,
	'e', 0x00,
	'e', 0x00,
	'R', 0x00,
	'T', 0x00,
	'O', 0x00,
	'S', 0x00,
	'.', 0x00,
	'o', 0x00,
	'r', 0x00,
	'g', 0x00,
	' ', 0x00,
	'J', 0x00,
	'o', 0x00,
	'y', 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,
	'e', 0x00
};

/* Enumeration descriptors. */
const portCHAR pxReportDescriptor[] =
{
	 0x05,  0x01,	/* USAGE_PAGE (Generic Desktop)		*/
	 0x09,  0x04,	/* USAGE (Joystick)					*/
	 0xa1,  0x01,	/* COLLECTION (Application)			*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影一区二区三区| 国产精品中文欧美| 精品无人码麻豆乱码1区2区| aaa国产一区| 精品国产麻豆免费人成网站| 亚洲一区二区三区爽爽爽爽爽| 国产在线播放一区二区三区| 欧美性大战xxxxx久久久| 国产欧美日韩综合| 韩国av一区二区| 欧美蜜桃一区二区三区| 国产精品天干天干在观线| 奇米色一区二区三区四区| 欧美午夜电影网| 国产精品国产自产拍高清av王其 | 成人毛片在线观看| 欧美xxxx在线观看| 日本在线不卡一区| 精品视频在线看| 亚洲激情自拍偷拍| 91欧美一区二区| 中文一区二区完整视频在线观看 | 国产黄人亚洲片| 日韩一区二区免费高清| 午夜视频一区二区| 欧美亚洲一区二区在线观看| 一区二区三区欧美日| 色噜噜久久综合| 亚洲少妇30p| 色视频欧美一区二区三区| 国产精品二三区| 色综合天天视频在线观看| 亚洲人午夜精品天堂一二香蕉| 丁香婷婷综合网| 中文字幕一区二区在线播放 | 国产精品国产三级国产aⅴ中文| 国产精品一区二区久久精品爱涩 | 亚洲另类春色校园小说| 色噜噜久久综合| 午夜精品久久久久久久| 欧美日韩亚洲国产综合| 日韩福利电影在线| 欧美变态tickling挠脚心| 国产一区二区伦理片| 国产亚洲欧美日韩日本| 成人高清视频免费观看| 亚洲欧美日韩国产另类专区| 欧洲av一区二区嗯嗯嗯啊| 亚洲成a人v欧美综合天堂下载| 9191精品国产综合久久久久久| 奇米综合一区二区三区精品视频| 欧美大肚乱孕交hd孕妇| 国产成人精品亚洲777人妖| 国产精品久久久久一区二区三区| 91蜜桃免费观看视频| 午夜久久久久久| 精品国产人成亚洲区| 欧美性猛交一区二区三区精品| 亚洲图片有声小说| 精品日产卡一卡二卡麻豆| 成人黄色小视频| 亚洲bt欧美bt精品| 久久精品一区二区三区不卡 | 亚洲天堂福利av| 欧美日韩在线一区二区| 国产一区二区三区香蕉 | 日韩高清不卡一区| 日本一区二区视频在线| 欧美日韩亚洲综合在线| 国产毛片一区二区| 亚洲在线一区二区三区| 久久久久久夜精品精品免费| 色婷婷久久99综合精品jk白丝| 另类小说综合欧美亚洲| 亚洲欧美日韩电影| 国产无人区一区二区三区| 欧美熟乱第一页| 成人精品国产福利| 男男视频亚洲欧美| 亚洲精品免费电影| 久久在线免费观看| 欧美乱妇15p| www.av精品| 国产一区二区三区香蕉| 日日夜夜免费精品视频| 亚洲乱码中文字幕| 国产日韩一级二级三级| 日韩欧美一区二区久久婷婷| 欧美制服丝袜第一页| 大尺度一区二区| 国内精品在线播放| 日韩经典一区二区| 一区二区欧美视频| 亚洲欧美一区二区三区国产精品| 2023国产精品| 日韩天堂在线观看| 欧美三级乱人伦电影| 97成人超碰视| 97精品视频在线观看自产线路二| 国产精品一区在线| 国产在线国偷精品产拍免费yy| 天堂成人免费av电影一区| 亚洲精品第一国产综合野| 中文字幕一区二区三中文字幕| 欧美国产欧美亚州国产日韩mv天天看完整 | 欧美三级电影网| 欧洲在线/亚洲| 色综合av在线| 91成人国产精品| 91婷婷韩国欧美一区二区| av网站一区二区三区| 成人免费观看男女羞羞视频| 国产精品1区2区3区在线观看| 黄色日韩三级电影| 国产精品白丝jk黑袜喷水| 国产精品资源在线观看| 国产成人在线网站| 高清不卡在线观看av| 成人国产精品免费网站| 91在线播放网址| 在线观看视频一区二区| 欧美日韩一区二区在线观看视频| 欧美日韩一区中文字幕| 51午夜精品国产| 日韩欧美中文一区| 久久综合色鬼综合色| 中文字幕精品—区二区四季| 中文在线一区二区 | 蜜臀av在线播放一区二区三区| 热久久免费视频| 国产一区二区网址| 成人av网站在线观看| 色女孩综合影院| 91精品在线免费| 久久网站热最新地址| 中文字幕av不卡| 亚洲午夜国产一区99re久久| 美日韩一区二区三区| 成人中文字幕在线| 在线一区二区三区四区五区 | 国产精品久久久久久久午夜片 | 色94色欧美sute亚洲13| 欧美日韩你懂的| 精品区一区二区| 综合久久给合久久狠狠狠97色| 亚洲国产日韩精品| 国产在线精品一区二区夜色| 91丨porny丨户外露出| 欧美一区二区三区四区在线观看 | 日韩午夜av一区| 国产精品二区一区二区aⅴ污介绍| 亚洲一区二区三区激情| 国内久久婷婷综合| 色香蕉成人二区免费| 精品久久人人做人人爰| 亚洲欧美日韩在线| 激情小说欧美图片| 在线观看91视频| 国产亚洲精品aa| 日韩电影在线观看电影| 91在线视频在线| 欧美精品一区二区三区蜜桃| 亚洲一区二区三区视频在线播放 | 欧美在线一二三| 精品噜噜噜噜久久久久久久久试看| 国产精品传媒在线| 精品午夜久久福利影院| 欧美私模裸体表演在线观看| 中文字幕精品在线不卡| 日本欧美久久久久免费播放网| 色综合久久综合中文综合网| 久久午夜羞羞影院免费观看| 手机精品视频在线观看| 91麻豆免费在线观看| 久久精品这里都是精品| 麻豆高清免费国产一区| 欧美最猛性xxxxx直播| 国产精品久久久久影视| 国产美女娇喘av呻吟久久| 91精品国产福利在线观看| 亚洲永久免费av| 色综合久久中文字幕综合网| 中文av一区二区| 国产精品 日产精品 欧美精品| 日韩精品中文字幕在线不卡尤物| 婷婷中文字幕一区三区| 91国偷自产一区二区三区成为亚洲经典| 中文字幕乱码一区二区免费| 国产一区二区三区综合| 精品免费视频一区二区| 免费成人在线播放| 3d动漫精品啪啪1区2区免费| 亚洲成av人片在线观看无码| 欧美艳星brazzers| 亚洲精品国产一区二区三区四区在线| 99精品热视频| 亚洲欧美日韩一区| 91久久精品网| 亚洲第一福利一区| 911精品产国品一二三产区|