📄 test_sdram.c.bak
字号:
/**********************************************************/
/* SDRAM_TEST for TMS320C6415 video board */
/* Use EDMA transfer data from internal memory to */
/* external SDRAM and compare them. */
/* parameter "error" indicates the first error occurs */
/* error=0xff indicates no error. */
/* Author: Beth */
/* Date: 2003,5,29 */
/* Version: 1.0 */
/**********************************************************/
#include <csl.h>
#include <csl_dat.h>
#include <csl_edma.h>
#include "emiface0cfg.h"
/* definitions */
#define MEM_SRC 0x00008000 /* Source address */
#define MEM_DST 0x80000000 /* Destination address*/
#define EL_COUNT 0x0100 /* Element count */
/* prototypes */
void cfg_data(void);
void submit_qdma(void);
void wait(void);
int check_data(void);
/************************************cfg_data************************************/
/* Store a data ramp in the source memory space. This data will be transferred */
/* by the EDMA. */
/********************************************************************************/
void cfg_data()
{
short *val;
unsigned short i = 0;
val = (short *)MEM_SRC;
for (i = 0; i < EL_COUNT; i++)
*val++ = i;
}
/***********************************submit_qdma**********************************/
/* Submit a QDMA request to transfer the data. */
/********************************************************************************/
void submit_qdma(void)
{
EDMA_Config config;
config.opt = (Uint32) /* 0x21200001 */
((EDMA_OPT_PRI_HIGH << _EDMA_OPT_PRI_SHIFT )
| (EDMA_OPT_ESIZE_32BIT << _EDMA_OPT_ESIZE_SHIFT )
| (EDMA_OPT_2DS_NO << _EDMA_OPT_2DS_SHIFT )
| (EDMA_OPT_SUM_INC << _EDMA_OPT_SUM_SHIFT )
| (EDMA_OPT_2DD_NO << _EDMA_OPT_2DD_SHIFT )
| (EDMA_OPT_DUM_INC << _EDMA_OPT_DUM_SHIFT )
| (EDMA_OPT_TCINT_NO << _EDMA_OPT_TCINT_SHIFT )
| (EDMA_OPT_TCC_DEFAULT << _EDMA_OPT_TCC_SHIFT )
#if (C64_SUPPORT)
| (EDMA_OPT_TCCM_DEFAULT << _EDMA_OPT_TCCM_SHIFT )
| (EDMA_OPT_ATCINT_NO << _EDMA_OPT_ATCINT_SHIFT)
| (EDMA_OPT_ATCC_DEFAULT << _EDMA_OPT_ATCC_SHIFT )
| (EDMA_OPT_PDTS_DISABLE << _EDMA_OPT_PDTS_SHIFT )
| (EDMA_OPT_PDTD_DISABLE << _EDMA_OPT_PDTD_SHIFT )
#endif
| (EDMA_OPT_LINK_NO << _EDMA_OPT_LINK_SHIFT )
| (EDMA_OPT_FS_YES << _EDMA_OPT_FS_SHIFT ));
config.src = (unsigned int)MEM_SRC; /* 0x00008000 */
config.cnt = (unsigned int)EL_COUNT; /* 0x00000100 */
config.dst = (unsigned int)MEM_DST; /* 0x80000000 */
config.idx = (unsigned int)0; /* 0x00000000 */
EDMA_qdmaConfig(&config);
}
/**************************************wait**************************************/
/* Wait until the transfer completes, as indicated by the status of the low- */
/* priority queue in the queue status register (QSR). */
/********************************************************************************/
void wait(void)
{
while (!(EDMA_getPriQStatus() & EDMA_OPT_PRI_HIGH));
}
/***********************************check_data***********************************/
/* Verify that the data was properly transferred by comparing the source data */
/* to the destination data. */
/********************************************************************************/
int check_data(void)
{
short *src = ( short *)MEM_SRC;
short *dst = ( short *)MEM_DST;
short i = 0;
int err = 0xff;
for (i = 0; i < EL_COUNT; i++)
{
if (*src++ != *dst++)
{
err = i;
break;
}
}
return(err);
}
/**************************************main**************************************/
/* Main code body. */
/********************************************************************************/
void main(void)
{
Uint32 error;
EMIFA_config(&emifaCfg0);
cfg_data();
submit_qdma();
wait();
error = check_data();
while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -