Changeset 474d08e in mainline for uspace/drv/uhci-hcd/batch.c
- Timestamp:
- 2011-03-05T00:44:27Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 00db345a, d20f211
- Parents:
- 80fdffe (diff), eae83aa (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 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/batch.c
r80fdffe r474d08e 47 47 static int batch_schedule(batch_t *instance); 48 48 49 static void batch_control( 50 batch_t *instance, int data_stage, intstatus_stage);51 static void batch_data(batch_t *instance, intpid);49 static void batch_control(batch_t *instance, 50 usb_packet_id data_stage, usb_packet_id status_stage); 51 static void batch_data(batch_t *instance, usb_packet_id pid); 52 52 static void batch_call_in(batch_t *instance); 53 53 static void batch_call_out(batch_t *instance); … … 84 84 } 85 85 86 instance->tds = malloc32(sizeof(t ransfer_descriptor_t) * instance->packets);86 instance->tds = malloc32(sizeof(td_t) * instance->packets); 87 87 if (instance->tds == NULL) { 88 88 usb_log_error("Failed to allocate transfer descriptors.\n"); … … 91 91 return NULL; 92 92 } 93 bzero(instance->tds, sizeof(t ransfer_descriptor_t) * instance->packets);93 bzero(instance->tds, sizeof(td_t) * instance->packets); 94 94 95 95 const size_t transport_size = max_packet_size * instance->packets; … … 152 152 size_t i = 0; 153 153 for (;i < instance->packets; ++i) { 154 if (t ransfer_descriptor_is_active(&instance->tds[i])) {154 if (td_is_active(&instance->tds[i])) { 155 155 return false; 156 156 } 157 instance->error = transfer_descriptor_status(&instance->tds[i]); 157 158 instance->error = td_status(&instance->tds[i]); 158 159 if (instance->error != EOK) { 160 usb_log_debug("Batch(%p) found error TD(%d):%x.\n", 161 instance, i, instance->tds[i].status); 159 162 if (i > 0) 160 instance->transfered_size -= instance->setup_size; 161 usb_log_debug("Batch(%p) found error TD(%d):%x.\n", 162 instance, i, instance->tds[i].status); 163 goto substract_ret; 163 164 return true; 164 165 } 165 instance->transfered_size += 166 transfer_descriptor_actual_size(&instance->tds[i]); 167 } 166 167 instance->transfered_size += td_act_size(&instance->tds[i]); 168 if (td_is_short(&instance->tds[i])) 169 goto substract_ret; 170 } 171 substract_ret: 168 172 instance->transfered_size -= instance->setup_size; 169 173 return true; … … 228 232 } 229 233 /*----------------------------------------------------------------------------*/ 230 static void batch_data(batch_t *instance, intpid)234 static void batch_data(batch_t *instance, usb_packet_id pid) 231 235 { 232 236 assert(instance); … … 247 251 remain_size : instance->max_packet_size; 248 252 249 t ransfer_descriptor_init(&instance->tds[packet],253 td_init(&instance->tds[packet], 250 254 DEFAULT_ERROR_COUNT, packet_size, toggle, false, low_speed, 251 255 instance->target, pid, data, … … 262 266 } 263 267 /*----------------------------------------------------------------------------*/ 264 static void batch_control( 265 batch_t *instance, int data_stage, intstatus_stage)268 static void batch_control(batch_t *instance, 269 usb_packet_id data_stage, usb_packet_id status_stage) 266 270 { 267 271 assert(instance); … … 270 274 int toggle = 0; 271 275 /* setup stage */ 272 t ransfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,276 td_init(instance->tds, DEFAULT_ERROR_COUNT, 273 277 instance->setup_size, toggle, false, low_speed, instance->target, 274 278 USB_PID_SETUP, instance->setup_buffer, &instance->tds[1]); … … 288 292 remain_size : instance->max_packet_size; 289 293 290 t ransfer_descriptor_init(&instance->tds[packet],294 td_init(&instance->tds[packet], 291 295 DEFAULT_ERROR_COUNT, packet_size, toggle, false, low_speed, 292 296 instance->target, data_stage, data, … … 301 305 /* status stage */ 302 306 assert(packet == instance->packets - 1); 303 t ransfer_descriptor_init(&instance->tds[packet], DEFAULT_ERROR_COUNT,307 td_init(&instance->tds[packet], DEFAULT_ERROR_COUNT, 304 308 0, 1, false, low_speed, instance->target, status_stage, NULL, NULL); 305 309
Note:
See TracChangeset
for help on using the changeset viewer.