csl_edmahwchannelcontrol.c

来自「TI达芬奇dm644x各硬件模块测试代码」· C语言 代码 · 共 132 行

C
132
字号
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
 *
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.
 *   ===========================================================================
 */
/** @file csl_edmaHwChannelControl.c
 *
 *    @brief    File for functional layer of CSL API 
 *    @a CSL_edmaHwChannelControl()
 *
 *  Description
 *    - The @a csl_edmaHwChannelControl() function definition &
 *     it's associated functions
 *  @date 29thMay, 2004
 *  @author Ruchika Kharwar
 */

/* =============================================================================
 *  Revision History
 *  ===============
 *  10-Aug-2005  brn      Updated for doxygen documentation and butification
 * =============================================================================
 */
 
#include <csl_edma.h>
#include <csl_edmaAux.h>

/** ============================================================================
 *  @n@b   CSL_edmaHwChannelControl
 *
 *  @b Description
 *  @n Takes a command with an optional argument & implements it. This function is
 *  used to carry out the different operations performed by EDMA
 *
 *   @b Arguments
 *   @verbatim
            hCh          Channel Handle

            cmd          Channel Command

            cmdArg       Additional command arguments are passed to the API
                         using this. The CSL function type casts to the
                         appropriate arguments type depending on the cmd.

     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK            - Command execution successful.
 *   @li                    CSL_ESYS_BADHANDLE - Invalid handle
 *   @li                    CSL_ESYS_INVCMD    - Invalid command
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Registers of the EDMA instance are configured according to the command
 *       and the command arguments. The command determines which registers are
 *       modified.
 *
 *   @b Modifies
 *   @n Registers determined by the command
 *  
 *  <b> Usage Constraints: </b>
 *  All @a CSL_edmaInit(), @a CSL_edmaOpen(), @a CSL_edmaChannelOpen() must be 
 *  invoked successfully in that order before this API can be invoked.
 *  If the channel is opened in context of a Region, @a CSL_edmaRegionOpen()
 *  may also need to be invoked before this API. If a Shadow region is used 
 *  then care of the DRAE settings must be taken
 *  
 *  @b Example:
 *  @verbatim
    // Initialization

    CSL_EdmaChanObj ChObj;
    CSL_EdmaChanHandle chHndl;
    
    CSL_EdmaHandle     hModHndl;          
    CSL_Status modStatus;
   
    // Initialize
    modStatus = CSL_edmaInit(NULL);
    ...
    // Open Module    
    hModHndl = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&modStatus);
    
    // Open Channel 0
    chParam.regionNum = CSL_EDMA_REGION_GLOBAL;
    chParam.chaNum = CSL_EDMA_CHA0;
    edmaHndl = CSL_edmaChannelOpen(&edmaObj,
                            CSL_EDMA_0,
                            &chParam,
                            &edmaStatus);
   status = CSL_edmaHwChannelControl(edmaHndl,CSL_EDMA_CMD_CHANNEL_ENABLE,NULL);
 *  @endverbatim
 * ============================================================================
 */
#pragma CODE_SECTION (CSL_edmaHwChannelControl, ".text:csl_section:edma");
CSL_Status  CSL_edmaHwChannelControl
(
    /** Channel handle */
    CSL_EdmaChanHandle           hCh,
    /** The command to this API which indicates the action to be taken */
    CSL_EdmaHwChannelControlCmd     cmd,
    /** Optional argument @a void* casted */
    void                           *cmdArg
)
{ 
    CSL_Status st;
    if (hCh == NULL) 
        return CSL_ESYS_BADHANDLE;
    switch(cmd) {
        case CSL_EDMA_CMD_CHANNEL_ENABLE:
            st = CSL_edmaChannelEnable(hCh);
            break;
        case CSL_EDMA_CMD_CHANNEL_DISABLE:
            st = CSL_edmaChannelDisable(hCh);
            break;
        case CSL_EDMA_CMD_CHANNEL_SET:
            st = CSL_edmaChannelEventSet(hCh);
            break;
        case CSL_EDMA_CMD_CHANNEL_CLEAR:
            st = CSL_edmaChannelEventClear(hCh);
            break;
        default:
            st = CSL_ESYS_INVCMD;
    }       
    return st;
}

⌨️ 快捷键说明

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