mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Assign the avalon info data to the device_data in cgpu_info.
This commit is contained in:
parent
1bb2cadfa6
commit
6baa23cf62
@ -173,7 +173,7 @@ static int avalon_send_task(int fd, const struct avalon_task *at,
|
||||
buf[4] = tt;
|
||||
#endif
|
||||
if (likely(avalon)) {
|
||||
info = avalon_infos[avalon->device_id];
|
||||
info = avalon->device_data;
|
||||
delay = nr_len * 10 * 1000000000ULL;
|
||||
delay = delay / info->baud;
|
||||
}
|
||||
@ -291,7 +291,7 @@ static bool avalon_decode_nonce(struct thr_info *thr, struct avalon_result *ar,
|
||||
if (!work)
|
||||
return false;
|
||||
|
||||
info = avalon_infos[avalon->device_id];
|
||||
info = avalon->device_data;
|
||||
info->matching_work[work->subid]++;
|
||||
*nonce = htole32(ar->nonce);
|
||||
submit_nonce(thr, work, *nonce);
|
||||
@ -388,7 +388,7 @@ static void avalon_idle(struct cgpu_info *avalon)
|
||||
struct avalon_task at;
|
||||
|
||||
int fd = avalon->device_fd;
|
||||
struct avalon_info *info = avalon_infos[avalon->device_id];
|
||||
struct avalon_info *info = avalon->device_data;
|
||||
int avalon_get_work_count = info->miner_count;
|
||||
|
||||
i = 0;
|
||||
@ -594,12 +594,12 @@ static bool avalon_detect_one(const char *devpath)
|
||||
applog(LOG_INFO, "Avalon Detect: Found at %s, mark as %d",
|
||||
devpath, avalon->device_id);
|
||||
|
||||
avalon_infos[avalon->device_id] = (struct avalon_info *)
|
||||
malloc(sizeof(struct avalon_info));
|
||||
avalon_infos[avalon->device_id] = calloc(sizeof(struct avalon_info), 1);
|
||||
if (unlikely(!(avalon_infos[avalon->device_id])))
|
||||
quit(1, "Failed to malloc avalon_infos");
|
||||
quit(1, "Failed to calloc avalon_infos");
|
||||
|
||||
info = avalon_infos[avalon->device_id];
|
||||
avalon->device_data = avalon_infos[avalon->device_id];
|
||||
info = avalon->device_data;
|
||||
|
||||
memset(info, 0, sizeof(struct avalon_info));
|
||||
|
||||
@ -640,12 +640,12 @@ static void __avalon_init(struct cgpu_info *avalon)
|
||||
|
||||
static void avalon_init(struct cgpu_info *avalon)
|
||||
{
|
||||
struct avalon_info *info = avalon->device_data;
|
||||
struct avalon_result ar;
|
||||
int fd, ret;
|
||||
|
||||
avalon->device_fd = -1;
|
||||
fd = avalon_open(avalon->device_path,
|
||||
avalon_infos[avalon->device_id]->baud);
|
||||
fd = avalon_open(avalon->device_path, info->baud);
|
||||
if (unlikely(fd == -1)) {
|
||||
applog(LOG_ERR, "Avalon: Failed to open on %s",
|
||||
avalon->device_path);
|
||||
@ -665,7 +665,7 @@ static void avalon_init(struct cgpu_info *avalon)
|
||||
static bool avalon_prepare(struct thr_info *thr)
|
||||
{
|
||||
struct cgpu_info *avalon = thr->cgpu;
|
||||
struct avalon_info *info = avalon_infos[avalon->device_id];
|
||||
struct avalon_info *info = avalon->device_data;
|
||||
struct timeval now;
|
||||
|
||||
free(avalon->works);
|
||||
@ -695,7 +695,7 @@ static void avalon_free_work(struct thr_info *thr)
|
||||
if (unlikely(!avalon->works))
|
||||
return;
|
||||
works = avalon->works;
|
||||
info = avalon_infos[avalon->device_id];
|
||||
info = avalon->device_data;
|
||||
|
||||
for (i = 0; i < info->miner_count * 4; i++) {
|
||||
if (works[i]) {
|
||||
@ -709,7 +709,7 @@ static void do_avalon_close(struct thr_info *thr)
|
||||
{
|
||||
struct avalon_result ar;
|
||||
struct cgpu_info *avalon = thr->cgpu;
|
||||
struct avalon_info *info = avalon_infos[avalon->device_id];
|
||||
struct avalon_info *info = avalon->device_data;
|
||||
|
||||
avalon_free_work(thr);
|
||||
sleep(1);
|
||||
@ -822,7 +822,7 @@ static int64_t avalon_scanhash(struct thr_info *thr)
|
||||
|
||||
avalon = thr->cgpu;
|
||||
works = avalon->works;
|
||||
info = avalon_infos[avalon->device_id];
|
||||
info = avalon->device_data;
|
||||
avalon_get_work_count = info->miner_count;
|
||||
|
||||
if (unlikely(avalon->device_fd == -1)) {
|
||||
@ -975,7 +975,7 @@ static int64_t avalon_scanhash(struct thr_info *thr)
|
||||
static struct api_data *avalon_api_stats(struct cgpu_info *cgpu)
|
||||
{
|
||||
struct api_data *root = NULL;
|
||||
struct avalon_info *info = avalon_infos[cgpu->device_id];
|
||||
struct avalon_info *info = cgpu->device_data;
|
||||
int i;
|
||||
|
||||
root = api_add_int(root, "baud", &(info->baud), false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user