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

📄 csl_mcbsp.h

📁 Dm6455 driver,magbe useful to you!
💻 H
📖 第 1 页 / 共 4 页
字号:

    /** Controls DX delay for XMT or sign-extension and justification for RCV */
    CSL_McbspRjustDxena     rjust_dxenable;
    
    /** Interrupt event mask */
    CSL_McbspIntMode       intEvent;
    
    /** 32-bit reversal feature */
    CSL_McbspBitReversal    wordReverse;
} CSL_McbspDataSetup;

/**
 * This is a sub-structure in @a CSL_McbspHwSetup. This structure is used for
 * configuring Clock and Frame Sync generation parameters.
 */
typedef struct CSL_McbspClkSetup {
    /** XMT frame sync mode */
    CSL_McbspFsClkMode        frmSyncTxMode;

    /** RCV frame sync mode */
    CSL_McbspFsClkMode        frmSyncRxMode;

    /** XMT clock mode */
    CSL_McbspTxRxClkMode      clkTxMode;

    /** RCV clock mode */
    CSL_McbspTxRxClkMode      clkRxMode;

    /** XMT frame sync polarity */
    CSL_McbspFsPol            frmSyncTxPolarity;

    /** RCV frame sync polarty */
    CSL_McbspFsPol            frmSyncRxPolarity;

    /** XMT clock polarity */
    CSL_McbspClkPol           clkTxPolarity;

    /** RCV clock polarity */
    CSL_McbspClkPol           clkRxPolarity;

    /** SRG frame sync pulse width */
    Uint16                    srgFrmPulseWidth;

    /** SRG frame sync period */
    Uint16                    srgFrmPeriod;

    /** SRG divide-down ratio */
    Uint16                    srgClkDivide;

    /** SRG input clock mode */
    CSL_McbspSrgClk           srgInputClkMode;

    /** SRG clock polarity */
    CSL_McbspClkPol           srgClkPolarity;

    /** SRG XMT frame-synchronisatoin mode */
    CSL_McbspTxFsMode         srgTxFrmSyncMode;

    /** SRG clock synchronisation mode */
    CSL_McbspClkgSyncMode     srgClkSync;
} CSL_McbspClkSetup;

/**
 * This is a sub-structure in @a CSL_McbspHwSetup. This structure is used 
 * for configuring the parameters global to MCBSP
 */
typedef struct CSL_McbspGlobalSetup {
    /** XMT and RCV IO enable bit */
    CSL_McbspIOMode       ioEnableMode;

    /** Digital Loopback mode */
    CSL_McbspDlbMode      dlbMode;

    /** Clock stop mode */
    CSL_McbspClkStp       clkStopMode;
} CSL_McbspGlobalSetup;

/**
 * This is a sub-structure in @a CSL_McbspHwSetup. This structure is used 
 * for configuring Multichannel mode parameters
 */
typedef struct CSL_McbspMulChSetup {
    /** RCV partition */
    CSL_McbspPartMode  rxPartition;

    /** XMT partition */
    CSL_McbspPartMode  txPartition;

    /** RCV multichannel selection mode */
    Uint16             rxMulChSel;

    /** XMT multichannel selection mode */
    Uint16             txMulChSel;

    /** RCV partition A block */
    CSL_McbspPABlk     rxPartABlk;

    /** RCV partition B block */
    CSL_McbspPBBlk     rxPartBBlk;

    /** XMT partition A block */
    CSL_McbspPABlk     txPartABlk;

    /** XMT partition B block */
    CSL_McbspPBBlk     txPartBBlk;    

} CSL_McbspMulChSetup;

/**
 * This is the Setup structure for configuring MCBSP using CSL_mcbspHwSetup() 
 * function.
 */
typedef struct CSL_McbspHwSetup {
    /** Global configuration parameters */
    CSL_McbspGlobalSetup    *global;

    /** RCV data setup related parameters */
    CSL_McbspDataSetup      *rxdataset;

    /** XMT data setup related parameters */
    CSL_McbspDataSetup      *txdataset;

    /** Clock configuration parameters */
    CSL_McbspClkSetup       *clkset;

    /** Multichannel mode configuration parameters */
    CSL_McbspMulChSetup     *mulCh;

    /** Emulation mode parameters */
    CSL_McbspEmu            emumode ;

    /** Any extra parameters, for future use */
    void                    *extendSetup;
} CSL_McbspHwSetup;

