Пример #1
0
        public RTL8139(PCIDevice device)
        {
            if (device == null) {
                throw new ArgumentException("PCI Device is null. Unable to get Realtek 8139 card");
            }
            pciCard = device;

            // We are handling this device
            pciCard.Claimed = true;

            // Setup interrupt handling
            //Interrupts.IRQ11 += HandleNetworkInterrupt;
            //Interrupts.AddIRQHandler(device.InterruptLine, HandleNetworkInterrupt);

            // Get IO Address from PCI Bus
            io = pciCard.GetAddressSpace(0);

            // Enable the card
            pciCard.EnableDevice();

            // Turn on the card
            io.Write8(0x52, 0x01);

            //Do a software reset
            SoftwareReset();

            // Get the MAC Address
            byte[] eeprom_mac = new byte[6];
            for (uint b = 0; b < 6; b++)
            {
                eeprom_mac[b] = io.Read8(b);
            }

            this.mac = new MACAddress(eeprom_mac);

            // Get a receive buffer and assign it to the card
            rxBuffer = new ManagedMemorySpace(RxBufferSize + 2048 + 16, 4);

            RBStartRegister = rxBuffer.Offset;

            // Setup receive Configuration
            RecvConfigRegister = 0xF381;
            // Setup Transmit Configuration
            TransmitConfigRegister = 0x3000300;

            // Setup Interrupts
            IntMaskRegister = 0x7F;
            IntStatusRegister = 0xFFFF;

            // Setup our Receive and Transmit Queues
            mRecvBuffer = new Queue<byte[]>();
            mTransmitBuffer = new Queue<byte[]>();
        }
Пример #2
0
 static MACAddress() {
   var xBroadcastArray = new byte[6];
   xBroadcastArray[0] = 0xFF;
   xBroadcastArray[1] = 0xFF;
   xBroadcastArray[2] = 0xFF;
   xBroadcastArray[3] = 0xFF;
   xBroadcastArray[4] = 0xFF;
   xBroadcastArray[5] = 0xFF;
   Broadcast = new MACAddress(xBroadcastArray);
   var xNoneArray = new byte[6];
   xNoneArray[0] = 0xFF;
   xNoneArray[1] = 0xFF;
   xNoneArray[2] = 0xFF;
   xNoneArray[3] = 0xFF;
   xNoneArray[4] = 0xFF;
   xNoneArray[5] = 0xFF;
   None = new MACAddress(xNoneArray);
 }
Пример #3
0
 public MACAddress(MACAddress m) : this(m.bytes)
 {
 }
Пример #4
0
 public MACAddress(MACAddress m) : this(m.bytes)
 {
 }