Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.h

    r668a2e8 r70d72dd  
    4040#include <usb/host/endpoint.h>
    4141
    42 #include "../ohci_regs.h"
    4342#include "../utils/malloc32.h"
    4443#include "transfer_descriptor.h"
     
    117116{
    118117        assert(instance);
    119         return (OHCI_RD(instance->td_head) & ED_TDHEAD_HALTED_FLAG)
    120             || (OHCI_RD(instance->status) & ED_STATUS_K_FLAG);
    121 }
    122 
    123 static inline void ed_clear_halt(ed_t *instance)
    124 {
    125         assert(instance);
    126         OHCI_CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG);
     118        return (instance->td_head & ED_TDHEAD_HALTED_FLAG)
     119            || (instance->status & ED_STATUS_K_FLAG);
    127120}
    128121
     
    135128{
    136129        assert(instance);
    137         return (OHCI_RD(instance->td_head) & ED_TDHEAD_PTR_MASK)
    138             != (OHCI_RD(instance->td_tail) & ED_TDTAIL_PTR_MASK);
     130        return (instance->td_head & ED_TDHEAD_PTR_MASK)
     131            != (instance->td_tail & ED_TDTAIL_PTR_MASK);
    139132}
    140133
     
    148141        assert(instance);
    149142        const uintptr_t pa = addr_to_phys(td);
    150         OHCI_WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK);
    151 }
    152 
    153 static inline uint32_t ed_tail_td(const ed_t *instance)
    154 {
    155         assert(instance);
    156         return OHCI_RD(instance->td_tail) & ED_TDTAIL_PTR_MASK;
    157 }
    158 
    159 static inline uint32_t ed_head_td(const ed_t *instance)
    160 {
    161         assert(instance);
    162         return OHCI_RD(instance->td_head) & ED_TDHEAD_PTR_MASK;
     143        instance->td_tail = pa & ED_TDTAIL_PTR_MASK;
    163144}
    164145
     
    174155        const uint32_t pa = addr_to_phys(next);
    175156        assert((pa & ED_NEXT_PTR_MASK) << ED_NEXT_PTR_SHIFT == pa);
    176         OHCI_WR(instance->next, pa);
    177 }
    178 
    179 static inline uint32_t ed_next(const ed_t *instance)
    180 {
    181         assert(instance);
    182         return OHCI_RD(instance->next) & ED_NEXT_PTR_MASK;
     157        instance->next = pa;
    183158}
    184159
     
    191166{
    192167        assert(instance);
    193         return (OHCI_RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0;
     168        return (instance->td_head & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0;
    194169}
    195170
     
    203178        assert(instance);
    204179        if (toggle) {
    205                 OHCI_SET(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);
     180                instance->td_head |= ED_TDHEAD_TOGGLE_CARRY;
    206181        } else {
    207182                /* Clear halted flag when reseting toggle TODO: Why? */
    208                 OHCI_CLR(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);
    209                 OHCI_CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG);
     183                instance->td_head &= ~ED_TDHEAD_TOGGLE_CARRY;
     184                instance->td_head &= ~ED_TDHEAD_HALTED_FLAG;
    210185        }
    211186}
Note: See TracChangeset for help on using the changeset viewer.