Added detection of Jaz drives

This commit is contained in:
Marcio T 2021-11-25 20:40:16 -07:00
parent 85eb5bc52c
commit d861f94fbe
8 changed files with 76 additions and 17 deletions

View File

@ -27,7 +27,6 @@ It has been tested in on the following environments:
What will not work or is missing:
* Support for JAZ drives is currently missing.
* TIP will only do a read-pass and the write-tests have been disabled.
* The functionality for operating with password or write protected disks is missing.
* The partition recovery feature has been removed, since it is meant for PC disks.

View File

@ -96,10 +96,10 @@ void scan_bus() {
printf( " %hd: (Not installed)\n", id );
} else {
printf( " %hd: ", id );
printn( reply.prod, 16 );
printf( " " );
printn( reply.vend, 8 );
printf( " " );
printf( ", " );
printn( reply.prod, 16 );
printf( ", " );
printn( reply.rvsn, 4 );
putchar( '\n' );
}

View File

@ -48,7 +48,7 @@ OSErr scsi_cmd(int id, void *cmd, size_t clen, void *buff, size_t siz, size_t cn
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 );

View File

@ -19,11 +19,24 @@ Rect TL_Sect = SET_RECT( 75, 154, 203, 170);
Rect ES_Read = SET_RECT(346, 154, 409, 170);
Rect SE_Rect = SET_RECT(222, 154, 255, 221);
/*******************************************************************************
* WinMain
*
* Startup the Windows program.
*******************************************************************************/
void WinMain(int Device) {
CurrentDevice = Device;
// test for an Iomega device
EnumerateIomegaDevices(CurrentDevice);
// now startup the timer for real-time features
StartApplicationTimer();
}
/*******************************************************************************
* WndProc
*
* This is the system's main window procedure
*/
*******************************************************************************/
void WndProc(long iMessage, long wParam) {
// -------------------------------------------------------------------------
// WM_PAINT
@ -142,11 +155,11 @@ void PaintCartStatus() {
}
// pickup the pointer to the string
const char *esi;
//if (DriveCount) {
esi = CartStatStrings[eax];
//} else {
// esi = szNoIomegaDrives;
//}
if (DriveCount) {
esi = CartStatStrings[eax];
} else {
esi = szNoIomegaDrives;
}
SetColor(BLACK_COLOR);
TextOutCentered(115, 9, 241 - 115, 27 - 9, esi);
}
@ -347,7 +360,10 @@ void TestMonitorWndProc() {
* APPLICATION TIMER PROC
*******************************************************************************/
void ApplicationTimerProc() {
HandleDriveChanging();
// only if we have at least ONE Iomega drive
if(DriveCount) {
HandleDriveChanging();
}
}
/*******************************************************************************

View File

@ -11,6 +11,7 @@ void run_tip(int id);
#define MAXIMUM_ZIP_SPARES 126
extern long CurrentDevice;
extern long DriveCount;
extern long JazDrive; // true if the current drive
extern long CartridgeStatus;
extern long LastLBAOnCartridge;
@ -117,6 +118,9 @@ enum {
extern const char *szWindowTitle;
extern const char *szCopyright_1;
extern const char *szCopyright_2;
extern const char *szIomega;
extern const char *szZip;
extern const char *szJaz;
extern const char *szSide0;
extern const char *szSide1;
extern const char *szSpaceDashSpace;
@ -202,6 +206,7 @@ void PreventProgramExit();
void AllowProgramExit();
void ErrorSound();
void ProcessPendingMessages();
void WinMain(int Device);
void WndProc(long iMessage, long wParam);
void TestMonitorWndProc();
void ApplicationTimerProc();
@ -209,6 +214,7 @@ void TestButtonClicked();
void GetCommandDetails(char command, char &cmd_flags, char &cmd_length);
long SCSICommand(short Device, char *lpCmdBlk, void *lpIoBuf, short IoBufLen);
void EnumerateIomegaDevices(long Device);
long GetModePage(short Device, short PageToGet, void *pBuffer, short BufLen);
long SetModePage(short Device, void *pBuffer);
void ModifyModePage(char *PageBuff, char eec, char retries);

View File

@ -10,6 +10,7 @@
#define MAKE_LITTLE_ENDIAN(a) a // Don't do anything on 68000
#define MAKE_BIG_ENDIAN(a) a // Don't do anything on 68000
// The following crashes on the 68000 due to unaligned access
//#define BYTE_AT(s, a) *((char*)(s + a))
//#define WORD_AT(s, a) *((short*)(s + a))
//#define DWORD_AT(s, a) *((long*)(s + a))
@ -101,6 +102,7 @@ enum {
};
long CurrentDevice = 0;
long DriveCount = 0;
long JazDrive = 0; // true if the current drive
long CartridgeStatus = DISK_NOT_PRESENT;
@ -213,6 +215,38 @@ long SCSICommand(short Device, char *lpCmdBlk, void *lpIoBuf, short IoBufLen) {
}
}
/*******************************************************************************
* ENUMERATE IOMEGA DEVICES
*******************************************************************************/
void EnumerateIomegaDevices(long Device) {
DriveCount = 0;
JazDrive = 0;
//-----------------------------------------------------------
char InqData[96];
char Scsi[6] = {0};
Scsi[0] = SCSI_Cmd_Inquiry;
Scsi[4] = sizeof(InqData);
long eax = SCSICommand(Device, Scsi, InqData, sizeof(InqData));
if(eax) goto TryNextDrive;
//-----------------------------------------------------------
InqData[14] = '\0';
if (strcmp(szIomega, InqData + 8)) goto TryNextDrive;
//-----------------------------------------------------------
InqData[19] = '\0';
if (!strcmp(szZip, InqData + 16)) goto FoundZipOrJaz;
//-----------------------------------------------------------
if (strcmp(szJaz, InqData + 16)) goto TryNextDrive;
JazDrive = 1;
FoundZipOrJaz:
DriveCount = 1;
if(JazDrive)
printf("Found Jaz drive\n");
else
printf("Found Zip drive\n");
TryNextDrive:
return;
}
/*******************************************************************************
* GET MODE PAGE
*******************************************************************************/
@ -262,8 +296,8 @@ void SetErrorRecovery(bool Retries, bool ECC, bool Testing) {
char PageBuff[40];
#ifdef NO_EXCESS_READS
// Limit reads to 20 bytes to prevent controller errors
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, 20);
// Limit reads to 20 bytes on Zip to prevent controller errors
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, JazDrive ? sizeof(PageBuff) : 20);
#else
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, sizeof(PageBuff));
#endif
@ -370,7 +404,7 @@ long GetSpareSectorCounts(char checkPassword) {
// here... might be better to conditionally check for Jaz drive
char DiskStat[72];
#ifdef NO_EXCESS_READS
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, 63);
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, JazDrive ? sizeof(DiskStat) : 63);
if (eax) return eax;
#else
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, sizeof(DiskStat));
@ -454,7 +488,7 @@ void HandleDriveChanging() {
long eax;
char DiskStat[72];
#ifdef NO_EXCESS_READS
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, 63);
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, JazDrive ? sizeof(DiskStat) : 63);
if (eax) return;
#else
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, sizeof(DiskStat));

View File

@ -27,7 +27,7 @@ void DoMouseMove(EventRecord &event, RgnHandle *cursorRegion);
void DoDiskEvent(EventRecord &event);
void run_tip(int id) {
CurrentDevice = id;
WinMain(id);
RgnHandle cursorRgn = NewRgn();
NewTipWindow();

View File

@ -4,6 +4,10 @@ const char *szWindowTitle = "TIP 2.1b -- Zip & Jaz Drive and Cartridge Testing S
const char *szCopyright_1 = "Copyright (c) 2006 by";
const char *szCopyright_2 = "Gibson Research Corp.";
const char *szIomega = "IOMEGA";
const char *szZip = "ZIP";
const char *szJaz = "JAZ";
const char *szSide0 = "Side 0";
const char *szSide1 = "Side 1";
const char *szSpaceDashSpace = " - ";