Package org.jnode.system.resource

Examples of org.jnode.system.resource.ResourceManager


        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) {
View Full Code Here


            throw new DriverException(ex);
        }
        this.io = factory.createIDEIO(parent, primary);

        // Register the irq handler
        final ResourceManager rm;
        try {
            rm = InitialNaming.lookup(ResourceManager.NAME);
        } catch (NameNotFoundException ex) {
            throw new ResourceNotFreeException("Cannot find ResourceManager",
                ex);
        }
        irqRes = rm.claimIRQ(parent, io.getIrq(), this, true);
        // Reset the controller
        softwareReset();
        // Create and start the queue processor
        queueProcessor = new QueueProcessorThread<IDECommand>(name, commandQueue, this);
        queueProcessor.start();
View Full Code Here

            public void init(Mock mockResMgr) {
                mockResMgr.expects(mockTestCase.atLeastOnce()).method("claimIOResource").withAnyArguments();
                mockResMgr.expects(mockTestCase.atLeastOnce()).method("claimIRQ").withAnyArguments();
            }
        };
        ResourceManager resMgr = MockUtils.createMockObject(ResourceManager.class, initializer);
        InitialNaming.bind(ResourceManager.NAME, resMgr);
    }
View Full Code Here

     * @param bytesPerLine
     * @return The created instance
     */
    public static BitmapGraphics createInstance(DataBuffer dataBuffer,
                                                int width, int height, int bytesPerLine, int transparency) {
        final ResourceManager rm;
        try {
            rm = InitialNaming.lookup(ResourceManager.NAME);
        } catch (NamingException ex) {
            throw new RuntimeException("Cannot find ResourceManager", ex);
        }
        final int dbOffset = dataBuffer.getOffset();
        switch (dataBuffer.getDataType()) {
            case DataBuffer.TYPE_BYTE: {
                final byte[] data = ((DataBufferByte) dataBuffer).getData();
                return new BitmapGraphics8bpp(rm.asMemoryResource(data), width,
                    height, dbOffset, bytesPerLine);
            }
            case DataBuffer.TYPE_SHORT: {
                final short[] data = ((DataBufferShort) dataBuffer).getData();
                return new BitmapGraphics16bpp(rm.asMemoryResource(data), width,
                    height, dbOffset * 2, bytesPerLine);
            }
            case DataBuffer.TYPE_USHORT: {
                final short[] data = ((DataBufferUShort) dataBuffer).getData();
                return new BitmapGraphics16bpp(rm.asMemoryResource(data), width,
                    height, dbOffset * 2, bytesPerLine);
            }
            case DataBuffer.TYPE_INT: {
                final int[] data = ((DataBufferInt) dataBuffer).getData();
                return new BitmapGraphics32bpp(rm.asMemoryResource(data), width,
                    height, dbOffset * 4, bytesPerLine, transparency);
            }
            default: {
                throw new RuntimeException("Unimplemented databuffer type " + dataBuffer.getDataType());
            }
View Full Code Here

    public void start() {
        Unsafe.debug("MmtkHeapManager#start\n");

        // Claim the available heap region as resource.
        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            final Address start = Memory.AVAILABLE_START();
            final Extent size = Memory.AVAILABLE_END().toWord().sub(start.toWord()).toExtent();
            heapResource = rm.claimMemoryResource(ResourceOwner.SYSTEM, start,
                    size, ResourceManager.MEMMODE_NORMAL);
        } catch (NameNotFoundException ex) {
            BootLogInstance.get().fatal("Cannot find resource manager", ex);
        } catch (ResourceNotFreeException ex) {
            BootLogInstance.get().fatal("Cannot claim available heap region", ex);
View Full Code Here

     * @throws ResourceNotFreeException
     */
    public CMOS(ResourceOwner owner)
        throws ResourceNotFreeException {
        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            this.cmosIO = rm.claimIOResource(owner, CMOS_FIRST_PORT, CMOS_LAST_PORT - CMOS_FIRST_PORT + 1);
        } catch (NameNotFoundException ex) {
            throw new ResourceNotFreeException("Cannot find ResourceManager", ex);
        }
    }
View Full Code Here

     */
    private PcTextScreen() throws ResourceNotFreeException {
        super(80, 25);
        Address ptr = Address.fromIntZeroExtend(0xb8000);
        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            final ResourceOwner owner = new SimpleResourceOwner("Screen");
            memory = rm.claimMemoryResource(owner, ptr, getWidth()
                    * getHeight() * 2, ResourceManager.MEMMODE_NORMAL);
        } catch (NameNotFoundException ex) {
            throw new ResourceNotFreeException("ResourceManager not found", ex);
        }
    }
View Full Code Here

        } 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();
View Full Code Here

        this.driver = driver;
        final int irq_nr = getIRQ(device, flags);
        PCIBaseAddress addr = getIOBaseAddress(device, flags);
        this.ioBase = addr.getIOBase();
        int io_length = addr.getSize();
        final ResourceManager rm;

        try {
            rm = InitialNaming.lookup(ResourceManager.NAME);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find ResourceManager");
        }

        this.irq = rm.claimIRQ(owner, irq_nr, this, true);

        try {
            io = rm.claimIOResource(owner, ioBase, io_length);
        } catch (ResourceNotFreeException ex) {
            this.irq.release();
            throw ex;
        }
View Full Code Here

                break;
    }

    void initRing() {
        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            rxRing = new ViaRhineRxRing(rm);
            log.debug("Rx ring initialised");
            txRing = new ViaRhineTxRing(rm);
            log.debug("Tx ring initialised");
        } catch (NameNotFoundException ex) {
View Full Code Here

TOP

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

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.