Changeset b5111c46 in mainline for uspace/drv/bus/usb/uhci


Ignore:
Timestamp:
2014-07-23T21:38:25Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ffa96c2
Parents:
87a3df7f
Message:

Convert OHCI and UHCI away from DDF_DATA_IMPLANT.

Location:
uspace/drv/bus/usb/uhci
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/hc.c

    r87a3df7f rb5111c46  
    230230 *
    231231 * @param[in] instance Memory place to initialize.
     232 * @param[in] HC function node
    232233 * @param[in] regs Range of device's I/O control registers.
    233234 * @param[in] interrupts True if hw interrupts should be used.
     
    238239 * interrupt fibrils.
    239240 */
    240 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts)
     241int hc_init(hc_t *instance, ddf_fun_t *fun, addr_range_t *regs, bool interrupts)
    241242{
    242243        assert(regs->size >= sizeof(uhci_regs_t));
     
    266267        }
    267268
    268         hcd_init(&instance->generic, USB_SPEED_FULL,
     269        instance->generic = ddf_fun_data_alloc(fun, sizeof(hcd_t));
     270        if (instance->generic == NULL) {
     271                usb_log_error("Out of memory.\n");
     272                return ENOMEM;
     273        }
     274
     275        hcd_init(instance->generic, USB_SPEED_FULL,
    269276            BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);
    270277
    271         instance->generic.private_data = instance;
    272         instance->generic.schedule = hc_schedule;
    273         instance->generic.ep_add_hook = NULL;
     278        instance->generic->private_data = instance;
     279        instance->generic->schedule = hc_schedule;
     280        instance->generic->ep_add_hook = NULL;
    274281
    275282        hc_init_hw(instance);
  • uspace/drv/bus/usb/uhci/hc.h

    r87a3df7f rb5111c46  
    3636#define DRV_UHCI_HC_H
    3737
     38#include <ddf/driver.h>
    3839#include <ddf/interrupt.h>
    3940#include <device/hw_res_parsed.h>
     
    9394typedef struct hc {
    9495        /** Generic HCD driver structure */
    95         hcd_t generic;
     96        hcd_t *generic;
    9697
    9798        /** Addresses of I/O registers */
     
    126127    addr_range_t *);
    127128void hc_interrupt(hc_t *instance, uint16_t status);
    128 int hc_init(hc_t *instance, addr_range_t *regs, bool interupts);
     129int hc_init(hc_t *, ddf_fun_t *, addr_range_t *, bool);
    129130
    130131/** Safely dispose host controller internal structures
  • uspace/drv/bus/usb/uhci/uhci.c

    r87a3df7f rb5111c46  
    3434 */
    3535
    36 /* XXX Fix this */
    37 #define _DDF_DATA_IMPLANT
    38 
    3936#include <errno.h>
    4037#include <stdbool.h>
     
    6259        hc_t hc;
    6360        /** Internal driver's representation of UHCI root hub */
    64         rh_t rh;
     61        rh_t *rh;
    6562} uhci_t;
    6663
     
    186183
    187184        ddf_fun_set_ops(instance->hc_fun, &hc_ops);
    188         ddf_fun_data_implant(instance->hc_fun, &instance->hc.generic);
    189185
    190186        instance->rh_fun = ddf_fun_create(device, fun_inner, "uhci_rh");
     
    196192
    197193        ddf_fun_set_ops(instance->rh_fun, &rh_ops);
    198         ddf_fun_data_implant(instance->rh_fun, &instance->rh);
     194        instance->rh = ddf_fun_data_alloc(instance->rh_fun, sizeof(rh_t));
    199195
    200196        addr_range_t regs;
     
    236232        }
    237233
    238         rc = hc_init(&instance->hc, &regs, interrupts);
     234        rc = hc_init(&instance->hc, instance->hc_fun, &regs, interrupts);
    239235        if (rc != EOK) {
    240236                usb_log_error("Failed to init uhci_hcd: %s.\n", str_error(rc));
     
    260256        }
    261257
    262         rc = rh_init(&instance->rh, instance->rh_fun, &regs, 0x10, 4);
     258        rc = rh_init(instance->rh, instance->rh_fun, &regs, 0x10, 4);
    263259        if (rc != EOK) {
    264260                usb_log_error("Failed to setup UHCI root hub: %s.\n",
Note: See TracChangeset for help on using the changeset viewer.