| 205 | } |
| 206 | |
| 207 | void testBulkRead() override |
| 208 | { |
| 209 | struct any_frame f = { |
| 210 | .f = {.type = F_FRAME_BULK_READ_TEST_CMD, .size = sizeof(f)} |
| 211 | }; |
| 212 | usb_cmd_send(&f, f.f.size); |
| 213 | |
| 214 | /* These must match the device. */ |
| 215 | const int XSIZE = 64; |
| 216 | const int YSIZE = 256; |
| 217 | const int ZSIZE = 64; |
| 218 | |
| 219 | Bytes bulk_buffer(XSIZE * YSIZE * ZSIZE); |
| 220 | for (int x = 0; x < XSIZE; x++) |
| 221 | for (int y = 0; y < YSIZE; y++) |
| 222 | for (int z = 0; z < ZSIZE; z++) |
| 223 | { |
| 224 | int offset = x * XSIZE * YSIZE + y * ZSIZE + z; |
| 225 | bulk_buffer[offset] = uint8_t(x + y + z); |
| 226 | } |
| 227 | |
| 228 | std::cout << "Writing data: " << std::flush; |
| 229 | double start_time = getCurrentTime(); |
| 230 | usb_data_send(bulk_buffer); |
| 231 | double elapsed_time = getCurrentTime() - start_time; |
| 232 | |
| 233 | std::cout << "transferred " << bulk_buffer.size() |
| 234 | << " bytes from PC -> device in " |
| 235 | << int(elapsed_time * 1000.0) << " ms (" |
| 236 | << int((bulk_buffer.size() / 1024.0) / elapsed_time) |
| 237 | << " kB/s)" << std::endl; |
| 238 | |
| 239 | await_reply<struct any_frame>(F_FRAME_BULK_READ_TEST_REPLY); |
| 240 | } |
| 241 | |
| 242 | Bytes read(int side, |
| 243 | bool synced, |
no test coverage detected