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

📄 csl_mcbsp.h

📁 ccs下对dm6446的测试程序
💻 H
📖 第 1 页 / 共 4 页
字号:
    /** Super frame synchronization configuration in RCV path */
    Uint32                  rxsynccount;

    /** Super frame synchronization configuration in XMT path */
    Uint32                  txsynccount;

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

/** @addtogroup CSL_MCBSP_DATASTRUCT
*
* @{ */
/**
 * @brief This structure/object holds the context of the instance of MCBSP
 * opened using @a CSL_mcbspOpen() function.
 *
 * Pointer to this object is passed as MCBSP Handle to all MCBSP CSL APIs.
 * @a 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;

/** @brief 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
     */
    /** Data Receive Register */ 
    volatile Uint32 DRR;
    /** Data Transmit Register */
    volatile Uint32 DXR;
    /** 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 RCERAB;
    /** Transmit Channel Enable Register for Partition A and B */
    volatile Uint32 XCERAB;
    /** Pin Control Register */
    volatile Uint32 PCR;
    /** Receive Channel Enable Register for Partition C and D */
    volatile Uint32 RCERCD;
    /** Transmit Channel Enable Register for Partition C and D */
    volatile Uint32 XCERCD;
    /** Receive Channel Enable Register for Partition E and F */
    volatile Uint32 RCEREF;
    /** Transmit Channel Enable Register for Partition E and F */
    volatile Uint32 XCEREF;
    /** Receive Channel Enable Register for Partition G and H */
    volatile Uint32 RCERGH;
    /** Transmit Channel Enable Register for Partition G and H */    
    volatile Uint32 XCERGH;
    /** Receive Synchronization Event Channel Identification Register */
    volatile Uint32 REVTCR;
    /** Transmit Synchronization Event Channel Identification Register */
    volatile Uint32 XEVTCR;
    /** Receive Frame Length Register */
    volatile Uint32 RFLR;
    /** Transmit Frame Length Register */
    volatile Uint32 XFLR;
    /** Receive Frame Synchronization Counter Register */
    volatile Uint32 RSYNCCNT;
    /** Transmit Frame Synchronization Counter Register */
    volatile Uint32 XSYNCCNT;
} CSL_McbspConfig;

/** Default Values for Config structure */
#define CSL_MCBSP_CONFIG_DEFAULTS { \
    CSL_MCBSP_DRR_RESETVAL,     \
    CSL_MCBSP_DXR_RESETVAL,     \
    CSL_MCBSP_SPCR_RESETVAL,    \
    CSL_MCBSP_RCR_RESETVAL,     \
    CSL_MCBSP_XCR_RESETVAL,     \
    CSL_MCBSP_SRGR_RESETVAL,    \
    CSL_MCBSP_MCR_RESETVAL,     \
    CSL_MCBSP_RCERAB_RESETVAL,  \
    CSL_MCBSP_XCERAB_RESETVAL,  \
    CSL_MCBSP_PCR_RESETVAL,     \
    CSL_MCBSP_RCERCD_RESETVAL,  \
    CSL_MCBSP_XCERCD_RESETVAL,  \
    CSL_MCBSP_RCEREF_RESETVAL,  \
    CSL_MCBSP_XCEREF_RESETVAL,  \
    CSL_MCBSP_RCERGH_RESETVAL,  \
    CSL_MCBSP_XCERGH_RESETVAL,  \
    CSL_MCBSP_REVTCR_RESETVAL,  \
    CSL_MCBSP_XEVTCR_RESETVAL,  \
    CSL_MCBSP_RFLR_RESETVAL,    \
    CSL_MCBSP_XFLR_RESETVAL,    \
    CSL_MCBSP_RSYNCCNT_RESETVAL,\
    CSL_MCBSP_XSYNCCNT_RESETVAL \
}

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

/*
 * ============================================================================
 *   @func CSL_mcbspInit
 *
 *   @desc
 *        This function is idempotent in that calling it many times is same as
 *        calling it once.This function initializes the MCBSP CSL data
 *        structures.
 *
 *   @arg pContext
 *        Context information for MCBSP
 *
 *   @ret CSL_Status
 *        CSL_SOK - Always returns
 *
 *   @eg
 *     CSL_mcbspInit (pContext);
 * =============================================================================
 */
CSL_Status  CSL_mcbspInit(
    CSL_McbspContext * pContext
);


