csl_mcbsp.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 1,398 行 · 第 1/3 页
H
1,398 行
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;/**@} *//** @addtogroup CSL_MCBSP_DATASTRUCT** @{ *//** * 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; // CSL_MCBSP_IOMODE_TXDIS_RXDIS = 0, // CSL_MCBSP_IOMODE_TXDIS_RXEN = 1,
// CSL_MCBSP_IOMODE_TXEN_RXDIS = 2,
/** Digital Loopback mode */
CSL_McbspDlbMode dlbMode; //typedef enum { // CSL_MCBSP_DLBMODE_OFF = 0, // CSL_MCBSP_DLBMODE_ON = 1 //} CSL_McbspDlbMode; /** Clock stop mode */ CSL_McbspClkStp clkStopMode;} CSL_McbspGlobalSetup;/**@} *//** @addtogroup CSL_MCBSP_DATASTRUCT** @{ *//** * 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;/**@} *//** @addtogroup CSL_MCBSP_DATASTRUCT** @{ *//** * This is the Setup structure for configuring MCBSP using @a 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;/**@} *//** @addtogroup CSL_MCBSP_DATASTRUCT** @{ *//** @brief This object contains the reference to the instance of MCBSP opened * using the @a CSL_mcbspOpen(). * * The pointer to this, is passed to all MCBSP CSL APIs. */typedef struct CSL_McbspObj { /** This is a pointer to the registers of the instance of MCBSP * referred to by this object */ CSL_McbspRegsOvly regs; /** This is the instance of MCBSP being referred to by this object */ CSL_InstNum perNum;} CSL_McbspObj;typedef struct CSL_McbspObj *CSL_McbspHandle;/** @brief This will have the base-address information for the peripheral * instance */typedef struct { /** Base-address of the Configuration registers of the peripheral */ CSL_McbspRegsOvly regs;} CSL_McbspBaseAddress;/** @brief Module specific parameters. Present implementation doesn't have * any module 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_McbspParam;/** @brief Module specific context information. Present implementation doesn't have * any Context information. */typedef struct { /** Context information of MCBSP. * The below declaration is just a place-holder for future * implementation. */ Uint16 contextInfo;} CSL_McbspContext;typedef struct { Uint16 DRR2; /**< Data receive register 2 */ Uint16 DRR1; /**< Data receive register 1 */ Uint16 DXR2; /**< Data transmit register 2 */ Uint16 DXR1; /**< Data transmit register 1 */ Uint16 SPCR2; /**< Serial port control register 2 */ Uint16 SPCR1; /**< Serial port control register 1 */ Uint16 RCR2; /**< Receive control register 2 */ Uint16 RCR1; /**< Receive control register 1 */ Uint16 XCR2; /**< Transmit control register 2 */ Uint16 XCR1; /**< Transmit control register 1 */ Uint16 SRGR2; /**< Sample rate generator register 2 */ Uint16 SRGR1; /**< Sample rate generator register 1 */ Uint16 MCR2; /**< Multichannel register 2 */ Uint16 MCR1; /**< Multichannel register 1 */ Uint16 RCERA; /**< Receive channel enable register partition A */ Uint16 RCERB; /**< Receive channel enable register partition B */ Uint16 XCERA; /**< Transmit channel enable register partition A */ Uint16 XCERB; /**< Transmit channel enable register partition B */ Uint16 PCR; /**< Pin control register */ Uint16 RCERC; /**< Receive channel enable register partition C */ Uint16 RCERD; /**< Receive channel enable register partition D */ Uint16 XCERC; /**< Transmit channel enable register partition C */ Uint16 XCERD; /**< Transmit channel enable register partition D */ Uint16 RCERE; /**< Receive channel enable register partition E */ Uint16 RCERF; /**< Receive channel enable register partition F */ Uint16 XCERE; /**< Transmit channel enable register partition E */ Uint16 XCERF; /**< Transmit channel enable register partition F */ Uint16 RCERG; /**< Receive channel enable register partition G */ Uint16 RCERH; /**< Receive channel enable register partition H */ Uint16 XCERG; /**< Transmit channel enable register partition G */ Uint16 XCERH; /**< Transmit channel enable register partition H */} CSL_McbspConfig;/* ************************************************************************\ * MCBSP global function declarations\* ************************************************************************//** @brief Peripheral specific initialization function. * * This is the peripheral specific intialization function. This function is * idempotent in that calling it many times is same as calling it once. * This function initializes the CSL data structures, and doesn't touches * the hardware. * * <b> Usage Constraints: </b> * This function should be called before using any of the CSL APIs in the MCBSP * module. * * Note: As MCBSP doesn't have any context based information, currently, the function * just returns CSL_SOK. User is expected to pass NULL in the function call. * * @b Example: * @verbatim ... if (CSL_SOK != CSL_mcbspInit(NULL)) { return; } @endverbatim * * @return returns the status of the operation * */CSL_Status CSL_mcbspInit( /** MCBSP specific context information */ CSL_McbspContext * pContext );/** @brief Opens the instance of MCBSP requested. * * The open call sets up the data structures for the particular instance of * MCBSP 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> Usage Constraints: </b> * MCBSP must be successfully initialized via @a CSL_mcbspInit() before calling * this function. Memory for the @a CSL_mcbspObj must be allocated outside * this call. This object must be retained while usage of this peripheral. * * @b Example: * @verbatim CSL_McbspObj mcbspObj; CSL_Status status; ... hMcbsp = CSL_mcbspOpen(&mcbspObj, CSL_MCBSP_1, NULL, &status); @endverbatim * * @return returns a handle @a CSL_McbspHandle to the requested instance of * MCBSP if the call is successful, otherwise, a @a NULL is returned. * */CSL_McbspHandle CSL_mcbspOpen ( /** Pointer to the object that holds reference to the * instance of MCBSP requested after the call */ CSL_McbspObj* pMcbspObj, /** Instance of MCBSP to which a handle is requested */ CSL_InstNum mcbspNum, /** Module specific parameters; * Currently there are none; the user should pass 'NULL' */ CSL_McbspParam *pMcbspParam, /** This returns the status (success/errors) of the call. * Could be 'NULL' if the user does not want status information. */ CSL_Status *pStatus );/** * @defgroup CSL_MCBSP_CLOSE_API MCBSP close API * @ingroup CSL_MCBSP_FUNCTION * @brief Closes the MCBSP instance * @{ */CSL_Status CSL_mcbspClose( CSL_McbspHandle hMcbsp);/**@} *//** * @defgroup CSL_MCBSP_SETUP_API MCBSP h/w setup API * @ingroup CSL_MCBSP_FUNCTION * @brief Sets up various configuration parameters * @{ */CSL_Status CSL_mcbspHwSetup( CSL_McbspHandle hMcbsp, CSL_McbspHwSetup *setup);/**@} *//** * @defgroup CSL_MCBSP_READ_API MCBSP read API * @ingroup CSL_MCBSP_FUNCTION * @brief Read data from MCBSP * @{ */CSL_Status CSL_mcbspRead( CSL_McbspHandle hMcbsp, CSL_McbspWordLen wordLen, void *data);/**@} *//** * @defgroup CSL_MCBSP_WRITE_API MCBSP write API * @ingroup CSL_MCBSP_FUNCTION * @brief Write data from MCBSP * @{ */CSL_Status CSL_mcbspWrite( CSL_McbspHandle hMcbsp, CSL_McbspWordLen wordLen, void *data);/**@} *//** * @defgroup CSL_MCBSP_IOWRITE_API MCBSP IO pin write API * @ingroup CSL_MCBSP_FUNCTION * @brief Send bit data to pins (I/O mode pins) * @{ */void CSL_mcbspIoWrite( CSL_McbspHandle hMcbsp, CSL_BitMask16 outputSel, Uint16 outputData);/**@} *//** * @defgroup CSL_MCBSP_IOREAD_API MCBSP IO pin read API * @ingroup CSL_MCBSP_FUNCTION * @brief Receive bit data from pins (I/O mode pins) * @{ */Uint16 CSL_mcbspIoRead( CSL_McbspHandle hMcbsp, CSL_BitMask16 inputSel);/**@} *//** * @defgroup CSL_MCBSP_CONTROL_API MCBSP h/w control API * @ingroup CSL_MCBSP_FUNCTION * @brief Controls MCBSP operation based on the control command * @{ */CSL_Status CSL_mcbspHwControl( CSL_McbspHandle hMcbsp, CSL_McbspControlCmd cmd, void *arg);/**@} *//** * @defgroup CSL_MCBSP_QUERY_API MCBSP h/w status query API * @ingroup CSL_MCBSP_FUNCTION * @brief Get the status of different operations * @{ */CSL_Status CSL_mcbspGetHwStatus( CSL_McbspHandle hMcbsp, CSL_McbspHwStatusQuery myQuery, void *response);/**@} *//** This function initializes the device registers with the register-values provided through the Config Data structure. For information passed through the Config Data structure refer to @a CSL_McbspConfig. * * <b> Usage Constraints: </b> * The user has to allocate space for & fill in the main setup structure appropriately before calling this function. * * @b Example: * @verbatim CSL_McbspHandle hMcbsp; CSL_McbspConfig config = CSL_MCBSP_CONFIG_DEFAULTS; ... CSL_mcbspHwSetupRaw(hMcbsp, &config); @endverbatim * * @return Returns the status of the setup operation * */ CSL_Status CSL_mcbspHwSetupRaw( /** pointer to the object that holds reference to the * instance of MCBSP requested after the call */ CSL_McbspHandle hMcbsp, /** pointer to the object that holds reference to the * config structure */ CSL_McbspConfig * setup);/** * @defgroup CSL_MCBSP_GETHWSETUP_API MCBSP h/w setup query API * @ingroup CSL_MCBSP_FUNCTION * @brief Retrieve or read back the required setup parameters * @{ */CSL_Status CSL_mcbspGetHwSetup( CSL_McbspHandle hMcbsp, CSL_McbspHwSetup *myHwSetup);/**@} *//** @brief Function to get the Base-address of the peripheral instance. * * This function is used for getting the base-address of the peripheral * instance. This function will be called inside the @ CSL_mcbspOpen() * function call. * * Note: This function is open for re-implementing if the user wants to modify * the base address of the peripheral object to point to a different * location and there by allow CSL initiated write/reads into peripheral * MMR's go to an alternate location. Please refer the documentation for * more details. * * @b Example: * @verbatim CSL_Status status; CSL_McbspBaseAddress baseAddress; ... status = CSL_mcbspGetBaseAddress(CSL_MCBSP_1, NULL, &baseAddress); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_mcbspGetBaseAddress( /** Instance number */ CSL_InstNum mcbspNum, /** Module specific parameters */ CSL_McbspParam * pMcbspParam, /** Base address details */ CSL_McbspBaseAddress * pBaseAddress);#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?