Changeset 4d73d71 in mainline
- Timestamp:
- 2011-02-04T23:51:54Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4192d3d6
- Parents:
- 474afc9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/uhci.c
r474afc9 r4d73d71 42 42 static int uhci_clean_finished(void *arg); 43 43 static int uhci_debug_checker(void *arg); 44 static bool allowed_usb_packet( 45 bool low_speed, usb_transfer_type_t, size_t size); 44 46 45 47 int uhci_init(uhci_t *instance, void *regs, size_t reg_size) … … 160 162 void *arg) 161 163 { 164 if (!allowed_usb_packet(low_speed, transfer_type, size)) { 165 usb_log_warning("Invalid USB packet specified %s SPEED %d %zu.\n", 166 low_speed ? "LOW" : "FULL" , transfer_type, size); 167 return ENOTSUP; 168 } 169 162 170 // TODO: Add support for isochronous transfers 163 171 if (transfer_type == USB_TRANSFER_ISOCHRONOUS) { … … 166 174 } 167 175 168 if (transfer_type == USB_TRANSFER_INTERRUPT169 && size >= 64) {170 usb_log_warning("Interrupt transfer too big %zu.\n", size);171 return ENOTSUP;172 }173 174 if (size >= 1024) {175 usb_log_warning("Transfer too big.\n");176 return ENOTSUP;177 }178 176 transfer_list_t *list = instance->transfers[low_speed][transfer_type]; 179 if (!list) { 180 usb_log_warning("UNSUPPORTED transfer %d-%d.\n", low_speed, transfer_type); 181 return ENOTSUP; 182 } 177 assert(list); 183 178 184 179 transfer_descriptor_t *td = NULL; … … 206 201 207 202 td->callback = job; 208 209 203 210 204 usb_log_debug("Appending a new transfer to queue %s.\n", list->name); … … 311 305 return 0; 312 306 } 307 /*----------------------------------------------------------------------------*/ 308 bool allowed_usb_packet( 309 bool low_speed, usb_transfer_type_t transfer, size_t size) 310 { 311 /* see USB specification chapter 5.5-5.8 for magic numbers used here */ 312 switch(transfer) { 313 case USB_TRANSFER_ISOCHRONOUS: 314 return (!low_speed && size < 1024); 315 case USB_TRANSFER_INTERRUPT: 316 return size <= (low_speed ? 8 :64); 317 case USB_TRANSFER_CONTROL: /* device specifies its own max size */ 318 return (size <= (low_speed ? 8 : 64)); 319 case USB_TRANSFER_BULK: /* device specifies its own max size */ 320 return (!low_speed && size <= 64); 321 } 322 return false; 323 } 313 324 /** 314 325 * @}
Note:
See TracChangeset
for help on using the changeset viewer.