Changeset a6d1bc1 in mainline


Ignore:
Timestamp:
2011-03-21T11:52:29Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8627377
Parents:
b0beee82
Message:

Add infrastructure for rh registration.

Location:
uspace/drv/ohci
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/hc.c

    rb0beee82 ra6d1bc1  
    3939#include <usb/debug.h>
    4040#include <usb/usb.h>
     41#include <usb/hub.h>
     42#include <usb/usbdevice.h>
    4143#include <usb/ddfiface.h>
    42 #include <usb_iface.h>
    4344
    4445#include "hc.h"
    4546
    46 int hc_init(hc_t *instance, ddf_fun_t *fun,
     47/*----------------------------------------------------------------------------*/
     48int hc_init(hc_t *instance, ddf_fun_t *fun, ddf_dev_t *dev,
    4749    uintptr_t regs, size_t reg_size, bool interrupts)
    4850{
     
    5658
    5759
    58         rh_init(&instance->rh, instance->registers);
     60        rh_init(&instance->rh, dev, instance->registers);
    5961        /* TODO: implement */
    6062        /* TODO: register root hub */
    6163        return EOK;
     64}
     65/*----------------------------------------------------------------------------*/
     66int hc_register_hub(hc_t *instance, ddf_dev_t *dev)
     67{
     68        assert(instance);
     69        return rh_register(&instance->rh, dev);
    6270}
    6371/*----------------------------------------------------------------------------*/
     
    7179        }
    7280        /* TODO: implement */
    73         return EOK;
     81        return ENOTSUP;
    7482}
    7583/*----------------------------------------------------------------------------*/
  • uspace/drv/ohci/hc.h

    rb0beee82 ra6d1bc1  
    5151        ohci_regs_t *registers;
    5252        usb_address_t rh_address;
    53         ohci_rh_t rh;
     53        rh_t rh;
    5454        ddf_fun_t *ddf_instance;
    5555        device_keeper_t manager;
    5656} hc_t;
    5757
    58 int hc_init(hc_t *instance, ddf_fun_t *fun,
     58int hc_init(hc_t *instance, ddf_fun_t *fun, ddf_dev_t *dev,
    5959     uintptr_t regs, size_t reg_size, bool interrupts);
     60
     61int hc_register_hub(hc_t *instance, ddf_dev_t *dev);
    6062
    6163int hc_schedule(hc_t *instance, batch_t *batch);
  • uspace/drv/ohci/main.c

    rb0beee82 ra6d1bc1  
    129129        }
    130130
    131         ret = hc_init(hcd, hc_fun, mem_reg_base, mem_reg_size, interrupts);
     131        ret = hc_init(hcd, hc_fun, device, mem_reg_base, mem_reg_size, interrupts);
    132132        if (ret != EOK) {
    133133                usb_log_error("Failed to initialize OHCI driver.\n");
     
    148148        hc_fun->driver_data = hcd;
    149149
    150         /* TODO: register interrupt handler */
     150        hc_register_hub(hcd, device);
    151151
    152152        usb_log_info("Controlling new OHCI device `%s' (handle %llu).\n",
  • uspace/drv/ohci/root_hub.c

    rb0beee82 ra6d1bc1  
    4343 * @return Error code.
    4444 */
    45 int rh_init(ohci_rh_t *instance, ohci_regs_t *regs)
     45int rh_init(rh_t *instance, ddf_dev_t *dev, ohci_regs_t *regs)
    4646{
    4747        assert(instance);
    4848        instance->address = 0;
    4949        instance->registers = regs;
     50        instance->device = dev;
    5051
    5152        usb_log_info("OHCI root hub with %d ports.\n", regs->rh_desc_a & 0xff);
     
    5556}
    5657/*----------------------------------------------------------------------------*/
    57 void rh_request(ohci_rh_t *instance, batch_t *request)
     58void rh_request(rh_t *instance, batch_t *request)
    5859{
     60        usb_log_error("Request processing not implemented.\n");
    5961        /* TODO: implement */
    6062}
    6163/*----------------------------------------------------------------------------*/
    62 void rh_interrupt(ohci_rh_t *instance)
     64void rh_interrupt(rh_t *instance)
    6365{
    64         usb_log_info("Interrupt!!.\n");
     66        usb_log_error("Root hub interrupt not implemented.\n");
    6567        /* TODO: implement */
     68}
     69/*----------------------------------------------------------------------------*/
     70int rh_register(rh_t *instance, ddf_dev_t *dev)
     71{
     72        return EOK;
    6673}
    6774/**
  • uspace/drv/ohci/root_hub.h

    rb0beee82 ra6d1bc1  
    4141#include "batch.h"
    4242
    43 typedef struct ohci_rh {
     43typedef struct rh {
    4444        ohci_regs_t *registers;
    4545        usb_address_t address;
    46 } ohci_rh_t;
     46        ddf_dev_t *device;
     47} rh_t;
    4748
    48 int rh_init(ohci_rh_t *instance, ohci_regs_t *regs);
     49int rh_init(rh_t *instance, ddf_dev_t *dev, ohci_regs_t *regs);
    4950
    50 void rh_request(ohci_rh_t *instance, batch_t *request);
     51void rh_request(rh_t *instance, batch_t *request);
    5152
    52 void rh_interrupt(ohci_rh_t *instance);
     53void rh_interrupt(rh_t *instance);
     54
     55int rh_register(rh_t *instance, ddf_dev_t *dev);
    5356#endif
    5457/**
Note: See TracChangeset for help on using the changeset viewer.