source: mainline/uspace/drv/bus/usb/uhci/main.c@ 3121b5f

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3121b5f was 4ca778b, checked in by Jan Vesely <jano.vesely@…>, 13 years ago

usbmid: Use initialized parent to get address and hc handle.

Remove forwarding helpers from libusb.
Remove unused headers.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2011 Vojtech Horky, 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 drvusbuhcihc
29 * @{
30 */
31/** @file
32 * @brief UHCI driver initialization
33 */
34#include <ddf/driver.h>
35#include <errno.h>
36#include <str_error.h>
37
38#include <usb/debug.h>
39
40#include "uhci.h"
41
42#define NAME "uhci"
43
44static int uhci_dev_add(ddf_dev_t *device);
45
46static driver_ops_t uhci_driver_ops = {
47 .dev_add = uhci_dev_add,
48};
49
50static driver_t uhci_driver = {
51 .name = NAME,
52 .driver_ops = &uhci_driver_ops
53};
54
55/** Initialize a new ddf driver instance for uhci hc and hub.
56 *
57 * @param[in] device DDF instance of the device to initialize.
58 * @return Error code.
59 */
60int uhci_dev_add(ddf_dev_t *device)
61{
62 usb_log_debug2("uhci_dev_add() called\n");
63 assert(device);
64
65 const int ret = device_setup_uhci(device);
66 if (ret != EOK) {
67 usb_log_error("Failed to initialize UHCI driver: %s.\n",
68 str_error(ret));
69 } else {
70 usb_log_info("Controlling new UHCI device '%s'.\n",
71 ddf_dev_get_name(device));
72 }
73
74 return ret;
75}
76
77/** Initialize global driver structures (NONE).
78 *
79 * @param[in] argc Number of arguments in argv vector (ignored).
80 * @param[in] argv Cmdline argument vector (ignored).
81 * @return Error code.
82 *
83 * Driver debug level is set here.
84 */
85int main(int argc, char *argv[])
86{
87 printf(NAME ": HelenOS UHCI driver.\n");
88 log_init(NAME);
89
90 return ddf_driver_main(&uhci_driver);
91}
92/**
93 * @}
94 */
Note: See TracBrowser for help on using the repository browser.