1 /******************************************************************************
3 * Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /*****************************************************************************/
37 * This file contains utility functions to test memory.
39 * <b>Memory test description</b>
41 * A subset of the memory tests can be selected or all of the tests can be run
42 * in order. If there is an error detected by a subtest, the test stops and the
43 * failure code is returned. Further tests are not run even if all of the tests
46 * Subtest descriptions:
48 * XIL_TESTMEM_ALLMEMTESTS:
49 * Runs all of the following tests
51 * XIL_TESTMEM_INCREMENT:
52 * Incrementing Value Test.
53 * This test starts at 'XIL_TESTMEM_INIT_VALUE' and uses the
54 * incrementing value as the test value for memory.
56 * XIL_TESTMEM_WALKONES:
58 * This test uses a walking '1' as the test value for memory.
59 * location 1 = 0x00000001
60 * location 2 = 0x00000002
63 * XIL_TESTMEM_WALKZEROS:
64 * Walking Zero's Test.
65 * This test uses the inverse value of the walking ones test
66 * as the test value for memory.
67 * location 1 = 0xFFFFFFFE
68 * location 2 = 0xFFFFFFFD
71 * XIL_TESTMEM_INVERSEADDR:
72 * Inverse Address Test.
73 * This test uses the inverse of the address of the location under test
74 * as the test value for memory.
76 * XIL_TESTMEM_FIXEDPATTERN:
78 * This test uses the provided patters as the test value for memory.
79 * If zero is provided as the pattern the test uses '0xDEADBEEF".
84 * The tests are <b>DESTRUCTIVE</b>. Run before any initialized memory spaces
87 * The address provided to the memory tests is not checked for
88 * validity except for the NULL case. It is possible to provide a code-space
89 * pointer for this test to start with and ultimately destroy executable code
90 * causing random failures.
94 * Used for spaces where the address range of the region is smaller than
95 * the data width. If the memory range is greater than 2 ** width,
96 * the patterns used in XIL_TESTMEM_WALKONES and XIL_TESTMEM_WALKZEROS will
97 * repeat on a boundry of a power of two making it more difficult to detect
98 * addressing errors. The XIL_TESTMEM_INCREMENT and XIL_TESTMEM_INVERSEADDR
99 * tests suffer the same problem. Ideally, if large blocks of memory are to be
100 * tested, break them up into smaller regions of memory to allow the test
101 * patterns used not to repeat over the region tested.
104 * MODIFICATION HISTORY:
106 * Ver Who Date Changes
107 * ----- ---- -------- -----------------------------------------------
108 * 1.00a hbm 08/25/09 First release
111 ******************************************************************************/
113 #ifndef XIL_TESTMEM_H /* prevent circular inclusions */
114 #define XIL_TESTMEM_H /* by using protection macros */
120 /***************************** Include Files *********************************/
121 #include "xil_types.h"
123 /************************** Constant Definitions *****************************/
126 /**************************** Type Definitions *******************************/
128 /* xutil_memtest defines */
130 #define XIL_TESTMEM_INIT_VALUE 1
132 /** @name Memory subtests
136 * See the detailed description of the subtests in the file description.
138 #define XIL_TESTMEM_ALLMEMTESTS 0
139 #define XIL_TESTMEM_INCREMENT 1
140 #define XIL_TESTMEM_WALKONES 2
141 #define XIL_TESTMEM_WALKZEROS 3
142 #define XIL_TESTMEM_INVERSEADDR 4
143 #define XIL_TESTMEM_FIXEDPATTERN 5
144 #define XIL_TESTMEM_MAXTEST XIL_TESTMEM_FIXEDPATTERN
147 /***************** Macros (Inline Functions) Definitions *********************/
150 /************************** Function Prototypes ******************************/
152 /* xutil_testmem prototypes */
154 extern int Xil_TestMem32(u32 *Addr, u32 Words, u32 Pattern, u8 Subtest);
155 extern int Xil_TestMem16(u16 *Addr, u32 Words, u16 Pattern, u8 Subtest);
156 extern int Xil_TestMem8(u8 *Addr, u32 Words, u8 Pattern, u8 Subtest);
162 #endif /* end of protection macro */