mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-13 00:09:19 +00:00
.github
.vscode
Architecture
Core
Crash
Driver
DriverBinding
Input
Audio.cpp
Display.cpp
Filesystem.cpp
Generic.cpp
Input.cpp
Network.cpp
Storage.cpp
Interrupt
PCI
Process
BindInput.cpp
BindInterrupt.cpp
BindPCI.cpp
BindProcess.cpp
Driver.cpp
DriverAPI.cpp
api.hpp
Memory
Time
Video
CPU.cpp
Debugger.cpp
Disk.cpp
InterruptsManager.cpp
Lock.cpp
PeripheralComponentInterconnect.cpp
Power.cpp
README.md
Random.cpp
StackCheck.cpp
Symbols.cpp
SystemManagementBIOS.cpp
UndefinedBehaviorSanitization.c
UniversalAsynchronousReceiverTransmitter.cpp
crashhandler.hpp
smbios.hpp
ubsan.h
Execute
FileSystem
Files
GUI
Library
Network
Profiling
Recovery
SystemCalls
Tasking
Tests
include
include_std
.gitignore
DAPI.hpp
Doxyfile
Fex.hpp
Kernel.cpp
KernelConfig.cpp
KernelThread.cpp
LICENSE
Makefile
README.md
dump.sh
ipc.h
kernel.h
syscalls.h
68 lines
2.2 KiB
C++
68 lines
2.2 KiB
C++
/*
|
|
This file is part of Fennix Kernel.
|
|
|
|
Fennix Kernel 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 (at your option) any later version.
|
|
|
|
Fennix Kernel 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 Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "../../api.hpp"
|
|
|
|
#include <ints.hpp>
|
|
#include <memory.hpp>
|
|
#include <task.hpp>
|
|
#include <lock.hpp>
|
|
#include <printf.h>
|
|
#include <cwalk.h>
|
|
#include <md5.h>
|
|
|
|
#include "../../../../kernel.h"
|
|
#include "../../../../DAPI.hpp"
|
|
#include "../../../../Fex.hpp"
|
|
|
|
namespace Driver
|
|
{
|
|
DriverCode Driver::BindInputInput(Memory::MemMgr *mem, void *fex)
|
|
{
|
|
FexExtended *fexExtended = (FexExtended *)((uintptr_t)fex + EXTENDED_SECTION_ADDRESS);
|
|
KernelCallback KCallback{};
|
|
|
|
fixme("Input driver: %s", fexExtended->Driver.Name);
|
|
KCallback.RawPtr = nullptr;
|
|
KCallback.Reason = CallbackReason::ConfigurationReason;
|
|
int CallbackRet = ((int (*)(KernelCallback *))((uintptr_t)fexExtended->Driver.Callback + (uintptr_t)fex))(&KCallback);
|
|
if (CallbackRet == DriverReturnCode::NOT_IMPLEMENTED)
|
|
{
|
|
delete mem, mem = nullptr;
|
|
error("Driver %s is not implemented", fexExtended->Driver.Name);
|
|
return DriverCode::NOT_IMPLEMENTED;
|
|
}
|
|
else if (CallbackRet != DriverReturnCode::OK)
|
|
{
|
|
delete mem, mem = nullptr;
|
|
error("Driver %s returned error %d", fexExtended->Driver.Name, CallbackRet);
|
|
return DriverCode::DRIVER_RETURNED_ERROR;
|
|
}
|
|
|
|
fixme("Input driver: %s", fexExtended->Driver.Name);
|
|
|
|
DriverFile DrvFile = {
|
|
.Enabled = true,
|
|
.DriverUID = this->DriverUIDs - 1,
|
|
.Address = (void *)fex,
|
|
.MemTrk = mem,
|
|
};
|
|
Drivers.push_back(DrvFile);
|
|
return DriverCode::OK;
|
|
}
|
|
}
|