mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Use the nusleep function for sleeping after sending work in avalon.
This commit is contained in:
parent
1b5ea442b8
commit
df81ce6784
@ -143,13 +143,11 @@ static int avalon_write(struct cgpu_info *avalon, char *buf, ssize_t len, int ep
|
|||||||
static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *avalon)
|
static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *avalon)
|
||||||
|
|
||||||
{
|
{
|
||||||
struct timespec p;
|
|
||||||
uint8_t buf[AVALON_WRITE_SIZE + 4 * AVALON_DEFAULT_ASIC_NUM];
|
uint8_t buf[AVALON_WRITE_SIZE + 4 * AVALON_DEFAULT_ASIC_NUM];
|
||||||
size_t nr_len;
|
int delay, ret, i, ep = C_AVALON_TASK;
|
||||||
struct avalon_info *info;
|
struct avalon_info *info;
|
||||||
uint64_t delay = 32000000; /* Default 32ms for B19200 */
|
|
||||||
uint32_t nonce_range;
|
uint32_t nonce_range;
|
||||||
int ret, i, ep = C_AVALON_TASK;
|
size_t nr_len;
|
||||||
|
|
||||||
if (at->nonce_elf)
|
if (at->nonce_elf)
|
||||||
nr_len = AVALON_WRITE_SIZE + 4 * at->asic_num;
|
nr_len = AVALON_WRITE_SIZE + 4 * at->asic_num;
|
||||||
@ -188,11 +186,9 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval
|
|||||||
tt |= ((buf[4] & 0x80) ? (1 << 0) : 0);
|
tt |= ((buf[4] & 0x80) ? (1 << 0) : 0);
|
||||||
buf[4] = tt;
|
buf[4] = tt;
|
||||||
#endif
|
#endif
|
||||||
if (likely(avalon)) {
|
|
||||||
info = avalon->device_data;
|
info = avalon->device_data;
|
||||||
delay = nr_len * 10 * 1000000000ULL;
|
delay = nr_len * 10 * 1000000;
|
||||||
delay = delay / info->baud;
|
delay = delay / info->baud;
|
||||||
}
|
|
||||||
|
|
||||||
if (at->reset) {
|
if (at->reset) {
|
||||||
ep = C_AVALON_RESET;
|
ep = C_AVALON_RESET;
|
||||||
@ -204,10 +200,9 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval
|
|||||||
}
|
}
|
||||||
ret = avalon_write(avalon, (char *)buf, nr_len, ep);
|
ret = avalon_write(avalon, (char *)buf, nr_len, ep);
|
||||||
|
|
||||||
p.tv_sec = 0;
|
delay += 4000;
|
||||||
p.tv_nsec = (long)delay + 4000000;
|
nusleep(delay);
|
||||||
nanosleep(&p, NULL);
|
applog(LOG_DEBUG, "Avalon: Sent: Buffer delay: %dus", delay);
|
||||||
applog(LOG_DEBUG, "Avalon: Sent: Buffer delay: %ld", p.tv_nsec);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user