1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

First network card driver

This commit is contained in:
Antoine Cure 2020-02-12 18:50:12 +01:00
parent 4dd9db33d5
commit 73ed380c15
No known key found for this signature in database
GPG Key ID: DCA412F83BD81F24
4 changed files with 89 additions and 10 deletions

View File

@ -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))

45
include/drivers/rtl8139.h Normal file
View File

@ -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 <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#ifndef _KERNEL_H
#include <kernel.h>
#endif
#ifndef _RTL8139_H
#define _RTL8139_H
#define RTL8139_VENDOR_ID 0x10EC
#define RTL8139_DEVICE_ID 0x8139
//----------------------------------------------------------------------------//
void initRTL8139();
#endif

View File

@ -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 <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <drivers/rtl8139.h>
#include <io/pci.h>
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);
}
}

View File

@ -37,8 +37,8 @@
#include <io/acpi.h>
#include <po/shtdwn.h>
#include <init/boot.h>
#include <io/pci.h>
#include <drivers/rtl8139.h>
//
// 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();