Changes in uspace/drv/vhc/hc.c [a39f4cf:e63a4e1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/hc.c
ra39f4cf re63a4e1 50 50 #include "hub.h" 51 51 52 #define USLEEP_BASE (0 * 5 00* 1000)53 54 #define USLEEP_VAR 50 0052 #define USLEEP_BASE (0 * 5 * 1000) 53 54 #define USLEEP_VAR 50 55 55 56 56 #define SHORTENING_VAR 15 … … 68 68 static link_t transaction_list; 69 69 70 #define TRANSACTION_FORMAT "T[%d :%d%s (%d)]"70 #define TRANSACTION_FORMAT "T[%d.%d %s/%s (%d)]" 71 71 #define TRANSACTION_PRINTF(t) \ 72 72 (t).target.address, (t).target.endpoint, \ 73 usb_str_transfer_type((t).transfer_type), \ 73 74 usbvirt_str_transaction_type((t).type), \ 74 75 (int)(t).len … … 77 78 list_get_instance(lnk, transaction_t, link) 78 79 80 #define HUB_STATUS_MAX_LEN (HUB_PORT_COUNT + 64) 81 79 82 static inline unsigned int pseudo_random(unsigned int *seed) 80 83 { … … 89 92 usb_transaction_outcome_t outcome) 90 93 { 91 dprintf(3, " processing transaction " TRANSACTION_FORMAT ", outcome: %s",94 dprintf(3, "transaction " TRANSACTION_FORMAT " done, outcome: %s", 92 95 TRANSACTION_PRINTF(*transaction), 93 96 usb_str_transaction_outcome(outcome)); … … 99 102 /** Host controller manager main function. 100 103 */ 101 void hc_manager(void)104 static int hc_manager_fibril(void *arg) 102 105 { 103 106 list_initialize(&transaction_list); … … 114 117 } 115 118 116 char ports[HUB_PORT_COUNT + 2]; 117 hub_get_port_statuses(ports, HUB_PORT_COUNT + 1); 118 dprintf(0, "virtual hub: addr=%d ports=%s", 119 virthub_dev.address, ports); 119 char ports[HUB_STATUS_MAX_LEN + 1]; 120 virthub_get_status(&virtual_hub_device, ports, HUB_STATUS_MAX_LEN); 120 121 121 122 link_t *first_transaction_link = transaction_list.next; … … 124 125 list_remove(first_transaction_link); 125 126 127 128 dprintf(0, "about to process " TRANSACTION_FORMAT " [%s]", 129 TRANSACTION_PRINTF(*transaction), ports); 130 126 131 dprintf(3, "processing transaction " TRANSACTION_FORMAT "", 127 132 TRANSACTION_PRINTF(*transaction)); … … 134 139 free(transaction); 135 140 } 141 142 assert(false && "unreachable"); 143 return EOK; 144 } 145 146 void hc_manager(void) 147 { 148 fid_t fid = fibril_create(hc_manager_fibril, NULL); 149 if (fid == 0) { 150 printf(NAME ": failed to start HC manager fibril\n"); 151 return; 152 } 153 fibril_add_ready(fid); 136 154 } 137 155 … … 139 157 */ 140 158 static transaction_t *transaction_create(usbvirt_transaction_type_t type, 141 usb_target_t target, 159 usb_target_t target, usb_transfer_type_t transfer_type, 142 160 void * buffer, size_t len, 143 161 hc_transaction_done_callback_t callback, void * arg) … … 147 165 list_initialize(&transaction->link); 148 166 transaction->type = type; 167 transaction->transfer_type = transfer_type; 149 168 transaction->target = target; 150 169 transaction->buffer = buffer; … … 162 181 */ 163 182 void hc_add_transaction_to_device(bool setup, usb_target_t target, 183 usb_transfer_type_t transfer_type, 164 184 void * buffer, size_t len, 165 185 hc_transaction_done_callback_t callback, void * arg) 166 186 { 167 187 transaction_t *transaction = transaction_create( 168 setup ? USBVIRT_TRANSACTION_SETUP : USBVIRT_TRANSACTION_OUT, target, 188 setup ? USBVIRT_TRANSACTION_SETUP : USBVIRT_TRANSACTION_OUT, 189 target, transfer_type, 169 190 buffer, len, callback, arg); 170 191 list_append(&transaction->link, &transaction_list); … … 174 195 */ 175 196 void hc_add_transaction_from_device(usb_target_t target, 197 usb_transfer_type_t transfer_type, 176 198 void * buffer, size_t len, 177 199 hc_transaction_done_callback_t callback, void * arg) 178 200 { 179 201 transaction_t *transaction = transaction_create(USBVIRT_TRANSACTION_IN, 180 target, buffer, len, callback, arg); 202 target, transfer_type, 203 buffer, len, callback, arg); 181 204 list_append(&transaction->link, &transaction_list); 182 205 }
Note:
See TracChangeset
for help on using the changeset viewer.