]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/libsrc/standalone_v4_1/src/xil_testmem.h
Preparing for next release...
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / libsrc / standalone_v4_1 / src / xil_testmem.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2009 - 2014 Xilinx, Inc.  All rights reserved.
4 *
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:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
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.
18 *
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
25 * SOFTWARE.
26 *
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.
30 *
31 ******************************************************************************/
32 /*****************************************************************************/
33 /**
34 *
35 * @file xil_testmem.h
36 *
37 * This file contains utility functions to test memory.
38 *
39 * <b>Memory test description</b>
40 *
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
44 * are selected.
45 *
46 * Subtest descriptions:
47 * <pre>
48 * XIL_TESTMEM_ALLMEMTESTS:
49 *       Runs all of the following tests
50 *
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.
55 *
56 * XIL_TESTMEM_WALKONES:
57 *       Walking Ones Test.
58 *       This test uses a walking '1' as the test value for memory.
59 *       location 1 = 0x00000001
60 *       location 2 = 0x00000002
61 *       ...
62 *
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
69 *       ...
70 *
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.
75 *
76 * XIL_TESTMEM_FIXEDPATTERN:
77 *       Fixed Pattern Test.
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".
80 * </pre>
81 *
82 * <i>WARNING</i>
83 *
84 * The tests are <b>DESTRUCTIVE</b>. Run before any initialized memory spaces
85 * have been set up.
86 *
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.
91 *
92 * @note
93 *
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.
102 *
103 * <pre>
104 * MODIFICATION HISTORY:
105 *
106 * Ver    Who    Date    Changes
107 * ----- ---- -------- -----------------------------------------------
108 * 1.00a hbm  08/25/09 First release
109 * </pre>
110 *
111 ******************************************************************************/
112
113 #ifndef XIL_TESTMEM_H   /* prevent circular inclusions */
114 #define XIL_TESTMEM_H   /* by using protection macros */
115
116 #ifdef __cplusplus
117 extern "C" {
118 #endif
119
120 /***************************** Include Files *********************************/
121 #include "xil_types.h"
122
123 /************************** Constant Definitions *****************************/
124
125
126 /**************************** Type Definitions *******************************/
127
128 /* xutil_memtest defines */
129
130 #define XIL_TESTMEM_INIT_VALUE  1
131
132 /** @name Memory subtests
133  * @{
134  */
135 /**
136  * See the detailed description of the subtests in the file description.
137  */
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
145 /* @} */
146
147 /***************** Macros (Inline Functions) Definitions *********************/
148
149
150 /************************** Function Prototypes ******************************/
151
152 /* xutil_testmem prototypes */
153
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);
157
158 #ifdef __cplusplus
159 }
160 #endif
161
162 #endif /* end of protection macro */