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

📄 csl_edmaregionopen.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_edmaRegionOpen.c
 *
 *  @brief    File for functional layer of CSL API @a CSL_edmaRegionOpen()
 *
 *  Path: \\(CSLPATH)\\ipmodules\\edma\\src
 *
 *  @date 
 *  @author Ruchika Kharwar
 */

/* =============================================================================
 *  Revision History
 *  ===============
 *  10-Aug-2005  brn      Updated for doxygen documentation and butification
 * =============================================================================
 */
 
/* File contains all the related functionality to do with Region region acquisitions */

#include <csl_edma.h>

/** =============================================================================
 *   @n@b   CSL_edmaRegionOpen
 *
 *   @b Description
 *   @n Acquires the shadow region requested. If the shadow region can be 
 *      allocated a valid handle to the shadow region is returned else a NULL 
 *      handle is returned. 
 *
 *   @b Arguments
 *   @verbatim

            hRegion          Shadow region handle

            edmaShObj        Pointer to the shadow EDMA instance object

            edmaNum          Instance of the EDMA to be opened.

            pEdmaParam       Pointer to module specific shadow parameters

            pStatus          pointer for returning status of the function call

     @endverbatim
 *
 *   <b> Return Value </b>
 *      CSL_EdmaHandle
 *        Valid EDMA instance handle will be returned if status value is
 *        equal to CSL_SOK.
 *
 *   <b> Pre Condition </b>
 *   @n  @a CSL_edmaInit() must be called successfully.
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b  Modifies
 *   @n  None
 *
 *   @b Example:
 *   @verbatim
        CSL_EdmaObj ModuleObj;
        CSL_EdmaHandle hModHndl;
        CSL_EdmaRegionParam regParam;
        CSL_EdmaRegionObj RegionObj;
        CSL_EdmaRegionHndl shHndl;
        CSL_Status status;
        CSL_EdmaChanObj ChObj;
        CSL_EdmaChanHandle chHndl;
        
        // Initialization
        CSL_edmaInit(NULL);
        
        // Open Module
        edmaHndl = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&modStatus);
        
        // Region Open 
        regParam.regionNum = CSL_EDMA_REGION_0;
        shHndl = CSL_edmaRegionOpen(&RegionObj,CSL_EDMA_0,&regParam,&status);
     @endverbatim
 *
 * ===========================================================================
 */
/** Acquires the shadow region requested. If the shadow region can be allocated 
 *  a valid handle to the shadow region is returned else a NULL handle is returned. 
 *
 * <b> Usage Constraints: </b>
 * CSL_edmaInit(), CSL_edmaOpen() must have been called successfully before this function can 
 * be called.The user must allocate space for this and this API fills in the system 
 * specified fields.
 * 
 *
 * @b Example:
 * \code
    CSL_EdmaObj ModuleObj;
    CSL_EdmaHandle hModHndl;
    CSL_EdmaRegionParam regParam;
    CSL_EdmaRegionObj RegionObj;
    CSL_EdmaRegionHndl shHndl;
    CSL_Status status;
    CSL_EdmaChanObj ChObj;
    CSL_EdmaChanHandle chHndl;
    
    // Initialization
    CSL_edmaInit(NULL);
    
    // Open Module
    edmaHndl = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&modStatus);
    
    // Region Open 
    regParam.regionNum = CSL_EDMA_REGION_0;
    shHndl = CSL_edmaRegionOpen(&RegionObj,CSL_EDMA_0,&regParam,&status);           

   \endcode
 *
 * @return Handle to the shadow region.
 *
 */

#pragma CODE_SECTION (CSL_edmaRegionOpen, ".text:csl_section:edma"); 
CSL_EdmaRegionHandle  CSL_edmaRegionOpen(
    /** pointer to the object that holds reference to the shadow region opened */
    CSL_EdmaRegionObj           *edmaShObj,
    /** instance of EDMA whose shadow region is requested for open */
    CSL_InstNum                 edmaNum,
    /** region requested */
    CSL_EdmaRegionParam         *param,
    /** points to the placeholder for the status (success/errors) of the call */
    CSL_Status                  *pStatus
) 
{
    CSL_EdmaRegionHandle pShHndl = NULL;
    
    CSL_Status status = CSL_SOK;
    CSL_EdmaModuleBaseAddress  baseAddress;
    if (param != NULL) {
        status = CSL_edmaccGetModuleBaseAddr(edmaNum,NULL,&baseAddress);
        edmaShObj->shregs = &baseAddress.regs->SHADOW[param->regionNum];
        edmaShObj->region = param->regionNum;
        edmaShObj->edmaNum = edmaNum;
        pShHndl = edmaShObj;
    } else {
        status = CSL_ESYS_FAIL;
    }
    if (status != CSL_SOK)
        *pStatus = CSL_ESYS_FAIL;
	else
		*pStatus = CSL_SOK;

    return pShHndl;     
}

⌨️ 快捷键说明

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