Kernel improvements (#485)

* **New Features**
  * Added public accessors for querying module/device start and ready state.

* **Refactor**
  * Internal state moved to opaque internal objects; module/device/driver initializers now explicitly initialize internal pointers.
  * Lifecycle handling updated to construct/destruct internal state and use accessors.

* **Tests**
  * Tests updated to use public accessors and explicit construct/destruct lifecycle calls.

* **Chores**
  * Test build/include paths and small metadata updated.
This commit is contained in:
Ken Van Hoeylandt
2026-02-06 16:32:30 +01:00
committed by GitHub
parent 1757af859c
commit 79e43b093a
105 changed files with 338 additions and 331 deletions
@@ -14,7 +14,7 @@ struct HalDevicePrivate {
std::shared_ptr<tt::hal::Device> halDevice;
};
#define GET_DATA(device) ((struct HalDevicePrivate*)device->internal.driver_data)
#define GET_DATA(device) ((HalDevicePrivate*)device_get_driver_data(device))
static enum HalDeviceType getHalDeviceType(tt::hal::Device::Type type) {
switch (type) {
@@ -94,7 +94,9 @@ void hal_device_set_device(::Device* kernelDevice, std::shared_ptr<Device> halDe
static error_t start(Device* device) {
LOG_I(TAG, "start %s", device->name);
device->internal.driver_data = new HalDevicePrivate();
auto hal_device_data = new(std::nothrow) HalDevicePrivate();
if (hal_device_data == nullptr) return ERROR_OUT_OF_MEMORY;
device_set_driver_data(device, hal_device_data);
return ERROR_NONE;
}
@@ -120,7 +122,7 @@ Driver hal_device_driver = {
.api = nullptr,
.device_type = &HAL_DEVICE_TYPE,
.owner = &hal_device_module,
.driver_private = nullptr
.internal = nullptr
};
}