Changes in / [aca85e4:818dc00] in mainline
- Files:
-
- 7 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
raca85e4 r818dc00 62 62 ./uspace/app/trace/trace 63 63 ./uspace/app/usb/usb 64 ./uspace/app/usbinfo/usbinfo 64 65 ./uspace/app/virtusbkbd/vuk 65 ./uspace/dist/app/bdsh 66 ./uspace/dist/app/edit 67 ./uspace/dist/app/getterm 68 ./uspace/dist/app/klog 69 ./uspace/dist/app/mkfat 70 ./uspace/dist/app/netecho 71 ./uspace/dist/app/netstart 72 ./uspace/dist/app/nettest1 73 ./uspace/dist/app/nettest2 74 ./uspace/dist/app/ping 75 ./uspace/dist/app/redir 76 ./uspace/dist/app/sbi 77 ./uspace/dist/app/stats 78 ./uspace/dist/app/taskdump 79 ./uspace/dist/app/tasks 80 ./uspace/dist/app/tester 81 ./uspace/dist/app/test_serial 82 ./uspace/dist/app/tetris 83 ./uspace/dist/app/top 84 ./uspace/dist/app/trace 85 ./uspace/dist/app/usb 86 ./uspace/dist/app/vuk 66 ./uspace/dist/app/* 87 67 ./uspace/dist/cfg/net/general 88 68 ./uspace/dist/cfg/net/lo -
boot/Makefile.common
raca85e4 r818dc00 142 142 $(USPACE_PATH)/app/ping/ping \ 143 143 $(USPACE_PATH)/app/stats/stats \ 144 $(USPACE_PATH)/app/virtusbkbd/vuk \145 144 $(USPACE_PATH)/app/tasks/tasks \ 146 $(USPACE_PATH)/app/top/top 145 $(USPACE_PATH)/app/top/top \ 146 $(USPACE_PATH)/app/usbinfo/usbinfo \ 147 $(USPACE_PATH)/app/virtusbkbd/vuk 147 148 148 149 ifneq ($(CONFIG_BAREBONE),y) -
uspace/Makefile
raca85e4 r818dc00 49 49 app/trace \ 50 50 app/top \ 51 app/usbinfo \ 51 52 app/virtusbkbd \ 52 53 app/netecho \ -
uspace/drv/uhci/main.c
raca85e4 r818dc00 27 27 */ 28 28 #include <usb/hcdhubd.h> 29 #include <usb/debug.h> 29 30 #include <errno.h> 30 31 #include "uhci.h" … … 36 37 static int uhci_add_device(device_t *device) 37 38 { 39 usb_dprintf(NAME, 1, "uhci_add_device() called\n"); 38 40 device->ops = &uhci_ops; 39 41 … … 41 43 * We need to announce the presence of our root hub. 42 44 */ 45 usb_dprintf(NAME, 2, "adding root hub\n"); 43 46 usb_hcd_add_root_hub(device); 44 47 … … 61 64 */ 62 65 sleep(5); 66 usb_dprintf_enable(NAME, 5); 63 67 64 68 return driver_main(&uhci_driver); -
uspace/drv/vhc/connhost.c
raca85e4 r818dc00 58 58 case USB_DIRECTION_IN: 59 59 transfer->in_callback(transfer->dev, 60 size, outcome,60 outcome, size, 61 61 transfer->arg); 62 62 break; -
uspace/drv/vhc/debug.c
raca85e4 r818dc00 35 35 #include <stdio.h> 36 36 #include <ipc/ipc.h> 37 #include <usb/debug.h> 37 38 38 39 #include "vhcd.h" 39 40 40 /** Current debug level. */41 int debug_level = 0;42 43 /** Debugging printf.44 * This function is intended for single-line messages as it45 * automatically prints debugging prefix at the beginning of the46 * line.47 *48 * @see printf49 * @param level Debugging level.50 */51 void dprintf(int level, const char *format, ...)52 {53 if (level > debug_level) {54 return;55 }56 57 printf("%s(%d): ", NAME, level);58 va_list args;59 va_start(args, format);60 vprintf(format, args);61 va_end(args);62 printf("\n");63 }64 41 65 42 /** Debug print informing of invalid call. -
uspace/drv/vhc/hcd.c
raca85e4 r818dc00 111 111 printf("%s: virtual USB host controller driver.\n", NAME); 112 112 113 debug_level = 10;113 usb_dprintf_enable(NAME, 10); 114 114 115 115 fid_t fid = fibril_create(hc_manager_fibril, NULL); -
uspace/drv/vhc/vhcd.h
raca85e4 r818dc00 36 36 #define VHCD_VHCD_H_ 37 37 38 #include <usb/debug.h> 39 38 40 #define NAME "vhc" 39 41 #define NAME_DEV "hcd-virt-dev" … … 43 45 #define DEVMAP_PATH_DEV NAMESPACE "/" NAME_DEV 44 46 45 extern int debug_level; 46 void dprintf(int, const char *, ...); 47 #define dprintf(level, format, ...) \ 48 usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__) 47 49 void dprintf_inval_call(int, ipc_call_t, ipcarg_t); 48 50 -
uspace/lib/c/include/ipc/dev_iface.h
raca85e4 r818dc00 54 54 DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX) 55 55 56 /* 57 * The first argument is actually method (as the "real" method is used 58 * for indexing into interfaces. 59 */ 60 61 #define DEV_IPC_GET_ARG1(call) IPC_GET_ARG2((call)) 62 #define DEV_IPC_GET_ARG2(call) IPC_GET_ARG3((call)) 63 #define DEV_IPC_GET_ARG3(call) IPC_GET_ARG4((call)) 64 #define DEV_IPC_GET_ARG4(call) IPC_GET_ARG5((call)) 65 56 66 57 67 #endif -
uspace/lib/drv/generic/remote_usbhc.c
raca85e4 r818dc00 108 108 } 109 109 110 devman_handle_t handle = IPC_GET_ARG1(*call);110 devman_handle_t handle = DEV_IPC_GET_ARG1(*call); 111 111 112 112 usb_address_t address; … … 122 122 ipc_callid_t callid, ipc_call_t *call) 123 123 { 124 ipcarg_t buffer_hash = IPC_GET_ARG1(*call);124 ipcarg_t buffer_hash = DEV_IPC_GET_ARG1(*call); 125 125 async_transaction_t * trans = (async_transaction_t *)buffer_hash; 126 126 if (trans == NULL) { … … 144 144 accepted_size = trans->size; 145 145 } 146 async_data_read_finalize(c allid, trans->buffer, accepted_size);146 async_data_read_finalize(cid, trans->buffer, accepted_size); 147 147 148 148 ipc_answer_1(callid, EOK, accepted_size); … … 211 211 } 212 212 213 usb_address_t address = (usb_address_t) IPC_GET_ARG1(*call);214 devman_handle_t handle = (devman_handle_t) IPC_GET_ARG2(*call);213 usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call); 214 devman_handle_t handle = (devman_handle_t) DEV_IPC_GET_ARG2(*call); 215 215 216 216 int rc = usb_iface->bind_address(device, address, handle); … … 229 229 } 230 230 231 usb_address_t address = (usb_address_t) IPC_GET_ARG1(*call);231 usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call); 232 232 233 233 int rc = usb_iface->release_address(device, address); … … 275 275 } 276 276 277 size_t expected_len = IPC_GET_ARG3(*call);277 size_t expected_len = DEV_IPC_GET_ARG3(*call); 278 278 usb_target_t target = { 279 .address = IPC_GET_ARG1(*call),280 .endpoint = IPC_GET_ARG2(*call)279 .address = DEV_IPC_GET_ARG1(*call), 280 .endpoint = DEV_IPC_GET_ARG2(*call) 281 281 }; 282 282 … … 327 327 } 328 328 329 size_t len = IPC_GET_ARG3(*call);329 size_t len = DEV_IPC_GET_ARG3(*call); 330 330 usb_target_t target = { 331 .address = IPC_GET_ARG1(*call),332 .endpoint = IPC_GET_ARG2(*call)331 .address = DEV_IPC_GET_ARG1(*call), 332 .endpoint = DEV_IPC_GET_ARG2(*call) 333 333 }; 334 334 … … 384 384 385 385 usb_target_t target = { 386 .address = IPC_GET_ARG1(*call),387 .endpoint = IPC_GET_ARG2(*call)386 .address = DEV_IPC_GET_ARG1(*call), 387 .endpoint = DEV_IPC_GET_ARG2(*call) 388 388 }; 389 389 -
uspace/lib/usb/Makefile
raca85e4 r818dc00 34 34 SOURCES = \ 35 35 src/addrkeep.c \ 36 src/debug.c \ 37 src/drvpsync.c \ 36 38 src/hcdhubd.c \ 37 39 src/hcdrv.c \ -
uspace/lib/usb/include/usb/usb.h
raca85e4 r818dc00 71 71 /** Default USB address. */ 72 72 #define USB_ADDRESS_DEFAULT 0 73 /** Maximum address number in USB 1.1. */ 74 #define USB11_ADDRESS_MAX 128 73 75 74 76 /** USB endpoint number type. -
uspace/lib/usb/include/usb/usbdrv.h
raca85e4 r818dc00 38 38 #include <usb/usb.h> 39 39 #include <driver.h> 40 #include <usb/devreq.h> 41 #include <usb/descriptor.h> 40 42 41 43 int usb_drv_hc_connect(device_t *, unsigned int); … … 54 56 void *, size_t, size_t *, usb_handle_t *); 55 57 58 int usb_drv_psync_interrupt_out(int, usb_target_t, void *, size_t); 59 int usb_drv_psync_interrupt_in(int, usb_target_t, void *, size_t, size_t *); 60 61 62 56 63 int usb_drv_async_control_write_setup(int, usb_target_t, 57 64 void *, size_t, usb_handle_t *); … … 60 67 int usb_drv_async_control_write_status(int, usb_target_t, 61 68 usb_handle_t *); 69 70 int usb_drv_psync_control_write_setup(int, usb_target_t, void *, size_t); 71 int usb_drv_psync_control_write_data(int, usb_target_t, void *, size_t); 72 int usb_drv_psync_control_write_status(int, usb_target_t); 73 62 74 63 75 int usb_drv_async_control_read_setup(int, usb_target_t, … … 68 80 usb_handle_t *); 69 81 82 int usb_drv_psync_control_read_setup(int, usb_target_t, void *, size_t); 83 int usb_drv_psync_control_read_data(int, usb_target_t, void *, size_t, size_t *); 84 int usb_drv_psync_control_read_status(int, usb_target_t); 85 86 70 87 int usb_drv_async_wait_for(usb_handle_t); 71 88 72 89 73 90 int usb_drv_req_set_address(int, usb_address_t, usb_address_t); 91 int usb_drv_req_get_device_descriptor(int, usb_address_t, 92 usb_standard_device_descriptor_t *); 74 93 75 94 #endif -
uspace/lib/usb/src/usbdrvreq.c
raca85e4 r818dc00 34 34 */ 35 35 #include <usb/usbdrv.h> 36 #include <usb/devreq.h>37 36 #include <errno.h> 38 37 … … 95 94 } 96 95 96 /** Retrieve device descriptor of connected USB device. 97 * 98 * @param[in] phone Open phone to HC driver. 99 * @param[in] address Device USB address. 100 * @param[out] descriptor Storage for the device descriptor. 101 * @return Error code. 102 * @retval EBADMEM @p descriptor is NULL. 103 */ 104 int usb_drv_req_get_device_descriptor(int phone, usb_address_t address, 105 usb_standard_device_descriptor_t *descriptor) 106 { 107 if (descriptor == NULL) { 108 return EBADMEM; 109 } 110 111 /* Prepare the target. */ 112 usb_target_t target = { 113 .address = address, 114 .endpoint = 0 115 }; 116 117 /* Prepare the setup packet. */ 118 usb_device_request_setup_packet_t setup_packet = { 119 .request_type = 128, 120 .request = USB_DEVREQ_GET_DESCRIPTOR, 121 .index = 0, 122 .length = sizeof(usb_standard_device_descriptor_t) 123 }; 124 setup_packet.value_high = USB_DESCTYPE_DEVICE; 125 setup_packet.value_low = 0; 126 127 usb_handle_t handle; 128 int rc; 129 130 /* Start the control read transfer. */ 131 rc = usb_drv_async_control_read_setup(phone, target, 132 &setup_packet, sizeof(usb_device_request_setup_packet_t), &handle); 133 if (rc != EOK) { 134 return rc; 135 } 136 rc = usb_drv_async_wait_for(handle); 137 if (rc != EOK) { 138 return rc; 139 } 140 141 /* Retrieve the descriptor. */ 142 size_t actually_transferred = 0; 143 usb_standard_device_descriptor_t descriptor_tmp; 144 rc = usb_drv_async_control_read_data(phone, target, 145 &descriptor_tmp, sizeof(usb_standard_device_descriptor_t), 146 &actually_transferred, &handle); 147 if (rc != EOK) { 148 return rc; 149 } 150 rc = usb_drv_async_wait_for(handle); 151 if (rc != EOK) { 152 return rc; 153 } 154 155 /* Finish the control read transfer. */ 156 rc = usb_drv_async_control_read_status(phone, target, &handle); 157 if (rc != EOK) { 158 return rc; 159 } 160 rc = usb_drv_async_wait_for(handle); 161 if (rc != EOK) { 162 return rc; 163 } 164 165 if (actually_transferred < sizeof(usb_standard_device_descriptor_t)) { 166 return ELIMIT; 167 } 168 169 /* 170 * Everything is okay, copy the descriptor. 171 */ 172 memcpy(descriptor, &descriptor_tmp, 173 sizeof(usb_standard_device_descriptor_t)); 174 175 return EOK; 176 } 177 178 179 97 180 /** 98 181 * @}
Note:
See TracChangeset
for help on using the changeset viewer.