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

📄 csl_edmahwchannelsetup.c

📁 TI达芬奇dm644x各硬件模块测试代码
💻 C
字号:
/*  ============================================================================
 *   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_edmaHwChannelSetup.c
 *
 *  @brief    File for functional layer of CSL API @a CSL_edmaHwChannelSetup()
 *
 *  Path: \\(CSLPATH)\\ipmodules\\edma\\src
 *
 *  @date
 *  @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_edmaHwChannelSetup
 *
 *  @b Description
 *  @n Does the Channel setup i.e the channel to param entry mapping(if relevant)
 *     trigger word programmation (if relevant) and the que to which the channel
 *     is mapped.
 *   @b Arguments
 *
 *   @verbatim
            hEdma           Channel handle

            setup           Pointer to hardware setup structure
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK             - Hardware setup successful
 *   @li                    CSL_ESYS_BADHANDLE  - Invalid handle
 *   @li                    CSL_ESYS_INVPARAMS  - Hardware structure is not
 *                                                properly initialized
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  The specified instance will be setup according to value passed
 *
 *   @b Modifies
 *   @n Hardware registers for the specified instance
 *
 *  <b> Usage Constraints: </b>
 *  All   CSL_edmaInit(),   CSL_edmaOpen() and   CSL_edmaChannelOpen() must be
 *  called successfully in that order before   csl_edmaHwChannelSetup()
 *  can be called.
 *
 *  @b Example:
 *  @verbatim
    CSL_EdmaHandle hModule;

    CSL_EdmaChanObj ChObj;
    CSL_EdmaChanHandle hChannel;
    CSL_EdmaChannelParam chParam;
    CSL_Status         edmaStatus;

    // Initialization
    CSL_edmaInit();
    // Module Level Open
     hModule = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&edmaStatus);

    ...
    // Channel 0 is opened which is allocated to Region Region 0
    chParam.regionNum = CSL_EDMA_REGION_GLOBAL;
    chParam.chaNum = CSL_EDMA_CHA0;
    hChannel = CSL_edmaChannelOpen(&edmaObj,
                            CSL_EDMA_0,
                            &chParam,
                            &edmaStatus);

    // Channel Setup
    setup.que =  CSL_EDMA_EVT_QUE0;
    setup.paramEntry = 0;
    setup.triggerWord = CSL_EDMA_TRIGWORD_NONE;
    CSL_edmaHwChannelSetup(edmaHndl,&setup);
    @endverbatim
 *
 * ============================================================================
 */
#pragma CODE_SECTION (CSL_edmaHwChannelSetup, ".text:csl_section:edma");
CSL_Status  CSL_edmaHwChannelSetup(
    /** pointer to the object that holds reference to the channel
    * instance of the Specified DMA */
    CSL_EdmaChanHandle        hCh,
    /** pointer to the setup structure */
    CSL_EdmaHwChannelSetup    *setup
)
{
    if (hCh==NULL)
        return CSL_ESYS_BADHANDLE;
    if (setup==NULL)
        return CSL_ESYS_INVPARAMS;
    CSL_edmaChannelSetEvtQue(hCh,setup->que);
    if (hCh->chaNum  < CSL_EDMA_NUM_DMACH) {
#if CSL_EDMA_CHMAPEXIST
        CSL_FINS(hCh->ccregs->DCHMAP[hCh->chaNum],
                 EDMACC_DCHMAP_PAENTRY,
                 setup->paramEntry);
#endif
    } else
        hCh->ccregs->QCHMAP[hCh->chaNum-CSL_EDMA_NUM_DMACH] =
            CSL_FMK(EDMACC_QCHMAP_PAENTRY,setup->paramEntry)
            |  CSL_FMK(EDMACC_QCHMAP_TRWORD,setup->triggerWord);

    return CSL_SOK;
}


⌨️ 快捷键说明

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