Changeset 3843ecb in mainline for uspace/srv/drivers/pciintel/pci.c


Ignore:
Timestamp:
2010-04-09T13:54:06Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
892e4e1
Parents:
3a5909f
Message:

device classes as interface sets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/drivers/pciintel/pci.c

    r3a5909f r3843ecb  
    5858#define NAME "pciintel"
    5959
    60 
    6160#define CONF_ADDR(bus, dev, fn, reg)   ((1 << 31) | (bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3))
     61
     62
     63static hw_resource_list_t * pciintel_get_child_resources(device_t *dev)
     64{
     65        pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
     66        if (NULL == dev_data) {
     67                return NULL;
     68        }
     69        return &dev_data->hw_resources;
     70}
     71
     72static bool pciintel_enable_child_interrupt(device_t *dev)
     73{
     74        // TODO
     75       
     76        return false;
     77}
     78
     79static resource_iface_t pciintel_child_res_iface = {
     80        &pciintel_get_child_resources,
     81        &pciintel_enable_child_interrupt       
     82};
     83
     84static device_class_t pci_child_class;
    6285
    6386
     
    373396                        pci_read_interrupt(dev);
    374397                       
    375                         // TODO initialize device interfaces                   
     398                        dev->class = &pci_child_class;                 
    376399                       
    377400                        printf(NAME ": adding new child device %s.\n", dev->name);
     
    464487}
    465488
     489static void pciintel_init()
     490{
     491        pci_child_class.id = 0; // TODO
     492        pci_child_class.interfaces[HW_RES_DEV_IFACE] = &pciintel_child_res_iface;
     493}
     494
    466495int main(int argc, char *argv[])
    467496{
    468         printf(NAME ": HelenOS pci bus driver (intel method 1).\n");   
     497        printf(NAME ": HelenOS pci bus driver (intel method 1).\n");
     498        pciintel_init();
    469499        return driver_main(&pci_driver);
    470500}
Note: See TracChangeset for help on using the changeset viewer.