ulxlife.c
9.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
/*
* F i l e N a m e : U L X L I F E . C
*
****************************************************************************
* Created Tomohiro Teshima.
* Peripheral Div. Quality Assurance Dpt.
* (C) CopyRight ALPS Electric Co., Ltd. 1996
****************************************************************************
* Version
*
* ver Date
* ---- --------
* 1.01 '96.07.17 Deleted DC2/EEC status .
* 1.00 '96.07.10 Initial revision .
****************************************************************************
*/
/*===========================================*/
/* レオドライブ用テストソフトのコマンド発行ルーチン */
/*===========================================*/
#include <ultra64.h>
#include "ulxmain.h"
#include "ulxlib.h"
#include "ulxutil.h"
extern u16 key;
extern union leo_sys_form LEO_sys_data;
extern void disp_leosys_data( void );
extern void setparameter( void );
/*==========================================================*/
void life_disp_init( u8 *chr )
{
ClrDisp();
Disp_Ready(0, 0, CYAN );
sprintf( STR, chr );
Disp_Fin();
Disp_Ready(0, 2, GREEN );
if( pass_count == CONTINUE )
sprintf( STR, " TEST PASS : CONTINUE" );
else
sprintf( STR, " TEST PASS : %u", pass_count );
Disp_Fin();
Disp_Ready(0, 3, GREEN );
sprintf( STR, " HD Load Time : -- " );
Disp_Fin();
Disp_Ready(0, 4, GREEN );
sprintf( STR, " HD UnLoad Time : --" );
Disp_Fin();
Disp_Ready(0, 5, GREEN );
sprintf( STR, " POST : %d ",Post );
Disp_Fin();
Disp_Ready(0, 7, GREEN );
sprintf( STR, " EXEC PASS : SEQUENCE: " );
Disp_Fin();
Disp_Ready(0, 8, GREEN );
sprintf( STR, " EXEC LBA : --- " );
Disp_Fin();
Disp_Ready(0, 9, GREEN );
sprintf( STR, " EXEC BLOCK: --- " );
Disp_Fin();
Disp_Ready(0, 11, GREEN );
sprintf( STR, " STATUS: SENSECODE: CMP: - " );
Disp_Fin();
Disp_Ready(0, 12, GREEN );
sprintf( STR, " ERROR NUM : " );
Disp_Fin();
Disp_Ready(0, 14, YELLOW );
sprintf( STR, " B:ABORT START:PAUSE " );
Disp_Fin();
}
u16 ld_uld_key(void)
{
switch( key ) {
case CONT_B:
GetChr();
return(1);
break;
case CONT_START:
ulxPrint0(5, 13, RED, " PAUSE Hit any key to start" );
GetChr();
ulxPrint0(5, 13, RED, " " );
break;
default : break;
}
return 0;
}
u16 ld_uld_life( void )
{
static u8 ldtime=2, uldtime=2;
u8 stbyflg=1, sta=0, ret=LEO_STATUS_GOOD;
u32 pass=CONTINUE, err=0;
u32 tcount_aft, tlba=0;
Post = 0;
ldtime = GetNum8A( ldtime, "Input HD Load Time(sec) ", 2, 13, YELLOW );
uldtime = GetNum8A( uldtime, "Input HD Un-Load Time(sec)", 2, 13, YELLOW );
tlba = GetNum32( tlba, "Input LBA", 2, 13, YELLOW );
stbyflg = GetNumFlg( stbyflg, "StandBy[1] or Sleep[0] ", 2, 13, YELLOW );
StartStop( stbyflg, sta ) ;
life_disp_init( "HEAD LD/ULD LIFE TEST" );
ulxPrint1(0, 3, GREEN , " HD Load Time : %d Sec", ldtime);
ulxPrint1(0, 4, GREEN , " HD UnLoad Time : %d Sec", uldtime);
do {
/**** Disp Status **********************************/
ulxPrint1(14, 7, WHITE, "%u", pass );
ulxPrint1(9, 11, WHITE, "%02X", Status );
ulxPrint1(22, 11, WHITE, "%02d", SCode );
if( ret != LEO_STATUS_GOOD )
err++;
ulxPrint1(13, 12, WHITE, "%d", err );
key = InCtrlData();
if (ld_uld_key())
return 0;
/**** Head Load ***********************************/
ulxPrint0(31, 7, WHITE, "LD " );
ret = ReadDrive( tlba, (u32)1, RDB );
Wait_Timer( (u16)ldtime );
if (ld_uld_key())
return 0;
/**** Head Un-Load Time ****************************/
ulxPrint0(31, 7, WHITE, "ULD" );
sta=0;
ret |= StartStop( stbyflg, sta );
Wait_Timer( (u16)uldtime );
if (ld_uld_key())
return 0;
pass++;
/*
switch( key ) {
case CONT_B:
GetChr();
return(0);
break;
case CONT_START:
Disp_Ready(5, 13, RED );
sprintf( STR, " PAUSE Hit any key to start" );
Disp_Fin();
GetChr();
Disp_Ready(5, 13, RED );
sprintf( STR, " " );
Disp_Fin();
break;
default : break;
}
*/
if( (pass_count != CONTINUE) && ( pass >= pass_count) )
{
ulxPrint1(14, 7, WHITE, "%u", pass );
GetChr();
return( 0 );
}
}while( 1 );
}
u16 seek_life( void )
{
u8 ret=0, i, skflg=1;
u32 pass=0, err=0;
u32 blk=1;
u32 tlba[33]={ 0,1198,2020,3624,2554,3266,2232,3518,336,970,2418,1392,
0,2718,2402,4291,562,4120,2528,3414,2452,3762,222,4250,
92,3938,1980,4048,528,3142,614,4020
};
key = Post = 0;
skflg = GetNumFlg( skflg, "Seek CMD[1] or Read CMD[0] ", 2, 13, YELLOW );
if( skflg ) {
life_disp_init( "SEEK LIFE TEST(SEEK CMD)" );
} else {
life_disp_init( "SEEK LIFE TEST(READ CMD)" );
Disp_Ready(14, 9, WHITE );
sprintf( STR, "%d ",blk );
Disp_Fin();
Disp_Ready(0, 5, GREEN );
sprintf( STR, " POST : %d ", Post );
Disp_Fin();
}
do
{
for( i=0; i<32; i++ )
{
Disp_Ready(14, 8, WHITE );
sprintf( STR, "%X ",tlba[i] );
Disp_Fin();
if( skflg )
ret = SeekDrive( tlba[i] );
else
ret = ReadDrive( tlba[i], blk, RDB );
/**** Disp Status **********************************/
Disp_Ready(14, 7, WHITE );
sprintf( STR, "%u", pass );
Disp_Fin();
Disp_Ready(9, 11, WHITE );
sprintf( STR, "%02X", Status );
Disp_Fin();
Disp_Ready(22, 11, WHITE );
sprintf( STR, "%02d", SCode );
Disp_Fin();
if( ret != LEO_STATUS_GOOD ) err++;
Disp_Ready(13, 12, WHITE );
sprintf( STR, "%u", err );
Disp_Fin();
if ( ret != LEO_STATUS_GOOD && err_stop == ENABLE )
{
Disp_Ready(3, 13, RED );
sprintf( STR, "ERROR. Hit any key to start" );
Disp_Fin();
GetChr();
Disp_Ready(3, 13, RED );
sprintf( STR, " " );
Disp_Fin();
if (key != CONT_B)
key = 0;
}
else
key = InCtrlData();
switch( key ) {
case CONT_B:
GetChr();
return(0);
break;
case CONT_START:
Disp_Ready(5, 13, RED );
sprintf( STR, " PAUSE Hit any key to start" );
Disp_Fin();
GetChr();
Disp_Ready(5, 13, RED );
sprintf( STR, " " );
Disp_Fin();
break;
default : break;
}
if( (pass_count != CONTINUE) && ( pass >= pass_count) )
{
Disp_Ready(14, 7, WHITE );
sprintf( STR, "%d", pass );
Disp_Fin();
GetChr();
return( 0 );
}
}
pass++ ;
} while (1);
return( 0 );
}
void life_test( void )
{
u16 num=1, xpos=2 ,ypos=13 ,clr=YELLOW ;
u16 x_l= 2, y_l=2, col_l=2;
u16 x_r=18, y_r=2, col_r=7;
u8 *left_d[2] = { "SEEK LIFE ",
"HD LD/ULD LIFE "
};
u8 *right_d[7] = { "SET PARAMETER ",
" ",
"DISP SYS. DATA ",
"CLEAR BUFFER ",
"COMPARE BUFFER ",
"BUFFER HANDLE ",
"EXIT "
};
static u8 stbyflg, stby, sleep, sta, wrt, tbl;
static u32 slba, blk, inb;
slba = blk = (u32)0x00;
inb = (u32)0x01;
do
{
ClrDisp();
Disp_Ready(0, 0, CYAN);
sprintf( STR, "LIFE TEST MENU " );
Disp_Fin();
ListDisp( x_l, y_l, col_l, left_d, x_r, y_r, col_r, right_d, GREEN );
num = SelStr2( x_l, y_l, col_l, left_d, x_r, y_r, col_r, right_d, num, GREEN );
switch( num )
{
case 1:
seek_life();
break;
case 2:
ld_uld_life();
break;
/***********************************************/
case 3:
setparameter();
break;
case 4:
break;
case 5:
disp_leosys_data();
break;
case 6:
ClrBuf();
break;
case 7:
CompBufDisp();
break;
case 8:
bufhandle();
break;
case 9:
num = ESC;
break;
default:
break;
}
if (num <= 2)
GetChr();
} while( num != ESC );
}