My Kernel v0.1.0
device_driver Struct Reference

The basic device driver structure. More...

#include <driver.h>

Data Structures

struct  driver_operations
 Vector table of the common operations used to control drivers. More...
 

Data Fields

node_t this
 Intrusive list node used to iterate through loaded drivers.
 
const char * name
 The name of the driver.
 
struct device_driver::driver_operations operations
 Vector table of driver control operations.
 

Detailed Description

This structure defines the common base interface used to enumerate and interact with all device drivers. It should be embedded inside a more specific 'per-bus' struct, and interacted with through the bus's API.

Example:

struct pci_driver {
struct device_driver driver;
void *pci_specific_field_1;
int pci_specific_field_2;
};
void pci_driver_register(struct pci_driver *driver)
{
// Perform pci-specific actions
// ...
// Register driver generically
driver_register(&driver->driver);
}
void driver_register(driver_t *driver)
Register a new driver.
Definition: driver.c:45
The basic device driver structure.
Definition: driver.h:77
Per-bus driver struct for PCI drivers.
Definition: pci.h:28

To interact with a pci_device, we will interact with the pci_* functions. These functions will be the one to interact with the driver_* api instead, adding into the process the steps/configuration necessary for PCI devices to work.


The documentation for this struct was generated from the following file: