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

📄 csl_edma3aux.h

📁 Dm6455 driver,magbe useful to you!
💻 H
📖 第 1 页 / 共 5 页
字号:
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005, 2006
 *
 *   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_edmaAux.h
 *
 *   @path  $(CSLPATH)\inc
 *
 *   @desc  Auxillary Header file for EDMA
 *
 */
 
/* =============================================================================
 *  Revision History
 *  ===============
 *  29-May-2004 Ruchika Kharwar File Created.
 *
 * =============================================================================
 */

#ifndef _CSL_EDMA3AUX_H_
#define _CSL_EDMA3AUX_H_

#define CSL_IDEF_INLINE static inline

/*
 *  Status query functions of the Edma Module
 */

/* ============================================================================
 *   @n@b CSL_edma3GetEventMissed
 *
 *   @b Description
 *   @n Queries all the events missed.Since there may be upto 64 EDMA 
 *      channels + upto 8 QDMA channels,this points to an  array of 3, 
 *      32 bit elements.Gets the status of the missed events.
 *
 *   @b Arguments
 *   @verbatim
        hModule           Module Handle
        missedLo          missed [0] - holds status from EMR
        missedHi          missed [1] - holds status from EMRH
        missedQdma        missed [2] - holds status from QEMR
 *   @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @n                     Always returns CSL_SOK
 *
 *   <b> Pre Condition </b>
 *   @n  All CSL_edma3Init(), CSL_edma3Open(), must be called successfully in  
 *       that order before CSL_edma3GetEventsMissed() can be called.
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
            CSL_Edma3Handle             hModule;
            CSL_Edma3HwSetup            hwSetup,gethwSetup;
            CSL_Edma3Obj                edmaObj;
            CSL_Edma3ParamHandle        hParamPing,hParamPong,hParamBasic;
            CSL_Edma3ChannelObj         ChObj;
            CSL_Edma3QueryInfo          info;
            CSL_Edma3CmdIntr            regionIntr;
            CSL_Edma3CmdDrae            regionAccess;
            CSL_Edma3ChannelHandle      hChannel;
            CSL_Edma3ParamSetup         myParamSetup;
            CSL_Edma3Context            context;
            CSL_Edma3ChannelAttr        chAttr;
            CSL_Edma3HwChannelSetup     dmahwSetup[CSL_EDMA3_NUM_DMACH] = \
                                              CSL_EDMA3_DMACHANNELSETUP_DEFAULT;
            CSL_Edma3HwChannelSetup     getdmahwSetup[CSL_EDMA3_NUM_DMACH];
            CSL_BitMask32               missedEdmaHi,missedEdma, missedQdma;
            CSL_Status                  status;
            Uint32                      i, passStatus = 1;   
        
            // Module Initialization
            CSL_edma3Init(&context);
            
            // Module Level Open    
            hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);
            
            // Module Setup
            hwSetup.dmaChaSetup  = &dmahwSetup[0];
            hwSetup.qdmaChaSetup = NULL;
            CSL_edma3HwSetup(hModule,&hwSetup);
         
            // Channel 0 Open in context of Shadow region 0
            chAttr.regionNum = CSL_EDMA3_REGION_0;
            chAttr.chaNum = CSL_EDMA3_CHA_DSP_EVT;
            hChannel = CSL_edma3ChannelOpen(&ChObj, CSL_EDMA3, &chAttr, &status);
               
            // Get missed events 
            status = CSL_edma3GetEventMissed(hModule, &missedEdma, &missedEdmaHi, 
                                             &missedQdma);
            ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE CSL_Status  CSL_edma3GetEventMissed (
    CSL_Edma3Handle         hModule,
    CSL_BitMask32           *missedLo,
    CSL_BitMask32           *missedHi,
    CSL_BitMask32           *missedQdma
)
{
    /* Reading the missed Status registers */
    *missedLo    = hModule->regs->EMR;
    *missedHi    = hModule->regs->EMRH;
    *missedQdma  = hModule->regs->QEMR;
    
    return CSL_SOK;     
}

