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

📄 csl_edma3aux.h

📁 Dm6455 driver,magbe useful to you!
💻 H
📖 第 1 页 / 共 5 页
字号:
            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 memory protection attributes 
            memProt = CSL_edma3GetMemoryProtectAttrib(hModule,CSL_EDMA3_REGION_2);
            ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE CSL_BitMask32  CSL_edma3GetMemoryProtectionAttrib (
    CSL_Edma3Handle        hModule,
    Int                    region
)
{
    /* Memory protection page fault attribute */
    CSL_BitMask32         mppa;
    
    if (region < 0) {
        mppa = hModule->regs->MPPAG;
    }
    else {
        mppa = hModule->regs->MPPA[region];
    }
                 
    return  mppa;
}

/* ============================================================================
 *   @n@b CSL_edma3GetMemoryFaultError
 *
 *   @b Description
 *   @n Queries the Channel controllers memory fault error and the error 
 *      attributes.Gets the memory fault status details, clears the fault.
 *
 *   @b Arguments
 *   @verbatim
        hModule           Module Handle
        memFault          This points to a structure alloctaed by the user 
                          program that can hold the queried the memory fault
                          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_edma3GetMemoryFaultError() 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 memory protection fault 
            status = CSL_edma3GetMemoryFaultError(hModule,&memFault);
            ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE CSL_Status  CSL_edma3GetMemoryFaultError (
    CSL_Edma3Handle             hModule,
    CSL_Edma3MemFaultStat       *memFault
)
{ 
    /* Reading the Memory Fault Status registers */
    memFault->addr = hModule->regs->MPFAR; 
    memFault->error =  CSL_FEXTR(hModule->regs->MPFSR, 8, 0);
    memFault->fid = CSL_FEXTR(hModule->regs->MPFSR, 12, 9);
    
    return CSL_SOK;     
}
#endif

/* =============================================================================
 *   @n@b CSL_edma3SetMemoryProtectionAttrib
 *
 *   @b Description
 *   @n This API sets the memory protection attributes for the specified region.
 *      Sets specified memory protection attributes for the specifed region.
 *
 *   @b Arguments
 *   @verbatim
        hModule           Module Handle
        
        edmaRegion        region - this may be specified as one of the many view 
                          supported by the chip or the global memory protection 
                          attributes themselves.
                          
        mpa               Value to be programmed into the MPPAG/MPPA[0/1/2/../n]
                          This is a Bitmask of the protection attributes.
 *   @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_edma3SetMemoryProtectionAttrib() 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);   
            
            // Module Control API 
            status = CSL_edma3SetMemoryProtectionAttrib (
                                                    hModule,CSL_EDMA3_REGION_0,
                                                    (CSL_EDMA3_MEMACCESS_UX \
                                                    |CSL_EDMA3_MEMACCESS_UW \
                                                    |CSL_EDMA3_MEMACCESS_UR \
                                                    |CSL_EDMA3_MEMACCESS_AID2));
            ...
     @endverbatim
 * ===========================================================================
 */
#if CSL_EDMA3_MEMPROTECT 
CSL_IDEF_INLINE CSL_Status  CSL_edma3SetMemoryProtectionAttrib(
    CSL_Edma3Handle        hModule,
    Int                    edmaRegion,
    CSL_BitMask32          mppa
)
{    
    if (edmaRegion == CSL_EDMA3_REGION_GLOBAL) {
        hModule->regs->MPPAG = mppa;
    }
    else {
        hModule->regs->MPPA[edmaRegion] = mppa;
    }
    
    return CSL_SOK;
}    
#endif

/* =============================================================================
 *   @n@b CSL_edma3DmaRegionAccessEnable
 *
 *   @b Description
 *   @n This API sets the DRAE/DRAEH BitMask.Enables shadow region access bits
 *      DRAE,DRAEH.
 *
 *   @b Arguments
 *   @verbatim
        hModule           Module Handle
        
        edmaRegion        Region - this may be specified as one of the many view 
                          supported by the chip or the global memory protection 
                          attributes themselves.
                          
        access            Region bits to be programmed
                          
        drae              Bitmask to be enabled in DRAE
                          
        draeh             Bitmask to be enabled in DRAEH
 *   @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status    
 *   @n                     CSL_SOK            - Region access enable success
 *   @n                     CSL_ESYS_INVPARAMS - Invalid parameter
 *
 *   <b> Pre Condition </b>
 *   @n  All CSL_edma3Init(), CSL_edma3Open(), must be called successfully in  
 *       that order before CSL_edma3DmaRegionAccessEnable() can be called.
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n Enable shadow region access bits DRAE,DRAEH
 *
 *   @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);   
        
            // Module Control API 
            status = CSL_edma3DmaRegionAccessEnable(hModule, CSL_EDMA3_REGION_0,
                                                    0x000000FF, 0x000000FF);
            ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE CSL_Status  CSL_edma3DmaRegionAccessEnable (
    CSL_Edma3Handle       hModule,
    Int                   edmaRegion,
    CSL_BitMask32         drae,
    CSL_BitMask32         draeh
)
{

    if (edmaRegion == CSL_EDMA3_REGION_GLOBAL) {
        return CSL_ESYS_INVPARAMS;
    }
    
    hModule->regs->DRA[edmaRegion].DRAE |= drae;
    hModule->regs->DRA[edmaRegion].DRAEH |= draeh;
    
    return CSL_SOK;
}

/* =============================================================================
 *   @n@b CSL_edma3DmaRegionAccessDisable
 *
 *   @b Description
 *   @n This API clears the DRAE/DRAEH BitMask..Disable shadow region access bits
 *      DRAE,DRAEH.
 *
 *   @b Arguments
 *   @verbatim
        hModule           Module Handle
        
        edmaRegion        Region - this may be specified as one of the many view 
                          supported by the chip or the global memory protection 
                          attributes themselves.
                          
        access            Region bits to be programmed
                          
        drae              Bitmask to be enabled in DRAE
                          
        draeh             Bitmask to be enabled in DRAEH
 *   @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @n                     CSL_SOK            - Region access disable success
 *   @n                     CSL_ESYS_INVPARAMS - Invalid parameter
 *
 *   <b> Pre Condition </b>
 *   @n  All CSL_edma3Init(), CSL_edma3Open(), must be called successfully in  
 *       that order before CSL_edma3DmaRegionAccessEnable() can be called.
 *
 *   <b> Post Condition </b>

⌨️ 快捷键说明

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