Package org.jnode.system.resource

Examples of org.jnode.system.resource.IOResource


        }

        log.info("Using PCI IDE " + (nativeMode ? "Native" : "Compatibility") + " mode [irq=" + irq + "]");

        // Now claim the resources
        IOResource cmdBlock = null;
        IOResource ctrlBlock = null;
        final ResourceManager rm;
        try {
            rm = InitialNaming.lookup(ResourceManager.NAME);
            cmdBlock = claimPorts(rm, device, cmdBlockStart, cmdBlockSize);
            ctrlBlock = claimPorts(rm, device, ctrlBlockStart, ctrlBlockSize);
        } catch (NameNotFoundException ex) {
            throw new ResourceNotFreeException("Cannot find ResourceManager",
                ex);
        } catch (ResourceNotFreeException ex) {
            if (cmdBlock != null) {
                cmdBlock.release();
            }
            if (ctrlBlock != null) {
                ctrlBlock.release();
            }
            throw ex;
        }
        this.irq = irq;
        this.cmdBlockStart = cmdBlockStart;
View Full Code Here


     */
    public DefaultFDC(ResourceOwner owner, boolean primary)
        throws ResourceNotFreeException, DriverException {
        IRQResource irq = null;
        DMAResource dma = null;
        IOResource io1 = null;
        IOResource io2 = null;
        MemoryResource dmaMem = null;

        if (primary) {
            startPort = PRIMARY_START_PORT;
        } else {
            startPort = SECONDARY_START_PORT;
        }

        // Try to read the floppy parameters in CMOS
        try {
            final CMOSService cmos = InitialNaming.lookup(CMOSService.NAME);
            final int fd = cmos.getRegister(CMOSConstants.CMOS_FLOPPY_DRIVES);
            driveParams = new FloppyDriveParameters[NR_DRIVES];
            diskChanged = new boolean[NR_DRIVES];
            for (int i = 0; i < NR_DRIVES; i++) {
                final int cmosType;
                if (i == 0) {
                    cmosType = (fd >> 4) & 0xf;
                } else if (i == 1) {
                    cmosType = (fd & 0xf);
                } else {
                    cmosType = 0;
                }
                driveParams[i] = getDriveParam(cmosType);
                diskChanged[i] = true;
            }
        } catch (NameNotFoundException ex) {
            throw new ResourceNotFreeException("Cannot find CMOSService", ex);
        }

        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            final DMAManager dmaService = InitialNaming.lookup(DMAManager.NAME);
            // PRESERVE THIS CLAIMING ORDER!
            irq = rm.claimIRQ(owner, FLOPPY_IRQ, this, false);
            dma = dmaService.claimDMAChannel(owner, FLOPPY_DMA);
            io1 = claimPorts(rm, owner, startPort + OFFSET_RANGE1, NR_PORTS_RANGE1);
            io2 = claimPorts(rm, owner, startPort + OFFSET_RANGE2, NR_PORTS_RANGE2);
            dmaMem = rm.claimMemoryResource(owner, null, 64 * 1024, ResourceManager.MEMMODE_ALLOC_DMA);
        } catch (NameNotFoundException ex) {
            throw new ResourceNotFreeException("Cannot find ResourceManager or DMAService", ex);
        } catch (ResourceNotFreeException ex) {
            if (dmaMem != null) {
                dmaMem.release();
            }
            if (io2 != null) {
                io2.release();
            }
            if (io1 != null) {
                io1.release();
            }
            if (dma != null) {
View Full Code Here

        try {
            rm = InitialNaming.lookup(ResourceManager.NAME);
        } catch (NameNotFoundException ex) {
            throw new DMAException("Cannot find ResourceManager", ex);
        }
        IOResource pageIO = null;
        IOResource dma1IO = null;
        IOResource dma2IO = null;

        try {
            final ResourceOwner owner = new SimpleResourceOwner("DMA-X86");
            pageIO = claimPorts(rm, owner, 0x81, 0x8f - 0x81 + 1);
            dma1IO = claimPorts(rm, owner, 0x00, 16);
            dma2IO = claimPorts(rm, owner, 0xc0, 32);

            this.pageIO = pageIO;
            this.dma1IO = dma1IO;
            this.dma2IO = dma2IO;

            for (int dmanr = 0; dmanr < MAX; dmanr++) {
                clearFF(dmanr);
            }

        } catch (ResourceNotFreeException ex) {
            if (pageIO != null) {
                pageIO.release();
            }
            if (dma1IO != null) {
                dma1IO.release();
            }
            if (dma2IO != null) {
                dma2IO.release();
            }
            throw new DMAException("Cannot claim DMA I/O ports", ex);
        }
    }
View Full Code Here

                        .getVendorID()));

        try {
            final ResourceManager rm = (ResourceManager) InitialNaming
                    .lookup(ResourceManager.NAME);
            final IOResource ports = claimPorts(rm, device, CIRRUS_FIRST_PORT,
                    CIRRUS_LAST_PORT - CIRRUS_FIRST_PORT);
            final int mmioBase = (int) mmioAddr.getMemoryBase() & 0xFF000000;
            final int mmioSize = mmioAddr.getSize();
            final int fbBase = (int) fbAddr.getMemoryBase() & 0xFF000000;
            final int fbSize = fbAddr.getSize();
View Full Code Here

TOP

Related Classes of org.jnode.system.resource.IOResource

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.