-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsAbort.c
More file actions
executable file
·96 lines (85 loc) · 2.66 KB
/
tsAbort.c
File metadata and controls
executable file
·96 lines (85 loc) · 2.66 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
#include "ts.h"
/*
name change 2010.10.01 By Enomoto
dwDriveMcsTotalSizeByte ---> dwDriveParametricSizeByte
dwDriveMcsDumpSizeByte ---> dwDriveParametricDumpSizeByte
*/
/**
* <pre>
* Description:
* Abort drive test and request rawdata preparation.
* </pre>
*****************************************************************************/
Byte requestDriveTestAbort(TEST_SCRIPT_CONTROL_BLOCK *tscb)
{
TEST_SCRIPT_ERROR_BLOCK *tseb = &tscb->testScriptErrorBlock;
Byte rc = 1;
ts_printf(__FILE__, __LINE__, "abortDriveTest");
/* error check */
if (tseb->isFatalError) {
ts_printf(__FILE__, __LINE__, "error");
return 1;
}
/* check identify done */
if (!tscb->isDriveIdentifyComplete) {
ts_printf(__FILE__, __LINE__, "skip by identify incomplete");
return 1;
}
/* SRST stop, and request test rawdata */
/* remove 2010.12.07 by Furukawa because it cannot read
rc = driveIoCtrlByKeywordWithRetry(tscb, KEY_IMMEDIATE_FLAG, 0, READ_FROM_DRIVE);
if (rc) {
ts_printf(__FILE__, __LINE__, "Error - read memory");
return 1;
}
*/
tscb->bSectorBuffer[0] = 0; /* 2010.12.07 add */
tscb->bSectorBuffer[0] |= IS_TEST_TIME_OUT; /* or by 0x01 */
rc = driveIoCtrlByKeywordWithRetry(tscb, KEY_IMMEDIATE_FLAG, 0, WRITE_TO_DRIVE); /* abort SRST then reprot flag ON --> PREPDATA */
if (rc) {
ts_printf(__FILE__, __LINE__, "Abort Error - write memory");
}
return rc;
}
/**
* <pre>
* Description:
* Unload drive head.
* </pre>
*****************************************************************************/
Byte requestDriveUnload(TEST_SCRIPT_CONTROL_BLOCK *tscb)
{
TEST_SCRIPT_ERROR_BLOCK *tseb = &tscb->testScriptErrorBlock;
Byte isFatalErrorCheck = 0;
Byte rc = 1;
ts_printf(__FILE__, __LINE__, "unloadDrive");
/* error check */
if (isFatalErrorCheck) {
if (tseb->isFatalError) {
ts_printf(__FILE__, __LINE__, "skip by fatal error flag");
return 1;
}
}
/* check identify done */
if (!tscb->isDriveIdentifyComplete) {
ts_printf(__FILE__, __LINE__, "skip by identify incomplete");
return 1;
}
/* drive unload */
/*
rc = driveIoCtrlByKeywordWithRetry(tscb, KEY_IMMEDIATE_FLAG, 0, READ_FROM_DRIVE);
if (rc) {
ts_printf(__FILE__, __LINE__, "Error - write memory");
return 1;
}
*/
tscb->bSectorBuffer[0] = 0; /* 2010.12.07 add */
tscb->bSectorBuffer[0] |= IS_EMERGENCY_POWER_SHUTDOWN;
rc = driveIoCtrlByKeywordWithRetry(tscb, KEY_IMMEDIATE_FLAG, 0, WRITE_TO_DRIVE);
if (rc) {
ts_printf(__FILE__, __LINE__, "Warning - unload command failure -> no way, ignore");
} else {
ts_sleep_slumber(SLEEP_TIME_AFTER_DRIVE_UNLOAD_SEC);
}
return rc;
}