1 |
5 |
quickwayne |
/* $Id: xutil.h,v 1.1 2006-06-23 18:59:00 quickwayne Exp $ */
|
2 |
|
|
/******************************************************************************
|
3 |
|
|
*
|
4 |
|
|
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
|
5 |
|
|
* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
|
6 |
|
|
* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
|
7 |
|
|
* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
|
8 |
|
|
* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
|
9 |
|
|
* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
|
10 |
|
|
* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
|
11 |
|
|
* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
|
12 |
|
|
* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
|
13 |
|
|
* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
|
14 |
|
|
* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
|
15 |
|
|
* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
16 |
|
|
* FOR A PARTICULAR PURPOSE.
|
17 |
|
|
*
|
18 |
|
|
* (c) Copyright 2002 Xilinx Inc.
|
19 |
|
|
* All rights reserved.
|
20 |
|
|
*
|
21 |
|
|
******************************************************************************/
|
22 |
|
|
/*****************************************************************************/
|
23 |
|
|
/**
|
24 |
|
|
*
|
25 |
|
|
* @file xutil.h
|
26 |
|
|
*
|
27 |
|
|
* This file contains utility functions such as memory test functions.
|
28 |
|
|
*
|
29 |
|
|
* <b>Memory test description</b>
|
30 |
|
|
*
|
31 |
|
|
* A subset of the memory tests can be selected or all of the tests can be run
|
32 |
|
|
* in order. If there is an error detected by a subtest, the test stops and the
|
33 |
|
|
* failure code is returned. Further tests are not run even if all of the tests
|
34 |
|
|
* are selected.
|
35 |
|
|
*
|
36 |
|
|
* Subtest descriptions:
|
37 |
|
|
* <pre>
|
38 |
|
|
* XUT_ALLMEMTESTS:
|
39 |
|
|
* Runs all of the following tests
|
40 |
|
|
*
|
41 |
|
|
* XUT_INCREMENT:
|
42 |
|
|
* Incrementing Value Test.
|
43 |
|
|
* This test starts at 'XUT_MEMTEST_INIT_VALUE' and uses the incrementing
|
44 |
|
|
* value as the test value for memory.
|
45 |
|
|
*
|
46 |
|
|
* XUT_WALKONES:
|
47 |
|
|
* Walking Ones Test.
|
48 |
|
|
* This test uses a walking '1' as the test value for memory.
|
49 |
|
|
* location 1 = 0x00000001
|
50 |
|
|
* location 2 = 0x00000002
|
51 |
|
|
* ...
|
52 |
|
|
*
|
53 |
|
|
* XUT_WALKZEROS:
|
54 |
|
|
* Walking Zero's Test.
|
55 |
|
|
* This test uses the inverse value of the walking ones test
|
56 |
|
|
* as the test value for memory.
|
57 |
|
|
* location 1 = 0xFFFFFFFE
|
58 |
|
|
* location 2 = 0xFFFFFFFD
|
59 |
|
|
* ...
|
60 |
|
|
*
|
61 |
|
|
* XUT_INVERSEADDR:
|
62 |
|
|
* Inverse Address Test.
|
63 |
|
|
* This test uses the inverse of the address of the location under test
|
64 |
|
|
* as the test value for memory.
|
65 |
|
|
*
|
66 |
|
|
* XUT_FIXEDPATTERN:
|
67 |
|
|
* Fixed Pattern Test.
|
68 |
|
|
* This test uses the provided patters as the test value for memory.
|
69 |
|
|
* If zero is provided as the pattern the test uses '0xDEADBEEF".
|
70 |
|
|
* </pre>
|
71 |
|
|
*
|
72 |
|
|
* <i>WARNING</i>
|
73 |
|
|
*
|
74 |
|
|
* The tests are <b>DESTRUCTIVE</b>. Run before any initialized memory spaces
|
75 |
|
|
* have been set up.
|
76 |
|
|
*
|
77 |
|
|
* The address, Addr, provided to the memory tests is not checked for
|
78 |
|
|
* validity except for the XNULL case. It is possible to provide a code-space
|
79 |
|
|
* pointer for this test to start with and ultimately destroy executable code
|
80 |
|
|
* causing random failures.
|
81 |
|
|
*
|
82 |
|
|
* @note
|
83 |
|
|
*
|
84 |
|
|
* Used for spaces where the address range of the region is smaller than
|
85 |
|
|
* the data width. If the memory range is greater than 2 ** width,
|
86 |
|
|
* the patterns used in XUT_WALKONES and XUT_WALKZEROS will repeat on a
|
87 |
|
|
* boundry of a power of two making it more difficult to detect addressing
|
88 |
|
|
* errors. The XUT_INCREMENT and XUT_INVERSEADDR tests suffer the same
|
89 |
|
|
* problem. Ideally, if large blocks of memory are to be tested, break
|
90 |
|
|
* them up into smaller regions of memory to allow the test patterns used
|
91 |
|
|
* not to repeat over the region tested.
|
92 |
|
|
*
|
93 |
|
|
* <pre>
|
94 |
|
|
* MODIFICATION HISTORY:
|
95 |
|
|
*
|
96 |
|
|
* Ver Who Date Changes
|
97 |
|
|
* ----- ---- -------- -----------------------------------------------
|
98 |
|
|
* 1.00a ecm 11/01/01 First release
|
99 |
|
|
* 1.00a xd 11/03/04 Improved support for doxygen.
|
100 |
|
|
* </pre>
|
101 |
|
|
*
|
102 |
|
|
******************************************************************************/
|
103 |
|
|
|
104 |
|
|
#ifndef XUTIL_H /* prevent circular inclusions */
|
105 |
|
|
#define XUTIL_H /* by using protection macros */
|
106 |
|
|
|
107 |
|
|
/***************************** Include Files *********************************/
|
108 |
|
|
#include "xbasic_types.h"
|
109 |
|
|
#include "xstatus.h"
|
110 |
|
|
|
111 |
|
|
/************************** Constant Definitions *****************************/
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
/**************************** Type Definitions *******************************/
|
115 |
|
|
|
116 |
|
|
/* xutil_memtest defines */
|
117 |
|
|
|
118 |
|
|
#define XUT_MEMTEST_INIT_VALUE 1
|
119 |
|
|
|
120 |
|
|
/** @name Memory subtests
|
121 |
|
|
* @{
|
122 |
|
|
*/
|
123 |
|
|
/**
|
124 |
|
|
* See the detailed description of the subtests in the file description.
|
125 |
|
|
*/
|
126 |
|
|
#define XUT_ALLMEMTESTS 0
|
127 |
|
|
#define XUT_INCREMENT 1
|
128 |
|
|
#define XUT_WALKONES 2
|
129 |
|
|
#define XUT_WALKZEROS 3
|
130 |
|
|
#define XUT_INVERSEADDR 4
|
131 |
|
|
#define XUT_FIXEDPATTERN 5
|
132 |
|
|
#define XUT_MAXTEST XUT_FIXEDPATTERN
|
133 |
|
|
/* @} */
|
134 |
|
|
|
135 |
|
|
/***************** Macros (Inline Functions) Definitions *********************/
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
/************************** Function Prototypes ******************************/
|
139 |
|
|
|
140 |
|
|
/* xutil_memtest prototypes */
|
141 |
|
|
|
142 |
|
|
XStatus XUtil_MemoryTest32(Xuint32 *Addr, Xuint32 Words, Xuint32 Pattern,
|
143 |
|
|
Xuint8 Subtest);
|
144 |
|
|
XStatus XUtil_MemoryTest16(Xuint16 *Addr, Xuint32 Words, Xuint16 Pattern,
|
145 |
|
|
Xuint8 Subtest);
|
146 |
|
|
XStatus XUtil_MemoryTest8(Xuint8 *Addr, Xuint32 Words, Xuint8 Pattern,
|
147 |
|
|
Xuint8 Subtest);
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
#endif /* end of protection macro */
|
151 |
|
|
|