Once you have written a handler function, you need to register it with startup and allocate the required system RAM for your data area. This is accomplished with the following functions:
paddr_t alloc_ram(phys_addr, size, alignment); int mdriver_add(name, interrupt, handler, data_paddr, data_size);
Since you're allocating memory and passing an interrupt, these functions must be called after RAM is initialized by calling init_raminfo(), and after the interrupt information is added to the system page by calling init_intrinfo(). The main() function of the startup main.c should look like this:
... paddr_t mdrvr_addr; ... init_intrinfo(); init_qtime(); /* allocate 64k of ram for the minidriver's use */ mdrvr_addr = alloc_ram(~0L, 64*1024, 1); /* code to add a sample minidriver which merely does data collection */ mdriver_add("mini-data", 0, mini_data, mdrvr_addr, 64*1024); /* code to add a sample minidriver for a serial port */ /* mdriver_add("mini-serial", 46, mini_serial, mdrvr_addr, 64*1024); */ ...
In this example, you have allocated 64 KB of memory and registered the minidriver handler function with the name mini-serial>