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

📄 csl_mcbspwrite.c

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

#include <csl_mcbsp.h>

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

/**
 * Transmits the data from MCBSP. The word length for the write operation is
 * specefied using @a wordLen argument. According to this word length, the
 * appropriate amount of data will transmitted from 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_mcbspWrite() can be called.
 * 
 * @b Example:
 * @verbatim

      Uint16     outData;
      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, XMT taken out of reset in that order
      ...
      outData = 0x1234;
      status = CSL_mcbspWrite(hMcbsp,
                             CSL_MCBSP_WORDLEN_16
                             &outData);
   @endverbatim
 *
 * @return Status of the operation 
 */
CSL_Status  CSL_mcbspWrite(
    /** MCBSP handle returned by successful 'open' */
    CSL_McbspHandle                         hMcbsp,
    /** Word length of data to be transmitted */
    CSL_McbspWordLen                     wordLen,
    /** Pointer to data object (variable) that holds the data to be sent out */
    void                                    *data
)
{
    CSL_Status status = CSL_SOK;

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

}

⌨️ 快捷键说明

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