csl_usbf.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 1,251 行 · 第 1/4 页
H
1,251 行
/** @mainpage USBF CSL 3.x
*
* @section Introduction
*
* @subsection xxx Purpose and Scope
* The purpose of this document is to identify a set of common CSL APIs for the
* USBF module across various devices. The CSL developer is expected to refer to
* this document while designing APIs for these modules. Some of the listed APIs
* may not be applicable to a given USBF module. While in other cases this list
* of APIs may not be sufficient to cover all the features of a particular USBF
* Module. The CSL developer should use his discretion in designing new APIs or
* extending the existing ones to cover these.
*
* @subsection aaa Terms and Abbreviations
* -# CSL: Chip Support Library
* -# API: Application Programmer Interface
*
* @subsection References
* -# CSL-001-DES, CSL 3.x Design Specification DocumentVersion 1.02
* -# 1610 TRM, Chapter on Universal Serial Bus, Section on USB Device Controller
*
*/
/** @file csl_usbf.h
*
* @brief Header file for functional layer of CSL
*
* Description
* - The different enumerations, structure definitions
* and function declarations
*/
/*
* Modification 3
* - modified on: 17/02/2004
* - reason: Added status object structure, commands and queries
*
* Modification 2
* - modified on: 15/02/2004
* - reason: Added setup object structure
*
* Modification 1
* - modified on: 11/02/2004
* - reason: Created the initail file
*
* @date 11th Feb, 2004
* @author Prakash V. Gudnavar.
*/
#ifndef _CSL_USBF_H_
#define _CSL_USBF_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <csl.h>
#include <cslr_usbf.h>
#include <soc.h>
/**************************************************************************\
* USBF global macro declarations
\**************************************************************************/
/* Macros - events, used for
* a. Interrupt Source
* b. Interrupt Enable
* c. Interrupt Disable
*/
/** @defgroup CSL_USBF_IRQ_SRC_<SYMBOL> Symbols for __irq sources
* @ingroup CSL_USBF_CONTROL_API and CSL_USBF_QUERY_IRQ_SRC API
*
*
* @{ */
/** The transmit DMA channel n done __irq */
#define CSL_USBF_IRQ_SRC_TXN_DONE (1 << 10)
/** The receive DMA channel n transactions count __irq */
#define CSL_USBF_IRQ_SRC_RXN_CNT (1 << 9)
/** 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*/
Uint16 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 */
Uint8 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 */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?