Rename nf1 driver to nfu in anticipation of support for more chips
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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
diff --git a/cgminer.c b/cgminer.c
index 4df1c1b..e77da7f 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1316,7 +1316,7 @@ static struct opt_table opt_config_table[] = {
#endif // defined(unix)
#ifdef USE_BITFURY
OPT_WITH_ARG("--nfu-bits",
- set_int_32_to_63, opt_show_intval, &opt_nf1_bits,
+ set_int_32_to_63, opt_show_intval, &opt_nfu_bits,
"Set nanofury bits for overclocking, range 32-63"),
#endif
OPT_WITHOUT_ARG("--net-delay",
diff --git a/driver-bitfury.c b/driver-bitfury.c
index a646241..bf9f99d 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -16,7 +16,7 @@
#include "libbitfury.h"
int opt_bxf_temp_target = BXF_TEMP_TARGET / 10;
-int opt_nf1_bits = 50;
+int opt_nfu_bits = 50;
int opt_bxm_bits = 54;
int opt_bxf_bits = 54;
int opt_bxf_debug;
@@ -371,7 +371,7 @@ out_close:
return false;
}
-static void nf1_close(struct cgpu_info *bitfury)
+static void nfu_close(struct cgpu_info *bitfury)
{
struct bitfury_info *info = bitfury->device_data;
struct mcp_settings *mcp = &info->mcp;
@@ -387,7 +387,7 @@ static void nf1_close(struct cgpu_info *bitfury)
mcp2210_set_gpio_settings(bitfury, mcp);
}
-static bool nf1_reinit(struct cgpu_info *bitfury, struct bitfury_info *info)
+static bool nfu_reinit(struct cgpu_info *bitfury, struct bitfury_info *info)
{
spi_clear_buf(info);
spi_add_break(info);
@@ -398,7 +398,7 @@ static bool nf1_reinit(struct cgpu_info *bitfury, struct bitfury_info *info)
return info->spi_txrx(bitfury, info);
}
-static bool nf1_set_spi_settings(struct cgpu_info *bitfury, struct bitfury_info *info)
+static bool nfu_set_spi_settings(struct cgpu_info *bitfury, struct bitfury_info *info)
{
struct mcp_settings *mcp = &info->mcp;
@@ -406,7 +406,7 @@ static bool nf1_set_spi_settings(struct cgpu_info *bitfury, struct bitfury_info
mcp->acsv, mcp->cstdd, mcp->ldbtcsd, mcp->sdbd, mcp->bpst, mcp->spimode);
}
-static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
+static bool nfu_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
{
struct mcp_settings *mcp = &info->mcp;
char buf[MCP2210_BUFFER_LENGTH];
@@ -426,8 +426,8 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
}
/* Set LED and PWR pins to output and high */
- mcp->direction.pin[NF1_PIN_LED] = mcp->direction.pin[NF1_PIN_PWR_EN] = MCP2210_GPIO_OUTPUT;
- mcp->value.pin[NF1_PIN_LED] = mcp->value.pin[NF1_PIN_PWR_EN] = MCP2210_GPIO_PIN_HIGH;
+ mcp->direction.pin[NFU_PIN_LED] = mcp->direction.pin[NFU_PIN_PWR_EN] = MCP2210_GPIO_OUTPUT;
+ mcp->value.pin[NFU_PIN_LED] = mcp->value.pin[NFU_PIN_PWR_EN] = MCP2210_GPIO_PIN_HIGH;
mcp->direction.pin[4] = MCP2210_GPIO_OUTPUT;
mcp->designation.pin[4] = MCP2210_PIN_CS;
@@ -466,7 +466,7 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
mcp->acsv = 0xffef;
mcp->cstdd = mcp->ldbtcsd = mcp->sdbd = mcp->spimode = 0;
mcp->bpst = 1;
- if (!nf1_set_spi_settings(bitfury, info))
+ if (!nfu_set_spi_settings(bitfury, info))
goto out;
buf[0] = 0;
@@ -475,14 +475,14 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
goto out;
/* after this command SCK_OVRRIDE should read the same as current SCK
* value (which for mode 0 should be 0) */
- if (!mcp2210_get_gpio_pinval(bitfury, NF1_PIN_SCK_OVR, &val))
+ if (!mcp2210_get_gpio_pinval(bitfury, NFU_PIN_SCK_OVR, &val))
goto out;
if (val != MCP2210_GPIO_PIN_LOW)
goto out;
/* switch SCK to polarity (default SCK=1 in mode 2) */
mcp->spimode = 2;
- if (!nf1_set_spi_settings(bitfury, info))
+ if (!nfu_set_spi_settings(bitfury, info))
goto out;
buf[0] = 0;
length = 1;
@@ -490,31 +490,31 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
goto out;
/* after this command SCK_OVRRIDE should read the same as current SCK
* value (which for mode 2 should be 1) */
- if (!mcp2210_get_gpio_pinval(bitfury, NF1_PIN_SCK_OVR, &val))
+ if (!mcp2210_get_gpio_pinval(bitfury, NFU_PIN_SCK_OVR, &val))
goto out;
if (val != MCP2210_GPIO_PIN_HIGH)
goto out;
/* switch SCK to polarity (default SCK=0 in mode 0) */
mcp->spimode = 0;
- if (!nf1_set_spi_settings(bitfury, info))
+ if (!nfu_set_spi_settings(bitfury, info))
goto out;
buf[0] = 0;
length = 1;
if (!mcp2210_spi_transfer(bitfury, mcp, buf, &length))
goto out;
- if (!mcp2210_get_gpio_pinval(bitfury, NF1_PIN_SCK_OVR, &val))
+ if (!mcp2210_get_gpio_pinval(bitfury, NFU_PIN_SCK_OVR, &val))
goto out;
if (val != MCP2210_GPIO_PIN_LOW)
goto out;
- info->osc6_bits = opt_nf1_bits;
- if (!nf1_reinit(bitfury, info))
+ info->osc6_bits = opt_nfu_bits;
+ if (!nfu_reinit(bitfury, info))
goto out;
ret = true;
if (!add_cgpu(bitfury))
- quit(1, "Failed to add_cgpu in nf1_detect_one");
+ quit(1, "Failed to add_cgpu in nfu_detect_one");
update_usb_stats(bitfury);
applog(LOG_INFO, "%s %d: Successfully initialised %s",
@@ -524,7 +524,7 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
info->total_nonces = 1;
out:
if (!ret)
- nf1_close(bitfury);
+ nfu_close(bitfury);
return ret;
}
@@ -802,8 +802,8 @@ static struct cgpu_info *bitfury_detect_one(struct libusb_device *dev, struct us
case IDENT_OSM:
ret = bxf_detect_one(bitfury, info);
break;
- case IDENT_NF1:
- ret = nf1_detect_one(bitfury, info);
+ case IDENT_NFU:
+ ret = nfu_detect_one(bitfury, info);
break;
case IDENT_BXM:
ret = bxm_detect_one(bitfury, info);
@@ -1322,7 +1322,7 @@ static void bitfury_check_work(struct thr_info *thr, struct cgpu_info *bitfury,
}
-static int64_t nf1_scan(struct thr_info *thr, struct cgpu_info *bitfury,
+static int64_t nfu_scan(struct thr_info *thr, struct cgpu_info *bitfury,
struct bitfury_info *info)
{
int64_t ret = 0;
@@ -1392,8 +1392,8 @@ static int64_t bitfury_scanwork(struct thr_info *thr)
case IDENT_OSM:
ret = bxf_scan(bitfury, info);
break;
- case IDENT_NF1:
- ret = nf1_scan(thr, bitfury, info);
+ case IDENT_NFU:
+ ret = nfu_scan(thr, bitfury, info);
break;
case IDENT_BXM:
ret = bxm_scan(thr, bitfury, info);
@@ -1594,8 +1594,8 @@ static void bitfury_shutdown(struct thr_info *thr)
case IDENT_OSM:
bxf_close(info);
break;
- case IDENT_NF1:
- nf1_close(bitfury);
+ case IDENT_NFU:
+ nfu_close(bitfury);
break;
case IDENT_BXM:
bxm_close(bitfury, info);
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 742d7b9..dfeef4e 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -23,15 +23,15 @@
#define BXF_TEMP_HYSTERESIS 30
extern int opt_bxf_temp_target;
-extern int opt_nf1_bits;
+extern int opt_nfu_bits;
extern int opt_bxm_bits;
extern int opt_bxf_bits;
extern int opt_bxf_debug;
extern int opt_osm_led_mode;
-#define NF1_PIN_LED 0
-#define NF1_PIN_SCK_OVR 5
-#define NF1_PIN_PWR_EN 6
+#define NFU_PIN_LED 0
+#define NFU_PIN_SCK_OVR 5
+#define NFU_PIN_PWR_EN 6
#define SPIBUF_SIZE 16384
#define BITFURY_REFRESH_DELAY 100
@@ -94,7 +94,7 @@ struct bitfury_info {
int *job; // Completed jobs we're told about
int *submits; // Submitted responses
- /* NF1 specific data */
+ /* NFU specific data */
struct mcp_settings mcp;
char spibuf[SPIBUF_SIZE];
unsigned int spibufsz;
diff --git a/libbitfury.c b/libbitfury.c
index 1857464..63da5b8 100644
--- a/libbitfury.c
+++ b/libbitfury.c
@@ -122,7 +122,7 @@ void spi_set_freq(struct bitfury_info *info)
void spi_send_conf(struct bitfury_info *info)
{
- const int8_t nf1_counters[16] = { 64, 64, SECOND_BASE, SECOND_BASE+4, SECOND_BASE+2,
+ const int8_t nfu_counters[16] = { 64, 64, SECOND_BASE, SECOND_BASE+4, SECOND_BASE+2,
SECOND_BASE+2+16, SECOND_BASE, SECOND_BASE+1, (FIRST_BASE)%65, (FIRST_BASE+1)%65,
(FIRST_BASE+3)%65, (FIRST_BASE+3+16)%65, (FIRST_BASE+4)%65, (FIRST_BASE+4+4)%65,
(FIRST_BASE+3+3)%65, (FIRST_BASE+3+1+3)%65 };
@@ -136,7 +136,7 @@ void spi_send_conf(struct bitfury_info *info)
spi_config_reg(info, i, 0);
/* Program counters correctly for rounds processing, here it should
* start consuming power */
- spi_add_data(info, 0x0100, nf1_counters, 16);
+ spi_add_data(info, 0x0100, nfu_counters, 16);
}
void spi_send_init(struct bitfury_info *info)
@@ -228,9 +228,9 @@ bool spi_reset(struct cgpu_info *bitfury, struct bitfury_info *info)
int r;
// SCK_OVRRIDE
- mcp->value.pin[NF1_PIN_SCK_OVR] = MCP2210_GPIO_PIN_HIGH;
- mcp->direction.pin[NF1_PIN_SCK_OVR] = MCP2210_GPIO_OUTPUT;
- mcp->designation.pin[NF1_PIN_SCK_OVR] = MCP2210_PIN_GPIO;
+ mcp->value.pin[NFU_PIN_SCK_OVR] = MCP2210_GPIO_PIN_HIGH;
+ mcp->direction.pin[NFU_PIN_SCK_OVR] = MCP2210_GPIO_OUTPUT;
+ mcp->designation.pin[NFU_PIN_SCK_OVR] = MCP2210_PIN_GPIO;
if (!mcp2210_set_gpio_settings(bitfury, mcp))
return false;
@@ -243,7 +243,7 @@ bool spi_reset(struct cgpu_info *bitfury, struct bitfury_info *info)
}
// Deactivate override
- mcp->direction.pin[NF1_PIN_SCK_OVR] = MCP2210_GPIO_INPUT;
+ mcp->direction.pin[NFU_PIN_SCK_OVR] = MCP2210_GPIO_INPUT;
if (!mcp2210_set_gpio_settings(bitfury, mcp))
return false;
diff --git a/usbutils.c b/usbutils.c
index 6ab114d..3882507 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -159,13 +159,13 @@ static struct usb_intinfo bxf_ints[] = {
USB_EPS(0, bxf0_epinfos)
};
-static struct usb_epinfo nf1_epinfos[] = {
+static struct usb_epinfo nfu_epinfos[] = {
{ LIBUSB_TRANSFER_TYPE_INTERRUPT, 64, EPI(1), 0, 0 },
{ LIBUSB_TRANSFER_TYPE_INTERRUPT, 64, EPO(1), 0, 0 },
};
-static struct usb_intinfo nf1_ints[] = {
- USB_EPS(0, nf1_epinfos)
+static struct usb_intinfo nfu_ints[] = {
+ USB_EPS(0, nfu_epinfos)
};
static struct usb_epinfo bxm_epinfos[] = {
@@ -428,14 +428,14 @@ static struct usb_find_devices find_dev[] = {
},
{
.drv = DRIVER_bitfury,
- .name = "NF1",
- .ident = IDENT_NF1,
+ .name = "NFU",
+ .ident = IDENT_NFU,
.idVendor = 0x04d8,
.idProduct = 0x00de,
.config = 1,
.timeout = BITFURY_TIMEOUT_MS,
.latency = LATENCY_UNUSED,
- INTINFO(nf1_ints)
+ INTINFO(nfu_ints)
},
{
.drv = DRIVER_bitfury,
diff --git a/usbutils.h b/usbutils.h
index 80f7c66..7f51186 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -158,7 +158,7 @@ enum sub_ident {
IDENT_KLN,
IDENT_LLT,
IDENT_MMQ,
- IDENT_NF1,
+ IDENT_NFU,
IDENT_OSM
};