Examples of IRQResource


Examples of org.jnode.system.resource.IRQResource

     * @throws ResourceNotFreeException
     * @throws DriverException
     */
    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) {
                dma.release();
            }
            if (irq != null) {
                irq.release();
            }
            throw ex;
        }
        this.primary = primary;
        this.irq = irq;
View Full Code Here

Examples of org.jnode.system.resource.IRQResource

        if (io != null) {
            this.io = null;
            io.release();
        }

        final IRQResource irq = this.irq;
        if (irq != null) {
            this.irq = null;
            irq.release();
        }
    }
View Full Code Here

Examples of org.jnode.system.resource.IRQResource

            }
            if (ioResData == null) {
                ioResData = claimPorts(rm, owner, PS2_DATA_PORT, 1);
                ioResCtrl = claimPorts(rm, owner, PS2_CTRL_PORT, 1);
            }
            final IRQResource irqRes = rm.claimIRQ(owner, irq, this, true);
            if (activeCount == 0) {
                flush();
            }
            activeCount++;
            return irqRes;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.