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

📄 csl_mcbsphwcontrol.c

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


#include <csl_mcbsp.h>
#include <_csl_mcbsp.h>
#include <csl_mcbspAux.h>
/**
 * This function takes an input control command with an optional argument
 * and accordingly controls the operation/configuration of MCBSP.
 * 
 * <b> Usage Constraints: </b>
 * Both @a CSL_mcbspInit() and @a CSL_mcbspOpen() must be called successfully
 * in that order before @a CSL_mcbspHwControl() can be called. 
 * Refer to @a CSL_McbspHwControlCmd for the argument type (@a void*) that needs
 * to be passed with the control command
 * 
 * @b Example:
 * @verbatim

      CSL_Status status;
      CSL_BitMask16 ctrlMask;
      CSL_McbspHandle hMcbsp;
      ...
      // MCBSP object defined and HwSetup structure defined and initialized
      ...
     
      // Init successfully done
      ...
      // Open successfully done
      ...
      // HwSetup sucessfully done
      ...
      // MCBSP SRG and Frame sync taken out of reset
      ...
      
      ctrlMask = CSL_MCBSP_CTRL_RX_ENABLE | CSL_MCBSP_CTRL_TX_ENABLE;
      status = CSL_mcbspHwControl(hMcbsp,
                                  CSL_MCBSP_CMD_RESET_CONTROL,
                                  &ctrlMask);
   @endverbatim
 * 
 * @return Status of the operation
 */
#pragma CODE_SECTION (CSL_mcbspHwControl, ".text:csl_section:mcbsp");
CSL_Status  CSL_mcbspHwControl(
    /** MCBSP handle returned by successful 'open' */
    CSL_McbspHandle                         hMcbsp,
    /** Control command, refer @a CSL_McbspControlCmd for the list of commands
     *  supported */
    CSL_McbspControlCmd                     cmd,
    /** Optional argument as per the control command, @a void * casted */
    void                                    *arg
)
{
    CSL_Status           status  = CSL_SOK;
    CSL_McbspBlkAssign   *blkAsg;
    CSL_McbspChanControl *ch;
    CSL_McbspChType      *chan;
    CSL_McbspIoControl   *io;
    CSL_BitMask16        *ctrl;
    
    if( hMcbsp == NULL){
        status=CSL_ESYS_BADHANDLE;
        return status;
    }

    switch(cmd)
    {
        case CSL_MCBSP_CMD_ASSIGN_BLOCK:
            blkAsg = (CSL_McbspBlkAssign *)arg;
            _CSL_mcbspBlockAssign(hMcbsp, blkAsg->partition, blkAsg->block);
            break;

        case CSL_MCBSP_CMD_CHANNEL_CONTROL:
            ch = (CSL_McbspChanControl *)arg;
            _CSL_mcbspChannelControl(hMcbsp, (ch->channelNo & 0xf), (CSL_McbspBlock)(ch->channelNo >> 4), ch->operation);
            break;

        case CSL_MCBSP_CMD_CLEAR_FRAME_SYNC:
            chan = (CSL_McbspChType *)arg;
            _CSL_mcbspClearFrmSyncErr(hMcbsp,*chan);
            break;

        case CSL_MCBSP_CMD_IO_MODE_CONTROL:
            io = (CSL_McbspIoControl *)arg;
            _CSL_mcbspIoModeCtrl(hMcbsp, io->outputsel, io->inputsel);
            break;

        case CSL_MCBSP_CMD_REG_RESET:
            _CSL_mcbspRegReset(hMcbsp);
            break;

        case CSL_MCBSP_CMD_RESET_CONTROL:
            ctrl = (CSL_BitMask16 *)arg;
            _CSL_mcbspResetCtrl(hMcbsp, *ctrl);
            break;

        case CSL_MCBSP_CMD_IDLE_CONTROL:
            CSL_mcbspIdleControl (hMcbsp,(CSL_BitMask16 *)arg);
            break;
        
        default:
        {
            status = CSL_ESYS_INVCMD;
            break;
        }

    }
    return (status);
}

⌨️ 快捷键说明

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