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

📄 csl_spi.h

📁 ccs下对dm6446的测试程序
💻 H
📖 第 1 页 / 共 3 页
字号:
    /** SCS2 pin */    CSL_SPI_PINTYPE_SCS2  =  CSL_FMKT(SPI_SPIPC0_SCSFUN2, SPI),    /** SCS1 pin */    CSL_SPI_PINTYPE_SCS1  =  CSL_FMKT(SPI_SPIPC0_SCSFUN1, SPI),    /** SCS0 pin */    CSL_SPI_PINTYPE_SCS0  =  CSL_FMKT(SPI_SPIPC0_SCSFUN0, SPI)} CSL_SpiPinType;/** @brief enumeration to control DMA enabling in compatibility mode */typedef enum {    /** enable dma servicing in compatibility mode */    CSL_SPI_CPTDMA_ENABLE   =  CSL_SPI_SPIINT0_DMAREQ_ENABLE,    /** disable dma servicing in compatibility mode */    CSL_SPI_CPTDMA_DISABLE  =  CSL_SPI_SPIINT0_DMAREQ_DISABLE} CSL_SpiCptDma;/** @brief enumeration to control reset of transfer mechnism of Spi */typedef enum {    /** enable spi to begin transfers */    CSL_SPI_XFEREN_DISABLE  =  CSL_SPI_SPIGCR1_SPIEN_INRESET,    /** hold spi transfer mechanism in reset */    CSL_SPI_XFEREN_ENABLE   =  CSL_SPI_SPIGCR1_SPIEN_ACTIVE} CSL_SpiXferEn;/** @brief this object contains the reference to the instance of SPI *         opened using the @a CSL_spiOpen() * * An object related to this structure is passed to all SPI CSL APIs * as the first argument */typedef struct CSL_SpiObj {    /** This is a pointer to the registers of the instance of SPI referred     *  to by this object     */    CSL_SpiRegsOvly  regs;    /** This is the instance of SPI being referred to by this object */    CSL_InstNum       perNum;} CSL_SpiObj;/** @brief This will have the base-address information for the peripheral *         instance */typedef struct {    /** Base-address of the Configuration registers of SPI. */    CSL_SpiRegsOvly regs;} CSL_SpiBaseAddress;/** @brief SPI specific parameters. Present implementation doesn't have *         any specific parameters. */typedef struct {    /** Bit mask to be used for module specific parameters.     *  The below declaration is just a place-holder for future     *  implementation.     */    CSL_BitMask16   flags;} CSL_SpiParam;/** @brief SPI specific context information. Present implementation doesn't *         have any Context information. */typedef struct {    /** Context information of SPI.     *  The below declaration is just a place-holder for future     *  implementation.     */    Uint16  contextInfo;} CSL_SpiContext;/** @brief SPI Config structure */typedef struct  {    /** SPI Global Control Register 0 */    volatile Uint32 SPIGCR0;    /** SPI Global Control Register 1 */    volatile Uint32 SPIGCR1;    /** SPI Interrupt register */    volatile Uint32 SPIINT0;    /** SPI Interrupt Level Register */    volatile Uint32 SPILVL;    /** SPI Flag Register */    volatile Uint32 SPIFLG;    /** SPI Pin Control Register 0 */    volatile Uint32 SPIPC0;    /** SPI Pin Control Register 1 */    volatile Uint32 SPIPC1;    /** SPI Pin Control Register 2 */    volatile Uint32 SPIPC2;    /** SPI Pin Control Register 3 */    volatile Uint32 SPIPC3;    /** SPI Pin Control Register 4 */    volatile Uint32 SPIPC4;    /** SPI Pin Control Register 5 */    volatile Uint32 SPIPC5;    /** SPI Pin Control Register 6 */    volatile Uint32 SPIPC6;    /** SPI Pin Control Register 7 */    volatile Uint32 SPIPC7;    /** SPI Pin Control Register 8 */    volatile Uint32 SPIPC8;    /** SPI Shift Register */    volatile Uint32 SPIDAT0;    /** SPI Shift Register */    volatile Uint32 SPIDAT1;    /** SPI Delay Register */    volatile Uint32 SPIDELAY;    /** SPI Default Chip Select Register */    volatile Uint32 SPIDEF;    /** SPI Data Format Registers */    volatile Uint32 SPIFMT[4];    /** MibSPI Enable Register */    volatile Uint32 MIBSPIE;} CSL_SpiConfig;/** @brief Default Values for Config structure */#define CSL_SPI_CONFIG_DEFAULTS {  \    CSL_SPI_SPIGCR0_RESETVAL,      \    CSL_SPI_SPIGCR1_RESETVAL,      \    CSL_SPI_SPIINT0_RESETVAL,      \    CSL_SPI_SPILVL_RESETVAL,       \    CSL_SPI_SPIFLG_RESETVAL,       \    CSL_SPI_SPIPC0_RESETVAL,       \    CSL_SPI_SPIPC1_RESETVAL,       \    CSL_SPI_SPIPC2_RESETVAL,       \    CSL_SPI_SPIPC3_RESETVAL,       \    CSL_SPI_SPIPC4_RESETVAL,       \    CSL_SPI_SPIPC5_RESETVAL,       \    CSL_SPI_SPIPC6_RESETVAL,       \    CSL_SPI_SPIPC7_RESETVAL,       \    CSL_SPI_SPIPC8_RESETVAL,       \    CSL_SPI_SPIDAT0_RESETVAL,      \    CSL_SPI_SPIDAT1_RESETVAL,      \    CSL_SPI_SPIDELAY_RESETVAL,     \    CSL_SPI_SPIDEF_RESETVAL,       \    {                              \        CSL_SPI_SPIFMT_RESETVAL,   \        CSL_SPI_SPIFMT_RESETVAL,   \        CSL_SPI_SPIFMT_RESETVAL,   \        CSL_SPI_SPIFMT_RESETVAL    \    },                             \    CSL_SPI_MIBSPIE_RESETVAL       \}/** @brief a pointer to @a CSL_SpiObj; this is passed to all SPI CSL APIs */typedef struct CSL_SpiObj *CSL_SpiHandle;/** @brief sets up the properties if the pins of Spi * * This object is used to setup or get the setup of the pins in Spi */typedef struct {    /** decides if the pins will be Spi or GPIO */    Uint32  *func;    /** if GPIO, decides the directions of the pins */    Uint32  *dir;    /** if configured as GPIO output, decides if the pull control is to     *  be turned on     */    Uint32  *pullCtrl;    /** if configured as GPIO output, decides if the pin should output     *  logic 1 or tristate     */    Uint32  *opnDrain;} CSL_SpiHwSetupPins;/** @brief sets up the format selection for a set of transfers * * This object is used to setup or get the setup of the format selection * for a set of transfers */typedef struct {    /** decides if chip select is to be held active between transfers */    CSL_SpiCsHold    csHold;    /** decides if delay specified in the selected format must be allowed     *  between 2 consecutive transfers     */    CSL_SpiWDelayEn  wDel;    /** decides which format to select */    CSL_SpiFmtSel    fmtSel;    /** defines the chip select that will be activated for the transfer */    Uint8            cSel;} CSL_SpiHwSetupFmtCtrl;/** @brief sets up the Spi for compatibility mode * * This structure is used to setup or get the setup of Spi in comaptibility * mode */typedef struct {    /** selects if interrupts should go to lines INT0 or INT1 */    Uint32                 *lvl;    /** selects the format & associated controls */    CSL_SpiHwSetupFmtCtrl  *fmtCtrlPtr;} CSL_SpiHwSetupCpt;/** @brief sets up the a formatting for an outgoing word * * This object is used to set up or get the setup of the format registers in * Spi */typedef struct {    /** delay between 2 consecutive words */    Uint8             wDelay;    /** the factor with which to multiply functional clock in order to get the     *  serial clock     */    Uint8             preScale;    /** the length of the word to be transmitted and/or received */    Uint8             charLen;    /** if in master mode; whether Spi should wait for ENA from slave */    CSL_SpiWaitEn     waitEna;    /** whether parity should be enabled; if enabled then even or odd */    CSL_SpiParity     parity;    /** whether clock should be high or low when inactive */    CSL_SpiPolarity   polarity;    /** whether data should be in phase of 1/2 cycle ahead of the clock */    CSL_SpiPhase      phase;    /** whether LSB or MSB should be shifted first */    CSL_SpiShDir      shiftDir;} CSL_SpiHwSetupPriFmt;/** @brief sets up the parameters to be setup in priority mode * * This object is used to setup or get the setup of the parameters to be setup * in priority mode */typedef struct {    /** array of pointers to structures of formats of an outgoing word */    CSL_SpiHwSetupPriFmt  *fmt[4];} CSL_SpiHwSetupPri;/** @brief sets up the parameters that are needed by multi-buffer as well as * compatibility modes * * This objetc is used to set up or get the setup of parameters that are needed * by multi-buffer as well as compatibility modes */typedef struct {    /** whether to use Spi in compatibility mode or multi-buffer mode */    CSL_SpiProtocol      protocol;    /** master or slave mode */    CSL_SpiOpMod         opMode;    /** whether ENA signal should be tristated when inactive or if it should     * bear a value     */    CSL_SpiEnaHiZ        enaHiZ;    /** the default value on Chip select when inactive */    Uint8                csDefault;    /** Chip-select-active-to-transmit-start-delay */    Uint8                c2tDelay;    /** Transmit-end-to-chip-select-inactive-delay */    Uint8                t2cDelay;    /** Transmit-data-finished-to-ENA-pin-inactive-time-out */    Uint8                t2eTmout;    /** Chip-select-active-to-ENA-signal-active-time-out */    Uint8                c2eTmout;} CSL_SpiHwSetupGen;/** @brief main structure that is used to setup the SPI * * This structure is used to setup or obtain the existing setup of SPI * using @a CSL_spiHwSetup() & @a CSL_spiGetHwStatus() functions * respectively. If a particular member pointer is null, then these functions * do not setup or get the setup of the corresponding part of SPI * respectively */typedef struct {    /** This pointer to @a CSL_SpiHwSetupCommon is used to hold     *  information on the common part of the SPI setup     */    CSL_SpiHwSetupGen   *genPtr;    /** This pointer to @a CSL_SpiHwSetupFifo is used to hold information     *  on the data FIFO part of the SPI setup     */    CSL_SpiHwSetupPri   *priPtr;    /** This pointer to @a CSL_SpiHwSetupSdio is used to hold information     *  on the SDIO part of the SPI setup     */    CSL_SpiHwSetupCpt   *cptPtr;    /** This pointer to @a CSL_SpiHwSetupSdio is used to hold information     *  on the SPI part of the SPI setup     */    CSL_SpiHwSetupPins  *pinsPtr;} CSL_SpiHwSetup;/** @brief gets the information for interrupt vectors */typedef struct {    /** interrupt vector number */    Uint8  intVal;    /** status of suspend */    Bool   suspend;} CSL_SpiIntVec;/** @brief gets the status of buffer after a transfer */typedef struct {    /** status as a bit-vector of the different events */    Uint8  status;    /** status of the chip select during last transfer */    Uint8  cSel;} CSL_SpiBufStat;/** @brief gets the status of buffer register */typedef struct {    /** Place to hold the data */    Uint16          data;    /** Place to hold the status */    CSL_SpiBufStat *bufStat;} CSL_SpiCptData;/** @brief default setting for @a CSL_SpiHwSetup */#define CSL_SPI_HWSETUP_DEFAULTS { \    NULL,                          \    NULL,                          \    NULL,                          \    NULL                           \}/** @brief default setting for @a CSL_SpiHwSetupGen */#define CSL_SPI_HWSETUP_GEN_DEFAULTS { \    CSL_SPI_PROTOCOL_COMPATIBLE,       \    CSL_SPI_OPMOD_SLAVE,               \    CSL_SPI_ENAHIZ_NO,                 \    0,                                 \    0,                                 \    0,                                 \    0,                                 \    0                                  \}/** @brief default setting for @a CSL_SpiHwSetupPri */#define CSL_SPI_HWSETUP_PRI_DEFAULTS { \    {                                  \        NULL,                          \        NULL,                          \        NULL,                          \        NULL                           \    }                                  \}/** @brief default setting for @a CSL_SpiHwSetupPriFmt */#define CSL_SPI_HWSETUP_PRI_FMT_DEFAULTS { \    0,                                     \    0,                                     \    0,                                     \    CSL_SPI_WAITEN_NO,                     \    CSL_SPI_PARITY_DISABLE,                \    CSL_SPI_POLARITY_INACTIVELO,           \    CSL_SPI_PHASE_IN,                      \    CSL_SPI_SHDIR_LSBFIRST                 \}/** @brief default setting for @a CSL_SpiHwSetupCpt */#define CSL_SPI_HWSETUP_CPT_DEFAULTS { \    NULL,                              \    NULL                               \}/** @brief default setting for @a CSL_SpiHwSetupFmtCtrl */#define CSL_SPI_HWSETUP_FMTCTRL_DEFAULTS { \    CSL_SPI_CSHOLD_NO,                     \    CSL_SPI_WDELAYEN_NO,                   \    CSL_SPI_FMTSEL_0,                      \    0                                      \}/** @brief default setting for @a CSL_SpiHwSetupPins */#define CSL_SPI_HWSETUP_PINS_DEFAULTS { \    NULL,                               \    NULL,                               \    NULL,                               \    NULL                                \}/******************************************************************************* * SPI global function declarations ******************************************************************************//** ============================================================================ *   @n@b CSL_spiOpen * *   @b Description *   @n This function populates the peripheral data object for the SPI instance *        and returns a handle to the instance. *        The open call sets up the data structures for the particular instance *        of SPI device. The device can be re-opened anytime after it has been *      normally closed if so required. The handle returned by this call is *      input as an essential argument for rest of the APIs described *      for this module. * *   @b Arguments *   @verbatim            spiObj          Pointer to SPI object.            spiNum          Instance of SPI CSL to be opened.            pSpiParam       Module specific parameters.

⌨️ 快捷键说明

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