Changeset 50ba203 in mainline for uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c
- Timestamp:
- 2011-02-20T15:46:48Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6bb83c7
- Parents:
- d81ef61c (diff), 0c00dac (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/uhci_struct/transfer_descriptor.c
rd81ef61c r50ba203 40 40 void transfer_descriptor_init(transfer_descriptor_t *instance, 41 41 int error_count, size_t size, bool toggle, bool isochronous, 42 usb_target_t target, int pid, void *buffer )42 usb_target_t target, int pid, void *buffer, transfer_descriptor_t *next) 43 43 { 44 44 assert(instance); 45 45 46 instance->next = 0 | LINK_POINTER_TERMINATE_FLAG; 46 instance->next = 0 47 | LINK_POINTER_VERTICAL_FLAG 48 | ((next != NULL) ? addr_to_phys(next) : LINK_POINTER_TERMINATE_FLAG); 47 49 48 50 instance->status = 0 … … 80 82 #endif 81 83 } 82 83 static inline usb_transaction_outcome_t convert_outcome(uint32_t status)84 {85 /*TODO: refactor into something sane */86 /*TODO: add additional usb_errors to usb_outcome_t */87 88 if (status & TD_STATUS_ERROR_STALLED)89 return USB_OUTCOME_CRCERROR;90 91 if (status & TD_STATUS_ERROR_BUFFER)92 return USB_OUTCOME_CRCERROR;93 94 if (status & TD_STATUS_ERROR_BABBLE)95 return USB_OUTCOME_BABBLE;96 97 if (status & TD_STATUS_ERROR_NAK)98 return USB_OUTCOME_CRCERROR;99 100 if (status & TD_STATUS_ERROR_CRC)101 return USB_OUTCOME_CRCERROR;102 103 if (status & TD_STATUS_ERROR_BIT_STUFF)104 return USB_OUTCOME_CRCERROR;105 106 // assert((((status >> TD_STATUS_ERROR_POS) & TD_STATUS_ERROR_MASK)107 // | TD_STATUS_ERROR_RESERVED) == TD_STATUS_ERROR_RESERVED);108 return USB_OUTCOME_OK;109 }110 84 /*----------------------------------------------------------------------------*/ 111 85 int transfer_descriptor_status(transfer_descriptor_t *instance) 112 86 { 113 87 assert(instance); 114 if (convert_outcome(instance->status)) 115 return EINVAL; //TODO: use sane error value here 88 89 if ((instance->status & TD_STATUS_ERROR_STALLED) != 0) 90 return EIO; 91 92 if ((instance->status & TD_STATUS_ERROR_CRC) != 0) 93 return EAGAIN; 94 95 if ((instance->status & TD_STATUS_ERROR_BUFFER) != 0) 96 return EAGAIN; 97 98 if ((instance->status & TD_STATUS_ERROR_BABBLE) != 0) 99 return EIO; 100 101 if ((instance->status & TD_STATUS_ERROR_NAK) != 0) 102 return EAGAIN; 103 104 if ((instance->status & TD_STATUS_ERROR_BIT_STUFF) != 0) 105 return EAGAIN; 106 116 107 return EOK; 117 108 }
Note:
See TracChangeset
for help on using the changeset viewer.