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

📄 csl_mcbspread.c

📁 TI达芬奇dm644x各硬件模块测试代码
💻 C
字号:
/** \file csl_mcbspRead.c
 *
 *  \brief    File for functional layer of CSL API \a CSL_mcbspRead()
 *
 *  Description
 *    - The \a CSL_mcbspRead() function contains definition of the 
 *      functional layer API
 *
 *  Path: \\(CSLPATH)\\ipmodules\\mcbsp\\src
 *
 */


#include <csl_mcbsp.h>

#pragma CODE_SECTION (CSL_mcbspRead, ".text:csl_section:mcbsp");

/**
 * Reads the data from MCBSP. The word length for the read operation is
 * specefied using @a wordLen argument. According to this word length, 
 * appropriate amount of data will read in the data object (variable);
 * the pointer to which is passed as the third argument.
 * 
 * <b> Usage Constraints: </b>
 * Both @a CSL_mcbspInit() and @a CSL_mcbspOpen() must be called successfully
 * in that order before @a CSL_mcbspRead() can be called.
 * 
 * @b Example:
 * @verbatim

      Uint16     inData;
      CSL_Status status;
      CSL_McbspHandle hMcbsp;
      ...
      // MCBSP object defined and HwSetup structure defined and initialized
      ...
     
      // Init, Open, HwSetup successfully done in that order
      ...
      // MCBSP SRG, Frame sync, RCV taken out of reset in that order
      ...
      status = CSL_mcbspRead(hMcbsp,
                             CSL_MCBSP_WORDLEN_16
                             &inData);
   @endverbatim
 *
 * @return Status of the operation 
 */
CSL_Status  CSL_mcbspRead(
    /** MCBSP handle returned by successful 'open' */
    CSL_McbspHandle                         hMcbsp,
    /** Word length of data to be read in */
    CSL_McbspWordLen                     wordLen,
    /** Pointer to data object (variable) that will hold the input data */
    void                                    *data
)
{
    CSL_Status status = CSL_SOK;

    switch(wordLen)
    {
    case CSL_MCBSP_WORDLEN_8:
    case CSL_MCBSP_WORDLEN_12:
    case CSL_MCBSP_WORDLEN_16:
        {
        *((Uint16 *)data) = (Uint16)hMcbsp->regs->DRR;
        break;
        }
    case CSL_MCBSP_WORDLEN_20:
    case CSL_MCBSP_WORDLEN_24:
    case CSL_MCBSP_WORDLEN_32:
        {
        *((Uint32 *)data) = (Uint32)hMcbsp->regs->DRR;
        }
    default:
        status = CSL_EMCBSP_INVSIZE;
    }

    return(status);
}

⌨️ 快捷键说明

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