diff --git a/Makefile b/Makefile index ebe01ea..341ae74 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,8 @@ KernSources = kernel/ke/cpuid.c kernel/mm/paging.c \ kernel/sh/musage.c kernel/io/ata.c \ kernel/sh/argv.c kernel/ke/pit.c \ kernel/sh/testcmds.c kernel/mm/palloc.c \ - kernel/io/acpi.c kernel/io/pci.c + kernel/io/acpi.c kernel/io/pci.c \ + kernel/drivers/rtl8139.c KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources)) KernDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(KernSources)) diff --git a/include/drivers/rtl8139.h b/include/drivers/rtl8139.h new file mode 100644 index 0000000..ccb5542 --- /dev/null +++ b/include/drivers/rtl8139.h @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Desc: RTL8139 network card driver // +// // +// // +// Copyright © 2018-2020 The OS/K Team // +// // +// This file is part of OS/K. // +// // +// OS/K is free software: you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation, either version 3 of the License, or // +// any later version. // +// // +// OS/K is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY//without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with OS/K. If not, see . // +//----------------------------------------------------------------------------// + + +#ifndef _KERNEL_H +#include +#endif + + + +#ifndef _RTL8139_H +#define _RTL8139_H + + +#define RTL8139_VENDOR_ID 0x10EC +#define RTL8139_DEVICE_ID 0x8139 + + +//----------------------------------------------------------------------------// + +void initRTL8139(); + + +#endif diff --git a/kaleid/kernel/drivers/rtl8139.c b/kaleid/kernel/drivers/rtl8139.c new file mode 100644 index 0000000..3b8d131 --- /dev/null +++ b/kaleid/kernel/drivers/rtl8139.c @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Desc: RTL8139 network card driver // +// // +// // +// Copyright © 2018-2020 The OS/K Team // +// // +// This file is part of OS/K. // +// // +// OS/K is free software: you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation, either version 3 of the License, or // +// any later version. // +// // +// OS/K is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY//without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with OS/K. If not, see . // +//----------------------------------------------------------------------------// + + +#include +#include + + +void initRTL8139() +{ + pciDev_t *rtl8139_pciDev = IoPciGetDevice(RTL8139_VENDOR_ID, RTL8139_DEVICE_ID); + if(rtl8139_pciDev != NULL) + { + DebugLog("Network card RTL8139 found ! PCI config addr = %p\n", + rtl8139_pciDev->configAddr); + } +} diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 8ce9bc8..d743926 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -37,8 +37,8 @@ #include #include #include - #include +#include // // Entry point of the Kaleid kernel @@ -89,14 +89,9 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg) // PCI IoInitPCI(); - // Test RTL8139 - pciDev_t *rtl8139_pciDev = IoPciGetDevice(0x10EC, 0x8139); - if(rtl8139_pciDev != NULL) - { - DebugLog("Network card RTL8139 found ! PCI config addr = %p\n", - rtl8139_pciDev->configAddr); - } - + // Network + initRTL8139(); + // Scheduler PsInitSched();