📄 usbd_func.h
字号:
/*
* description: USB Function definition
* Maker : Tsuyoshi Yamashita
* Copyright : (C)2003,SEIKO EPSON Corp. All Rights Reserved.
*
*--------------------------------------------------------------------------
* $Revision: 1.5 $ $Date: 2006/08/10 08:11:29 $
*/
#include "SPRDEF.h"
/*
Prevention for double include
*/
#ifndef USBD_FUNC_H
#define USBD_FUNC_H
/*=== Define ==============================================================*/
/*--- USBD_Func{Get/Set}DescriptorInfo{Address} ----------------------------*/
#define USBD_FUNC_SPEEDCOMMON (0x00) /* Common descriptor */
#define USBD_FUNC_SPEEDFS (0x01) /* Descriptor for FS */
#define USBD_FUNC_SPEEDHS (0x02) /* Descriptor for HS */
/*--- USBD_FuncGetParam,USBD_FuncSetParam -----------------------------------*/
#define USBD_FUNC_FEATURE_ON (0x01) /* The function is used */
#define USBD_FUNC_FEATURE_OFF (0x00) /* The function is not used */
#define USBD_FUNC_POWER_PARAM (0x01) /* Power saving setting */
#define USBD_FUNC_PSLEVEL0 (0x00) /* Full Power */
#define USBD_FUNC_PSLEVEL1 (0x01) /* Low Power */
#define USBD_FUNC_HWFEATURE_PARAM (0x02) /* Hardware function setting */
#define USBD_FUNC_SWFEATURE_PARAM (0x03) /* Software function setting */
#define USBD_FUNC_FIFOAREA_PARAM (0x04) /* Endpoint area setting */
#define USBD_FUNC_BULKONLY_PARAM (0x06) /* Setting for BulkOnly H/W support */
/*--- USBD_FuncStart -------------------------------------------------------*/
#define USBD_FUNC_ATTACH_NORMAL (0x00) /* Normal attach mode */
#define USBD_FUNC_ATTACH_FORCEFS (0x01) /* Force FS mode */
/*--- USBD_Func{Get/Set}DescriptorInfo{Address} ----------------------------*/
#define USBD_FUNC_DT_DEVICE (0x01) /* Device Descriptor */
#define USBD_FUNC_DT_CONFIG (0x02) /* Configuration Descriptor */
#define USBD_FUNC_DT_STRING (0x03) /* String Descriptor */
#define USBD_FUNC_DT_INTERFACE (0x04) /* Interface Descriptor */
#define USBD_FUNC_DT_ENDPOINT (0x05) /* Endpoint Descriptor */
#define USBD_FUNC_DT_DEVICE_QUAL (0x06) /* Device Qualifier */
#define USBD_FUNC_DT_OTHER_SPEED_CONFIG (0x07) /* Other Speed Configuration Descriptor */
/*--- USBD_FuncGetStatus ---------------------------------------------------*/
#define USBD_FUNC_BUS_EVENT (0x01) /* USB Bus Event */
#define USBD_FUNC_BE_RESET (0x00000010) /* Reset occurred */
#define USBD_FUNC_BE_RESUME (0x00000008) /* Resume occurred */
#define USBD_FUNC_BE_SUSPEND (0x00000004) /* Suspend occurred */
#define USBD_FUNC_BE_ATTCHG (0x00000002) /* State change of Attach, Detach */
#define USBD_FUNC_BE_VBUS (0x00000001) /* State change of VBUS */
/* USB Packet Event */
#define USBD_FUNC_PACKET_EVENT (0x02) /* USB Packet Event */
#define USBD_FUNC_PE_SETUP (0x00000002) /* SETUP packet reception */
#define USBD_FUNC_PE_SOF (0x00000001) /* SOF packet reception */
/* USB Bus Status */
#define USBD_FUNC_BUS_STATUS (0x03) /* USB Bus Status */
#define USBD_FUNC_BS_TESTMODE (0x00000080) /* Test Mode is on executing */
#define USBD_FUNC_BS_REMOTEWAKEUP (0x00000040) /* In Remote Wakeup */
#define USBD_FUNC_BS_RESET (0x00000020) /* In Reset */
#define USBD_FUNC_BS_RESUME (0x00000010) /* In Resume */
#define USBD_FUNC_BS_SUSPEND (0x00000008) /* In Suspend */
#define USBD_FUNC_BS_HSMODE (0x00000004) /* HS Mode operating */
#define USBD_FUNC_BS_VBUS (0x00000001) /* VBUS state */
#define USBD_FUNC_VBUS_LOW (0) /* VBUS Low */
#define USBD_FUNC_VBUS_HIGH (1) /* VBUS High */
/* Function Execute Status */
#define USBD_FUNC_EXEC_STATUS (0x04) /* Function's running state */
#define USBD_FUNC_ES_STARTDMA (0x00000010) /* USBD_FuncStartEPxDMATransfer() */
#define USBD_FUNC_ES_PIOTRN (0x00000008) /* USBD_FuncEPxPIOTransferA() */
#define USBD_FUNC_ES_PIOSIMTRN (0x00000004) /* USBD_FuncEPxPIOSimpleTransferA() */
#define USBD_FUNC_ES_SSTAGE (0x00000002) /* USBD_FuncStatusStageReadyA() */
#define USBD_FUNC_ES_REMOTEWAKE (0x00000001) /* USBD_FuncSendRemoteWakeupA() */
/*--- USBD_Func{Get/Set}EPxControl ------------------------------------------*/
#define USBD_FUNC_CE_FIFOCLEAR (0x80) /* FIFO Clear */
#define USBD_FUNC_CE_TOGGLE (0x10) /* Change of Toggle Bit */
#define USBD_FUNC_CE_AUTO_SHORT_NAKMODE (0x08) /* NAK automatic setting for Short Pkt reception */
#define USBD_FUNC_CE_ENBSHORT (0x04) /* ShortPkt transfer is effective */
#define USBD_FUNC_CE_NAKMODE (0x02) /* NAK reply setting */
#define USBD_FUNC_CE_STALLMODE (0x01) /* STALL reply setting */
#define USBD_FUNC_FLAG_CLR (0x00) /* Clear Bit */
#define USBD_FUNC_FLAG_SET (0x01) /* Set Bit */
/*--- USBD_FuncGetEPxStatus ------------------------------------------------*/
#define USBD_FUNC_SE_OUT_SHORT_ACK (0x08) /* OUT Short ACK */
#define USBD_FUNC_SE_ACK (0x04) /* ACK */
#define USBD_FUNC_SE_NAK (0x02) /* NAK */
#define USBD_FUNC_SE_STALL (0x01) /* STALL */
#define USBD_FUNC_FLAG_NOTCLR (0x02) /* Do not Clear */
/*--- USBD_FuncSetEPxIntEvent ----------------------------------------------*/
#define USBD_FUNC_IE_FIFOFULL (0x80) /* FIFO Full notification is effective */
#define USBD_FUNC_IE_FIFOEMPTY (0x40) /* FIFO Empty notification is effective */
#define USBD_FUNC_IE_OUT_SHORT_ACK (0x08) /* OUT Short ACK */
#define USBD_FUNC_IE_ACK (0x04) /* OUT ACK */
#define USBD_FUNC_IE_NAK (0x02) /* OUT NAK */
#define USBD_FUNC_IE_STALL (0x01) /* OUT STALL */
/*--- USBD_FuncEnterTestModeA ----------------------------------------------*/
#define USBD_FUNC_TEST_J (0x01) /* Test J */
#define USBD_FUNC_TEST_K (0x02) /* Test K */
#define USBD_FUNC_TEST_SE0NAK (0x03) /* SE0 NAK */
#define USBD_FUNC_TEST_PACKET (0x04) /* Test Packet */
/*--- USBD_FuncSetEPxTransferMode ------------------------------------------*/
#define USBD_FUNC_ENB_SHORTPKT_MODE (0x00) /* ShortPkt transfer mode */
#define USBD_FUNC_DIS_SHORTPKT_MODE (0x01) /* Mode of ShortPkt no transfer */
/*--- USBD_FuncSetEPxTransferParam -----------------------------------------*/
#define USBD_FUNC_EPX_PIO_32 (32)
#define USBD_FUNC_EPX_PIO_64 (64)
#define USBD_FUNC_EPX_PIO_128 (128)
#define USBD_FUNC_EPX_PIO_256 (256)
#define USBD_FUNC_EPX_PIO_512 (512)
/*--- USBD_FuncSetEPxJoinDMA ----------------------------------------------*/
#define USBD_FUNC_DMACH0 (0) /* DMA Channel 0 */
#define USBD_FUNC_DMACH1 (1) /* DMA Channel 1 */
#define USBD_FUNC_DMACH2 (2) /* DMA Channel 2 */
#define USBD_FUNC_ENABLE (1)
#define USBD_FUNC_DISABLE (0)
/*--- USBD_FuncSetBulkOnlyMode --------------------------------------------*/
#define USBD_FUNC_CBWMODE (1)
#define USBD_FUNC_CSWMODE (2)
#define USBD_FUNC_CBW_CMP_EVENT (0x0001) /* CBW reception */
#define USBD_FUNC_CBW_LENERR_EVENT (0x0002) /* CBW Length Error */
#define USBD_FUNC_CBW_ERR_EVENT (0x0003) /* CBW Error */
#define USBD_FUNC_CSW_CMP_EVENT (0x0004) /* CSW transfer */
#define USBD_FUNC_CSW_ERR_EVENT (0x0005) /* CSW Error */
/*=== Structure ===========================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -