00001 /* 00002 * Copyright (c) 2011 Jan Vesely 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * - Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * - Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * - The name of the author may not be used to endorse or promote products 00015 * derived from this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00019 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00020 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00022 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00024 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00025 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00026 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 */ 00034 #ifndef DRV_UHCI_PORT_H 00035 #define DRV_UHCI_PORT_H 00036 00037 #include <stdint.h> 00038 #include <fibril.h> 00039 #include <ddf/driver.h> 00040 #include <usb/hc.h> /* usb_hc_connection_t */ 00041 00042 typedef uint16_t port_status_t; 00043 #define STATUS_CONNECTED (1 << 0) 00044 #define STATUS_CONNECTED_CHANGED (1 << 1) 00045 #define STATUS_ENABLED (1 << 2) 00046 #define STATUS_ENABLED_CHANGED (1 << 3) 00047 #define STATUS_LINE_D_PLUS (1 << 4) 00048 #define STATUS_LINE_D_MINUS (1 << 5) 00049 #define STATUS_RESUME (1 << 6) 00050 #define STATUS_ALWAYS_ONE (1 << 7) 00051 00052 #define STATUS_LOW_SPEED (1 << 8) 00053 #define STATUS_IN_RESET (1 << 9) 00054 #define STATUS_SUSPEND (1 << 12) 00055 00057 typedef struct uhci_port { 00058 const char *id_string; 00059 port_status_t *address; 00060 unsigned number; 00061 unsigned wait_period_usec; 00062 usb_hc_connection_t hc_connection; 00063 ddf_dev_t *rh; 00064 devman_handle_t attached_device; 00065 fid_t checker; 00066 } uhci_port_t; 00067 00068 int uhci_port_init( 00069 uhci_port_t *port, port_status_t *address, unsigned number, 00070 unsigned usec, ddf_dev_t *rh); 00071 00072 void uhci_port_fini(uhci_port_t *port); 00073 00074 #endif 00075