|
|
@ -2416,18 +2416,17 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro |
|
|
|
got = 0; |
|
|
|
got = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (first && usbdev->usecps && usbdev->last_write_siz) { |
|
|
|
if (first && usbdev->usecps && usbdev->last_write_siz) { |
|
|
|
cgtimer_t now, already; |
|
|
|
cgtimer_t now, already_done; |
|
|
|
double sleep_estimate; |
|
|
|
double sleep_estimate; |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
(double)(usbdev->cps); |
|
|
|
(double)(usbdev->cps); |
|
|
|
|
|
|
|
|
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done); |
|
|
|
|
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
cgpu->usbinfo.read_delay_count++; |
|
|
|
cgpu->usbinfo.read_delay_count++; |
|
|
|
cgpu->usbinfo.total_read_delay += sleep_estimate; |
|
|
|
cgpu->usbinfo.total_read_delay += sleep_estimate; |
|
|
|
} |
|
|
|
} |
|
|
@ -2521,18 +2520,17 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro |
|
|
|
} |
|
|
|
} |
|
|
|
got = 0; |
|
|
|
got = 0; |
|
|
|
if (first && usbdev->usecps && usbdev->last_write_siz) { |
|
|
|
if (first && usbdev->usecps && usbdev->last_write_siz) { |
|
|
|
cgtimer_t now, already; |
|
|
|
cgtimer_t now, already_done; |
|
|
|
double sleep_estimate; |
|
|
|
double sleep_estimate; |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
(double)(usbdev->cps); |
|
|
|
(double)(usbdev->cps); |
|
|
|
|
|
|
|
|
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done); |
|
|
|
|
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
cgpu->usbinfo.read_delay_count++; |
|
|
|
cgpu->usbinfo.read_delay_count++; |
|
|
|
cgpu->usbinfo.total_read_delay += sleep_estimate; |
|
|
|
cgpu->usbinfo.total_read_delay += sleep_estimate; |
|
|
|
} |
|
|
|
} |
|
|
@ -2660,18 +2658,17 @@ int _usb_write(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pr |
|
|
|
sent = 0; |
|
|
|
sent = 0; |
|
|
|
if (usbdev->usecps) { |
|
|
|
if (usbdev->usecps) { |
|
|
|
if (usbdev->last_write_siz) { |
|
|
|
if (usbdev->last_write_siz) { |
|
|
|
cgtimer_t now, already; |
|
|
|
cgtimer_t now, already_done; |
|
|
|
double sleep_estimate; |
|
|
|
double sleep_estimate; |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
(double)(usbdev->cps); |
|
|
|
(double)(usbdev->cps); |
|
|
|
|
|
|
|
|
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done); |
|
|
|
|
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
cgpu->usbinfo.write_delay_count++; |
|
|
|
cgpu->usbinfo.write_delay_count++; |
|
|
|
cgpu->usbinfo.total_write_delay += sleep_estimate; |
|
|
|
cgpu->usbinfo.total_write_delay += sleep_estimate; |
|
|
|
} |
|
|
|
} |
|
|
@ -2757,18 +2754,17 @@ int __usb_transfer(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bReques |
|
|
|
|
|
|
|
|
|
|
|
if (usbdev->usecps) { |
|
|
|
if (usbdev->usecps) { |
|
|
|
if (usbdev->last_write_siz) { |
|
|
|
if (usbdev->last_write_siz) { |
|
|
|
cgtimer_t now, already; |
|
|
|
cgtimer_t now, already_done; |
|
|
|
double sleep_estimate; |
|
|
|
double sleep_estimate; |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
(double)(usbdev->cps); |
|
|
|
(double)(usbdev->cps); |
|
|
|
|
|
|
|
|
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done); |
|
|
|
|
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
cgpu->usbinfo.write_delay_count++; |
|
|
|
cgpu->usbinfo.write_delay_count++; |
|
|
|
cgpu->usbinfo.total_write_delay += sleep_estimate; |
|
|
|
cgpu->usbinfo.total_write_delay += sleep_estimate; |
|
|
|
} |
|
|
|
} |
|
|
@ -2835,18 +2831,17 @@ int _usb_transfer_read(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRe |
|
|
|
*amount = 0; |
|
|
|
*amount = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (usbdev->usecps && usbdev->last_write_siz) { |
|
|
|
if (usbdev->usecps && usbdev->last_write_siz) { |
|
|
|
cgtimer_t now, already; |
|
|
|
cgtimer_t now, already_done; |
|
|
|
double sleep_estimate; |
|
|
|
double sleep_estimate; |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
double write_time = (double)(usbdev->last_write_siz) / |
|
|
|
(double)(usbdev->cps); |
|
|
|
(double)(usbdev->cps); |
|
|
|
|
|
|
|
|
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_time(&now); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already); |
|
|
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already); |
|
|
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done); |
|
|
|
|
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
if (sleep_estimate > 0.0) { |
|
|
|
|
|
|
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0); |
|
|
|
cgpu->usbinfo.read_delay_count++; |
|
|
|
cgpu->usbinfo.read_delay_count++; |
|
|
|
cgpu->usbinfo.total_read_delay += sleep_estimate; |
|
|
|
cgpu->usbinfo.total_read_delay += sleep_estimate; |
|
|
|
} |
|
|
|
} |
|
|
|