21 void _gdriverInit(
void) {
25 void _gdriverDeinit(
void) {
33 unsigned dinstance, sinstance;
36 dinstance = sinstance = 0;
37 for(pd = dhead; pd; pd = pd->driverchain) {
40 if (pd->vmt->type == vmt->type)
48 memset(pd, 0, vmt->objsize);
50 if (vmt->init && !vmt->init(pd, param, dinstance, sinstance)) {
57 dtail->driverchain = pd;
78 dhead = driver->driverchain;
80 for(pd = dhead; pd->driverchain; pd = pd->driverchain) {
81 if (pd->driverchain == driver) {
82 pd->driverchain = driver->driverchain;
91 if (driver->vmt->deinit)
92 driver->vmt->deinit(driver);
104 for(pd = dhead; pd; pd = pd->driverchain) {
105 if (pd->vmt->type == type) {
106 if (sinstance == instance)
120 for(pd = dhead; pd; pd = pd->driverchain) {
121 if (pd->vmt->type == type)
128 driver = driver ? driver->driverchain : dhead;
130 while(driver && driver->vmt->type != type)
131 driver = driver->driverchain;
142 for(pd = dhead; pd; pd = pd->driverchain) {
145 if (pd->vmt->type == driver->vmt->type)
GDriver * gdriverRegister(const GDriverVMT *vmt, void *param)
Register a new driver instance.
GDriver * gdriverGetInstance(gU16 type, unsigned instance)
Get the driver for a particular instance of a type of device.
GDriver * gdriverGetNext(gU16 type, GDriver *driver)
Get the next driver for a type of device.
void gdriverUnRegister(GDriver *driver)
UnRegister a driver instance.
unsigned gdriverInstanceCount(gU16 type)
Get the count of instances of a type of device.
unsigned gdriverGetDriverInstanceNumber(GDriver *driver)
Get the instance number for a device.
void * gfxAlloc(gMemSize sz)
Allocate memory.
void gfxFree(void *ptr)
Free memory.
All runtime driver structures start with this structure.
All driver VMT's start with this structure.