Kernel and buildscript improvements (#477)
* **New Features** * Centralized module management with global symbol resolution * Level-aware logging with colored prefixes and millisecond timestamps * **Breaking Changes** * ModuleParent hierarchy and getModuleParent() removed * Logging API and adapter model replaced; LogLevel-driven log_generic signature changed * **Improvements** * Unified, simplified module registration across build targets * Tests updated to reflect new module lifecycle and global symbol resolution
This commit is contained in:
committed by
GitHub
parent
1a61eac8e0
commit
a935410f82
@@ -10,7 +10,7 @@
|
||||
#include <tactility/error.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
#define TAG LOG_TAG(driver)
|
||||
#define TAG "driver"
|
||||
|
||||
struct DriverPrivate {
|
||||
Mutex mutex { 0 };
|
||||
@@ -30,21 +30,11 @@ struct DriverLedger {
|
||||
std::vector<Driver*> drivers;
|
||||
Mutex mutex { 0 };
|
||||
|
||||
DriverLedger() {
|
||||
mutex_construct(&mutex);
|
||||
}
|
||||
DriverLedger() { mutex_construct(&mutex); }
|
||||
~DriverLedger() { mutex_destruct(&mutex); }
|
||||
|
||||
~DriverLedger() {
|
||||
mutex_destruct(&mutex);
|
||||
}
|
||||
|
||||
void lock() {
|
||||
mutex_lock(&mutex);
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
mutex_unlock(&mutex);
|
||||
}
|
||||
void lock() { mutex_lock(&mutex); }
|
||||
void unlock() { mutex_unlock(&mutex); }
|
||||
};
|
||||
|
||||
static DriverLedger& get_ledger() {
|
||||
@@ -99,6 +89,8 @@ error_t driver_add(Driver* driver) {
|
||||
error_t driver_remove(Driver* driver) {
|
||||
LOG_I(TAG, "remove %s", driver->name);
|
||||
|
||||
if (driver->owner == nullptr) return ERROR_NOT_ALLOWED;
|
||||
|
||||
ledger.lock();
|
||||
const auto iterator = std::ranges::find(ledger.drivers, driver);
|
||||
if (iterator == ledger.drivers.end()) {
|
||||
|
||||
Reference in New Issue
Block a user