Changeset f2962621 in mainline for uspace/drv/vhc/hub/virthub.h
- Timestamp:
- 2010-12-17T10:14:01Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6e5dc07
- Parents:
- 9223dc5c (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/hub/virthub.h
r9223dc5c rf2962621 31 31 */ 32 32 /** @file 33 * @brief 33 * @brief USB hub as a virtual USB device. 34 34 */ 35 #ifndef VHC D_HUBINTERN_H_36 #define VHC D_HUBINTERN_H_35 #ifndef VHC_HUB_VIRTHUB_H_ 36 #define VHC_HUB_VIRTHUB_H_ 37 37 38 #include <usbvirt/device.h> 39 #include "../devices.h" 38 40 #include "hub.h" 39 41 … … 42 44 /** Configuration value for hub configuration. */ 43 45 #define HUB_CONFIGURATION_ID 1 46 44 47 45 48 /** Hub descriptor. … … 68 71 } __attribute__ ((packed)) hub_descriptor_t; 69 72 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 int index; 124 hub_port_state_t state; 125 uint16_t status_change; 126 } hub_port_t; 127 128 /** Hub device type. */ 129 typedef struct { 130 hub_port_t ports[HUB_PORT_COUNT]; 131 } hub_device_t; 132 133 extern hub_device_t hub_dev; 134 73 extern usbvirt_device_ops_t hub_ops; 135 74 extern hub_descriptor_t hub_descriptor; 136 75 137 extern usbvirt_device_ops_t hub_ops;138 139 void clear_port_status_change(hub_port_t *, uint16_t);140 void set_port_status_change(hub_port_t *, uint16_t);141 76 int virthub_init(usbvirt_device_t *); 77 int virthub_connect_device(usbvirt_device_t *, virtdev_connection_t *); 78 int virthub_disconnect_device(usbvirt_device_t *, virtdev_connection_t *); 79 bool virthub_is_device_enabled(usbvirt_device_t *, virtdev_connection_t *); 80 void virthub_get_status(usbvirt_device_t *, char *, size_t); 142 81 143 82 #endif
Note:
See TracChangeset
for help on using the changeset viewer.