/*
 *============================================================================
 *   @func CSL_mcbspOpen
 *
 *   @desc
 *        This function populates the peripheral data object for the instance
 *        and returns a handle to the instance.
 *        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. MCBSP Hardware setup will be performed
 *        at the end of the open call only if the HwSetup Pointer supplied was
 *        non- NULL. The handle returned by this call is input as an essential
 *        argument for rest of the APIs described for this module.
 *
 *   @arg hMcbspObj
 *        Pointer to the MCBSP instance object
 *
 *   @arg McbspNum
 *        Instance of the MCBSP 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_McbspObj     mcbspObj;
 *        CSL_Status      status;
 *          ...
 *        hMcbsp = CSL_mcbspOpen(&mcbspObj,
 *                            CSL_MCBSP_0,
 *                            CSL_EXCLUSIVE,
 *                            &status);
 *
 * ===========================================================================
 */
CSL_McbspHandle CSL_mcbspOpen (
    /** Pointer to the object that holds reference to the
     *  instance of MCBSP requested after the call
     */
    CSL_McbspObj                           *hMcbspObj,
    /** Instance of MCBSP to which a handle is requested
     */
    CSL_InstNum                            mcbspNum,
    /** Specifies if MCBSP should be opened with exclusive or
     *  shared access to the associate pins
     */
    CSL_McbspParam            *pMcbspParam,
    /** This returns the status (success/errors) of the call
     */
    CSL_Status                *pStatus
    );


/*
 * =============================================================================
 *   @func CSL_mcbspClose
 *
 *   @b Description
 *   @n This function closes the specified instance of MCBSP.
 *
 *   @arg  hMcbsp
           Handle to the MCBSP instance
 *
 *   @ret CSL_Status
 *         CSL_SOK            - Close successful
 *         CSL_ESYS_BADHANDLE - Invalid handle
 *
 *   @eg
 *     CSL_mcbspClose (hMcbsp);
 * =============================================================================
 */
CSL_Status  CSL_mcbspClose(
    /** Pointer to the object that holds reference to the
     *  instance of MCBSP requested after the call
     */
    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
);


/** =============================================================================
 *   @func CSL_mcbspHwSetupRaw
 *
 *   @desc
 *       This function configures the registers of MCBSP as per the values given
 *       in the Config structure.
 *
 *   @arg hMcbsp
 *        Handle to the MCBSP instance
 *
 *   @arg hwConfig
 *        Pointer to MCBSP config structure
 *
 *   @ret CSL_Status
 *         CSL_SOK             - Configuration successful
 *         CSL_ESYS_BADHANDLE  - Invalid handle
 *
 *   @eg
 *
 *        CSL_Status            status  ;
 *        CSL_McbspConfig       hwConfig;
 *
 *        status = CSL_mcbspHwsetupRaw (hMcbsp, &hwConfig);
 *
 * ===========================================================================
 */

CSL_Status  CSL_mcbspHwSetupRaw (
    CSL_McbspHandle                        hMcbsp,
    CSL_McbspConfig *         config
);


/**
@} */

/**
  * @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
);
/**
@} */

/**
  * @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
);


/** ============================================================================
 *   @n@b CSL_mcbspGetBaseAddress
 *
 *   @b Description
 *   @n  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. 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.
 *
 *   @b Arguments
 *   @verbatim
            mcbspNum          Specifies the instance of MCBSP to be opened.

            pMcbspParam       Module specific parameters.

            pBaseAddress    Pointer to baseaddress structure containing base
                            address details.

     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_OK            Open call is successful
 *   @li                    CSL_ESYS_FAIL     The instance number is invalid.
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Base Address structure is populated
 *
 *   @b Modifies
 *   @n    1. The status variable
 *
 *         2. Base address structure is modified.
 *
 *   @b Example
 *   @verbatim
        CSL_Status              status;
        CSL_McbspBaseAddress  baseAddress;

       ...
      status = CSL_mcbspGetBaseAddress(CSL_MCBSP_PER_CNT, NULL, &baseAddress);

    @endverbatim
 * ===========================================================================
 */
CSL_Status   CSL_mcbspGetBaseAddress (
        CSL_InstNum              mcbspNum,
        CSL_McbspParam           *pMcbspParam,
        CSL_McbspBaseAddress     *pBaseAddress
);


#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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