mirror of
https://github.com/marciot/mac-tip.git
synced 2024-11-10 07:09:14 +00:00
Added detection of Jaz drives
This commit is contained in:
parent
85eb5bc52c
commit
d861f94fbe
@ -27,7 +27,6 @@ It has been tested in on the following environments:
|
|||||||
|
|
||||||
What will not work or is missing:
|
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.
|
* 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 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.
|
* The partition recovery feature has been removed, since it is meant for PC disks.
|
||||||
|
@ -96,10 +96,10 @@ void scan_bus() {
|
|||||||
printf( " %hd: (Not installed)\n", id );
|
printf( " %hd: (Not installed)\n", id );
|
||||||
} else {
|
} else {
|
||||||
printf( " %hd: ", id );
|
printf( " %hd: ", id );
|
||||||
printn( reply.prod, 16 );
|
|
||||||
printf( " " );
|
|
||||||
printn( reply.vend, 8 );
|
printn( reply.vend, 8 );
|
||||||
printf( " " );
|
printf( ", " );
|
||||||
|
printn( reply.prod, 16 );
|
||||||
|
printf( ", " );
|
||||||
printn( reply.rvsn, 4 );
|
printn( reply.rvsn, 4 );
|
||||||
putchar( '\n' );
|
putchar( '\n' );
|
||||||
}
|
}
|
||||||
|
@ -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;}
|
if (err != noErr) {printf("SCSIGet Error: %d\n", err); return err;}
|
||||||
|
|
||||||
err = SCSISelect(id);
|
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 */
|
/* Send the command to the SCSI device and perform the requested I/O */
|
||||||
err = SCSICmd( (Ptr) cmd, clen );
|
err = SCSICmd( (Ptr) cmd, clen );
|
||||||
|
@ -19,11 +19,24 @@ Rect TL_Sect = SET_RECT( 75, 154, 203, 170);
|
|||||||
Rect ES_Read = SET_RECT(346, 154, 409, 170);
|
Rect ES_Read = SET_RECT(346, 154, 409, 170);
|
||||||
Rect SE_Rect = SET_RECT(222, 154, 255, 221);
|
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
|
* WndProc
|
||||||
*
|
*
|
||||||
* This is the system's main window procedure
|
* This is the system's main window procedure
|
||||||
*/
|
*******************************************************************************/
|
||||||
void WndProc(long iMessage, long wParam) {
|
void WndProc(long iMessage, long wParam) {
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// WM_PAINT
|
// WM_PAINT
|
||||||
@ -142,11 +155,11 @@ void PaintCartStatus() {
|
|||||||
}
|
}
|
||||||
// pickup the pointer to the string
|
// pickup the pointer to the string
|
||||||
const char *esi;
|
const char *esi;
|
||||||
//if (DriveCount) {
|
if (DriveCount) {
|
||||||
esi = CartStatStrings[eax];
|
esi = CartStatStrings[eax];
|
||||||
//} else {
|
} else {
|
||||||
// esi = szNoIomegaDrives;
|
esi = szNoIomegaDrives;
|
||||||
//}
|
}
|
||||||
SetColor(BLACK_COLOR);
|
SetColor(BLACK_COLOR);
|
||||||
TextOutCentered(115, 9, 241 - 115, 27 - 9, esi);
|
TextOutCentered(115, 9, 241 - 115, 27 - 9, esi);
|
||||||
}
|
}
|
||||||
@ -347,7 +360,10 @@ void TestMonitorWndProc() {
|
|||||||
* APPLICATION TIMER PROC
|
* APPLICATION TIMER PROC
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ApplicationTimerProc() {
|
void ApplicationTimerProc() {
|
||||||
HandleDriveChanging();
|
// only if we have at least ONE Iomega drive
|
||||||
|
if(DriveCount) {
|
||||||
|
HandleDriveChanging();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -11,6 +11,7 @@ void run_tip(int id);
|
|||||||
#define MAXIMUM_ZIP_SPARES 126
|
#define MAXIMUM_ZIP_SPARES 126
|
||||||
|
|
||||||
extern long CurrentDevice;
|
extern long CurrentDevice;
|
||||||
|
extern long DriveCount;
|
||||||
extern long JazDrive; // true if the current drive
|
extern long JazDrive; // true if the current drive
|
||||||
extern long CartridgeStatus;
|
extern long CartridgeStatus;
|
||||||
extern long LastLBAOnCartridge;
|
extern long LastLBAOnCartridge;
|
||||||
@ -117,6 +118,9 @@ enum {
|
|||||||
extern const char *szWindowTitle;
|
extern const char *szWindowTitle;
|
||||||
extern const char *szCopyright_1;
|
extern const char *szCopyright_1;
|
||||||
extern const char *szCopyright_2;
|
extern const char *szCopyright_2;
|
||||||
|
extern const char *szIomega;
|
||||||
|
extern const char *szZip;
|
||||||
|
extern const char *szJaz;
|
||||||
extern const char *szSide0;
|
extern const char *szSide0;
|
||||||
extern const char *szSide1;
|
extern const char *szSide1;
|
||||||
extern const char *szSpaceDashSpace;
|
extern const char *szSpaceDashSpace;
|
||||||
@ -202,6 +206,7 @@ void PreventProgramExit();
|
|||||||
void AllowProgramExit();
|
void AllowProgramExit();
|
||||||
void ErrorSound();
|
void ErrorSound();
|
||||||
void ProcessPendingMessages();
|
void ProcessPendingMessages();
|
||||||
|
void WinMain(int Device);
|
||||||
void WndProc(long iMessage, long wParam);
|
void WndProc(long iMessage, long wParam);
|
||||||
void TestMonitorWndProc();
|
void TestMonitorWndProc();
|
||||||
void ApplicationTimerProc();
|
void ApplicationTimerProc();
|
||||||
@ -209,6 +214,7 @@ void TestButtonClicked();
|
|||||||
|
|
||||||
void GetCommandDetails(char command, char &cmd_flags, char &cmd_length);
|
void GetCommandDetails(char command, char &cmd_flags, char &cmd_length);
|
||||||
long SCSICommand(short Device, char *lpCmdBlk, void *lpIoBuf, short IoBufLen);
|
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 GetModePage(short Device, short PageToGet, void *pBuffer, short BufLen);
|
||||||
long SetModePage(short Device, void *pBuffer);
|
long SetModePage(short Device, void *pBuffer);
|
||||||
void ModifyModePage(char *PageBuff, char eec, char retries);
|
void ModifyModePage(char *PageBuff, char eec, char retries);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#define MAKE_LITTLE_ENDIAN(a) a // Don't do anything on 68000
|
#define MAKE_LITTLE_ENDIAN(a) a // Don't do anything on 68000
|
||||||
#define MAKE_BIG_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 BYTE_AT(s, a) *((char*)(s + a))
|
||||||
//#define WORD_AT(s, a) *((short*)(s + a))
|
//#define WORD_AT(s, a) *((short*)(s + a))
|
||||||
//#define DWORD_AT(s, a) *((long*)(s + a))
|
//#define DWORD_AT(s, a) *((long*)(s + a))
|
||||||
@ -101,6 +102,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
long CurrentDevice = 0;
|
long CurrentDevice = 0;
|
||||||
|
long DriveCount = 0;
|
||||||
|
|
||||||
long JazDrive = 0; // true if the current drive
|
long JazDrive = 0; // true if the current drive
|
||||||
long CartridgeStatus = DISK_NOT_PRESENT;
|
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
|
* GET MODE PAGE
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@ -262,8 +296,8 @@ void SetErrorRecovery(bool Retries, bool ECC, bool Testing) {
|
|||||||
char PageBuff[40];
|
char PageBuff[40];
|
||||||
|
|
||||||
#ifdef NO_EXCESS_READS
|
#ifdef NO_EXCESS_READS
|
||||||
// Limit reads to 20 bytes to prevent controller errors
|
// Limit reads to 20 bytes on Zip to prevent controller errors
|
||||||
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, 20);
|
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, JazDrive ? sizeof(PageBuff) : 20);
|
||||||
#else
|
#else
|
||||||
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, sizeof(PageBuff));
|
GetModePage(CurrentDevice, ERROR_RECOVERY_PAGE, PageBuff, sizeof(PageBuff));
|
||||||
#endif
|
#endif
|
||||||
@ -370,7 +404,7 @@ long GetSpareSectorCounts(char checkPassword) {
|
|||||||
// here... might be better to conditionally check for Jaz drive
|
// here... might be better to conditionally check for Jaz drive
|
||||||
char DiskStat[72];
|
char DiskStat[72];
|
||||||
#ifdef NO_EXCESS_READS
|
#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;
|
if (eax) return eax;
|
||||||
#else
|
#else
|
||||||
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, sizeof(DiskStat));
|
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, sizeof(DiskStat));
|
||||||
@ -454,7 +488,7 @@ void HandleDriveChanging() {
|
|||||||
long eax;
|
long eax;
|
||||||
char DiskStat[72];
|
char DiskStat[72];
|
||||||
#ifdef NO_EXCESS_READS
|
#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;
|
if (eax) return;
|
||||||
#else
|
#else
|
||||||
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, sizeof(DiskStat));
|
eax = GetNonSenseData(CurrentDevice, DISK_STATUS_PAGE, DiskStat, sizeof(DiskStat));
|
||||||
|
@ -27,7 +27,7 @@ void DoMouseMove(EventRecord &event, RgnHandle *cursorRegion);
|
|||||||
void DoDiskEvent(EventRecord &event);
|
void DoDiskEvent(EventRecord &event);
|
||||||
|
|
||||||
void run_tip(int id) {
|
void run_tip(int id) {
|
||||||
CurrentDevice = id;
|
WinMain(id);
|
||||||
RgnHandle cursorRgn = NewRgn();
|
RgnHandle cursorRgn = NewRgn();
|
||||||
|
|
||||||
NewTipWindow();
|
NewTipWindow();
|
||||||
|
@ -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_1 = "Copyright (c) 2006 by";
|
||||||
const char *szCopyright_2 = "Gibson Research Corp.";
|
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 *szSide0 = "Side 0";
|
||||||
const char *szSide1 = "Side 1";
|
const char *szSide1 = "Side 1";
|
||||||
const char *szSpaceDashSpace = " - ";
|
const char *szSpaceDashSpace = " - ";
|
||||||
|
Loading…
Reference in New Issue
Block a user