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:
parent
4dd9db33d5
commit
73ed380c15
3
Makefile
3
Makefile
@ -116,7 +116,8 @@ KernSources = kernel/ke/cpuid.c kernel/mm/paging.c \
|
|||||||
kernel/sh/musage.c kernel/io/ata.c \
|
kernel/sh/musage.c kernel/io/ata.c \
|
||||||
kernel/sh/argv.c kernel/ke/pit.c \
|
kernel/sh/argv.c kernel/ke/pit.c \
|
||||||
kernel/sh/testcmds.c kernel/mm/palloc.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))
|
KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources))
|
||||||
KernDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(KernSources))
|
KernDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(KernSources))
|
||||||
|
45
include/drivers/rtl8139.h
Normal file
45
include/drivers/rtl8139.h
Normal 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
|
38
kaleid/kernel/drivers/rtl8139.c
Normal file
38
kaleid/kernel/drivers/rtl8139.c
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -37,8 +37,8 @@
|
|||||||
#include <io/acpi.h>
|
#include <io/acpi.h>
|
||||||
#include <po/shtdwn.h>
|
#include <po/shtdwn.h>
|
||||||
#include <init/boot.h>
|
#include <init/boot.h>
|
||||||
|
|
||||||
#include <io/pci.h>
|
#include <io/pci.h>
|
||||||
|
#include <drivers/rtl8139.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Entry point of the Kaleid kernel
|
// Entry point of the Kaleid kernel
|
||||||
@ -89,13 +89,8 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
|||||||
// PCI
|
// PCI
|
||||||
IoInitPCI();
|
IoInitPCI();
|
||||||
|
|
||||||
// Test RTL8139
|
// Network
|
||||||
pciDev_t *rtl8139_pciDev = IoPciGetDevice(0x10EC, 0x8139);
|
initRTL8139();
|
||||||
if(rtl8139_pciDev != NULL)
|
|
||||||
{
|
|
||||||
DebugLog("Network card RTL8139 found ! PCI config addr = %p\n",
|
|
||||||
rtl8139_pciDev->configAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scheduler
|
// Scheduler
|
||||||
PsInitSched();
|
PsInitSched();
|
||||||
|
Loading…
Reference in New Issue
Block a user