mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-31 16:57:58 +00:00
Update drivers after the new DAPI
This commit is contained in:
parent
a3769735bc
commit
31c0898bff
@ -4,6 +4,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -16,6 +17,7 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.TypeFlags = FexDriverInputTypes_None,
|
||||
.OverrideOnConflict = false,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_PCI,
|
||||
.PCI = {
|
||||
@ -99,13 +101,20 @@ int CallbackHandler(KernelCallback *Data)
|
||||
DescriptorList = (BufferDescriptorList *)KAPI->Memory.RequestPage((sizeof(BufferDescriptorList) * DescriptorListLength) / KAPI->Memory.PageSize + 1);
|
||||
KAPI->Util.memset(DescriptorList, 0, sizeof(BufferDescriptorList) * DescriptorListLength);
|
||||
|
||||
uint16_t DLSampleCount = KAPI->Memory.PageSize / SampleSize;
|
||||
char DLLogBuffer[128];
|
||||
for (int i = 0; i < DescriptorListLength; i++)
|
||||
{
|
||||
DescriptorList[i] = {
|
||||
.Address = (uint32_t)(uint64_t)KAPI->Memory.RequestPage(sizeof(uint16_t *) / KAPI->Memory.PageSize + 1),
|
||||
.SampleCount = (uint16_t)(KAPI->Memory.PageSize / SampleSize),
|
||||
.Flags = 0,
|
||||
};
|
||||
int DescriptorPages = sizeof(uint16_t *) / KAPI->Memory.PageSize + 1;
|
||||
DescriptorList[i].Address = (uint32_t)(uint64_t)KAPI->Memory.RequestPage(DescriptorPages);
|
||||
DescriptorList[i].SampleCount = DLSampleCount;
|
||||
DescriptorList[i].Flags = 0;
|
||||
KAPI->Util.sprintf(DLLogBuffer, "DescriptorList[%d] = { Address: 0x%x (%d %s), SampleCount: %d, Flags: 0x%x }",
|
||||
i,
|
||||
DescriptorList[i].Address, DescriptorPages, DescriptorPages == 1 ? "page" : "pages",
|
||||
DescriptorList[i].SampleCount,
|
||||
DescriptorList[i].Flags);
|
||||
print(DLLogBuffer);
|
||||
}
|
||||
|
||||
outw(BAR.MixerAddress + NAM_MasterVolume, MixerVolume(Volume, Volume, Mute));
|
||||
@ -236,10 +245,19 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
case SendReason:
|
||||
{
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
KAPI->Util.Sleep(1000);
|
||||
return OK;
|
||||
unsigned char *Buffer = (unsigned char *)Data->AudioCallback.Send.Data;
|
||||
unsigned int Length = Data->AudioCallback.Send.Length;
|
||||
|
||||
if (Length % (SampleSize * Channels))
|
||||
if (Buffer == nullptr)
|
||||
{
|
||||
print("Invalid buffer.");
|
||||
return INVALID_DATA;
|
||||
}
|
||||
|
||||
if ((Length == 0) || (Length % (SampleSize * Channels)))
|
||||
{
|
||||
print("Invalid buffer length.");
|
||||
return INVALID_DATA;
|
||||
@ -270,11 +288,8 @@ int CallbackHandler(KernelCallback *Data)
|
||||
{
|
||||
long SampleCount = DescriptorList[(CurrentBDL + 1) % DescriptorListLength].SampleCount / Channels;
|
||||
if (SampleCount > 0)
|
||||
{
|
||||
// KAPI->Util.Sleep(SampleCount * 1000000 / SampleRate); // microseconds
|
||||
KAPI->Util.Sleep(SampleCount * 1000 / SampleRate); // milliseconds
|
||||
}
|
||||
}
|
||||
|
||||
} while (RemainingBDL >= DescriptorListLength - 1 && !(inw(BAR.BusMasterAddress + PCMOUT_Status) & TC_DMAControllerControl));
|
||||
}
|
||||
@ -294,7 +309,7 @@ int CallbackHandler(KernelCallback *Data)
|
||||
|
||||
do
|
||||
{
|
||||
int Wrote = ((KAPI->Memory.PageSize > Length) ? Length : KAPI->Memory.PageSize);
|
||||
int Wrote = (KAPI->Memory.PageSize > Length) ? Length : KAPI->Memory.PageSize;
|
||||
|
||||
if (Wrote == 0)
|
||||
break;
|
||||
@ -343,9 +358,17 @@ int CallbackHandler(KernelCallback *Data)
|
||||
print("Driver stopped.");
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
default:
|
||||
{
|
||||
break; // Not working as expected
|
||||
print("Unknown reason.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
uint16_t Status = inw(BAR.MixerAddress + PCMOUT_Status);
|
||||
|
||||
if (Status & TC_IOCInterruptEnable)
|
||||
@ -370,13 +393,5 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
|
||||
outw(BAR.MixerAddress + PCMOUT_Status, 0xFFFF);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
print("Unknown reason.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
/* The driver is
|
||||
* This is a driver for Fennix Driver Entry Extended Header
|
||||
@ -18,10 +19,11 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.Name = "Example Driver",
|
||||
.Type = FexDriverType_Generic,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_INTERRUPT,
|
||||
.Interrupt = {
|
||||
.Vector = {0xFF},
|
||||
.Vector = {222}, // IRQ222
|
||||
}}}};
|
||||
|
||||
// Global variable that holds the kernel API
|
||||
@ -61,11 +63,6 @@ int CallbackHandler(KernelCallback *Data)
|
||||
print("Kernel acknowledged the driver.");
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
{
|
||||
print("Interrupt received.");
|
||||
break;
|
||||
}
|
||||
case StopReason:
|
||||
{
|
||||
print("Driver stopped.");
|
||||
@ -79,3 +76,9 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
print("Interrupt received.");
|
||||
return OK;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -18,10 +19,11 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.TypeFlags = FexDriverInputTypes_Mouse,
|
||||
.OverrideOnConflict = false,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_INTERRUPT,
|
||||
.Interrupt = {
|
||||
.Vector = {0xC}, // IRQ12
|
||||
.Vector = {12}, // IRQ12
|
||||
}}}};
|
||||
|
||||
KernelAPI *KAPI;
|
||||
@ -156,8 +158,17 @@ int CallbackHandler(KernelCallback *Data)
|
||||
print("Driver stopped.");
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
default:
|
||||
{
|
||||
print("Unknown reason.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
uint8_t Data = inb(0x60);
|
||||
|
||||
if (__builtin_expect(!!(PacketReady), 0))
|
||||
@ -263,13 +274,5 @@ int CallbackHandler(KernelCallback *Data)
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
print("Unknown reason.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -18,10 +19,11 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.TypeFlags = FexDriverInputTypes_Mouse,
|
||||
.OverrideOnConflict = true,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_INTERRUPT,
|
||||
.Interrupt = {
|
||||
.Vector = {0xC}, // IRQ12
|
||||
.Vector = {12}, // IRQ12
|
||||
}}}};
|
||||
|
||||
KernelAPI *KAPI;
|
||||
@ -240,8 +242,17 @@ int CallbackHandler(KernelCallback *Data)
|
||||
print("Driver stopped.");
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
default:
|
||||
{
|
||||
print("Unknown reason.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
uint8_t Data = inb(0x60);
|
||||
(void)Data;
|
||||
VMwareCommand cmd;
|
||||
@ -269,14 +280,5 @@ int CallbackHandler(KernelCallback *Data)
|
||||
MouseX = cmd.bx; /* Both X and Y are scaled from 0 to 0xFFFF */
|
||||
MouseY = cmd.cx; /* You should map these somewhere to the actual resolution. */
|
||||
MouseZ = (int8_t)cmd.dx; /* Z is a single signed byte indicating scroll direction. */
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
print("Unknown reason.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -18,6 +19,7 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.TypeFlags = FexDriverInputTypes_Mouse,
|
||||
.OverrideOnConflict = true,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_PCI,
|
||||
.PCI = {
|
||||
@ -78,11 +80,6 @@ int CallbackHandler(KernelCallback *Data)
|
||||
{
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@ -90,3 +87,8 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -17,6 +18,7 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.Name = "AMD PCNET",
|
||||
.Type = FexDriverType_Network,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_PCI,
|
||||
.PCI = {
|
||||
@ -114,10 +116,6 @@ int CallbackHandler(KernelCallback *Data)
|
||||
Data->NetworkCallback.Fetch.MAC = MAC.ToHex();
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case SendReason:
|
||||
{
|
||||
break;
|
||||
@ -136,3 +134,8 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -17,6 +18,7 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.Name = "Intel Gigabit Ethernet Controller",
|
||||
.Type = FexDriverType_Network,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_PCI,
|
||||
.PCI = {
|
||||
@ -469,24 +471,6 @@ int CallbackHandler(KernelCallback *Data)
|
||||
Data->NetworkCallback.Fetch.MAC = MAC.ToHex();
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
{
|
||||
WriteCMD(REG::IMASK, 0x1);
|
||||
uint32_t status = ReadCMD(0xC0);
|
||||
UNUSED(status);
|
||||
|
||||
while ((RX[RXCurrent]->Status & 0x1))
|
||||
{
|
||||
uint8_t *Data = (uint8_t *)RX[RXCurrent]->Address;
|
||||
uint16_t DataLength = RX[RXCurrent]->Length;
|
||||
KAPI->Command.Network.ReceivePacket(KAPI->Info.DriverUID, Data, DataLength);
|
||||
RX[RXCurrent]->Status = 0;
|
||||
uint16_t OldRXCurrent = RXCurrent;
|
||||
RXCurrent = (RXCurrent + 1) % E1000_NUM_RX_DESC;
|
||||
WriteCMD(REG::RXDESCTAIL, OldRXCurrent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SendReason:
|
||||
{
|
||||
TX[TXCurrent]->Address = (uint64_t)Data->NetworkCallback.Send.Data;
|
||||
@ -532,3 +516,22 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
WriteCMD(REG::IMASK, 0x1);
|
||||
uint32_t status = ReadCMD(0xC0);
|
||||
UNUSED(status);
|
||||
|
||||
while ((RX[RXCurrent]->Status & 0x1))
|
||||
{
|
||||
uint8_t *Data = (uint8_t *)RX[RXCurrent]->Address;
|
||||
uint16_t DataLength = RX[RXCurrent]->Length;
|
||||
KAPI->Command.Network.ReceivePacket(KAPI->Info.DriverUID, Data, DataLength);
|
||||
RX[RXCurrent]->Status = 0;
|
||||
uint16_t OldRXCurrent = RXCurrent;
|
||||
RXCurrent = (RXCurrent + 1) % E1000_NUM_RX_DESC;
|
||||
WriteCMD(REG::RXDESCTAIL, OldRXCurrent);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -17,6 +18,7 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.Name = "RTL8139",
|
||||
.Type = FexDriverType_Network,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_PCI,
|
||||
.PCI = {
|
||||
@ -173,23 +175,6 @@ int CallbackHandler(KernelCallback *Data)
|
||||
Data->NetworkCallback.Fetch.MAC = MAC.ToHex();
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
{
|
||||
uint16_t Status = RTLIW(0x3E);
|
||||
UNUSED(Status);
|
||||
|
||||
uint16_t *Data = (uint16_t *)(RXBuffer + CurrentPacket);
|
||||
uint16_t DataLength = *(Data + 1);
|
||||
Data = Data + 2;
|
||||
KAPI->Command.Network.ReceivePacket(KAPI->Info.DriverUID, (uint8_t *)Data, DataLength);
|
||||
CurrentPacket = (CurrentPacket + DataLength + 4 + 3) & (~3);
|
||||
if (CurrentPacket > 8192)
|
||||
CurrentPacket -= 8192;
|
||||
RTLOW(0x38, CurrentPacket - 0x10);
|
||||
|
||||
RTLOW(0x3E, (1 << 0) | (1 << 2));
|
||||
break;
|
||||
}
|
||||
case SendReason:
|
||||
{
|
||||
RTLOL(TSAD[TXCurrent], static_cast<uint32_t>(reinterpret_cast<uint64_t>(Data->NetworkCallback.Send.Data)));
|
||||
@ -212,3 +197,21 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
uint16_t Status = RTLIW(0x3E);
|
||||
UNUSED(Status);
|
||||
|
||||
uint16_t *Data = (uint16_t *)(RXBuffer + CurrentPacket);
|
||||
uint16_t DataLength = *(Data + 1);
|
||||
Data = Data + 2;
|
||||
KAPI->Command.Network.ReceivePacket(KAPI->Info.DriverUID, (uint8_t *)Data, DataLength);
|
||||
CurrentPacket = (CurrentPacket + DataLength + 4 + 3) & (~3);
|
||||
if (CurrentPacket > 8192)
|
||||
CurrentPacket -= 8192;
|
||||
RTLOW(0x38, CurrentPacket - 0x10);
|
||||
|
||||
RTLOW(0x3E, (1 << 0) | (1 << 2));
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -17,6 +18,7 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.Name = "RTL8169",
|
||||
.Type = FexDriverType_Network,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_PCI,
|
||||
.PCI = {
|
||||
@ -84,10 +86,6 @@ int CallbackHandler(KernelCallback *Data)
|
||||
Data->NetworkCallback.Fetch.MAC = MAC.ToHex();
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case SendReason:
|
||||
{
|
||||
break;
|
||||
@ -106,3 +104,8 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -17,6 +18,7 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.Name = "Virtio Network",
|
||||
.Type = FexDriverType_Network,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_PCI,
|
||||
.PCI = {
|
||||
@ -84,10 +86,6 @@ int CallbackHandler(KernelCallback *Data)
|
||||
Data->NetworkCallback.Fetch.MAC = MAC.ToHex();
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case SendReason:
|
||||
{
|
||||
break;
|
||||
@ -106,3 +104,8 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -17,6 +18,7 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.Name = "AHCI",
|
||||
.Type = FexDriverType_Storage,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_PCI,
|
||||
.PCI = {
|
||||
@ -500,3 +502,9 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *)
|
||||
{
|
||||
/* There's no need to do anything here. */
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
extern "C" int DriverEntry(void *Data);
|
||||
int CallbackHandler(KernelCallback *Data);
|
||||
int InterruptCallback(CPURegisters *Registers);
|
||||
|
||||
HEAD(FexFormatType_Driver, FexOSType_Fennix, DriverEntry);
|
||||
|
||||
@ -17,10 +18,11 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
|
||||
.Name = "ATA",
|
||||
.Type = FexDriverType_Storage,
|
||||
.Callback = CallbackHandler,
|
||||
.InterruptCallback = InterruptCallback,
|
||||
.Bind = {
|
||||
.Type = BIND_INTERRUPT,
|
||||
.Interrupt = {
|
||||
.Vector = {0xE, 0xF}, // IRQ14, IRQ15
|
||||
.Vector = {14, 15}, // IRQ14, IRQ15
|
||||
}}}};
|
||||
|
||||
KernelAPI *KAPI;
|
||||
@ -57,18 +59,6 @@ int CallbackHandler(KernelCallback *Data)
|
||||
{
|
||||
break;
|
||||
}
|
||||
case InterruptReason:
|
||||
{
|
||||
if (Data->InterruptInfo.Vector == 0xE)
|
||||
{
|
||||
print("IRQ14");
|
||||
}
|
||||
else if (Data->InterruptInfo.Vector == 0xF)
|
||||
{
|
||||
print("IRQ15");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SendReason:
|
||||
case ReceiveReason:
|
||||
{
|
||||
@ -88,3 +78,16 @@ int CallbackHandler(KernelCallback *Data)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int InterruptCallback(CPURegisters *Registers)
|
||||
{
|
||||
if (Registers->InterruptNumber == 0xE)
|
||||
{
|
||||
print("IRQ14");
|
||||
}
|
||||
else if (Registers->InterruptNumber == 0xF)
|
||||
{
|
||||
print("IRQ15");
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user