Module Handling and Loader Definitions.
This file serves two pourposes. First it defines the format for native Acess2 modules and the functions to create them. Second, it defines the structure and register function for new module loaders, allowing Acess to understand many different module / driver formats.
Modules are defined by including this file in the module's main source file and using the MODULE_DEFINE macro to create the module header.
To register a new module loader with the kernel, the loader module must create and populate an instance of tModuleLoader then pass it to Module_RegisterLoader
Go to the source code of this file.
Data Structures | |
struct | tModule |
Module header. More... | |
struct | tModuleLoader |
Module Loader definition. More... | |
Defines | |
#define | MODULE_MAGIC ('A'|('M'<<8)|('D'<<16)|('\2'<<24)) |
Module header magic value. | |
#define | MODULE_ARCH_ID 1 |
Architecture ID. | |
#define | MODULE_DEFINE(_flags, _ver, _ident, _entry, _deinit, _deps...) |
Define a module. | |
Enumerations | |
enum | eModuleErrors { MODULE_ERR_OK, MODULE_ERR_MISC, MODULE_ERR_NOTNEEDED, MODULE_ERR_MALLOC, MODULE_ERR_BADMODULE, MODULE_ERR_MAX } |
Return values for tModule.Init. More... | |
Functions | |
int | Module_RegisterLoader (tModuleLoader *Loader) |
Registers a tModuleLoader with the kernel. | |
int | Modules_InitialiseBuiltin (const char *Name) |
Initialise a named builtin module. |
#define MODULE_DEFINE | ( | _flags, | |||
_ver, | |||||
_ident, | |||||
_entry, | |||||
_deinit, | |||||
_deps... | ) |
char *EXPAND_CONCAT(_DriverDeps_,_ident)[]={_deps};\ tModule __attribute__ ((section ("KMODULES"),unused))\ EXPAND_CONCAT(_DriverInfo_,_ident)=\ {MODULE_MAGIC,MODULE_ARCH_ID,_flags,_ver,NULL,EXPAND_STR(_ident),\ _entry,_deinit,EXPAND_CONCAT(_DriverDeps_,_ident)}
Define a module.
_flags | Module Flags | |
_ver | Module Version | |
_ident | Unique Module Name | |
_entry | Module initialiser / entrypoint | |
_deinit | Module cleanup / unloader | |
_deps | NULL terminated list of this's module's dependencies Contains the identifiers of the required modules. |
enum eModuleErrors |
Return values for tModule.Init.
int Module_RegisterLoader | ( | tModuleLoader * | Loader | ) |
Registers a tModuleLoader with the kernel.
Loader | Pointer to loader structure (must be persistent) |
int Modules_InitialiseBuiltin | ( | const char * | Name | ) |
Initialise a named builtin module.
Name | Module name to initialise |