Changeset 361e61b in mainline for uspace/drv/ohci/root_hub.c


Ignore:
Timestamp:
2011-03-21T14:23:15Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
55e388a1
Parents:
c32688d (diff), 48fe0c9 (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 with development

File:
1 moved

Legend:

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

    rc32688d r361e61b  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup usb
     28/** @addtogroup drvusbohci
    2929 * @{
    3030 */
    3131/** @file
    32  * @brief UHCI driver
     32 * @brief OHCI driver
    3333 */
    3434#include <assert.h>
    35 #include <stdio.h>
     35#include <errno.h>
     36#include <str_error.h>
    3637
    3738#include <usb/debug.h>
    3839
    39 #include "port_status.h"
     40#include "root_hub.h"
    4041
    41 struct flag_name
    42 {
    43         uint16_t flag;
    44         const char *name;
    45 };
    46 
    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 };
    61 
    62 /** Prints portr status in a human readable way.
    63  *
    64  * @param[in] value Port value to print.
     42/** Root hub initialization
    6543 * @return Error code.
    6644 */
    67 void print_port_status(port_status_t value)
     45int rh_init(rh_t *instance, ddf_dev_t *dev, ohci_regs_t *regs)
    6846{
    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");
     47        assert(instance);
     48        instance->address = -1;
     49        instance->registers = regs;
     50        instance->device = dev;
     51
     52        usb_log_info("OHCI root hub with %d ports.\n", regs->rh_desc_a & 0xff);
     53
     54        /* TODO: implement */
     55        return EOK;
     56}
     57/*----------------------------------------------------------------------------*/
     58int rh_request(rh_t *instance, batch_t *request)
     59{
     60        assert(instance);
     61        assert(request);
     62        /* TODO: implement */
     63        if (request->setup_buffer) {
     64                usb_log_info("Root hub got SETUP packet: %s.\n",
     65                    usb_debug_str_buffer((const uint8_t *)request->setup_buffer, 8, 8));
    7366        }
     67        usb_log_error("Root hub request processing not implemented.\n");
     68        batch_finish(request, ENOTSUP);
     69        return EOK;
     70}
     71/*----------------------------------------------------------------------------*/
     72void rh_interrupt(rh_t *instance)
     73{
     74        usb_log_error("Root hub interrupt not implemented.\n");
     75        /* TODO: implement */
    7476}
    7577/**
Note: See TracChangeset for help on using the changeset viewer.