Changeset d37dd3b9 in mainline
- Timestamp:
- 2017-12-21T09:37:58Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0fbe27d
- Parents:
- ad2a8b1
- Location:
- uspace/app/tmon
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tmon/test.c
rad2a8b1 rd37dd3b9 48 48 #define DEFAULT_SIZE 65432 49 49 50 static int resolve_and_test(int argc, char *argv[], int (*test)( devman_handle_t, int, size_t)) {50 static int resolve_and_test(int argc, char *argv[], int (*test)(async_exch_t *, int, size_t)) { 51 51 devman_handle_t fun = -1; 52 52 … … 62 62 } 63 63 64 int rc ;64 int rc, ec; 65 65 char path[MAX_PATH_LENGTH]; 66 66 if ((rc = devman_fun_get_path(fun, path, sizeof(path)))) { … … 73 73 // TODO: Read options here. 74 74 75 return test(fun, DEFAULT_CYCLES, DEFAULT_SIZE);76 }77 78 static int stress_intr_in(devman_handle_t fun, int cycles, size_t size) {79 75 async_sess_t *sess = usbdiag_connect(fun); 80 async_exch_t *exch = async_exchange_begin(sess); 81 82 int rc = usbdiag_stress_intr_in(exch, cycles, size); 83 int ec = 0; 84 85 if (rc) { 86 printf(NAME ": %s\n", str_error(rc)); 87 ec = 1; 76 if (!sess) { 77 printf(NAME ": Could not connect to the device.\n"); 78 return 1; 88 79 } 89 80 81 async_exch_t *exch = async_exchange_begin(sess); 82 if (!exch) { 83 printf(NAME ": Could not start exchange with the device.\n"); 84 ec = 1; 85 goto err_sess; 86 } 87 88 ec = test(exch, DEFAULT_CYCLES, DEFAULT_SIZE); 90 89 async_exchange_end(exch); 90 91 err_sess: 91 92 usbdiag_disconnect(sess); 92 93 return ec; 93 94 } 94 95 95 static int stress_intr_out(devman_handle_t fun, int cycles, size_t size) { 96 async_sess_t *sess = usbdiag_connect(fun); 97 async_exch_t *exch = async_exchange_begin(sess); 98 99 int rc = usbdiag_stress_intr_out(exch, cycles, size); 100 int ec = 0; 101 96 static int stress_intr_in(async_exch_t *exch, int cycles, size_t size) 97 { 98 int rc = usbdiag_stress_intr_in(exch, cycles, size); 102 99 if (rc) { 103 100 printf(NAME ": %s\n", str_error(rc)); 104 ec =1;101 return 1; 105 102 } 106 103 107 async_exchange_end(exch); 108 usbdiag_disconnect(sess); 109 return ec; 104 return 0; 110 105 } 111 106 112 static int stress_bulk_in(devman_handle_t fun, int cycles, size_t size) { 113 async_sess_t *sess = usbdiag_connect(fun); 114 async_exch_t *exch = async_exchange_begin(sess); 115 116 int rc = usbdiag_stress_bulk_in(exch, cycles, size); 117 int ec = 0; 118 107 static int stress_intr_out(async_exch_t *exch, int cycles, size_t size) 108 { 109 int rc = usbdiag_stress_intr_out(exch, cycles, size); 119 110 if (rc) { 120 111 printf(NAME ": %s\n", str_error(rc)); 121 ec =1;112 return 1; 122 113 } 123 114 124 async_exchange_end(exch); 125 usbdiag_disconnect(sess); 126 return ec; 115 return 0; 127 116 } 128 117 129 static int stress_bulk_out(devman_handle_t fun, int cycles, size_t size) { 130 async_sess_t *sess = usbdiag_connect(fun); 131 async_exch_t *exch = async_exchange_begin(sess); 132 133 int rc = usbdiag_stress_bulk_out(exch, cycles, size); 134 int ec = 0; 135 118 static int stress_bulk_in(async_exch_t *exch, int cycles, size_t size) 119 { 120 int rc = usbdiag_stress_bulk_in(exch, cycles, size); 136 121 if (rc) { 137 122 printf(NAME ": %s\n", str_error(rc)); 138 ec =1;123 return 1; 139 124 } 140 125 141 async_exchange_end(exch); 142 usbdiag_disconnect(sess); 143 return ec; 126 return 0; 127 } 128 129 static int stress_bulk_out(async_exch_t *exch, int cycles, size_t size) 130 { 131 int rc = usbdiag_stress_bulk_out(exch, cycles, size); 132 if (rc) { 133 printf(NAME ": %s\n", str_error(rc)); 134 return 1; 135 } 136 137 return 0; 144 138 } 145 139
Note:
See TracChangeset
for help on using the changeset viewer.