mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Add the choice of hash loop to the device driver, defaulting to hash_sole_work if none is specified.
This commit is contained in:
parent
254e25ac7f
commit
fda6d46e95
@ -5652,7 +5652,7 @@ static void flush_queue(struct cgpu_info *cgpu)
|
||||
* perform a full nonce range and need a queue to maintain the device busy.
|
||||
* Work creation and destruction is not done from within this function
|
||||
* directly. */
|
||||
static void hash_queued_work(struct thr_info *mythr)
|
||||
void hash_queued_work(struct thr_info *mythr)
|
||||
{
|
||||
const long cycle = opt_log_interval / 5 ? : 1;
|
||||
struct timeval tv_start = {0, 0}, tv_end;
|
||||
@ -5719,7 +5719,7 @@ void *miner_thread(void *userdata)
|
||||
applog(LOG_DEBUG, "Popping ping in miner thread");
|
||||
tq_pop(mythr->q, NULL); /* Wait for a ping to start */
|
||||
|
||||
hash_sole_work(mythr);
|
||||
drv->hash_work(mythr);
|
||||
out:
|
||||
drv->thread_shutdown(mythr);
|
||||
|
||||
@ -6647,6 +6647,8 @@ void fill_device_api(struct cgpu_info *cgpu)
|
||||
drv->thread_shutdown = &noop_thread_shutdown;
|
||||
if (!drv->thread_enable)
|
||||
drv->thread_enable = &noop_thread_enable;
|
||||
if (!drv->hash_work)
|
||||
drv->hash_work = &hash_sole_work;
|
||||
if (!drv->flush_work)
|
||||
drv->flush_work = &noop_flush_work;
|
||||
if (!drv->queue_full)
|
||||
|
11
miner.h
11
miner.h
@ -297,8 +297,18 @@ struct device_drv {
|
||||
uint64_t (*can_limit_work)(struct thr_info *);
|
||||
bool (*thread_init)(struct thr_info *);
|
||||
bool (*prepare_work)(struct thr_info *, struct work *);
|
||||
|
||||
/* Which hash work loop this driver uses. */
|
||||
void (*hash_work)(struct thr_info *);
|
||||
/* Two variants depending on whether the device divides work up into
|
||||
* small pieces or works with whole work items and may or may not have
|
||||
* a queue of its own. */
|
||||
int64_t (*scanhash)(struct thr_info *, struct work *, int64_t);
|
||||
int64_t (*scanwork)(struct thr_info *);
|
||||
|
||||
/* Used to extract work from the hash table of queued work and tell
|
||||
* the main loop that it should not add any further work to the table.
|
||||
*/
|
||||
bool (*queue_full)(struct cgpu_info *);
|
||||
void (*flush_work)(struct cgpu_info *);
|
||||
|
||||
@ -1095,6 +1105,7 @@ struct modminer_fpga_state {
|
||||
extern void get_datestamp(char *, struct timeval *);
|
||||
extern void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
|
||||
extern void work_completed(struct cgpu_info *cgpu, struct work *work);
|
||||
extern void hash_queued_work(struct thr_info *mythr);
|
||||
extern void tailsprintf(char *f, const char *fmt, ...);
|
||||
extern void wlogprint(const char *f, ...);
|
||||
extern int curses_int(const char *query);
|
||||
|
Loading…
x
Reference in New Issue
Block a user