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

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

?? 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 頁 / 共 3 頁
字號(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,

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
波多野结衣视频一区| 亚洲444eee在线观看| 99视频精品免费视频| 婷婷久久综合九色综合绿巨人| 久久综合资源网| 欧美精三区欧美精三区| 成人午夜电影久久影院| 日韩成人精品在线观看| 国产精品久久久久永久免费观看 | www.亚洲在线| 同产精品九九九| 国产精品激情偷乱一区二区∴| 日韩一卡二卡三卡| 欧美美女视频在线观看| 欧美综合视频在线观看| 欧美视频一二三区| 蜜臀av亚洲一区中文字幕| 亚洲大片免费看| 精品播放一区二区| 国产一区激情在线| 国产精品国产三级国产普通话蜜臀 | 亚洲精品国久久99热| 国产综合色在线| 日本不卡中文字幕| 北条麻妃一区二区三区| 国产成人av资源| 91色综合久久久久婷婷| 欧美婷婷六月丁香综合色| 91精品在线观看入口| 久久综合色鬼综合色| 国产精品国产自产拍在线| 亚洲福利一区二区三区| 黄网站免费久久| 国内一区二区在线| 国产精品一区二区在线看| 国产成人aaa| 91热门视频在线观看| 9l国产精品久久久久麻豆| 99久久综合狠狠综合久久| 色偷偷一区二区三区| 在线视频亚洲一区| 欧美美女直播网站| 日韩精品一区二区三区在线 | 成人黄色免费短视频| 成人午夜大片免费观看| 欧美亚洲尤物久久| 久久久精品黄色| 一区二区三区av电影| 性久久久久久久| 国产精品综合一区二区| 色综合久久综合网| 91麻豆精品国产综合久久久久久| 91精品国产aⅴ一区二区| 日韩美女一区二区三区| 国产精品欧美久久久久一区二区| 亚洲成人激情av| 精品亚洲成av人在线观看| 99麻豆久久久国产精品免费优播| 色狠狠桃花综合| 欧美丝袜自拍制服另类| 91在线观看美女| 欧美疯狂性受xxxxx喷水图片| 国产亚洲成aⅴ人片在线观看| 99综合影院在线| 国产在线精品国自产拍免费| 久久国产精品第一页| 日韩限制级电影在线观看| 国产亚洲一区二区在线观看| 亚洲第四色夜色| 91玉足脚交白嫩脚丫在线播放| 日韩欧美亚洲国产精品字幕久久久| 一区二区三区四区乱视频| 国产精品一区二区久久精品爱涩| 欧美人伦禁忌dvd放荡欲情| 自拍偷拍亚洲欧美日韩| 精品一区二区三区不卡| 欧美日韩精品一区二区三区四区 | 777xxx欧美| 亚洲男女毛片无遮挡| 国产91综合一区在线观看| 欧美一区二区久久久| 亚洲午夜一区二区| 不卡的av电影| 国产精品私人影院| 狠狠网亚洲精品| 欧美成人精品1314www| 亚洲风情在线资源站| 色综合网站在线| 亚洲三级在线看| 成人av网站在线| 国产精品视频yy9299一区| 国产一区二区美女诱惑| 精品国产第一区二区三区观看体验| 日韩va欧美va亚洲va久久| 欧美日韩国产色站一区二区三区| 伊人一区二区三区| 色综合久久久网| 亚洲靠逼com| 一本大道av伊人久久综合| 国产精品国产三级国产三级人妇| 不卡av电影在线播放| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 亚洲精品精品亚洲| 91九色最新地址| 亚洲综合男人的天堂| 欧美丝袜丝交足nylons| 亚洲成a人在线观看| 7777精品伊人久久久大香线蕉最新版 | 免费视频最近日韩| 日韩欧美第一区| 激情综合色播激情啊| wwww国产精品欧美| 风间由美一区二区三区在线观看| 国产精品污网站| av不卡免费电影| 亚洲小说欧美激情另类| 欧美日本一道本| 老司机精品视频在线| 久久久精品人体av艺术| 国产成人综合自拍| 国产精品久久久爽爽爽麻豆色哟哟| 91网站在线观看视频| 尤物在线观看一区| 91精品久久久久久蜜臀| 韩国在线一区二区| 国产精品久久久久婷婷| 色先锋aa成人| 青青草伊人久久| 国产亚洲人成网站| 色综合一个色综合| 日韩av中文字幕一区二区 | 国产在线视频精品一区| 国产成人av网站| 亚洲欧美日韩中文字幕一区二区三区 | 免费成人在线网站| 欧美激情一区二区三区四区| 色综合天天性综合| 香蕉影视欧美成人| 久久精品夜色噜噜亚洲a∨| 91在线码无精品| 日韩电影免费在线看| 久久久久久久久久久久久夜| 一本一本大道香蕉久在线精品 | 视频一区二区国产| 欧美精品一区二区三区在线播放| 99国产麻豆精品| 蜜桃精品视频在线观看| 国产精品拍天天在线| 欧美精品视频www在线观看| 国产成人av网站| 日韩国产欧美三级| 国产精品色在线观看| 在线综合+亚洲+欧美中文字幕| 丁香五精品蜜臀久久久久99网站| 亚洲大片免费看| 国产精品视频yy9299一区| 4438成人网| 色婷婷av久久久久久久| 国内成人精品2018免费看| 一区二区三区不卡视频在线观看| 久久午夜色播影院免费高清| 欧洲精品在线观看| 国产成人99久久亚洲综合精品| 午夜激情一区二区三区| 中文字幕在线不卡国产视频| 精品奇米国产一区二区三区| 一本色道a无线码一区v| 国产美女精品人人做人人爽| 亚洲不卡一区二区三区| 国产精品久久久久久久久快鸭| 日韩欧美电影一二三| 91国产精品成人| 成人午夜在线播放| 久久精品国产亚洲高清剧情介绍| 亚洲精品国产高清久久伦理二区| 久久久久久久久一| 日韩一区二区在线观看视频| 欧美午夜精品一区| 不卡的av网站| 成人午夜电影网站| 国产在线精品一区二区夜色| 午夜影视日本亚洲欧洲精品| 亚洲人成网站影音先锋播放| 久久久久久久久久久黄色| 日韩丝袜情趣美女图片| 欧美日韩精品一区二区三区| 91日韩精品一区| 99久久99久久免费精品蜜臀| 国产成人在线免费| 精品午夜久久福利影院| 天堂成人免费av电影一区| 亚洲午夜久久久久| 亚洲视频中文字幕| 国产精品久久久久婷婷| 中文无字幕一区二区三区| 久久众筹精品私拍模特| 日韩欧美国产综合在线一区二区三区| 欧美高清视频www夜色资源网| 欧美日韩精品久久久| 欧美日本一区二区在线观看|