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 interrupt that you want to attach the handler to.
handler
A pointer to the handler function for the minidriver. For more information, see "Handler function" in the Writing a Minidriver chapter.
data_paddr
The physical address of a block of memory that the minidriver can use to store any data. It can be:
  • a predetermined location (e.g., one that you reserved beforehand by passing the -r addr,size[,flag] option to startup)
  • a block that you allocated by calling the alloc_ram() startup function

The virtual address of this block is passed to the handler function as its data argument.

data_size
The size of the block of memory denoted by data_paddr.

Library:

libc

Description:

This function registers the minidriver with the system, as follows:

You call mdriver_add() from main() in your board's startup code.

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:

QNX Neutrino