mirror of https://github.com/GOSTSec/sgminer
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
3.0 KiB
62 lines
3.0 KiB
/* |
|
* Copyright 2013 Con Kolivas <kernel@kolivas.org> |
|
* Copyright 2013 Hashfast |
|
* |
|
* This program is free software; you can redistribute it and/or modify it |
|
* under the terms of the GNU General Public License as published by the Free |
|
* Software Foundation; either version 3 of the License, or (at your option) |
|
* any later version. See COPYING for more details. |
|
*/ |
|
|
|
#ifndef HASHFAST_H |
|
#define HASHFAST_H |
|
|
|
#ifdef USE_HASHFAST |
|
#include "miner.h" |
|
#include "elist.h" |
|
#include "hf_protocol.h" |
|
|
|
#define HASHFAST_MINER_THREADS 1 |
|
#define HF_SEQUENCE_DISTANCE(tx,rx) ((tx)>=(rx)?((tx)-(rx)):(info->num_sequence+(tx)-(rx))) |
|
|
|
// Matching fields for hf_statistics, but large #'s for local accumulation, per-die |
|
struct hf_long_statistics { |
|
uint64_t rx_header_crc; // Header CRC's |
|
uint64_t rx_body_crc; // Data CRC's |
|
uint64_t rx_header_timeouts; // Header timeouts |
|
uint64_t rx_body_timeouts; // Data timeouts |
|
uint64_t core_nonce_fifo_full; // Core nonce Q overrun events |
|
uint64_t array_nonce_fifo_full; // System nonce Q overrun events |
|
uint64_t stats_overrun; // Overrun in statistics reporting |
|
} __attribute__((packed,aligned(4))); |
|
|
|
struct hashfast_info { |
|
int asic_count; // # of chips in the chain |
|
int core_count; // # of cores per chip |
|
int device_type; // What sort of device this is |
|
int num_sequence; // A power of 2. What the sequence number range is. |
|
int ref_frequency; // Reference clock rate |
|
uint16_t hash_sequence; // The next hash sequence # to be sent |
|
struct hf_g1_die_data *die_status; // Array of per-die voltage, current, temperature sensor data |
|
struct hf_long_statistics *die_statistics; // Array of per-die error counters |
|
int hash_clock_rate; // Hash clock rate to use, in Mhz |
|
struct hf_usb_init_base usb_init_base; // USB Base information from USB_INIT |
|
struct hf_config_data config_data; // Configuration data used from USB_INIT |
|
int core_bitmap_size; // in bytes |
|
uint32_t *core_bitmap; // Core OK bitmap test results, run with PLL Bypassed |
|
|
|
pthread_mutex_t lock; |
|
struct work **works; |
|
uint16_t hash_sequence_head; // HOST: The next hash sequence # to be sent |
|
uint16_t hash_sequence_tail; // HOST: Follows device_sequence_tail around to free work |
|
uint16_t device_sequence_head; // DEVICE: The most recent sequence number the device dispatched |
|
uint16_t device_sequence_tail; // DEVICE: The most recently completed job in the device |
|
int64_t hash_count; |
|
uint16_t shed_count; // Dynamic copy of #cores device has shed for thermal control |
|
int no_matching_work; |
|
|
|
pthread_t read_thr; |
|
}; |
|
|
|
#endif /* USE_HASHFAST */ |
|
#endif /* HASHFAST_H */
|
|
|