Customizing the startup program to include your minidriver
You need to modify the startup code in the BSP's main.c file in order to set up the minidriver's data area, register the handler function, and so on. Depending on what your minidriver needs to do, you might have to do the following:
- Declare the prototype for your minidriver's handler function.
For example:
extern int mini_data(int state, void *data); - Call init_raminfo(), to determine the location and size of available system RAM.
- Allocate the required system RAM for your data area by calling
alloc_ram().
For example:
/* Global variable: */ paddr_t mdriver_addr; /* Allocate 64 KB of memory for use by the minidriver */ mdriver_addr = alloc_ram(~0L, 65536, 1); - Call init_intrinfo() to add the interrupt information to the system page.
- Call
mdriver_add()
to register your minidriver handler.
For example:
/* Add a minidriver function called "mini-data" for IRQ 81. */ mdriver_add("mini-data", 81, mini_data, mdrvr_addr, 65536);
For more information about the startup library functions, see the Customizing Image Startup Programs chapter of Building Embedded Systems.
Page updated:
