introduce a stable NTL_DDK driver ABI to replace direct HAL_API and kernel-header access in drivers, add code/kernel/io_ddk.c and code/public/ntlite/ddk/ headers, change DriverEntry to take (const NTL_DDK*, NTL_DRIVER_INIT*), update kmain to build the DDK once via IoInitializeDdk/IoGetDdk and hand it to both boot and runtime drivers, downgrade code/public/ntlite/ddi/io_driver.h to a legacy I/O model header pulling from ntlite/ddk instead of kernel internals, move code/third_party/lwip into code/drivers/net/lwip/third_party, fix up lwip_sources.txt and build.c include paths to match, split build.c's single CFLAGS macro into COMMON/KERNEL/USER/BOOT/DRIVER cflags.

This commit is contained in:
maksw committed 2026-07-01 23:19:11 +02:00
1 parent 08329516ba
commit 485a6bbfe7
385 files changed
+1822 -1079

No files matched your search

+11 -10
View File
@@ -2,7 +2,7 @@
#include "rtl816x.h"
const HAL_API* gHal;
const NTL_DDK* gRtl816xDdk;
static DRIVER_OBJECT gRtl816xDriver;
static RTL816X_DEVICE* gRtl816xDevices[RTL816X_MAX_DEVICES];
static uint32_t gRtl816xDeviceCount;
@@ -70,8 +70,8 @@ static KSTATUS RtlReset(RTL816X_DEVICE* r) {
for (uint32_t i = 0; i < 1000; i++) {
if ((RtlRead8(r, RTL_REG_CHIP_CMD) & RTL_CMD_RESET) == 0)
return NTLSTATUS_SUCCESS;
if (gHal->Timer.Stall)
gHal->Timer.Stall(1000);
if (gRtl816xDdk->Timer->Stall)
gRtl816xDdk->Timer->Stall(1000);
}
return NTLSTATUS_TIMEOUT;
}
@@ -93,10 +93,10 @@ static KSTATUS RtlAllocateDma(RTL816X_DEVICE* r) {
if (!r->RxRingPhys || !r->TxRingPhys || !r->RxBuffersPhys || !r->TxBuffersPhys)
return NTLSTATUS_NO_MEMORY;
r->RxRing = (RTL_DESC*)gHal->PhysToVirt(r->RxRingPhys);
r->TxRing = (RTL_DESC*)gHal->PhysToVirt(r->TxRingPhys);
r->RxBuffers = (uint8_t*)gHal->PhysToVirt(r->RxBuffersPhys);
r->TxBuffers = (uint8_t*)gHal->PhysToVirt(r->TxBuffersPhys);
r->RxRing = (RTL_DESC*)gRtl816xDdk->Memory->PhysToVirt(r->RxRingPhys);
r->TxRing = (RTL_DESC*)gRtl816xDdk->Memory->PhysToVirt(r->TxRingPhys);
r->RxBuffers = (uint8_t*)gRtl816xDdk->Memory->PhysToVirt(r->RxBuffersPhys);
r->TxBuffers = (uint8_t*)gRtl816xDdk->Memory->PhysToVirt(r->TxBuffersPhys);
memset(r->RxRing, 0, PAGE_SIZE * RTL_RING_PAGES);
memset(r->TxRing, 0, PAGE_SIZE * RTL_RING_PAGES);
@@ -559,12 +559,13 @@ KSTATUS Rtl816xAddDevice(DRIVER_OBJECT* driver, DEVICE_OBJECT* physicalDeviceObj
}
// Implements the driver Entry operation.
KSTATUS DriverEntry(const HAL_API* hal) {
if (!hal)
KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
(void)init;
if (!ddk || !ddk->Memory || !ddk->Memory->PhysToVirt || !ddk->Timer)
return NTLSTATUS_INVALID_PARAMETER;
DbgPrint("RTL816X: driver loading...\n");
gHal = hal;
gRtl816xDdk = ddk;
gRtl816xDeviceCount = 0;
memset(&gRtl816xDriver, 0, sizeof(gRtl816xDriver));