Ignore:
Timestamp:
2018-02-28T16:37:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b20da0
Parents:
f5e5f73 (diff), b2dca8de (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.
git-author:
Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
git-committer:
Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
Message:

Merge github.com:helenos-xhci-team/helenos

This commit merges support for USB 3 and generally refactors, fixes,
extends and cleans up the existing USB framework.

Notable additions and features:

  • new host controller driver has been implemented to control various xHC models (among others, NEC Renesas uPD720200)
  • isochronous data transfer mode
  • support for explicit USB device removal
  • USB tablet driver
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c

    rf5e5f73 rdf6ded8  
    11/*
    22 * Copyright (c) 2014 Jan Vesely
     3 * Copyright (c) 2018 Ondrej Hlavaty
    34 * All rights reserved.
    45 *
     
    3940
    4041#include <usb/usb.h>
    41 #include <usb/host/utils/malloc32.h>
    4242
    4343#include "mem_access.h"
     
    7070};
    7171
     72#include <usb/debug.h>
     73
    7274/**
    7375 * Initialize EHCI TD.
    7476 * @param instance TD structure to initialize.
    75  * @param next Next TD in ED list.
     77 * @param next_phys Next TD in ED list.
    7678 * @param direction Used to determine PID, BOTH means setup PID.
    7779 * @param buffer Pointer to the first byte of transferred data.
     
    8082 *        any other value means that ED toggle will be used.
    8183 */
    82 void td_init(td_t *instance, const td_t *next,
    83     usb_direction_t direction, const void *buffer, size_t size, int toggle,
    84     bool ioc)
     84void td_init(td_t *instance, uintptr_t next_phys, uintptr_t buffer,
     85    usb_direction_t direction, size_t size, int toggle, bool ioc)
    8586{
    8687        assert(instance);
     
    9899        }
    99100
    100         if (buffer != NULL) {
     101        if (buffer != 0) {
    101102                assert(size != 0);
    102103                for (unsigned i = 0; (i < ARRAY_SIZE(instance->buffer_pointer))
    103104                    && size; ++i) {
    104                         const uintptr_t page =
    105                             (addr_to_phys(buffer) & TD_BUFFER_POINTER_MASK);
    106                         const size_t offset =
    107                             ((uintptr_t)buffer & TD_BUFFER_POINTER_OFFSET_MASK);
     105                        const uintptr_t offset = buffer & TD_BUFFER_POINTER_OFFSET_MASK;
    108106                        assert(offset == 0 || i == 0);
    109                         size -= min((4096 - offset), size);
    110                         buffer += min((4096 - offset), size);
    111                         EHCI_MEM32_WR(instance->buffer_pointer[i],
    112                             page | offset);
     107                        const size_t this_size = min(size, 4096 - offset);
     108                        EHCI_MEM32_WR(instance->buffer_pointer[i], buffer);
     109                        size -= this_size;
     110                        buffer += this_size;
    113111                }
    114112        }
    115113
    116         EHCI_MEM32_WR(instance->next, next ?
    117             LINK_POINTER_TD(addr_to_phys(next)) : LINK_POINTER_TERM);
     114        EHCI_MEM32_WR(instance->next, next_phys ?
     115            LINK_POINTER_TD(next_phys) : LINK_POINTER_TERM);
    118116
    119117        EHCI_MEM32_WR(instance->alternate, LINK_POINTER_TERM);
Note: See TracChangeset for help on using the changeset viewer.