SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
AMIGA - MOD_#?
----------------------------------------------------------------------------
NAME
mod_addmodule() - Create and add module to the system.
SYNOPSIS
ptr = mod_addmodule(af);
void *mod_addmodule(struct mod_ade_feed *);
FUNCTION
With this function custom module creation is no longer
heavy magic. All you have to do is to pass proper args
and youre done.
INPUTS
af - Module feed structure.
RETURNS
Returns pointer to the allocation/module or NULL if no
success.
BASES
SysBase
NOTES
'struct mod_ade_feed' is described in the header file.
Dummy(no real life code/data) modules can be created
by supplying 0 to 'af_dataptr' and/or 'af_datalen'.
If you want to allocate just the space in the module
then supply 'af_dataptr' with NULL and pick the amount
of memory your module should have by supplying it to
'af_datalen'(min 4 bytes). Also remeber that the dummy
code will occupy first 4 bytes!
SEE ALSO
mod_delmodule()
EXAMPLE
...
#include <qdev.h>
...
struct mod_ade_feed af;
void *modptr;
af.af_memflags = MEMF_LOCAL;
af.af_memstart = QDEV_MOD_ADE_24BITLOWER;
af.af_memend = QDEV_MOD_ADE_24BITUPPER;
af.af_dataptr = NULL;
af.af_datalen = 0;
af.af_rtflags = RTF_COLDSTART;
af.af_type = NT_UNKNOWN;
af.af_pri = 0;
af.af_ver = 0;
af.af_nameptr = "dummymodule";
af.af_idstrptr = "dummymodule 0.0 (Today)";
if ((modptr = mod_addmodule(&af)))
{
/*
* Pressing Ctrl-E unloads the module. If you reboot
* at this point then the module will be initialised
* at startup.
*/
Wait(SIGBREAKF_CTRL_E);
mod_delmodule(modptr);
}
BUGS
None known.
----------------------------------------------------------------------------
|