// -------------------------------------------------------------------- // Copyright (c) 2008 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic Development Boards and Altera Development // Kits made by Terasic. Other use of this code, including the selling // ,duplication, or modification of any portion is strictly prohibited. // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference // which illustrates how these types of functions can be implemented. // It is the user's responsibility to verify their design for // consistency and functionality through the use of formal // verification methods. Terasic provides no warranty regarding the use // or functionality of this code. // // -------------------------------------------------------------------- // // Terasic Technologies Inc // 356 Fu-Shin E. Rd Sec. 1. JhuBei City, // HsinChu County, Taiwan // 302 // // web: http://www.terasic.com/ // email: support@terasic.com // // -------------------------------------------------------------------- #include #include #include "terasic_includes.h" #include "i2c.h" #include "mem_test.h" #include "system.h" #include #define SHOW_PROGRESS #define xTEST_I2C bool DDR2_RepeatRead(int Addr, int nNum){ bool bSuccess = TRUE; int i, Value, FirstValue; FirstValue = IORD(ALTMEMDDR_BASE, Addr); for(i=0;i I2C Testing, Iteration: %d\n", TestIndex); if (DDR2_I2C_Read()) printf("I2C Pass\n"); else printf("I2C NG\n"); #endif // memory test printf("=====> DDR2 Testing, Iteration: %d\n", TestIndex); //printf("reset memory content to zero\n"); //memset(ddr2_base, 0, MemSize); InitValue = alt_nticks(); bPass = TMEM_Verify((alt_u32)ddr2_base, MemSize, InitValue); TimeElapsed = alt_nticks()-TimeStart; if (bPass){ printf("DDR2 test pass, size=%d bytes, %.3f sec\n", MemSize, (float)TimeElapsed/(float)alt_ticks_per_second()); }else{ printf("DDR2 test fail\n"); } }while(bLoop && bPass); } return 0; }