⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drv_usb.h

📁 基于omap5912平台的usb设备驱动源程序
💻 H
📖 第 1 页 / 共 5 页
字号:
/** The receive DMA channel n end of transfer __irq */
#define CSL_USBF_IRQ_SRC_RXN_EOT				(1 << 8)
/** Start of frame __irq */
#define CSL_USBF_IRQ_SRC_SOF					(1 << 7)
/** The EPn OUT transactions __irq (Concerns Non-ISO endpoints only)*/
#define CSL_USBF_IRQ_SRC_EPN_RX					(1 << 5)
/** The EPn IN transactions __irq (Concerns Non-ISO endpoints only)*/
#define CSL_USBF_IRQ_SRC_EPN_TX					(1 << 4)
/** Device status changed __irq */
#define CSL_USBF_IRQ_SRC_DS_CHG					(1 << 3)
/** Setup transaction __irq flag */
#define CSL_USBF_IRQ_SRC_SETUP					(1 << 2)
/** EP0 OUT transactions __irq */
#define CSL_USBF_IRQ_SRC_EP0_RX					(1 << 1)
/** EP0 IN transactions __irq */				
#define CSL_USBF_IRQ_SRC_EP0_TX					(1 << 0)	
/** All __irq sources */				
#define CSL_USBF_IRQ_SRC_ALL					0x07BF
/** 
@} */

/** @defgroup CSL_USBF_IE_<SYMBOL> Symbols for __irq enable 
*   @ingroup CSL_USBF_CONTROL_API CSL_USBF_QUERY_API
*   
*
* @{ */
/** Start of frame __irq */
#define CSL_USBF_IE_SOF						(1 << 7)
/** The EPn OUT transactions __irq (Concerns Non-ISO endpoints only)*/
#define CSL_USBF_IE_EPN_RX					(1 << 5)
/** The EPn IN transactions __irq (Concerns Non-ISO endpoints only)*/
#define CSL_USBF_IE_EPN_TX					(1 << 4)
/** Device status changed __irq */
#define CSL_USBF_IE_DS_CHG					(1 << 3)
/** EP0 IN transactions __irq */				
#define CSL_USBF_IE_EP0						(1 << 0)	
/** All __irq sources */				
#define CSL_USBF_IE_ALL						(CSL_USBF_IE_SOF | CSL_USBF_IE_EPN_RX | \
													CSL_USBF_IE_EPN_TX | CSL_USBF_IE_DS_CHG |CSL_USBF_IE_EP0) 
/** 
@} */

/** @defgroup CSL_USBF_DMA_IE_<SYMBOL> Symbols for __irq enable 
*   @ingroup CSL_USBF_CONTROL_API CSL_USBF_QUERY_API
*   
*
* @{ */
/** Transmit channel 2 done __irq */
#define CSL_USBF_DMA_IE_TX2_DONE			(1 << 10)
/** Receive channel 2 transactions count __irq */
#define CSL_USBF_DMA_IE_RX2_CNT				(1 << 9)
/** Receive channel 2 end of transfer __irq */
#define CSL_USBF_DMA_IE_RX2_EOT				(1 << 8)
/** Transmit channel 1 done __irq */
#define CSL_USBF_DMA_IE_TX1_DONE			(1 << 6)
/** Receive channel 1 transactions count __irq */
#define CSL_USBF_DMA_IE_RX1_CNT				(1 << 5)
/** Receive channel 1 end of transfer __irq */
#define CSL_USBF_DMA_IE_RX1_EOT				(1 << 4)
/** Transmit channel 0 done __irq */
#define CSL_USBF_DMA_IE_TX0_DONE			(1 << 2)
/** Receive channel 0 transactions count __irq */
#define CSL_USBF_DMA_IE_RX0_CNT				(1 << 1)
/** Receive channel 0 end of transfer __irq */
#define CSL_USBF_DMA_IE_RX0_EOT				(1 << 0)

/** 
@} */
/**************************************************************************\
* USBF global typedef declarations
\**************************************************************************/

/** @brief Enumeration for USBF DMA instances
 *
 * These are the serial numbers of USBF DMAs DMAs. The numbers refer both Transfer DMA and Recieve DMA */
typedef enum CSL_UsbfDmaNum {
    /** USB Function DMA tranmist/receive channel 0 */
    CSL_USBF_DMANUM_0 = 0,  
    /** USB Function DMA tranmist/receive channel 1 */
    CSL_USBF_DMANUM_1,       
    /** USB Function DMA tranmist/receive channel 2 */
    CSL_USBF_DMANUM_2       
} CSL_UsbfDmaNum;    

/** @brief Enumeration for endpoint numbers 
 *
 * These are the serial numbers of endpoints in the USB Function */
