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

📄 bbu_dd_edmaadl.c

📁 DSP芯片自检测程序
💻 C
📖 第 1 页 / 共 2 页
字号:
    EDMA_clearParameter(0x00000000);
  
    IRQ_globalRestore(gie);
}
/*----------------------------------------------------------------------------*/

/*******************************************************************************
* 函数名称: EDMA_allocLink    			                  			           *
* 函数描述: Allocating a Link Channel in Link Area of ParaRAM to EDMA Handle   *
* 相关文档:                                                                    *
* 参数描述:  						                    			           *
* 参数名		     类型		输入/输出 	   描述	       			           *
* -------- 		     ---- 		---------	-----------    			           *
* linkCha           Sint32         in		Linked EDMA Channel Number         *
*                                                                              *
* 返回值: 无									                               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI EDMA_Handle EDMA_allocLink(Sint32 linkCha)
{
Uint32 gie;
Uint32 addr;
EDMA_Handle hEdma;

    gie = IRQ_globalDisable();
            
    addr = (linkCha * EDMA_ENTRY_SIZE) + EDMA_PRAM_START;
    hEdma= (addr & 0x0000FFFF) | ((linkCha<<16) & 0x00FF0000) | EDMA_TYPE_T;            
     
    IRQ_globalRestore(gie);
    
    return hEdma;
}
/*----------------------------------------------------------------------------*/ 

/*******************************************************************************
* 函数名称: EDMA_freeLink    			                  			           *
* 函数描述: Free a Link Channel in Link Area of ParaRAM                        *
* 相关文档:                                                                    *
* 参数描述:  						                    			           *
* 参数名		     类型		输入/输出 	   描述	       			           *
* -------- 		     ---- 		---------	-----------    			           *
* hEdma           EDMA_Handle      in		Handle for Linked EDMA Channel     *
*                                                                              *
* 返回值: 无									                               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI void EDMA_freeLink(EDMA_Handle hEdma)
{
Uint32 gie;

    gie = IRQ_globalDisable();
   
    if (hEdma & EDMA_TYPE_T)
    {
        EDMA_RSETH(hEdma,OPT,EDMA_OPT_DEFAULT);  
        EDMA_RSETH(hEdma,SRC,EDMA_SRC_DEFAULT);   
        EDMA_RSETH(hEdma,DST,EDMA_DST_DEFAULT);
        EDMA_RSETH(hEdma,CNT,EDMA_CNT_DEFAULT);
        EDMA_RSETH(hEdma,RLD,EDMA_RLD_DEFAULT);
        EDMA_RSETH(hEdma,IDX,EDMA_IDX_DEFAULT);
    }
    
    IRQ_globalRestore(gie);
}
/*----------------------------------------------------------------------------*/  

/*******************************************************************************
* 函数名称: EDMA_intEnable    			                  			           *
* 函数描述: Enables a TCC Interrupt by Modifying the CIER Register             *
* 相关文档:                                                                    *
* 参数描述:  						                    			           *
* 参数名		     类型		输入/输出 	   描述	       			           *
* -------- 		     ---- 		---------	-----------    			           *
* tccIntNum         Sint32         in		Transfer Completion Code Number    *
*                                                                              *
* 返回值: 无									                               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI void EDMA_intEnable(Sint32 tccIntNum)
{
Uint32 gie;

    gie = IRQ_globalDisable();
        
    if((tccIntNum>=0) && (tccIntNum<32))
    {
        EDMA_RSET(CIERL,EDMA_RGET(CIERL) | (1<<tccIntNum));
    }
    
    if((tccIntNum>=32) && (tccIntNum<EDMA_CHA_CNT))
    {
        EDMA_RSET(CIERH,EDMA_RGET(CIERH) | (1<<(tccIntNum-32))); 
    }
 
    IRQ_globalRestore(gie);
}
/*----------------------------------------------------------------------------*/

