Register the minidriver with the system
int mdriver_add(char *name,
int interrupt,
int (*handler)( int state,
void *data),
paddr32_t data_paddr,
unsigned data_size)
- name
- An arbitrary character string used for identification purposes.
- interrupt
- The interrupt that you want to attach to.
- handler
- A pointer to the handler function for the minidriver.
“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.
libc
This function registers the minidriver with the system, as follows:
- It checks the interrupt number to make sure it's valid, so you must call
init_intrinfo()
to add the interrupt information to the system page before you can register a minidriver.
For more information, see the Customizing Image Startup Programs chapter of Building Embedded Systems.
 |
If the interrupt number isn't valid, mdriver_add() crashes the system.
|
- It calls the handler with a state of MDRIVER_INIT and the virtual address that corresponds
to the physical address given by data_paddr.
- It adds an entry of type
mdriver_entry
to the mdriver section of the system page.
You call mdriver_add() from main() in your board's startup code.
The index into the mdriver section of the system page for
the newly added minidriver, or -1 if the minidriver wasn't added.
QNX Neutrino
The Safety information below is “Not applicable” because
the OS isn't even running when you call mdriver_add().
Safety: | |
Interrupt handler |
Not applicable |
Signal handler |
Not applicable |
Thread |
Not applicable |