643cbc3806
- Added POSIX desktop support for SDK builds, application packaging, and integration testing. - Added POSIX filesystem partitions and improved application path handling. - Added simulator support for loading and running applications dynamically. - Improved simulator task stack handling and display startup reliability. - Improved simulator display scaling, resizing, high-DPI support, and pointer accuracy. - Fixed LVGL timers and input polling on POSIX. (fixes simulator with Linux on some Intel graphics platforms) - Standardized data paths across platforms. - Logging now works via separate task: this allows apps to write to log without it affecting their stdout (for apps that output text as relevant date for other apps, like the File Selection app) - Fixes for app stdio
93 lines
2.7 KiB
C++
93 lines
2.7 KiB
C++
#include <tactility/kernel_init.h>
|
|
|
|
#include <tactility/device.h>
|
|
#include <tactility/log.h>
|
|
#include <tactility/log_queue.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define TAG "kernel"
|
|
|
|
extern const ModuleSymbol KERNEL_SYMBOLS[];
|
|
|
|
extern Driver root_driver;
|
|
extern Driver battery_sense_driver;
|
|
extern Driver battery_sense_power_supply_driver;
|
|
extern Driver gpio_hog_driver;
|
|
extern Driver pwm_backlight_driver;
|
|
extern Driver gpio_backlight_driver;
|
|
extern Driver rgb_led_gpio_driver;
|
|
extern Driver rgb_led_pwm_driver;
|
|
|
|
/**
|
|
* @warning Because the drivers have no owning module, they cannot be unbound.
|
|
* This is fine for now because we never unload the kernel once it's loaded.
|
|
*/
|
|
static Driver* const KERNEL_DRIVERS[] = {
|
|
&root_driver,
|
|
&battery_sense_driver,
|
|
&battery_sense_power_supply_driver,
|
|
&gpio_hog_driver,
|
|
&pwm_backlight_driver,
|
|
&gpio_backlight_driver,
|
|
&rgb_led_gpio_driver,
|
|
&rgb_led_pwm_driver,
|
|
nullptr,
|
|
};
|
|
|
|
Module kernel_module = {
|
|
.name = "kernel",
|
|
.start = nullptr,
|
|
.stop = nullptr,
|
|
.drivers = KERNEL_DRIVERS,
|
|
.symbols = static_cast<const struct ModuleSymbol*>(KERNEL_SYMBOLS),
|
|
.internal = nullptr,
|
|
};
|
|
|
|
error_t kernel_init(Module* const dts_modules[], const DtsDevice dts_devices[]) {
|
|
log_queue_init();
|
|
|
|
LOG_I(TAG, "init");
|
|
|
|
if (module_construct_add_start(&kernel_module) != ERROR_NONE) {
|
|
LOG_E(TAG, "root module init failed");
|
|
return ERROR_RESOURCE;
|
|
}
|
|
|
|
Module* const* dts_module = dts_modules;
|
|
while (*dts_module != nullptr) {
|
|
if (module_construct_add_start(*dts_module) != ERROR_NONE) {
|
|
LOG_E(TAG, "dts module init failed: %s", (*dts_module)->name);
|
|
return ERROR_RESOURCE;
|
|
}
|
|
dts_module++;
|
|
}
|
|
|
|
const DtsDevice* dts_device = dts_devices;
|
|
while (dts_device->device != nullptr) {
|
|
if (dts_device->status == DTS_DEVICE_STATUS_OKAY) {
|
|
if (device_construct_add_start(dts_device->device, dts_device->compatible) != ERROR_NONE) {
|
|
LOG_E(TAG, "kernel_init failed to construct+add+start device: %s (%s)", dts_device->device->name, dts_device->compatible);
|
|
return ERROR_RESOURCE;
|
|
}
|
|
} else if (dts_device->status == DTS_DEVICE_STATUS_DISABLED) {
|
|
if (device_construct_add(dts_device->device, dts_device->compatible) != ERROR_NONE) {
|
|
LOG_E(TAG, "kernel_init failed to construct+add device: %s (%s)", dts_device->device->name, dts_device->compatible);
|
|
return ERROR_RESOURCE;
|
|
}
|
|
} else {
|
|
check(false, "DTS status not implemented");
|
|
}
|
|
dts_device++;
|
|
}
|
|
|
|
LOG_I(TAG, "init done");
|
|
return ERROR_NONE;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|