/********************************************************************************* Copyright(c) 2019 Analog Devices, Inc. All Rights Reserved. This software is proprietary and confidential. By using this software you agree to the terms of the associated Analog Devices License Agreement. *********************************************************************************/ /* To be added SPU and memory translation */ #include "ddr_sweep.h" #include //#define DEBUG_PRINT printf #define DEBUG_PRINT #ifdef ADI_DEBUG_PRIVATE #include "adi_dmc_def.h" #endif void MdmaAccess(uint32_t uiSourceDMACFG,uint8_t* pSrcBuf,uint32_t uiSourceMSIZE,uint32_t uiBuffSize1, uint32_t uiDestDMACFG, uint8_t* pDestBuff, uint32_t uiDestMSIZE,uint32_t uiBuffSize2) { MDMA_CONFIG(8,uiSourceDMACFG, (uint8_t*)adi_rtl_internal_to_system_addr((uint32_t)pSrcBuf,0), uiSourceMSIZE, uiBuffSize1,9,uiDestDMACFG, (uint8_t*)adi_rtl_internal_to_system_addr((uint32_t)pDestBuff,0), uiDestMSIZE, uiBuffSize2); WAIT_FOR_DMADONE(9); DISABLE_MDMA(8,9); } /************************************************************************************************************************** Function name : Memory_Sweep_Test_8Bits Description : This function can be used to perform a memory sweep test for 8 bit accesses Arguments : Parameter | Description | Valid values uiMUTStartAdd | Start address of the memory under test | 8 bit aligned address uiCount | Total number of words to be swept | unsigned int 32 bit uiAccessType | Type of access (core/DMA) | 0=core, 1= DMA uiDataPattern | Type of pattern | 0=all zeros, 1= all ones,2=all A's, 3= all 5's, 4=incremental, 5 =random sBuffAdd | Source buffer start address for testing | 8 bit aligned address uiDestBuffAdd | Destination buffer start address for testing| 8 bit aligned address uiBuffSize | Size of the test buffer | unsigned int 32 bit Return value : 0=for no failure, non-zero= number of failures. **************************************************************************************************************************/ uint32_t Memory_Sweep_Test_8Bits(uint8_t* uiMUTStartAdd, uint32_t uiCount, uint32_t uiAccessType, uint32_t uiDataPattern, uint8_t* uiSrcBuffAdd, uint8_t* uiDestBuffAdd, uint32_t uiBuffSize) { int i,j; uint8_t* pSrcBuff; uint8_t* pDestBuff; uint8_t* pMUTRead; uint8_t* pMUTWrite; uint32_t uiFailCount=0; pSrcBuff=(uint8_t*)uiSrcBuffAdd; uint32_t uiSourceMSIZE = 1; uint32_t uiDestMSIZE = 1; uint32_t uiSourceDMACFG = ENUM_DMA_CFG_MSIZE01|ENUM_DMA_CFG_PSIZE04; uint32_t uiDestDMACFG = BITM_DMA_CFG_WNR|ENUM_DMA_CFG_PSIZE04|ENUM_DMA_CFG_MSIZE01|ENUM_DMA_CFG_XCNT_INT; switch (uiAccessType){ case CORE_ACCESS: DEBUG_PRINT("\nCORE_ACCESS\n"); break; case DMA_ACCESS: DEBUG_PRINT("\nDMA_ACCESS\n"); break; } DEBUG_PRINT("Test Word size = 1 byte\n"); //Fill the source buffer with data based on the pattern type argument switch (uiDataPattern) { case ALL_ZEROS: DEBUG_PRINT("Data pattern = All ZEROS\n"); for(i=0;iCaControl); DEBUG_PRINT("\nLane0ctl0 %x",Preg->Lane0Control0); DEBUG_PRINT("\nLane0ctl1 %x",Preg->Lane0Control1); DEBUG_PRINT("\nLane0ctl2 %x",Preg->Lane0Control2); DEBUG_PRINT("\nLane0stat0 %x",Preg->Lane0Stat0); DEBUG_PRINT("\nLane0ctl0 %x",Preg->Lane1Control0); DEBUG_PRINT("\nLane0ctl1 %x",Preg->Lane1Control1); DEBUG_PRINT("\nLane0ctl2 %x",Preg->Lane1Control2); DEBUG_PRINT("\nLane1stat0 %x",Preg->Lane1Stat0); DEBUG_PRINT("\nRootCtl %x",Preg->RootControl); DEBUG_PRINT("\Scratch0 %x",Preg->Scratch0); DEBUG_PRINT("\Scratch1 %x",Preg->Scratch1); DEBUG_PRINT("\Scratch2 %x",Preg->Scratch2); DEBUG_PRINT("\Scratch3 %x",Preg->Scratch3); DEBUG_PRINT("\Scratch4 %x",Preg->Scratch4); DEBUG_PRINT("\Scratch5 %x",Preg->Scratch5); DEBUG_PRINT("\Scratch6 %x",Preg->Scratch6); DEBUG_PRINT("\Scratch7 %x",Preg->Scratch7); DEBUG_PRINT("\Zqctl0 %x",Preg->ZqControl0); DEBUG_PRINT("\Zqctl1 %x",Preg->ZqControl1); DEBUG_PRINT("\Zqctl2 %x",Preg->ZqControl2); DEBUG_PRINT("\Printing Controller registers"); DEBUG_PRINT("\nConfig %x",Creg->Config); DEBUG_PRINT("\nControl %x",Creg->Control); DEBUG_PRINT("\nDllcontrol %x",Creg->DllControl); DEBUG_PRINT("\nEfficiencyControl %x",Creg->EfficiencyCcontrol); DEBUG_PRINT("\nModeMask %x",Creg->ModeMask); DEBUG_PRINT("\nPhyControl %x",Creg->PhyControl); DEBUG_PRINT("\nPriority 0 %x",Creg->Priority0); DEBUG_PRINT("\nPriority 2 %x",Creg->Priority2); DEBUG_PRINT("\nPriorityMask0 %x",Creg->PriorityMask0); DEBUG_PRINT("\nPriorityMask2 %x",Creg->PriorityMask2); DEBUG_PRINT("\nRdBufid1 %x",Creg->RdDataBufId1); DEBUG_PRINT("\nRdBufid2 %x",Creg->RdDataBufId2); DEBUG_PRINT("\nRdBufMskid1 %x",Creg->RdDataBufMask1); DEBUG_PRINT("\nRdBufMskid1 %x",Creg->RdDataBufMsk2); DEBUG_PRINT("\nShadowMR %x",Creg->ShadowMR); DEBUG_PRINT("\nShadowMR1 %x",Creg->ShadowMR1); DEBUG_PRINT("\nShadowMR2 %x",Creg->ShadowMR2); DEBUG_PRINT("\nShadowMR3 %x",Creg->ShadowMR3); DEBUG_PRINT("\nTiming0 %x",Creg->Timing0); DEBUG_PRINT("\nTiming1 %x",Creg->Timing1); DEBUG_PRINT("\nTiming2 %x",Creg->Timing2); DEBUG_PRINT("\nDMCstat %x",Creg->Status); } #endif