include/modules.h File Reference


Detailed Description

Module Handling and Loader Definitions.

Author:
John Hodge (thePowersGang)

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_MAX
}
 

Return values for tModule.Init.

More...

Functions

int Module_RegisterLoader (tModuleLoader *Loader)
 Registers a tModuleLoader with the kernel.

Define Documentation

#define MODULE_DEFINE ( _flags,
_ver,
_ident,
_entry,
_deinit,
_deps...   ) 
Value:
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.

Parameters:
_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.

Enumeration Type Documentation

Return values for tModule.Init.

Enumerator:
MODULE_ERR_OK 

No Error.

MODULE_ERR_MISC 

Misc Error.

MODULE_ERR_NOTNEEDED 

Module not needed.

MODULE_ERR_MALLOC 

Error with malloc/realloc/calloc.

MODULE_ERR_MAX 

Maximum defined error code.


Function Documentation

int Module_RegisterLoader ( tModuleLoader Loader  ) 

Registers a tModuleLoader with the kernel.

Parameters:
Loader Pointer to loader structure (must be persistent)
Returns:
Boolean Success
Generated on Sun May 16 19:24:09 2010 for Acess2 by  doxygen 1.6.3