Changeset 708da59e in mainline


Ignore:
Timestamp:
2015-06-29T04:42:30Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e9e80a9
Parents:
a996402e
Message:

ehci, qh: Refactor QH initialization

File:
1 edited

Legend:

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

    ra996402e r708da59e  
    3939
    4040#include "mem_access.h"
    41 
    4241#include "queue_head.h"
    4342
    44 const uint32_t speed[] = {
     43static const uint32_t speed[] = {
    4544        [USB_SPEED_LOW] = QH_EP_CHAR_EPS_LS,
    4645        [USB_SPEED_FULL] = QH_EP_CHAR_EPS_FS,
     
    5453
    5554        EHCI_MEM32_WR(instance->horizontal, LINK_POINTER_TERM);
    56         EHCI_MEM32_WR(instance->current, LINK_POINTER_TERM);
     55//      EHCI_MEM32_WR(instance->current, LINK_POINTER_TERM);
    5756        EHCI_MEM32_WR(instance->next, LINK_POINTER_TERM);
    5857        EHCI_MEM32_WR(instance->alternate, LINK_POINTER_TERM);
    5958        if (ep == NULL) {
    60                 /* Mark as halted and list head, used by endpoint lists
    61                  * as dummy */
     59                /* Mark as halted and list head,
     60                 * used by endpoint lists as dummy */
    6261                EHCI_MEM32_WR(instance->ep_char, QH_EP_CHAR_H_FLAG);
    6362                EHCI_MEM32_WR(instance->status, QH_STATUS_HALTED_FLAG);
     
    7877                EHCI_MEM32_SET(instance->ep_char, QH_EP_CHAR_DTC_FLAG);
    7978        }
     79        uint32_t ep_cap = QH_EP_CAP_C_MASK_SET(3 << 2) |
     80                    QH_EP_CAP_MULTI_SET(ep->packets);
     81        if (ep->speed != USB_SPEED_HIGH) {
     82                ep_cap |=
     83                    QH_EP_CAP_TT_PORT_SET(ep->tt.port) |
     84                    QH_EP_CAP_TT_ADDR_SET(ep->tt.address);
     85        }
     86        if (ep->transfer_type == USB_TRANSFER_INTERRUPT) {
     87                ep_cap |= QH_EP_CAP_S_MASK_SET(3);
     88        }
    8089
    8190        // TODO Figure out how to correctly use CMASK and SMASK for LS/FS
    8291        // INT transfers. Current values are just guesses
    83         /* Setting TT stuff on HS endpoints is OK, the fields are ignored,
    84          * and so is setting multi on async (should be 1 anyway)*/
    85         EHCI_MEM32_WR(instance->ep_cap,
    86             QH_EP_CAP_MULTI_SET(ep->packets) |
    87             QH_EP_CAP_TT_PORT_SET(ep->tt.port) |
    88             QH_EP_CAP_TT_ADDR_SET(ep->tt.address) |
    89             QH_EP_CAP_C_MASK_SET(3 << 2)
    90         );
     92        EHCI_MEM32_WR(instance->ep_cap, ep_cap);
    9193
    92         if (ep->transfer_type == USB_TRANSFER_INTERRUPT) {
    93                 EHCI_MEM32_SET(instance->ep_cap, QH_EP_CAP_S_MASK_SET(3));
    94         }
    9594        /* The rest of the fields are transfer working area, it should be ok to
    9695         * leave it NULL */
Note: See TracChangeset for help on using the changeset viewer.