Changeset 1b0b86e6 in mainline for uspace/drv/uhci-hcd/uhci_rh.c


Ignore:
Timestamp:
2011-03-13T22:02:44Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b7d8fd9
Parents:
67f54965 (diff), deb4ba7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge development/ changes

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/uhci_rh.c

    r67f54965 r1b0b86e6  
    3333 */
    3434#include <assert.h>
     35#include <errno.h>
     36#include <str_error.h>
    3537#include <stdio.h>
    3638
    3739#include <usb/debug.h>
    3840
    39 #include "port_status.h"
     41#include "uhci_rh.h"
     42#include "uhci_hc.h"
    4043
    41 struct flag_name
     44/*----------------------------------------------------------------------------*/
     45int uhci_rh_init(
     46    uhci_rh_t *instance, ddf_fun_t *fun, uintptr_t reg_addr, size_t reg_size)
    4247{
    43         uint16_t flag;
    44         const char *name;
    45 };
     48        assert(fun);
    4649
    47 static const struct flag_name flags[] =
    48 {
    49         { STATUS_SUSPEND, "suspended" },
    50         { STATUS_IN_RESET, "in reset" },
    51         { STATUS_LOW_SPEED, "low speed device" },
    52         { STATUS_ALWAYS_ONE, "always 1 bit" },
    53         { STATUS_RESUME, "resume" },
    54         { STATUS_LINE_D_MINUS, "line D- value" },
    55         { STATUS_LINE_D_PLUS, "line D+ value" },
    56         { STATUS_ENABLED_CHANGED, "enabled changed" },
    57         { STATUS_ENABLED, "enabled" },
    58         { STATUS_CONNECTED_CHANGED, "connected changed" },
    59         { STATUS_CONNECTED, "connected" }
    60 };
     50        char *match_str = NULL;
     51        int ret = asprintf(&match_str, "usb&uhci&root-hub");
     52        if (ret < 0) {
     53                usb_log_error("Failed to create root hub match string.\n");
     54                return ENOMEM;
     55        }
    6156
    62 /** Prints portr status in a human readable way.
    63  *
    64  * @param[in] value Port value to print.
    65  * @return Error code.
    66  */
    67 void print_port_status(port_status_t value)
    68 {
    69         unsigned i = 0;
    70         for (;i < sizeof(flags)/sizeof(struct flag_name); ++i) {
    71                 usb_log_debug2("\t%s status: %s.\n", flags[i].name,
    72                   ((value & flags[i].flag) != 0) ? "YES" : "NO");
     57        ret = ddf_fun_add_match_id(fun, match_str, 100);
     58        if (ret != EOK) {
     59                usb_log_error("Failed(%d) to add root hub match id: %s\n",
     60                    ret, str_error(ret));
     61                return ret;
    7362        }
     63
     64        hw_resource_list_t *resource_list = &instance->resource_list;
     65        resource_list->count = 1;
     66        resource_list->resources = &instance->io_regs;
     67        assert(resource_list->resources);
     68        instance->io_regs.type = IO_RANGE;
     69        instance->io_regs.res.io_range.address = reg_addr;
     70//          ((uintptr_t)hc->registers) + 0x10; // see UHCI design guide
     71        instance->io_regs.res.io_range.size = reg_size;
     72        instance->io_regs.res.io_range.endianness = LITTLE_ENDIAN;
     73
     74        return EOK;
    7475}
    7576/**
Note: See TracChangeset for help on using the changeset viewer.