/*******************************************************************************
* 函数名称: EDMA_intDisable    			                  			           *
* 函数描述: Disables a TCC Interrupt by Modifying the CIER Register            *
* 相关文档:                                                                    *
* 参数描述:  						                    			           *
* 参数名		     类型		输入/输出 	   描述	       			           *
* -------- 		     ---- 		---------	-----------    			           *
* tccIntNum         Sint32         in		Transfer Completion Code Number    *
*                                                                              *
* 返回值: 无									                               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI void EDMA_intDisable(Sint32 tccIntNum)
{
Uint32 gie;

    gie = IRQ_globalDisable();
        
    if((tccIntNum>=0) && (tccIntNum<32))
    {
        EDMA_RSET(CIERL,EDMA_RGET(CIERL) & ~(1<<tccIntNum));
    }
    
    if((tccIntNum>=32) && (tccIntNum<EDMA_CHA_CNT))
    {
        EDMA_RSET(CIERH,EDMA_RGET(CIERH) & ~(1<<(tccIntNum-32)));
    }
 
    IRQ_globalRestore(gie);
}
/*----------------------------------------------------------------------------*/

/*******************************************************************************
* 函数名称: EDMA_intClear    			                  			           *
* 函数描述: Clears a TCC Interrupt Flag by Modifying the CIPR Register         *
* 相关文档:                                                                    *
* 参数描述:  						                    			           *
* 参数名		     类型		输入/输出 	   描述	       			           *
* -------- 		     ---- 		---------	-----------    			           *
* tccIntNum         Sint32         in		Transfer Completion Code Number    *
*                                                                              *
* 返回值: 无									                               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI void EDMA_intClear(Sint32 tccIntNum)
{
Uint32 gie;

    gie = IRQ_globalDisable();
        
    if((tccIntNum>=0) && (tccIntNum<32))
    {
        EDMA_RSET(CIPRL,1<<tccIntNum);
    }
    
    if((tccIntNum>=32) && (tccIntNum<EDMA_CHA_CNT))
    {
        EDMA_RSET(CIPRH,1<<(tccIntNum-32));
    }
 
    IRQ_globalRestore(gie);
}
/*----------------------------------------------------------------------------*/

/*******************************************************************************
* 函数名称: EDMA_intStatus    			                  			           *
* 函数描述: Gets a TCC Interrupt Flag by Reading the CIPR Register             *
* 相关文档:                                                                    *
* 参数描述:  						                    			           *
* 参数名		     类型		输入/输出 	   描述	       			           *
* -------- 		     ---- 		---------	-----------    			           *
* tccIntNum         Sint32         in		Transfer Completion Code Number    *
*                                                                              *
* 返回值: 0 -- There is no Interrupt;  1 -- There is Interrupt	               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI Uint32 EDMA_intStatus(Sint32 tccIntNum)
{
Uint32 gie;
Uint32 result;

    gie = IRQ_globalDisable();
        
    if((tccIntNum>=0) && (tccIntNum<32))
    {
        result = (Uint32)((EDMA_RGET(CIPRL) & (1<<tccIntNum)) ? 1 : 0);
    }
    
    if((tccIntNum>=32) && (tccIntNum<EDMA_CHA_CNT))
    {
        result = (Uint32)((EDMA_RGET(CIPRH) & (1<<(tccIntNum-32))) ? 1 : 0);
    }
 
    IRQ_globalRestore(gie);
    
    return result;
}
/*----------------------------------------------------------------------------*/

/*******************************************************************************
* 函数名称: EDMA_intResetAll    	                    			           *
* 函数描述: Disable and Clear All EDMA Interrupt                               *
* 相关文档:                                                                    *
* 参数描述: 无 						                    			           *
* 返回值: 无                                                	               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI void EDMA_intResetAll(void)
{
Uint32 gie;

    gie = IRQ_globalDisable();

    EDMA_RSET(CIERL, EDMA_CIERL_CIE_DEFAULT);
    EDMA_RSET(CIERH, EDMA_CIERH_CIE_DEFAULT);
    EDMA_RSET(CIPRL, 0xFFFFFFFF);
    EDMA_RSET(CIPRH, 0xFFFFFFFF);

    IRQ_globalRestore(gie);
} 
/*----------------------------------------------------------------------------*/

