Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/ida_tdk_en/appl_note/mdriver_add.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/ida_tdk_en/appl_note/mdriver_add.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/ida_tdk_en/appl_note/mdriver_add.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/ida_tdk_en/appl_note/mdriver_add.html on line 8

mdriver_add()

Register the minidriver with the system

Synopsis:

int mdriver_add(char *name,
                int interrupt,
                int (*handler)(int state, void *data), 
                               paddr32_t data_paddr, 
                               unsigned data_size)

Arguments:

name
An arbitrary character string used for identification purposes.
interrupt
The same value that is passed into InterruptAttach() to attach to a particular interrupt. It's first checked to make sure it's a valid number, so you must do an init_intrinfo() to add the interrupt information to the system page before you can register a minidriver. (See the Customizing Image Startup Programs chapter of Building Embedded Systems).
handler
This minidriver function is called at various times for the user to check the device. Do not assume that just because the handler has been called that the device actually needs servicing.
data_paddr
A physical address of a block of memory that is made available to the minidriver. It can be a predetermined location, or the user could use the alloc_ram() startup function to obtain the memory.
data_size
The size of the block of memory denoted by data_paddr.

Library:

libc

Description:

This function registers the minidriver with the system.

mdriver_handler()

It's the prototype of your handler function. This function registers the minidriver with the system. The prototype is:

int mdriver_handler(int state, void *data);

The arguments are:

state
Indicates when the handler is being called. It can have one of the following values:
MDRIVER_INIT
The driver is being initialized, called from mdriver_add(). The handler is called with this state only once.
MDRIVER_STARTUP
The driver is being called from somewhere in startup.
MDRIVER_STARTUP_PREPARE
Preparations must take place for minidriver operation outside of startup environment.
MDRIVER_STARTUP_FINI
The last call to the driver from within the startup.
MDRIVER_KERNEL
The driver is being called during kernel initialization
MDRIVER_PROCESS
The driver is being called during process manager/system initialization.
MDRIVER_INTR_ATTACH
A process is calling. The InterruptAttachEvent() with the same interrupt number as the minidriver.
data
A pointer that points to virtual address of the block of data provided as the data_paddr parameter of mdriver_add().

Returns:

The index into the mdriver section of the system page for the newly added minidriver, or -1 if the minidriver wasn't added.

Classification:

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes

Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/ida_tdk_en/appl_note/mdriver_add.html on line 189

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/ida_tdk_en/appl_note/mdriver_add.html on line 189