add license headers and some cleanup
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
diff --git a/libztex.c b/libztex.c
index 6d2c9bf..57200c8 100644
--- a/libztex.c
+++ b/libztex.c
@@ -1,3 +1,25 @@
+/**
+ * libztex.c - Ztex 1.15x fpga board support library
+ *
+ * Copyright (c) 2012 nelisky.btc@gmail.com
+ *
+ * This work is based upon the Java SDK provided by ztex which is
+ * Copyright (C) 2009-2011 ZTEX GmbH.
+ * http://www.ztex.de
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see http://www.gnu.org/licenses/.
+**/
+
#include <stdio.h>
#include <unistd.h>
#include "miner.h"
@@ -340,8 +362,6 @@ int libztex_scanDevices (struct libztex_dev_list*** devs_p) {
devs[pos] = malloc(sizeof(struct libztex_dev_list));
devs[pos]->dev = ztex;
devs[pos]->next = NULL;
- //libusb_open(list[usbdevices[i]], &devs[i]->hndl);
- //libusb_close(devs[cnt]->dev->hndl);
if (pos > 0) {
devs[pos]->next = devs[pos];
}
diff --git a/libztex.h b/libztex.h
index 44e598b..bce2498 100644
--- a/libztex.h
+++ b/libztex.h
@@ -1,3 +1,24 @@
+/**
+ * libztex.h - headers for Ztex 1.15x fpga board support library
+ *
+ * Copyright (c) 2012 nelisky.btc@gmail.com
+ *
+ * This work is based upon the Java SDK provided by ztex which is
+ * Copyright (C) 2009-2011 ZTEX GmbH.
+ * http://www.ztex.de
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see http://www.gnu.org/licenses/.
+**/
#ifndef __LIBZTEX_H__
#define __LIBZTEX_H__
diff --git a/ztex.c b/ztex.c
index 2cf7ae2..e478ab0 100644
--- a/ztex.c
+++ b/ztex.c
@@ -1,34 +1,37 @@
-//#include <limits.h>
-//#include <pthread.h>
-//#include <stdio.h>
-//#include <sys/time.h>
-//#include <sys/types.h>
-//#include <dirent.h>
-//#include <unistd.h>
-//#ifndef WIN32
-// #include <termios.h>
-// #include <sys/stat.h>
-// #include <fcntl.h>
-// #ifndef O_CLOEXEC
-// #define O_CLOEXEC 0
-// #endif
-//#else
-// #include <windows.h>
-// #include <io.h>
-//#endif
-
-//#include "elist.h"
+/**
+ * ztex.c - cgminer worker for Ztex 1.15x fpga board
+ *
+ * Copyright (c) 2012 nelisky.btc@gmail.com
+ *
+ * This work is based upon the Java SDK provided by ztex which is
+ * Copyright (C) 2009-2011 ZTEX GmbH.
+ * http://www.ztex.de
+ *
+ * This work is based upon the icarus.c worker which is
+ * Copyright 2012 Luke Dashjr
+ * Copyright 2012 Xiangfu <xiangfu@openmobilefree.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see http://www.gnu.org/licenses/.
+**/
#include <unistd.h>
#include "miner.h"
#include "libztex.h"
-//#include <libusb.h>
#define GOLDEN_BACKLOG 5
struct device_api ztex_api;
-
static void ztex_detect()
{
int cnt;
@@ -46,7 +49,6 @@ static void ztex_detect()
ztex->api = &ztex_api;
ztex->device_id = total_devices;
ztex->device = ztex_devices[i]->dev;
- //ztex->device_path = strdup(devpath);
ztex->threads = 1;
devices[total_devices++] = ztex;
@@ -91,17 +93,13 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
memcpy(sendbuf+12, work->midstate, 32);
memset(backlog, 0, sizeof(backlog));
libztex_sendHashData(ztex, sendbuf);
- //applog(LOG_WARNING, "sent hashdata");
+ applog(LOG_DEBUG, "sent hashdata");
- //hdata = malloc(sizeof(struct libztex_hash_data*)*ztex->numNonces);
for (i=0; i<ztex->numNonces; i++) {
- //hdata[i] = malloc(sizeof(struct libztex_hash_data));
lastnonce[i] = 0;
}
- //sleep(1.00);
overflow = false;
while (!(overflow || work_restart[thr->id].restart)) {
- //sleep(0.5);
libztex_readHashData(ztex, &hdata[0]);
for (i=0; i<ztex->numNonces; i++) {
@@ -132,22 +130,14 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
#endif
work->blk.nonce = 0xffffffff;
rv = submit_nonce(thr, work, nonce);
- applog(LOG_WARNING, "submitted %0.8X %d", nonce, rv);
+ applog(LOG_DEBUG, "submitted %0.8X %d", nonce, rv);
}
}
-
-//
-// //applog(LOG_WARNING, "%0.8X %0.8X %d", hdata[i]->nonce, hdata[i]->goldenNonce, work_restart[thr->id].restart);
}
}
- //for (i=0; i<ztex->numNonces; i++) {
- // free(hdata[i]);
- // }
- // free(hdata);
-
- applog(LOG_WARNING, "exit %0.8X", noncecnt);
+ applog(LOG_DEBUG, "exit %0.8X", noncecnt);
return noncecnt;
}
@@ -166,3 +156,4 @@ struct device_api ztex_api = {
.scanhash = ztex_scanhash,
.thread_shutdown = ztex_shutdown,
};
+