Updated cointerra features.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
diff --git a/cgminer.c b/cgminer.c
index 43d894b..cccb18f 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -670,7 +670,7 @@ static char *set_int_0_to_10(const char *arg, int *i)
return set_int_range(arg, i, 0, 10);
}
-#ifdef USE_AVALON
+#if (defined USE_AVALON)||(defined USE_COINTERRA)
static char *set_int_0_to_100(const char *arg, int *i)
{
return set_int_range(arg, i, 0, 100);
@@ -1253,8 +1253,11 @@ static struct opt_table opt_config_table[] = {
#endif
#ifdef USE_COINTERRA
OPT_WITH_ARG("--cta-load",
- set_int_0_to_255, NULL, &opt_cta_load,
- opt_hidden),
+ set_int_0_to_255, opt_show_intval, &opt_cta_load,
+ "Set load for CTA devices, 0-255 range"),
+ OPT_WITH_ARG("--ps-load",
+ set_int_0_to_100, opt_show_intval, &opt_ps_load,
+ "Set power supply load for CTA devices, 0-100 range"),
#endif
OPT_WITHOUT_ARG("--debug|-D",
enable_debug, &opt_debug,
diff --git a/driver-cointerra.c b/driver-cointerra.c
index 48fcccf..abc4d73 100644
--- a/driver-cointerra.c
+++ b/driver-cointerra.c
@@ -14,6 +14,8 @@
static const char *cointerra_hdr = "ZZ";
+int opt_ps_load;
+
static void cta_gen_message(char *msg, char type)
{
memset(msg, 0, CTA_MSG_SIZE);
@@ -60,6 +62,7 @@ static bool cta_open(struct cgpu_info *cointerra)
buf[CTA_RESET_TYPE] = CTA_RESET_INIT | CTA_RESET_DIFF;
buf[CTA_RESET_DIFF] = diff_to_bits(CTA_INIT_DIFF);
buf[CTA_RESET_LOAD] = opt_cta_load ? opt_cta_load : 255;
+ buf[CTA_RESET_PSLOAD] = opt_ps_load;
if (cointerra->usbinfo.nodev)
return ret;
@@ -547,6 +550,9 @@ static void cta_parse_debug(struct cointerra_info *info, char *buf)
u16array_from_msg(info->tot_hw_errors, CTA_CORES, CTA_STAT_HW_ERRORS, buf);
info->tot_hashes = hu64_from_msg(buf, CTA_STAT_HASHES);
info->tot_flushed_hashes = hu64_from_msg(buf, CTA_STAT_FLUSHED_HASHES);
+ info->autovoltage = u8_from_msg(buf, CTA_STAT_AUTOVOLTAGE);
+ info->current_ps_percent = u8_from_msg(buf, CTA_STAT_POWER_PERCENT);
+ info->power_used = hu16_from_msg(buf,CTA_STAT_POWER_USED);
mutex_unlock(&info->lock);
}
@@ -826,6 +832,7 @@ resend:
buf[CTA_RESET_TYPE] = reset_type;
buf[CTA_RESET_LOAD] = opt_cta_load ? opt_cta_load : 255;
+ buf[CTA_RESET_PSLOAD] = opt_ps_load;
applog(LOG_INFO, "%s %d: Sending Reset type %u with diffbits %u", cointerra->drv->name,
cointerra->device_id, reset_type, diffbits);
@@ -1080,6 +1087,9 @@ static struct api_data *cta_api_stats(struct cgpu_info *cgpu)
root = api_add_string(root, "Asic1Core2", bitmaphex, true);
__bin2hex(bitmaphex, &info->pipe_bitmap[112], 16);
root = api_add_string(root, "Asic1Core3", bitmaphex, true);
+ root = api_add_uint8(root,"AV",&info->autovoltage, false);
+ root = api_add_uint8(root,"Power Supply Percent",&info->current_ps_percent, false);
+ root = api_add_uint16(root,"Power Used",&info->power_used, false);
return root;
}
diff --git a/driver-cointerra.h b/driver-cointerra.h
index 9bab1a5..eb6175c 100644
--- a/driver-cointerra.h
+++ b/driver-cointerra.h
@@ -33,6 +33,7 @@
#define CTA_RESET_TYPE 3
#define CTA_RESET_DIFF 4
#define CTA_RESET_LOAD 5
+#define CTA_RESET_PSLOAD 6
#define CTA_DRIVER_TAG 3
#define CTA_MCU_TAG 5
#define CTA_MCU_CORE 5
@@ -116,7 +117,10 @@
#define CTA_STAT_HW_ERRORS 5
#define CTA_STAT_UPTIME_MS 21
#define CTA_STAT_HASHES 25
-#define CTA_STAT_FLUSHED_HASHES 33
+#define CTA_STAT_FLUSHED_HASHES 33
+#define CTA_STAT_AUTOVOLTAGE 41
+#define CTA_STAT_POWER_PERCENT 42
+#define CTA_STAT_POWER_USED 43
#define CTA_CORES 8
#define CTA_PUMPS 2
@@ -127,6 +131,7 @@
int opt_cta_load;
+int opt_ps_load;
struct cointerra_info {
/* Info data */
@@ -175,6 +180,9 @@ struct cointerra_info {
uint64_t tot_hashes;
uint64_t tot_reset_hashes;
uint64_t tot_flushed_hashes;
+ uint8_t autovoltage;
+ uint8_t current_ps_percent;
+ uint16_t power_used;
/* Calculated totals based on work done and nonces found */
uint64_t hashes;