Changeset df6ded8 in mainline for uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c
- Timestamp:
- 2018-02-28T16:37:50Z (7 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.