Changeset 58563585 in mainline for uspace/lib
- Timestamp:
- 2016-08-31T11:15:39Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 10cb47e
- Parents:
- 7a67416
- Location:
- uspace/lib
- Files:
-
- 42 edited
-
c/arch/amd64/src/stacktrace_asm.S (modified) (1 diff)
-
c/arch/arm32/src/eabi.S (modified) (1 diff)
-
c/arch/arm32/src/stacktrace_asm.S (modified) (1 diff)
-
c/arch/ia32/src/rtld/reloc.c (modified) (3 diffs)
-
c/arch/ia32/src/syscall.S (modified) (1 diff)
-
c/arch/ia64/src/fibril.S (modified) (1 diff)
-
c/arch/ia64/src/stacktrace_asm.S (modified) (1 diff)
-
c/arch/ia64/src/syscall.S (modified) (1 diff)
-
c/arch/mips32/src/entryjmp.S (modified) (1 diff)
-
c/generic/async.c (modified) (3 diffs)
-
c/generic/dnsr.c (modified) (1 diff)
-
c/generic/rtld/module.c (modified) (5 diffs)
-
c/generic/tls.c (modified) (3 diffs)
-
c/include/fibril.h (modified) (1 diff)
-
drv/generic/driver.c (modified) (2 diffs)
-
drv/generic/remote_ahci.c (modified) (2 diffs)
-
drv/generic/remote_usb.c (modified) (4 diffs)
-
drv/include/usb_iface.h (modified) (1 diff)
-
drv/include/usbhc_iface.h (modified) (1 diff)
-
math/arch/amd64/src/sin.S (modified) (1 diff)
-
math/arch/ia32/src/cos.S (modified) (1 diff)
-
math/arch/ia32/src/sin.S (modified) (1 diff)
-
math/arch/ia32/src/trunc.S (modified) (1 diff)
-
usb/include/usb/classes/hub.h (modified) (2 diffs)
-
usb/include/usb/debug.h (modified) (1 diff)
-
usb/include/usb/descriptor.h (modified) (3 diffs)
-
usb/include/usb/dev.h (modified) (2 diffs)
-
usb/include/usb/usb.h (modified) (5 diffs)
-
usb/src/usb.c (modified) (1 diff)
-
usbdev/include/usb/dev/poll.h (modified) (1 diff)
-
usbdev/include/usb/dev/recognise.h (modified) (1 diff)
-
usbdev/src/devdrv.c (modified) (8 diffs)
-
usbdev/src/devpoll.c (modified) (4 diffs)
-
usbdev/src/pipes.c (modified) (1 diff)
-
usbdev/src/pipesinit.c (modified) (1 diff)
-
usbdev/src/recognise.c (modified) (2 diffs)
-
usbdev/src/request.c (modified) (5 diffs)
-
usbhost/include/usb/host/endpoint.h (modified) (2 diffs)
-
usbhost/include/usb/host/hcd.h (modified) (3 diffs)
-
usbhost/src/usb_transfer_batch.c (modified) (1 diff)
-
usbvirt/include/usbvirt/device.h (modified) (2 diffs)
-
usbvirt/src/ctrltransfer.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/amd64/src/stacktrace_asm.S
r7a67416 r58563585 44 44 ret 45 45 FUNCTION_END(stacktrace_pc_get) 46 -
uspace/lib/c/arch/arm32/src/eabi.S
r7a67416 r58563585 95 95 mov pc, lr 96 96 FUNCTION_END(__aeabi_uldivmod) 97 -
uspace/lib/c/arch/arm32/src/stacktrace_asm.S
r7a67416 r58563585 44 44 mov pc, lr 45 45 FUNCTION_END(stacktrace_pc_get) 46 -
uspace/lib/c/arch/ia32/src/rtld/reloc.c
r7a67416 r58563585 69 69 uint32_t sym_size; 70 70 char *str_tab; 71 71 72 72 elf_symbol_t *sym_def; 73 73 module_t *dest; … … 80 80 81 81 DPRINTF("address: 0x%x, entries: %d\n", (uintptr_t)rt, rt_entries); 82 82 83 83 for (i = 0; i < rt_entries; ++i) { 84 84 // DPRINTF("symbol %d: ", i); … … 171 171 memcpy(r_ptr, (const void *)sym_addr, sym_size); 172 172 break; 173 173 174 174 case R_386_RELATIVE: 175 175 DPRINTF("fixup R_386_RELATIVE (b+a)\n"); -
uspace/lib/c/arch/ia32/src/syscall.S
r7a67416 r58563585 63 63 FUNCTION_END(__syscall_slow) 64 64 65 66 65 /** Syscall wrapper - SYSENTER version. 67 66 * -
uspace/lib/c/arch/ia64/src/fibril.S
r7a67416 r58563585 338 338 br.ret.sptk.many b0 339 339 FUNCTION_END(context_restore) 340 -
uspace/lib/c/arch/ia64/src/stacktrace_asm.S
r7a67416 r58563585 41 41 FUNCTION_END(stacktrace_fp_get) 42 42 FUNCTION_END(stacktrace_pc_get) 43 -
uspace/lib/c/arch/ia64/src/syscall.S
r7a67416 r58563585 45 45 br.ret.sptk.many b0 46 46 FUNCTION_END(__syscall) 47 -
uspace/lib/c/arch/mips32/src/entryjmp.S
r7a67416 r58563585 51 51 addiu $sp, ABI_STACK_FRAME 52 52 FUNCTION_END(entry_point_jmp) 53 -
uspace/lib/c/generic/async.c
r7a67416 r58563585 991 991 * @param callid Hash of the incoming call. 992 992 * @param call Data of the incoming call. 993 * 993 994 */ 994 995 static void process_notification(ipc_callid_t callid, ipc_call_t *call) … … 1316 1317 fibril_t *fibril = (fibril_t *) __tcb_get()->fibril_data; 1317 1318 unsigned oldsw = fibril->switches; 1318 1319 1319 1320 process_notification(callid, call); 1320 1321 1321 1322 if (oldsw != fibril->switches) { 1322 1323 /* … … 1334 1335 fibril_switch(FIBRIL_FROM_DEAD); 1335 1336 } 1337 1336 1338 return; 1337 1339 } -
uspace/lib/c/generic/dnsr.c
r7a67416 r58563585 124 124 return (int) retval; 125 125 } 126 126 127 127 size_t act_size = IPC_GET_ARG2(answer_cname); 128 128 assert(act_size <= DNSR_NAME_MAX_SIZE); 129 129 130 130 cname_buf[act_size] = '\0'; 131 131 132 132 info->cname = str_dup(cname_buf); 133 133 134 134 if (info->cname == NULL) { 135 135 free(info); -
uspace/lib/c/generic/rtld/module.c
r7a67416 r58563585 151 151 } 152 152 } 153 153 154 154 return NULL; /* Not found */ 155 155 } … … 167 167 module_t *m; 168 168 int rc; 169 169 170 170 m = calloc(1, sizeof(module_t)); 171 171 if (m == NULL) { … … 173 173 exit(1); 174 174 } 175 175 176 176 m->rtld = rtld; 177 177 m->id = rtld_get_next_id(rtld); … … 217 217 /* Insert into the list of loaded modules */ 218 218 list_append(&m->modules_link, &rtld->modules); 219 219 220 220 /* Copy TLS info */ 221 221 m->tdata = info.tls.tdata; … … 223 223 m->tbss_size = info.tls.tbss_size; 224 224 m->tls_align = info.tls.tls_align; 225 225 226 226 DPRINTF("tdata at %p size %zu, tbss size %zu\n", 227 227 m->tdata, m->tdata_size, m->tbss_size); -
uspace/lib/c/generic/tls.c
r7a67416 r58563585 74 74 tcb_t *tcb; 75 75 size_t tls_size = &_tbss_end - &_tdata_start; 76 76 77 77 #ifdef CONFIG_RTLD 78 78 if (runtime_env != NULL) 79 79 return rtld_tls_make(runtime_env); 80 80 #endif 81 81 82 tcb = tls_alloc_arch(&data, tls_size); 82 83 if (!tcb) 83 84 return NULL; 84 85 85 86 /* 86 87 * Copy thread local data from the initialization image. … … 118 119 if (!tcb) 119 120 return NULL; 120 *data = ((void *)tcb) + sizeof(tcb_t); 121 122 *data = ((void *) tcb) + sizeof(tcb_t); 121 123 #ifdef CONFIG_RTLD 122 124 tcb->dtv = NULL; … … 148 150 { 149 151 tcb_t *tcb; 150 152 151 153 size = ALIGN_UP(size, &_tls_alignment); 152 154 *data = memalign((uintptr_t) &_tls_alignment, sizeof(tcb_t) + size); -
uspace/lib/c/include/fibril.h
r7a67416 r58563585 79 79 fibril_owner_info_t *waits_for; 80 80 81 unsigned switches;81 unsigned int switches; 82 82 } fibril_t; 83 83 -
uspace/lib/drv/generic/driver.c
r7a67416 r58563585 126 126 return; 127 127 } 128 128 129 129 ddf_dev_t *dev = create_device(); 130 130 if (!dev) { … … 133 133 return; 134 134 } 135 135 136 136 /* Add one reference that will be dropped by driver_dev_remove() */ 137 137 dev_add_ref(dev); -
uspace/lib/drv/generic/remote_ahci.c
r7a67416 r58563585 226 226 return; 227 227 } 228 228 229 229 const int ret = ahci_iface->get_sata_device_name(fun, 230 230 sata_dev_name_length, sata_dev_name); … … 235 235 (real_size == sata_dev_name_length)) 236 236 async_data_read_finalize(cid, sata_dev_name, sata_dev_name_length); 237 237 238 238 free(sata_dev_name); 239 239 async_answer_0(callid, ret); -
uspace/lib/drv/generic/remote_usb.c
r7a67416 r58563585 91 91 92 92 /** Tell devman handle of the usb device function. 93 * @param[in] exch IPC communication exchange 93 * 94 * @param[in] exch IPC communication exchange 94 95 * @param[out] handle devman handle of the HC used by the target device. 96 * 95 97 * @return Error code. 98 * 96 99 */ 97 100 int usb_get_my_device_handle(async_exch_t *exch, devman_handle_t *handle) … … 119 122 120 123 /** Release default USB address. 124 * 121 125 * @param[in] exch IPC communication exchange 126 * 122 127 * @return Error code. 128 * 123 129 */ 124 130 int usb_release_default_address(async_exch_t *exch) … … 131 137 132 138 /** Trigger USB device enumeration 133 * @param[in] exch IPC communication exchange 139 * 140 * @param[in] exch IPC communication exchange 134 141 * @param[out] handle Identifier of the newly added device (if successful) 142 * 135 143 * @return Error code. 144 * 136 145 */ 137 146 int usb_device_enumerate(async_exch_t *exch, unsigned port) … … 145 154 146 155 /** Trigger USB device enumeration 147 * @param[in] exch IPC communication exchange 156 * 157 * @param[in] exch IPC communication exchange 148 158 * @param[in] handle Identifier of the device 159 * 149 160 * @return Error code. 161 * 150 162 */ 151 163 int usb_device_remove(async_exch_t *exch, unsigned port) -
uspace/lib/drv/include/usb_iface.h
r7a67416 r58563585 44 44 typedef async_sess_t usb_dev_session_t; 45 45 46 usb_dev_session_t *usb_dev_connect(devman_handle_t);47 usb_dev_session_t *usb_dev_connect_to_self(ddf_dev_t *);48 void usb_dev_disconnect(usb_dev_session_t *);46 extern usb_dev_session_t *usb_dev_connect(devman_handle_t); 47 extern usb_dev_session_t *usb_dev_connect_to_self(ddf_dev_t *); 48 extern void usb_dev_disconnect(usb_dev_session_t *); 49 49 50 int usb_get_my_interface(async_exch_t *, int *);51 int usb_get_my_device_handle(async_exch_t *, devman_handle_t *);50 extern int usb_get_my_interface(async_exch_t *, int *); 51 extern int usb_get_my_device_handle(async_exch_t *, devman_handle_t *); 52 52 53 int usb_reserve_default_address(async_exch_t *, usb_speed_t);54 int usb_release_default_address(async_exch_t *);53 extern int usb_reserve_default_address(async_exch_t *, usb_speed_t); 54 extern int usb_release_default_address(async_exch_t *); 55 55 56 int usb_device_enumerate(async_exch_t *, unsigned port);57 int usb_device_remove(async_exch_t *, unsigned port);56 extern int usb_device_enumerate(async_exch_t *, unsigned port); 57 extern int usb_device_remove(async_exch_t *, unsigned port); 58 58 59 int usb_register_endpoint(async_exch_t *, usb_endpoint_t, usb_transfer_type_t, 60 usb_direction_t, size_t, unsigned, unsigned); 61 int usb_unregister_endpoint(async_exch_t *, usb_endpoint_t, usb_direction_t); 62 int usb_read(async_exch_t *, usb_endpoint_t, uint64_t, void *, size_t, size_t *); 63 int usb_write(async_exch_t *, usb_endpoint_t, uint64_t, const void *, size_t); 59 extern int usb_register_endpoint(async_exch_t *, usb_endpoint_t, 60 usb_transfer_type_t, usb_direction_t, size_t, unsigned, unsigned); 61 extern int usb_unregister_endpoint(async_exch_t *, usb_endpoint_t, 62 usb_direction_t); 63 extern int usb_read(async_exch_t *, usb_endpoint_t, uint64_t, void *, size_t, 64 size_t *); 65 extern int usb_write(async_exch_t *, usb_endpoint_t, uint64_t, const void *, 66 size_t); 64 67 65 68 /** Callback for outgoing transfer. */ -
uspace/lib/drv/include/usbhc_iface.h
r7a67416 r58563585 44 44 #include <stdbool.h> 45 45 46 int usbhc_read(async_exch_t *, usb_address_t, usb_endpoint_t,46 extern int usbhc_read(async_exch_t *, usb_address_t, usb_endpoint_t, 47 47 uint64_t, void *, size_t, size_t *); 48 int usbhc_write(async_exch_t *, usb_address_t, usb_endpoint_t,48 extern int usbhc_write(async_exch_t *, usb_address_t, usb_endpoint_t, 49 49 uint64_t, const void *, size_t); 50 50 -
uspace/lib/math/arch/amd64/src/sin.S
r7a67416 r58563585 77 77 retq 78 78 FUNCTION_END(sin_f64) 79 -
uspace/lib/math/arch/ia32/src/cos.S
r7a67416 r58563585 64 64 ret 65 65 FUNCTION_END(cos_f64) 66 -
uspace/lib/math/arch/ia32/src/sin.S
r7a67416 r58563585 64 64 ret 65 65 FUNCTION_END(sin_f64) 66 -
uspace/lib/math/arch/ia32/src/trunc.S
r7a67416 r58563585 61 61 ret 62 62 FUNCTION_END(trunc_f64) 63 -
uspace/lib/usb/include/usb/classes/hub.h
r7a67416 r58563585 110 110 */ 111 111 uint8_t characteristics; 112 112 113 #define HUB_CHAR_POWER_PER_PORT_FLAG (1 << 0) 113 114 #define HUB_CHAR_NO_POWER_SWITCH_FLAG (1 << 1) … … 196 197 */ 197 198 /* 7 (basic size) + 2*32 (port bitmasks) */ 198 #define USB_HUB_MAX_DESCRIPTOR_SIZE (7 + 2 * 32)199 #define USB_HUB_MAX_DESCRIPTOR_SIZE (7 + 2 * 32) 199 200 200 201 #endif -
uspace/lib/usb/include/usb/debug.h
r7a67416 r58563585 38 38 #include <sys/types.h> 39 39 #include <io/log.h> 40 41 40 42 41 void usb_dump_standard_descriptor(FILE *, const char *, const char *, -
uspace/lib/usb/include/usb/descriptor.h
r7a67416 r58563585 45 45 USB_DESCTYPE_INTERFACE = 4, 46 46 USB_DESCTYPE_ENDPOINT = 5, 47 /* New in USB 2.0 */47 /* New in USB 2.0 */ 48 48 USB_DESCTYPE_DEVICE_QUALIFIER = 6, 49 49 USB_DESCTYPE_OTHER_SPEED_CONFIGURATION = 7, … … 202 202 * HS INT and ISO transfers. */ 203 203 uint16_t max_packet_size; 204 204 205 #define ED_MPS_PACKET_SIZE_MASK 0x3ff 205 206 #define ED_MPS_PACKET_SIZE_GET(value) \ … … 207 208 #define ED_MPS_TRANS_OPPORTUNITIES_GET(value) \ 208 209 ((((value) >> 10) & 0x3) + 1) 210 209 211 /** Polling interval in milliseconds. 210 212 * Ignored for bulk and control endpoints. -
uspace/lib/usb/include/usb/dev.h
r7a67416 r58563585 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 /** @addtogroup libusb 29 30 * @{ 30 31 */ 32 31 33 /** @file 32 34 * Common USB types and functions. 33 35 */ 36 34 37 #ifndef LIBUSB_DEV_H_ 35 38 #define LIBUSB_DEV_H_ … … 37 40 #include <devman.h> 38 41 39 int usb_resolve_device_handle(const char *, devman_handle_t *); 42 extern int usb_resolve_device_handle(const char *, devman_handle_t *); 43 40 44 #endif 45 41 46 /** 42 47 * @} -
uspace/lib/usb/include/usb/usb.h
r7a67416 r58563585 114 114 /** Default USB address. */ 115 115 #define USB_ADDRESS_DEFAULT 0 116 116 117 /** Maximum address number in USB 1.1. */ 117 118 #define USB11_ADDRESS_MAX 127 … … 121 122 * 122 123 * @param ep USB address. 124 * 123 125 * @return True, if value is wihtin limits, false otherwise. 126 * 124 127 */ 125 128 static inline bool usb_address_is_valid(usb_address_t a) … … 135 138 /** Default control endpoint */ 136 139 #define USB_ENDPOINT_DEFAULT_CONTROL 0 140 137 141 /** Maximum endpoint number in USB 1.1. */ 138 142 #define USB11_ENDPOINT_MAX 16 … … 141 145 * 142 146 * @param ep USB endpoint number. 147 * 143 148 * @return True, if value is wihtin limits, false otherwise. 149 * 144 150 */ 145 151 static inline bool usb_endpoint_is_valid(usb_endpoint_t ep) … … 160 166 uint32_t packed; 161 167 } usb_target_t; 162 163 168 164 169 /** Check USB target for allowed values (address and endpoint). -
uspace/lib/usb/src/usb.c
r7a67416 r58563585 121 121 * 122 122 * @param[in] requst Setup requst data. 123 * 123 124 * @retval -1 No endpoints need reset. 124 125 * @retval 0 All endpoints need reset. 125 126 * @retval >0 Specified endpoint needs reset. 127 * 126 128 */ 127 129 int usb_request_needs_toggle_reset( -
uspace/lib/usbdev/include/usb/dev/poll.h
r7a67416 r58563585 94 94 typedef void (*usb_polling_terminted_callback_t)(usb_device_t *, bool, void *); 95 95 96 int usb_device_auto_polling(usb_device_t *, usb_endpoint_t,96 extern int usb_device_auto_polling(usb_device_t *, usb_endpoint_t, 97 97 const usb_device_auto_polling_t *, size_t); 98 98 99 int usb_device_auto_poll(usb_device_t *, usb_endpoint_t,99 extern int usb_device_auto_poll(usb_device_t *, usb_endpoint_t, 100 100 usb_polling_callback_t, size_t, int, usb_polling_terminted_callback_t, void *); 101 101 102 int usb_device_auto_polling_desc(usb_device_t *,102 extern int usb_device_auto_polling_desc(usb_device_t *, 103 103 const usb_endpoint_description_t *, const usb_device_auto_polling_t *, 104 104 size_t); 105 105 106 int usb_device_auto_poll_desc(usb_device_t *,106 extern int usb_device_auto_poll_desc(usb_device_t *, 107 107 const usb_endpoint_description_t *, usb_polling_callback_t, size_t, int, 108 108 usb_polling_terminted_callback_t, void *); -
uspace/lib/usbdev/include/usb/dev/recognise.h
r7a67416 r58563585 50 50 51 51 extern int usb_device_create_match_ids(usb_pipe_t *, match_id_list_t *); 52 52 53 #endif 53 54 -
uspace/lib/usbdev/src/devdrv.c
r7a67416 r58563585 27 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 */ 29 29 30 /** @addtogroup libusbdev 30 31 * @{ … … 55 56 /** Connection to device on USB bus */ 56 57 usb_dev_session_t *bus_session; 58 57 59 /** devman handle */ 58 60 devman_handle_t handle; 61 59 62 /** The default control pipe. */ 60 63 usb_pipe_t ctrl_pipe; 61 64 62 65 /** Other endpoint pipes. 66 * 63 67 * This is an array of other endpoint pipes in the same order as 64 68 * in usb_driver_t. 65 69 */ 66 70 usb_endpoint_mapping_t *pipes; 71 67 72 /** Number of other endpoint pipes. */ 68 73 size_t pipes_count; 74 69 75 /** Current interface. 76 * 70 77 * Usually, drivers operate on single interface only. 71 78 * This item contains the value of the interface or -1 for any. 72 79 */ 73 80 int interface_no; 81 74 82 /** Alternative interfaces. */ 75 83 usb_alternate_interfaces_t alternate_interfaces; 84 76 85 /** Some useful descriptors for USB device. */ 77 86 usb_device_descriptors_t descriptors; 87 78 88 /** Generic DDF device backing this one. DO NOT TOUCH! */ 79 89 ddf_dev_t *ddf_dev; 90 80 91 /** Custom driver data. 92 * 81 93 * Do not use the entry in generic device, that is already used 82 94 * by the framework. 83 95 */ 84 96 void *driver_data; 85 86 97 } usb_device_t; 87 98 … … 135 146 return rc; 136 147 } 137 148 138 149 /* Change current alternative */ 139 150 usb_dev->alternate_interfaces.current = alternate_setting; … … 279 290 * 280 291 * @param[in] usb_dev USB device. 292 * 281 293 */ 282 294 void usb_device_destroy_pipes(usb_device_t *usb_dev) … … 284 296 assert(usb_dev); 285 297 assert(usb_dev->pipes || usb_dev->pipes_count == 0); 298 286 299 /* Destroy the pipes. */ 287 300 for (size_t i = 0; i < usb_dev->pipes_count; ++i) { … … 291 304 usb_pipe_unregister(&usb_dev->pipes[i].pipe); 292 305 } 306 293 307 free(usb_dev->pipes); 294 308 usb_dev->pipes = NULL; … … 448 462 assert(handle); 449 463 assert(iface_no); 464 450 465 async_exch_t *exch = async_exchange_begin(sess); 451 466 if (!exch) 452 467 return EPARTY; 468 453 469 int ret = usb_get_my_device_handle(exch, handle); 454 470 if (ret == EOK) { … … 459 475 } 460 476 } 477 461 478 async_exchange_end(exch); 462 479 return ret; -
uspace/lib/usbdev/src/devpoll.c
r7a67416 r58563585 33 33 * USB device driver framework - automatic interrupt polling. 34 34 */ 35 35 36 #include <usb/dev/device.h> 36 37 #include <usb/dev/pipes.h> … … 85 86 86 87 if (params->debug > 0) { 87 const usb_endpoint_mapping_t *mapping 88 =data->polling_mapping;88 const usb_endpoint_mapping_t *mapping = 89 data->polling_mapping; 89 90 usb_log_debug("Poll (%p): started polling of `%s' - " \ 90 91 "interface %d (%s,%d,%d), %zuB/%zu.\n", … … 154 155 155 156 /* Take a rest before next request. */ 156 //TODO: This is broken, the time is in ms not us. 157 158 // FIXME TODO: This is broken, the time is in ms not us. 157 159 // but first we need to fix drivers to actually stop using this, 158 // since polling de aly should be implemented in HC schedule160 // since polling delay should be implemented in HC schedule 159 161 async_usleep(params->delay); 160 162 } … … 213 215 if (request_size == 0) 214 216 return EINVAL; 215 217 216 218 if (!epm || (epm->pipe.transfer_type != USB_TRANSFER_INTERRUPT) || 217 219 (epm->pipe.direction != USB_DIRECTION_IN)) 218 220 return EINVAL; 219 221 220 222 221 223 polling_data_t *polling_data = malloc(sizeof(polling_data_t)); -
uspace/lib/usbdev/src/pipes.c
r7a67416 r58563585 98 98 async_exch_t *exch = async_exchange_begin(pipe->bus_session); 99 99 size_t act_size = 0; 100 const int rc = usb_read(exch, 101 pipe->endpoint_no, setup_packet, buffer,buffer_size, &act_size);100 const int rc = usb_read(exch, pipe->endpoint_no, setup_packet, buffer, 101 buffer_size, &act_size); 102 102 async_exchange_end(exch); 103 103 -
uspace/lib/usbdev/src/pipesinit.c
r7a67416 r58563585 286 286 usb_dev_session_t *bus_session) 287 287 { 288 289 if (config_descriptor == NULL) { 288 if (config_descriptor == NULL) 290 289 return EBADMEM; 291 }292 if (config_descriptor_size 293 <sizeof(usb_standard_configuration_descriptor_t)) {290 291 if (config_descriptor_size < 292 sizeof(usb_standard_configuration_descriptor_t)) { 294 293 return ERANGE; 295 294 } -
uspace/lib/usbdev/src/recognise.c
r7a67416 r58563585 234 234 (int) device_descriptor->product_id, 235 235 BCD_ARGS(device_descriptor->device_version)); 236 236 237 237 /* Next, without release number. */ 238 238 ADD_MATCHID_OR_RETURN(matches, 90, … … 245 245 ADD_MATCHID_OR_RETURN(matches, 50, "usb&class=%s", 246 246 usb_str_class(device_descriptor->device_class)); 247 247 248 248 /* As a last resort, try fallback driver. */ 249 249 ADD_MATCHID_OR_RETURN(matches, 10, "usb&fallback"); -
uspace/lib/usbdev/src/request.c
r7a67416 r58563585 50 50 * @see usb_pipe_control_write 51 51 * 52 * @param pipe Pipe used for the communication.52 * @param pipe Pipe used for the communication. 53 53 * @param request_type Request type (standard/class/vendor). 54 * @param recipient Request recipient (e.g. device or endpoint). 55 * @param request Actual request (e.g. GET_DESCRIPTOR). 56 * @param value Value of @c wValue field of setup packet 57 * (must be in USB endianness). 58 * @param index Value of @c wIndex field of setup packet 59 * (must be in USB endianness). 60 * @param data Data to be sent during DATA stage 61 * (expected to be in USB endianness). 62 * @param data_size Size of the @p data buffer (in native endianness). 54 * @param recipient Request recipient (e.g. device or endpoint). 55 * @param request Actual request (e.g. GET_DESCRIPTOR). 56 * @param value Value of @c wValue field of setup packet 57 * (must be in USB endianness). 58 * @param index Value of @c wIndex field of setup packet 59 * (must be in USB endianness). 60 * @param data Data to be sent during DATA stage 61 * (expected to be in USB endianness). 62 * @param data_size Size of the @p data buffer (in native endianness). 63 * 63 64 * @return Error code. 64 65 * @retval EBADMEM @p pipe is NULL. 65 66 * @retval EBADMEM @p data is NULL and @p data_size is not zero. 66 67 * @retval ERANGE Data buffer too large. 68 * 67 69 */ 68 70 int usb_control_request_set(usb_pipe_t *pipe, … … 100 102 } 101 103 102 /** Generic wrapper for GET requests using standard control request format. 103 * 104 * @see usb_pipe_control_read 105 * 106 * @param pipe Pipe used for the communication. 107 * @param request_type Request type (standard/class/vendor). 108 * @param recipient Request recipient (e.g. device or endpoint). 109 * @param request Actual request (e.g. GET_DESCRIPTOR). 110 * @param value Value of @c wValue field of setup packet 111 * (must be in USB endianness). 112 * @param index Value of @c wIndex field of setup packet 113 * (must be in USB endianness). 114 * @param data Buffer where to store data accepted during the DATA stage. 115 * (they will come in USB endianness). 116 * @param data_size Size of the @p data buffer 117 * (in native endianness). 118 * @param actual_data_size Actual size of transfered data 119 * (in native endianness). 120 * @return Error code. 121 * @retval EBADMEM @p pipe is NULL. 122 * @retval EBADMEM @p data is NULL and @p data_size is not zero. 123 * @retval ERANGE Data buffer too large. 124 */ 104 /** Generic wrapper for GET requests using standard control request format. 105 * 106 * @see usb_pipe_control_read 107 * 108 * @param pipe Pipe used for the communication. 109 * @param request_type Request type (standard/class/vendor). 110 * @param recipient Request recipient (e.g. device or endpoint). 111 * @param request Actual request (e.g. GET_DESCRIPTOR). 112 * @param value Value of @c wValue field of setup packet 113 * (must be in USB endianness). 114 * @param index Value of @c wIndex field of setup packet 115 * (must be in USB endianness). 116 * @param data Buffer where to store data accepted during 117 * the DATA stage (they will come in USB endianness). 118 * @param data_size Size of the @p data buffer 119 * (in native endianness). 120 * @param actual_data_size Actual size of transfered data 121 * (in native endianness). 122 * 123 * @return Error code. 124 * @retval EBADMEM @p pipe is NULL. 125 * @retval EBADMEM @p data is NULL and @p data_size is not zero. 126 * @retval ERANGE Data buffer too large. 127 * 128 */ 125 129 int usb_control_request_get(usb_pipe_t *pipe, 126 130 usb_request_type_t request_type, usb_request_recipient_t recipient, … … 209 213 { 210 214 if (request_type == USB_REQUEST_TYPE_STANDARD) { 211 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) 212 { 215 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) { 213 216 return EINVAL; 214 217 } … … 234 237 { 235 238 if (request_type == USB_REQUEST_TYPE_STANDARD) { 236 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) 237 { 239 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) { 238 240 return EINVAL; 239 241 } … … 271 273 } 272 274 273 /* The wValue field specifies the descriptor type in the high byte 275 /* 276 * The wValue field specifies the descriptor type in the high byte 274 277 * and the descriptor index in the low byte. USB 1.1 spec p. 189 275 278 */ -
uspace/lib/usbhost/include/usb/host/endpoint.h
r7a67416 r58563585 88 88 } endpoint_t; 89 89 90 endpoint_t * endpoint_create(usb_address_t address, usb_endpoint_t endpoint, 91 usb_direction_t direction, usb_transfer_type_t type, usb_speed_t speed, 92 size_t max_packet_size, unsigned packets, size_t bw, 93 usb_address_t tt_address, unsigned tt_port); 94 void endpoint_destroy(endpoint_t *instance); 90 extern endpoint_t *endpoint_create(usb_address_t, usb_endpoint_t, 91 usb_direction_t, usb_transfer_type_t, usb_speed_t, size_t, unsigned int, 92 size_t, usb_address_t, unsigned int); 93 extern void endpoint_destroy(endpoint_t *); 95 94 96 void endpoint_add_ref(endpoint_t *instance);97 void endpoint_del_ref(endpoint_t *instance);95 extern void endpoint_add_ref(endpoint_t *); 96 extern void endpoint_del_ref(endpoint_t *); 98 97 99 void endpoint_set_hc_data(endpoint_t *instance,100 void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int));101 void endpoint_clear_hc_data(endpoint_t *instance);98 extern void endpoint_set_hc_data(endpoint_t *, void *, int (*)(void *), 99 void (*)(void *, int)); 100 extern void endpoint_clear_hc_data(endpoint_t *); 102 101 103 void endpoint_use(endpoint_t *instance);104 void endpoint_release(endpoint_t *instance);102 extern void endpoint_use(endpoint_t *); 103 extern void endpoint_release(endpoint_t *); 105 104 106 int endpoint_toggle_get(endpoint_t *instance);107 void endpoint_toggle_set(endpoint_t *instance, int toggle);105 extern int endpoint_toggle_get(endpoint_t *); 106 extern void endpoint_toggle_set(endpoint_t *, int); 108 107 109 108 /** list_get_instance wrapper. 109 * 110 110 * @param item Pointer to link member. 111 * 111 112 * @return Pointer to endpoint_t structure. 113 * 112 114 */ 113 115 static inline endpoint_t * endpoint_get_instance(link_t *item) … … 116 118 } 117 119 #endif 120 118 121 /** 119 122 * @} -
uspace/lib/usbhost/include/usb/host/hcd.h
r7a67416 r58563585 81 81 }; 82 82 83 void hcd_init(hcd_t *hcd, usb_speed_t max_speed, size_t bandwidth, 84 bw_count_func_t bw_count); 83 extern void hcd_init(hcd_t *, usb_speed_t, size_t, bw_count_func_t); 85 84 86 85 static inline void hcd_set_implementation(hcd_t *hcd, void *data, … … 102 101 } 103 102 104 usb_address_t hcd_request_address(hcd_t *hcd, usb_speed_t speed);103 extern usb_address_t hcd_request_address(hcd_t *, usb_speed_t); 105 104 106 int hcd_release_address(hcd_t *hcd, usb_address_t address);105 extern int hcd_release_address(hcd_t *, usb_address_t); 107 106 108 int hcd_reserve_default_address(hcd_t *hcd, usb_speed_t speed);107 extern int hcd_reserve_default_address(hcd_t *, usb_speed_t); 109 108 110 109 static inline int hcd_release_default_address(hcd_t *hcd) … … 113 112 } 114 113 115 int hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir,116 usb_transfer_type_t type, size_t max_packet_size, unsigned packets,117 size_t size, usb_address_t tt_address, unsigned tt_port);114 extern int hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t, 115 usb_transfer_type_t, size_t, unsigned int, size_t, usb_address_t, 116 unsigned int); 118 117 119 int hcd_remove_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir);118 extern int hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t); 120 119 121 int hcd_send_batch(hcd_t *hcd, usb_target_t target, usb_direction_t direction, 122 void *data, size_t size, uint64_t setup_data, 123 usbhc_iface_transfer_in_callback_t in, 124 usbhc_iface_transfer_out_callback_t out, void *arg, const char* name); 120 extern int hcd_send_batch(hcd_t *, usb_target_t, usb_direction_t, void *, 121 size_t, uint64_t, usbhc_iface_transfer_in_callback_t, 122 usbhc_iface_transfer_out_callback_t, void *, const char *); 125 123 126 ssize_t hcd_send_batch_sync(hcd_t *hcd, usb_target_t target, 127 usb_direction_t dir, void *data, size_t size, uint64_t setup_data, 128 const char* name); 124 extern ssize_t hcd_send_batch_sync(hcd_t *, usb_target_t, usb_direction_t, 125 void *, size_t, uint64_t, const char *); 129 126 130 127 #endif 128 131 129 /** 132 130 * @} -
uspace/lib/usbhost/src/usb_transfer_batch.c
r7a67416 r58563585 56 56 * @return Pointer to valid usb_transfer_batch_t structure, NULL on failure. 57 57 */ 58 usb_transfer_batch_t * usb_transfer_batch_create( 59 endpoint_t *ep, 60 char *buffer, 58 usb_transfer_batch_t *usb_transfer_batch_create(endpoint_t *ep, char *buffer, 61 59 size_t buffer_size, 62 60 uint64_t setup_buffer, 63 61 usbhc_iface_transfer_in_callback_t func_in, 64 62 usbhc_iface_transfer_out_callback_t func_out, 65 void *arg 66 ) 63 void *arg) 67 64 { 68 65 if (func_in == NULL && func_out == NULL) -
uspace/lib/usbvirt/include/usbvirt/device.h
r7a67416 r58563585 41 41 #include <async.h> 42 42 #include <errno.h> 43 44 43 45 44 /** Maximum number of endpoints supported by virtual USB. */ … … 240 239 }; 241 240 242 243 int req_nop(usbvirt_device_t *device, 241 extern int req_nop(usbvirt_device_t *device, 244 242 const usb_device_request_setup_packet_t *setup_packet, 245 243 uint8_t *data, size_t *act_size); 246 244 247 int usbvirt_device_plug(usbvirt_device_t *, const char *); 248 void usbvirt_device_unplug(usbvirt_device_t *); 249 250 void usbvirt_control_reply_helper(const usb_device_request_setup_packet_t *, 251 uint8_t *, size_t *, const void *, size_t); 252 253 int usbvirt_control_write(usbvirt_device_t *, const void *, size_t, void *, size_t); 254 int usbvirt_control_read(usbvirt_device_t *, const void *, size_t, void *, size_t, size_t *); 255 int usbvirt_data_out(usbvirt_device_t *, usb_transfer_type_t, usb_endpoint_t, 245 extern int usbvirt_device_plug(usbvirt_device_t *, const char *); 246 extern void usbvirt_device_unplug(usbvirt_device_t *); 247 248 extern void usbvirt_control_reply_helper( 249 const usb_device_request_setup_packet_t *, uint8_t *, size_t *, 256 250 const void *, size_t); 257 int usbvirt_data_in(usbvirt_device_t *, usb_transfer_type_t, usb_endpoint_t, 251 252 extern int usbvirt_control_write(usbvirt_device_t *, const void *, size_t, 253 void *, size_t); 254 extern int usbvirt_control_read(usbvirt_device_t *, const void *, size_t, 258 255 void *, size_t, size_t *); 256 extern int usbvirt_data_out(usbvirt_device_t *, usb_transfer_type_t, 257 usb_endpoint_t, const void *, size_t); 258 extern int usbvirt_data_in(usbvirt_device_t *, usb_transfer_type_t, 259 usb_endpoint_t, void *, size_t, size_t *); 259 260 260 261 #endif -
uspace/lib/usbvirt/src/ctrltransfer.c
r7a67416 r58563585 60 60 return EFORWARD; 61 61 } 62 62 63 const usbvirt_control_request_handler_t *handler = control_handlers; 63 64 for (;handler->callback != NULL; ++handler) {
Note:
See TracChangeset
for help on using the changeset viewer.
