Package org.jnode.driver.bus.ide.command

Examples of org.jnode.driver.bus.ide.command.IDEIdCommand


        // Interrupts enabled
        io.setControlReg(CTR_BLANK);

        // First try a normal IDE Identify command
        IDEIdCommand cmd = new IDEIdCommand(primary, master, false);
        try {
            executeAndWait(cmd, IDE_TIMEOUT);
        } catch (TimeoutException ex) {
            // Do nothing, handled later
        }
        if (cmd.isFinished()) {
            final IDEDriveDescriptor result = cmd.getResult();
            if (result != null) {
                return result;
            } else {
                if (!cmd.isPacketResponse()) {
                    // Not an ATAPI response, try it anyway.
                    log.debug("NON-Packet response from ID command");
                } else {
                    log.debug("Packet response from ID command");
                }
            }
        } else {
            // Finish the command
            cmd.setError(ERR_ABORT);
            // Force a reset of any IRQ
            final int state = io.getStatusReg();
            // Timeout
            log.debug("Timeout of " + ideId + " state=" + NumberUtils.hex(state));
            return null;
        }

        // Clear any interrupts
        io.getStatusReg();
        // Interrupts enabled
        io.setControlReg(CTR_BLANK);

        // IDE Identify failed, do an ATAPI Identify
        cmd = new IDEIdCommand(primary, master, true);
        try {
            executeAndWait(cmd, IDE_TIMEOUT);
        } catch (TimeoutException ex1) {
            // Do nothing, handled later
        }
        // Force a reset of any IRQ
        io.getStatusReg();
        // Good result?
        if (cmd.isFinished()) {
            return cmd.getResult();
        } else {
            // Finish the command
            cmd.setError(ERR_ABORT);
            log.debug("Probe of " + ideId + " done, return null");
            // No device found
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of org.jnode.driver.bus.ide.command.IDEIdCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.