typedef enum CSL_UsbfEpNum {
    /** OUT endpoint 0 */
    CSL_USBF_OUT_EP0 = 0, 
    /** OUT endpoint 1 */
    CSL_USBF_OUT_EP1,     
    /** OUT endpoint 2 */
    CSL_USBF_OUT_EP2,     
    /** OUT endpoint 3 */
    CSL_USBF_OUT_EP3,     
    /** OUT endpoint 4 */
    CSL_USBF_OUT_EP4,     
    /** OUT endpoint 5 */
    CSL_USBF_OUT_EP5,     
    /** OUT endpoint 6 */
    CSL_USBF_OUT_EP6,     
    /** OUT endpoint 7 */
    CSL_USBF_OUT_EP7,     
    /** OUT endpoint 8 */
    CSL_USBF_OUT_EP8,                         
    /** OUT endpoint 9 */
    CSL_USBF_OUT_EP9,     
    /** OUT endpoint 10 */
    CSL_USBF_OUT_EP10,    
    /** OUT endpoint 11 */
    CSL_USBF_OUT_EP11,    
    /** OUT endpoint 12 */
    CSL_USBF_OUT_EP12,    
    /** OUT endpoint 13 */
    CSL_USBF_OUT_EP13,    
    /** OUT endpoint 14 */
    CSL_USBF_OUT_EP14,    
    /** OUT endpoint 15 */
    CSL_USBF_OUT_EP15,     
    
    /** IN endpoint 0 */
    CSL_USBF_IN_EP0 = 16,     
    /** IN endpoint 1 */
    CSL_USBF_IN_EP1 = 17,     
    /** IN endpoint 2 */
    CSL_USBF_IN_EP2,     
    /** IN endpoint 3 */
    CSL_USBF_IN_EP3,     
    /** IN endpoint 4 */
    CSL_USBF_IN_EP4,     
    /** IN endpoint 5 */
    CSL_USBF_IN_EP5,     
    /** IN endpoint 6 */
    CSL_USBF_IN_EP6,     
    /** IN endpoint 7 */
    CSL_USBF_IN_EP7,     
    /** IN endpoint 8 */
    CSL_USBF_IN_EP8,                         
    /** IN endpoint 9 */
    CSL_USBF_IN_EP9,     
    /** IN endpoint 10 */
    CSL_USBF_IN_EP10,    
    /** IN endpoint 11 */
    CSL_USBF_IN_EP11,    
    /** IN endpoint 12 */
    CSL_USBF_IN_EP12,    
    /** IN endpoint 13 */
    CSL_USBF_IN_EP13,    
    /** IN endpoint 14 */
    CSL_USBF_IN_EP14,    
    /** IN endpoint 15 */
    CSL_USBF_IN_EP15     
}CSL_UsbfEpNum ;    
    
/*****************************************************************************/

/*****************************************************************************/
/** @brief Enumeration for DMA transfer size  */
typedef enum CSL_UsbfDmaTxSize {
    /** Transfer size is in buffers */
    CSL_USBF_DMATXSIZE_BUFFERS = 0,     
    /** Transfer size is in bytes */
    CSL_USBF_DMATXSIZE_BYTES            
} CSL_UsbfDmaTxSizeType;

/** @brief Enumerations for DMA request type */
typedef enum CSL_UsbfDmaReqType {
    /** DMA request active level */
    CSL_USBF_USBFDMAREQTYPE_LEVEL = 0,  
    /** DMA request active pulse */
    CSL_USBF_USBFDMAREQTYPE_PULSE       
}CSL_UsbfDmaReqType ;

/** @brief Structure that is used to setup a DMA transmit channel 
 *
 * This structure is part of DMA setup */
typedef struct CSL_UsbfDmaTxChanSetup {
    /** Transmit endpoint number for DMA channel */
    CSL_UsbfEpNum   chanEpNum ;                     
    /** DMA transfer size */
    CSL_UsbfDmaTxSizeType txSizeType ;   
    /** Transmit DMA channel n transfer size counter : Valid values ==> 0 to 1023*/
    INT16U  txSize ;                  
} CSL_UsbfDmaTxChanSetup;

/** @brief Structure that is used to setup a DMA transmit channel 
 *
 * This structure is part of DMA setup */
typedef struct CSL_UsbfDmaRxChanSetup {
    /** Receive endpoint number for DMA channel */
    CSL_UsbfEpNum  chanEpNum ;             
    /** Receive DMA channel n transactions count */
    INT8U   transactionCount ;      
} CSL_UsbfDmaRxChanSetup;

/** @brief Structure that is used to setup a DMA receive channel 
 *
 * This structure is used setup DMA channels */
typedef struct CSL_UsbfDmaSetup {
    /** TX DMA request type */
    CSL_UsbfDmaReqType      txRequestType;   
    /** Setup for transmit channels */
    CSL_UsbfDmaTxChanSetup  *txChanSetup[3] ; 
    /** RX DMA request type */
    CSL_UsbfDmaReqType      rxRequestType;   
    /** Setup for recieve channels */
    CSL_UsbfDmaRxChanSetup  *rxChanSetup[3] ; 
} CSL_UsbfDmaSetup; 

