📄 dsk6xtst.c
字号:
dsk6x_hpi_read(hBd, &handShakingBuffer[4], &readLength,
DSPHS_BUFFER_ADDRESS+4*4);
if(handShakingBuffer[4] == DSP_STATUS_OUTPUT_READY)
dspProcFlag = 0; // DSP is done processing
} while(dspProcFlag);
/*-------------------------------------------------------------------*/
/* Check Results */
/*-------------------------------------------------------------------*/
readLength = 6*4;
dsk6x_hpi_read(hBd, handShakingBuffer, &readLength, DSPHS_BUFFER_ADDRESS);
error_count+=CheckResults(handShakingBuffer);
} // End of for loop
} // End of if(AllTests)
else if(MenuTests)
{
/*---------------------------------------------------------------------*/
/* Display Menu First time */
/*---------------------------------------------------------------------*/
PrintMenu();
/*---------------------------------------------------------------------*/
/* Do while loop for repeat of choices */
/*---------------------------------------------------------------------*/
do
{
/*-------------------------------------------------------------------*/
/* Request Choice 1 to 9 only for CnfTDSP.out */
/*-------------------------------------------------------------------*/
do
{
printf("\nChoice: ");
scanf("%d", &choice);
LogPrint("\nChoice: %d\n ", choice,0,0,0,0);
if(Debug)
{
if(choice == 7) // LEDS user input
{
printf(" Number of blinks, Time period (msec): ");
scanf("%d,%d", &numblink, &ledperiod);
LogPrint(" Number of blinks, Time period (msec): %d,%d\n ",
numblink,ledperiod,0,0,0);
}
if(choice == 10) // PGMEM user input
{
printf(" Value(hex), Relative Addr(hex), Size(hex): ");
scanf("%x,%x,%x", &writevalue, &startaddr, &sizemem);
LogPrint(" Value(hex), Relative Addr(hex), Size(hex): %#09x,%#09x,%#09x\n ",
writevalue,startaddr,sizemem,0,0);
}
}
LogPrint("Command=", 0,0,0,0,1);
if(choice == 1)
{
command = ISRAM;
LogPrint("ISRAM",0,0,0,0,1);
}
else if(choice == 2)
{
command = SDRAM;
LogPrint("SDRAM",0,0,0,0,1);
}
/* else if(choice == 3)
{
command = FLASH;
LogPrint("FLASH", 0,0,0,0,1);
} */
else if(choice == 3)
{
command = MCBSP;
LogPrint("MCBSP",0,0,0,0,1);
}
else if(choice == 4)
{
command = TIMER;
LogPrint("TIMER",0,0,0,0,1);
}
else if(choice == 5)
{
command = QDMA;
LogPrint("QDMA.",0,0,0,0,1);
}
else if(choice == 6)
{
command = LEDS;
LogPrint("LEDS.",0,0,0,0,1);
}
else if(choice == 7)
{
command = CODEC;
LogPrint("CODEC",0,0,0,0,1);
}
else if(choice == 8)
{
command = MENU;
LogPrint("MENU\n",0,0,0,0,1);
PrintMenu();
}
else if((choice == 9) && Debug)
{
command = PGMEM;
LogPrint("PGMEM",0,0,0,0,1);
}
else
if(Debug)
LogPrint("\nERROR! Only choices are 1-10 (9 for menu)!\n",
0,0,0,0,1);
else
LogPrint("\nERROR! Only choices are 1-9 (9 for menu)!\n",
0,0,0,0,1);
if(command == LEDS)
{
if(Debug)
{
handShakingBuffer[0]=numblink;
handShakingBuffer[1]=ledperiod;
handShakingBuffer[2]=((~(dip_settings>>24)+0x8)<<24)&0xF000000;
}
else
{
handShakingBuffer[0]=LEDBlinks;
handShakingBuffer[1]=LEDPeriod;
handShakingBuffer[2]=0;
}
LogPrint("..Are They Flashing?.......Result=>", 0,0,0,0,1);
}
else if(command == CODEC)
{
handShakingBuffer[0]=CodecTone;
handShakingBuffer[1]=CodecCDPlay;
handShakingBuffer[2]=0;
LogPrint("..Is Tone/Music Playing?...Result=>", 0,0,0,0,1);
}
else if(command == MENU)
LogPrint("\n", 0,0,0,0,1);
else if(command == PGMEM)
{
handShakingBuffer[0]=writevalue;
handShakingBuffer[1]=startaddr;
handShakingBuffer[2]=sizemem;
LogPrint("..(SDRAM)..................Result=>", 0,0,0,0,1);
}
else
LogPrint("...........................Result=>", 0,0,0,0,1);
} while(choice<1 || choice>10 || choice==9);
/*-------------------------------------------------------------------*/
/* Send parameters to Target(DSP) */
/*-------------------------------------------------------------------*/
if ((command == LEDS)||(command == CODEC)||(command == PGMEM))
{
writeLength = 3*4;
dsk6x_hpi_write(hBd, handShakingBuffer, &writeLength,
DSPHS_BUFFER_ADDRESS);
}
/*-------------------------------------------------------------------*/
/* Send command to Target(DSP) */
/*-------------------------------------------------------------------*/
writeLength = 4;
handShakingBuffer[3] = command;
dsk6x_hpi_write(hBd, &handShakingBuffer[3], &writeLength,
DSPHS_BUFFER_ADDRESS+3*4);
/*-------------------------------------------------------------------*/
/* Tell Target(DSP) that Host is ready */
/*-------------------------------------------------------------------*/
writeLength = 4;
handShakingBuffer[4] = HOST_STATUS_INPUT_READY;
dsk6x_hpi_write(hBd, &handShakingBuffer[4], &writeLength,
DSPHS_BUFFER_ADDRESS+4*4);
dspProcFlag = 1;
/*-------------------------------------------------------------------*/
/* Wait for Target(DSP) to tell you it is done! */
/*-------------------------------------------------------------------*/
do
{
readLength = 4;
dsk6x_hpi_read(hBd, &handShakingBuffer[4], &readLength,
DSPHS_BUFFER_ADDRESS+4*4);
if(handShakingBuffer[4] == DSP_STATUS_OUTPUT_READY)
dspProcFlag = 0; // DSP is done processing
} while(dspProcFlag);
/*-------------------------------------------------------------------*/
/* Check Result */
/*-------------------------------------------------------------------*/
readLength = 6*4;
dsk6x_hpi_read(hBd, handShakingBuffer, &readLength, DSPHS_BUFFER_ADDRESS);
error_count+=CheckResults(handShakingBuffer);
/*-------------------------------------------------------------------*/
/* Request Yes/No for repeat processing */
/*-------------------------------------------------------------------*/
printf("\nDo you want to make another Choice? (Yes/No): ");
scanf("%s", YesOrNo);
LogPrint("\nDo you want to make another Choice? (Yes/No): %s\n",
(ULONG)YesOrNo,0,0,0,0);
/*---------------------------------------------------------------------*/
/* Test for yes answer to repeat processing */
/*---------------------------------------------------------------------*/
} while (!strncmp("Yes",YesOrNo,1) || !strncmp("yes",YesOrNo,1));
} // End of if(MenuTests) choice
else if(InfoOnly)
{
// don't send commands to DSP
}
/*-----------------------------------------------------------------------*/
/* Tell Target(DSP) that HOST is done! */
/*-----------------------------------------------------------------------*/
writeLength = 4;
handShakingBuffer[4] = HOST_STATUS_END_PROCESSING;
dsk6x_hpi_write(hBd, &handShakingBuffer[4], &writeLength,
DSPHS_BUFFER_ADDRESS+4*4);
/*-----------------------------------------------------------------------*/
/* Close the new HPI session started with evm6x_hpi_open() */
/*-----------------------------------------------------------------------*/
if (!dsk6x_hpi_close(hBd))
{
LogPrint("FAILED: dsk6x_hpi_close()!\n", 0,0,0,0,1);
exit(6);
}
/*-----------------------------------------------------------------------*/
/* Close a previously opened driver connection to a board. */
/*-----------------------------------------------------------------------*/
if (!dsk6x_close(hBd))
{
LogPrint("FAILED: dsk6x_close()!\n", 0,0,0,0,1);
exit(7);
}
/*-----------------------------------------------------------------------*/
/* Cleanup */
/*-----------------------------------------------------------------------*/
if(InfoOnly)
{
// don't write into log file
}
else
{
if(error_count)
{
LogPrint( "\nTMS320C6211/6711 DSK %s Test FAILED!", (ULONG)TestType,0,0,0,1);
LogPrint( "\n ... Found %d test failure(s)!\n", error_count,0,0,0,1);
}
else
{
LogPrint( "\nTMS320C6211/6711 DSK %s Test PASSED!", (ULONG)TestType,0,0,0,1);
LogPrint( "\n ... No test failures found!\n", 0,0,0,0,1);
}
LogPrint( "\n\nClosing Log File: %s\n", (ULONG)sLogFile,0,0,0,1);
LogPrint( "\n** TMS320C6211/6711 DSK %s Test Complete! **\n", (ULONG)TestType,0,0,0,1);
}
if(pLogFile != NULL)
{
fclose(pLogFile);
}
exit(0);
} /* end of main() */
/*-------------------------------------------------------------------------*/
/* LogPrint() - used to print to a log file and stdout (if printflag=1) */
/*-------------------------------------------------------------------------*/
static void LogPrint( char *format, ULONG parm1, ULONG parm2,
ULONG parm3, ULONG parm4, int printflag )
{
if ( pLogFile != NULL )
{
fprintf( pLogFile, format, parm1, parm2, parm3, parm4 );
}
if (printflag)
printf( format, parm1, parm2, parm3, parm4 );
}
/*-------------------------------------------------------------------------*/
/* PressAnyKey() - used to stall and show user error message on log file */
/*-------------------------------------------------------------------------*/
static void PressAnyKey( void )
{
int c;
printf( "Press any key to continue (cntrl-C to abort)." );
c = getchar();
printf( "\n" );
if ( c == 0x03 ) { exit( -1 ); }
return;
} /* end of PressAnyKey() */
/*-------------------------------------------------------------------------*/
/* PrintMenu() - used to print list of tests in menu mode */
/*-------------------------------------------------------------------------*/
static void PrintMenu( void )
{
LogPrint("\nMake a numeric choice from the following list: \n", 0,0,0,0,1);
LogPrint("\n", 0,0,0,0,1);
LogPrint("\t1) Internal SRAM test \n", 0,0,0,0,1);
LogPrint("\t2) External SDRAM test \n", 0,0,0,0,1);
/* LogPrint("\t3) External FLASH test \n", 0,0,0,0,1); */
LogPrint("\t3) McBSP Loopback test \n", 0,0,0,0,1);
LogPrint("\t4) Timer test \n", 0,0,0,0,1);
LogPrint("\t5) QDMA test \n", 0,0,0,0,1);
LogPrint("\t6) LED test \n", 0,0,0,0,1);
LogPrint("\t7) CODEC test \n", 0,0,0,0,1);
LogPrint("\n\t8) Display this menu \n", 0,0,0,0,1);
if(Debug)
LogPrint("\n\t9) PGMEM test (SDRAM) \n", 0,0,0,0,1);
}
/*-------------------------------------------------------------------------*/
/* CheckResults() - decodes returned values (ie. error conditions) from DSP*/
/*-------------------------------------------------------------------------*/
static int CheckResults( ULONG hSB[] )
{
int error=0;
switch(hSB[5])
{
/*---------------------------------------------------------------------*/
/* Decode test results OK */
/*---------------------------------------------------------------------*/
case ISRAM_OK:
case SDRAM_OK:
case MCBSP_OK:
case TIMER_OK:
case QDMA_OK:
case LEDS_OK:
case CODEC_OK:
LogPrint(" PASSED!\n", 0,
0,0,0,1);
break;
/*---------------------------------------------------------------------*/
/* Decode test results for internal SRAM test errors */
/*---------------------------------------------------------------------*/
case ISRAM_ERR55: /* Write 55 error */
LogPrint(" FAILED!\n", 0,
0,0,0,1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -