mirror of
https://github.com/vivier/EMILE.git
synced 2025-01-18 06:31:23 +00:00
Wait bus is not busy
This commit is contained in:
parent
6df85e6083
commit
5eb95f1419
@ -11,17 +11,45 @@
|
||||
#include <macos/types.h>
|
||||
#include <macos/errors.h>
|
||||
#include <macos/scsi.h>
|
||||
#include <macos/lowmem.h>
|
||||
|
||||
#include "libscsi.h"
|
||||
|
||||
#define COMPLETION_TIMEOUT 300
|
||||
|
||||
#define SCSI_BUSY (1 << 6)
|
||||
#define SCSI_SEL (1 << 1)
|
||||
|
||||
static inline int scsi_busy(void)
|
||||
{
|
||||
return (SCSIStat() & (SCSI_BUSY | SCSI_SEL)) != 0;
|
||||
}
|
||||
|
||||
static inline int scsi_wait_bus()
|
||||
{
|
||||
int timeout;
|
||||
|
||||
timeout = Ticks + 300;
|
||||
|
||||
while (scsi_busy())
|
||||
if (Ticks > timeout)
|
||||
return scsiBusy;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
int scsi_command(int target, char* cdb, int count, TIB_t* tib)
|
||||
{
|
||||
int err;
|
||||
short stat;
|
||||
short message;
|
||||
|
||||
err = scsi_wait_bus();
|
||||
if (err != noErr)
|
||||
{
|
||||
printf("SCSI bus is busy\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = SCSIGet();
|
||||
if (err != noErr)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user