Changeset 518372c in mainline


Ignore:
Timestamp:
2011-02-11T17:59:02Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
53338bda
Parents:
687efaa
Message:

Error reporting refactored

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c

    r687efaa r518372c  
    8080#endif
    8181}
    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 }
    11082/*----------------------------------------------------------------------------*/
    11183int transfer_descriptor_status(transfer_descriptor_t *instance)
    11284{
    11385        assert(instance);
    114         if (convert_outcome(instance->status))
    115                 return EINVAL; //TODO: use sane error value here
     86
     87        if ((instance->status & TD_STATUS_ERROR_STALLED) != 0)
     88                return EIO;
     89
     90        if ((instance->status & TD_STATUS_ERROR_CRC) != 0)
     91                return EAGAIN;
     92
     93        if ((instance->status & TD_STATUS_ERROR_BUFFER) != 0)
     94                return EAGAIN;
     95
     96        if ((instance->status & TD_STATUS_ERROR_BABBLE) != 0)
     97                return EIO;
     98
     99        if ((instance->status & TD_STATUS_ERROR_NAK) != 0)
     100                return EAGAIN;
     101
     102        if ((instance->status & TD_STATUS_ERROR_BIT_STUFF) != 0)
     103                return EAGAIN;
     104
    116105        return EOK;
    117106}
Note: See TracChangeset for help on using the changeset viewer.