/**
 * This structure/object holds the context of the instance of MCBSP
 * opened using CSL_mcbspOpen() function.
 *
 * Pointer to this object is passed as MCBSP Handle to all MCBSP CSL APIs.
 * CSL_mcbspOpen() function intializes this structure based on the parameters
 * passed 
 */
typedef struct CSL_McbspObj {
    /** Pointer to the register overlay structure of the MCBSP */
    CSL_McbspRegsOvly    regs;

    /** Instance of MCBSP being referred by this object  */
    CSL_InstNum          perNum;
} CSL_McbspObj;

/** This is a pointer to @a CSL_McbspObj and is passed as the first
 *  parameter to all MCBSP CSL APIs
 */
typedef struct CSL_McbspObj *CSL_McbspHandle;

/**************************************************************************\
* Register Configuration Structure of MCBSP
\**************************************************************************/

/** @brief Config structure of MCBSP.
 *
 *  This is used to configure MCBSP using CSL_HwSetupRaw function
 */
typedef struct  {
    /** Config structure of MCBSP. This is used to configure MCBSP
     * using CSL_HwSetupRaw function
     */
    /** Serial Port Control Register */
    volatile Uint32 SPCR;
    /** Receive Control Register */
    volatile Uint32 RCR;
    /** Transmit Control Register */
    volatile Uint32 XCR;
    /** Sample Rate Generator Register */
    volatile Uint32 SRGR;
    /** Multichannel Control Register */
    volatile Uint32 MCR;
    /** Receive Channel Enable Register for Partition A and B */
    volatile Uint32 RCERE0;
    /** Transmit Channel Enable Register for Partition A and B */
    volatile Uint32 XCERE0;
    /** Pin Control Register */
    volatile Uint32 PCR;
    /** Receive Channel Enable Register for Partition C and D */
    volatile Uint32 RCERE1;
    /** Transmit Channel Enable Register for Partition C and D */
    volatile Uint32 XCERE1;
    /** Receive Channel Enable Register for Partition E and F */
    volatile Uint32 RCERE2;
    /** Transmit Channel Enable Register for Partition E and F */
    volatile Uint32 XCERE2;
    /** Receive Channel Enable Register for Partition G and H */
    volatile Uint32 RCERE3;
    /** Transmit Channel Enable Register for Partition G and H */    
    volatile Uint32 XCERE3;
} CSL_McbspConfig;

/** Default Values for Config structure */
#define CSL_MCBSP_CONFIG_DEFAULTS { \
    CSL_MCBSP_SPCR_RESETVAL,    \
    CSL_MCBSP_RCR_RESETVAL,     \
    CSL_MCBSP_XCR_RESETVAL,     \
    CSL_MCBSP_SRGR_RESETVAL,    \
    CSL_MCBSP_MCR_RESETVAL,     \
    CSL_MCBSP_RCERE0_RESETVAL,  \
    CSL_MCBSP_XCERE0_RESETVAL,  \
    CSL_MCBSP_PCR_RESETVAL,     \
    CSL_MCBSP_RCERE1_RESETVAL,  \
    CSL_MCBSP_XCERE1_RESETVAL,  \
    CSL_MCBSP_RCERE2_RESETVAL,  \
    CSL_MCBSP_XCERE2_RESETVAL,  \
    CSL_MCBSP_RCERE3_RESETVAL,  \
    CSL_MCBSP_XCERE3_RESETVAL   \
}

/* ************************************************************************\
 * MCBSP global function declarations
\* ************************************************************************/

/*
 * =============================================================================
 *   @func CSL_mcbspInit
 *
 *   @desc
 *      This function is idempotent i.e. calling it many times is same as
 *      calling it once. This function is only for book-keeping purpose
 *      and it doesn't touch the hardware (read/write registers) in any manner.
 *
 *   @arg pContext
 *        Context information for mcbsp
 *
 *   @ret CSL_Status
 *        CSL_SOK - Always returns 
 *
 *   @eg
 *     CSL_mcbspInit (NULL);
 * =============================================================================
 */
extern CSL_Status  CSL_mcbspInit (
    CSL_McbspContext   *pContext
);

