mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Merge branch 'master' into kncminer
This commit is contained in:
commit
3b04a306b7
@ -695,17 +695,32 @@ static bool klondike_init(struct cgpu_info *klncgpu)
|
|||||||
|
|
||||||
// boundaries are checked by device, with valid values returned
|
// boundaries are checked by device, with valid values returned
|
||||||
if (opt_klondike_options != NULL) {
|
if (opt_klondike_options != NULL) {
|
||||||
int hashclock;
|
int hashclock, fantarget;
|
||||||
double temp1, temp2;
|
double temp1, temp2;
|
||||||
|
|
||||||
sscanf(opt_klondike_options, "%d:%lf:%lf:%"SCNu8,
|
sscanf(opt_klondike_options, "%d:%lf:%lf:%d",
|
||||||
&hashclock,
|
&hashclock,
|
||||||
&temp1, &temp2,
|
&temp1, &temp2,
|
||||||
&kline.cfg.fantarget);
|
&fantarget);
|
||||||
SET_HASHCLOCK(kline.cfg.hashclock, hashclock);
|
SET_HASHCLOCK(kline.cfg.hashclock, hashclock);
|
||||||
kline.cfg.temptarget = cvtCToKln(temp1);
|
kline.cfg.temptarget = cvtCToKln(temp1);
|
||||||
kline.cfg.tempcritical = cvtCToKln(temp2);
|
kline.cfg.tempcritical = cvtCToKln(temp2);
|
||||||
kline.cfg.fantarget = (int)255*kline.cfg.fantarget/100;
|
if (fantarget < 0) {
|
||||||
|
applog(LOG_WARNING,
|
||||||
|
"%s%i: %s options invalid fantarget < 0 using 0",
|
||||||
|
klncgpu->drv->name,
|
||||||
|
klncgpu->device_id,
|
||||||
|
klncgpu->drv->dname);
|
||||||
|
fantarget = 0;
|
||||||
|
} else if (fantarget > 100) {
|
||||||
|
applog(LOG_WARNING,
|
||||||
|
"%s%i: %s options invalid fantarget > 100 using 100",
|
||||||
|
klncgpu->drv->name,
|
||||||
|
klncgpu->device_id,
|
||||||
|
klncgpu->drv->dname);
|
||||||
|
fantarget = 100;
|
||||||
|
}
|
||||||
|
kline.cfg.fantarget = (int)(255 * fantarget / 100);
|
||||||
size = sizeof(kline.cfg) - 2;
|
size = sizeof(kline.cfg) - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
usbutils.c
20
usbutils.c
@ -2495,14 +2495,14 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
|
|||||||
cgtimer_t now, already_done;
|
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) * 1000;
|
||||||
|
|
||||||
cgtimer_time(&now);
|
cgtimer_time(&now);
|
||||||
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
||||||
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
||||||
|
|
||||||
if (sleep_estimate > 0.0) {
|
if (sleep_estimate > 0.0) {
|
||||||
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0);
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time);
|
||||||
cgpu->usbinfo.read_delay_count++;
|
cgpu->usbinfo.read_delay_count++;
|
||||||
cgpu->usbinfo.total_read_delay += sleep_estimate;
|
cgpu->usbinfo.total_read_delay += sleep_estimate;
|
||||||
}
|
}
|
||||||
@ -2596,14 +2596,14 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
|
|||||||
cgtimer_t now, already_done;
|
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) * 1000;
|
||||||
|
|
||||||
cgtimer_time(&now);
|
cgtimer_time(&now);
|
||||||
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
||||||
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
||||||
|
|
||||||
if (sleep_estimate > 0.0) {
|
if (sleep_estimate > 0.0) {
|
||||||
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0);
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time);
|
||||||
cgpu->usbinfo.read_delay_count++;
|
cgpu->usbinfo.read_delay_count++;
|
||||||
cgpu->usbinfo.total_read_delay += sleep_estimate;
|
cgpu->usbinfo.total_read_delay += sleep_estimate;
|
||||||
}
|
}
|
||||||
@ -2743,14 +2743,14 @@ int _usb_write(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_
|
|||||||
cgtimer_t now, already_done;
|
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) * 1000;
|
||||||
|
|
||||||
cgtimer_time(&now);
|
cgtimer_time(&now);
|
||||||
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
||||||
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
||||||
|
|
||||||
if (sleep_estimate > 0.0) {
|
if (sleep_estimate > 0.0) {
|
||||||
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0);
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time);
|
||||||
cgpu->usbinfo.write_delay_count++;
|
cgpu->usbinfo.write_delay_count++;
|
||||||
cgpu->usbinfo.total_write_delay += sleep_estimate;
|
cgpu->usbinfo.total_write_delay += sleep_estimate;
|
||||||
}
|
}
|
||||||
@ -2882,14 +2882,14 @@ int __usb_transfer(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bReques
|
|||||||
cgtimer_t now, already_done;
|
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) * 1000;
|
||||||
|
|
||||||
cgtimer_time(&now);
|
cgtimer_time(&now);
|
||||||
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
||||||
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
||||||
|
|
||||||
if (sleep_estimate > 0.0) {
|
if (sleep_estimate > 0.0) {
|
||||||
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0);
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time);
|
||||||
cgpu->usbinfo.write_delay_count++;
|
cgpu->usbinfo.write_delay_count++;
|
||||||
cgpu->usbinfo.total_write_delay += sleep_estimate;
|
cgpu->usbinfo.total_write_delay += sleep_estimate;
|
||||||
}
|
}
|
||||||
@ -2964,14 +2964,14 @@ int _usb_transfer_read(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRe
|
|||||||
cgtimer_t now, already_done;
|
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) * 1000;
|
||||||
|
|
||||||
cgtimer_time(&now);
|
cgtimer_time(&now);
|
||||||
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
cgtimer_sub(&now, &usbdev->cgt_last_write, &already_done);
|
||||||
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
sleep_estimate = write_time - cgtimer_to_ms(&already_done);
|
||||||
|
|
||||||
if (sleep_estimate > 0.0) {
|
if (sleep_estimate > 0.0) {
|
||||||
cgsleep_ms_r(&usbdev->cgt_last_write, write_time * 1000.0);
|
cgsleep_ms_r(&usbdev->cgt_last_write, write_time);
|
||||||
cgpu->usbinfo.read_delay_count++;
|
cgpu->usbinfo.read_delay_count++;
|
||||||
cgpu->usbinfo.total_read_delay += sleep_estimate;
|
cgpu->usbinfo.total_read_delay += sleep_estimate;
|
||||||
}
|
}
|
||||||
|
6
util.c
6
util.c
@ -1079,9 +1079,13 @@ void cgtimer_time(cgtimer_t *ts_start)
|
|||||||
|
|
||||||
static void liSleep(LARGE_INTEGER *li, int timeout)
|
static void liSleep(LARGE_INTEGER *li, int timeout)
|
||||||
{
|
{
|
||||||
HANDLE hTimer = CreateWaitableTimer(NULL, TRUE, NULL);
|
HANDLE hTimer;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
|
|
||||||
|
if (unlikely(timeout <= 0))
|
||||||
|
return;
|
||||||
|
|
||||||
|
hTimer = CreateWaitableTimer(NULL, TRUE, NULL);
|
||||||
if (unlikely(!hTimer))
|
if (unlikely(!hTimer))
|
||||||
quit(1, "Failed to create hTimer in liSleep");
|
quit(1, "Failed to create hTimer in liSleep");
|
||||||
ret = SetWaitableTimer(hTimer, li, 0, NULL, NULL, 0);
|
ret = SetWaitableTimer(hTimer, li, 0, NULL, NULL, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user