Example #1
0
        public static void Init(bool debug = true)
        {
            if (debug)
            {
                System.Utilities.PrintConsole("Finding NIC...");
            }

            PCIDevice RTL8168 = PCI.GetDevice((VendorID)0x10EC, (DeviceID)0x8168);

            if (RTL8168 != null)
            {
                if (debug)
                {
                    System.Utilities.PrintConsole("Found RTL8168 NIC on PCI " + RTL8168.bus + ":" + RTL8168.slot + ":" + RTL8168.function);
                    System.Utilities.PrintConsole("NIC IRQ: " + RTL8168.InterruptLine);
                }
                RTL8168NIC = new Drivers.RTL8168(RTL8168);
                if (debug)
                {
                    System.Utilities.PrintConsole("NIC MAC Address: " + RTL8168NIC.MACAddress.ToString());
                }
                Network.NetworkStack.Init();
                RTL8168NIC.Enable();
            }
            PCIDevice AMDPCNETII = PCI.GetDevice(VendorID.AMD, DeviceID.PCNETII);

            if (AMDPCNETII != null)
            {
                if (debug)
                {
                    System.Utilities.PrintConsole("Found AMDPCNETII NIC on PCI " + AMDPCNETII.bus + ":" + AMDPCNETII.slot + ":" + AMDPCNETII.function);
                    System.Utilities.PrintConsole("NIC IRQ: " + AMDPCNETII.InterruptLine);
                }
                AMDPCNetIINIC = new Drivers.AMDPCNetII(AMDPCNETII);
                if (debug)
                {
                    System.Utilities.PrintConsole("NIC MAC Address: " + AMDPCNetIINIC.MACAddress.ToString());
                }
                Network.NetworkStack.Init();
                AMDPCNetIINIC.Enable();
            }
            if (RTL8168 == null && AMDPCNETII == null)
            {
                System.Utilities.PrintConsole("No supported network card found!!");
                return;
            }
            if (debug)
            {
                System.Utilities.PrintConsole("Network initialization done!");
            }
        }
Example #2
0
        /// <summary>
        /// Retrieve all AMD PCNetII network cards found on computer.
        /// </summary>
        public static void FindAll()
        {
            Console.WriteLine("Scanning for AMD PCNetII cards...");
            PCIDevice device = Cosmos.HAL.PCI.GetDevice(VendorID.AMD, DeviceID.PCNETII);

            if (device != null)
            {
                AMDPCNetII nic = new AMDPCNetII((PCIDevice)device);

                Console.WriteLine("Found AMD PCNetII NIC on PCI " + device.bus + ":" + device.slot + ":" +
                                  device.function);
                Console.WriteLine("NIC IRQ: " + device.InterruptLine);
                Console.WriteLine("NIC MAC Address: " + nic.MACAddress.ToString());
            }
        }