I wanted to combine the example of ad/da programe with dmax program making a pingpang structure ,but it didn't work afer my two weeks' emmulation.Dmaxinit codes as follows,can you tell me where is wrong?Thank you.
CSL_Status dmax_init( void ) {
Uint32 i = 0;
CSL_Status status2;
Uint32 response;
response = fillMem ((Uint32) srcData, DMAX_DATA_TRANSFER_COUNT, SRC_DATA_DEFAULT, FILL_INC); if (response == ERROR_FILL) { status2 = ERROR_FILL; return status2; }
response = fillMem ((Uint32) dstData, DMAX_DATA_TRANSFER_COUNT, DST_DATA_DEFAULT, FILL_CONST); if (response == ERROR_FILL) { status2 = ERROR_FILL; return status2; }
CSL_sysInit();
status2 = CSL_dmaxInit (NULL);
if (status2 != CSL_SOK) { return status2; }
CSL_intcSetVectorPtr (ISTP_VECTOR_VALUE);
dmaxEvent.eventUid = CSL_DMAX_LOPRIORITY_MCASP0RX_UID
dmaxEvent.paramUid = CSL_DMAX_LOPRIORITY_PARAMETERENTRY0_UID;
hDmax = CSL_dmaxOpen (&dmaxEvent, CSL_DMAX, NULL, &status2);
if (status2 != CSL_SOK || (hDmax == (CSL_DmaxHandle) CSL_DMAX_BADHANDLE)) { status2 = CSL_ESYS_BADHANDLE; return status2; }
gpxfrEventSetup.qtsl = CSL_DMAX_EVENT2_QTSL_MOVE4_ELE;
gpxfrEventSetup.tcc = CSL_DMAX_EVENT2_TCC_RESETVAL;
gpxfrEventSetup.atcint = CSL_DMAX_EVENT2_ATCINT_DISABLE;
gpxfrEventSetup.tcint = CSL_DMAX_EVENT2_TCINT_ENABLE;
gpxfrEventSetup.rload = CSL_DMAX_EVENT2_RLOAD_ENABLE;
gpxfrEventSetup.cc = CSL_DMAX_EVENT2_CC_COUNT2_15_COUNT1_8_COUNT0_8;
gpxfrEventSetup.esize = CSL_DMAX_EVENT2_ESIZE_32BIT;
gpxfrEventSetup.pte = hDmax->paramPtr;
gpxfrEventSetup.etype = CSL_DMAX_EVENT2_ETYPE_GENERALXFR;
gpxfrEventSetup.paramSetup = &gpxfrParameterSetup;
gpxfrParameterSetup.count0 = DMAX_DATA_TRANSFER_COUNT;
gpxfrParameterSetup.count1 = 0;
gpxfrParameterSetup.count2 = 0;
gpxfrParameterSetup.srcIndex0 = 0x0;
gpxfrParameterSetup.dstIndex0 = 1;
gpxfrParameterSetup.srcIndex1 = 0;
gpxfrParameterSetup.dstIndex1 = 0;
gpxfrParameterSetup.dstIndex2 = 0;
gpxfrParameterSetup.srcReloadAddr0 = (Uint32)0x54000000;
gpxfrParameterSetup.dstReloadAddr0 = (Uint32) dstData;
gpxfrParameterSetup.srcReloadAddr1 = SRC_ADDR1;
gpxfrParameterSetup.dstReloadAddr1 = DST_ADDR1;
dmaxhwSetup.polarity = CSL_DMAX_POLARITY_RISING_EDGE;
dmaxhwSetup.priority = CSL_DMAX_EVENT_LO_PRIORITY;
dmaxhwSetup.eventSetup = (CSL_DmaxEventSetup *) & gpxfrEventSetup;
status2 = CSL_dmaxHwSetup (hDmax, &dmaxhwSetup);
if (status2 != CSL_SOK) { dmax_error_exit (); return status2; }
status2 = setup_interrupts ();
if (status2 != CSL_SOK) { dmax_error_exit (); return status2; }
status2 = CSL_dmaxHwControl (hDmax, CSL_DMAX_CMD_EVENTENABLE, NULL);
if (status2 != CSL_SOK) { dmax_error_exit (); return status2; }
status2 = CSL_dmaxHwControl (hDmax, CSL_DMAX_CMD_STARTASYNCTRANSFER, NULL);
if (status2 != CSL_SOK) { dmax_error_exit (); return status2; }
status2 = CSL_dmaxGetHwStatus (hDmax, CSL_DMAX_QUERY_GET_TCC, (void *) &response);
if (status2 != CSL_SOK) { dmax_error_exit (); return status2; }
while (!response) { status2 = CSL_dmaxGetHwStatus (hDmax, CSL_DMAX_QUERY_GET_TCC, (void *) &response);
if (status2 != CSL_SOK) { dmax_error_exit (); return status2; } }
if (response != 1) { printf ("Error - CPPUINT 8 Set, But TCC not set!\n"); }
else { for (i = 0; i < DMAX_DATA_TRANSFER_COUNT; i++) { if (srcData[i] != dstData[i]) { dmax_error_exit ();
status2 = CSL_ESYS_FAIL; return status2; } } }
status2 = CSL_dmaxHwControl (hDmax, CSL_DMAX_CMD_CLEARTCC, NULL);
if (status2 != CSL_SOK) { dmax_error_exit (); return status2; }
status2 = CSL_dmaxGetHwStatus (hDmax, CSL_DMAX_QUERY_GET_TCC, (void *) &response);
if (status2 != CSL_SOK) { dmax_error_exit (); return status2; }
if (response != 0) { printf ("Clear TCC Bit failed!\n"); }
else { printf ("Clear TCC bit Passed!\n"); }
status2 = CSL_dmaxClose (hDmax);
if (status2 != CSL_SOK) { return status2; } return status2; }