Ignore:
Timestamp:
2011-04-15T13:19:59Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
da1dd48
Parents:
e3b5129 (diff), 8fd4ba0 (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.
Message:

Development changes

File:
1 edited

Legend:

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

    re3b5129 rc7dd69d  
    5353#define ED_STATUS_D_MASK (0x3)     /* direction */
    5454#define ED_STATUS_D_SHIFT (11)
    55 #define ED_STATUS_D_IN (0x1)
    56 #define ED_STATUS_D_OUT (0x2)
     55#define ED_STATUS_D_OUT (0x1)
     56#define ED_STATUS_D_IN (0x2)
    5757#define ED_STATUS_D_TRANSFER (0x3)
    5858
     
    7373#define ED_TDHEAD_ZERO_SHIFT (2)
    7474#define ED_TDHEAD_TOGGLE_CARRY (0x2)
     75#define ED_TDHEAD_HALTED_FLAG (0x1)
    7576
    7677        volatile uint32_t next;
     
    8182void ed_init(ed_t *instance, endpoint_t *ep);
    8283
    83 static inline void ed_add_tds(ed_t *instance, td_t *head, td_t *tail)
     84static inline void ed_set_td(ed_t *instance, td_t *td)
    8485{
    8586        assert(instance);
    86         instance->td_head = addr_to_phys(head) & ED_TDHEAD_PTR_MASK;
    87         instance->td_tail = addr_to_phys(tail) & ED_TDTAIL_PTR_MASK;
     87        uintptr_t pa = addr_to_phys(td);
     88        instance->td_head =
     89            ((pa & ED_TDHEAD_PTR_MASK)
     90            | (instance->td_head & ~ED_TDHEAD_PTR_MASK));
     91        instance->td_tail = pa & ED_TDTAIL_PTR_MASK;
     92}
     93
     94static inline void ed_set_end_td(ed_t *instance, td_t *td)
     95{
     96        assert(instance);
     97        uintptr_t pa = addr_to_phys(td);
     98        instance->td_tail = pa & ED_TDTAIL_PTR_MASK;
    8899}
    89100
     
    97108}
    98109
     110static inline int ed_toggle_get(ed_t *instance)
     111{
     112        assert(instance);
     113        return (instance->td_head & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0;
     114}
     115
     116static inline void ed_toggle_set(ed_t *instance, int toggle)
     117{
     118        assert(instance);
     119        assert(toggle == 0 || toggle == 1);
     120        if (toggle == 1) {
     121                instance->td_head |= ED_TDHEAD_TOGGLE_CARRY;
     122        } else {
     123                /* clear halted flag when reseting toggle */
     124                instance->td_head &= ~ED_TDHEAD_TOGGLE_CARRY;
     125                instance->td_head &= ~ED_TDHEAD_HALTED_FLAG;
     126        }
     127}
    99128#endif
    100129/**
Note: See TracChangeset for help on using the changeset viewer.