Ignore:
Timestamp:
2011-03-21T23:42:08Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
11dd29b, 62f4212
Parents:
31b568e (diff), 87644b4 (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:

Fixes selecting a new USB address when max address has been reached.

Whitespace and code-style fixes, renames

File:
1 moved

Legend:

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

    r31b568e rb01995b  
    6969            || (pid == USB_PID_OUT));
    7070
     71        const uint32_t next_pa = addr_to_phys(next);
     72        assert((next_pa & LINK_POINTER_ADDRESS_MASK) == next_pa);
     73
    7174        instance->next = 0
    7275            | LINK_POINTER_VERTICAL_FLAG
    73             | ((next != NULL) ? addr_to_phys(next) : LINK_POINTER_TERMINATE_FLAG);
     76            | (next_pa ? next_pa : LINK_POINTER_TERMINATE_FLAG);
    7477
    7578        instance->status = 0
     
    9093            | ((pid & TD_DEVICE_PID_MASK) << TD_DEVICE_PID_POS);
    9194
    92         instance->buffer_ptr = 0;
    93 
    94         if (size) {
    95                 instance->buffer_ptr = (uintptr_t)addr_to_phys(buffer);
    96         }
     95        instance->buffer_ptr = addr_to_phys(buffer);
    9796
    9897        usb_log_debug2("Created TD(%p): %X:%X:%X:%X(%p).\n",
     
    115114        assert(instance);
    116115
    117         if ((instance->status & TD_STATUS_ERROR_STALLED) != 0)
    118                 return ESTALL;
     116        /* this is hc internal error it should never be reported */
     117        if ((instance->status & TD_STATUS_ERROR_BIT_STUFF) != 0)
     118                return EAGAIN;
    119119
     120        /* CRC or timeout error, like device not present or bad data,
     121         * it won't be reported unless err count reached zero */
    120122        if ((instance->status & TD_STATUS_ERROR_CRC) != 0)
    121123                return EBADCHECKSUM;
    122124
    123         if ((instance->status & TD_STATUS_ERROR_BUFFER) != 0)
     125        /* hc does not end transaction on these, it should never be reported */
     126        if ((instance->status & TD_STATUS_ERROR_NAK) != 0)
    124127                return EAGAIN;
    125128
     129        /* buffer overrun or underrun */
     130        if ((instance->status & TD_STATUS_ERROR_BUFFER) != 0)
     131                return ERANGE;
     132
     133        /* device babble is something serious */
    126134        if ((instance->status & TD_STATUS_ERROR_BABBLE) != 0)
    127135                return EIO;
    128136
    129         if ((instance->status & TD_STATUS_ERROR_NAK) != 0)
    130                 return EAGAIN;
    131 
    132         if ((instance->status & TD_STATUS_ERROR_BIT_STUFF) != 0)
    133                 return EAGAIN;
     137        /* stall might represent err count reaching zero or stall response from
     138         * the device, is err count reached zero, one of the above is reported*/
     139        if ((instance->status & TD_STATUS_ERROR_STALLED) != 0)
     140                return ESTALL;
    134141
    135142        return EOK;
Note: See TracChangeset for help on using the changeset viewer.