Changeset df6ded8 in mainline for uspace/drv/bus/usb/ehci/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/ehci/hw_struct
- Files:
-
- 6 edited
-
iso_transfer_descriptor.h (modified) (1 diff)
-
queue_head.c (modified) (4 diffs)
-
queue_head.h (modified) (2 diffs)
-
split_iso_transfer_descriptor.h (modified) (1 diff)
-
transfer_descriptor.c (modified) (5 diffs)
-
transfer_descriptor.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hw_struct/iso_transfer_descriptor.h
rf5e5f73 rdf6ded8 72 72 /* 64 bit struct only */ 73 73 volatile uint32_t extended_bp[7]; 74 } itd_t;74 } __attribute__((packed, aligned(32))) itd_t; 75 75 #endif 76 76 /** -
uspace/drv/bus/usb/ehci/hw_struct/queue_head.c
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2013 Jan Vesely 3 * Copyright (c) 2018 Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 37 38 #include <mem.h> 38 39 #include <macros.h> 40 #include <usb/host/bus.h> 39 41 40 42 #include "mem_access.h" … … 63 65 return; 64 66 } 65 assert(ep-> speed < ARRAY_SIZE(speed));67 assert(ep->device->speed < ARRAY_SIZE(speed)); 66 68 EHCI_MEM32_WR(instance->ep_char, 67 QH_EP_CHAR_ADDR_SET(ep-> address) |69 QH_EP_CHAR_ADDR_SET(ep->device->address) | 68 70 QH_EP_CHAR_EP_SET(ep->endpoint) | 69 speed[ep->speed] | 70 QH_EP_CHAR_MAX_LENGTH_SET(ep->max_packet_size) 71 ); 71 speed[ep->device->speed] | 72 QH_EP_CHAR_MAX_LENGTH_SET(ep->max_packet_size)); 72 73 if (ep->transfer_type == USB_TRANSFER_CONTROL) { 73 if (ep-> speed != USB_SPEED_HIGH)74 if (ep->device->speed != USB_SPEED_HIGH) 74 75 EHCI_MEM32_SET(instance->ep_char, QH_EP_CHAR_C_FLAG); 75 76 /* Let BULK and INT use queue head managed toggle, … … 78 79 } 79 80 uint32_t ep_cap = QH_EP_CAP_C_MASK_SET(3 << 2) | 80 QH_EP_CAP_MULTI_SET(ep->packets); 81 if (ep->speed != USB_SPEED_HIGH) { 81 QH_EP_CAP_MULTI_SET(ep->packets_per_uframe); 82 if (usb_speed_is_11(ep->device->speed)) { 83 assert(ep->device->tt.dev != NULL); 82 84 ep_cap |= 83 QH_EP_CAP_TT_PORT_SET(ep-> tt.port) |84 QH_EP_CAP_TT_ADDR_SET(ep-> tt.address);85 QH_EP_CAP_TT_PORT_SET(ep->device->tt.port) | 86 QH_EP_CAP_TT_ADDR_SET(ep->device->tt.dev->address); 85 87 } 86 88 if (ep->transfer_type == USB_TRANSFER_INTERRUPT) { -
uspace/drv/bus/usb/ehci/hw_struct/queue_head.h
rf5e5f73 rdf6ded8 143 143 /* 64 bit struct only */ 144 144 volatile uint32_t extended_bp[5]; 145 } qh_t;145 } __attribute__((packed, aligned(32))) qh_t; 146 146 147 147 static inline void qh_append_qh(qh_t *qh, const qh_t *next) … … 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/split_iso_transfer_descriptor.h
rf5e5f73 rdf6ded8 89 89 /* 64 bit struct only */ 90 90 volatile uint32_t extended_bp[2]; 91 } sitd_t;91 } __attribute__((packed, aligned(32))) sitd_t; 92 92 #endif 93 93 /** -
uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2014 Jan Vesely 3 * Copyright (c) 2018 Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 39 40 40 41 #include <usb/usb.h> 41 #include <usb/host/utils/malloc32.h>42 42 43 43 #include "mem_access.h" … … 70 70 }; 71 71 72 #include <usb/debug.h> 73 72 74 /** 73 75 * Initialize EHCI TD. 74 76 * @param instance TD structure to initialize. 75 * @param next Next TD in ED list.77 * @param next_phys Next TD in ED list. 76 78 * @param direction Used to determine PID, BOTH means setup PID. 77 79 * @param buffer Pointer to the first byte of transferred data. … … 80 82 * any other value means that ED toggle will be used. 81 83 */ 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) 84 void td_init(td_t *instance, uintptr_t next_phys, uintptr_t buffer, 85 usb_direction_t direction, size_t size, int toggle, bool ioc) 85 86 { 86 87 assert(instance); … … 98 99 } 99 100 100 if (buffer != NULL) {101 if (buffer != 0) { 101 102 assert(size != 0); 102 103 for (unsigned i = 0; (i < ARRAY_SIZE(instance->buffer_pointer)) 103 104 && 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); 105 const uintptr_t offset = buffer & TD_BUFFER_POINTER_OFFSET_MASK; 108 106 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);107 const size_t this_size = min(size, 4096 - offset); 108 EHCI_MEM32_WR(instance->buffer_pointer[i], buffer); 109 size -= this_size; 110 buffer += this_size; 113 111 } 114 112 } 115 113 116 EHCI_MEM32_WR(instance->next, next ?117 LINK_POINTER_TD( addr_to_phys(next)) : LINK_POINTER_TERM);114 EHCI_MEM32_WR(instance->next, next_phys ? 115 LINK_POINTER_TD(next_phys) : LINK_POINTER_TERM); 118 116 119 117 EHCI_MEM32_WR(instance->alternate, LINK_POINTER_TERM); -
uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h
rf5e5f73 rdf6ded8 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 } __attribute__((packed,aligned(32))) td_t; 80 81 static_assert(sizeof(td_t) % 32 == 0); 78 82 79 83 static inline bool td_active(const td_t *td) … … 92 96 errno_t td_error(const td_t *td); 93 97 94 void td_init(td_t *td, const td_t *next, usb_direction_t dir, const void * buf,98 void td_init(td_t *td, uintptr_t next_phys, uintptr_t buf, usb_direction_t dir, 95 99 size_t buf_size, int toggle, bool ioc); 96 100
Note:
See TracChangeset
for help on using the changeset viewer.
