Register the minidriver with the system
int mdriver_add(char *name,
int (*handler)( int state,
- An arbitrary character string used for identification purposes.
- The interrupt that you want to attach to.
- A pointer to the handler function for the minidriver.
in the Writing a Minidriver chapter.
- 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
option to startup)
- a block that you allocated by calling the
The virtual address of this block is passed to the handler function as its data argument.
- The size of the block of memory denoted by data_paddr.
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
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
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.
The Safety information below is “Not applicable” because
the OS isn't even running when you call mdriver_add().