Changeset d03ade7 in mainline


Ignore:
Timestamp:
2011-01-25T21:25:39Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ee87f6
Parents:
b00163f
Message:

Enqueue transfers

Fix malloc check in uhci_add_transfer()

Location:
uspace/drv/uhci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/transfer_list.c

    rb00163f rd03ade7  
    2323  transfer_list_t *instance, transfer_descriptor_t *transfer)
    2424{
     25        assert(instance);
     26        assert(transfer);
     27
     28        uint32_t pa = (uintptr_t)addr_to_phys(transfer);
     29        assert((pa & LINK_POINTER_ADDRESS_MASK) == pa);
     30
     31        /* empty list */
     32        if (instance->first == NULL) {
     33                assert(instance->last == NULL);
     34                instance->first = instance->last = transfer;
     35        } else {
     36                assert(instance->last);
     37                instance->last->next_va = transfer;
     38
     39                assert(instance->last->next & LINK_POINTER_TERMINATE_FLAG);
     40                instance->last->next = (pa & LINK_POINTER_ADDRESS_MASK);
     41                instance->last = transfer;
     42        }
     43
     44        assert(instance->queue_head);
     45        if (instance->queue_head->element & LINK_POINTER_TERMINATE_FLAG) {
     46                instance->queue_head->element = (pa & LINK_POINTER_ADDRESS_MASK);
     47        }
     48        uhci_print_info("Successfully added transfer to the hc queue.\n");
    2549        return EOK;
    2650}
  • uspace/drv/uhci/uhci.c

    rb00163f rd03ade7  
    1313static inline int uhci_add_transfer(
    1414  device_t *dev,
    15         usb_target_t target,
    16   usb_transfer_type_t transfer_type,
    17         usb_packet_id pid,
     15  usb_target_t target,
     16  usb_transfer_type_t transfer_type,
     17  usb_packet_id pid,
    1818  void *buffer, size_t size,
    1919  usbhc_iface_transfer_out_callback_t callback_out,
    2020  usbhc_iface_transfer_in_callback_t callback_in,
    21         void *arg );
     21  void *arg );
    2222
    2323int uhci_init(device_t *device, void *regs)
     
    164164static inline int uhci_add_transfer(
    165165  device_t *dev,
    166         usb_target_t target,
    167   usb_transfer_type_t transfer_type,
    168         usb_packet_id pid,
     166  usb_target_t target,
     167  usb_transfer_type_t transfer_type,
     168  usb_packet_id pid,
    169169  void *buffer, size_t size,
    170170  usbhc_iface_transfer_out_callback_t callback_out,
    171171  usbhc_iface_transfer_in_callback_t callback_in,
    172         void *arg )
     172  void *arg )
    173173{
    174174        // TODO: Add support for isochronous transfers
     
    203203
    204204        td = trans_malloc(sizeof(transfer_descriptor_t));
    205         ret = td ? ENOMEM : EOK;
    206         CHECK_RET_TRANS_FREE_JOB_TD("Failed to allocate tranfer descriptor.\n");
     205        ret = td ? EOK : ENOMEM;
     206        CHECK_RET_TRANS_FREE_JOB_TD("Failed to allocate transfer descriptor.\n");
    207207
    208208        ret = transfer_descriptor_init(td, 3, size, false, target, pid);
Note: See TracChangeset for help on using the changeset viewer.