/*******************************************************************************
* 函数名称: QDMA_config      			                  			           *
* 函数描述: Config a QDMA Channel                                              *
* 相关文档:                                                                    *
* 参数描述:  						                    			           *
* 参数名		     类型		输入/输出 	   描述	       			           *
* -------- 		     ---- 		---------	-----------    			           *
* config       EDMA_ParaConfig*    in		Configuration Structure for EDMA   *
*                                                                              *
* 返回值: 无									                               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI void QDMA_config(EDMA_ParaConfig *config)
{
Uint32 gie;
register Uint32 x0,x1,x2,x3,x4;

    gie = IRQ_globalDisable();
         
    x0 = config->opt;
    x1 = config->src;
    x2 = config->cnt;
    x3 = config->dst;
    x4 = config->idx;

    QDMA_RSET(QSRC,x1);
    QDMA_RSET(QCNT,x2);
    QDMA_RSET(QDST,x3);
    QDMA_RSET(QIDX,x4);
    QDMA_RSET(QSOPT,x0);

    IRQ_globalRestore(gie);
}
/*----------------------------------------------------------------------------*/

/*******************************************************************************
* 函数名称: QDMA_getConfig     			                  			           *
* 函数描述: Get a QDMA Channel Configuration parameter                         *
* 相关文档:                                                                    *
* 参数描述:  						                    			           *
* 参数名		     类型		输入/输出 	   描述	       			           *
* -------- 		     ---- 		---------	-----------    			           *
* config       EDMA_ParaConfig*   out		Configuration Structure for EDMA   *
*                                                                              *
* 返回值: 无									                               *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI void QDMA_getConfig(EDMA_ParaConfig *config)
{
Uint32 gie;
register Uint32 x0,x1,x2,x3,x4;
    
    gie = IRQ_globalDisable();
         
    x0 = QDMA_RGET(QOPT);
    x1 = QDMA_RGET(QSRC);
    x2 = QDMA_RGET(QCNT);
    x3 = QDMA_RGET(QDST);
    x4 = QDMA_RGET(QIDX);
        
    config->opt = x0;
    config->src = x1;
    config->cnt = x2;
    config->dst = x3;
    config->idx = x4;
    config->rld = 0x00000000;

    IRQ_globalRestore(gie);
}   
/*----------------------------------------------------------------------------*/

/*******************************************************************************
* 函数名称: EDMA_init              					       			           *
* 函数描述: EDMA Initialization Submodule Function Definitions	               *
* 相关文档: 						                      			           *							       			                   *
* 参数描述: void 						                       		           *
* 返回值: void										                           *
* 说明:			                         		                           *
*******************************************************************************/
CSLAPI void EDMA_init(void)
{
    /* Reset EDMA Controller and Clear out the Parameter RAM */       
    EDMA_resetAll();
    
    /* Set EDMA Priority Queue Length */ 
    EDMA_setPriQLength(EDMA_Q0,EDMA_Q0_LEN);
    EDMA_setPriQLength(EDMA_Q1,EDMA_Q1_LEN);
    EDMA_setPriQLength(EDMA_Q2,EDMA_Q2_LEN);
    EDMA_setPriQLength(EDMA_Q3,EDMA_Q3_LEN);
    
    IRQ_enable(IRQ_EVT_EDMAINT);
}    
/*----------------------------------------------------------------------------*/
    
/******************************************************************************\
* End of BBU_DD_EdmaAdl.c
\******************************************************************************/

⌨️ 快捷键说明

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