Ignore:
Timestamp:
2011-02-20T15:46:48Z (14 years ago)
Author:
Matus Dekanek <smekideki@…>
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.
Message:

merge with usb/development

File:
1 edited

Legend:

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

    rd81ef61c r50ba203  
    4040void transfer_descriptor_init(transfer_descriptor_t *instance,
    4141    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)
    4343{
    4444        assert(instance);
    4545
    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);
    4749
    4850        instance->status = 0
     
    8082#endif
    8183}
    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 }
    11084/*----------------------------------------------------------------------------*/
    11185int transfer_descriptor_status(transfer_descriptor_t *instance)
    11286{
    11387        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
    116107        return EOK;
    117108}
Note: See TracChangeset for help on using the changeset viewer.