예제 #1
0
        /// <summary>
        /// Claims the resources.
        /// </summary>
        /// <param name="hardwareResources">The hardware resources.</param>
        /// <returns></returns>
        public bool ClaimResources(HardwareResources hardwareResources)
        {
            spinLock.Enter();

            for (byte r = 0; r < hardwareResources.IOPointRegionCount - 1; r++)
            {
                var region = hardwareResources.GetIOPortRegion(r);

                for (int p = 0; p < region.Size; p++)
                {
                    if (portUsed[region.BaseIOPort + p])
                    {
                        return(false);
                    }
                }
            }

            for (byte r = 0; r < hardwareResources.IOPointRegionCount; r++)
            {
                var region = hardwareResources.GetIOPortRegion(r);

                for (int p = 0; p < region.Size; p++)
                {
                    portUsed[region.BaseIOPort + p] = true;
                }
            }

            spinLock.Exit();

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Claims the resources.
        /// </summary>
        /// <param name="hardwareResources">The hardware resources.</param>
        /// <returns></returns>
        public bool ClaimResources(HardwareResources hardwareResources)
        {
            spinLock.Enter();

            for (byte r = 0; r < hardwareResources.IOPointRegionCount - 1; r++)
            {
                var region = hardwareResources.GetIOPortRegion(r);

                for (int p = 0; p < region.Size; p++)
                {
                    if (portUsed[region.BaseIOPort + p])
                        return false;
                }
            }

            for (byte r = 0; r < hardwareResources.IOPointRegionCount; r++)
            {
                var region = hardwareResources.GetIOPortRegion(r);

                for (int p = 0; p < region.Size; p++)
                {
                    portUsed[region.BaseIOPort + p] = true;
                }
            }

            spinLock.Exit();

            return true;
        }
예제 #3
0
        /// <summary>
        /// Setups this hardware device driver
        /// </summary>
        /// <returns></returns>
        public override bool Setup(HardwareResources hardwareResources)
        {
            this.HardwareResources = hardwareResources;
            base.Name = "AMDPCNet_0x" + hardwareResources.GetIOPortRegion(0).BaseIOPort.ToString("X");

            ioProm1 = hardwareResources.GetIOPort(0, 0x0);
            ioProm4 = hardwareResources.GetIOPort(0, 0x4);
            rdp     = hardwareResources.GetIOPort(0, 0x10);
            rap     = hardwareResources.GetIOPort(0, 0x14);
            bdp     = hardwareResources.GetIOPort(0, 0x1C);

            initBlock    = hardwareResources.GetMemory(0);
            txDescriptor = hardwareResources.GetMemory(1);
            rxDescriptor = hardwareResources.GetMemory(2);
            buffers      = hardwareResources.GetMemory(3);

            bufferSize = 2048;
            uint len = (ushort)(~bufferSize);

            len = (len + 1) & 0x0FFF | 0x8000F000;

            physicalBufferAddress = HAL.GetPhysicalAddress(buffers);

            for (uint index = 0; index < 16; index++)
            {
                uint offset = index * 4;
                rxDescriptor.Write32((offset + 1) * 4, len);
                rxDescriptor.Write32((offset + 2) * 4, physicalBufferAddress + (bufferSize * index));
                txDescriptor.Write32((offset + 2) * 4, physicalBufferAddress + (bufferSize * (index + 16)));
            }

            nextTXDesc = 0;

            return(true);
        }
예제 #4
0
        /// <summary>
        /// Setups this hardware device driver
        /// </summary>
        /// <returns></returns>
        public override bool Setup(HardwareResources hardwareResources)
        {
            this.HardwareResources = hardwareResources;
            base.Name = "VMWARE_SVGA_0x" + hardwareResources.GetIOPortRegion(0).BaseIOPort.ToString("X");

            indexPort = hardwareResources.GetIOPort(0, 0);
            valuePort = hardwareResources.GetIOPort(0, 1);
            HAL.DebugWrite("**G**");
            memory = base.HardwareResources.GetMemory(0);
            HAL.DebugWrite("**I**");
            fifo = base.HardwareResources.GetMemory(1);
            HAL.DebugWrite("**J**");
            return(true);
        }
예제 #5
0
        /// <summary>
        /// Releases the resources.
        /// </summary>
        /// <param name="hardwareResources">The hardware resources.</param>
        public void ReleaseResources(HardwareResources hardwareResources)
        {
            lock (_lock)
            {
                for (byte r = 0; r < hardwareResources.IOPointRegionCount; r++)
                {
                    var region = hardwareResources.GetIOPortRegion(r);

                    for (int p = 0; p < region.Size; p++)
                    {
                        portUsed[region.BaseIOPort + p] = false;
                    }
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Setups this hardware device driver
        /// </summary>
        /// <returns></returns>
        public override bool Setup(HardwareResources hardwareResources)
        {
            this.HardwareResources = hardwareResources;
            base.Name = "VMWARE_SVGA_0x" + hardwareResources.GetIOPortRegion(0).BaseIOPort.ToString("X");

            indexPort = hardwareResources.GetIOPort(0, 0);
            valuePort = hardwareResources.GetIOPort(0, 1);
            HAL.DebugWrite("**G**");
            memory = base.HardwareResources.GetMemory(0);
            HAL.DebugWrite("**I**");
            fifo = base.HardwareResources.GetMemory(1);
            HAL.DebugWrite("**J**");
            return true;
        }
예제 #7
0
        /// <summary>
        /// Setups this hardware device driver
        /// </summary>
        /// <returns></returns>
        public override bool Setup(HardwareResources hardwareResources)
        {
            this.HardwareResources = hardwareResources;
            base.Name = "AMDPCNet_0x" + hardwareResources.GetIOPortRegion(0).BaseIOPort.ToString("X");

            ioProm1 = hardwareResources.GetIOPort(0, 0x0);
            ioProm4 = hardwareResources.GetIOPort(0, 0x4);
            rdp = hardwareResources.GetIOPort(0, 0x10);
            rap = hardwareResources.GetIOPort(0, 0x14);
            bdp = hardwareResources.GetIOPort(0, 0x1C);

            initBlock = hardwareResources.GetMemory(0);
            txDescriptor = hardwareResources.GetMemory(1);
            rxDescriptor = hardwareResources.GetMemory(2);
            buffers = hardwareResources.GetMemory(3);

            bufferSize = 2048;
            uint len = (ushort)(~bufferSize);
            len = (len + 1) & 0x0FFF | 0x8000F000;

            physicalBufferAddress = HAL.GetPhysicalAddress(buffers);

            for (uint index = 0; index < 16; index++)
            {
                uint offset = index * 4;
                rxDescriptor.Write32((offset + 1) * 4, len);
                rxDescriptor.Write32((offset + 2) * 4, physicalBufferAddress + (bufferSize * index));
                txDescriptor.Write32((offset + 2) * 4, physicalBufferAddress + (bufferSize * (index + 16)));
            }

            nextTXDesc = 0;

            return true;
        }
예제 #8
0
        /// <summary>
        /// Releases the resources.
        /// </summary>
        /// <param name="hardwareResources">The hardware resources.</param>
        public void ReleaseResources(HardwareResources hardwareResources)
        {
            spinLock.Enter();

            for (byte r = 0; r < hardwareResources.IOPointRegionCount; r++)
            {
                var region = hardwareResources.GetIOPortRegion(r);

                for (int p = 0; p < region.Size; p++)
                {
                    portUsed[region.BaseIOPort + p] = false;
                }
            }

            spinLock.Exit();
        }