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

📄 csl_edmagethwchannelstatus.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_edmaGetHwChannelStatus.c
 *
 *  @brief File for functional layer of CSL API @a CSL_edmaGetHwChannelStatus()
 *
 *  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_edmaGetHwChannelStatus
 *  
 *  @b Description
 *  @n Gets the status of the different operations or the current setup of EDMA 
 *  module
 *
 *   @b Arguments
 *   @verbatim
            hEdma           Handle to the EDMA instance

            myQuery         Shadow region query

            response        Additional query arguments are passed to the API
                            sing the response structure. The query response is
                            passed back to the user program using this pointer.
                            Depending on 'myQuery' this argument is type casted
                            appropriately.
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK            - Successful completion of the
 *                                               query
 *
 *   @li                    CSL_ESYS_BADHANDLE - Invalid handle
 *
 *   @li                    CSL_ESYS_INVQUERY  - Query command not supported
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *       Data requested by the query is returned through the variable "response"
 *
 *   @b Modifies
 *   @n  The input arguement "response" is modified
 *
 *  <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_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 0 is opened which is in the global region, hence the shadow
    // Handle is NULL
    edmaStatus = CSL_edmaGetHwChannelStatus(hChannel,
                            CSL_EDMA_QUERY_CHANNEL_SETUP,
                            &querySetup);
    @endverbatim
 *
 * ============================================================================
 */
#pragma CODE_SECTION (CSL_edmaGetHwChannelStatus, ".text:csl_section:edma");
CSL_Status  CSL_edmaGetHwChannelStatus(
   /** Pointer to the object that holds reference to the
     * instance of EDMA Channel*/
    CSL_EdmaChanHandle                 hEdma,
    /** The query to this API which indicates the status/setup
     * to be returned */
    CSL_EdmaHwChannelStatusQuery       myQuery,
    /** Placeholder to return the status; @a void* casted */
    void                               *response
)
{
    CSL_Status st = CSL_SOK;
    int _qNumIndex,_qchMap;
    Uint32 temp;
    if (hEdma == NULL)
        return CSL_ESYS_BADHANDLE;
    if (response == NULL)
        return CSL_ESYS_INVPARAMS;
    switch(myQuery) {
        case CSL_EDMA_QUERY_CHANNEL_SETUP:
            if (hEdma->chaNum  < CSL_EDMA_NUM_DMACH) {
                _qNumIndex = hEdma->chaNum >> 3;
                _qchMap = hEdma->chaNum - (_qNumIndex * 8);

                ((CSL_EdmaHwChannelSetup*)response)->que =
                    (CSL_EdmaEventQueue)(CSL_FEXTR(
                                    hEdma->ccregs->DMAQNUM[_qNumIndex],
                                    _qchMap*4+2,_qchMap*4));
#if CSL_EDMA_CHMAPEXIST
                ((CSL_EdmaHwChannelSetup*)response)->paramEntry =
                    CSL_FEXT(hEdma->ccregs->DCHMAP[hEdma->chaNum],
                                EDMACC_DCHMAP_PAENTRY);
#else
                ((CSL_EdmaHwChannelSetup*)response)->paramEntry= hEdma->chaNum;
#endif
                ((CSL_EdmaHwChannelSetup*)response)->triggerWord =
                                                    CSL_EDMA_TRIGWORD_NONE;
            } else {
                _qNumIndex = hEdma->chaNum - CSL_EDMA_NUM_DMACH;
                ((CSL_EdmaHwChannelSetup*)response)->que =
                    (CSL_EdmaEventQueue)(CSL_FEXTR(hEdma->ccregs->QDMAQNUM,
                                                  _qNumIndex*4 + 2,
                                                  _qNumIndex*4));
                temp = hEdma->ccregs->QCHMAP[_qNumIndex];
                ((CSL_EdmaHwChannelSetup*)response)->triggerWord =
                                        CSL_FEXT(temp,EDMACC_QCHMAP_TRWORD);
                ((CSL_EdmaHwChannelSetup*)response)->paramEntry =
                                        CSL_FEXT(temp,EDMACC_QCHMAP_PAENTRY);
            }
            break;
        default:
            st = CSL_ESYS_INVQUERY;
            break;
    }
    return st;
}

⌨️ 快捷键说明

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