Changeset 35c37fc in mainline for uspace/drv/bus/usb/ehci/hw_struct
- Timestamp:
- 2018-01-05T20:15:08Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9e5b162
- Parents:
- b60944b
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-05 16:11:04)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-05 20:15:08)
- Location:
- uspace/drv/bus/usb/ehci/hw_struct
- Files:
-
- 3 edited
-
queue_head.h (modified) (1 diff)
-
transfer_descriptor.c (modified) (4 diffs)
-
transfer_descriptor.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hw_struct/queue_head.h
rb60944b r35c37fc 193 193 } 194 194 195 static inline void qh_set_next_td(qh_t *qh, td_t *td)195 static inline void qh_set_next_td(qh_t *qh, uintptr_t td) 196 196 { 197 197 assert(qh); 198 198 assert(td); 199 EHCI_MEM32_WR(qh->next, LINK_POINTER_TD( addr_to_phys(td)));199 EHCI_MEM32_WR(qh->next, LINK_POINTER_TD(td)); 200 200 } 201 201 -
uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c
rb60944b r35c37fc 39 39 40 40 #include <usb/usb.h> 41 #include <usb/host/utils/malloc32.h>42 41 43 42 #include "mem_access.h" … … 70 69 }; 71 70 71 #include <usb/debug.h> 72 72 73 /** 73 74 * Initialize EHCI TD. 74 75 * @param instance TD structure to initialize. 75 * @param next Next TD in ED list.76 * @param next_phys Next TD in ED list. 76 77 * @param direction Used to determine PID, BOTH means setup PID. 77 78 * @param buffer Pointer to the first byte of transferred data. … … 80 81 * any other value means that ED toggle will be used. 81 82 */ 82 void td_init(td_t *instance, const td_t *next, 83 usb_direction_t direction, const void *buffer, size_t size, int toggle, 84 bool ioc) 83 void td_init(td_t *instance, uintptr_t next_phys, uintptr_t buffer, 84 usb_direction_t direction, size_t size, int toggle, bool ioc) 85 85 { 86 86 assert(instance); … … 98 98 } 99 99 100 if (buffer != NULL) {100 if (buffer != 0) { 101 101 assert(size != 0); 102 102 for (unsigned i = 0; (i < ARRAY_SIZE(instance->buffer_pointer)) 103 103 && size; ++i) { 104 const uintptr_t page = 105 (addr_to_phys(buffer) & TD_BUFFER_POINTER_MASK); 106 const size_t offset = 107 ((uintptr_t)buffer & TD_BUFFER_POINTER_OFFSET_MASK); 104 const uintptr_t offset = buffer & TD_BUFFER_POINTER_OFFSET_MASK; 108 105 assert(offset == 0 || i == 0); 109 size -= min((4096 - offset), size);110 buffer += min((4096 - offset), size);111 EHCI_MEM32_WR(instance->buffer_pointer[i],112 page | offset);106 const size_t this_size = min(size, 4096 - offset); 107 EHCI_MEM32_WR(instance->buffer_pointer[i], buffer); 108 size -= this_size; 109 buffer += this_size; 113 110 } 114 111 } 115 112 116 EHCI_MEM32_WR(instance->next, next ?117 LINK_POINTER_TD( addr_to_phys(next)) : LINK_POINTER_TERM);113 EHCI_MEM32_WR(instance->next, next_phys ? 114 LINK_POINTER_TD(next_phys) : LINK_POINTER_TERM); 118 115 119 116 EHCI_MEM32_WR(instance->alternate, LINK_POINTER_TERM); -
uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h
rb60944b r35c37fc 37 37 #include <stddef.h> 38 38 #include <stdint.h> 39 #include <macros.h> 39 40 #include "link_pointer.h" 40 41 #include "mem_access.h" … … 75 76 /* 64 bit struct only */ 76 77 volatile uint32_t extended_bp[5]; 77 } td_t; 78 79 /* TDs must be 32-byte aligned */ 80 PADD32 [3]; 81 82 } __attribute__((packed)) td_t; 83 84 static_assert(sizeof(td_t) % 32 == 0); 78 85 79 86 static inline bool td_active(const td_t *td) … … 92 99 int td_error(const td_t *td); 93 100 94 void td_init(td_t *td, const td_t *next, usb_direction_t dir, const void * buf,101 void td_init(td_t *td, uintptr_t next_phys, uintptr_t buf, usb_direction_t dir, 95 102 size_t buf_size, int toggle, bool ioc); 96 103
Note:
See TracChangeset
for help on using the changeset viewer.
