source: mainline/uspace/drv/ohci/hc.c@ 8627377

lfn serial ticket/834-toolchain-update topic/fix-logger-deadlock topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 8627377 was 8627377, checked in by Jan Vesely <jano.vesely@…>, 15 years ago

Add usb iface implementation

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 * Copyright (c) 2011 Jan Vesely
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28/** @addtogroup drvusbohcihc
29 * @{
30 */
31/** @file
32 * @brief OHCI Host controller driver routines
33 */
34#include <errno.h>
35#include <str_error.h>
36#include <adt/list.h>
37#include <libarch/ddi.h>
38
39#include <usb/debug.h>
40#include <usb/usb.h>
41#include <usb/hub.h>
42#include <usb/usbdevice.h>
43#include <usb/ddfiface.h>
44
45#include "hc.h"
46
47/*----------------------------------------------------------------------------*/
48int hc_init(hc_t *instance, ddf_fun_t *fun, ddf_dev_t *dev,
49 uintptr_t regs, size_t reg_size, bool interrupts)
50{
51 assert(instance);
52 int ret = pio_enable((void*)regs, reg_size, (void**)&instance->registers);
53 if (ret != EOK) {
54 usb_log_error("Failed to gain access to device registers.\n");
55 return ret;
56 }
57 device_keeper_init(&instance->manager);
58
59
60 rh_init(&instance->rh, dev, instance->registers);
61 /* TODO: implement */
62 /* TODO: register root hub */
63 return EOK;
64}
65/*----------------------------------------------------------------------------*/
66int hc_register_hub(hc_t *instance, ddf_dev_t *dev)
67{
68 assert(instance);
69 return EOK;
70}
71/*----------------------------------------------------------------------------*/
72int hc_schedule(hc_t *instance, batch_t *batch)
73{
74 assert(instance);
75 assert(batch);
76 if (batch->target.address == instance->rh.address) {
77 rh_request(&instance->rh, batch);
78 return EOK;
79 }
80 /* TODO: implement */
81 return ENOTSUP;
82}
83/*----------------------------------------------------------------------------*/
84void hc_interrupt(hc_t *instance, uint16_t status)
85{
86 assert(instance);
87 /* TODO: Check for interrupt cause */
88 rh_interrupt(&instance->rh);
89 /* TODO: implement */
90}
91/**
92 * @}
93 */
Note: See TracBrowser for help on using the repository browser.