]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5_bsp/psu_cortexr5_0/libsrc/standalone_v6_6/src/xil_testmem.h
Update Zynq, MPSoc Cortex-A53 and MPSoc Cortex-R5 demo projects to build with the...
[freertos] / FreeRTOS / Demo / CORTEX_R5_UltraScale_MPSoC / RTOSDemo_R5_bsp / psu_cortexr5_0 / libsrc / standalone_v6_6 / src / xil_testmem.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2009 - 2015 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 * @addtogroup common_test_utils
37 *
38 * <h2>Memory test</h2>
39 *
40 * The xil_testmem.h file contains utility functions to test memory.
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 * Following list describes the supported memory tests:
46 *
47 *  - XIL_TESTMEM_ALLMEMTESTS: This test runs all of the subtests.
48 *
49 *  - XIL_TESTMEM_INCREMENT: This test
50 * starts at 'XIL_TESTMEM_INIT_VALUE' and uses the incrementing value as the
51 * test value for memory.
52 *
53 *  - XIL_TESTMEM_WALKONES: Also known as the Walking ones test. This test
54 * uses a walking '1' as the test value for memory.
55 * @code
56 *          location 1 = 0x00000001
57 *          location 2 = 0x00000002
58 *          ...
59 * @endcode
60 *
61 *  - XIL_TESTMEM_WALKZEROS: Also known as the Walking zero's test.
62 * This test uses the inverse value of the walking ones test
63 * as the test value for memory.
64 * @code
65 *       location 1 = 0xFFFFFFFE
66 *       location 2 = 0xFFFFFFFD
67 *       ...
68 *@endcode
69 *
70 *  - XIL_TESTMEM_INVERSEADDR: Also known as the inverse address test.
71 * This test uses the inverse of the address of the location under test
72 * as the test value for memory.
73 *
74 *  - XIL_TESTMEM_FIXEDPATTERN: Also known as the fixed pattern test.
75 * This test uses the provided patters as the test value for memory.
76 * If zero is provided as the pattern the test uses '0xDEADBEEF".
77 *
78 * @warning
79 * The tests are <b>DESTRUCTIVE</b>. Run before any initialized memory spaces
80 * have been set up.
81 * The address provided to the memory tests is not checked for
82 * validity except for the NULL case. It is possible to provide a code-space
83 * pointer for this test to start with and ultimately destroy executable code
84 * causing random failures.
85 *
86 * @note
87 * Used for spaces where the address range of the region is smaller than
88 * the data width. If the memory range is greater than 2 ** width,
89 * the patterns used in XIL_TESTMEM_WALKONES and XIL_TESTMEM_WALKZEROS will
90 * repeat on a boundry of a power of two making it more difficult to detect
91 * addressing errors. The XIL_TESTMEM_INCREMENT and XIL_TESTMEM_INVERSEADDR
92 * tests suffer the same problem. Ideally, if large blocks of memory are to be
93 * tested, break them up into smaller regions of memory to allow the test
94 * patterns used not to repeat over the region tested.
95 *
96 * <pre>
97 * MODIFICATION HISTORY:
98 *
99 * Ver    Who    Date    Changes
100 * ----- ---- -------- -----------------------------------------------
101 * 1.00a hbm  08/25/09 First release
102 * </pre>
103 *
104 ******************************************************************************/
105
106 #ifndef XIL_TESTMEM_H   /* prevent circular inclusions */
107 #define XIL_TESTMEM_H   /* by using protection macros */
108
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112
113 /***************************** Include Files *********************************/
114 #include "xil_types.h"
115
116 /************************** Constant Definitions *****************************/
117
118
119 /**************************** Type Definitions *******************************/
120
121 /* xutil_memtest defines */
122
123 #define XIL_TESTMEM_INIT_VALUE  1U
124
125 /** @name Memory subtests
126  * @{
127  */
128 /**
129  * See the detailed description of the subtests in the file description.
130  */
131 #define XIL_TESTMEM_ALLMEMTESTS     0x00U
132 #define XIL_TESTMEM_INCREMENT       0x01U
133 #define XIL_TESTMEM_WALKONES        0x02U
134 #define XIL_TESTMEM_WALKZEROS       0x03U
135 #define XIL_TESTMEM_INVERSEADDR     0x04U
136 #define XIL_TESTMEM_FIXEDPATTERN    0x05U
137 #define XIL_TESTMEM_MAXTEST         XIL_TESTMEM_FIXEDPATTERN
138 /* @} */
139
140 /***************** Macros (Inline Functions) Definitions *********************/
141
142
143 /************************** Function Prototypes ******************************/
144
145 /* xutil_testmem prototypes */
146
147 extern s32 Xil_TestMem32(u32 *Addr, u32 Words, u32 Pattern, u8 Subtest);
148 extern s32 Xil_TestMem16(u16 *Addr, u32 Words, u16 Pattern, u8 Subtest);
149 extern s32 Xil_TestMem8(u8 *Addr, u32 Words, u8 Pattern, u8 Subtest);
150
151 #ifdef __cplusplus
152 }
153 #endif
154
155 #endif /* end of protection macro */
156 /**
157 * @} End of "addtogroup common_test_utils".
158 */