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:
committed by
GitHub
parent
1757af859c
commit
79e43b093a
@@ -123,7 +123,7 @@ Driver esp32_gpio_driver = {
|
||||
.api = (void*)&esp32_gpio_api,
|
||||
.device_type = &GPIO_CONTROLLER_TYPE,
|
||||
.owner = &platform_module,
|
||||
.driver_private = nullptr
|
||||
.internal = nullptr
|
||||
};
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -25,7 +25,7 @@ struct InternalData {
|
||||
};
|
||||
|
||||
#define GET_CONFIG(device) ((Esp32I2cConfig*)device->config)
|
||||
#define GET_DATA(device) ((InternalData*)device->internal.driver_data)
|
||||
#define GET_DATA(device) ((InternalData*)device_get_driver_data(device))
|
||||
|
||||
#define lock(data) mutex_lock(&data->mutex);
|
||||
#define unlock(data) mutex_unlock(&data->mutex);
|
||||
@@ -216,7 +216,7 @@ Driver esp32_i2c_driver = {
|
||||
.api = (void*)&esp32_i2c_api,
|
||||
.device_type = &I2C_CONTROLLER_TYPE,
|
||||
.owner = &platform_module,
|
||||
.driver_private = nullptr
|
||||
.internal = nullptr
|
||||
};
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -31,7 +31,7 @@ struct InternalData {
|
||||
};
|
||||
|
||||
#define GET_CONFIG(device) ((Esp32I2sConfig*)device->config)
|
||||
#define GET_DATA(device) ((InternalData*)device->internal.driver_data)
|
||||
#define GET_DATA(device) ((InternalData*)device_get_driver_data(device))
|
||||
|
||||
#define lock(data) mutex_lock(&data->mutex);
|
||||
#define unlock(data) mutex_unlock(&data->mutex);
|
||||
@@ -236,7 +236,7 @@ Driver esp32_i2s_driver = {
|
||||
.api = (void*)&esp32_i2s_api,
|
||||
.device_type = &I2S_CONTROLLER_TYPE,
|
||||
.owner = &platform_module,
|
||||
.driver_private = nullptr
|
||||
.internal = nullptr
|
||||
};
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -31,7 +31,8 @@ struct Module platform_module = {
|
||||
.name = "platform-esp32",
|
||||
.start = start,
|
||||
.stop = stop,
|
||||
.symbols = nullptr
|
||||
.symbols = nullptr,
|
||||
.internal = nullptr
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ struct Module platform_module = {
|
||||
.name = "platform-posix",
|
||||
.start = start,
|
||||
.stop = stop,
|
||||
.symbols = nullptr
|
||||
.symbols = nullptr,
|
||||
.internal = nullptr
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user