P { margin-bottom: 0.21cm; direction: ltr; color: rgb(0, 0, 0); widows: 2; orphans: 2; }
/********************************************************************************/
/* block.c */
/* written by David Bell */
/* on 6/24/99 */
/* last modified 12/19/00 : Use CSL */
/* */
/* block.c uses the QDMA to perform a simple block transfer from external (CE2) */
/* to internal (L2) memory. */
/********************************************************************************/
#include <csl.h>
#include <csl_dat.h>
#include <csl_edma.h>
/* definitions */
#define MEM_SRC 0x80000000 /* Source address for transfer */
#define MEM_DST 0x00008000 /* Destination address for transfer */
#define EL_COUNT 0x0100 /* Element count for transfer */
/* 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()
{
unsigned short *val;
unsigned short i = 0;
val = (unsigned short *)MEM_SRC;
/* Set up transfer data */
for (i = 0; i < (EL_COUNT<<1); i++){
*val++ = i;
} /* end for */
} /* end cfg_data */
/***********************************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; /* 0x80000000 */
config.cnt = (unsigned int)EL_COUNT; /* 0x00000100 */
config.dst = (unsigned int)MEM_DST; /* 0x00002000 */
config.idx = (unsigned int)0; /* 0x00000000 */
EDMA_qdmaConfig(&config);
} /* end submit_qdma */
/**************************************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));
} /* end wait */
/***********************************check_data***********************************/
/* Verify that the data was properly transferred by comparing the source data */
/* to the destination data. */
/********************************************************************************/
int
check_data(void)
{
unsigned short *src = (unsigned short *)MEM_SRC,
*dst = (unsigned short *)MEM_DST,
source = 0,
dest = 0;
short i = 0;
int err = 0;
for (i = 0; i < (EL_COUNT<<1); i++){
dest = *dst;
source = *src;
if (dest != source){
/* Set error value if incorrect data */
err = i;
break;
} /* end if */
dst += 1;
src += 1;
} /* end for i */
return(err);
} /* end check_data */
/**************************************main**************************************/
/* Main code body. */
/********************************************************************************/
void
main(void)
{
Uint32 xfr_id = 0;
Uint32 error = 0;
cfg_data();
#if 0
submit_qdma();
wait();
#else
DAT_open(DAT_CHAANY, DAT_PRI_HIGH, 0);
xfr_id = DAT_copy((void *)MEM_SRC, (void *)MEM_DST, (Uint16)(EL_COUNT<<2));
DAT_wait(xfr_id);
DAT_close();
#endif
error = check_data();
while(error);
while(!error);
} /* end main */
this is the program for c6000 processor but i want this code to work on c6678 processor pls can u modify this program to work on c6678