Structure of a busmanager

A busmanager is a normal kernel module that is located in the /system/drivers/dev/bus directory . The only difference is that it calls the register_busmanager() function:

status_t        register_busmanager( int nDeviceID, const char* pzName, busmanager_get_hooks* pfHooks );

The pzName parameter is the same name that the device drivers pass to the get_busmanager() function. The pfHooks pointer points to the entrypoint of the busmanager. It should return a structure with entries to the exported functions of the busmanager:

struct BusHooks_s
{
        void (*function_ptr)();
        ....
};

BusHooks_s sMyHooks =
{
        function,
        ....
};

void* my_bus_get_hooks( int nVersion )
{
        if( nVersion == MY_BUS_VERSION )
                return( &sMyHooks );
        return( NULL );
}

....

register_busmanager( nDeviceID, "my_bus", my_bus_get_hooks );

Once you have called the register_busmanager() function the kernel will not unload the driver until the next reboot. It will also call the device_uninit() function of the driver before shutdown/reboot to give it the possibility so save its settings.


Generated on Sat May 9 22:53:27 2009 for Syllable device driver API by  doxygen 1.5.1