Changeset df6ded8 in mainline for uspace/drv/bus/usb/ohci/hw_struct
- Timestamp:
- 2018-02-28T16:37:50Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b20da0
- Parents:
- f5e5f73 (diff), b2dca8de (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. - git-author:
- Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
- git-committer:
- Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
- Location:
- uspace/drv/bus/usb/ohci/hw_struct
- Files:
-
- 5 edited
-
endpoint_descriptor.c (modified) (3 diffs)
-
endpoint_descriptor.h (modified) (4 diffs)
-
iso_transfer_descriptor.h (modified) (1 diff)
-
transfer_descriptor.c (modified) (1 diff)
-
transfer_descriptor.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.c
rf5e5f73 rdf6ded8 40 40 #include <usb/usb.h> 41 41 #include <usb/host/utils/malloc32.h> 42 #include <usb/host/endpoint.h> 43 #include <usb/host/bus.h> 42 44 43 45 #include "mem_access.h" … … 79 81 /* Status: address, endpoint nr, direction mask and max packet size. */ 80 82 OHCI_MEM32_WR(instance->status, 81 ((ep-> address & ED_STATUS_FA_MASK) << ED_STATUS_FA_SHIFT)83 ((ep->device->address & ED_STATUS_FA_MASK) << ED_STATUS_FA_SHIFT) 82 84 | ((ep->endpoint & ED_STATUS_EN_MASK) << ED_STATUS_EN_SHIFT) 83 85 | ((dir[ep->direction] & ED_STATUS_D_MASK) << ED_STATUS_D_SHIFT) 84 | ((ep->max_packet_size & ED_STATUS_MPS_MASK) 85 << ED_STATUS_MPS_SHIFT)); 86 | ((ep->max_packet_size & ED_STATUS_MPS_MASK) << ED_STATUS_MPS_SHIFT)); 86 87 87 88 /* Low speed flag */ 88 if (ep-> speed == USB_SPEED_LOW)89 if (ep->device->speed == USB_SPEED_LOW) 89 90 OHCI_MEM32_SET(instance->status, ED_STATUS_S_FLAG); 90 91 … … 98 99 OHCI_MEM32_WR(instance->td_head, pa & ED_TDHEAD_PTR_MASK); 99 100 OHCI_MEM32_WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK); 100 101 /* Set toggle bit */102 if (ep->toggle)103 OHCI_MEM32_SET(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);104 105 101 } 106 102 /** -
uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.h
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2011 Jan Vesely 3 * Copyright (c) 2018 Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 106 107 #define ED_NEXT_PTR_MASK (0xfffffff0) 107 108 #define ED_NEXT_PTR_SHIFT (0) 108 } __attribute__((packed )) ed_t;109 } __attribute__((packed, aligned(32))) ed_t; 109 110 110 111 void ed_init(ed_t *instance, const endpoint_t *ep, const td_t *td); … … 162 163 assert(instance); 163 164 return OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_PTR_MASK; 165 } 166 167 /** 168 * Set the HeadP of ED. Do not call unless the ED is Halted. 169 * @param instance ED 170 */ 171 static inline void ed_set_head_td(ed_t *instance, const td_t *td) 172 { 173 assert(instance); 174 const uintptr_t pa = addr_to_phys(td); 175 OHCI_MEM32_WR(instance->td_head, pa & ED_TDHEAD_PTR_MASK); 164 176 } 165 177 … … 192 204 { 193 205 assert(instance); 194 return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0;206 return !!(OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY); 195 207 } 196 208 -
uspace/drv/bus/usb/ohci/hw_struct/iso_transfer_descriptor.h
rf5e5f73 rdf6ded8 69 69 #define ITD_OFFSET_CC_SHIFT (12) 70 70 71 } __attribute__((packed )) itd_t;71 } __attribute__((packed, aligned(32))) itd_t; 72 72 73 73 #endif -
uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c
rf5e5f73 rdf6ded8 88 88 } 89 89 90 td_set_next(instance, next); 91 } 92 93 void td_set_next(td_t *instance, const td_t *next) 94 { 90 95 OHCI_MEM32_WR(instance->next, addr_to_phys(next) & TD_NEXT_PTR_MASK); 96 } 91 97 92 }93 98 /** 94 99 * @} -
uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h
rf5e5f73 rdf6ded8 90 90 */ 91 91 volatile uint32_t be; 92 } __attribute__((packed )) td_t;92 } __attribute__((packed, aligned(32))) td_t; 93 93 94 void td_init(td_t * instance, const td_t *next,95 usb_direction_t dir, const void *buffer, size_t size, int toggle);94 void td_init(td_t *, const td_t *, usb_direction_t, const void *, size_t, int); 95 void td_set_next(td_t *, const td_t *); 96 96 97 97 /** … … 103 103 { 104 104 assert(instance); 105 const int cc = (OHCI_MEM32_RD(instance->status)106 >> TD_STATUS_CC_SHIFT)& TD_STATUS_CC_MASK;105 const int cc = (OHCI_MEM32_RD(instance->status) >> TD_STATUS_CC_SHIFT) 106 & TD_STATUS_CC_MASK; 107 107 /* This value is changed on transfer completion, 108 108 * either to CC_NOERROR or and error code.
Note:
See TracChangeset
for help on using the changeset viewer.
