Add drivers to module and make start/stop optional (#580)

This commit is contained in:
Ken Van Hoeylandt
2026-07-23 23:28:09 +02:00
committed by GitHub
parent 08eac48e64
commit 429125734a
131 changed files with 488 additions and 2381 deletions
+10 -4
View File
@@ -26,6 +26,7 @@ struct ModuleSymbol {
const void* symbol;
};
struct Driver;
struct ModuleInternal;
/**
@@ -40,18 +41,23 @@ struct Module {
*/
const char* name;
/**
* A function to initialize the module.
* Should never be NULL.
* A function to initialize the module, or NULL.
* This can be used to load drivers, initialize hardware, etc.
* @return ERROR_NONE if successful
*/
error_t (*start)(void);
/**
* Deinitializes the module.
* Should never be NULL.
* A function to deinitialize the module, or NULL.
* @return ERROR_NONE if successful
*/
error_t (*stop)(void);
/**
* An array of driver pointers, or NULL.
* The list must be NULL-terminated.
* When the module is started, these drivers are constructed and added to the module.
* When the module is stopped, these drivers are removed from the module and destroyed.
*/
struct Driver* const* drivers;
/**
* A list of symbols exported by the module.
* Should be terminated by MODULE_SYMBOL_TERMINATOR.