diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/README.txt b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/README.txt deleted file mode 100644 index c4d32efe..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/README.txt +++ /dev/null @@ -1 +0,0 @@ -Empty application. Add your own sources. diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/ct.h b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/ct.h deleted file mode 100644 index 5f10f900..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/ct.h +++ /dev/null @@ -1,586 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file ct.h -* -* Code test (CT) utility driver. -* -* This package is intended to help designers test their Xilinx device drivers -* in unit and integration testing environments. The macros and functions -* provide the following services: -* -* - Automated data comparison -* - Xilinx driver assert testing -* - Interrupt utilities -* - Error & message logging -* - Test sequencing utilities -* - Timing utilities -* -* The main benefit of this package is to simplify test code and make it easier -* for the tester to get more coverage in their integration and unit testing -* without having to replicate common testing constructs. -* -* Integrating CT Source code -* -* This package consists of this header file and an implementation file. The -* implementation can be operating system specific. When including this package -* in your test, use this file and one of the CT implementation files such as -* ct_vxworks.c. -* -* There are GNU specific "C" extensions used in this package and as a result -* make it non-ANSI compliment. The tester must compile this package and their -* other test code with the GNU compiler suite. -* -* The CT package requires that there be available standard header files -* stdio.h, string.h, and stdarg.h. -* -* -* Setup and Test Sequencing -* -* Before calling any comparison or utility function in this package, the tester -* should call CT_Init() to initialize the library. This function only needs to -* be called once. -* -* During tests, your code may be segmented into sub tests where you would want -* separate out the results. At the end of all sub tests, you may want to -summarize -* all the tests run. The following pseudo code shows how this is done with CT -* sequencing function calls: -* -*
-* -* CT_Init(); -* -* // Subtest #1 -* CT_TestReset("This is my Subtest #1"); -* ... -* // Subtest code -* ... -* Failures = CT_GetTestFailures(); -* CT_Message("Subtest #1 had %d failures\r\n", Failures); -* -* // Subtest #2 -* CT_TestReset("This is my Subtest #2"); -* ... -* // Subtest code -* ... -* Failures = CT_GetTestFailures(); -* CT_Message("Subtest #2 had %d failures\r\n", Failures); -* -* Failures = CT_GetTotalFailures(); -* CT_Message("Total test failures = %d\r\n", Failures); -* -*-* -* General Usage -* -* The heart of this package utilizes macros to compare variables or memory -* areas. For example, -* -*
-* -* CT_CMP_NUM(int, ActualValue, ExpectedValue); -* -*-* -* compares two values of type int. If they are not equal, then an error message -* is logged and an internal counter is incremented. If they are equal, then the -* test proceeds as if nothing had occurred. Other examples: -* -*
-* -* CT_CMP_NUM(int, *ActualPtr, 5); -* CT_CMP_NUM(int*, ActualPtr, 0x20002100); -* -*-* -* With each failure, a descriptive message is printed along with the line number -* of the invoking code. -* -* If the tester needs to make a comparison manually, then they can use the -* CT_LOG_FAILURE() macro to note the error in case the comparison is negative. -* If the tester needs to emit an informational message, then they can use the -* CT_Mesage() function. Calling this function does not increment error counters. -* -* -* Message Logging -* -* This package uses the printf() library for message logging. -* -* Ideally, the tester's environment should include some sort of UART. By -* default CT utilizes a pre-configured console UART. -* -* If your system does not contain a UART, then another method of providing -* results includes printf'ing messages to memory. To enable this method, -* enable the definition of IO_USE_BUFFER in this file. To further tailor this -* method of logging, change IO_BUF_SIZE and IO_BUF_CUSHION. All output will -* be written to the TextBuf array. Use your debugger or your own test -* utilities to examine this buffer for generated output. -* -* -* Limitations -* -* - This package must be compiled under the GNU compiler suite. -* - CT_CMP macros can compare only ordinal data types. Structure type -* comparisons require the tester to implement their own function. -* - Some sort of BSP is required to support implementation of string.h, -* stdio.h, and stdarg.h at a minimum. -* - Advanced BSP support of signal.h is required to use CT_SetAlarm(). -* If support is not available, then this function will return an error. -* - Testing asserts requires that NDEBUG not be defined in your driver under -* test code. -* -*
-* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* --- ---- -------- ----------------------------------------------- -* 1 rmm 12/23/03 First release for VxWorks -* -*-* -******************************************************************************/ -#ifndef CT_H -#define CT_H - -/***************************** Include Files *********************************/ - -#include "xil_types.h" /* Needed for assert testing */ -#include "xil_assert.h" -#include
- * 1 int i; - * 2 - * 3 i = 10; - * 4 if (i != 5) - * 5 { - * 6 CT_LOG_FAILURE("GetDataFromDevice() returned %d instead of 5", i); - * 7 CT_LOG_FAILURE("D'oh"); - * 8 } - *- * - * yields the output: - * - * FAIL: 0006: GetDataFromDevice() returned 10 instead of 5 - * FAIL: 0007: D'oh - * - * @param fmt is a printf style format string - * @param args is a variable argument list that matches fields in the fmt - * string. - * - * @note - * Usage: CT_LOG_FAILURE(char* fmt, ...) - *****************************************************************************/ -#define CT_LOG_FAILURE(fmt, args...) \ - CT_LogFailure(CT_ERR_FMT fmt "\r\n", __FILE__, __LINE__ , ## args) - -/* Note: In the preceding construct, the space between __FILE__, __LINE__ and - * the comma are needed for the ## args to work when there is no "args" - * expansion like in line 7 of the example shown above. - */ - -/*****************************************************************************/ -/** - * - * Test asserts for a function. This macro will verify whether the called - * function generates an assert from the provided arguments. If it does not - * then a failure message is logged. - * - * The design of this macro allows the tester to verify an assert occurs - * with a single line of code with full type checking of the called - * function. For example, if your function under test is coded as: - * - *
- * void XDev_Start(Dev* Instance) - * { - * Xil_AssertVoid(Dev != NULL); - * ... - * } - *- * - * Then use CT_ASSERT in the following way to verify that the assert is caught. - * - *
- * CT_ASSERT(XDev_Start, (Dev*)NULL); - *- * - * @param Function is the function being tested for asserts. - * @param args is a variable number of arguments. It contains whatever arguments - * should cause an assert. These arguments are arranged by the - * preprocessor in the order provided by the tester. - * - * @note - * Usage: CT_ASSERT(SomeFunc, arg1, arg2, ...) - *****************************************************************************/ -#define CT_ASSERT(Function, args...) \ -{ \ - if (CT_IsAssertDisabled()) \ - CT_LogFailure(CT_ERR_FMT "NDEBUG is defined, assert test failed\r\n", \ - __FILE__, __LINE__); \ - else \ - { \ - XAssertStatus = XASSERT_NONE; \ - XWaitInAssert = FALSE; \ - (void)Function(args); \ - XWaitInAssert = TRUE; \ - if (XAssertStatus == XASSERT_NONE) \ - CT_LogFailure(CT_ERR_FMT "Assert failed\r\n", __FILE__, __LINE__); \ - } \ -} - -/*****************************************************************************/ -/** - * - * Compare numbers. If not equal, then output message and increment fail - * counter. The message contains the line number of the failure, the - * name of the variable, and its actual and expected values in hex and - * decimal. An example: - * - *
- * 1 UINT32 result = 5; - * 2 UINT32 expected = 17; - * 3 - * 4 CT_CMP_NUM(UINT32, result, expected) - * - * yields the output: - * - * FAIL: 0004: result=5(5h), expected 17(11h) - * - *- * - * @param type is data type to compare (must be an ordinal type such as int) - * @param actual is the actual data retrieved from test - * @param expected is the expected value - * - * @note - * Usage: CT_CMP_NUM(
- * 1 UINT32 result[5]; - * 2 UINT32 expected[5]; - * 3 int i; - * 4 - * 5 for (i=0; i<5; i++) - * 6 { - * 7 CT_CMP_NUM_ARG(UINT32, result[i], expected[i], i); - * 8 } - * 9 - * - * yeilds the output if for example failure occurs at i=3: - * - * FAIL: 0007: result=5(5h), expected 17(11h). i=3 - *- * - * @param type is data type to compare (must be an ordinal type such as int) - * @param actual is the actual data retrieved from test - * @param expected is the expected value - * @param arg is an argument that can be treated as an integer. - * - * @note - * Usage: CT_CMP_NUM_ARG(
- * 1 UINT32 result[5]; - * 2 UINT32 expected[5]; - * 3 int i, j=(int)&result[0]; - * 4 - * 5 for (i=0; i<5; i++, j++) - * 6 { - * 7 CT_CMP_NUM_ARG2(UINT32, result[i], expected[i], i, j); - * 8 } - * 9 - * - * yeilds the output if for example failure occurs at i=3: - * - * FAIL: 0007: result=5(5h), expected 17(11h). i=3, j=543234 - *- * - * @param type is data type to compare (must be an ordinal type such as int) - * @param actual is the actual data retrieved from test - * @param expected is the expected value - * @param arg1 is an argument that can be treated as an integer. - * @param arg2 is an argument that can be treated as an integer. - * - * @note - * Usage: CT_CMP_NUM_ARG2(
-* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* --- ---- -------- ----------------------------------------------- -* 1.0 rmm 12/23/03 First release -* 1.1 xd 03/16/04 Changed to support PPC405 without OS. -* -*-* -******************************************************************************/ - -/***************************** Include Files *********************************/ -#include
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ---- ---------------------------------------------------------------- -* 1.0 sb 11/28/14 First release. -*-* -******************************************************************************/ - -/***************************** Include Files *********************************/ - -#include "intg.h" - -/************************** Constant Definitions *****************************/ - -/** - * Main menu selections. - * @{ - */ -#define MENU_MAIN_TEST 1 -#define MENU_MAIN_UTIL 2 -#define MENU_MAIN_EXIT 99 -/*@}*/ - -/** - * Test sub-menu selections. - * @{ - */ -#define MENU_TEST_ALL 0 -#define MENU_TEST_ERASE_READ 1 -#define MENU_TEST_FLASH_RW 2 -#define MENU_TEST_RANDOM_RW 3 -#define MENU_TEST_SPAREBYTES_RW 4 -#define MENU_TEST_PARTIAL_RW 5 -#define MENU_TEST_ECC 6 -#define MENU_TEST_BBT 7 -#define MENU_TEST_MARK_BLOCK_BAD 8 -#define MENU_TEST_EXIT 99 -/*@}*/ - -/** - * Create unique bitmasks from the test numbers. - * @{ - */ -#define INTG_TEST_ALL 0xFFFFFFFF -#define INTG_TEST_ERASE_READ (1 << MENU_TEST_ERASE_READ) -#define INTG_TEST_FLASH_RW (1 << MENU_TEST_FLASH_RW) -#define INTG_TEST_RANDOM_RW (1 << MENU_TEST_RANDOM_RW) -#define INTG_TEST_SPAREBYTES_RW (1 << MENU_TEST_SPAREBYTES_RW) -#define INTG_TEST_PARTIAL_RW (1 << MENU_TEST_PARTIAL_RW) -#define INTG_TEST_ECC (1 << MENU_TEST_ECC) -#define INTG_TEST_BBT (1 << MENU_TEST_BBT) -#define INTG_TEST_MARK_BLOCK_BAD (1 << MENU_TEST_MARK_BLOCK_BAD) -/*@}*/ - -/** - * Utility sub-menu selections. - * @{ - */ -#define MENU_UTIL_DATA_INTERFACE 1 -#define MENU_UTIL_OOB_MODE 2 -#define MENU_UTIL_DMA_MODE 3 -#define MENU_UTIL_EXIT 99 -/*@}*/ - -typedef enum TimingMode { - Mode0 = 0U, - Mode1, - Mode2, - Mode3, - Mode4, - Mode5 -}NandPsu_TimingMode; - - -/**************************** Type Definitions *******************************/ - -/***************** Macros (Inline Functions) Definitions *********************/ - -/************************** Variable Definitions *****************************/ -/* - * Buffers used during read and write transactions. - */ -u8 ReadBuffer[TEST_BUF_SIZE] __attribute__ ((aligned(64)));/**< Read buffer */ -u8 WriteBuffer[TEST_BUF_SIZE] __attribute__ ((aligned(64)));/**< write buffer */ -/** - * Nand driver instance for the Nand device. - */ -XNandPsu NandInstance; -XNandPsu *NandInstPtr = &NandInstance; - -s32 MismatchCounter; -/************************** Function Prototypes ******************************/ - -#ifndef AUTOMATIC_TEST_MODE -static unsigned int GetUserInput(char* Prompt, char* Response, - unsigned int - MaxChars); -static int GetMainMenuCommand(char* CmdLine); -static void RunTestMenu(char* CmdLine); -static void RunUtilMenu(char* CmdLine); -#endif -extern char inbyte (); /**< Inbyte returns the byte received by device. */ -s32 FlashInit(u16 NandDeviceId); -#ifdef AUTOMATIC_TEST_MODE -int Automode_Tests(int TestLoops); -int CodeCoverage_Tests(int TestLoops); -#endif - -/*****************************************************************************/ -/* - * Retrieve a line of input from the user. A line is defined as all characters - * up to a new line. - * - * This basically implements a fgets function. The standalone EDK stdin - * is apparently buggy because it behaves differently when new line is - * entered by itself vs. when it is entered after a number of regular chars - * have been entered. Characters entered are echoed back. - * - * @param Prompt - Printed before string is accepted to ask the user to - * enter something. - * @param Response - User entered string with new line stripped - * @param MaxChars - Maximum number of characters to read - * - * @return Number of characters read (excluding newlines) - * - *****************************************************************************/ -unsigned int GetUserInput(char* Prompt, char* Response, unsigned int MaxChars) -{ - int Finished, i; - - /* display prompt */ - if (Prompt) printf(Prompt); - - Finished = 0; - i = 0; - - while(!Finished && (i < MaxChars - 1)) { - /* flush out any output pending in stdout */ - fflush(stdout); - - /* wait for a character to arrive */ - Response[i] = inbyte(); - - /* normal chars, add them to the string and keep going */ - if ((Response[i] >= 0x20) && (Response[i] <=0x7E)) { - printf("%c", Response[i++]); - continue; - } - - /* control chars */ - switch(Response[i]) { - /* carriage return */ - case 0x0D: - /* Case Fall through */ - /* Line Feed */ - case 0x0A: - Response[i++] = '\n'; - Finished = 1; - printf("\r\n"); - break; - - /* backspace */ - case 0x08: - if (i != 0) { - /* erase previous character and move - cursor back one space */ - printf("\b \b"); - Response[--i] = 0; - } - break; - - /* ignore all other control chars */ - default: - continue; - } - } - - Response[i] = 0; - return i; -} - -/*****************************************************************************/ -/** -* -* Intg_Entry -* -* Executes all unit tests for the device -* -* param None -* -* @return None -* -* @note None -* -******************************************************************************/ -void Intg_Entry(void) -{ - s32 Status = XST_FAILURE; -#ifdef AUTOMATIC_TEST_MODE - int TestLoops; - int TestFailures; - u32 t_mode = 0U; -#else - char CmdLine[132]; -#endif - - /* print banner */ - printf("\r\n\r\nNand Driver Integration Test\r\n" - "Created on %s\n\n\r", __DATE__); - printf("=====================================================\r\n"); - - CT_Init(); - - Status = FlashInit(NAND_DEVICE_ID); - if(Status != XST_SUCCESS){ - printf("Flash Initialization Failed\r\n"); - goto Out; - } - printf("Flash initialization done\r\n"); -#ifndef AUTOMATIC_TEST_MODE - /* prompt user for menu selections */ - while(1) { - switch(GetMainMenuCommand(CmdLine)) { - case MENU_MAIN_TEST: - RunTestMenu(CmdLine); - break; - - case MENU_MAIN_UTIL: - RunUtilMenu(CmdLine); - break; - - case MENU_MAIN_EXIT: - printf("\r\nByebye!\r\n"); - return; - - default: - printf("Invalid selection\r\n"); - } - } -#else - /* set defaults */ - TestLoops = 1; - TestFailures = 0; - - /* - * Setting Interface - */ - NandInstPtr->DataInterface = XNANDPSU_SDR; - - for (t_mode = Mode0; t_mode <= Mode5; t_mode++){ - NandInstPtr->DataInterface = XNANDPSU_SDR; - - /* - * Set Timing mode - */ - Status = XNandPsu_ChangeTimingMode(NandInstPtr, XNANDPSU_SDR, t_mode); - if (Status != XST_SUCCESS) { - goto Out; - } - xil_printf("\n\tCurrent Interface is SDR and Timing Mode is %d\r\n", - t_mode); - /* - * Run the test cases - */ - TestFailures += Automode_Tests(TestLoops); - } - - for (t_mode = Mode0; t_mode <= Mode5; t_mode++){ - - NandInstPtr->DataInterface = XNANDPSU_NVDDR; - /* - * Set Timing mode - */ - Status = XNandPsu_ChangeTimingMode(NandInstPtr, XNANDPSU_NVDDR, - t_mode); - if (Status != XST_SUCCESS) { - goto Out; - } - xil_printf("\n\tCurrent Interface is NVDDR and Timing Mode is " - "%d\r\n", t_mode); - /* - * Run the test cases - */ - TestFailures += Automode_Tests(TestLoops); - } - - /* - * Set No OOB Option and Run Test Cases - */ - XNandPsu_DisableBbtOobMode(NandInstPtr); - printf("NO OOB Mode selected..Scanning for BBT\r\n"); - Status = XNandPsu_ScanBbt(NandInstPtr); - if(Status != XST_SUCCESS){ - printf("Scan BBT Failed\r\n"); - goto Out; - } - TestFailures += Automode_Tests(TestLoops); - - /* - * Run Code Coverage Tests - */ - TestFailures += CodeCoverage_Tests(TestLoops); - - if (TestFailures) { - XIL_FAIL(TestFailures); - } else { - XIL_PASS(); - } -#endif - -Out: - return; -} - -#ifdef AUTOMATIC_TEST_MODE -/*****************************************************************************/ -/** -* -* Auto Mode Tests -* -* Executes all unit tests for the device -* -* param TestLoops: Number of times a test should run. -* -* @return Total Test failures -* -* @note None -* -******************************************************************************/ -int Automode_Tests(int TestLoops) -{ - volatile int failures = 0; - - failures += Intg_EraseReadTest(NandInstPtr, TestLoops); - failures += Intg_FlashRWTest(NandInstPtr, TestLoops); - failures += Intg_RandomRWTest(NandInstPtr, TestLoops); - failures += Intg_SpareBytesRWTest(NandInstPtr, TestLoops); - failures += Intg_PartialRWTest(NandInstPtr, TestLoops); - failures += Intg_EccTest(NandInstPtr, TestLoops); - - return failures; -} - -/*****************************************************************************/ -/** -* -* Code Coverage Tests -* -* Executes all code coverage tests for the device -* -* param TestLoops: Number of times a test should run. -* -* @return Total Test failures -* -* @note None -* -******************************************************************************/ -int CodeCoverage_Tests(int TestLoops) -{ - volatile int failures = 0; - - printf("\tRunning Code Coverage Tests Now\r\n"); - - XNandPsu_DisableDmaMode(NandInstPtr); - failures += Automode_Tests(TestLoops); - XNandPsu_EnableDmaMode(NandInstPtr); - failures += Intg_BbtTest(NandInstPtr, TestLoops); - failures += Intg_MarkBlockBadTest(NandInstPtr, TestLoops); - failures += Intg_CodeCoverageTest(NandInstPtr, TestLoops); - - return failures; -} -#endif - -#ifndef AUTOMATIC_TEST_MODE -/*****************************************************************************/ -/** - * - * Prompt the user for selections in the main menu. The user is allowed to - * enter one command at a time. - * - * @param CmdLine - Storage to use for User input. - * - * @return Numeric command entered. - * - * @note None. - * - *****************************************************************************/ -static int GetMainMenuCommand(char* CmdLine) -{ - /* prompt user */ - printf("\r\n\r\n\r\nMain Menu:\r\n" - "==========\r\n"); - printf("%d - Test menu\r\n", MENU_MAIN_TEST); - printf("%d - Util menu\r\n", MENU_MAIN_UTIL); - printf("%d - Exit\r\n\r\n", MENU_MAIN_EXIT); - - *CmdLine = '\n'; - while(*CmdLine == '\n') { - printf("Enter selection: "); - GetUserInput(0, CmdLine, 131); - } - return(atoi(CmdLine)); -} - - -/*****************************************************************************/ -/** - * - * Prompt the user for a sequence of tests to run in the test sub-menu - * - * @param CmdLine - Storage to use for User input - * - * @return None - * - * @note None - * - *****************************************************************************/ -static void RunTestMenu(char* CmdLine) -{ - char* Token; - char* tmp; - int QuitToMain = 0; - int TestLoops; - int TestFailures; - u32 RunTestMask; - - /* - * Flash Initialization Function - */ - - while(!QuitToMain) { - /* set defaults */ - TestLoops = 1; - RunTestMask = 0; - TestFailures = 0; - - /* prompt user */ - printf("\r\n\r\n\r\nTest Menu:\r\n" - "==========\r\n"); - printf("%d - Run all tests\r\n", MENU_TEST_ALL); - printf("%d - Flash Erase Read Test\r\n", MENU_TEST_ERASE_READ); - printf("%d - Flash Read Write Test \r\n", MENU_TEST_FLASH_RW); - printf("%d - Random Block Flash Read Write Test\r\n", - MENU_TEST_RANDOM_RW); - printf("%d - Spare Bytes Read Write Test \r\n", - MENU_TEST_SPAREBYTES_RW); - printf("%d - Partial Page Read Write Test\r\n", - MENU_TEST_PARTIAL_RW); - printf("%d - ECC Test.\r\n", MENU_TEST_ECC); - printf("%d - BBT Scan Test.\r\n", MENU_TEST_BBT); - printf("%d - Mark Block Bad Test.\r\n", MENU_TEST_MARK_BLOCK_BAD); - printf("%d - Exit to main menu\r\n\r\n", MENU_TEST_EXIT); - printf("More than one test can be specified\r\n" - "Adding l
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 11/28/14 First release. -* -*-* -*****************************************************************************/ -#ifndef INTG_H /**< prevent circular inclusions */ -#define INTG_H /**< by using protection macros */ - -/***************************** Include Files ********************************/ - -#include "xparameters.h" -#include "xnandpsu.h" -#include "xscugic.h" -#include "xstatus.h" -#include
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 11/28/2014 First release -* -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ - -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 Bbt_Test(XNandPsu * NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the Bbt Scan test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_BbtTest(XNandPsu * NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module Bbt Scan test"); - - while(TestLoops--) { - Status = Bbt_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Bbt Scan Test Failed\r\n"); - break; - } - CT_NotifyNextPass(); - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* Scan for Bad Block table. -* If not found Create new and write it onto flash. -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* -* @note -* None -* -****************************************************************************/ -s32 Bbt_Test(XNandPsu * NandInstPtr) -{ - s32 Status = XST_FAILURE; - - /* - * Enabling Ecc Mode - */ - XNandPsu_EnableEccMode(NandInstPtr); - - /* - * Scanning for Bbt - */ - Status = XNandPsu_ScanBbt(NandInstPtr); - - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_codecoverage_test.c b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_codecoverage_test.c deleted file mode 100644 index b23870dc..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_codecoverage_test.c +++ /dev/null @@ -1,187 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file intg_codecoverage_test.c -* -* This file contains the design example for using NAND driver (XNandPsu). -* This example scans the Bbt on the flash. If found returns success else -* Creates a new BBT and writes it on the flash. -* -* @note None. -* -* -*
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 12/18/2014 First release -* -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ -#define EXPECTED_FAILURES 2 -#define RANDOM_DEVICEID 1U -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 CodeCoverage_Test(XNandPsu *NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the Code Coverage test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_CodeCoverageTest(XNandPsu *NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module Code Coverage test"); - - while(TestLoops--) { - Status = CodeCoverage_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Code Coverage Test Failed\r\n"); - break; - } - CT_NotifyNextPass(); - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* - Performs Code Coverage for -* -XNandPsu_WriteSpareBytes -* -XNandPsu_LookupConfig -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* -* @note -* None -* -****************************************************************************/ -s32 CodeCoverage_Test(XNandPsu *NandInstPtr) -{ - s32 Status = XST_FAILURE; - XNandPsu_Config *StatusPtr = NULL; - u32 Index; - u64 Offset; - u16 Length; - s32 Failures = 0; - - Offset = (u64)(TEST_PAGE_START * NandInstPtr->Geometry.PagesPerBlock); - Length = NandInstPtr->Geometry.BytesPerPage; - - /* - * Initialize the write buffer - */ - for (Index = 0; Index < Length;Index++) { - WriteBuffer[Index] = (u8) (rand() % 256); - } - - /* - * Altering Ecc Address for covering code in - * XNandPsu_WriteSpareBytes API - */ - NandInstPtr->EccCfg.EccAddr -= 8U; - - /* - * Enabling DMA Mode - */ - XNandPsu_EnableDmaMode(NandInstPtr); - /* - * Write to flash Spare Bytes Section - */ - Status = XNandPsu_WriteSpareBytes(NandInstPtr, (u32)Offset, - &WriteBuffer[0]); - if (Status != XST_SUCCESS) { - Failures++; - } - /* - * Reverting the Ecc Address back to original. - */ - NandInstPtr->EccCfg.EccAddr += 8U; - - /* - * Code Coverage for LookUp Config API - */ - StatusPtr = XNandPsu_LookupConfig(RANDOM_DEVICEID); - if (StatusPtr == NULL){ - Failures++; - } - - if(Failures == EXPECTED_FAILURES){ - Status = XST_SUCCESS; - } - - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_ecc_test.c b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_ecc_test.c deleted file mode 100644 index e4bbd5e9..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_ecc_test.c +++ /dev/null @@ -1,271 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file intg_ecc_test.c -* -* This file contains the design example for using NAND driver (XNandPsu). -* This example tests the erase, read and write feature of the controller -* in the spare bytes region.The flash is erased and written. The data is -* read back and compared with the data written for correctness. -* -* @note None. -* -* -*
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 11/28/2014 First release -* -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ - -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 Ecc_Test(XNandPsu * NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the ECC R/W test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_EccTest(XNandPsu * NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module Ecc Error Check test"); - - while(TestLoops--) { - Status = Ecc_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Ecc Error Check Test Failed with " - "%d mismatches\r\n", MismatchCounter); - break; - } - CT_NotifyNextPass(); - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* - Erase the block. -* - Write data to the page. -* - Read back the data from the page. -* - Compare the data read against the data Written. -* - Corrupt data by writing random data to page -* - Read back the data from the page. -* - Compare the data read against the data Written before corruption. -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* - XST_SUCCESS if successful. -* - XST_FAILURE if failed. -* -* @note -* None -* -****************************************************************************/ -s32 Ecc_Test(XNandPsu * NandInstPtr) -{ - s32 Status = XST_FAILURE; - u32 Index; - u64 Offset; - u32 SpareOffset,ReadSpareOffset,WriteSpareOffset; - u32 Length; - s32 i,j; - MismatchCounter = 0; - u8 SpareBuffer[TEST_BUF_SIZE]; - u32 BlockSize = NandInstPtr->Geometry.BlockSize; - NandInstPtr->Ecc_Stats_total_flips = 0; - - Offset = (u64)(TEST_PAGE_START * NandInstPtr->Geometry.BytesPerPage); - /* - * Offset to write in spare area - */ - SpareOffset = TEST_PAGE_START; - - Length = NandInstPtr->Geometry.BytesPerPage; - - /* - * Initialize the write buffer - */ - for (Index = 0; Index < Length;Index++) { - WriteBuffer[Index] = (u8)0; - } - - /* - * Erase the Block - */ - Status = XNandPsu_Erase(NandInstPtr, (u64)Offset, (u64)BlockSize); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Enable ECC - */ - XNandPsu_EnableEccMode(NandInstPtr); - - /* - * Write first 30 pages of the block. - */ - for(i = 0 ; i < 24 ; i++){ - /* - * Write to flash - */ - Status = XNandPsu_Write(NandInstPtr, (u64)Offset, (u64)Length, - &WriteBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - Offset = Offset + NandInstPtr->Geometry.BytesPerPage; - } - - ReadSpareOffset = SpareOffset; - WriteSpareOffset = Offset/(NandInstPtr->Geometry.BytesPerPage); - - for(i = 0 ; i < 24 ; i++){ - /* - * Read the Spare Area - */ - Status = XNandPsu_ReadSpareBytes(NandInstPtr, ReadSpareOffset, - &SpareBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Disable the ecc mode - */ - XNandPsu_DisableEccMode(NandInstPtr); - - - /* - * Corrupting the data in write buffer. - */ - for(j = 0; j<= i ; j++){ - WriteBuffer[j] = (u8)1; - } - - Status = XNandPsu_Write(NandInstPtr, Offset, Length, &WriteBuffer[0]); - if(Status != XST_SUCCESS){ - goto Out; - } - - /* - * Write the Ecc Data into the spare area of next page. - */ - Status = XNandPsu_WriteSpareBytes(NandInstPtr, WriteSpareOffset, - &SpareBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - for(j = 0; j<= i ; j++){ - WriteBuffer[j] = (u8)0; - } - /* - * Enable Ecc Mode - */ - XNandPsu_EnableEccMode(NandInstPtr); - - /* - * Read the page after writing - */ - Status = XNandPsu_Read(NandInstPtr, Offset, Length, - &ReadBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Compare the results - */ - for (Index = 0U; Index < Length;Index++) { - if (ReadBuffer[Index] != WriteBuffer[Index]) { - MismatchCounter++; - Status = XST_FAILURE; - } - - } - ReadSpareOffset++; - WriteSpareOffset++; - Offset = Offset + NandInstPtr->Geometry.BytesPerPage; - } - xil_printf("Total Ecc Error Flips = %d\r\n", - NandInstPtr->Ecc_Stats_total_flips); -Out: - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_erase_read.c b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_erase_read.c deleted file mode 100644 index d72af841..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_erase_read.c +++ /dev/null @@ -1,190 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file intg_erase_read.c -* -* This file contains the design example for using NAND driver (XNandPsu). -* This example tests the erase and read feature of the controller. -* The flash is erased. The data is -* read back and compared with the 0xFF for correctness. -* -* @note None. -* -* -*
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 11/28/2014 First release -* -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ - -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 Erase_Read_Test(XNandPsu * NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the Erase Read test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_EraseReadTest(XNandPsu * NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module FLASH Erase Read test"); - - while(TestLoops--) { - Status = Erase_Read_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Nand Flash Erase ReadTest Failed" - " with %d mismatches\r\n", MismatchCounter); - break; - } - CT_NotifyNextPass(); - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* - Erase the block. -* - Read back the data from the block. -* - Compare the data read against 0xFF. -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* - XST_SUCCESS if successful. -* - XST_FAILURE if failed. -* -* @note -* None -* -****************************************************************************/ -s32 Erase_Read_Test(XNandPsu * NandInstPtr) -{ - s32 Status = XST_FAILURE; - s32 i = 0; - u32 Index; - u64 Offset; - u32 Length; - u32 BlockSize = NandInstPtr->Geometry.BlockSize; - MismatchCounter = 0; - - Offset = (u64)TEST_BLOCK_START * NandInstPtr->Geometry.BlockSize; - Length = NandInstPtr->Geometry.BytesPerPage; - - /* - * Erasing whole block - */ - Status = XNandPsu_Erase(NandInstPtr, (u64)Offset, (u64)BlockSize); - if (Status != XST_SUCCESS) { - goto Out; - } - - for (i = 0; i < NandInstPtr->Geometry.PagesPerBlock; i++){ - /* - * Disbale ECC - */ - XNandPsu_DisableEccMode(NandInstPtr); - - /* - * Read the block. - */ - Status = XNandPsu_Read(NandInstPtr, (u64)Offset, (u64)Length, - &ReadBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Enable ECC - */ - XNandPsu_EnableEccMode(NandInstPtr); - - /* - * Compare the results - */ - for (Index = 0U; Index < Length;Index++) { - if (ReadBuffer[Index] != (u8)0xFF) { - MismatchCounter++; - Status = XST_FAILURE; - } - } - Offset = Offset + NandInstPtr->Geometry.BytesPerPage; - } - -Out: - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_flash_rw.c b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_flash_rw.c deleted file mode 100644 index 0798f018..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_flash_rw.c +++ /dev/null @@ -1,193 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file intg_flash_rw.c -* -* This file contains the design example for using NAND driver (XNandPsu). -* This example tests the erase, read and write feature of the controller. -* The flash is erased and written. The data is -* read back and compared with the data written for correctness. -* -* @note None. -* -* -*
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 11/28/2014 First release -* -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ - -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 Flash_RW_Test(XNandPsu * NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the Flash R/W test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_FlashRWTest(XNandPsu * NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module FLASH Read Write test"); - - while(TestLoops--) { - Status = Flash_RW_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Nand Flash Read Write Test Failed" - " with %d mismatches\r\n", MismatchCounter); - break; - } - CT_NotifyNextPass(); - - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* - Initialize the driver. -* - Erase the block. -* - Write data to the page. -* - Read back the data from the page. -* - Compare the data read against the data Written. -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* - XST_SUCCESS if successful. -* - XST_FAILURE if failed. -* -* @note -* None -* -****************************************************************************/ -s32 Flash_RW_Test(XNandPsu * NandInstPtr) -{ - s32 Status = XST_FAILURE; - u32 Index; - u64 Offset; - u32 Length; - MismatchCounter = 0; - - Offset = (u64)(TEST_PAGE_START * NandInstPtr->Geometry.BytesPerPage); - Length = NandInstPtr->Geometry.BytesPerPage; - - /* - * Initialize the write buffer - */ - for (Index = 0; Index < Length;Index++) { - WriteBuffer[Index] = (u8) (rand() % 256); - } - /* - * Erase the Block - */ - Status = XNandPsu_Erase(NandInstPtr, (u64)Offset, (u64)Length); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Write to page offset - */ - Status = XNandPsu_Write(NandInstPtr, (u64)Offset, (u64)Length, - &WriteBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Read from the page after writing - */ - Status = XNandPsu_Read(NandInstPtr, (u64)Offset, (u64)Length, - &ReadBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Compare the results - */ - for (Index = 0U; Index < 10;Index++) { - if (ReadBuffer[Index] != WriteBuffer[Index]) { - MismatchCounter++; - Status = XST_FAILURE; - } - } - -Out: - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_markblockbad_test.c b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_markblockbad_test.c deleted file mode 100644 index 2be8a525..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_markblockbad_test.c +++ /dev/null @@ -1,221 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file intg_flash_rw.c -* -* This file contains the design example for using NAND driver (XNandPsu). -* This example tests the erase, read and write feature of the controller. -* The flash is erased and written. The data is -* read back and compared with the data written for correctness. -* -* @note None. -* -* -*
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 12/18/2014 First release -* -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ - -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 Mark_BlockBad_Test(XNandPsu * NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the Mark Block Bad R/W test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_MarkBlockBadTest(XNandPsu * NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module Mark Block Bad test"); - - while(TestLoops--) { - Status = Mark_BlockBad_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Mark Block Bad Test Failed" - " with %d mismatches\r\n", MismatchCounter); - break; - } - CT_NotifyNextPass(); - - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* - Marks Blocks bad. -* - Erase the blocks. -* - Write data to the blocks. -* - Read back the data from the blocks. -* - Compare the data read against the data Written. -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* - XST_SUCCESS if successful. -* - XST_FAILURE if failed. -* -* @note -* None -* -****************************************************************************/ -s32 Mark_BlockBad_Test(XNandPsu * NandInstPtr) -{ - s32 Status = XST_FAILURE; - s32 BlockNo; - s32 i; - u32 Index; - u64 PageOff; - u32 Length; - u32 BlockSize = NandInstPtr->Geometry.BlockSize; - u64 BlockOff; - MismatchCounter = 0; - - PageOff = (u64)(TEST_PAGE_START * NandInstPtr->Geometry.BytesPerPage); - Length = NandInstPtr->Geometry.BytesPerPage; - - /* - * Initialize the write buffer - */ - for (Index = 0; Index < Length;Index++) { - WriteBuffer[Index] = 2U; - } - - /* - * Marking blocks 1 & 3 as bad - */ - for (BlockNo = 0 ; BlockNo < 5 ; BlockNo++){ - if(BlockNo%2 == 0){ - continue; - } - Status = XNandPsu_MarkBlockBad(NandInstPtr,BlockNo); - if(Status != XST_SUCCESS){ - goto Out; - } - } - /* - * Performing Block Erase Read Write on Block 1,2,3 - */ - for (BlockNo = TEST_BLOCK_START ; BlockNo < TEST_BLOCK_START + 3 ; BlockNo++ ){ - - BlockOff = BlockNo * BlockSize; - - /* - * Erase the Block 1,2,3 - */ - Status = XNandPsu_Erase(NandInstPtr, (u64)BlockOff, (u64)BlockSize); - if (Status != XST_SUCCESS) { - goto Out; - } - - PageOff = BlockOff; - - for (i = 0; i < NandInstPtr->Geometry.PagesPerBlock; i++){ - /* - * Write to page offset - */ - Status = XNandPsu_Write(NandInstPtr, (u64)PageOff, (u64)Length, - &WriteBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - /* - * Read from the page after writing - */ - Status = XNandPsu_Read(NandInstPtr, (u64)PageOff, (u64)Length, - &ReadBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - /* - * Compare the results - */ - for (Index = 0U; Index < Length;Index++) { - if (ReadBuffer[Index] != WriteBuffer[Index]) { - MismatchCounter++; - Status = XST_FAILURE; - } - } - PageOff = PageOff + NandInstPtr->Geometry.BytesPerPage; - } - } - -Out: - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_partialpage_rw.c b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_partialpage_rw.c deleted file mode 100644 index c68bd5cb..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_partialpage_rw.c +++ /dev/null @@ -1,208 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file intg_partialpage_rw.c -* -* This file contains the design example for using NAND driver (XNandPsu). -* This example tests the erase, read and write feature of the controller -* to the page.The flash is erased and written. The data is -* read back and compared with the data written for correctness. - -* -* @note None. -* -* -*
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 11/28/2014 First release -* -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ - -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 PartialPage_RW_Test(XNandPsu * NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the Partial Page R/W test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_PartialRWTest(XNandPsu * NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module Partial Page Read Write test"); - - while(TestLoops--) { - Status = PartialPage_RW_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Nand Partial Page Read Write Failed" - " with %d mismatches\r\n", MismatchCounter); - break; - } - CT_NotifyNextPass(); - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* - Choose random page size for read write Operations. -* - Erase the block. -* - Write data to the page. -* - Read back the data from the page. -* - Compare the data read against the data Written. -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* - XST_SUCCESS if successful. -* - XST_FAILURE if failed. -* -* @note -* None -* -****************************************************************************/ -s32 PartialPage_RW_Test(XNandPsu * NandInstPtr) -{ - s32 Status = (s32)XST_FAILURE; - u32 Index; - u64 Offset; - u32 Length; - s32 i; - MismatchCounter = 0; - Offset = (u64)(TEST_PAGE_START * (u64)NandInstPtr->Geometry.BytesPerPage); - Length = NandInstPtr->Geometry.BytesPerPage; - - /* - * Repeat the test for 5 iterations - */ - for(i = 0; i< 5; i++){ - - /* - * Select Random Length of data to be written to the page. - */ - Length = rand()%NandInstPtr->Geometry.BytesPerPage; - if(Length == 0U){ - Length = NandInstPtr->Geometry.BytesPerPage; - } - - /* - * Erase the Block - */ - Status = XNandPsu_Erase(NandInstPtr, (u64)Offset, (u64)Length); - if (Status != (s32)XST_SUCCESS) { - goto Out; - } - - /* - * Initialize the write buffer - */ - for (Index = 0U; Index < Length;Index++) { - WriteBuffer[Index] = ((u8)rand() % 256); - } - - /* - * Write to page - */ - Status = XNandPsu_Write(NandInstPtr, (u64)Offset, (u64)Length, - &WriteBuffer[0]); - if (Status != (s32)XST_SUCCESS) { - goto Out; - } - - /* - * Read the page after writing - */ - Status = XNandPsu_Read(NandInstPtr, (u64)Offset, (u64)Length, - &ReadBuffer[0]); - if (Status != (s32)XST_SUCCESS) { - goto Out; - } - - /* - * Compare the results - */ - for (Index = 0U; Index < Length;Index++) { - if (ReadBuffer[Index] != WriteBuffer[Index]) { - MismatchCounter++; - Status = (s32)XST_FAILURE; - } - } - } - -Out: - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_random_rw.c b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_random_rw.c deleted file mode 100644 index 0cb92fc6..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_random_rw.c +++ /dev/null @@ -1,206 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file intg_random_rw.c -* -* This file contains the design example for using NAND driver (XNandPsu). -* This example tests the erase, read and write feature of the controller -* to a complete block. The block is randomly selected. -* The flash is erased and written. The data is read back and compared -* with the data written for correctness. -* -* @note None. -* -* -*
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 11/28/2014 First release -* -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ - -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 Random_Block_RW_Test(XNandPsu * NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the Random Block Read Write test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_RandomRWTest(XNandPsu * NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module Random Block Read Write test"); - - while(TestLoops--) { - Status = Random_Block_RW_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Nand Random Block Read Write Test Failed" - " with %d mismatches\r\n", MismatchCounter); - break; - } - CT_NotifyNextPass(); - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* - Initialize the driver. -* - Erase the block. -* - Write data to the pages of block. -* - Read back the data from the pages of block. -* - Compare the data read against the data Written. -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* - XST_SUCCESS if successful. -* - XST_FAILURE if failed. -* -* @note -* None -* -****************************************************************************/ -s32 Random_Block_RW_Test(XNandPsu * NandInstPtr) -{ - s32 Status = XST_FAILURE; - u32 Index; - u64 Offset; - u32 Length; - s32 i = 0; - u32 BlockSize = NandInstPtr->Geometry.BlockSize; - - Offset = (u64) ((rand()% 50) * - NandInstPtr->Geometry.BlockSize); - - Length = NandInstPtr->Geometry.BytesPerPage; - - /* - * Erase the Block - */ - Status = XNandPsu_Erase(NandInstPtr, (u64)Offset, (u64)BlockSize); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Flash operation i.e. write and read for all the pages - * of the block. - * This test will take some time to execute. Please be patient. - */ - for (i = 0; i < NandInstPtr->Geometry.PagesPerBlock; i++){ - - /* - * Initialize the write buffer - */ - for (Index = 0; Index < Length;Index++) { - WriteBuffer[Index] = (u8) (rand() % 256); - } - - /* - * Write to page - */ - Status = XNandPsu_Write(NandInstPtr, (u64)Offset, (u64)Length, - &WriteBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Read the page after writing - */ - Status = XNandPsu_Read(NandInstPtr, (u64)Offset, (u64)Length, - &ReadBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Compare the results - */ - for (Index = 0U; Index < Length;Index++) { - if (ReadBuffer[Index] != WriteBuffer[Index]) { - MismatchCounter++; - Status = XST_FAILURE; - } - } - Offset = Offset + NandInstPtr->Geometry.BytesPerPage; - } - -Out: - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_sparebytes_rw.c b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_sparebytes_rw.c deleted file mode 100644 index ffda8fe4..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/intg_sparebytes_rw.c +++ /dev/null @@ -1,221 +0,0 @@ -/****************************************************************************** -* -* (c) Copyright 2010-14 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file intg_sparebytes_rw.c -* -* This file contains the design example for using NAND driver (XNandPsu). -* This example tests the erase, read and write feature of the controller -* in the spare bytes region.The flash is erased and written. The data is -* read back and compared with the data written for correctness. -* -* @note None. -* -* -*
-* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ----- -------- ----------------------------------------------- -* 1.0 sb 11/28/2014 First release -* -*-* -******************************************************************************/ - -/***************************** Include Files ********************************/ - -#include "intg.h" - -/************************** Constant Definitions ****************************/ - -/**************************** Type Definitions ******************************/ - -/***************** Macros (Inline Functions) Definitions ********************/ - -/************************** Variable Definitions ****************************/ - -/************************** Function Prototypes *****************************/ -s32 SpareBytes_RW_Test(XNandPsu * NandInstPtr); -/************************** Function Definitions ****************************/ - -/****************************************************************************/ -/** -* -* Entry point to call the Spare Bytes test. -* -* @param NandInstPtr - Instance to the nand driver. -* @param TestLoops - Number of tests to execute. -* -* @return Number of test failures. -* -* @note None. -* -*****************************************************************************/ -int Intg_SpareBytesRWTest(XNandPsu * NandInstPtr, int TestLoops) -{ - - s32 Status = XST_FAILURE; - CT_TestReset("Module Spare Bytes Read Write test"); - - while(TestLoops--) { - Status = SpareBytes_RW_Test(NandInstPtr); - if (Status != XST_SUCCESS) { - CT_LOG_FAILURE("Nand Spare Bytes Read Write Test Failed" - " with %d mismatches\r\n", MismatchCounter); - break; - } - CT_NotifyNextPass(); - } - - return(CT_GetTestFailures()); -} - -/****************************************************************************/ -/** -* -* This function runs a test on the NAND flash device using the basic driver -* functions in polled mode. -* The function does the following tasks: -* - Erase the Block. -* - Write data to the spare byte section of page. -* - Read back the data from the spare byte section of page. -* - Compare the data read against the data Written. -* -* @param NandInstPtr - Instance to the nand driver. -* -* @return -* - XST_SUCCESS if successful. -* - XST_FAILURE if failed. -* -* @note -* None -* -****************************************************************************/ -s32 SpareBytes_RW_Test(XNandPsu * NandInstPtr) -{ - s32 Status = XST_FAILURE; - u32 Index; - u64 Offset; - u32 SpareOffset; - u16 Length; - s32 i; - MismatchCounter = 0; - - Offset = (u64)(TEST_PAGE_START * NandInstPtr->Geometry.BytesPerPage); - Length = NandInstPtr->Geometry.BytesPerPage; - - /* - * Offset to write in spare area - */ - SpareOffset = TEST_PAGE_START; - - /* - * Repeat the test for 5 iterations - */ - for(i = 0; i< 5; i++){ - - /* - * Erase the Block - */ - Status = XNandPsu_Erase(NandInstPtr, (u64)Offset, (u64)Length); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Select Random Length of data to be written in Spare Region. - */ - Length = rand() % (NandInstPtr->Geometry.SpareBytesPerPage); - if(Length == 0U){ - Length = (NandInstPtr->Geometry.SpareBytesPerPage); - } - - /* - * Initialize the write buffer - */ - for (Index = 0; Index < Length;Index++) { - WriteBuffer[Index] = (u8) (rand() % 256); - } - - /* - * Disable the ECC mode - */ - XNandPsu_DisableEccMode(NandInstPtr); - - /* - * Write to Spare Bytes Section of page. - */ - Status = XNandPsu_WriteSpareBytes(NandInstPtr, SpareOffset, - &WriteBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Read from the Spare Bytes after writing - */ - Status = XNandPsu_ReadSpareBytes(NandInstPtr, SpareOffset, - &ReadBuffer[0]); - if (Status != XST_SUCCESS) { - goto Out; - } - - /* - * Enable the ECC mode - */ - XNandPsu_EnableEccMode(NandInstPtr); - /* - * Compare the results - */ - for (Index = 0U; Index < Length;Index++) { - if (ReadBuffer[Index] != WriteBuffer[Index]) { - MismatchCounter++; - Status = XST_FAILURE; - } - } - } - -Out: - return Status; -} diff --git a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/xil_testlib.h b/XilinxProcessorIPLib/drivers/nandpsu/intgTest/xil_testlib.h deleted file mode 100644 index c9f70bce..00000000 --- a/XilinxProcessorIPLib/drivers/nandpsu/intgTest/xil_testlib.h +++ /dev/null @@ -1,96 +0,0 @@ -/* $Id: xil_testlib.h,v 1.00 2009/2/19 */ -/****************************************************************************** -* -* (c) Copyright 2010-13 Xilinx, Inc. All rights reserved. -* -* This file contains confidential and proprietary information of Xilinx, Inc. -* and is protected under U.S. and international copyright and other -* intellectual property laws. -* -* DISCLAIMER -* This disclaimer is not a license and does not grant any rights to the -* materials distributed herewith. Except as otherwise provided in a valid -* license issued to you by Xilinx, and to the maximum extent permitted by -* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL -* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, -* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF -* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE -* and (2) Xilinx shall not be liable (whether in contract or tort, including -* negligence, or under any other theory of liability) for any loss or damage -* of any kind or nature related to, arising under or in connection with these -* materials, including for any direct, or any indirect, special, incidental, -* or consequential loss or damage (including loss of data, profits, goodwill, -* or any type of loss or damage suffered as a result of any action brought by -* a third party) even if such damage or loss was reasonably foreseeable or -* Xilinx had been advised of the possibility of the same. -* -* CRITICAL APPLICATIONS -* Xilinx products are not designed or intended to be fail-safe, or for use in -* any application requiring fail-safe performance, such as life-support or -* safety devices or systems, Class III medical devices, nuclear facilities, -* applications related to the deployment of airbags, or any other applications -* that could lead to death, personal injury, or severe property or -* environmental damage (individually and collectively, "Critical -* Applications"). Customer assumes the sole risk and liability of any use of -* Xilinx products in Critical Applications, subject only to applicable laws -* and regulations governing limitations on product liability. -* -* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE -* AT ALL TIMES. -* -******************************************************************************/ -/*****************************************************************************/ - -/***************************** Include Files *********************************/ -#include