Ignore:
File:
1 edited

Legend:

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

    r0d4b110 r9d58539  
    3636
    3737#include <assert.h>
    38 #include <stdbool.h>
    39 #include <sys/types.h>
     38#include <stdint.h>
    4039
    4140#include <usb/host/endpoint.h>
     
    4544
    4645#include "completion_codes.h"
    47 #include "mem_access.h"
    4846
    4947/**
     
    118116{
    119117        assert(instance);
    120         return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_HALTED_FLAG)
    121             || (OHCI_MEM32_RD(instance->status) & ED_STATUS_K_FLAG);
    122 }
    123 
    124 static inline void ed_clear_halt(ed_t *instance)
    125 {
    126         assert(instance);
    127         OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG);
     118        return (instance->td_head & ED_TDHEAD_HALTED_FLAG)
     119            || (instance->status & ED_STATUS_K_FLAG);
    128120}
    129121
     
    136128{
    137129        assert(instance);
    138         return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_PTR_MASK)
    139             != (OHCI_MEM32_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);
    140132}
    141133
     
    149141        assert(instance);
    150142        const uintptr_t pa = addr_to_phys(td);
    151         OHCI_MEM32_WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK);
    152 }
    153 
    154 static inline uint32_t ed_tail_td(const ed_t *instance)
    155 {
    156         assert(instance);
    157         return OHCI_MEM32_RD(instance->td_tail) & ED_TDTAIL_PTR_MASK;
    158 }
    159 
    160 static inline uint32_t ed_head_td(const ed_t *instance)
    161 {
    162         assert(instance);
    163         return OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_PTR_MASK;
     143        instance->td_tail = pa & ED_TDTAIL_PTR_MASK;
    164144}
    165145
     
    175155        const uint32_t pa = addr_to_phys(next);
    176156        assert((pa & ED_NEXT_PTR_MASK) << ED_NEXT_PTR_SHIFT == pa);
    177         OHCI_MEM32_WR(instance->next, pa);
    178 }
    179 
    180 static inline uint32_t ed_next(const ed_t *instance)
    181 {
    182         assert(instance);
    183         return OHCI_MEM32_RD(instance->next) & ED_NEXT_PTR_MASK;
     157        instance->next = pa;
    184158}
    185159
     
    192166{
    193167        assert(instance);
    194         return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0;
     168        return (instance->td_head & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0;
    195169}
    196170
     
    204178        assert(instance);
    205179        if (toggle) {
    206                 OHCI_MEM32_SET(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);
     180                instance->td_head |= ED_TDHEAD_TOGGLE_CARRY;
    207181        } else {
    208182                /* Clear halted flag when reseting toggle TODO: Why? */
    209                 OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);
    210                 OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG);
     183                instance->td_head &= ~ED_TDHEAD_TOGGLE_CARRY;
     184                instance->td_head &= ~ED_TDHEAD_HALTED_FLAG;
    211185        }
    212186}
Note: See TracChangeset for help on using the changeset viewer.