Changes in uspace/drv/vhc/connhost.c [c4ba29c7:4b4c797] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/connhost.c
rc4ba29c7 r4b4c797 41 41 #include "hc.h" 42 42 43 typedef struct {44 usb_direction_t direction;45 usb_hcd_transfer_callback_out_t out_callback;46 usb_hcd_transfer_callback_in_t in_callback;47 usb_hc_device_t *hc;48 void *arg;49 } transfer_info_t;50 51 static void universal_callback(void *buffer, size_t size,52 usb_transaction_outcome_t outcome, void *arg)53 {54 transfer_info_t *transfer = (transfer_info_t *) arg;55 56 switch (transfer->direction) {57 case USB_DIRECTION_IN:58 transfer->in_callback(transfer->hc,59 size, outcome,60 transfer->arg);61 break;62 case USB_DIRECTION_OUT:63 transfer->out_callback(transfer->hc,64 outcome,65 transfer->arg);66 break;67 default:68 assert(false && "unreachable");69 break;70 }71 72 free(transfer);73 }74 75 static transfer_info_t *create_transfer_info(usb_hc_device_t *hc,76 usb_direction_t direction, void *arg)77 {78 transfer_info_t *transfer = malloc(sizeof(transfer_info_t));79 80 transfer->direction = direction;81 transfer->in_callback = NULL;82 transfer->out_callback = NULL;83 transfer->arg = arg;84 transfer->hc = hc;85 86 return transfer;87 }88 89 43 static int enqueue_transfer_out(usb_hc_device_t *hc, 90 44 usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint, … … 96 50 usb_str_transfer_type(endpoint->transfer_type), 97 51 size); 98 99 transfer_info_t *transfer 100 = create_transfer_info(hc, USB_DIRECTION_OUT, arg); 101 transfer->out_callback = callback; 102 103 usb_target_t target = { 104 .address = dev->address, 105 .endpoint = endpoint->endpoint 106 }; 107 108 hc_add_transaction_to_device(false, target, buffer, size, 109 universal_callback, transfer); 110 111 return EOK; 52 return ENOTSUP; 112 53 } 113 54 … … 121 62 usb_str_transfer_type(endpoint->transfer_type), 122 63 size); 123 124 transfer_info_t *transfer 125 = create_transfer_info(hc, USB_DIRECTION_OUT, arg); 126 transfer->out_callback = callback; 127 128 usb_target_t target = { 129 .address = dev->address, 130 .endpoint = endpoint->endpoint 131 }; 132 133 hc_add_transaction_to_device(true, target, buffer, size, 134 universal_callback, transfer); 135 136 return EOK; 64 return ENOTSUP; 137 65 } 138 66 … … 146 74 usb_str_transfer_type(endpoint->transfer_type), 147 75 size); 148 149 transfer_info_t *transfer 150 = create_transfer_info(hc, USB_DIRECTION_IN, arg); 151 transfer->in_callback = callback; 152 153 usb_target_t target = { 154 .address = dev->address, 155 .endpoint = endpoint->endpoint 156 }; 157 158 hc_add_transaction_from_device(target, buffer, size, 159 universal_callback, transfer); 160 161 return EOK; 76 return ENOTSUP; 162 77 } 163 78
Note:
See TracChangeset
for help on using the changeset viewer.