/*****************************************************************************/

/*****************************************************************************/

/** @brief Enumerations for endpoint size */
typedef enum CSL_UsbfEpSize {
    /** Size is 8 bytes */
    CSL_USBF_EPSIZE_8BYTES = 0,     
    /** Size is 16 bytes */
    CSL_USBF_EPSIZE_16BYTES,
    /** Size is 32 bytes */
    CSL_USBF_EPSIZE_32BYTES,
    /** Size is 64 bytes */
    CSL_USBF_EPSIZE_64BYTES,    
    /** Size is 128 bytes; Valid for ISO EPs only */
    CSL_USBF_EPSIZE_128BYTES,   
    /** Size is 256 bytes; Valid for ISO EPs only */
    CSL_USBF_EPSIZE_256BYTES,   
    /** Size is 512 bytes; Valid for ISO EPs only */
    CSL_USBF_EPSIZE_512BYTES,   
    /** Size is 1023 bytes; Valid for ISO EPs only */
    CSL_USBF_EPSIZE_1023BYTES  
} CSL_UsbfEpSize;

/** @brief Enumerations for endpoint type */
typedef enum CSL_UsbfEpType {
	/** Bulk or __irq endpoint */
	CSL_USBF_EPTYPE_NON_ISO = 0,
	/** Isochronous endpoint */
	CSL_USBF_EPTYPE_ISO = 1
} CSL_UsbfEpType;	

/** @brief Structure that is used to setup endpoint 0 
 *
 * This structure is part of endpoint setup */
typedef struct CSL_UsbfEp0Properties {
    /** Endpoint 0 FIFO size */
    CSL_UsbfEpSize size ;
    /** The address of the endpoint 0 pointer */
    INT8U          ptr ;       
} CSL_UsbfEp0Properties;

/** @brief Structure that is used to setup endpoints other than endpoint 0 
 *
 * This structure is part of endpoint setup */
typedef struct CSL_UsbfEpProperties {
    /** Is endpoint valid fopr USB transfers? */
    Bool valid ;
    /** Endpoint buffering. Valid only if endpoint is Non-ISO */
    Bool doubleBuffered;
    /** Endpoint FIFO size value */         
    CSL_UsbfEpSize size ;
    /** Endpoint type: Isochronous OR bulk or __irq */
    CSL_UsbfEpType type;
    /** Address of endpoint pointer */
    INT16U          ptr ; 
} CSL_UsbfEpProperties;

/** @brief Structure that is used to setup endpoints */
typedef struct CSL_UsbfEpSetup {
    /** Endpoint 0 setup */
    CSL_UsbfEp0Properties  *ep0 ;
    /** Recieve endpoints setup */
    CSL_UsbfEpProperties   *rxEp[15]; 
    /** Transmit endpoints setup */
    CSL_UsbfEpProperties   *txEp[15]; 
} CSL_UsbfEpSetup;

/** @brief Enumerations for endianness */
typedef enum CSL_UsbfEndian {
    /** Little endian */
    CSL_USBF_ENDIAN_LITTLE,
    /** Big endian */
    CSL_USBF_ENDIAN_BIG
} CSL_UsbfEndian;

/** @brief Structure that is used for system configuration */ 
typedef struct CSL_UsbfSystemSetup {
    /** Device configuration lock */
    Bool cfgLocked ;
    /** Data endianness */
    CSL_UsbfEndian dataEndian;
    /** DMA data endianness */
    CSL_UsbfEndian dmaEndian;
    /** NAK enabling */
    Bool nakEnabled;
    /** Auto deocde process activation */
    Bool noAutoDecode;
    /** Device self powered or not */
    Bool selfPowered;
    /** Power shutoff circuitry setting */
    Bool powershutoffDisabled;
    /** Device connectivity to USB bus */
    Bool deviceConnected;
} CSL_UsbfSystemSetup;

 
/** @brief Structure that is used to setup USB Function overall*/ 
typedef struct CSL_UsbfHwSetup {
    /** Endpoint setup */
    CSL_UsbfEpSetup     *epSetup ;
    /** DMA setup */
    CSL_UsbfDmaSetup    *dmaSetup;
    /** System configuration */
    CSL_UsbfSystemSetup *systemSetup;   
} CSL_UsbfHwSetup;

/**
 * @brief   Default values for the ep0properties
 */
#define CSL_USBF_EP0PROPERTIES_DEFAULTS {     \
        (CSL_UsbfEpSize)CSL_USBF_EP0_SIZE_RESETVAL,       \
        CSL_USBF_EP0_PTR_RESETVAL          \
        }
        
/**
 * @brief   Default values for the Rxepproperties
 */
#define CSL_USBF_RXEP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -