Changeset 42de21a in mainline


Ignore:
Timestamp:
2014-01-24T03:24:54Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dc44023
Parents:
4e732f1a
Message:

ehci: implement toggle bit manipulation

Location:
uspace/drv/bus/usb/ehci
Files:
2 edited

Legend:

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

    r4e732f1a r42de21a  
    3535#include <assert.h>
    3636#include <stdlib.h>
     37#include <usb/debug.h>
    3738
    3839#include "utils/malloc32.h"
     
    5051        assert(instance);
    5152        assert(instance->qh);
    52 //      qh_toggle_set(instance->qh, toggle);
     53        if (qh_toggle_from_td(instance->qh))
     54                usb_log_warning("Setting toggle bit for transfer directed EP\n");
     55        qh_toggle_set(instance->qh, toggle);
    5356}
    5457
     
    6366        assert(instance);
    6467        assert(instance->qh);
    65         return 0;
    66 //      return qh_toggle_get(instance->qh);
     68        if (qh_toggle_from_td(instance->qh))
     69                usb_log_warning("Reading useless toggle bit\n");
     70        return qh_toggle_get(instance->qh);
    6771}
    6872
  • uspace/drv/bus/usb/ehci/hw_struct/queue_head.h

    r4e732f1a r42de21a  
    154154{
    155155        assert(qh);
    156         return (qh->horizontal & LINK_POINTER_ADDRESS_MASK);
     156        return (EHCI_MEM32_RD(qh->horizontal) & LINK_POINTER_ADDRESS_MASK);
    157157}
     158
     159static inline bool qh_toggle_from_td(const qh_t *qh)
     160{
     161        assert(qh);
     162        return (EHCI_MEM32_RD(qh->ep_cap) & QH_EP_CHAR_DTC_FLAG);
     163}
     164
     165static inline void qh_toggle_set(qh_t *qh, int toggle)
     166{
     167        assert(qh);
     168        if (toggle)
     169                EHCI_MEM32_SET(qh->status, QH_STATUS_TOGGLE_FLAG);
     170        else
     171                EHCI_MEM32_CLR(qh->status, QH_STATUS_TOGGLE_FLAG);
     172}
     173
     174static inline int qh_toggle_get(const qh_t *qh)
     175{
     176        assert(qh);
     177        return (EHCI_MEM32_RD(qh->status) & QH_STATUS_TOGGLE_FLAG) ? 1 : 0;
     178}
     179
    158180
    159181void qh_init(qh_t *instance, const endpoint_t *ep);
Note: See TracChangeset for help on using the changeset viewer.