From 17447ec7e294e84dceabaca6916d4518e357750f Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 18 Aug 2013 11:59:02 +1000 Subject: [PATCH] Use the cgsleep reentrant function in avalon_send_task. --- driver-avalon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/driver-avalon.c b/driver-avalon.c index 1b054922..6d72c13a 100644 --- a/driver-avalon.c +++ b/driver-avalon.c @@ -147,6 +147,7 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval uint8_t buf[AVALON_WRITE_SIZE + 4 * AVALON_DEFAULT_ASIC_NUM]; int delay, ret, i, ep = C_AVALON_TASK; struct avalon_info *info; + struct timespec ts_start; uint32_t nonce_range; size_t nr_len; @@ -190,6 +191,7 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval info = avalon->device_data; delay = nr_len * 10 * 1000000; delay = delay / info->baud; + delay += 4000; if (at->reset) { ep = C_AVALON_RESET; @@ -199,10 +201,10 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval applog(LOG_DEBUG, "Avalon: Sent(%u):", (unsigned int)nr_len); hexdump(buf, nr_len); } + cgsleep_prepare_r(&ts_start); ret = avalon_write(avalon, (char *)buf, nr_len, ep); + cgsleep_us_r(&ts_start, delay); - delay += 4000; - nusleep(delay); applog(LOG_DEBUG, "Avalon: Sent: Buffer delay: %dus", delay); return ret;