Bug fixes, whitespace cleanup, deleted binaries.
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 10 KiB |
@ -17,38 +17,38 @@ void dev_info( int id );
|
||||
void show_spares( int id );
|
||||
|
||||
void main() {
|
||||
SIOUXSettings.autocloseonquit = TRUE;
|
||||
SIOUXSettings.autocloseonquit = TRUE;
|
||||
SIOUXSettings.asktosaveonclose = FALSE;
|
||||
SIOUXSettings.standalone = FALSE;
|
||||
|
||||
|
||||
printf( "SCSI and Iomega Zip/Jaz Toolkit V0.1\n" );
|
||||
printf( "(c) 2021 Marcio Teixeira\n\n" );
|
||||
printf( "TIP based on source code provided by Steve Gibson (http://grc.com)\n" );
|
||||
|
||||
|
||||
SIOUXSetTitle("\pCommand Console");
|
||||
|
||||
|
||||
print_help();
|
||||
|
||||
do {
|
||||
EventRecord event;
|
||||
if (WaitNextEvent(everyEvent, &event, GetCaretTime(), NULL))
|
||||
SIOUXHandleOneEvent(&event);
|
||||
|
||||
} while (process_command());
|
||||
|
||||
|
||||
do {
|
||||
EventRecord event;
|
||||
if (WaitNextEvent(everyEvent, &event, GetCaretTime(), NULL))
|
||||
SIOUXHandleOneEvent(&event);
|
||||
|
||||
} while (process_command());
|
||||
|
||||
printf( "Goodbye.\n" );
|
||||
}
|
||||
|
||||
bool process_command() {
|
||||
short int arg_val = 0;
|
||||
short int arg_val = 0;
|
||||
char cmd[80];
|
||||
printf( "\n> " );
|
||||
gets( cmd );
|
||||
printf("\n");
|
||||
|
||||
|
||||
char *arg_str = strchr(cmd, ' ');
|
||||
if(arg_str) arg_val = atoi(arg_str);
|
||||
|
||||
|
||||
switch( tolower(cmd[0]) ) {
|
||||
case 'h': print_help(); break;
|
||||
case 'l': scan_bus(); break;
|
||||
@ -58,38 +58,38 @@ bool process_command() {
|
||||
case 'i': dev_info(arg_val); break;
|
||||
case 'v': mac_list_volumes(); break;
|
||||
case 'u': mac_unmount(arg_val); break;
|
||||
case 't': run_tip(); break;
|
||||
case 't': run_tip(arg_val); break;
|
||||
case 'q': return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void print_help() {
|
||||
printf(
|
||||
"\nGeneral commands:\n"
|
||||
" help : print this help\n"
|
||||
" quit : quit the program\n"
|
||||
|
||||
"\nMacintosh commands (please unmount Zip prior to testing):\n"
|
||||
" volumes : list Mac volumes\n"
|
||||
" unmount [n] : unmount a volume\n"
|
||||
printf(
|
||||
"\nGeneral commands:\n"
|
||||
" help : print this help\n"
|
||||
" quit : quit the program\n"
|
||||
|
||||
"\nGeneral SCSI operations:\n"
|
||||
" reset : reset the SCSI bus\n"
|
||||
" list : list devices on the SCSI bus\n"
|
||||
" info [n] : display SCSI inquiry\n"
|
||||
|
||||
"\nIomega device operations on SCSI device:\n"
|
||||
" spin [n] : spin up a cartridge\n"
|
||||
" eject [n] : eject cartridge\n"
|
||||
" tip [n] : run Steve Gibson's TIP 2.1\n"
|
||||
);
|
||||
"\nMacintosh commands (please unmount Zip prior to testing):\n"
|
||||
" volumes : list Mac volumes\n"
|
||||
" unmount [n] : unmount a volume\n"
|
||||
|
||||
"\nGeneral SCSI operations:\n"
|
||||
" reset : reset the SCSI bus\n"
|
||||
" list : list devices on the SCSI bus\n"
|
||||
" info [n] : display SCSI inquiry\n"
|
||||
|
||||
"\nIomega device operations on SCSI device:\n"
|
||||
" spin [n] : spin up a cartridge\n"
|
||||
" eject [n] : eject cartridge\n"
|
||||
" tip [n] : run Steve Gibson's TIP 2.1\n"
|
||||
);
|
||||
}
|
||||
|
||||
void scan_bus() {
|
||||
short err, id;
|
||||
scsi_inq_reply reply;
|
||||
|
||||
|
||||
for( id=0; id<8; id++ ) {
|
||||
err = scsi_inquiry( id, 0, &reply);
|
||||
if( err != 0 ) {
|
||||
@ -109,7 +109,7 @@ void scan_bus() {
|
||||
void dev_info( int id ) {
|
||||
short err, lun;
|
||||
scsi_inq_reply reply;
|
||||
|
||||
|
||||
for( lun = 0; lun < 8; lun++ ) {
|
||||
err = scsi_inquiry( id, lun, &reply);
|
||||
if( err ) {
|
||||
@ -123,7 +123,7 @@ void dev_info( int id ) {
|
||||
case 0x01: printf( "not connected\n" ); continue;
|
||||
case 0x03: printf( "not supported\n" ); continue;
|
||||
}
|
||||
|
||||
|
||||
printf( " Device class (%02X): ", reply.inf1 & 0x1F );
|
||||
switch( reply.inf1 & 0x1F ) {
|
||||
case 0x00: printf( "Disk drive\n" ); break;
|
||||
@ -139,7 +139,7 @@ void dev_info( int id ) {
|
||||
case 0x1F: printf( "Unknown device\n" ); break;
|
||||
default: printf( "Reserved\n" );
|
||||
}
|
||||
|
||||
|
||||
printf( " ANSI version (%02X): ", reply.vers & 0x07 );
|
||||
switch( reply.vers & 0x07 ) {
|
||||
case 0x00: printf( "SCSI-1\n" ); break;
|
||||
@ -149,7 +149,7 @@ void dev_info( int id ) {
|
||||
}
|
||||
printf( " ISO version (%02X)\n", reply.vers & 0xC0 >> 6 );
|
||||
printf( " ECMA version (%02X)\n", reply.vers & 0x78 >> 3 );
|
||||
|
||||
|
||||
printf( " Flags: " );
|
||||
if( reply.flg1 & 0x80 ) printf( "rmb " );
|
||||
if( reply.flg2 & 0x80 ) printf( "rel " );
|
||||
|
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 410 B |
@ -5,34 +5,34 @@
|
||||
void mac_list_volumes() {
|
||||
HParamBlockRec paramBlock;
|
||||
Str255 volName;
|
||||
|
||||
|
||||
paramBlock.volumeParam.ioCompletion = 0;
|
||||
paramBlock.volumeParam.ioNamePtr = volName;
|
||||
paramBlock.volumeParam.ioVRefNum = 0;
|
||||
paramBlock.volumeParam.ioVolIndex = 0;
|
||||
for (;;) {
|
||||
OSErr err = PBHGetVInfo(¶mBlock, false);
|
||||
if (err == nsvErr) break;
|
||||
printf(" %d: %#s\n", paramBlock.volumeParam.ioVolIndex, paramBlock.volumeParam.ioNamePtr);
|
||||
paramBlock.volumeParam.ioVolIndex++;
|
||||
}
|
||||
OSErr err = PBHGetVInfo(¶mBlock, false);
|
||||
if (err == nsvErr) break;
|
||||
printf(" %d: %#s\n", paramBlock.volumeParam.ioVolIndex, paramBlock.volumeParam.ioNamePtr);
|
||||
paramBlock.volumeParam.ioVolIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
void mac_unmount(int id) {
|
||||
HParamBlockRec paramBlock;
|
||||
HParamBlockRec paramBlock;
|
||||
paramBlock.volumeParam.ioCompletion = 0;
|
||||
paramBlock.volumeParam.ioNamePtr = 0;
|
||||
paramBlock.volumeParam.ioVRefNum = 0;
|
||||
paramBlock.volumeParam.ioVolIndex = id;
|
||||
OSErr err = PBHGetVInfo(¶mBlock, false);
|
||||
if (err == nsvErr) {
|
||||
printf("No such volume\n");
|
||||
return;
|
||||
}
|
||||
err = UnmountVol(0, paramBlock.volumeParam.ioVRefNum);
|
||||
switch (err) {
|
||||
case noErr: printf("Okay\n"); break;
|
||||
case fBsyErr: printf("One or more files are open\n"); break;
|
||||
default: printf("Failed %d\n", err);
|
||||
}
|
||||
if (err == nsvErr) {
|
||||
printf("No such volume\n");
|
||||
return;
|
||||
}
|
||||
err = UnmountVol(0, paramBlock.volumeParam.ioVRefNum);
|
||||
switch (err) {
|
||||
case noErr: printf("Okay\n"); break;
|
||||
case fBsyErr: printf("One or more files are open\n"); break;
|
||||
default: printf("Failed %d\n", err);
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 410 B |
@ -7,7 +7,7 @@ OSErr iomega_spin_up_cartridge( int id ) {
|
||||
// issue an Asynchronous START command to induce spinup
|
||||
char cmd[6] = {
|
||||
SCSI_Cmd_StartStopUnit,
|
||||
1, // set the IMMED bit for offline
|
||||
1, // set the IMMED bit for offline
|
||||
0,
|
||||
0,
|
||||
1, // start the disk spinning
|
||||
@ -20,7 +20,7 @@ OSErr iomega_spin_down_and_eject( int id ) {
|
||||
// issue an Asynchronous STOP command to induce spindown and ejection
|
||||
char cmd[6] = {
|
||||
SCSI_Cmd_StartStopUnit,
|
||||
1, // set the IMMED bit for offline
|
||||
1, // set the IMMED bit for offline
|
||||
0,
|
||||
0,
|
||||
2, // eject a Jaz disk after stopping
|
||||
@ -33,7 +33,7 @@ OSErr iomega_set_prevent_removal( int id, bool lock) {
|
||||
OSErr err;
|
||||
char cmd[6] = {
|
||||
SCSI_Cmd_PreventAllow,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
lock ? 1 : 0,
|
||||
@ -43,7 +43,7 @@ OSErr iomega_set_prevent_removal( int id, bool lock) {
|
||||
}
|
||||
|
||||
OSErr iomega_eject_cartridge( int id ) {
|
||||
OSErr err;
|
||||
OSErr err;
|
||||
err = iomega_set_prevent_removal(id, false);
|
||||
if (err != noErr) return err;
|
||||
return iomega_spin_down_and_eject(id);
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define READ_TIMEOUT 300 /* 300 ticks = 5 seconds */
|
||||
#define READ_TIMEOUT 60 /* 300 ticks = 5 seconds */
|
||||
|
||||
OSErr scsi_reset() {
|
||||
return SCSIReset();
|
||||
@ -14,9 +14,9 @@ OSErr scsi_reset() {
|
||||
OSErr scsi_cmd(int id, void *cmd, size_t clen, void *buff, size_t siz, size_t cnt, int flags, char *status) {
|
||||
SCSIInstr TIB[3]; /* Transfer instruction block */
|
||||
OSErr err;
|
||||
|
||||
|
||||
/* Set up the TIB (used by Macintosh SCSI Manager) */
|
||||
|
||||
|
||||
if( cnt != 0 ) {
|
||||
/* Transfer cnt continguous blocks of size siz, one at a time. */
|
||||
/* Use this sort of transfer when doing blind transfers to a */
|
||||
@ -34,7 +34,7 @@ OSErr scsi_cmd(int id, void *cmd, size_t clen, void *buff, size_t siz, size_t cn
|
||||
TIB[2].scParam2 = 0;
|
||||
} else {
|
||||
/* Transfer siz bytes in one fell swoop. */
|
||||
|
||||
//printf("CMD: %x SCSI Siz %ld\n", int(*((char*)cmd)), siz);
|
||||
TIB[0].scOpcode = scInc;
|
||||
TIB[0].scParam1 = (long) buff;
|
||||
TIB[0].scParam2 = siz;
|
||||
@ -42,36 +42,37 @@ OSErr scsi_cmd(int id, void *cmd, size_t clen, void *buff, size_t siz, size_t cn
|
||||
TIB[1].scParam1 = 0;
|
||||
TIB[1].scParam2 = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Arbitrate for the bus and select the device. */
|
||||
err = SCSIGet();
|
||||
if (err != noErr) {printf("SCSIGet Error: %d\n", err); return err;}
|
||||
|
||||
|
||||
err = SCSISelect(id);
|
||||
if (err != noErr) {/*printf("SCSISelect Error: %d\n", err);*/ return err;}
|
||||
|
||||
if (err != noErr) {printf("SCSISelect Error: %d\n", err); return err;}
|
||||
|
||||
/* Send the command to the SCSI device and perform the requested I/O */
|
||||
err = SCSICmd( (Ptr) cmd, clen );
|
||||
if (err == noErr) {
|
||||
OSErr io_err;
|
||||
switch(flags) {
|
||||
case SCSI_WRITE | SCSI_BLIND: err = SCSIWBlind( (Ptr) TIB ); break;
|
||||
case SCSI_READ | SCSI_BLIND: err = SCSIRBlind( (Ptr) TIB ); break;
|
||||
case SCSI_WRITE: err = SCSIWrite( (Ptr) TIB ); break;
|
||||
case SCSI_READ: err = SCSIRead( (Ptr) TIB ); break;
|
||||
case SCSI_WRITE | SCSI_BLIND: io_err = SCSIWBlind( (Ptr) TIB ); break;
|
||||
case SCSI_READ | SCSI_BLIND: io_err = SCSIRBlind( (Ptr) TIB ); break;
|
||||
case SCSI_WRITE: io_err = SCSIWrite( (Ptr) TIB ); break;
|
||||
case SCSI_READ: io_err = SCSIRead( (Ptr) TIB ); break;
|
||||
default: break;
|
||||
}
|
||||
if (err != noErr) {
|
||||
printf("SCSI Read/Write Error: %d\n", err);
|
||||
if (io_err != noErr) {
|
||||
printf("SCSI Read/Write Error: %d\n", io_err);
|
||||
}
|
||||
} else {
|
||||
printf("SCSICmd Error: %d", err);
|
||||
printf("SCSICmd Error: %d\n", err);
|
||||
}
|
||||
|
||||
/* Complete the transaction and release the bus */
|
||||
short cstat, cmsg;
|
||||
OSErr comperr = SCSIComplete( &cstat, &cmsg, READ_TIMEOUT );
|
||||
if (comperr != noErr) {printf("SCSIComplete Error: %d\n", err); return err;}
|
||||
if(status) *status = cstat;
|
||||
if (comperr != noErr) {printf("SCSIComplete Error: %d (status: %d)\n", err, cstat); return err;}
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -79,12 +80,12 @@ OSErr scsi_cmd(int id, void *cmd, size_t clen, void *buff, size_t siz, size_t cn
|
||||
OSErr scsi_inquiry(int id, int lun, scsi_inq_reply *reply) {
|
||||
short err;
|
||||
unsigned char cmd[6] = { SCSI_Cmd_Inquiry, lun << 5, 0x00, 0x00, 0x05, 0x00 };
|
||||
|
||||
|
||||
memset(reply, 0, sizeof(scsi_inq_reply));
|
||||
|
||||
|
||||
/* First we issue a dummy command to get the additional data field, then */
|
||||
/* we use that number to issue a second command with the corrected length. */
|
||||
|
||||
|
||||
if( (err = scsi_cmd(id, cmd, sizeof(cmd), reply, cmd[4], 0, SCSI_READ)) != noErr) {
|
||||
return err;
|
||||
}
|
||||
@ -93,18 +94,7 @@ OSErr scsi_inquiry(int id, int lun, scsi_inq_reply *reply) {
|
||||
}
|
||||
|
||||
OSErr scsi_request_sense_data(int id, scsi_sense_reply *reply) {
|
||||
short err;
|
||||
unsigned char cmd[6] = { SCSI_Cmd_RequestSense, 0x00, 0x00, 0x00, 0x08, 0x00 };
|
||||
|
||||
memset(reply, 0, sizeof(scsi_sense_reply));
|
||||
|
||||
/* First we issue a dummy command to get the additional data field, then */
|
||||
/* we use that number to issue a second command with the corrected length. */
|
||||
|
||||
if( (err = scsi_cmd(id, cmd, sizeof(cmd), reply, cmd[4], 0, SCSI_READ)) != noErr) {
|
||||
return err;
|
||||
}
|
||||
cmd[4] += reply->alen;
|
||||
unsigned char cmd[6] = {SCSI_Cmd_RequestSense, 0x00, 0x00, 0x00, sizeof(scsi_sense_reply), 0x00};
|
||||
return scsi_cmd(id, cmd, sizeof(cmd), reply, cmd[4], 0, SCSI_READ);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ typedef Boolean bool;
|
||||
|
||||
enum {
|
||||
SCSI_Cmd_RequestSense = 0x03,
|
||||
SCSI_Cmd_FormatUnit = 0x04,
|
||||
SCSI_Cmd_FormatUnit = 0x04,
|
||||
SCSI_Cmd_NonSenseData = 0x06,
|
||||
SCSI_Cmd_Read = 0x08,
|
||||
SCSI_Cmd_Write = 0x0a,
|
||||
|
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 410 B |
@ -8,7 +8,7 @@
|
||||
|
||||
#include "tip.h"
|
||||
|
||||
// ----------------------- Test Monitor Panel Definitions -------------------
|
||||
// ----------------------- Test Monitor Panel Definitions -------------------
|
||||
#define SET_RECT(LEFT, TOP, RIGHT, BOTTOM) {TOP, LEFT, BOTTOM, RIGHT}
|
||||
|
||||
Rect CS_Stat = SET_RECT(114, 8, 242, 28);
|
||||
@ -25,72 +25,72 @@ Rect SE_Rect = SET_RECT(222, 154, 255, 221);
|
||||
* This is the system's main window procedure
|
||||
*/
|
||||
void WndProc(long iMessage, long wParam) {
|
||||
// -------------------------------------------------------------------------
|
||||
// WM_PAINT
|
||||
// -------------------------------------------------------------------------
|
||||
if (iMessage == WM_PAINT) {
|
||||
// Draw the Lower Horz Button Divider
|
||||
// -------------------------------------------------------------------------
|
||||
// WM_PAINT
|
||||
// -------------------------------------------------------------------------
|
||||
if (iMessage == WM_PAINT) {
|
||||
// Draw the Lower Horz Button Divider
|
||||
|
||||
SetColor(GRAY_COLOR);
|
||||
MoveTo(15, 289);
|
||||
LineTo(446, 289);
|
||||
SetColor(WHITE_COLOR);
|
||||
LineTo(446, 290);
|
||||
LineTo(14, 290);
|
||||
SetColor(GRAY_COLOR);
|
||||
MoveTo(15, 289);
|
||||
LineTo(446, 289);
|
||||
SetColor(WHITE_COLOR);
|
||||
LineTo(446, 290);
|
||||
LineTo(14, 290);
|
||||
|
||||
// Paint the Copyright Notice
|
||||
SetColor(GRAY_COLOR);
|
||||
TextOut(15, 298, szCopyright_1);
|
||||
TextOut(15, 311, szCopyright_2);
|
||||
// Paint the Copyright Notice
|
||||
SetColor(GRAY_COLOR);
|
||||
TextOut(15, 298, szCopyright_1);
|
||||
TextOut(15, 311, szCopyright_2);
|
||||
}
|
||||
// -------------------------------------------------------------------------
|
||||
// WM_COMMAND : a button was pressed
|
||||
// -------------------------------------------------------------------------
|
||||
else if (iMessage == WM_COMMAND) {
|
||||
switch(wParam) {
|
||||
case IDB_QUIT:
|
||||
if (TestingPhase < TESTING_STARTUP) {
|
||||
PostQuitMessage();
|
||||
}
|
||||
break;
|
||||
case IDB_TEST:
|
||||
switch(CartridgeStatus) {
|
||||
case DISK_SPUN_DOWN:
|
||||
SpinUpIomegaCartridge(CurrentDevice);
|
||||
break;
|
||||
case DISK_AT_SPEED:
|
||||
printf("Testing the disk\n");
|
||||
if(TestingPhase != READY_TO_TEST) {
|
||||
PrepareToBeginTesting();
|
||||
}
|
||||
TestTheDisk();
|
||||
printf("Test finished\n");
|
||||
break;
|
||||
case DISK_TEST_UNDERWAY:
|
||||
UserInterrupt = 1;
|
||||
break;
|
||||
case DISK_Z_TRACK_FAILURE:
|
||||
case DISK_TEST_FAILURE:
|
||||
case DISK_PROTECTED:
|
||||
//EjectIomegaCartridge();
|
||||
break;
|
||||
case DISK_LOW_SPARES:
|
||||
PrepareToBeginTesting();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// -------------------------------------------------------------------------
|
||||
// WM_COMMAND : a button was pressed
|
||||
// -------------------------------------------------------------------------
|
||||
else if (iMessage == WM_COMMAND) {
|
||||
switch(wParam) {
|
||||
case IDB_QUIT:
|
||||
if (TestingPhase < TESTING_STARTUP) {
|
||||
PostQuitMessage();
|
||||
}
|
||||
break;
|
||||
case IDB_TEST:
|
||||
switch(CartridgeStatus) {
|
||||
case DISK_SPUN_DOWN:
|
||||
SpinUpIomegaCartridge(CurrentDevice);
|
||||
break;
|
||||
case DISK_AT_SPEED:
|
||||
printf("Testing the disk\n");
|
||||
if(TestingPhase != READY_TO_TEST) {
|
||||
PrepareToBeginTesting();
|
||||
}
|
||||
TestTheDisk();
|
||||
printf("Test finished\n");
|
||||
break;
|
||||
case DISK_TEST_UNDERWAY:
|
||||
UserInterrupt = 1;
|
||||
break;
|
||||
case DISK_Z_TRACK_FAILURE:
|
||||
case DISK_TEST_FAILURE:
|
||||
case DISK_PROTECTED:
|
||||
//EjectIomegaCartridge();
|
||||
break;
|
||||
case DISK_LOW_SPARES:
|
||||
PrepareToBeginTesting();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BtnList tipBtns[] = {
|
||||
{IDB_TEST, szPressToStart, 200, 301, 160, 24, true}, // Added by MLT
|
||||
{IDB_BACK, szBack, 185-28, 301, 80, 24, false},
|
||||
{IDB_NEXT, szNext, 264-28, 301, 80, 24, false},
|
||||
{IDB_QUIT, szQuit, 367+35, 301, 45, 24, true},
|
||||
{0, 0, 0, 0, 0, 0, 0}
|
||||
{IDB_TEST, szPressToStart, 200, 301, 160, 24, true}, // Added by MLT
|
||||
{IDB_BACK, szBack, 185-28, 301, 80, 24, false},
|
||||
{IDB_NEXT, szNext, 264-28, 301, 80, 24, false},
|
||||
{IDB_QUIT, szQuit, 367+35, 301, 45, 24, true},
|
||||
{0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
@ -155,7 +155,7 @@ void PaintCartStatus() {
|
||||
* PAINT BAR GRAPH
|
||||
*******************************************************************************/
|
||||
void PaintBarGraph(int Xleft, int Ytop, int XWidth, int YHeight, long BarColor, long BarValue, char *pRightText, bool Active) {
|
||||
// fill the entire rectangle with background gray
|
||||
// fill the entire rectangle with background gray
|
||||
SetColor(BACK_COLOR);
|
||||
Rectangle(Xleft, Ytop, Xleft + XWidth, Ytop + YHeight);
|
||||
if (Active) { // now fleshout the bar ONLY IF we're active
|
||||
@ -170,11 +170,11 @@ void PaintBarGraph(int Xleft, int Ytop, int XWidth, int YHeight, long BarColor,
|
||||
Rectangle(Xleft, Ytop, Xleft + AbsoluteBarWidth, Ytop + YHeight);
|
||||
// now place the floating percentage into the middle (if it fits there)
|
||||
if(BarValue) {
|
||||
char PercentString[8];
|
||||
sprintf(PercentString, szBarChartPercent, BarValue);
|
||||
SetColor(WHITE_COLOR);
|
||||
TextOutCentered(Xleft, Ytop, AbsoluteBarWidth, YHeight, PercentString);
|
||||
|
||||
char PercentString[8];
|
||||
sprintf(PercentString, szBarChartPercent, BarValue);
|
||||
SetColor(WHITE_COLOR);
|
||||
TextOutCentered(Xleft, Ytop, AbsoluteBarWidth, YHeight, PercentString);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -193,17 +193,21 @@ void PaintTheBarGraphs(bool Active) {
|
||||
if(ebx > ecx) { // if Spares > MAXIMUM
|
||||
ebx = ecx; // clip Spares down to MAX
|
||||
}
|
||||
PaintBarGraph(13, 95, 395, 30, RED_COLOR, ebx*100/ecx, NULL, Active);
|
||||
PaintBarGraph(13, 95, 395, 30, RED_COLOR, CvrtIntoPrcnt(ebx, ecx), NULL, Active);
|
||||
} else {
|
||||
ebx = Side_0_SparesCount;
|
||||
ecx = MAXIMUM_ZIP_SPARES;
|
||||
PaintBarGraph(13, 95, 395, 14, RED_COLOR, ebx*100/ecx, "Side 0", Active);
|
||||
PaintBarGraph(13, 95, 395, 14, RED_COLOR, CvrtIntoPrcnt(ebx, ecx), "Side 0", Active);
|
||||
ebx = Side_1_SparesCount;
|
||||
ecx = MAXIMUM_ZIP_SPARES;
|
||||
PaintBarGraph(13, 111, 395, 14, RED_COLOR, ebx*100/ecx, "Side 1", Active);
|
||||
PaintBarGraph(13, 111, 395, 14, RED_COLOR, CvrtIntoPrcnt(ebx, ecx), "Side 1", Active);
|
||||
}
|
||||
}
|
||||
|
||||
int CvrtIntoPrcnt(long val, long max) {
|
||||
return 100 - val*100/max;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* PAINT CENTERED STRING
|
||||
*
|
||||
@ -251,7 +255,7 @@ void PaintTestStatistics(bool Active) {
|
||||
}
|
||||
sprintf(szString, szCenteredDecimal, eax);
|
||||
strcat(szString, szSpaceDashSpace);
|
||||
eax = FirstLBASector + NumberOfLBAs;
|
||||
eax = FirstLBASector + NumberOfLBAs - 1;
|
||||
if (TestingPhase == READY_TO_TEST) {
|
||||
eax = LastLBAOnCartridge;
|
||||
}
|
||||
@ -262,8 +266,8 @@ void PaintTestStatistics(bool Active) {
|
||||
// show the LastError
|
||||
char *errStr = 0;
|
||||
for (int i = 0; errorTypeList[i].str; i++) {
|
||||
errStr = errorTypeList[i].str;
|
||||
if (errorTypeList[i].code == LastError) break;
|
||||
errStr = errorTypeList[i].str;
|
||||
if (errorTypeList[i].code == LastError) break;
|
||||
}
|
||||
PaintCenteredString(76, 172, 126, 14, errStr, Active);
|
||||
|
||||
@ -345,12 +349,12 @@ void TestMonitorWndProc() {
|
||||
*******************************************************************************/
|
||||
|
||||
void UpdateRunTimeDisplay() {
|
||||
GetDC(hTestMonitor);
|
||||
PaintTestPhase();
|
||||
PaintTheBarGraphs(true);
|
||||
PaintTestStatistics(true);
|
||||
PaintCartStatus();// Added by MLT
|
||||
ReleaseDC(hTestMonitor);
|
||||
GetDC(hTestMonitor);
|
||||
PaintTestPhase();
|
||||
PaintTheBarGraphs(true);
|
||||
PaintTestStatistics(true);
|
||||
PaintCartStatus();// Added by MLT
|
||||
ReleaseDC(hTestMonitor);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -358,11 +362,11 @@ void UpdateRunTimeDisplay() {
|
||||
*******************************************************************************/
|
||||
|
||||
void UpdateCurrentSector() {
|
||||
GetDC(hTestMonitor);
|
||||
char szString[40];
|
||||
sprintf(szString, szCenteredDecimal, SingleTransferLBA);
|
||||
PaintCenteredString(76, 155, 126, 14, szString, true);
|
||||
ReleaseDC(hTestMonitor);
|
||||
GetDC(hTestMonitor);
|
||||
char szString[40];
|
||||
sprintf(szString, szCenteredDecimal, SingleTransferLBA);
|
||||
PaintCenteredString(76, 155, 126, 14, szString, true);
|
||||
ReleaseDC(hTestMonitor);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -370,9 +374,9 @@ void UpdateCurrentSector() {
|
||||
*******************************************************************************/
|
||||
|
||||
void UpdateRunPhaseDisplay() {
|
||||
GetDC(hTestMonitor);
|
||||
PaintTestPhase();
|
||||
ReleaseDC(hTestMonitor);
|
||||
GetDC(hTestMonitor);
|
||||
PaintTestPhase();
|
||||
ReleaseDC(hTestMonitor);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -380,4 +384,5 @@ void UpdateRunPhaseDisplay() {
|
||||
*******************************************************************************/
|
||||
|
||||
void ErrorSound() {
|
||||
SysBeep(10);
|
||||
}
|
@ -3,7 +3,7 @@ typedef Boolean bool;
|
||||
|
||||
extern WindowPtr tipWindow;
|
||||
|
||||
void run_tip();
|
||||
void run_tip(int id);
|
||||
|
||||
#define MINIMUM_JAZ_SPARES 500
|
||||
#define MAXIMUM_JAZ_SPARES 2557
|
||||
@ -70,13 +70,13 @@ unsigned long GetSystemTime();
|
||||
#define hMainWnd 0, 40
|
||||
|
||||
#define GetDC(h) {GrafPtr oldPort; \
|
||||
GetPort(&oldPort); \
|
||||
SetPort(tipWindow); \
|
||||
SetOrigin(h);
|
||||
|
||||
GetPort(&oldPort); \
|
||||
SetPort(tipWindow); \
|
||||
SetOrigin(h);
|
||||
|
||||
#define ReleaseDC(h) SetOrigin(0,0); \
|
||||
SetPort(oldPort);}
|
||||
|
||||
|
||||
|
||||
// ------------------------------ Cartridge Status -------------------------------
|
||||
|
||||
@ -162,9 +162,9 @@ extern const char *szBack;
|
||||
extern const char *szNext;
|
||||
extern const char *szQuit;
|
||||
|
||||
#define IDB_BACK 0xFF00
|
||||
#define IDB_NEXT 0xFF01
|
||||
#define IDB_QUIT 0xFF02
|
||||
#define IDB_BACK 0xFF00
|
||||
#define IDB_NEXT 0xFF01
|
||||
#define IDB_QUIT 0xFF02
|
||||
#define IDB_TEST 0xFF03
|
||||
|
||||
typedef struct {long id; const char *name; int x; int y; int w; int h; bool visible;} BtnList;
|
||||
@ -180,6 +180,7 @@ void SunkenFields(Rect *pFirstRect, long count, long yspacing);
|
||||
void PaintCartStatus();
|
||||
void PaintTextArray(TextList *list, long color);
|
||||
void PaintBarGraph(int Xleft, int Ytop, int XWidth, int YHeight, long BarColor, long BarValue, char *pRightText, bool Active);
|
||||
int CvrtIntoPrcnt(long val, long max);
|
||||
void PaintTestPhase();
|
||||
void PaintTheBarGraphs(bool Active);
|
||||
void PaintTestStatistics(bool Active);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "tip.h"
|
||||
|
||||
//#define DEMO
|
||||
#define NO_EXCESS_READS
|
||||
|
||||
#define BYTE_AT(a) *((char*)&(a))
|
||||
#define WORD_AT(a) *((short*)&(a))
|
||||
@ -25,9 +26,9 @@
|
||||
#define JAZ_2GB_BOOT 0x0E00
|
||||
|
||||
struct DEFECT_LIST_HEADER {
|
||||
char DLH_reserved; // (00h)
|
||||
char DLH_BitFlags; // [000] [P] [G] [xxx - defect list format]
|
||||
char DLH_DefectListLength;
|
||||
char DLH_reserved; // (00h)
|
||||
char DLH_BitFlags; // [000] [P] [G] [xxx - defect list format]
|
||||
short DLH_DefectListLength;
|
||||
};
|
||||
|
||||
//-------------------------- Drive Array Status Flags ---------------------------
|
||||
@ -60,7 +61,7 @@ struct DEFECT_LIST_HEADER {
|
||||
#define DRIVE_A_SUPPORT_BIAS 32 // reduce total by 32 for DRIVE A support
|
||||
|
||||
#define BYTES_PER_SECTOR 512
|
||||
#define MAX_SECTORS_PER_TEST 20
|
||||
#define MAX_SECTORS_PER_TEST 50
|
||||
|
||||
#define BADNESS_THRESHOLD 10
|
||||
|
||||
@ -170,23 +171,22 @@ long SCSICommand(short Device, char *lpCmdBlk, void *lpIoBuf, short IoBufLen) {
|
||||
// call the SCSI interface to forward the command to the device
|
||||
OSErr err = scsi_cmd(Device, lpCmdBlk, cmd_length, lpIoBuf, IoBufLen, 0, cmd_flags, &cmd_status);
|
||||
if(err != noErr) {
|
||||
return SS_ERR;
|
||||
return SS_ERR;
|
||||
}
|
||||
if(cmd_status == 0) {
|
||||
printf("SCSI OK\n");
|
||||
// if the command did not generate any Sense Data, just return NULL
|
||||
return 0;
|
||||
}
|
||||
else if(cmd_status == 2) { // Check Condition
|
||||
printf("SCSI CHK CONDITION\n");
|
||||
// Request sense data
|
||||
scsi_sense_reply sense_data;
|
||||
scsi_request_sense_data(Device, &sense_data);
|
||||
printf("SCSI CHECK CONDITION (KEY %x, ASC %x, ASCQ %x)\n", sense_data.key, sense_data.asc, sense_data.ascq);
|
||||
// okay, we have an SS_ERR condition, let's check the SENSE DATA
|
||||
// assemble [00 ASC ASCQ SenseKey]
|
||||
return (sense_data.asc << 16) ||
|
||||
(sense_data.ascq << 8) ||
|
||||
sense_data.key;
|
||||
return (long(sense_data.asc) << 16) |
|
||||
(long(sense_data.ascq) << 8) |
|
||||
(long(sense_data.key) );
|
||||
}
|
||||
else {
|
||||
// else, if it's *NOT* a "Sense Data" error (SS_ERR)
|
||||
@ -209,9 +209,13 @@ long GetModePage(short Device, short PageToGet, void *pBuffer, short BufLen) {
|
||||
* SET MODE PAGE
|
||||
*******************************************************************************/
|
||||
long SetModePage(short Device, void *pBuffer) {
|
||||
char Scsi[6] = {0}; // init the SCSI parameter block
|
||||
char* ebx = (char*) pBuffer; // get a pointer to the top of buffer
|
||||
char ecx = ebx[0] + 1; // adjust it up by one
|
||||
|
||||
ebx[0] = 0; // now clear the two reserved bytes
|
||||
ebx[2] = 0;
|
||||
|
||||
char Scsi[6] = {0}; // init the SCSI parameter block
|
||||
Scsi[0] = SCSI_Cmd_ModeSelect; // set the command
|
||||
Scsi[1] = 0x10; // set the Page Format bit
|
||||
Scsi[4] = ecx; // set the parameter list length
|
||||
@ -237,7 +241,13 @@ void ModifyModePage(char *PageBuff, char ecc, char retries) {
|
||||
|
||||
void SetErrorRecovery(bool Retries, bool ECC, bool Testing) {
|
||||
char PageBuff[40];
|
||||
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, sizeof(PageBuff));
|
||||
|
||||
#ifdef NO_EXCESS_READS
|
||||
// Limit reads to 20 bytes to prevent controller errors
|
||||
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, 20);
|
||||
#else
|
||||
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, sizeof(PageBuff));
|
||||
#endif
|
||||
|
||||
#define EARLY_RECOVERY 0x08
|
||||
#define PER 0x04
|
||||
@ -260,7 +270,7 @@ void SetErrorRecovery(bool Retries, bool ECC, bool Testing) {
|
||||
retries = 0;
|
||||
|
||||
ModifyModePage(PageBuff, ecc, retries);
|
||||
long eax = SetModePage(CurrentDevice, PageBuff);
|
||||
const long eax = SetModePage(CurrentDevice, PageBuff);
|
||||
// if we had an invalid field in the CDB (the EER bit was on)
|
||||
if (eax == 0x00260005) {
|
||||
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, sizeof(PageBuff));
|
||||
@ -339,8 +349,13 @@ void GetSpareSectorCounts(bool) {
|
||||
// rather than 72; it looks like this code is causing a SCSI transfer error
|
||||
// here... might be better to conditionally check for Jaz drive
|
||||
char DiskStat[72];
|
||||
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, sizeof(DiskStat));
|
||||
if (!eax) /*goto ListChk;*/ return;
|
||||
#ifdef NO_EXCESS_READS
|
||||
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, 63);
|
||||
if (eax) return;
|
||||
#else
|
||||
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, sizeof(DiskStat));
|
||||
if (!eax) /*goto ListChk;*/ return;
|
||||
#endif
|
||||
// --------------------------------------------------------------------------
|
||||
ch = 0; // clear the DRIVE_A_SUPPORT
|
||||
if (JazDrive) {
|
||||
@ -378,6 +393,7 @@ void GetSpareSectorCounts(bool) {
|
||||
Side_0_SparesCount = eax;
|
||||
MAKE_LITTLE_ENDIAN(ebx); // make it little endian
|
||||
Side_1_SparesCount = ebx;
|
||||
|
||||
// compute the number of troubles we encountered during the testing
|
||||
FirmErrors = Initial_Side_0_Spares - Side_0_SparesCount;
|
||||
FirmErrors += Initial_Side_1_Spares - Side_1_SparesCount;
|
||||
@ -386,6 +402,7 @@ void GetSpareSectorCounts(bool) {
|
||||
CartridgeStatus = DISK_TEST_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
// MLT: The code for removing the ZIP protection has been omitted
|
||||
return; // return zero since no error
|
||||
}
|
||||
@ -423,16 +440,16 @@ void PrepareToBeginTesting() {
|
||||
HardErrors = 0;
|
||||
UserInterrupt = 0;
|
||||
LastError = 0;
|
||||
#ifdef DEMO
|
||||
LastLBAOnCartridge = 99999;
|
||||
SoftErrors = 6;
|
||||
FirmErrors = 2;
|
||||
HardErrors = 1;
|
||||
UserInterrupt = 0;
|
||||
LastError = 0x0C8001;
|
||||
Side_0_SparesCount = 12;
|
||||
Side_1_SparesCount = 20;
|
||||
#endif
|
||||
#ifdef DEMO
|
||||
LastLBAOnCartridge = 99999;
|
||||
SoftErrors = 6;
|
||||
FirmErrors = 2;
|
||||
HardErrors = 1;
|
||||
UserInterrupt = 0;
|
||||
LastError = 0x0C8001;
|
||||
Side_0_SparesCount = 12;
|
||||
Side_1_SparesCount = 20;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -462,20 +479,19 @@ void BumpErrorCounts(long ErrorCode) {
|
||||
* PERFORM REGION TRANSFER
|
||||
*******************************************************************************/
|
||||
long PerformRegionTransfer(short XferCmd, void *pBuffer) {
|
||||
return -1;
|
||||
char Scsi[10] = {0}; // clear out the SCSI CDB
|
||||
const long InitialHardErrors = HardErrors;
|
||||
|
||||
|
||||
SetErrorRecovery(false, false, true); // disable Retries & ECC
|
||||
|
||||
|
||||
Scsi[0] = XferCmd;
|
||||
DWORD_AT(Scsi[2]) = MAKE_BIG_ENDIAN(FirstLBASector); // WHICH LBA's to read, BIG endian
|
||||
WORD_AT(Scsi[7]) = MAKE_BIG_ENDIAN(NumberOfLBAs); // HOW MANY to read, BIG endian
|
||||
long eax = SCSICommand(CurrentDevice, Scsi, pBuffer, NumberOfLBAs * BYTES_PER_SECTOR);
|
||||
|
||||
return 1;
|
||||
// if we failed somewhere during our transfer ... let's zero in on it
|
||||
if (eax) {
|
||||
printf("Error during transfer %lx (lba: %ld)\n", eax, FirstLBASector);
|
||||
|
||||
if ( eax == SS_ERR || // if it's a CONTROLLER ERROR, skip!
|
||||
eax == BUFFER_TOO_BIG ||
|
||||
eax == LBA_TOO_LARGE) {
|
||||
@ -485,39 +501,39 @@ long PerformRegionTransfer(short XferCmd, void *pBuffer) {
|
||||
//--------------------------------------------------------------------------
|
||||
// Save error and current Soft + Hard Error count to see if we do FIND the glitch ...
|
||||
const long GlitchError = eax; // save the error which stopped us!
|
||||
const long GlitchCount = SoftErrors + HardErrors;
|
||||
const long GlitchCount = SoftErrors + HardErrors;
|
||||
char *LocalBuffer = (char*) pBuffer;
|
||||
ErrorSound();
|
||||
|
||||
SingleTransferLBA = FirstLBASector;
|
||||
|
||||
SingleTransferLBA = FirstLBASector;
|
||||
|
||||
// Perform transfer LBA block at a time
|
||||
for(long i = 0; i < NumberOfLBAs; ++i) {
|
||||
UpdateCurrentSector();
|
||||
|
||||
UpdateCurrentSector();
|
||||
|
||||
// setup for our series of transfer tests ...
|
||||
|
||||
|
||||
// disable all recovery techniques
|
||||
SetErrorRecovery(false, false, true); // disable Retries & ECC
|
||||
|
||||
|
||||
memset(Scsi, 0, sizeof(Scsi)); // clear out the SCSI CDB
|
||||
Scsi[0] = XferCmd;
|
||||
DWORD_AT(Scsi[2]) = MAKE_BIG_ENDIAN(SingleTransferLBA); // WHICH LBA to read, BIG endian
|
||||
WORD_AT(Scsi[7]) = MAKE_BIG_ENDIAN(1); // a single sector
|
||||
eax = SCSICommand(CurrentDevice, Scsi, LocalBuffer, BYTES_PER_SECTOR);
|
||||
|
||||
|
||||
if (eax) {
|
||||
// some sort of problem encountered!
|
||||
if (eax == SS_ERR) goto Exit; // if it's a CONTROLLER ERROR, skip!
|
||||
if (eax & 0xFF == 1) goto PostTheError; // did we recover?
|
||||
|
||||
if (eax & 0xFF == 1) goto PostTheError; // did we recover?
|
||||
|
||||
SetErrorRecovery(true, false, true); // enable retries
|
||||
eax = SCSICommand(CurrentDevice, Scsi, LocalBuffer, BYTES_PER_SECTOR);
|
||||
if (eax) {
|
||||
// failed with retries
|
||||
if (eax == SS_ERR) goto Exit; // if it's a CONTROLLER ERROR, skip!
|
||||
if (eax & 0xFF == 1) goto PostTheError; // did we recover?
|
||||
|
||||
|
||||
SetErrorRecovery(true, true, true); // enable retries AND EEC
|
||||
eax = SCSICommand(CurrentDevice, Scsi, LocalBuffer, BYTES_PER_SECTOR);
|
||||
if (eax) {
|
||||
@ -539,14 +555,14 @@ long PerformRegionTransfer(short XferCmd, void *pBuffer) {
|
||||
BumpErrorCounts(eax); // given eax, count the errors
|
||||
GetSpareSectorCounts(false); // update the Cart's Condition
|
||||
UpdateRunTimeDisplay();
|
||||
|
||||
LocalBuffer += BYTES_PER_SECTOR;
|
||||
SingleTransferLBA++;
|
||||
if(UserInterrupt) break;
|
||||
|
||||
if(UserInterrupt) break;
|
||||
}
|
||||
LocalBuffer += BYTES_PER_SECTOR;
|
||||
SingleTransferLBA++;
|
||||
ProcessPendingMessages();
|
||||
}
|
||||
|
||||
|
||||
// now see whether we *did* found something to complain about ...
|
||||
eax = SoftErrors + HardErrors;
|
||||
if (eax == GlitchCount) {
|
||||
@ -582,34 +598,37 @@ long TestTheDisk() {
|
||||
void *pPatternBuffer = malloc(MAX_SECTORS_PER_TEST * BYTES_PER_SECTOR);
|
||||
void *pUserDataBuffer = malloc(MAX_SECTORS_PER_TEST * BYTES_PER_SECTOR);
|
||||
|
||||
if(pPatternBuffer == NULL || pUserDataBuffer == NULL) {
|
||||
printf("Allocation error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(pPatternBuffer == NULL || pUserDataBuffer == NULL) {
|
||||
printf("Allocation error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
CartridgeStatus = DISK_TEST_UNDERWAY;
|
||||
TestingPhase = TESTING_STARTUP; // inhibit stopping now
|
||||
SetButtonText(szPressToStop);
|
||||
|
||||
|
||||
LockCurrentDrive(); // prevent media removal
|
||||
|
||||
GetSpareSectorCounts(false); // update the Cart's Condition
|
||||
UpdateRunTimeDisplay();
|
||||
|
||||
// Standard Testing Operation
|
||||
StartingInstant = GetSystemTime();
|
||||
|
||||
|
||||
do {
|
||||
ProcessPendingMessages();
|
||||
|
||||
NumberOfLBAs = MAX_SECTORS_PER_TEST;
|
||||
|
||||
if(LastLBAOnCartridge) {
|
||||
if (FirstLBASector + NumberOfLBAs > LastLBAOnCartridge + 1) {
|
||||
NumberOfLBAs = LastLBAOnCartridge - FirstLBASector + 1;
|
||||
}
|
||||
// compute the percentage complete
|
||||
PercentComplete = FirstLBASector * 100 / LastLBAOnCartridge;
|
||||
}
|
||||
|
||||
if(NumberOfLBAs == 0) break;
|
||||
ProcessPendingMessages();
|
||||
|
||||
NumberOfLBAs = MAX_SECTORS_PER_TEST;
|
||||
|
||||
if(LastLBAOnCartridge) {
|
||||
if (FirstLBASector + NumberOfLBAs > LastLBAOnCartridge + 1) {
|
||||
NumberOfLBAs = LastLBAOnCartridge - FirstLBASector + 1;
|
||||
}
|
||||
// compute the percentage complete
|
||||
PercentComplete = FirstLBASector * 100 / LastLBAOnCartridge;
|
||||
}
|
||||
|
||||
if(NumberOfLBAs == 0) break;
|
||||
|
||||
// uppdate the elapsed time
|
||||
SecondsElapsed = GetElapsedTimeInSeconds();
|
||||
@ -617,17 +636,17 @@ long TestTheDisk() {
|
||||
// get a random pattern of data to write
|
||||
const long DataPattern = rand();
|
||||
memset(pPatternBuffer, DataPattern, sizeof(pPatternBuffer));
|
||||
|
||||
|
||||
// update the cartridge's status
|
||||
GetSpareSectorCounts(false); // update the Cart's Condition
|
||||
|
||||
TestingPhase = READING_DATA;
|
||||
|
||||
|
||||
UpdateRunTimeDisplay();
|
||||
|
||||
|
||||
long eax = PerformRegionTransfer(SCSI_Cmd_ReadMany, pUserDataBuffer);
|
||||
|
||||
if(eax == 0) {
|
||||
|
||||
/*if(eax == 0) {
|
||||
// -------------------------------
|
||||
TestingPhase = WRITING_PATT;
|
||||
UpdateRunPhaseDisplay();
|
||||
@ -646,17 +665,17 @@ long TestTheDisk() {
|
||||
goto GetOut;
|
||||
}
|
||||
if (CartridgeStatus != DISK_TEST_UNDERWAY) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}*/
|
||||
// bump the FirstLBASector up for the next transfer
|
||||
FirstLBASector += NumberOfLBAs;
|
||||
} while(!UserInterrupt);
|
||||
// show that we're post-test
|
||||
|
||||
GetOut:
|
||||
free(pPatternBuffer);
|
||||
free(pUserDataBuffer);
|
||||
|
||||
free(pPatternBuffer);
|
||||
free(pUserDataBuffer);
|
||||
|
||||
TestingPhase = UNTESTED;
|
||||
UnlockCurrentDrive();
|
||||
SetErrorRecovery(true, true, false); // reenable Retries & ECC
|
||||
|
@ -22,16 +22,17 @@ void DoUpdate(WindowPtr window);
|
||||
void DoMouseDown(EventRecord &event);
|
||||
void DoMouseMove(EventRecord &event, RgnHandle *cursorRegion);
|
||||
|
||||
void run_tip(void) {
|
||||
RgnHandle cursorRgn = NewRgn();
|
||||
|
||||
void run_tip(int id) {
|
||||
CurrentDevice = id;
|
||||
RgnHandle cursorRgn = NewRgn();
|
||||
|
||||
NewTipWindow();
|
||||
gDone = false;
|
||||
do {
|
||||
EventRecord event;
|
||||
if (WaitNextEvent(everyEvent, &event, GetCaretTime(), cursorRgn)) {
|
||||
DoEvent(event, &cursorRgn);
|
||||
}
|
||||
EventRecord event;
|
||||
if (WaitNextEvent(everyEvent, &event, GetCaretTime(), cursorRgn)) {
|
||||
DoEvent(event, &cursorRgn);
|
||||
}
|
||||
} while (!gDone);
|
||||
|
||||
DestroyTipWindow();
|
||||
@ -50,14 +51,14 @@ void NewTipWindow() {
|
||||
rect.bottom = rect.top + 336 - 35;
|
||||
rect.right = rect.left + 467;
|
||||
|
||||
Str255 title;
|
||||
StrToPascal(title, szWindowTitle);
|
||||
Str255 title;
|
||||
StrToPascal(title, szWindowTitle);
|
||||
tipWindow = AllowColor ?
|
||||
NewCWindow(NULL,&rect, title, true, 0, 0, true, 0) :
|
||||
NewWindow(NULL,&rect, title, true, 0, 0, true, 0);
|
||||
|
||||
GetDC(hMainWnd);
|
||||
|
||||
GetDC(hMainWnd);
|
||||
|
||||
if (AllowColor) {
|
||||
SetColor(BACK_COLOR);
|
||||
RGBColor bgColor;
|
||||
@ -65,24 +66,30 @@ void NewTipWindow() {
|
||||
RGBBackColor(&bgColor);
|
||||
}
|
||||
TextSize(10);
|
||||
|
||||
for(int i = 0; tipBtns[i].name; i++) {
|
||||
if (!tipBtns[i].visible) continue;
|
||||
SetRect(&rect,
|
||||
tipBtns[i].x,
|
||||
tipBtns[i].y,
|
||||
tipBtns[i].x + tipBtns[i].w,
|
||||
tipBtns[i].y + tipBtns[i].h
|
||||
);
|
||||
|
||||
StrToPascal(title, tipBtns[i].name);
|
||||
ControlHandle h = NewControl(tipWindow, &rect, title, true, 0, 0, 0, 0, tipBtns[i].id);
|
||||
if(tipBtns[i].id == IDB_TEST) {
|
||||
actionBtn = h;
|
||||
}
|
||||
|
||||
for(int i = 0; tipBtns[i].name; i++) {
|
||||
if (!tipBtns[i].visible) continue;
|
||||
SetRect(&rect,
|
||||
tipBtns[i].x,
|
||||
tipBtns[i].y,
|
||||
tipBtns[i].x + tipBtns[i].w,
|
||||
tipBtns[i].y + tipBtns[i].h
|
||||
);
|
||||
|
||||
StrToPascal(title, tipBtns[i].name);
|
||||
ControlHandle h = NewControl(tipWindow, &rect, title, true, 0, 0, 0, 0, tipBtns[i].id);
|
||||
if(tipBtns[i].id == IDB_TEST) {
|
||||
actionBtn = h;
|
||||
}
|
||||
}
|
||||
|
||||
ReleaseDC(hMainWnd);
|
||||
|
||||
// Initialize tip
|
||||
PrepareToBeginTesting();
|
||||
GetSpareSectorCounts(false);
|
||||
FirmErrors = 0;
|
||||
UpdateRunTimeDisplay();
|
||||
}
|
||||
|
||||
void DestroyTipWindow() {
|
||||
@ -91,9 +98,9 @@ void DestroyTipWindow() {
|
||||
|
||||
void DoEvent(EventRecord &event, RgnHandle *cursorRgn) {
|
||||
if(!SIOUXHandleOneEvent(&event)) {
|
||||
// If SIOUX didn't handle the event, then handle it ourselves
|
||||
// If SIOUX didn't handle the event, then handle it ourselves
|
||||
switch(event.what) {
|
||||
case mouseDown: DoMouseDown(event); break;
|
||||
case mouseDown: DoMouseDown(event); break;
|
||||
case updateEvt: DoUpdate((WindowPtr)event.message); break;
|
||||
case osEvt: DoMouseMove(event, cursorRgn); break;
|
||||
}
|
||||
@ -105,16 +112,16 @@ void DoUpdate(WindowPtr window) {
|
||||
BeginUpdate(window);
|
||||
SetPort(window);
|
||||
EraseRect(&window->portRect);
|
||||
|
||||
GetDC(hMainWnd);
|
||||
|
||||
GetDC(hMainWnd);
|
||||
WndProc(WM_PAINT, 0);
|
||||
DrawControls(window);
|
||||
ReleaseDC(hMainWnd);
|
||||
|
||||
|
||||
GetDC(hTestMonitor);
|
||||
TestMonitorWndProc();
|
||||
ReleaseDC(hTestMonitor);
|
||||
|
||||
|
||||
EndUpdate(window);
|
||||
}
|
||||
|
||||
@ -131,19 +138,19 @@ void DoMouseDown(EventRecord &event) {
|
||||
SelectWindow(thisWindow);
|
||||
}
|
||||
else if(thisWindow == tipWindow) {
|
||||
long id = 0;
|
||||
Point mouse = event.where;
|
||||
GetDC(hMainWnd);
|
||||
GlobalToLocal(&mouse);
|
||||
if(FindControl(mouse, thisWindow, &thisControl) == inButton) {
|
||||
if(TrackControl(thisControl, mouse, 0) == inButton) {
|
||||
id = GetControlReference(thisControl);
|
||||
}
|
||||
}
|
||||
ReleaseDC(hMainWnd);
|
||||
if(id) {
|
||||
WndProc(WM_COMMAND, id);
|
||||
}
|
||||
long id = 0;
|
||||
Point mouse = event.where;
|
||||
GetDC(hMainWnd);
|
||||
GlobalToLocal(&mouse);
|
||||
if(FindControl(mouse, thisWindow, &thisControl) == inButton) {
|
||||
if(TrackControl(thisControl, mouse, 0) == inButton) {
|
||||
id = GetControlReference(thisControl);
|
||||
}
|
||||
}
|
||||
ReleaseDC(hMainWnd);
|
||||
if(id) {
|
||||
WndProc(WM_COMMAND, id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case inDrag:
|
||||
@ -163,13 +170,13 @@ void DoMouseDown(EventRecord &event) {
|
||||
void DoMouseMove(EventRecord &event, RgnHandle *cursorRgn) {
|
||||
WindowPtr thisWindow;
|
||||
int part = FindWindow(event.where, &thisWindow);
|
||||
if (thisWindow == tipWindow) {
|
||||
InitCursor();
|
||||
// Set the cursorRegion to everything inside our window
|
||||
if(cursorRgn) {
|
||||
CopyRgn(((WindowPeek)tipWindow)->contRgn, *cursorRgn);
|
||||
}
|
||||
}
|
||||
if (thisWindow == tipWindow) {
|
||||
InitCursor();
|
||||
// Set the cursorRegion to everything inside our window
|
||||
if(cursorRgn) {
|
||||
CopyRgn(((WindowPeek)tipWindow)->contRgn, *cursorRgn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StrToPascal(Str255 pStr, const char *str) {
|
||||
@ -202,8 +209,8 @@ void SetColor(long color) {
|
||||
break;
|
||||
case BLACK_COLOR:
|
||||
case GRAY_COLOR:
|
||||
PenPat(&qd.black);
|
||||
break;
|
||||
PenPat(&qd.black);
|
||||
break;
|
||||
case RED_COLOR:
|
||||
case BLUE_COLOR:
|
||||
PenPat(&qd.ltGray);
|
||||
@ -211,17 +218,17 @@ void SetColor(long color) {
|
||||
case LTGRAY_COLOR:
|
||||
case GREEN_COLOR:
|
||||
PenPat(&qd.gray);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetColor(long color, long monoColor) {
|
||||
if (AllowColor) {
|
||||
SetColor(color);
|
||||
} else {
|
||||
SetColor(monoColor);
|
||||
}
|
||||
if (AllowColor) {
|
||||
SetColor(color);
|
||||
} else {
|
||||
SetColor(monoColor);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -264,7 +271,7 @@ void DrawLed(int x, int y, long color) {
|
||||
*******************************************************************************/
|
||||
|
||||
void DrawEdge(Rect *qrc, int edge, int grfFlags) {
|
||||
if(edge == BDR_SUNKENOUTER && AllowColor) {
|
||||
if(edge == BDR_SUNKENOUTER && AllowColor) {
|
||||
// Draw a sunken rectangle
|
||||
SetColor(GRAY_COLOR);
|
||||
MoveTo(qrc->left,qrc->bottom-1);
|
||||
@ -343,28 +350,28 @@ unsigned long GetSystemTime() {
|
||||
* SET BUTTON TEXT
|
||||
*******************************************************************************/
|
||||
void SetButtonText(const char *str) {
|
||||
Str255 pStr;
|
||||
StrToPascal(pStr, str);
|
||||
if(actionBtn) {
|
||||
GetDC(hMainWnd);
|
||||
SetCTitle(actionBtn, pStr);
|
||||
ReleaseDC(hMainWnd);
|
||||
}
|
||||
Str255 pStr;
|
||||
StrToPascal(pStr, str);
|
||||
if(actionBtn) {
|
||||
GetDC(hMainWnd);
|
||||
SetCTitle(actionBtn, pStr);
|
||||
ReleaseDC(hMainWnd);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* POST QUIT MESSAGE
|
||||
*******************************************************************************/
|
||||
void PostQuitMessage() {
|
||||
gDone = true;
|
||||
gDone = true;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* PROCESS PENDING MESSAGES
|
||||
*******************************************************************************/
|
||||
void ProcessPendingMessages() {
|
||||
EventRecord event;
|
||||
if (GetNextEvent(everyEvent, &event)) {
|
||||
DoEvent(event,NULL);
|
||||
}
|
||||
EventRecord event;
|
||||
if (GetNextEvent(everyEvent, &event)) {
|
||||
DoEvent(event,NULL);
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#include "tip.h"
|
||||
|
||||
const char *szWindowTitle = "TIP 2.1b -- Zip & Jaz Drive and Cartridge Testing System";
|
||||
const char *szCopyright_1 = "Copyright (c) 2006 by";
|
||||
const char *szCopyright_1 = "Copyright (c) 2006 by";
|
||||
const char *szCopyright_2 = "Gibson Research Corp.";
|
||||
|
||||
const char *szSide0 = "Side 0";
|
||||
@ -10,7 +10,7 @@ const char *szSpaceDashSpace = " - ";
|
||||
|
||||
const char *szBarChartPercent = " %ld%% ";
|
||||
const char *szCenteredDecimal = "%ld";
|
||||
const char *szCenteredHex = "ErrorCode: %06lX";
|
||||
const char *szCenteredHex = "ErrorCode: %06lX";
|
||||
const char *szHoursMinsSecs = "%ld:%02ld:%02ld";
|
||||
|
||||
const char *szCartStatus = "Cartridge Status:";
|
||||
|