/* ============================================================================
 *   @n@b CSL_edma3GetControllerError
 *
 *   @b Description
 *   @n Gets the status of the controller Error.
 *
 *   @b Arguments
 *   @verbatim
        hModule           Module Handle
        ccStat            This points to a structure allocated by the user 
                          program that can hold the queried status values.
 *   @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @n                     Always returns CSL_SOK
 *
 *   <b> Pre Condition </b>
 *   @n  All CSL_edma3Init(), CSL_edma3Open(), must be called successfully in  
 *       that order before CSL_edma3GetControllerError() can be called.
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
            CSL_Edma3Handle hModule;
            CSL_Edma3HwSetup hwSetup,gethwSetup;
            CSL_Edma3Obj    edmaObj;
            CSL_Edma3ParamHandle hParamPing,hParamPong,hParamBasic;
            CSL_Edma3ChannelObj ChObj;
            CSL_Edma3QueryInfo info;
            CSL_Edma3CmdIntr regionIntr;
            CSL_Edma3CmdDrae regionAccess;
            CSL_Edma3ChannelHandle hChannel;
            CSL_Edma3ParamSetup myParamSetup;
            CSL_Edma3Context    context;
            CSL_Edma3ChannelAttr  chAttr;
            CSL_Edma3HwChannelSetup dmahwSetup[CSL_EDMA3_NUM_DMACH] = \
                                              CSL_EDMA3_DMACHANNELSETUP_DEFAULT;
            CSL_Edma3HwChannelSetup getdmahwSetup[CSL_EDMA3_NUM_DMACH];
            
            CSL_Status status;
            Uint32 i,passStatus = 1;   
            
            // Module Initialization
            CSL_edma3Init(&context);
            
            // Module Level Open    
            hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);
            
            // Module Setup
            hwSetup.dmaChaSetup  = &dmahwSetup[0];
            hwSetup.qdmaChaSetup = NULL;
            CSL_edma3HwSetup(hModule,&hwSetup);
            
            // Channel 0 Open in context of Shadow region 0
            chAttr.regionNum = CSL_EDMA3_REGION_0;
            chAttr.chaNum = CSL_EDMA3_CHA_DSP_EVT;
            hChannel = CSL_edma3ChannelOpen(&ChObj,
                                    CSL_EDMA3,
                                    &chAttr,                            
                                    &status);   
            // Get Controller Error
            status = CSL_edma3GetControllerError(hModule,&ccError);
            ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE CSL_Status  CSL_edma3GetControllerError (
    CSL_Edma3Handle         hModule,
    CSL_Edma3CtrlErrStat    *ccStat
)
{ 
    ccStat->error = hModule->regs->CCERR & 0xFF ; 
    ccStat->exceedTcc = (Bool)(CSL_FEXT(hModule->regs->CCERR, \
                                        EDMA3CC_CCERR_TCCERR)) ;
    
    return CSL_SOK;     
}

/* ============================================================================
 *   @n@b CSL_edma3GetIntrPendStatus
 *
 *   @b Description
 *   @n Queries the interrupt status of the interrupts.This is read from the 
 *      Global Channel Register.Gets the interrupt pend status.
 *
 *   @b Arguments
 *   @verbatim
        hModule           Module Handle
        region            Region
        intrLo            Status 0-31 of the interrupts 
        intrHi            Status 32-63 of the interrupts       
 *   @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @n                     Returns CSL_SOK
 *
 *   <b> Pre Condition </b>
 *   @n  All CSL_edma3Init(), CSL_edma3Open(), must be called successfully in  
 *       that order before CSL_edma3GetIntrPendStatus() can be called.
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
            CSL_Edma3Handle             hModule;
            CSL_Edma3HwSetup            hwSetup,gethwSetup;
            CSL_Edma3Obj                edmaObj;
            CSL_Edma3ParamHandle        hParamPing,hParamPong,hParamBasic;
            CSL_Edma3ChannelObj         ChObj;
            CSL_Edma3QueryInfo          info;
            CSL_Edma3CmdIntr            regionIntr;
            CSL_Edma3CmdDrae            regionAccess;
            CSL_Edma3ChannelHandle      hChannel;
            CSL_Edma3ParamSetup         myParamSetup;
            CSL_Edma3Context            context;
            CSL_Edma3ChannelAttr        chAttr;
            CSL_Edma3HwChannelSetup     dmahwSetup[CSL_EDMA3_NUM_DMACH] = \
                                             CSL_EDMA3_DMACHANNELSETUP_DEFAULT;
            CSL_Edma3HwChannelSetup     getdmahwSetup[CSL_EDMA3_NUM_DMACH];
            CSL_Status                  status;
            Uint32                      i, passStatus = 1;   
        
            // Module Initialization
            CSL_edma3Init(&context);
            
            // Module Level Open    
            hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);
            
            // Module Setup
            hwSetup.dmaChaSetup  = &dmahwSetup[0];
            hwSetup.qdmaChaSetup = NULL;
            CSL_edma3HwSetup(hModule,&hwSetup);
         
            // Channel 0 Open in context of Shadow region 0
            chAttr.regionNum = CSL_EDMA3_REGION_0;
            chAttr.chaNum = CSL_EDMA3_CHA_DSP_EVT;
            hChannel = CSL_edma3ChannelOpen(&ChObj,
                                    CSL_EDMA3,
                                    &chAttr,                            
                                    &status);   
            
            // Get interrupt pend status 
            status = CSL_edma3GetIntrPendStatus(hModule,CSL_EDMA3_REGION_0, 
                                                &edmaIntrLo, &edmaIntrHi);
            ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE CSL_Status  CSL_edma3GetIntrPendStatus (
    CSL_Edma3Handle          hModule,
    Int                      region,
    CSL_BitMask32            *intrLo,
    CSL_BitMask32            *intrHi
)
{
    if (region != CSL_EDMA3_REGION_GLOBAL) {   
        *intrLo = hModule->regs->SHADOW[region].IPR  ;
        *intrHi = hModule->regs->SHADOW[region].IPRH ;
    } 
    else {
        *intrLo = hModule->regs->IPR  ;
        *intrHi = hModule->regs->IPRH ;
    }
    
    return CSL_SOK; 
}
   
#if CSL_EDMA3_MEMPROTECT 
/* ============================================================================
 *   @n@b CSL_edma3GetMemoryProtectionAttrib
 *
 *   @b Description
 *   @n Queries the Memory Access rights of the specified region. This 
 *      may be global/view.Gets the memory protection attributes.
 *
 *   @b Arguments
 *   @verbatim
        hModule           Module Handle
        region            Region queried. This may refer to the global channel
                          register space or a specific region/view.
 *   @endverbatim
 *
 *   <b> Return Value </b>  CSL_BitMask32
 *   @n                     Memory protection attributes - MPPAG/MPPA[0/1../n] 
 *                                                         value
 *
 *   <b> Pre Condition </b>
 *   @n  All CSL_edma3Init(), CSL_edma3Open(), must be called successfully in  
 *       that order before CSL_edma3GetMemoryProtectAttrib() can be called.
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
            CSL_Edma3Handle             hModule;
            CSL_Edma3HwSetup            hwSetup,gethwSetup;
            CSL_Edma3Obj                edmaObj;
            CSL_Edma3ParamHandle        hParamPing,hParamPong,hParamBasic;
            CSL_Edma3ChannelObj         ChObj;
            CSL_Edma3QueryInfo          info;
            CSL_Edma3CmdIntr            regionIntr;
            CSL_Edma3CmdDrae            regionAccess;
            CSL_Edma3ChannelHandle      hChannel;
            CSL_Edma3ParamSetup         myParamSetup;
            CSL_Edma3Context            context;
            CSL_Edma3ChannelAttr        chAttr;
            CSL_Edma3HwChannelSetup     dmahwSetup[CSL_EDMA3_NUM_DMACH] = \
                                              CSL_EDMA3_DMACHANNELSETUP_DEFAULT;
            CSL_Edma3HwChannelSetup     getdmahwSetup[CSL_EDMA3_NUM_DMACH];
            CSL_Status                  status;
            Uint32                      i, passStatus = 1,memprot;   
        
            // Module Initialization
            CSL_edma3Init(&context);
            
            // Module Level Open    

⌨️ 快捷键说明

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