コード例 #1
0
BYTE
Z47Interface::in(BYTE addr)
{
    debugss(ssH47, ALL, "(%d)\n", addr);
    BYTE offset = getPortOffset(addr);
    BYTE data   = 0;

    switch (offset)
    {
        case StatusPort_Offset_c:
            readStatus(data);
            debugss(ssH47, ALL, "StatusPort - 0x%02x\n", data);
            break;

        case DataPort_Offset_c:
            readData(data);
            debugss(ssH47, ALL, "DataPort - 0x%02x\n", data);
            break;

        default:
            debugss(ssH47, ERROR, "Unknown Port offset - %d\n", offset);
            break;
    }

    return data;
}
コード例 #2
0
void
Z47Interface::out(BYTE addr,
                  BYTE val)
{
    BYTE offset = getPortOffset(addr);

    debugss(ssH47, ALL, "(%d) = 0x%02x\n", addr, val);

    switch (offset)
    {
        case StatusPort_Offset_c:
            debugss(ssH47, ALL, "StatusPort\n");
            writeStatus(val);
            break;

        case DataPort_Offset_c:
            debugss(ssH47, ALL, " DataPort\n");
            writeData(val);
            break;

        default:
            debugss(ssH47, ERROR, "Unknown Port offset - %d\n", offset);
            break;
    }
}
コード例 #3
0
ファイル: mms77316.cpp プロジェクト: mgarlanger/VirtualH89
void
MMS77316::out(BYTE addr,
              BYTE val)
{
    BYTE offset = getPortOffset(addr);

    debugss(ssMMS77316, VERBOSE, "(addr: %d, %d (0x%x))\n", addr, val, val);

    if (offset >= Wd1797_Offset_c)
    {
        offset -= Wd1797_Offset_c;

        if (offset == WD1797::DataPort_Offset_c)
        {
            // See notes for MMS77316::in()...
            int timeout = 0;

            while (burstMode() && !drqRaised_m && !intrqRaised_m && ++timeout < 16)
            {
                wd1797_m->waitForData();
            }
        }

        wd1797_m->out(offset, val);
    }
    else if (offset == ControlPort_Offset_c)
    {
        debugss(ssMMS77316, VERBOSE, "(ControlPort) %02x\n", val);
        controlReg_m = val;
        drqCount_m   = 0;

        if ((controlReg_m & ctrl_525DriveSel_c) != 0)
        {
            GenericFloppyDrive* drive = getCurrentDrive();

            if (drive)
            {
                drive->motor(true);
            }
        }

        wd1797_m->setDoubleDensity((controlReg_m & ctrl_SetMFMRecordingN_c) == 0);

        if ((controlReg_m & ctrl_EnableIntReq_c) != 0 && (intrqRaised_m || drqRaised_m))
        {
            // Interrupt still pending, but now un-masked. Raise it.
            ic_m->setIntrq(intrqRaised_m);
            ic_m->setDrq(drqRaised_m);
        }

    }
    else
    {
        debugss(ssMMS77316, ERROR, "(Unknown addr- 0x%02x): %d\n", addr, val);
    }
}
コード例 #4
0
ファイル: tape_hosts.c プロジェクト: bagdxk/openafs
int
bc_AddHostCmd(struct cmd_syndesc *as, void *arock)
{
    struct cmd_item *ti;
    udbClientTextP ctPtr;
    afs_int32 port = 0;
    afs_int32 code = 0;

    ctPtr = &bc_globalConfig->configText[TB_TAPEHOSTS];
    code = bc_LockText(ctPtr);
    if (code)
	ERROR(code);

    code = bc_UpdateHosts();
    if (code) {
	afs_com_err(whoami, code, "; Can't retrieve tape hosts");
	return (code);
    }

    /* add tape hosts first */
    ti = as->parms[0].items;
    if (ti) {
	if (as->parms[1].items) {
	    port = getPortOffset(as->parms[1].items->data);
	    if (port < 0)
		ERROR(BC_BADARG);
	}
	printf("Adding host %s offset %u to tape list...", ti->data, port);
	fflush(stdout);
	code = bc_AddTapeHost(bc_globalConfig, ti->data, port);
	if (code) {
	    printf("failed\n");
	    fflush(stdout);
	    if (code == EEXIST)
		afs_com_err(whoami, 0, "Port offset already in tape database");
	    ERROR(code);
	}

	code = bc_SaveHosts();
	if (code) {
	    afs_com_err(whoami, code, "Cannot save tape hosts");
	    afs_com_err(whoami, 0,
		    "Changes are temporary - for this session only");
	    ERROR(code);
	}
    }

    /* done */
    printf("done\n");

  error_exit:
    if (ctPtr->lockHandle != 0)
	bc_UnlockText(ctPtr);
    return (code);
}
コード例 #5
0
ファイル: mms77320.cpp プロジェクト: durgadas311/VirtualH89
BYTE
MMS77320::in(BYTE addr)
{
    BYTE offset = getPortOffset(addr);
    BYTE val    = 0;

    debugss(ssMMS77320, ALL, "MMS77320::in(%d)\n", addr);

    if (offset == DataPort_Offset_c)
    {
        val = dataInReg_m;
        debugss(ssMMS77320, INFO, "MMS77320::in(DataPort) %02x\n", val);

        if (curDrive_m != NULL)
        {
            ctrlBus_m |= GenericSASIDrive::ctl_Ack_i_c;
            curDrive_m->ack(dataInReg_m, dataOutReg_m, ctrlBus_m);
        }

        // TODO: side-effects?
    }
    else if (offset == StatusPort_Offset_c)
    {
        val = getStatus(ctrlBus_m);
        debugss(ssMMS77320, INFO, "MMS77320::in(StatusPort) %02x %s %s %s %s %s\n", val,
                (val & sts_Msg_c) ? "MSG" : "   ",
                (val & sts_Req_c) ? "REQ" : "   ",
                (val & sts_Cmd_c) ? "CMD" : "   ",
                (val & sts_POut_c) ? "OUT" : "   ",
                (val & sts_Busy_c) ? "BSY" : "   "
                );
        lowerIntrq();
        // TODO; other side-effects?
    }
    else
    {
        debugss(ssMMS77320, ERROR, "MMS77320::in(Unknown - 0x%02x)\n", addr);
    }

    debugss_nts(ssMMS77320, INFO, " - %d(0x%x)\n", val, val);
    return (val);
}
コード例 #6
0
ファイル: mms77316.cpp プロジェクト: mgarlanger/VirtualH89
BYTE
MMS77316::in(BYTE addr)
{
    BYTE offset = getPortOffset(addr);
    BYTE val    = 0;

    // case ControlPort_Offset_c: NOT READABLE
    if (offset >= Wd1797_Offset_c)
    {
        offset -= Wd1797_Offset_c;
        if (offset == WD1797::DataPort_Offset_c)
        {
            // might need to simulate WAIT states...
            // Must NOT wait too long - this blocks all other progress.
            // TODO: redesign this to return to execute() loop and
            // stall there... requires in() to return a status or
            // some other way inform the CPU to stall. The MMS77316
            // has a built-in timeout on the WAIT hardware anyway,
            // so, insure we don't stay here forever. The hardware
            // timed out after 16 busclk (2MHz, i.e. CPU clock) cycles,
            // really should count those but this is probably close enough.
            int timeout = 0;

            while (burstMode() && !drqRaised_m && !intrqRaised_m && ++timeout < 16)
            {
                // TODO: this stalls
                wd1797_m->waitForData();
            }
        }

        val = wd1797_m->in(offset);
    }
    else
    {
        debugss(ssMMS77316, ERROR, "(Unknown addr - 0x%02x)\n", addr);
    }

    debugss(ssMMS77316, VERBOSE, "(addr: %d) - %d\n", addr, val);
    return (val);
}
コード例 #7
0
ファイル: mms77320.cpp プロジェクト: durgadas311/VirtualH89
void
MMS77320::out(BYTE addr,
              BYTE val)
{
    BYTE offset = getPortOffset(addr);

    debugss(ssMMS77320, ALL, "MMS77320::out(%d, %d (0x%x))\n", addr, val, val);

    if (offset == DataPort_Offset_c)
    {
        debugss(ssMMS77320, INFO, "MMS77320::out(DataPort) %02x\n", val);
        dataOutReg_m = val;

        if (curDrive_m != NULL)
        {
            ctrlBus_m |= GenericSASIDrive::ctl_Ack_i_c;
            curDrive_m->ack(dataInReg_m, dataOutReg_m, ctrlBus_m);
        }

    }
    else if (offset == Control1Port_Offset_c)
    {
        val          &= 0x0f;
        debugss(ssMMS77320, INFO, "MMS77320::out(Control1Port) %02x\n", val);
        bool diff = ((control1Reg_m ^ val) & ctrl_DriveSel_c) != 0;
        control1Reg_m = val;

        if (diff)
        {
            if (curDrive_m != NULL)
            {
                // anything to do to de-select drive?
                curDrive_m->deselect(dataInReg_m, dataOutReg_m, ctrlBus_m);
            }

            curDrive_m = drives_m[control1Reg_m & ctrl_DriveSel_c];
            // anything else to do to select new drive?
            // actual SELECT is done later, on Control0Port_Offset_c...
        }

    }
    else if (offset == Control0Port_Offset_c)
    {
        val &= 0xf0;
        int diffs = (control0Reg_m ^ val);
        debugss(ssMMS77320, INFO, "MMS77320::out(Control0Port) %02x [%02x] (%s)\n", val, diffs,
                curDrive_m != NULL ? "OK" : "null");
        control0Reg_m = val;

        if (diffs && curDrive_m != NULL)
        {
            if (control0Reg_m == 0)
            {
                ctrlBus_m &= ~GenericSASIDrive::ctl_Sel_i_c;
                ctrlBus_m &= ~GenericSASIDrive::ctl_Reset_i_c;
                curDrive_m->run(dataInReg_m, dataOutReg_m, ctrlBus_m);
            }
            else if (control0Reg_m & ctrl_ResetStart_c)
            {
                debugss(ssMMS77320, INFO, "RESET SASI\n");
                ctrlBus_m |= GenericSASIDrive::ctl_Reset_i_c;
                curDrive_m->resetSASI(dataInReg_m, dataOutReg_m, ctrlBus_m);
            }
            else if (control0Reg_m & ctrl_Select_c)
            {
                BYTE temp = (1 << (control1Reg_m & ctrl_DriveSel_c));
                ctrlBus_m |= GenericSASIDrive::ctl_Sel_i_c;
                curDrive_m->select(dataInReg_m, temp, ctrlBus_m);
            }
        }
    }
    else
    {
        debugss(ssMMS77320, ERROR, "MMS77320::out(Unknown - 0x%02x): %d\n", addr, val);
    }
}