Changeset 82122f3 in mainline for uspace/drv/vhc/hub/virthub.h


Ignore:
Timestamp:
2010-12-17T14:51:41Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1f383dde
Parents:
692f13e4 (diff), 11658b64 (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:

Merged development into lelian/hidd

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/hub/virthub.h

    r692f13e4 r82122f3  
    3131 */
    3232/** @file
    33  * @brief
     33 * @brief USB hub as a virtual USB device.
    3434 */
    35 #ifndef VHCD_HUBINTERN_H_
    36 #define VHCD_HUBINTERN_H_
     35#ifndef VHC_HUB_VIRTHUB_H_
     36#define VHC_HUB_VIRTHUB_H_
    3737
     38#include <usbvirt/device.h>
     39#include "../devices.h"
    3840#include "hub.h"
    3941
     
    4244/** Configuration value for hub configuration. */
    4345#define HUB_CONFIGURATION_ID 1
     46
    4447
    4548/** Hub descriptor.
     
    6871} __attribute__ ((packed)) hub_descriptor_t;
    6972
    70 /** Hub port internal state.
    71  * Some states (e.g. port over current) are not covered as they are not
    72  * simulated at all.
    73  */
    74 typedef enum {
    75         HUB_PORT_STATE_NOT_CONFIGURED,
    76         HUB_PORT_STATE_POWERED_OFF,
    77         HUB_PORT_STATE_DISCONNECTED,
    78         HUB_PORT_STATE_DISABLED,
    79         HUB_PORT_STATE_RESETTING,
    80         HUB_PORT_STATE_ENABLED,
    81         HUB_PORT_STATE_SUSPENDED,
    82         HUB_PORT_STATE_RESUMING,
    83         /* HUB_PORT_STATE_, */
    84 } hub_port_state_t;
    85 
    86 /** Convert hub port state to a char. */
    87 static inline char hub_port_state_as_char(hub_port_state_t state) {
    88         switch (state) {
    89                 case HUB_PORT_STATE_NOT_CONFIGURED:
    90                         return '-';
    91                 case HUB_PORT_STATE_POWERED_OFF:
    92                         return 'O';
    93                 case HUB_PORT_STATE_DISCONNECTED:
    94                         return 'X';
    95                 case HUB_PORT_STATE_DISABLED:
    96                         return 'D';
    97                 case HUB_PORT_STATE_RESETTING:
    98                         return 'R';
    99                 case HUB_PORT_STATE_ENABLED:
    100                         return 'E';
    101                 case HUB_PORT_STATE_SUSPENDED:
    102                         return 'S';
    103                 case HUB_PORT_STATE_RESUMING:
    104                         return 'F';
    105                 default:
    106                         return '?';
    107         }
    108 }
    109 
    110 /** Hub status change mask bits. */
    111 typedef enum {
    112         HUB_STATUS_C_PORT_CONNECTION = (1 << 0),
    113         HUB_STATUS_C_PORT_ENABLE = (1 << 1),
    114         HUB_STATUS_C_PORT_SUSPEND = (1 << 2),
    115         HUB_STATUS_C_PORT_OVER_CURRENT = (1 << 3),
    116         HUB_STATUS_C_PORT_RESET = (1 << 4),
    117         /* HUB_STATUS_C_ = (1 << ), */
    118 } hub_status_change_t;
    119 
    120 /** Hub port information. */
    121 typedef struct {
    122         virtdev_connection_t *device;
    123         hub_port_state_t state;
    124         uint16_t status_change;
    125 } hub_port_t;
    126 
    127 /** Hub device type. */
    128 typedef struct {
    129         hub_port_t ports[HUB_PORT_COUNT];
    130 } hub_device_t;
    131 
    132 extern hub_device_t hub_dev;
    133 
     73extern usbvirt_device_ops_t hub_ops;
    13474extern hub_descriptor_t hub_descriptor;
    13575
    136 extern usbvirt_device_ops_t hub_ops;
    137 
    138 void clear_port_status_change(hub_port_t *, uint16_t);
    139 void set_port_status_change(hub_port_t *, uint16_t);
    140 
     76int virthub_init(usbvirt_device_t *);
     77int virthub_connect_device(usbvirt_device_t *, virtdev_connection_t *);
     78int virthub_disconnect_device(usbvirt_device_t *, virtdev_connection_t *);
     79bool virthub_is_device_enabled(usbvirt_device_t *, virtdev_connection_t *);
     80void virthub_get_status(usbvirt_device_t *, char *, size_t);
    14181
    14282#endif
Note: See TracChangeset for help on using the changeset viewer.