1 |
32 |
redbear |
#ifndef _SEQUENCER_H_
|
2 |
|
|
#define _SEQUENCER_H_
|
3 |
|
|
|
4 |
|
|
/*
|
5 |
|
|
* Copyright Altera Corporation (C) 2012-2014. All rights reserved
|
6 |
|
|
*
|
7 |
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
8 |
|
|
*
|
9 |
|
|
* Redistribution and use in source and binary forms, with or without
|
10 |
|
|
* modification, are permitted provided that the following conditions are met:
|
11 |
|
|
* * Redistributions of source code must retain the above copyright
|
12 |
|
|
* notice, this list of conditions and the following disclaimer.
|
13 |
|
|
* * Redistributions in binary form must reproduce the above copyright
|
14 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
15 |
|
|
* documentation and/or other materials provided with the distribution.
|
16 |
|
|
* * Neither the name of Altera Corporation nor the
|
17 |
|
|
* names of its contributors may be used to endorse or promote products
|
18 |
|
|
* derived from this software without specific prior written permission.
|
19 |
|
|
*
|
20 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
|
|
* DISCLAIMED. IN NO EVENT SHALL ALTERA CORPORATION BE LIABLE FOR ANY
|
24 |
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
27 |
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
|
|
*/
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
#if ENABLE_ASSERT
|
34 |
|
|
#define ERR_IE_TEXT "Internal Error: Sub-system: %s, File: %s, Line: %d\n%s%s"
|
35 |
|
|
|
36 |
|
|
extern void err_report_internal_error (const char* description, const char* module, const char* file, int line);
|
37 |
|
|
|
38 |
|
|
#define ALTERA_INTERNAL_ERROR(string) {err_report_internal_error(string, "SEQ", __FILE__, __LINE__); exit(-1);}
|
39 |
|
|
|
40 |
|
|
#define ALTERA_ASSERT(condition) \
|
41 |
|
|
if (!(condition)) { ALTERA_INTERNAL_ERROR(#condition); }
|
42 |
|
|
#define ALTERA_INFO_ASSERT(condition,text) \
|
43 |
|
|
if (!(condition)) { ALTERA_INTERNAL_ERROR(text); }
|
44 |
|
|
|
45 |
|
|
#else
|
46 |
|
|
|
47 |
|
|
#define ALTERA_ASSERT(condition)
|
48 |
|
|
#define ALTERA_INFO_ASSERT(condition,text)
|
49 |
|
|
|
50 |
|
|
#endif
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
#if RLDRAMII
|
54 |
|
|
#define RW_MGR_NUM_DM_PER_WRITE_GROUP (1)
|
55 |
|
|
#define RW_MGR_NUM_TRUE_DM_PER_WRITE_GROUP (1)
|
56 |
|
|
#else
|
57 |
|
|
#define RW_MGR_NUM_DM_PER_WRITE_GROUP (RW_MGR_MEM_DATA_MASK_WIDTH / RW_MGR_MEM_IF_WRITE_DQS_WIDTH)
|
58 |
|
|
#define RW_MGR_NUM_TRUE_DM_PER_WRITE_GROUP (RW_MGR_TRUE_MEM_DATA_MASK_WIDTH / RW_MGR_MEM_IF_WRITE_DQS_WIDTH)
|
59 |
|
|
#endif
|
60 |
|
|
|
61 |
|
|
#define RW_MGR_NUM_DQS_PER_WRITE_GROUP (RW_MGR_MEM_IF_READ_DQS_WIDTH / RW_MGR_MEM_IF_WRITE_DQS_WIDTH)
|
62 |
|
|
#define NUM_RANKS_PER_SHADOW_REG (RW_MGR_MEM_NUMBER_OF_RANKS / NUM_SHADOW_REGS)
|
63 |
|
|
|
64 |
|
|
#define RW_MGR_RUN_SINGLE_GROUP BASE_RW_MGR
|
65 |
|
|
#define RW_MGR_RUN_ALL_GROUPS BASE_RW_MGR + 0x0400
|
66 |
|
|
|
67 |
|
|
#if HARD_PHY
|
68 |
|
|
#define RW_MGR_DI_BASE (BASE_RW_MGR + 0x0020)
|
69 |
|
|
#else
|
70 |
|
|
#define RW_MGR_DI_BASE (BASE_RW_MGR + 0x0010)
|
71 |
|
|
#endif
|
72 |
|
|
|
73 |
|
|
#if DDR3
|
74 |
|
|
#define DDR3_MR1_ODT_MASK 0xFFFFFD99
|
75 |
|
|
#define DDR3_MR2_ODT_MASK 0xFFFFF9FF
|
76 |
|
|
#define DDR3_AC_MIRR_MASK 0x020A8
|
77 |
|
|
|
78 |
|
|
#if LRDIMM
|
79 |
|
|
// USER RTT_NOM: bits {4,3,2} of the SPD = bits {9,6,2} of the MR
|
80 |
|
|
#define LRDIMM_SPD_MR_RTT_NOM(spd_byte) \
|
81 |
|
|
( (((spd_byte) & (1 << 4)) << (9-4)) \
|
82 |
|
|
| (((spd_byte) & (1 << 3)) << (6-3)) \
|
83 |
|
|
| (((spd_byte) & (1 << 2)) << (2-2)))
|
84 |
|
|
|
85 |
|
|
// USER RTT_DRV: bits {1,0} of the SPD = bits {5,1} of the MR
|
86 |
|
|
#define LRDIMM_SPD_MR_RTT_DRV(spd_byte) \
|
87 |
|
|
( (((spd_byte) & (1 << 1)) << (5-1)) \
|
88 |
|
|
| (((spd_byte) & (1 << 0)) << (1-0)))
|
89 |
|
|
|
90 |
|
|
// USER RTT_WR: bits {7,6} of the SPD = bits {10,9} of the MR
|
91 |
|
|
#define LRDIMM_SPD_MR_RTT_WR(spd_byte) \
|
92 |
|
|
(((spd_byte) & (3 << 6)) << (9-6))
|
93 |
|
|
|
94 |
|
|
#endif // LRDIMM
|
95 |
|
|
#endif // DDR3
|
96 |
|
|
|
97 |
|
|
#define RW_MGR_LOAD_CNTR_0 BASE_RW_MGR + 0x0800
|
98 |
|
|
#define RW_MGR_LOAD_CNTR_1 BASE_RW_MGR + 0x0804
|
99 |
|
|
#define RW_MGR_LOAD_CNTR_2 BASE_RW_MGR + 0x0808
|
100 |
|
|
#define RW_MGR_LOAD_CNTR_3 BASE_RW_MGR + 0x080C
|
101 |
|
|
|
102 |
|
|
#define RW_MGR_LOAD_JUMP_ADD_0 BASE_RW_MGR + 0x0C00
|
103 |
|
|
#define RW_MGR_LOAD_JUMP_ADD_1 BASE_RW_MGR + 0x0C04
|
104 |
|
|
#define RW_MGR_LOAD_JUMP_ADD_2 BASE_RW_MGR + 0x0C08
|
105 |
|
|
#define RW_MGR_LOAD_JUMP_ADD_3 BASE_RW_MGR + 0x0C0C
|
106 |
|
|
|
107 |
|
|
#define RW_MGR_RESET_READ_DATAPATH BASE_RW_MGR + 0x1000
|
108 |
|
|
#define RW_MGR_SOFT_RESET BASE_RW_MGR + 0x2000
|
109 |
|
|
|
110 |
|
|
#define RW_MGR_SET_CS_AND_ODT_MASK BASE_RW_MGR + 0x1400
|
111 |
|
|
#define RW_MGR_SET_ACTIVE_RANK BASE_RW_MGR + 0x2400
|
112 |
|
|
|
113 |
|
|
#define RW_MGR_LOOPBACK_MODE BASE_RW_MGR + 0x0200
|
114 |
|
|
|
115 |
|
|
#define RW_MGR_ENABLE_REFRESH BASE_RW_MGR + 0x3000
|
116 |
|
|
|
117 |
|
|
#define RW_MGR_RANK_NONE 0xFF
|
118 |
|
|
#define RW_MGR_RANK_ALL 0x00
|
119 |
|
|
|
120 |
|
|
#define RW_MGR_ODT_MODE_OFF 0
|
121 |
|
|
#define RW_MGR_ODT_MODE_READ_WRITE 1
|
122 |
|
|
|
123 |
|
|
#define NUM_CALIB_REPEAT 1
|
124 |
|
|
|
125 |
|
|
#define NUM_READ_TESTS 7
|
126 |
|
|
#define NUM_READ_PB_TESTS 7
|
127 |
|
|
#define NUM_WRITE_TESTS 15
|
128 |
|
|
#define NUM_WRITE_PB_TESTS 31
|
129 |
|
|
|
130 |
|
|
#define PASS_ALL_BITS 1
|
131 |
|
|
#define PASS_ONE_BIT 0
|
132 |
|
|
|
133 |
|
|
/* calibration stages */
|
134 |
|
|
|
135 |
|
|
#define CAL_STAGE_NIL 0
|
136 |
|
|
#define CAL_STAGE_VFIFO 1
|
137 |
|
|
#define CAL_STAGE_WLEVEL 2
|
138 |
|
|
#define CAL_STAGE_LFIFO 3
|
139 |
|
|
#define CAL_STAGE_WRITES 4
|
140 |
|
|
#define CAL_STAGE_FULLTEST 5
|
141 |
|
|
#define CAL_STAGE_REFRESH 6
|
142 |
|
|
#define CAL_STAGE_CAL_SKIPPED 7
|
143 |
|
|
#define CAL_STAGE_CAL_ABORTED 8
|
144 |
|
|
#define CAL_STAGE_VFIFO_AFTER_WRITES 9
|
145 |
|
|
|
146 |
|
|
/* calibration substages */
|
147 |
|
|
|
148 |
|
|
#define CAL_SUBSTAGE_NIL 0
|
149 |
|
|
#define CAL_SUBSTAGE_GUARANTEED_READ 1
|
150 |
|
|
#define CAL_SUBSTAGE_DQS_EN_PHASE 2
|
151 |
|
|
#define CAL_SUBSTAGE_VFIFO_CENTER 3
|
152 |
|
|
#define CAL_SUBSTAGE_WORKING_DELAY 1
|
153 |
|
|
#define CAL_SUBSTAGE_LAST_WORKING_DELAY 2
|
154 |
|
|
#define CAL_SUBSTAGE_WLEVEL_COPY 3
|
155 |
|
|
#define CAL_SUBSTAGE_WRITES_CENTER 1
|
156 |
|
|
#define CAL_SUBSTAGE_READ_LATENCY 1
|
157 |
|
|
#define CAL_SUBSTAGE_REFRESH 1
|
158 |
|
|
|
159 |
|
|
#define MAX_RANKS (RW_MGR_MEM_NUMBER_OF_RANKS)
|
160 |
|
|
#define MAX_DQS (RW_MGR_MEM_IF_WRITE_DQS_WIDTH > RW_MGR_MEM_IF_READ_DQS_WIDTH ? RW_MGR_MEM_IF_WRITE_DQS_WIDTH : RW_MGR_MEM_IF_READ_DQS_WIDTH)
|
161 |
|
|
#define MAX_DQ (RW_MGR_MEM_DATA_WIDTH)
|
162 |
|
|
#define MAX_DM (RW_MGR_MEM_DATA_MASK_WIDTH)
|
163 |
|
|
|
164 |
|
|
/* length of VFIFO, from SW_MACROS */
|
165 |
|
|
#define VFIFO_SIZE (READ_VALID_FIFO_SIZE)
|
166 |
|
|
|
167 |
|
|
/* Memory for data transfer between TCL scripts and NIOS.
|
168 |
|
|
*
|
169 |
|
|
* - First word is a command request.
|
170 |
|
|
* - The remaining words are part of the transfer.
|
171 |
|
|
*/
|
172 |
|
|
|
173 |
|
|
/* Define the base address of each manager. */
|
174 |
|
|
|
175 |
|
|
/* MarkW: how should these base addresses be done for A-V? */
|
176 |
|
|
#define BASE_PTR_MGR SEQUENCER_PTR_MGR_INST_BASE
|
177 |
|
|
#if HARD_PHY
|
178 |
|
|
#define BASE_PHY_MGR (0x00088000)
|
179 |
|
|
#define BASE_RW_MGR (0x00090000)
|
180 |
|
|
#define BASE_DATA_MGR (0x00098000)
|
181 |
|
|
#else
|
182 |
|
|
#define BASE_PHY_MGR SEQUENCER_PHY_MGR_INST_BASE
|
183 |
|
|
#define BASE_RW_MGR SEQUENCER_RW_MGR_INST_BASE
|
184 |
|
|
#define BASE_DATA_MGR SEQUENCER_DATA_MGR_INST_BASE
|
185 |
|
|
#endif
|
186 |
|
|
#define BASE_SCC_MGR SEQUENCER_SCC_MGR_INST_BASE
|
187 |
|
|
#define BASE_REG_FILE SEQUENCER_REG_FILE_INST_BASE
|
188 |
|
|
#define BASE_TIMER SEQUENCER_TIMER_INST_BASE
|
189 |
|
|
#define BASE_MMR (0x000C0000)
|
190 |
|
|
#define BASE_TRK_MGR (0x000D0000)
|
191 |
|
|
|
192 |
|
|
/* Register file addresses. */
|
193 |
|
|
#define REG_FILE_SIGNATURE (BASE_REG_FILE + 0x0000)
|
194 |
|
|
#define REG_FILE_DEBUG_DATA_ADDR (BASE_REG_FILE + 0x0004)
|
195 |
|
|
#define REG_FILE_CUR_STAGE (BASE_REG_FILE + 0x0008)
|
196 |
|
|
#define REG_FILE_FOM (BASE_REG_FILE + 0x000C)
|
197 |
|
|
#define REG_FILE_FAILING_STAGE (BASE_REG_FILE + 0x0010)
|
198 |
|
|
#define REG_FILE_DEBUG1 (BASE_REG_FILE + 0x0014)
|
199 |
|
|
#define REG_FILE_DEBUG2 (BASE_REG_FILE + 0x0018)
|
200 |
|
|
|
201 |
|
|
#if TRACKING_WATCH_TEST || TRACKING_ERROR_TEST
|
202 |
|
|
#define REG_FILE_TRK_SAMPLE_CHECK (BASE_REG_FILE + 0x003C)
|
203 |
|
|
#elif MARGIN_VARIATION_TEST
|
204 |
|
|
#define IO_DQS_EN_DELAY_OFFSET (IORD_32DIRECT(BASE_REG_FILE + 0x003C, 0))
|
205 |
|
|
#endif
|
206 |
|
|
|
207 |
|
|
#if HHP_HPS
|
208 |
|
|
#define REG_FILE_DTAPS_PER_PTAP (BASE_REG_FILE + 0x001C)
|
209 |
|
|
#define REG_FILE_TRK_SAMPLE_COUNT (BASE_REG_FILE + 0x0020)
|
210 |
|
|
#define REG_FILE_TRK_LONGIDLE (BASE_REG_FILE + 0x0024)
|
211 |
|
|
#define REG_FILE_DELAYS (BASE_REG_FILE + 0x0028)
|
212 |
|
|
#define REG_FILE_TRK_RW_MGR_ADDR (BASE_REG_FILE + 0x002C)
|
213 |
|
|
#define REG_FILE_TRK_READ_DQS_WIDTH (BASE_REG_FILE + 0x0030)
|
214 |
|
|
#define REG_FILE_TRK_RFSH (BASE_REG_FILE + 0x0034)
|
215 |
|
|
#define CTRL_CONFIG_REG (BASE_MMR + 0x0000)
|
216 |
|
|
#else
|
217 |
|
|
/* Tracking slave addresses. */
|
218 |
|
|
#define TRK_DTAPS_PER_PTAP (BASE_TRK_MGR + 0x0000)
|
219 |
|
|
#define TRK_SAMPLE_COUNT (BASE_TRK_MGR + 0x0004)
|
220 |
|
|
#define TRK_LONGIDLE (BASE_TRK_MGR + 0x0008)
|
221 |
|
|
#define TRK_DELAYS (BASE_TRK_MGR + 0x000C)
|
222 |
|
|
#define TRK_RW_MGR_ADDR (BASE_TRK_MGR + 0x0010)
|
223 |
|
|
#define TRK_READ_DQS_WIDTH (BASE_TRK_MGR + 0x0014)
|
224 |
|
|
#define TRK_RFSH (BASE_TRK_MGR + 0x0018)
|
225 |
|
|
#define TRK_STALL (BASE_TRK_MGR + 0x001C)
|
226 |
|
|
#define TRK_V_POINTER (BASE_TRK_MGR + 0x0020)
|
227 |
|
|
|
228 |
|
|
#define TRK_STALL_REQ_VAL (0x1)
|
229 |
|
|
#define TRK_STALL_ACKED_VAL (0x80000000 | TRK_STALL_REQ_VAL)
|
230 |
|
|
#endif // HHP_HPS
|
231 |
|
|
|
232 |
|
|
/* PHY manager configuration registers. */
|
233 |
|
|
|
234 |
|
|
#define PHY_MGR_PHY_RLAT (BASE_PHY_MGR + 0x4000)
|
235 |
|
|
#define PHY_MGR_RESET_MEM_STBL (BASE_PHY_MGR + 0x4004)
|
236 |
|
|
#define PHY_MGR_MUX_SEL (BASE_PHY_MGR + 0x4008)
|
237 |
|
|
#define PHY_MGR_CAL_STATUS (BASE_PHY_MGR + 0x400c)
|
238 |
|
|
#define PHY_MGR_CAL_DEBUG_INFO (BASE_PHY_MGR + 0x4010)
|
239 |
|
|
#define PHY_MGR_VFIFO_RD_EN_OVRD (BASE_PHY_MGR + 0x4014)
|
240 |
|
|
#if CALIBRATE_BIT_SLIPS
|
241 |
|
|
#define PHY_MGR_FR_SHIFT (BASE_PHY_MGR + 0x4020)
|
242 |
|
|
#if MULTIPLE_AFI_WLAT
|
243 |
|
|
#define PHY_MGR_AFI_WLAT (BASE_PHY_MGR + 0x4020 + 4*RW_MGR_MEM_IF_WRITE_DQS_WIDTH)
|
244 |
|
|
#else
|
245 |
|
|
#define PHY_MGR_AFI_WLAT (BASE_PHY_MGR + 0x4018)
|
246 |
|
|
#endif
|
247 |
|
|
#else
|
248 |
|
|
#define PHY_MGR_AFI_WLAT (BASE_PHY_MGR + 0x4018)
|
249 |
|
|
#endif
|
250 |
|
|
#define PHY_MGR_AFI_RLAT (BASE_PHY_MGR + 0x401c)
|
251 |
|
|
|
252 |
|
|
#define PHY_MGR_CAL_RESET (0)
|
253 |
|
|
#define PHY_MGR_CAL_SUCCESS (1)
|
254 |
|
|
#define PHY_MGR_CAL_FAIL (2)
|
255 |
|
|
|
256 |
|
|
/* PHY manager command addresses. */
|
257 |
|
|
|
258 |
|
|
#define PHY_MGR_CMD_INC_VFIFO_FR (BASE_PHY_MGR + 0x0000)
|
259 |
|
|
#define PHY_MGR_CMD_INC_VFIFO_HR (BASE_PHY_MGR + 0x0004)
|
260 |
|
|
#define PHY_MGR_CMD_INC_VFIFO_HARD_PHY (BASE_PHY_MGR + 0x0004)
|
261 |
|
|
#define PHY_MGR_CMD_FIFO_RESET (BASE_PHY_MGR + 0x0008)
|
262 |
|
|
#define PHY_MGR_CMD_INC_VFIFO_FR_HR (BASE_PHY_MGR + 0x000C)
|
263 |
|
|
#define PHY_MGR_CMD_INC_VFIFO_QR (BASE_PHY_MGR + 0x0010)
|
264 |
|
|
|
265 |
|
|
/* PHY manager parameters. */
|
266 |
|
|
|
267 |
|
|
#define PHY_MGR_MAX_RLAT_WIDTH (BASE_PHY_MGR + 0x0000)
|
268 |
|
|
#define PHY_MGR_MAX_AFI_WLAT_WIDTH (BASE_PHY_MGR + 0x0004)
|
269 |
|
|
#define PHY_MGR_MAX_AFI_RLAT_WIDTH (BASE_PHY_MGR + 0x0008)
|
270 |
|
|
#define PHY_MGR_CALIB_SKIP_STEPS (BASE_PHY_MGR + 0x000c)
|
271 |
|
|
#define PHY_MGR_CALIB_VFIFO_OFFSET (BASE_PHY_MGR + 0x0010)
|
272 |
|
|
#define PHY_MGR_CALIB_LFIFO_OFFSET (BASE_PHY_MGR + 0x0014)
|
273 |
|
|
#define PHY_MGR_RDIMM (BASE_PHY_MGR + 0x0018)
|
274 |
|
|
#define PHY_MGR_MEM_T_WL (BASE_PHY_MGR + 0x001c)
|
275 |
|
|
#define PHY_MGR_MEM_T_RL (BASE_PHY_MGR + 0x0020)
|
276 |
|
|
|
277 |
|
|
/* Data Manager */
|
278 |
|
|
#define DATA_MGR_DRAM_CFG (BASE_DATA_MGR + 0x0000)
|
279 |
|
|
#define DATA_MGR_MEM_T_WL (BASE_DATA_MGR + 0x0004)
|
280 |
|
|
#define DATA_MGR_MEM_T_ADD (BASE_DATA_MGR + 0x0008)
|
281 |
|
|
#define DATA_MGR_MEM_T_RL (BASE_DATA_MGR + 0x000C)
|
282 |
|
|
#define DATA_MGR_MEM_T_RFC (BASE_DATA_MGR + 0x0010)
|
283 |
|
|
#define DATA_MGR_MEM_T_REFI (BASE_DATA_MGR + 0x0014)
|
284 |
|
|
#define DATA_MGR_MEM_T_WR (BASE_DATA_MGR + 0x0018)
|
285 |
|
|
#define DATA_MGR_MEM_T_MRD (BASE_DATA_MGR + 0x001C)
|
286 |
|
|
#define DATA_MGR_COL_WIDTH (BASE_DATA_MGR + 0x0020)
|
287 |
|
|
#define DATA_MGR_ROW_WIDTH (BASE_DATA_MGR + 0x0024)
|
288 |
|
|
#define DATA_MGR_BANK_WIDTH (BASE_DATA_MGR + 0x0028)
|
289 |
|
|
#define DATA_MGR_CS_WIDTH (BASE_DATA_MGR + 0x002C)
|
290 |
|
|
#define DATA_MGR_ITF_WIDTH (BASE_DATA_MGR + 0x0030)
|
291 |
|
|
#define DATA_MGR_DVC_WIDTH (BASE_DATA_MGR + 0x0034)
|
292 |
|
|
|
293 |
|
|
#if HARD_PHY
|
294 |
|
|
#define MEM_T_WL_ADD DATA_MGR_MEM_T_WL
|
295 |
|
|
#define MEM_T_RL_ADD DATA_MGR_MEM_T_RL
|
296 |
|
|
#else
|
297 |
|
|
#define MEM_T_WL_ADD PHY_MGR_MEM_T_WL
|
298 |
|
|
#define MEM_T_RL_ADD PHY_MGR_MEM_T_RL
|
299 |
|
|
#endif
|
300 |
|
|
|
301 |
|
|
#define CALIB_SKIP_DELAY_LOOPS (1 << 0)
|
302 |
|
|
#define CALIB_SKIP_ALL_BITS_CHK (1 << 1)
|
303 |
|
|
#define CALIB_SKIP_DELAY_SWEEPS (1 << 2)
|
304 |
|
|
#define CALIB_SKIP_VFIFO (1 << 3)
|
305 |
|
|
#define CALIB_SKIP_LFIFO (1 << 4)
|
306 |
|
|
#define CALIB_SKIP_WLEVEL (1 << 5)
|
307 |
|
|
#define CALIB_SKIP_WRITES (1 << 6)
|
308 |
|
|
#define CALIB_SKIP_FULL_TEST (1 << 7)
|
309 |
|
|
#define CALIB_SKIP_ALL (CALIB_SKIP_VFIFO | CALIB_SKIP_LFIFO | CALIB_SKIP_WLEVEL | CALIB_SKIP_WRITES | CALIB_SKIP_FULL_TEST)
|
310 |
|
|
#define CALIB_IN_RTL_SIM (1 << 8)
|
311 |
|
|
|
312 |
|
|
/* Scan chain manager command addresses */
|
313 |
|
|
|
314 |
|
|
#define WRITE_SCC_DQS_IN_DELAY(group, delay) IOWR_32DIRECT(SCC_MGR_DQS_IN_DELAY, (group) << 2, delay)
|
315 |
|
|
#define WRITE_SCC_DQS_EN_DELAY(group, delay) IOWR_32DIRECT(SCC_MGR_DQS_EN_DELAY, (group) << 2, (delay) + IO_DQS_EN_DELAY_OFFSET)
|
316 |
|
|
#define WRITE_SCC_DQS_EN_PHASE(group, phase) IOWR_32DIRECT(SCC_MGR_DQS_EN_PHASE, (group) << 2, phase)
|
317 |
|
|
#define WRITE_SCC_DQDQS_OUT_PHASE(group, phase) IOWR_32DIRECT(SCC_MGR_DQDQS_OUT_PHASE, (group) << 2, phase)
|
318 |
|
|
#define WRITE_SCC_OCT_OUT1_DELAY(group, delay) IOWR_32DIRECT(SCC_MGR_OCT_OUT1_DELAY, (group) << 2, delay)
|
319 |
|
|
#if HHP_HPS
|
320 |
|
|
#define WRITE_SCC_OCT_OUT2_DELAY(group, delay)
|
321 |
|
|
#else
|
322 |
|
|
#define WRITE_SCC_OCT_OUT2_DELAY(group, delay) IOWR_32DIRECT(SCC_MGR_OCT_OUT2_DELAY, (group) << 2, delay)
|
323 |
|
|
#endif
|
324 |
|
|
#if HHP_HPS
|
325 |
|
|
#define WRITE_SCC_DQS_BYPASS(group, bypass)
|
326 |
|
|
#else
|
327 |
|
|
#define WRITE_SCC_DQS_BYPASS(group, bypass) IOWR_32DIRECT(SCC_MGR_DQS_BYPASS, (group) << 2, bypass)
|
328 |
|
|
#endif
|
329 |
|
|
|
330 |
|
|
#define WRITE_SCC_DQ_OUT1_DELAY(pin, delay) IOWR_32DIRECT(SCC_MGR_IO_OUT1_DELAY, (pin) << 2, delay)
|
331 |
|
|
|
332 |
|
|
#if HHP_HPS
|
333 |
|
|
#define WRITE_SCC_DQ_OUT2_DELAY(pin, delay)
|
334 |
|
|
#else
|
335 |
|
|
#define WRITE_SCC_DQ_OUT2_DELAY(pin, delay) IOWR_32DIRECT(SCC_MGR_IO_OUT2_DELAY, (pin) << 2, delay)
|
336 |
|
|
#endif
|
337 |
|
|
|
338 |
|
|
#define WRITE_SCC_DQ_IN_DELAY(pin, delay) IOWR_32DIRECT(SCC_MGR_IO_IN_DELAY, (pin) << 2, delay)
|
339 |
|
|
|
340 |
|
|
#if HHP_HPS
|
341 |
|
|
#define WRITE_SCC_DQ_BYPASS(pin, bypass)
|
342 |
|
|
#else
|
343 |
|
|
#define WRITE_SCC_DQ_BYPASS(pin, bypass) IOWR_32DIRECT(SCC_MGR_DQ_BYPASS, (pin) << 2, bypass)
|
344 |
|
|
#endif
|
345 |
|
|
|
346 |
|
|
#if HHP_HPS
|
347 |
|
|
#define WRITE_SCC_RFIFO_MODE(pin, mode)
|
348 |
|
|
#else
|
349 |
|
|
#define WRITE_SCC_RFIFO_MODE(pin, mode) IOWR_32DIRECT(SCC_MGR_RFIFO_MODE, (pin) << 2, mode)
|
350 |
|
|
#endif
|
351 |
|
|
|
352 |
|
|
#if HHP_HPS
|
353 |
|
|
#define WRITE_SCC_HHP_EXTRAS(value) IOWR_32DIRECT(SCC_MGR_HHP_GLOBALS, SCC_MGR_HHP_EXTRAS_OFFSET, value)
|
354 |
|
|
#define WRITE_SCC_HHP_DQSE_MAP(value) IOWR_32DIRECT(SCC_MGR_HHP_GLOBALS, SCC_MGR_HHP_DQSE_MAP_OFFSET, value)
|
355 |
|
|
#else
|
356 |
|
|
#define WRITE_SCC_HHP_EXTRAS(value)
|
357 |
|
|
#define WRITE_SCC_HHP_DQSE_MAP(value)
|
358 |
|
|
#endif
|
359 |
|
|
|
360 |
|
|
#define WRITE_SCC_DQS_IO_OUT1_DELAY(delay) IOWR_32DIRECT(SCC_MGR_IO_OUT1_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS) << 2, delay)
|
361 |
|
|
|
362 |
|
|
#if HHP_HPS
|
363 |
|
|
#define WRITE_SCC_DQS_IO_OUT2_DELAY(delay)
|
364 |
|
|
#else
|
365 |
|
|
#define WRITE_SCC_DQS_IO_OUT2_DELAY(delay) IOWR_32DIRECT(SCC_MGR_IO_OUT2_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS) << 2, delay)
|
366 |
|
|
#endif
|
367 |
|
|
|
368 |
|
|
#define WRITE_SCC_DQS_IO_IN_DELAY(delay) IOWR_32DIRECT(SCC_MGR_IO_IN_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS) << 2, delay)
|
369 |
|
|
|
370 |
|
|
#define WRITE_SCC_DM_IO_OUT1_DELAY(pin, delay) IOWR_32DIRECT(SCC_MGR_IO_OUT1_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS + 1 + pin) << 2, delay)
|
371 |
|
|
|
372 |
|
|
#if HHP_HPS
|
373 |
|
|
#define WRITE_SCC_DM_IO_OUT2_DELAY(pin, delay)
|
374 |
|
|
#else
|
375 |
|
|
#define WRITE_SCC_DM_IO_OUT2_DELAY(pin, delay) IOWR_32DIRECT(SCC_MGR_IO_OUT2_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS + 1 + pin) << 2, delay)
|
376 |
|
|
#endif
|
377 |
|
|
|
378 |
|
|
#define WRITE_SCC_DM_IO_IN_DELAY(pin, delay) IOWR_32DIRECT(SCC_MGR_IO_IN_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS + 1 + pin) << 2, delay)
|
379 |
|
|
|
380 |
|
|
#if HHP_HPS
|
381 |
|
|
#define WRITE_SCC_DM_BYPASS(pin, bypass)
|
382 |
|
|
#else
|
383 |
|
|
#define WRITE_SCC_DM_BYPASS(pin, bypass) IOWR_32DIRECT(SCC_MGR_DQ_BYPASS, (RW_MGR_MEM_DQ_PER_WRITE_DQS + 1 + pin) << 2, bypass)
|
384 |
|
|
#endif
|
385 |
|
|
|
386 |
|
|
#define READ_SCC_DQS_IN_DELAY(group) IORD_32DIRECT(SCC_MGR_DQS_IN_DELAY, (group) << 2)
|
387 |
|
|
#define READ_SCC_DQS_EN_DELAY(group) (IORD_32DIRECT(SCC_MGR_DQS_EN_DELAY, (group) << 2) - IO_DQS_EN_DELAY_OFFSET)
|
388 |
|
|
#define READ_SCC_DQS_EN_PHASE(group) IORD_32DIRECT(SCC_MGR_DQS_EN_PHASE, (group) << 2)
|
389 |
|
|
#define READ_SCC_DQDQS_OUT_PHASE(group) IORD_32DIRECT(SCC_MGR_DQDQS_OUT_PHASE, (group) << 2)
|
390 |
|
|
#define READ_SCC_OCT_OUT1_DELAY(group) IORD_32DIRECT(SCC_MGR_OCT_OUT1_DELAY, (group * RW_MGR_MEM_IF_READ_DQS_WIDTH / RW_MGR_MEM_IF_WRITE_DQS_WIDTH) << 2)
|
391 |
|
|
#if HHP_HPS
|
392 |
|
|
#define READ_SCC_OCT_OUT2_DELAY(group) 0
|
393 |
|
|
#else
|
394 |
|
|
#define READ_SCC_OCT_OUT2_DELAY(group) IORD_32DIRECT(SCC_MGR_OCT_OUT2_DELAY, (group * RW_MGR_MEM_IF_READ_DQS_WIDTH / RW_MGR_MEM_IF_WRITE_DQS_WIDTH) << 2)
|
395 |
|
|
#endif
|
396 |
|
|
#if HHP_HPS
|
397 |
|
|
#define READ_SCC_DQS_BYPASS(group) 0
|
398 |
|
|
#else
|
399 |
|
|
#define READ_SCC_DQS_BYPASS(group) IORD_32DIRECT(SCC_MGR_DQS_BYPASS, (group) << 2)
|
400 |
|
|
#endif
|
401 |
|
|
#if HHP_HPS
|
402 |
|
|
#define READ_SCC_DQS_BYPASS(group) 0
|
403 |
|
|
#else
|
404 |
|
|
#define READ_SCC_DQS_BYPASS(group) IORD_32DIRECT(SCC_MGR_DQS_BYPASS, (group) << 2)
|
405 |
|
|
#endif
|
406 |
|
|
|
407 |
|
|
#define READ_SCC_DQ_OUT1_DELAY(pin) IORD_32DIRECT(SCC_MGR_IO_OUT1_DELAY, (pin) << 2)
|
408 |
|
|
#if HHP_HPS
|
409 |
|
|
#define READ_SCC_DQ_OUT2_DELAY(pin) 0
|
410 |
|
|
#else
|
411 |
|
|
#define READ_SCC_DQ_OUT2_DELAY(pin) IORD_32DIRECT(SCC_MGR_IO_OUT2_DELAY, (pin) << 2)
|
412 |
|
|
#endif
|
413 |
|
|
#define READ_SCC_DQ_IN_DELAY(pin) IORD_32DIRECT(SCC_MGR_IO_IN_DELAY, (pin) << 2)
|
414 |
|
|
#if HHP_HPS
|
415 |
|
|
#define READ_SCC_DQ_BYPASS(pin) 0
|
416 |
|
|
#else
|
417 |
|
|
#define READ_SCC_DQ_BYPASS(pin) IOWR_32DIRECT(SCC_MGR_DQ_BYPASS, (pin) << 2)
|
418 |
|
|
#endif
|
419 |
|
|
#if HHP_HPS
|
420 |
|
|
#define READ_SCC_RFIFO_MODE(pin) 0
|
421 |
|
|
#else
|
422 |
|
|
#define READ_SCC_RFIFO_MODE(pin) IOWR_32DIRECT(SCC_MGR_RFIFO_MODE, (pin) << 2)
|
423 |
|
|
#endif
|
424 |
|
|
|
425 |
|
|
#define READ_SCC_DQS_IO_OUT1_DELAY() IORD_32DIRECT(SCC_MGR_IO_OUT1_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS) << 2)
|
426 |
|
|
#if HHP_HPS
|
427 |
|
|
#define READ_SCC_DQS_IO_OUT2_DELAY() 0
|
428 |
|
|
#else
|
429 |
|
|
#define READ_SCC_DQS_IO_OUT2_DELAY() IORD_32DIRECT(SCC_MGR_IO_OUT2_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS) << 2)
|
430 |
|
|
#endif
|
431 |
|
|
#define READ_SCC_DQS_IO_IN_DELAY() IORD_32DIRECT(SCC_MGR_IO_IN_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS) << 2)
|
432 |
|
|
|
433 |
|
|
#define READ_SCC_DM_IO_OUT1_DELAY(pin) IORD_32DIRECT(SCC_MGR_IO_OUT1_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS + 1 + pin) << 2)
|
434 |
|
|
#if HHP_HPS
|
435 |
|
|
#define READ_SCC_DM_IO_OUT2_DELAY(pin) 0
|
436 |
|
|
#else
|
437 |
|
|
#define READ_SCC_DM_IO_OUT2_DELAY(pin) IORD_32DIRECT(SCC_MGR_IO_OUT2_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS + 1 + pin) << 2)
|
438 |
|
|
#endif
|
439 |
|
|
#define READ_SCC_DM_IO_IN_DELAY(pin) IORD_32DIRECT(SCC_MGR_IO_IN_DELAY, (RW_MGR_MEM_DQ_PER_WRITE_DQS + 1 + pin) << 2)
|
440 |
|
|
#if HHP_HPS
|
441 |
|
|
#define READ_SCC_DM_BYPASS(pin) 0
|
442 |
|
|
#else
|
443 |
|
|
#define READ_SCC_DM_BYPASS(pin) IOWR_32DIRECT(SCC_MGR_DQ_BYPASS, (RW_MGR_MEM_DQ_PER_WRITE_DQS + 1 + pin) << 2)
|
444 |
|
|
#endif
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
#define SCC_MGR_GROUP_COUNTER (BASE_SCC_MGR + 0x0000)
|
448 |
|
|
#define SCC_MGR_DQS_IN_DELAY (BASE_SCC_MGR + 0x0100)
|
449 |
|
|
#define SCC_MGR_DQS_EN_PHASE (BASE_SCC_MGR + 0x0200)
|
450 |
|
|
#define SCC_MGR_DQS_EN_DELAY (BASE_SCC_MGR + 0x0300)
|
451 |
|
|
#define SCC_MGR_DQDQS_OUT_PHASE (BASE_SCC_MGR + 0x0400)
|
452 |
|
|
#define SCC_MGR_OCT_OUT1_DELAY (BASE_SCC_MGR + 0x0500)
|
453 |
|
|
#if !HHP_HPS
|
454 |
|
|
#define SCC_MGR_OCT_OUT2_DELAY (BASE_SCC_MGR + 0x0600)
|
455 |
|
|
#endif
|
456 |
|
|
#define SCC_MGR_IO_OUT1_DELAY (BASE_SCC_MGR + 0x0700)
|
457 |
|
|
#if !HHP_HPS
|
458 |
|
|
#define SCC_MGR_IO_OUT2_DELAY (BASE_SCC_MGR + 0x0800)
|
459 |
|
|
#endif
|
460 |
|
|
#define SCC_MGR_IO_IN_DELAY (BASE_SCC_MGR + 0x0900)
|
461 |
|
|
|
462 |
|
|
#if !HHP_HPS
|
463 |
|
|
/* ACV-specific commands */
|
464 |
|
|
#define SCC_MGR_DQS_BYPASS (BASE_SCC_MGR + 0x0A00)
|
465 |
|
|
#define SCC_MGR_DQ_BYPASS (BASE_SCC_MGR + 0x0B00)
|
466 |
|
|
#define SCC_MGR_RFIFO_MODE (BASE_SCC_MGR + 0x0C00)
|
467 |
|
|
#endif
|
468 |
|
|
|
469 |
|
|
#if HHP_HPS
|
470 |
|
|
/* HHP-HPS-specific versions of some commands */
|
471 |
|
|
#define SCC_MGR_DQS_EN_DELAY_GATE (BASE_SCC_MGR + 0x0600)
|
472 |
|
|
#define SCC_MGR_IO_OE_DELAY (BASE_SCC_MGR + 0x0800)
|
473 |
|
|
#define SCC_MGR_HHP_GLOBALS (BASE_SCC_MGR + 0x0A00)
|
474 |
|
|
#define SCC_MGR_HHP_RFILE (BASE_SCC_MGR + 0x0B00)
|
475 |
|
|
#endif
|
476 |
|
|
|
477 |
|
|
/* HHP-HPS-specific values */
|
478 |
|
|
#define SCC_MGR_HHP_EXTRAS_OFFSET 0
|
479 |
|
|
#define SCC_MGR_HHP_DQSE_MAP_OFFSET 1
|
480 |
|
|
|
481 |
|
|
#define SCC_MGR_DQS_ENA (BASE_SCC_MGR + 0x0E00)
|
482 |
|
|
#define SCC_MGR_DQS_IO_ENA (BASE_SCC_MGR + 0x0E04)
|
483 |
|
|
#define SCC_MGR_DQ_ENA (BASE_SCC_MGR + 0x0E08)
|
484 |
|
|
#define SCC_MGR_DM_ENA (BASE_SCC_MGR + 0x0E0C)
|
485 |
|
|
#define SCC_MGR_UPD (BASE_SCC_MGR + 0x0E20)
|
486 |
|
|
#define SCC_MGR_ACTIVE_RANK (BASE_SCC_MGR + 0x0E40)
|
487 |
|
|
#define SCC_MGR_AFI_CAL_INIT (BASE_SCC_MGR + 0x0D00)
|
488 |
|
|
|
489 |
|
|
// PHY Debug mode flag constants
|
490 |
|
|
#define PHY_DEBUG_IN_DEBUG_MODE 0x00000001
|
491 |
|
|
#define PHY_DEBUG_ENABLE_CAL_RPT 0x00000002
|
492 |
|
|
#define PHY_DEBUG_ENABLE_MARGIN_RPT 0x00000004
|
493 |
|
|
#define PHY_DEBUG_SWEEP_ALL_GROUPS 0x00000008
|
494 |
|
|
#define PHY_DEBUG_DISABLE_GUARANTEED_READ 0x00000010
|
495 |
|
|
#define PHY_DEBUG_ENABLE_NON_DESTRUCTIVE_CALIBRATION 0x00000020
|
496 |
|
|
|
497 |
|
|
// Init and Reset delay constants - Only use if defined by sequencer_defines.h,
|
498 |
|
|
// otherwise, revert to defaults
|
499 |
|
|
// Default for Tinit = (0+1) * ((202+1) * (2 * 131 + 1) + 1) = 53532 = 200.75us @ 266MHz
|
500 |
|
|
#ifdef TINIT_CNTR0_VAL
|
501 |
|
|
#define SEQ_TINIT_CNTR0_VAL TINIT_CNTR0_VAL
|
502 |
|
|
#else
|
503 |
|
|
#define SEQ_TINIT_CNTR0_VAL 0
|
504 |
|
|
#endif
|
505 |
|
|
|
506 |
|
|
#ifdef TINIT_CNTR1_VAL
|
507 |
|
|
#define SEQ_TINIT_CNTR1_VAL TINIT_CNTR1_VAL
|
508 |
|
|
#else
|
509 |
|
|
#define SEQ_TINIT_CNTR1_VAL 202
|
510 |
|
|
#endif
|
511 |
|
|
|
512 |
|
|
#ifdef TINIT_CNTR2_VAL
|
513 |
|
|
#define SEQ_TINIT_CNTR2_VAL TINIT_CNTR2_VAL
|
514 |
|
|
#else
|
515 |
|
|
#define SEQ_TINIT_CNTR2_VAL 131
|
516 |
|
|
#endif
|
517 |
|
|
|
518 |
|
|
|
519 |
|
|
// Default for Treset = (2+1) * ((252+1) * (2 * 131 + 1) + 1) = 133563 = 500.86us @ 266MHz
|
520 |
|
|
#ifdef TRESET_CNTR0_VAL
|
521 |
|
|
#define SEQ_TRESET_CNTR0_VAL TRESET_CNTR0_VAL
|
522 |
|
|
#else
|
523 |
|
|
#define SEQ_TRESET_CNTR0_VAL 2
|
524 |
|
|
#endif
|
525 |
|
|
|
526 |
|
|
#ifdef TRESET_CNTR1_VAL
|
527 |
|
|
#define SEQ_TRESET_CNTR1_VAL TRESET_CNTR1_VAL
|
528 |
|
|
#else
|
529 |
|
|
#define SEQ_TRESET_CNTR1_VAL 252
|
530 |
|
|
#endif
|
531 |
|
|
|
532 |
|
|
#ifdef TRESET_CNTR2_VAL
|
533 |
|
|
#define SEQ_TRESET_CNTR2_VAL TRESET_CNTR2_VAL
|
534 |
|
|
#else
|
535 |
|
|
#define SEQ_TRESET_CNTR2_VAL 131
|
536 |
|
|
#endif
|
537 |
|
|
|
538 |
|
|
|
539 |
|
|
|
540 |
|
|
/* Bitfield type changes depending on protocol */
|
541 |
|
|
#if QDRII
|
542 |
|
|
typedef long long t_btfld;
|
543 |
|
|
#else
|
544 |
|
|
typedef alt_u32 t_btfld;
|
545 |
|
|
#endif
|
546 |
|
|
|
547 |
|
|
#define RW_MGR_INST_ROM_WRITE BASE_RW_MGR + 0x1800
|
548 |
|
|
#define RW_MGR_AC_ROM_WRITE BASE_RW_MGR + 0x1C00
|
549 |
|
|
|
550 |
|
|
extern const alt_u32 inst_rom_init_size;
|
551 |
|
|
extern const alt_u32 inst_rom_init[];
|
552 |
|
|
extern const alt_u32 ac_rom_init_size;
|
553 |
|
|
extern const alt_u32 ac_rom_init[];
|
554 |
|
|
|
555 |
|
|
|
556 |
|
|
|
557 |
|
|
/* parameter variable holder */
|
558 |
|
|
|
559 |
|
|
typedef struct param_type {
|
560 |
|
|
t_btfld dm_correct_mask;
|
561 |
|
|
t_btfld read_correct_mask;
|
562 |
|
|
t_btfld read_correct_mask_vg;
|
563 |
|
|
t_btfld write_correct_mask;
|
564 |
|
|
t_btfld write_correct_mask_vg;
|
565 |
|
|
|
566 |
|
|
/* set a particular entry to 1 if we need to skip a particular rank */
|
567 |
|
|
|
568 |
|
|
alt_u32 skip_ranks[MAX_RANKS];
|
569 |
|
|
|
570 |
|
|
/* set a particular entry to 1 if we need to skip a particular group */
|
571 |
|
|
|
572 |
|
|
alt_u32 skip_groups;
|
573 |
|
|
|
574 |
|
|
/* set a particular entry to 1 if the shadow register (which represents a set of ranks) needs to be skipped */
|
575 |
|
|
|
576 |
|
|
alt_u32 skip_shadow_regs[NUM_SHADOW_REGS];
|
577 |
|
|
|
578 |
|
|
} param_t;
|
579 |
|
|
|
580 |
|
|
|
581 |
|
|
/* global variable holder */
|
582 |
|
|
|
583 |
|
|
typedef struct gbl_type {
|
584 |
|
|
|
585 |
|
|
alt_u32 phy_debug_mode_flags;
|
586 |
|
|
|
587 |
|
|
/* current read latency */
|
588 |
|
|
|
589 |
|
|
alt_u32 curr_read_lat;
|
590 |
|
|
|
591 |
|
|
/* current write latency */
|
592 |
|
|
|
593 |
|
|
alt_u32 curr_write_lat;
|
594 |
|
|
|
595 |
|
|
/* error code */
|
596 |
|
|
|
597 |
|
|
alt_u32 error_substage;
|
598 |
|
|
alt_u32 error_stage;
|
599 |
|
|
alt_u32 error_group;
|
600 |
|
|
|
601 |
|
|
/* figure-of-merit in, figure-of-merit out */
|
602 |
|
|
|
603 |
|
|
alt_u32 fom_in;
|
604 |
|
|
alt_u32 fom_out;
|
605 |
|
|
|
606 |
|
|
//USER Number of RW Mgr NOP cycles between write command and write data
|
607 |
|
|
#if MULTIPLE_AFI_WLAT
|
608 |
|
|
alt_u32 rw_wl_nop_cycles_per_group[RW_MGR_MEM_IF_WRITE_DQS_WIDTH];
|
609 |
|
|
#endif
|
610 |
|
|
alt_u32 rw_wl_nop_cycles;
|
611 |
|
|
} gbl_t;
|
612 |
|
|
|
613 |
|
|
// External global variables
|
614 |
|
|
extern gbl_t *gbl;
|
615 |
|
|
extern param_t *param;
|
616 |
|
|
|
617 |
|
|
// External functions
|
618 |
|
|
alt_u32 rw_mgr_mem_calibrate_full_test (alt_u32 min_correct, t_btfld *bit_chk, alt_u32 test_dm);
|
619 |
|
|
#if ENABLE_NON_DES_CAL
|
620 |
|
|
extern alt_u32 run_mem_calibrate (alt_u32 enable_non_des_c);
|
621 |
|
|
#else
|
622 |
|
|
extern alt_u32 run_mem_calibrate (void);
|
623 |
|
|
#endif
|
624 |
|
|
extern void rw_mgr_mem_calibrate_eye_diag_aid (void);
|
625 |
|
|
extern void rw_mgr_load_mrs_calib (void);
|
626 |
|
|
extern void rw_mgr_load_mrs_exec (void);
|
627 |
|
|
extern void rw_mgr_mem_initialize (void);
|
628 |
|
|
extern void rw_mgr_mem_dll_lock_wait(void);
|
629 |
|
|
extern inline void scc_mgr_set_dq_in_delay (alt_u32 write_group, alt_u32 dq_in_group, alt_u32 delay);
|
630 |
|
|
extern inline void scc_mgr_set_dq_out1_delay (alt_u32 write_group, alt_u32 dq_in_group, alt_u32 delay);
|
631 |
|
|
extern inline void scc_mgr_set_dq_out2_delay (alt_u32 write_group, alt_u32 dq_in_group, alt_u32 delay);
|
632 |
|
|
extern inline void scc_mgr_load_dq (alt_u32 dq_in_group);
|
633 |
|
|
extern inline void scc_mgr_set_dqs_bus_in_delay (alt_u32 read_group, alt_u32 delay);
|
634 |
|
|
extern inline void scc_mgr_load_dqs (alt_u32 dqs);
|
635 |
|
|
extern void scc_mgr_set_group_dqs_io_and_oct_out1_gradual (alt_u32 write_group, alt_u32 delay);
|
636 |
|
|
extern void scc_mgr_set_group_dqs_io_and_oct_out2_gradual (alt_u32 write_group, alt_u32 delay);
|
637 |
|
|
extern void scc_mgr_set_dqs_en_delay_all_ranks (alt_u32 read_group, alt_u32 delay);
|
638 |
|
|
extern void scc_mgr_set_dqs_en_phase_all_ranks (alt_u32 read_group, alt_u32 phase);
|
639 |
|
|
extern void scc_mgr_set_dqdqs_output_phase_all_ranks (alt_u32 write_group, alt_u32 phase);
|
640 |
|
|
extern inline void scc_mgr_set_dm_out1_delay (alt_u32 write_group, alt_u32 dm, alt_u32 delay);
|
641 |
|
|
extern inline void scc_mgr_set_dm_out2_delay (alt_u32 write_group, alt_u32 dm, alt_u32 delay);
|
642 |
|
|
extern inline void scc_mgr_load_dm (alt_u32 dm);
|
643 |
|
|
extern void rw_mgr_incr_vfifo_auto(alt_u32 grp);
|
644 |
|
|
extern void rw_mgr_decr_vfifo_auto(alt_u32 grp);
|
645 |
|
|
#if HPS_HW
|
646 |
|
|
extern int sdram_calibration(void);
|
647 |
|
|
#endif
|
648 |
|
|
#endif
|