Changeset ff16da5f in mainline
- Timestamp:
- 2017-12-21T14:37:30Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 119a794
- Parents:
- 74c0de0
- git-author:
- Petr Mánek <petr.manek@…> (2017-12-21 14:37:23)
- git-committer:
- Petr Mánek <petr.manek@…> (2017-12-21 14:37:30)
- Location:
- uspace
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tmon/commands.h
r74c0de0 rff16da5f 42 42 int tmon_stress_bulk_in(int, char **); 43 43 int tmon_stress_bulk_out(int, char **); 44 int tmon_stress_isoch_in(int, char **); 45 int tmon_stress_isoch_out(int, char **); 44 46 45 47 #endif /* TMON_COMMANDS_H_ */ -
uspace/app/tmon/main.c
r74c0de0 rff16da5f 73 73 }, 74 74 { 75 .name = "stress-isoch-in", 76 .description = "Stress benchmark isochronous in endpoints of a device.", 77 .action = tmon_stress_isoch_in, 78 }, 79 { 80 .name = "stress-isoch-out", 81 .description = "Stress benchmark isochronous out endpoints of a device.", 82 .action = tmon_stress_isoch_out, 83 }, 84 { 75 85 .name = NULL 76 86 } -
uspace/app/tmon/stress_test.c
r74c0de0 rff16da5f 130 130 } 131 131 132 static int run_isoch_in(async_exch_t *exch, const tmon_test_params_t *generic_params) 133 { 134 const tmon_stress_test_params_t *params = (tmon_stress_test_params_t *) generic_params; 135 printf("Executing isochronous in stress test.\n" 136 " Packet count: %d\n" 137 " Packet size: %ld\n", params->cycles, params->size); 138 139 int rc = usbdiag_stress_isoch_in(exch, params->cycles, params->size); 140 if (rc) { 141 printf(NAME ": Test failed. %s\n", str_error(rc)); 142 return 1; 143 } 144 145 return 0; 146 } 147 148 static int run_isoch_out(async_exch_t *exch, const tmon_test_params_t *generic_params) 149 { 150 const tmon_stress_test_params_t *params = (tmon_stress_test_params_t *) generic_params; 151 printf("Executing isochronous out stress test.\n" 152 " Packet count: %d\n" 153 " Packet size: %ld\n", params->cycles, params->size); 154 155 int rc = usbdiag_stress_isoch_out(exch, params->cycles, params->size); 156 if (rc) { 157 printf(NAME ": Test failed. %s\n", str_error(rc)); 158 return 1; 159 } 160 161 return 0; 162 } 163 132 164 int tmon_stress_intr_in(int argc, char *argv[]) 133 165 { … … 170 202 } 171 203 204 int tmon_stress_isoch_in(int argc, char *argv[]) 205 { 206 static const tmon_test_ops_t ops = { 207 .run = run_isoch_in, 208 .read_params = read_params 209 }; 210 211 return tmon_test_main(argc, argv, &ops); 212 } 213 214 int tmon_stress_isoch_out(int argc, char *argv[]) 215 { 216 static const tmon_test_ops_t ops = { 217 .run = run_isoch_out, 218 .read_params = read_params 219 }; 220 221 return tmon_test_main(argc, argv, &ops); 222 } 223 172 224 /** @} 173 225 */ -
uspace/drv/bus/usb/usbdiag/device.c
r74c0de0 rff16da5f 53 53 } 54 54 55 TRANSLATE_FUNC(usb_diag_stress_intr_out) 56 TRANSLATE_FUNC(usb_diag_stress_intr_in) 55 57 TRANSLATE_FUNC(usb_diag_stress_bulk_out) 56 58 TRANSLATE_FUNC(usb_diag_stress_bulk_in) 57 TRANSLATE_FUNC(usb_diag_stress_i ntr_out)58 TRANSLATE_FUNC(usb_diag_stress_i ntr_in)59 TRANSLATE_FUNC(usb_diag_stress_isoch_out) 60 TRANSLATE_FUNC(usb_diag_stress_isoch_in) 59 61 60 62 static usbdiag_iface_t diag_interface = { 63 .stress_intr_out = TRANSLATE_FUNC_NAME(usb_diag_stress_intr_out), 64 .stress_intr_in = TRANSLATE_FUNC_NAME(usb_diag_stress_intr_in), 61 65 .stress_bulk_out = TRANSLATE_FUNC_NAME(usb_diag_stress_bulk_out), 62 66 .stress_bulk_in = TRANSLATE_FUNC_NAME(usb_diag_stress_bulk_in), 63 .stress_i ntr_out = TRANSLATE_FUNC_NAME(usb_diag_stress_intr_out),64 .stress_i ntr_in = TRANSLATE_FUNC_NAME(usb_diag_stress_intr_in)67 .stress_isoch_out = TRANSLATE_FUNC_NAME(usb_diag_stress_isoch_out), 68 .stress_isoch_in = TRANSLATE_FUNC_NAME(usb_diag_stress_isoch_in) 65 69 }; 66 70 -
uspace/drv/bus/usb/usbdiag/tests.c
r74c0de0 rff16da5f 178 178 } 179 179 180 int usb_diag_stress_isoch_out(usb_diag_dev_t *dev, int cycles, size_t size) 181 { 182 if (!dev) 183 return EBADMEM; 184 185 char *buffer = (char *) malloc(size); 186 if (!buffer) 187 return ENOMEM; 188 189 memset(buffer, 42, size); 190 191 // TODO: Are we sure that no other test is running on this endpoint? 192 193 usb_log_info("Performing isochronous out stress test on device %s.", ddf_fun_get_name(dev->fun)); 194 int rc = EOK; 195 for (int i = 0; i < cycles; ++i) { 196 // Write buffer to device. 197 if ((rc = usb_pipe_write(dev->isoch_out, buffer, size))) { 198 usb_log_error("Isochronous OUT write failed. %s\n", str_error(rc)); 199 break; 200 } 201 } 202 203 free(buffer); 204 return rc; 205 } 206 207 int usb_diag_stress_isoch_in(usb_diag_dev_t *dev, int cycles, size_t size) 208 { 209 if (!dev) 210 return EBADMEM; 211 212 char *buffer = (char *) malloc(size); 213 if (!buffer) 214 return ENOMEM; 215 216 // TODO: Are we sure that no other test is running on this endpoint? 217 218 usb_log_info("Performing isochronous in stress test on device %s.", ddf_fun_get_name(dev->fun)); 219 int rc = EOK; 220 for (int i = 0; i < cycles; ++i) { 221 // Read device's response. 222 size_t remaining = size; 223 size_t transferred; 224 225 while (remaining > 0) { 226 if ((rc = usb_pipe_read(dev->isoch_in, buffer + size - remaining, remaining, &transferred))) { 227 usb_log_error("Isochronous IN read failed. %s\n", str_error(rc)); 228 break; 229 } 230 231 if (transferred > remaining) { 232 usb_log_error("Isochronous IN read more than expected.\n"); 233 rc = EINVAL; 234 break; 235 } 236 237 remaining -= transferred; 238 } 239 240 if (rc) 241 break; 242 } 243 244 free(buffer); 245 return rc; 246 } 247 180 248 /** 181 249 * @} -
uspace/drv/bus/usb/usbdiag/tests.h
r74c0de0 rff16da5f 43 43 int usb_diag_stress_bulk_out(usb_diag_dev_t *, int, size_t); 44 44 int usb_diag_stress_bulk_in(usb_diag_dev_t *, int, size_t); 45 int usb_diag_stress_isoch_out(usb_diag_dev_t *, int, size_t); 46 int usb_diag_stress_isoch_in(usb_diag_dev_t *, int, size_t); 45 47 46 48 #endif /* USB_DIAG_TESTS_H_ */ -
uspace/lib/drv/generic/remote_usbdiag.c
r74c0de0 rff16da5f 46 46 IPC_M_USBDIAG_STRESS_INTR_OUT, 47 47 IPC_M_USBDIAG_STRESS_BULK_IN, 48 IPC_M_USBDIAG_STRESS_BULK_OUT 48 IPC_M_USBDIAG_STRESS_BULK_OUT, 49 IPC_M_USBDIAG_STRESS_ISOCH_IN, 50 IPC_M_USBDIAG_STRESS_ISOCH_OUT 49 51 } usb_iface_funcs_t; 50 52 … … 90 92 91 93 return async_req_3_0(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_STRESS_BULK_OUT, cycles, size); 94 } 95 96 int usbdiag_stress_isoch_in(async_exch_t *exch, int cycles, size_t size) 97 { 98 if (!exch) 99 return EBADMEM; 100 101 return async_req_3_0(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_STRESS_ISOCH_IN, cycles, size); 102 } 103 104 int usbdiag_stress_isoch_out(async_exch_t *exch, int cycles, size_t size) 105 { 106 if (!exch) 107 return EBADMEM; 108 109 return async_req_3_0(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_STRESS_ISOCH_OUT, cycles, size); 92 110 } 93 111 … … 96 114 static void remote_usbdiag_stress_bulk_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 97 115 static void remote_usbdiag_stress_bulk_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 116 static void remote_usbdiag_stress_isoch_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 117 static void remote_usbdiag_stress_isoch_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 98 118 99 119 /** Remote USB diagnostic interface operations. */ 100 120 static const remote_iface_func_ptr_t remote_usbdiag_iface_ops [] = { 101 [IPC_M_USBDIAG_STRESS_INTR_IN] = remote_usbdiag_stress_intr_in,121 [IPC_M_USBDIAG_STRESS_INTR_IN] = remote_usbdiag_stress_intr_in, 102 122 [IPC_M_USBDIAG_STRESS_INTR_OUT] = remote_usbdiag_stress_intr_out, 103 [ IPC_M_USBDIAG_STRESS_BULK_IN] = remote_usbdiag_stress_bulk_in, 104 [IPC_M_USBDIAG_STRESS_BULK_OUT] = remote_usbdiag_stress_bulk_out 123 [IPC_M_USBDIAG_STRESS_BULK_IN] = remote_usbdiag_stress_bulk_in, 124 [IPC_M_USBDIAG_STRESS_BULK_OUT] = remote_usbdiag_stress_bulk_out, 125 [IPC_M_USBDIAG_STRESS_ISOCH_IN] = remote_usbdiag_stress_isoch_in, 126 [IPC_M_USBDIAG_STRESS_ISOCH_OUT] = remote_usbdiag_stress_isoch_out 105 127 }; 106 128 … … 171 193 } 172 194 195 void remote_usbdiag_stress_isoch_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call) 196 { 197 const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface; 198 199 if (diag_iface->stress_isoch_in == NULL) { 200 async_answer_0(callid, ENOTSUP); 201 return; 202 } 203 204 int cycles = DEV_IPC_GET_ARG1(*call); 205 size_t size = DEV_IPC_GET_ARG2(*call); 206 const int ret = diag_iface->stress_isoch_in(fun, cycles, size); 207 async_answer_0(callid, ret); 208 } 209 210 void remote_usbdiag_stress_isoch_out(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call) 211 { 212 const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface; 213 214 if (diag_iface->stress_isoch_out == NULL) { 215 async_answer_0(callid, ENOTSUP); 216 return; 217 } 218 219 int cycles = DEV_IPC_GET_ARG1(*call); 220 size_t size = DEV_IPC_GET_ARG2(*call); 221 const int ret = diag_iface->stress_isoch_out(fun, cycles, size); 222 async_answer_0(callid, ret); 223 } 224 173 225 /** 174 226 * @} -
uspace/lib/drv/include/usbdiag_iface.h
r74c0de0 rff16da5f 49 49 int usbdiag_stress_bulk_in(async_exch_t*, int, size_t); 50 50 int usbdiag_stress_bulk_out(async_exch_t*, int, size_t); 51 int usbdiag_stress_isoch_in(async_exch_t*, int, size_t); 52 int usbdiag_stress_isoch_out(async_exch_t*, int, size_t); 51 53 52 54 /** USB diagnostic device communication interface. */ … … 56 58 int (*stress_bulk_in)(ddf_fun_t*, int, size_t); 57 59 int (*stress_bulk_out)(ddf_fun_t*, int, size_t); 60 int (*stress_isoch_in)(ddf_fun_t*, int, size_t); 61 int (*stress_isoch_out)(ddf_fun_t*, int, size_t); 58 62 } usbdiag_iface_t; 59 63
Note:
See TracChangeset
for help on using the changeset viewer.