/*
 *============================================================================
 *   @func CSL_mcbspOpen
 *
 *   @desc
 *      Reserves the specified MCBSP for use. The device can be re-opened 
 *      anytime after it has been normally closed, if so required. The MCBSP  
 *      handle returned  by this call is input as an essential argument for
 *      the rest of the APIs in MCBSP module. 
 *
 *   @arg pMcbspObj
 *        Pointer to the object that holds reference to the instance of MCBSP 
 *        requested after the call
 *
 *   @arg mcbspNum
 *        Instance of mcbsp CSL to be opened.
 *        
 *   @arg pMcbspParam
 *        Pointer to module specific parameters
 *
 *   @arg pStatus
 *        pointer for returning status of the function call
 *
 *   @ret CSL_McbspHandle
 *        Valid mcbsp instance handle will be returned 
 *        if status value is equal to CSL_SOK.
 *
 *   @eg
 *      CSL_McbspHandle     hMcbsp;
 *      CSL_McbspObj        mcbspObj;
 *      CSL_McbspHwSetup    mcbspSetup;
 *      CSL_Status          status;
 *      ...
 *      hMcbsp = CSL_mcbspOpen(&mcbspObj, CSL_MCBSP_0, NULL, &status);
 *      ...
 * ===========================================================================
 */
extern CSL_McbspHandle CSL_mcbspOpen (
    CSL_McbspObj              *pMcbspObj,
    CSL_InstNum               mcbspNum,
    CSL_McbspParam            *pMcbspParam,
    CSL_Status                *pStatus
);


/*
 *============================================================================
 *   @func CSL_mcbspClose
 *
 *   @desc
 *      Unreserves the MCBSP identified by the handle passed.
 *
 *   @arg hMcbsp
 *        Mcbsp handle
 *
 *   @ret CSL_Status
 *        CSL_SOK            - Close successful
 *        CSL_ESYS_BADHANDLE - Invalid handle
 *
 *   @eg
 *      CSL_McbspHandle     hMcbsp;
 *      CSL_McbspObj        mcbspObj;
 *      CSL_McbspHwSetup    mcbspSetup;
 *      CSL_Status          status;
 *      ...
 *      hMcbsp = CSL_mcbspOpen(&mcbspObj, CSL_MCBSP_0, NULL, &status);
 *      ...
 *      CSL_mcbspClose(hMcbsp);
 * ===========================================================================
 */
extern CSL_Status  CSL_mcbspClose (
    CSL_McbspHandle        hMcbsp
);

/*
 * =============================================================================
 *   @func CSL_mcbspHwSetup
 *
 *   @desc
 *     Configures the MCBSP using the values passed in the setup structure.
 *
 *   @arg hMcbsp
 *        Handle to the mcbsp instance
 *
 *   @arg hwSetup
 *        Pointer to hardware setup structure
 *
 *   @ret CSL_Status
 *        CSL_SOK             - Hardware setup successful
 *        CSL_ESYS_BADHANDLE  - Invalid handle
 *        CSL_ESYS_INVPARAMS  - Hardware structure is not
 *                              properly initialized
 *
 *   @eg
 *      CSL_mcbspHandle hMcbsp;
 *      CSL_McbspHwSetup hwSetup = CSL_MCBSP_HWSETUP_DEFAULTS;
 *      ...
 *
 *      // Init Successfully done
 *      ...
 *      // Open Successfully done
 *      ...
 *      CSL_mcbspHwSetup(hMcbsp, &hwSetup);
 *      ...
 * ===========================================================================
 */
extern CSL_Status  CSL_mcbspHwSetup (
    CSL_McbspHandle       hMcbsp,
    CSL_McbspHwSetup      *setup
);

/*
 * =============================================================================
 *   @func CSL_mcbspHwSetupRaw
 *
 *   @desc
 *     This function initializes the device registers with the register-values
 *     provided through the Config Data structure.
 *
 *   @arg hMcbsp
 *        Handle to the mcbsp instance
 *
 *   @arg config
 *        Pointer to config structure
 *
 *   @ret CSL_Status
 *        CSL_SOK             - Configuration successful
 *        CSL_ESYS_BADHANDLE  - Invalid handle
 *        CSL_ESYS_INVPARAMS  - Config structure is not
 *                              properly initialized
 *
 *   @eg
 *      CSL_mcbspHandle     hMcbsp;
 *      CSL_McbspConfig     config = CSL_MCBSP_CONFIG_DEFAULTS;
 *      CSL_Status          status;
 *      ...
 *      status = CSL_mcbspHwSetupRaw (hMcbsp, &config);
 *      ...
 * ===========================================================================
 */
extern CSL_Status  CSL_mcbspHwSetupRaw (
    CSL_McbspHandle          hMcbsp,
    CSL_McbspConfig          *config
);

/*

⌨️ 快捷键说明

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