Ignore:
Timestamp:
2011-02-11T12:06:05Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
03197ffc, fe1776c2
Parents:
960ff451 (diff), f96aefc (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:

UHCI internals rework, add support for ew control transfer API

File:
1 edited

Legend:

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

    r960ff451 r5d4193c  
    3232 * @brief UHCI driver
    3333 */
     34#include <errno.h>
    3435#include <usb/debug.h>
    3536
    3637#include "transfer_descriptor.h"
     38#include "utils/malloc32.h"
    3739
    3840void transfer_descriptor_init(transfer_descriptor_t *instance,
    39   int error_count, size_t size, bool isochronous, usb_target_t target,
    40         int pid, void *buffer)
     41    int error_count, size_t size, bool toggle, bool isochronous,
     42    usb_target_t target, int pid, void *buffer)
    4143{
    4244        assert(instance);
    4345
    44         instance->next =
    45           0 | LINK_POINTER_TERMINATE_FLAG;
     46        instance->next = 0 | LINK_POINTER_TERMINATE_FLAG;
    4647
    47 
    48         assert(size < 1024);
    4948        instance->status = 0
    5049          | ((error_count & TD_STATUS_ERROR_COUNT_MASK) << TD_STATUS_ERROR_COUNT_POS)
    5150          | TD_STATUS_ERROR_ACTIVE;
    5251
     52        assert(size < 1024);
    5353        instance->device = 0
    5454                | (((size - 1) & TD_DEVICE_MAXLEN_MASK) << TD_DEVICE_MAXLEN_POS)
     55                | (toggle ? TD_DEVICE_DATA_TOGGLE_ONE_FLAG : 0)
    5556                | ((target.address & TD_DEVICE_ADDRESS_MASK) << TD_DEVICE_ADDRESS_POS)
    5657                | ((target.endpoint & TD_DEVICE_ENDPOINT_MASK) << TD_DEVICE_ENDPOINT_POS)
     
    5859
    5960        instance->buffer_ptr = 0;
    60 
    61         instance->next_va = NULL;
    62         instance->callback = NULL;
    6361
    6462        if (size) {
     
    106104                return USB_OUTCOME_CRCERROR;
    107105
    108         assert((((status >> TD_STATUS_ERROR_POS) & TD_STATUS_ERROR_MASK)
    109         | TD_STATUS_ERROR_RESERVED) == TD_STATUS_ERROR_RESERVED);
     106//      assert((((status >> TD_STATUS_ERROR_POS) & TD_STATUS_ERROR_MASK)
     107//      | TD_STATUS_ERROR_RESERVED) == TD_STATUS_ERROR_RESERVED);
    110108        return USB_OUTCOME_OK;
    111109}
    112 
    113 void transfer_descriptor_fini(transfer_descriptor_t *instance)
     110/*----------------------------------------------------------------------------*/
     111int transfer_descriptor_status(transfer_descriptor_t *instance)
    114112{
    115113        assert(instance);
    116         callback_run(instance->callback,
    117                 convert_outcome(instance->status),
    118                 ((instance->status >> TD_STATUS_ACTLEN_POS) + 1) & TD_STATUS_ACTLEN_MASK
    119         );
     114        if (convert_outcome(instance->status))
     115                return EINVAL; //TODO: use sane error value here
     116        return EOK;
    120117}
    121118/**
Note: See TracChangeset for help on using the changeset viewer.