forked from ubiGG/bmminer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fazio.Bai
committed
Aug 22, 2016
0 parents
commit b7cddda
Showing
262 changed files
with
134,763 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
nbproject | ||
ccan/opt/.dirstamp | ||
compat/jansson-2.6/jansson.pc | ||
compat/jansson-2.6/libtool | ||
compat/jansson-2.6/ltmain.sh | ||
compat/jansson-2.6/m4/libtool.m4 | ||
compat/jansson-2.6/m4/ltoptions.m4 | ||
compat/jansson-2.6/m4/ltsugar.m4 | ||
compat/jansson-2.6/m4/ltversion.m4 | ||
compat/jansson-2.6/m4/lt~obsolete.m4 | ||
compat/jansson-2.6/src/.libs/ | ||
compat/jansson-2.6/src/dump.lo | ||
compat/jansson-2.6/src/error.lo | ||
compat/jansson-2.6/src/hashtable.lo | ||
compat/jansson-2.6/src/jansson_config.h | ||
compat/jansson-2.6/src/libjansson.la | ||
compat/jansson-2.6/src/load.lo | ||
compat/jansson-2.6/src/memory.lo | ||
compat/jansson-2.6/src/pack_unpack.lo | ||
compat/jansson-2.6/src/strbuffer.lo | ||
compat/jansson-2.6/src/strconv.lo | ||
compat/jansson-2.6/src/utf.lo | ||
compat/jansson-2.6/src/value.lo | ||
compat/libusb-1.0/libtool | ||
compat/libusb-1.0/libusb-1.0.pc | ||
compat/libusb-1.0/libusb/.libs/ | ||
compat/libusb-1.0/libusb/os/.dirstamp | ||
compat/libusb-1.0/ltmain.sh | ||
libtool | ||
ltmain.sh | ||
m4/libtool.m4 | ||
m4/ltoptions.m4 | ||
m4/ltsugar.m4 | ||
m4/ltversion.m4 | ||
m4/lt~obsolete.m4 | ||
|
||
|
||
|
||
cgminer | ||
cgminer.exe | ||
minerd | ||
minerd.exe | ||
*.o | ||
*.bin | ||
|
||
autom4te.cache | ||
.deps | ||
|
||
Makefile | ||
Makefile.in | ||
INSTALL | ||
aclocal.m4 | ||
configure | ||
depcomp | ||
missing | ||
install-sh | ||
stamp-h1 | ||
cpuminer-config.h* | ||
compile | ||
config.log | ||
config.status | ||
config.guess | ||
config.sub | ||
|
||
mingw32-config.cache | ||
|
||
*~ | ||
|
||
ext_deps | ||
config.h.in | ||
config.h | ||
|
||
|
||
ccan/libccan.a | ||
lib/arg-nonnull.h | ||
lib/c++defs.h | ||
lib/libgnu.a | ||
lib/signal.h | ||
lib/string.h | ||
lib/stdint.h | ||
lib/warn-on-use.h | ||
|
||
mkinstalldirs | ||
|
||
*.swp | ||
*.pre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Butterfly Labs FPGA and ASIC devices | ||
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# ModMinerQuad | ||
ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0003", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Lancelot and Avalon | ||
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Icarus | ||
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0083", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# AsicminerUSB and Antminer U1 | ||
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Cairnsmore1 | ||
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="0230", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Cairnsmore1-2 | ||
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8350", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Ztex | ||
ATTRS{idVendor}=="221a", ATTRS{idProduct}=="0100", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# BF1 | ||
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204b", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Klondike | ||
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f60a", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# HashFast | ||
ATTRS{idVendor}=="297c", ATTRS{idProduct}=="0001", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
ATTRS{idVendor}=="297c", ATTRS{idProduct}=="8001", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# BXF | ||
ATTRS{idVendor}=="198c", ATTRS{idProduct}=="b1f1", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# NF1 | ||
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00de", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# ANT_S1 | ||
ATTRS{idVendor}=="4254", ATTRS{idProduct}=="4153", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Cointerra | ||
ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="0003", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Drillbit Thumb | ||
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2404", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" | ||
|
||
# Avalon4 | ||
ATTRS{idVendor}=="29f1", ATTRS{idProduct}=="33f2", SUBSYSTEM=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* | ||
* board selector support for TCA9535 used in Bitmine's CoinCraft Desk | ||
* | ||
* Copyright 2014 Zefir Kurtisi <[email protected]> | ||
* | ||
* 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. | ||
*/ | ||
|
||
|
||
#include <sys/ioctl.h> | ||
#include <errno.h> | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
#include <linux/i2c.h> | ||
#include <linux/i2c-dev.h> | ||
|
||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <fcntl.h> | ||
|
||
#include "miner.h" | ||
|
||
#include "A1-board-selector.h" | ||
#include "i2c-context.h" | ||
|
||
static struct board_selector ccd_selector; | ||
|
||
struct i2c_ctx *U1_tca9535; | ||
uint8_t chain_mask = 0xff; | ||
uint8_t active_chain = 255; | ||
pthread_mutex_t lock; | ||
|
||
|
||
#define UNUSED_BITS 0xe0 | ||
|
||
static void ccd_unlock(void) | ||
{ | ||
mutex_unlock(&lock); | ||
} | ||
|
||
static void ccd_exit(void) | ||
{ | ||
if (U1_tca9535 != NULL) | ||
U1_tca9535->exit(U1_tca9535); | ||
} | ||
uint8_t retval = 0; | ||
|
||
extern struct board_selector *ccd_board_selector_init(void) | ||
{ | ||
mutex_init(&lock); | ||
U1_tca9535 = i2c_slave_open(I2C_BUS, 0x27); | ||
if (U1_tca9535 == NULL) | ||
return NULL; | ||
bool retval = U1_tca9535->write(U1_tca9535, 0x06, 0xe0) && | ||
U1_tca9535->write(U1_tca9535, 0x07, 0xe0) && | ||
U1_tca9535->write(U1_tca9535, 0x02, 0x1f) && | ||
U1_tca9535->write(U1_tca9535, 0x03, 0x00); | ||
if (retval) | ||
return &ccd_selector; | ||
ccd_exit(); | ||
return NULL; | ||
} | ||
|
||
static bool ccd_select(uint8_t chain) | ||
{ | ||
if (chain >= CCD_MAX_CHAINS) | ||
return false; | ||
|
||
mutex_lock(&lock); | ||
if (active_chain == chain) | ||
return true; | ||
|
||
active_chain = chain; | ||
chain_mask = 1 << active_chain; | ||
return U1_tca9535->write(U1_tca9535, 0x02, ~chain_mask); | ||
} | ||
|
||
static bool __ccd_board_selector_reset(uint8_t mask) | ||
{ | ||
if (!U1_tca9535->write(U1_tca9535, 0x03, mask)) | ||
return false; | ||
cgsleep_ms(RESET_LOW_TIME_MS); | ||
if (!U1_tca9535->write(U1_tca9535, 0x03, 0x00)) | ||
return false; | ||
cgsleep_ms(RESET_HI_TIME_MS); | ||
return true; | ||
} | ||
// we assume we are already holding the mutex | ||
static bool ccd_reset(void) | ||
{ | ||
return __ccd_board_selector_reset(chain_mask); | ||
} | ||
|
||
static bool ccd_reset_all(void) | ||
{ | ||
mutex_lock(&lock); | ||
bool retval = __ccd_board_selector_reset(0xff & ~UNUSED_BITS); | ||
mutex_unlock(&lock); | ||
return retval; | ||
} | ||
|
||
|
||
static struct board_selector ccd_selector = { | ||
.select = ccd_select, | ||
.release = ccd_unlock, | ||
.exit = ccd_exit, | ||
.reset = ccd_reset, | ||
.reset_all = ccd_reset_all, | ||
/* don't have a temp sensor dedicated to chain */ | ||
.get_temp = dummy_get_temp, | ||
}; | ||
|
Oops, something went wrong.