EDMA SEED 例程
来源:互联网 发布:琅琊榜光翼进阶数据 编辑:程序博客网 时间:2024/04/28 04:21
模块化
/******************************************************
* program: EDMA_pingpong_Int **
* Description: how to Init EDMA pingpong transfer **
* Author: hanyj **
********************************************************/
/**************************************************
****** 定义通道和通道参数结构 *****
***************************************************/
/********** 定义通道 three EDMA channel handle*/
EDMA_Handle hEdma; /* Handle for the EDMA channel */
EDMA_Handle hEdmaPing; /* Handle for the ping EDMA reload parameters */
EDMA_Handle hEdmaPong; /* Handle for the pong EDMA reload parameters */
/* 定义并初始化三个通道参数结构 three EDMA channel Param structure */
EDMA_Config cfgEdma{}; /* EDMA configuration structure */
EDMA_Config cfgEdmaPing{} ;
EDMA_Config cfgEdmaPong{} ;
/**************************************************
****** 通道初始化 *****
***************************************************/
/***********通道初始化步骤1 打开事件对应的通道 ********************** */
/* 1.Lets open up the EDMA channel associated with timer #1. */ //打开某个事件对应的通道
hEdma = EDMA_open(EDMA_CHA_TINT1, EDMA_OPEN_RESET);
// 2.定义两个 link 通道:将hEdmaPing 和 hEdmaPong 与任意两个link 通道表关联
hEdmaPing = EDMA_allocTable(-1);
hEdmaPong = EDMA_allocTable(-1);
/*************** 通道初始化步骤2 配置通道********************************/
/* 三个通道参数的rld段初始化,实质将通道进行了link初始化 */
/* Let's initialize the link fields of the configuration structures */
cfgEdmaPing.rld = EDMA_RLD_RMK(0,hEdmaPing);
cfgEdmaPong.rld = EDMA_RLD_RMK(0,hEdmaPong);
cfgEdma.rld = EDMA_RLD_RMK(0,hEdmaPong);
/********* 配置通道 **********************/
/* Now let's program up the EDMA channel with the configuration structure */ //配置该通道
EDMA_config(hEdma, &cfgEdma);
EDMA_config(hEdmaPing, &cfgEdmaPing);
EDMA_config(hEdmaPong, &cfgEdmaPong);
/**************** 使能 **********************************/
/* Enable the EDMA channel */
EDMA_enableChannel(hEdma);
/********************** 以上三个EDMA通道都已顺利完成初始化***********************/
/***************************************************
****** 由于用到中断,接下来设置EDMA中断 *****
***************************************************/
/************** step1 interupt_int*********************/
setupInterruptsEDMA();
/*子函数代码*/
/************************************************************************/
void setupInterruptsEDMA(void)
{
IRQ_setVecs(vectors); /* point to the IRQ vector table */
IRQ_nmiEnable();
IRQ_globalEnable();
IRQ_map(IRQ_EVT_EDMAINT, 8);
IRQ_reset(IRQ_EVT_EDMAINT);
} /* End of SetInterruptsEdma() */
/**********************step2 ENABLE EDMA Interupt*********************************/
//CPU可以响应该中断
IRQ_enable(IRQ_EVT_EDMAINT);
//EDMA可以产生中断
EDMA_intDisable(TCCINTNUM); // CIER disable
EDMA_intClear(TCCINTNUM); // CIPR
EDMA_intEnable(TCCINTNUM); // CIER enable
/***************************************************
****** 开始传输,等待事件触发EDMA传输 *****
***************************************************/
/****** 此处为定时器事件***********************/
TIMER_start(hTimer);
while(transferCount <= TRANSFER_CNT); /* waiting for interrupts */
/***************************************************
****** 每次EDMA传输结束,进EDMA中断 *****
***************************************************/
interrupt void
c_int08(void)
{
/* 步骤1:清除挂起中断,以免嵌套中断*/
/*Clear the pending interrupt from the EDMA interrupt pending register */
EDMA_intClear(TCCINTNUM);
/*Exit from the program if certain no of transfres are done*/
if (transferCount >= TRANSFER_CNT)
{
TIMER_pause(hTimer);
stopEdma();
TIMER_close(hTimer);
printf ("/nDone.....");
exit(0);
}
/* 步骤2:pingponglink*/
/* Based on if we ping'ed or pong'ed, we need to set the EDMA channel */
/* link address for the NEXT frame. */
if (pingpong){
/* Now filled pong so set link to ping */
EDMA_link(hEdma,hEdmaPing);
}else{
/* Now filled ping so set link to pong */
EDMA_link(hEdma,hEdmaPong);
}
/* 步骤3:处理*/
processbuff(0);
pingpong = (pingpong + 1) & 1;
return;
} /* end c_int08 */
/***************************************************
****** 适当条件下,结束EDMA传输 *****
***************************************************/
void stopEdma(void) {
/*Disable interrupts, close EDMA channel before exit of the program*/
IRQ_disable(IRQ_EVT_EDMAINT); //after IRQ_enable;
EDMA_intDisable(TCCINTNUM); // CIER
EDMA_intClear(TCCINTNUM); //CIPR
EDMA_RSET(CCER,0x00000000); //CCER_RST
EDMA_disableChannel(hEdma); //after EDMA_enable EER
EDMA_close(hEdma); // afer EDMA_open ER
EDMA_resetAll();
EDMA_RSET(CIPR,0xFFFFFFFF);
EDMA_RSET(ECR,0xFFFFFFFF);
}
- EDMA SEED 例程
- SEED
- seed()
- Angular Seed
- angular-seed
- 例程
- dm642的EDMA
- DSP之EDMA
- DSP中的EDMA是什么?
- TDS320DM6446的EDMA传输
- C6000 EDMA简要笔记
- C64x EDMA Architecture
- EDMA Channel Parameter Entries
- EDMA parameter RAM配置
- EDMA的基本概念
- DM6437 EDMA/QDMA
- pcie调试和edma
- DSP模块之:EDMA
- 单个文件(图片)上传功能
- 组合模式(Composite)
- Windows Mobile boot 过程详解
- 阅读分几种
- 再说spring下action的作用域
- EDMA SEED 例程
- 道、德、仁、礼
- POJ1159 Palindrome 简单的DP
- UDP socket 编程点滴记录
- 我是仪表工,我的专业是仪表
- JAVA 版的LRU页面调度算法
- 在Ogre中使用DirectShow来播放视频--重新封装并测试通过
- C/C++面试题1
- Dll中的窗体嵌入主程序的Panel