├── software ├── cgminer │ ├── .depend │ ├── compat │ │ ├── libusb-1.0 │ │ │ ├── ChangeLog │ │ │ ├── THANKS │ │ │ ├── libusb │ │ │ │ ├── os │ │ │ │ │ ├── poll_posix.h │ │ │ │ │ ├── threads_posix.c │ │ │ │ │ ├── threads_posix.h │ │ │ │ │ └── threads_windows.h │ │ │ │ ├── version.h │ │ │ │ ├── Makefile.am │ │ │ │ ├── libusb-1.0.rc │ │ │ │ └── hotplug.h │ │ │ ├── TODO │ │ │ ├── libusb-1.0.pc.in │ │ │ ├── Makefile.am │ │ │ ├── README │ │ │ ├── m4 │ │ │ │ └── ltversion.m4 │ │ │ ├── AUTHORS │ │ │ └── NEWS │ │ ├── Makefile.am │ │ └── jansson-2.5 │ │ │ ├── jansson.pc.in │ │ │ ├── Makefile.am │ │ │ ├── src │ │ │ ├── Makefile.am │ │ │ ├── strbuffer.h │ │ │ ├── utf.h │ │ │ ├── memory.c │ │ │ ├── jansson_config.h.in │ │ │ ├── jansson.def │ │ │ ├── error.c │ │ │ ├── jansson_private.h │ │ │ ├── strbuffer.c │ │ │ └── strconv.c │ │ │ ├── m4 │ │ │ └── ltversion.m4 │ │ │ ├── LICENSE │ │ │ ├── configure.ac │ │ │ ├── README.rst │ │ │ └── config.h.in │ ├── run.sh │ ├── API.class │ ├── bitstreams │ │ ├── fpgaminer_top_fixed7_197MHz.ncd │ │ └── COPYING_fpgaminer │ ├── ChangeLog │ ├── ccan │ │ ├── Makefile.am │ │ └── opt │ │ │ ├── private.h │ │ │ └── usage.c │ ├── AUTHORS │ ├── lib │ │ ├── memchr.valgrind │ │ ├── dummy.c │ │ ├── sig-handler.h │ │ ├── stddef.in.h │ │ └── memmem.c │ ├── example.conf │ ├── m4 │ │ ├── ltversion.m4 │ │ ├── wchar_t.m4 │ │ ├── sigaction.m4 │ │ ├── 00gnulib.m4 │ │ ├── signalblocking.m4 │ │ ├── stddef_h.m4 │ │ ├── mmap-anon.m4 │ │ ├── multiarch.m4 │ │ ├── warn-on-use.m4 │ │ ├── signal_h.m4 │ │ └── memchr.m4 │ ├── driver-gridseed.h │ ├── driver-bitfury.h │ ├── arg-nonnull.h │ ├── 01-cgminer.rules │ ├── compat.h │ ├── hexdump.c │ ├── logging.c │ ├── api-example.php │ ├── Makefile.am │ ├── sha2.h │ ├── logging.h │ └── fpgautils.h ├── cpuminer │ ├── ChangeLog │ ├── compat │ │ ├── Makefile.am │ │ └── jansson │ │ │ ├── util.h │ │ │ ├── Makefile.am │ │ │ ├── utf.h │ │ │ ├── strbuffer.h │ │ │ ├── LICENSE │ │ │ ├── jansson_private.h │ │ │ ├── config.h │ │ │ └── strbuffer.c │ ├── LICENSE │ ├── AUTHORS │ ├── autogen.sh │ ├── example-cfg.json │ ├── run.sh │ ├── .gitignore │ ├── compat.h │ ├── Makefile.am │ ├── nomacro.pl │ └── README ├── doc │ ├── INSTALL_CN.pdf │ └── INSTALL_EN.pdf └── README.md ├── hardware ├── GC3355 USB BOM.xlsx ├── GC3355 USB_pcb_V1.brd ├── GC3355 USB FOR RELEASE.DSN └── GC3355 USB for release.pdf ├── firmware ├── STM32_Virtual_COM │ ├── _htmresc │ │ ├── ar_s.gif │ │ ├── logo.bmp │ │ ├── bulb16.gif │ │ ├── stm32_ryc.jpg │ │ ├── USB-RGB-1008.jpg │ │ └── CMSIS_Logo_Final.jpg │ ├── Projects │ │ └── Virtual_COM_Port │ │ │ ├── inc │ │ │ ├── delay.h │ │ │ ├── timer.h │ │ │ ├── debug.h │ │ │ ├── trans_buffers.h │ │ │ ├── stm32_it.h │ │ │ ├── miner.h │ │ │ ├── usb_pwr.h │ │ │ ├── usb_istr.h │ │ │ ├── usb_desc.h │ │ │ ├── stm32l1xx_conf.h │ │ │ ├── stm32f30x_conf.h │ │ │ ├── stm32f37x_conf.h │ │ │ └── hw_config.h │ │ │ ├── src │ │ │ ├── debug.c │ │ │ ├── delay.c │ │ │ ├── timer.c │ │ │ └── hw_config.c │ │ │ └── MDK-ARM │ │ │ ├── STM3210B-EVAL │ │ │ ├── STM3210B-EVAL.plg │ │ │ └── STM3210B-EVAL.sct │ │ │ └── JLinkSettings.ini │ ├── MCD-ST Liberty SW License Agreement V2.pdf │ ├── Libraries │ │ ├── CMSIS │ │ │ ├── Device │ │ │ │ └── ST │ │ │ │ │ └── STM32F10x │ │ │ │ │ └── Include │ │ │ │ │ ├── stm32f10x.h │ │ │ │ │ └── system_stm32f10x.h │ │ │ └── Include │ │ │ │ └── arm_common_tables.h │ │ ├── STM32F10x_StdPeriph_Driver │ │ │ ├── src │ │ │ │ ├── stm32f10x_i2c.c │ │ │ │ ├── stm32f10x_flash.c │ │ │ │ └── stm32f10x_usart.c │ │ │ └── inc │ │ │ │ ├── stm32f10x_crc.h │ │ │ │ └── stm32f10x_wwdg.h │ │ └── STM32_USB-FS-Device_Driver │ │ │ ├── inc │ │ │ ├── usb_int.h │ │ │ ├── usb_type.h │ │ │ ├── usb_mem.h │ │ │ ├── usb_sil.h │ │ │ ├── usb_lib.h │ │ │ ├── usb_init.h │ │ │ └── usb_def.h │ │ │ └── src │ │ │ └── usb_init.c │ └── Utilities │ │ └── STM32_EVAL │ │ ├── Common │ │ ├── fonts.h │ │ └── lcd_log_conf_template.h │ │ └── STM3210E_EVAL │ │ └── stm3210e_eval_fsmc_sram.h └── PC_Firmware_Protocol │ ├── GC3355_USB_Protocol_V1.1_CN.pdf │ └── GC3355_USB_Protocol_V1.1_EN.pdf └── README.md /software/cgminer/.depend: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /software/cpuminer/ChangeLog: -------------------------------------------------------------------------------- 1 | See git repository ('git log') for full changelog. 2 | -------------------------------------------------------------------------------- /software/cgminer/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./cgminer --verbose $1 $2 $3 $4 $5 $6 $7 4 | -------------------------------------------------------------------------------- /software/cgminer/API.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/software/cgminer/API.class -------------------------------------------------------------------------------- /software/doc/INSTALL_CN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/software/doc/INSTALL_CN.pdf -------------------------------------------------------------------------------- /software/doc/INSTALL_EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/software/doc/INSTALL_EN.pdf -------------------------------------------------------------------------------- /hardware/GC3355 USB BOM.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/hardware/GC3355 USB BOM.xlsx -------------------------------------------------------------------------------- /hardware/GC3355 USB_pcb_V1.brd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/hardware/GC3355 USB_pcb_V1.brd -------------------------------------------------------------------------------- /software/cpuminer/compat/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | if WANT_JANSSON 3 | SUBDIRS = jansson 4 | else 5 | SUBDIRS = 6 | endif 7 | 8 | -------------------------------------------------------------------------------- /hardware/GC3355 USB FOR RELEASE.DSN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/hardware/GC3355 USB FOR RELEASE.DSN -------------------------------------------------------------------------------- /hardware/GC3355 USB for release.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/hardware/GC3355 USB for release.pdf -------------------------------------------------------------------------------- /software/cpuminer/LICENSE: -------------------------------------------------------------------------------- 1 | cpuminer is available under the terms of the GNU Public License version 2. 2 | 3 | See COPYING for details. 4 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/_htmresc/ar_s.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/_htmresc/ar_s.gif -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/_htmresc/logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/_htmresc/logo.bmp -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/_htmresc/bulb16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/_htmresc/bulb16.gif -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/_htmresc/stm32_ryc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/_htmresc/stm32_ryc.jpg -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/_htmresc/USB-RGB-1008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/_htmresc/USB-RGB-1008.jpg -------------------------------------------------------------------------------- /software/cpuminer/AUTHORS: -------------------------------------------------------------------------------- 1 | Jeff Garzik 2 | 3 | ArtForz 4 | 5 | pooler 6 | 7 | 8 | faster -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/_htmresc/CMSIS_Logo_Final.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/_htmresc/CMSIS_Logo_Final.jpg -------------------------------------------------------------------------------- /software/cgminer/compat/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = jansson-2.5 3 | 4 | if WANT_USBUTILS 5 | if WANT_STATIC_LIBUSB 6 | SUBDIRS += libusb-1.0 7 | endif 8 | endif 9 | -------------------------------------------------------------------------------- /software/cgminer/bitstreams/fpgaminer_top_fixed7_197MHz.ncd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/software/cgminer/bitstreams/fpgaminer_top_fixed7_197MHz.ncd -------------------------------------------------------------------------------- /firmware/PC_Firmware_Protocol/GC3355_USB_Protocol_V1.1_CN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/PC_Firmware_Protocol/GC3355_USB_Protocol_V1.1_CN.pdf -------------------------------------------------------------------------------- /firmware/PC_Firmware_Protocol/GC3355_USB_Protocol_V1.1_EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/PC_Firmware_Protocol/GC3355_USB_Protocol_V1.1_EN.pdf -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/delay.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/delay.h -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/src/debug.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/src/debug.c -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/src/delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/src/delay.c -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/src/timer.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/src/timer.c -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/MCD-ST Liberty SW License Agreement V2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/MCD-ST Liberty SW License Agreement V2.pdf -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/src/hw_config.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/src/hw_config.c -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef __TIMER_H 2 | #define __TIMER_H 3 | #include "stm32f10x_tim.h" 4 | 5 | void Timerx_Init(u16 arr,u16 psc); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /software/cgminer/ChangeLog: -------------------------------------------------------------------------------- 1 | See git repository ('git log') for full changelog. 2 | 3 | Git repo can be found at: 4 | https://github.com/ckolivas/cgminer 5 | 6 | The NEWS file contains most of the changelog 7 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/CMSIS/Device/ST/STM32F10x/Include/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Libraries/CMSIS/Device/ST/STM32F10x/Include/stm32f10x.h -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/MDK-ARM/STM3210B-EVAL/STM3210B-EVAL.plg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gridseed/usb-miner/HEAD/firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/MDK-ARM/STM3210B-EVAL/STM3210B-EVAL.plg -------------------------------------------------------------------------------- /software/cgminer/ccan/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LIBRARIES = libccan.a 2 | 3 | libccan_a_SOURCES = compiler/compiler.h opt/helpers.c opt/opt.c opt/opt.h opt/parse.c opt/private.h opt/usage.c typesafe_cb/typesafe_cb.h 4 | libccan_a_CPPFLAGS = -I$(top_srcdir) 5 | -------------------------------------------------------------------------------- /software/cpuminer/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # You need autoconf 2.5x, preferably 2.57 or later 4 | # You need automake 1.7 or later. 1.6 might work. 5 | 6 | set -e 7 | 8 | aclocal 9 | autoheader 10 | automake --gnu --add-missing --copy 11 | autoconf 12 | 13 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/THANKS: -------------------------------------------------------------------------------- 1 | Development contributors are listed in the AUTHORS file. Other community 2 | members who have made significant contributions in other areas are listed 3 | in this file: 4 | 5 | Alan Stern 6 | Ludovic Rousseau 7 | Tim Roberts 8 | Xiaofan Chen 9 | -------------------------------------------------------------------------------- /software/README.md: -------------------------------------------------------------------------------- 1 | cgminer 2 | BTC mining software. Please see https://github.com/ckolivas/cgminer 3 | This is a little old version, based on cgminer-3.8.5. Will reach the lastest version of cgminer soon. 4 | 5 | cpuminer 6 | LTC mining software. Please see https://github.com/pooler/cpuminer 7 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb/os/poll_posix.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBUSB_POLL_POSIX_H 2 | #define LIBUSB_POLL_POSIX_H 3 | 4 | #define usbi_write write 5 | #define usbi_read read 6 | #define usbi_close close 7 | #define usbi_pipe pipe 8 | #define usbi_poll poll 9 | 10 | #endif /* LIBUSB_POLL_POSIX_H */ 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | All document for building USB BTC/LTC dual miner based on GC3355 chips. 2 | 3 | 1. Hardware 4 | Include Schematic, PCB, BOM. 5 | 6 | 2. Firmware 7 | Firmware for ARM Cortex STM32F103 CPU, to control set of GC3355 mining chips. 8 | 9 | 3. Software 10 | cgminer and cpuminer program for BTC and LTC mining. -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/jansson.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=${prefix}/include 5 | 6 | Name: Jansson 7 | Description: Library for encoding, decoding and manipulating JSON data 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -ljansson 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /software/cpuminer/example-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment1" : "Any long-format command line argument ", 3 | "_comment2" : "may be used in this JSON configuration file", 4 | 5 | "url" : "http://127.0.0.1:9332/", 6 | "user" : "rpcuser", 7 | "pass" : "rpcpass", 8 | 9 | "algo" : "scrypt", 10 | "threads" : "4", 11 | 12 | "quiet" : true 13 | } 14 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/TODO: -------------------------------------------------------------------------------- 1 | for 1.1 or future 2 | ================== 3 | optional timerfd support (runtime detection) 4 | notifications of hotplugged/unplugged devices 5 | offer API to create/destroy handle_events thread 6 | isochronous sync I/O? 7 | exposing of parent-child device relationships 8 | "usb primer" introduction docs 9 | more examples 10 | -------------------------------------------------------------------------------- /software/cpuminer/compat/jansson/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2010 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef UTIL_H 9 | #define UTIL_H 10 | 11 | #define max(a, b) ((a) > (b) ? (a) : (b)) 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /software/cpuminer/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./minerd -o stratum+tcp://ltc.give-me-coins.com:3333 -u faster.1 -p abcd1234 --dual 3 | #./minerd -o stratum+tcp://ltc.give-me-coins.com:3333 -u faster.1 -p abcd1234 -G /dev/ttyUSB0,/dev/ttyUSB1 --freq=700 -t 1 $1 $2 $3 $4 4 | #./minerd -o stratum+tcp://hk2.wemineltc.com:3333 -u faster.1 -p abcd1234 -G /dev/ttyUSB0,/dev/ttyUSB1 --freq=700 -t 1 $1 $2 $3 $4 5 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb-1.0.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libusb-1.0 7 | Description: C API for USB device access from Linux, Mac OS X, OpenBSD, NetBSD and Windows userspace 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lusb-1.0 10 | Libs.private: @LIBS@ 11 | Cflags: -I${includedir}/libusb-1.0 12 | 13 | -------------------------------------------------------------------------------- /software/cpuminer/compat/jansson/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | noinst_LIBRARIES = libjansson.a 3 | 4 | libjansson_a_SOURCES = \ 5 | config.h \ 6 | dump.c \ 7 | hashtable.c \ 8 | hashtable.h \ 9 | jansson.h \ 10 | jansson_private.h \ 11 | load.c \ 12 | strbuffer.c \ 13 | strbuffer.h \ 14 | utf.c \ 15 | utf.h \ 16 | util.h \ 17 | value.c 18 | 19 | -------------------------------------------------------------------------------- /software/cpuminer/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | minerd 3 | minerd.exe 4 | *.o 5 | 6 | autom4te.cache 7 | .deps 8 | 9 | Makefile 10 | Makefile.in 11 | INSTALL 12 | aclocal.m4 13 | configure 14 | configure.lineno 15 | depcomp 16 | missing 17 | install-sh 18 | stamp-h1 19 | cpuminer-config.h* 20 | compile 21 | config.log 22 | config.status 23 | config.status.lineno 24 | config.guess 25 | config.sub 26 | 27 | mingw32-config.cache 28 | 29 | -------------------------------------------------------------------------------- /software/cpuminer/compat.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMPAT_H__ 2 | #define __COMPAT_H__ 3 | 4 | #ifdef WIN32 5 | 6 | #include 7 | 8 | #define sleep(secs) Sleep((secs) * 1000) 9 | 10 | enum { 11 | PRIO_PROCESS = 0, 12 | }; 13 | 14 | static inline int setpriority(int which, int who, int prio) 15 | { 16 | return -!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE); 17 | } 18 | 19 | #endif /* WIN32 */ 20 | 21 | #endif /* __COMPAT_H__ */ 22 | -------------------------------------------------------------------------------- /software/cgminer/AUTHORS: -------------------------------------------------------------------------------- 1 | Current maintainers and active developers: 2 | Main code+ASIC+GPU+SCRYPT+maintainer: Con Kolivas 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ 3 | API+USB+FPGA+ASIC: Andrew Smith 1Jjk2LmktEQKnv8r2cZ9MvLiZwZ9gxabKm 4 | 5 | Legacy: 6 | Original CPU mining software: Jeff Garzik 7 | BitFORCE FPGA mining and refactor: Luke Dashjr 1NbRmS6a4dniwHHoSS9v3tEYUpP1Z5VVdL 8 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | EXTRA_DIST = CHANGES LICENSE README.rst 4 | SUBDIRS = src 5 | 6 | # "make distcheck" builds the dvi target, so use it to check that the 7 | # documentation is built correctly. 8 | dvi: 9 | $(MAKE) SPHINXOPTS_EXTRA=-W html 10 | 11 | pkgconfigdir = $(libdir)/pkgconfig 12 | pkgconfig_DATA = jansson.pc 13 | 14 | if GCC 15 | # These flags are gcc specific 16 | export AM_CFLAGS = -Wall -Wextra -Wdeclaration-after-statement 17 | endif 18 | -------------------------------------------------------------------------------- /software/cgminer/lib/memchr.valgrind: -------------------------------------------------------------------------------- 1 | # Suppress a valgrind message about use of uninitialized memory in memchr(). 2 | # POSIX states that when the character is found, memchr must not read extra 3 | # bytes in an overestimated length (for example, where memchr is used to 4 | # implement strnlen). However, we use a safe word read to provide a speedup. 5 | { 6 | memchr-value4 7 | Memcheck:Value4 8 | fun:rpl_memchr 9 | } 10 | { 11 | memchr-value8 12 | Memcheck:Value8 13 | fun:rpl_memchr 14 | } 15 | -------------------------------------------------------------------------------- /software/cgminer/example.conf: -------------------------------------------------------------------------------- 1 | { 2 | "pools" : [ 3 | { 4 | "url" : "http://url1:8332", 5 | "user" : "user1", 6 | "pass" : "pass1" 7 | }, 8 | { 9 | "url" : "http://url2:8344", 10 | "user" : "user2", 11 | "pass" : "pass2" 12 | }, 13 | { 14 | "url" : "http://url3:8332", 15 | "user" : "user3", 16 | "pass" : "pass3" 17 | } 18 | ], 19 | 20 | "failover-only" : true, 21 | "no-submit-stale" : true, 22 | "api-listen" : true, 23 | "api-port" : "4028", 24 | "api-allow" : "W:192.168.1.0/24,W:127.0.0.1" 25 | } 26 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = jansson.def 2 | 3 | include_HEADERS = jansson.h jansson_config.h 4 | 5 | lib_LTLIBRARIES = libjansson.la 6 | libjansson_la_SOURCES = \ 7 | dump.c \ 8 | error.c \ 9 | hashtable.c \ 10 | hashtable.h \ 11 | jansson_private.h \ 12 | load.c \ 13 | memory.c \ 14 | pack_unpack.c \ 15 | strbuffer.c \ 16 | strbuffer.h \ 17 | strconv.c \ 18 | utf.c \ 19 | utf.h \ 20 | value.c 21 | libjansson_la_LDFLAGS = \ 22 | -no-undefined \ 23 | -export-symbols-regex '^json_' \ 24 | -version-info 9:0:5 25 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb/version.h: -------------------------------------------------------------------------------- 1 | /* This file is parsed by m4 and windres and RC.EXE so please keep it simple. */ 2 | #ifndef LIBUSB_MAJOR 3 | #define LIBUSB_MAJOR 1 4 | #endif 5 | #ifndef LIBUSB_MINOR 6 | #define LIBUSB_MINOR 0 7 | #endif 8 | #ifndef LIBUSB_MICRO 9 | #define LIBUSB_MICRO 16 10 | #endif 11 | /* LIBUSB_NANO may be used for Windows internal versioning. 0 means unused. */ 12 | #ifndef LIBUSB_NANO 13 | #define LIBUSB_NANO 0 14 | #endif 15 | /* LIBUSB_RC is the release candidate suffix. Should normally be empty. */ 16 | #ifndef LIBUSB_RC 17 | #define LIBUSB_RC "-rc10" 18 | #endif 19 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/MDK-ARM/STM3210B-EVAL/STM3210B-EVAL.sct: -------------------------------------------------------------------------------- 1 | ; ************************************************************* 2 | ; *** Scatter-Loading Description File generated by uVision *** 3 | ; ************************************************************* 4 | 5 | LR_IROM1 0x08000000 0x00040000 { ; load region size_region 6 | ER_IROM1 0x08000000 0x00040000 { ; load address = execution address 7 | *.o (RESET, +First) 8 | *(InRoot$$Sections) 9 | .ANY (+RO) 10 | } 11 | RW_IRAM1 0x20000000 0x0000C000 { ; RW data 12 | .ANY (+RW +ZI) 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /software/cgminer/ccan/opt/private.h: -------------------------------------------------------------------------------- 1 | #ifndef CCAN_OPT_PRIVATE_H 2 | #define CCAN_OPT_PRIVATE_H 3 | 4 | extern struct opt_table *opt_table; 5 | extern unsigned int opt_count, opt_num_short, opt_num_short_arg, opt_num_long; 6 | 7 | extern const char *opt_argv0; 8 | 9 | #define subtable_of(entry) ((struct opt_table *)((entry)->names)) 10 | 11 | const char *first_sopt(unsigned *i); 12 | const char *next_sopt(const char *names, unsigned *i); 13 | const char *first_lopt(unsigned *i, unsigned *len); 14 | const char *next_lopt(const char *p, unsigned *i, unsigned *len); 15 | 16 | int parse_one(int *argc, char *argv[], unsigned *offset, 17 | void (*errlog)(const char *fmt, ...)); 18 | 19 | #endif /* CCAN_OPT_PRIVATE_H */ 20 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip 2 | ACLOCAL_AMFLAGS = -I m4 3 | DISTCLEANFILES = libusb-1.0.pc 4 | MAINTAINERCLEANFILES = ChangeLog 5 | EXTRA_DIST = TODO PORTING 6 | SUBDIRS = libusb 7 | 8 | pkgconfigdir=$(libdir)/pkgconfig 9 | pkgconfig_DATA=libusb-1.0.pc 10 | 11 | .PHONY: ChangeLog dist-up 12 | ChangeLog: 13 | git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog 14 | 15 | dist-hook: ChangeLog 16 | 17 | reldir = .release/$(distdir) 18 | dist-up: dist 19 | rm -rf $(reldir) 20 | mkdir -p $(reldir) 21 | cp $(distdir).tar.bz2 $(reldir) 22 | rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/ 23 | rm -rf $(reldir) 24 | 25 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/MDK-ARM/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ShowInfoWin = 1 3 | EnableFlashBP = 2 4 | BPDuringExecution = 0 5 | [CFI] 6 | CFISize = 0x00 7 | CFIAddr = 0x00 8 | [CPU] 9 | OverrideMemMap = 0 10 | AllowSimulation = 1 11 | ScriptFile="" 12 | [FLASH] 13 | MinNumBytesFlashDL = 0 14 | SkipProgOnCRCMatch = 1 15 | VerifyDownload = 1 16 | AllowCaching = 1 17 | EnableFlashDL = 2 18 | Override = 0 19 | Device="UNSPECIFIED" 20 | [GENERAL] 21 | WorkRAMSize = 0x00 22 | WorkRAMAddr = 0x00 23 | [SWO] 24 | SWOLogFile="" 25 | [MEM] 26 | RdOverrideOrMask = 0x00 27 | RdOverrideAndMask = 0xFFFFFFFF 28 | RdOverrideAddr = 0xFFFFFFFF 29 | WrOverrideOrMask = 0x00 30 | WrOverrideAndMask = 0xFFFFFFFF 31 | WrOverrideAddr = 0xFFFFFFFF 32 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/README: -------------------------------------------------------------------------------- 1 | libusb 2 | ====== 3 | 4 | libusb is a library for USB device access from Linux, Mac OS X, 5 | OpenBSD, NetBSD, and Windows userspace. 6 | It is written in C and licensed under the LGPL-2.1 (see COPYING). 7 | 8 | libusb is abstracted internally in such a way that it can hopefully 9 | be ported to other operating systems. See the PORTING file for some 10 | information, if you fancy a challenge. :) 11 | 12 | libusb homepage: 13 | http://libusb.org/ 14 | 15 | Developers will wish to consult the API documentation: 16 | http://libusb.sourceforge.net/api-1.0/ 17 | 18 | Use the mailing list for questions, comments, etc: 19 | http://libusb.org/wiki/MailingList 20 | 21 | - Peter Stuge 22 | (use the mailing list rather than mailing developers directly) 23 | -------------------------------------------------------------------------------- /software/cgminer/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /software/cpuminer/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | if WANT_JANSSON 3 | JANSSON_INCLUDES= -I$(top_srcdir)/compat/jansson 4 | else 5 | JANSSON_INCLUDES= 6 | endif 7 | 8 | EXTRA_DIST = example-cfg.json nomacro.pl 9 | 10 | SUBDIRS = compat 11 | 12 | INCLUDES = $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES) 13 | 14 | bin_PROGRAMS = minerd 15 | 16 | dist_man_MANS = minerd.1 17 | 18 | minerd_SOURCES = elist.h miner.h compat.h \ 19 | cpu-miner.c util.c \ 20 | gc3355.h \ 21 | sha2.c scrypt.c 22 | if ARCH_x86 23 | minerd_SOURCES += sha2-x86.S scrypt-x86.S 24 | endif 25 | if ARCH_x86_64 26 | minerd_SOURCES += sha2-x64.S scrypt-x64.S 27 | endif 28 | if ARCH_ARM 29 | minerd_SOURCES += sha2-arm.S scrypt-arm.S 30 | endif 31 | minerd_LDFLAGS = $(PTHREAD_FLAGS) 32 | minerd_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@ 33 | minerd_CPPFLAGS = @LIBCURL_CPPFLAGS@ 34 | 35 | -------------------------------------------------------------------------------- /software/cpuminer/compat/jansson/utf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2010 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef UTF_H 9 | #define UTF_H 10 | 11 | #include 12 | 13 | #ifdef HAVE_INTTYPES_H 14 | /* inttypes.h includes stdint.h in a standard environment, so there's 15 | no need to include stdint.h separately. If inttypes.h doesn't define 16 | int32_t, it's defined in config.h. */ 17 | #include 18 | #endif 19 | 20 | int utf8_encode(int codepoint, char *buffer, int *size); 21 | 22 | int utf8_check_first(char byte); 23 | int utf8_check_full(const char *buffer, int size, int32_t *codepoint); 24 | const char *utf8_iterate(const char *buffer, int32_t *codepoint); 25 | 26 | int utf8_check_string(const char *string, int length); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /software/cgminer/m4/wchar_t.m4: -------------------------------------------------------------------------------- 1 | # wchar_t.m4 serial 4 (gettext-0.18.2) 2 | dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Bruno Haible. 8 | dnl Test whether has the 'wchar_t' type. 9 | dnl Prerequisite: AC_PROG_CC 10 | 11 | AC_DEFUN([gt_TYPE_WCHAR_T], 12 | [ 13 | AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], 14 | [AC_COMPILE_IFELSE( 15 | [AC_LANG_PROGRAM( 16 | [[#include 17 | wchar_t foo = (wchar_t)'\0';]], 18 | [[]])], 19 | [gt_cv_c_wchar_t=yes], 20 | [gt_cv_c_wchar_t=no])]) 21 | if test $gt_cv_c_wchar_t = yes; then 22 | AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) 23 | fi 24 | ]) 25 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEBUH_H_ 2 | #define __DEBUG_H_ 3 | /* debug.h 4 | 2014/1/15 5 | */ 6 | #include 7 | 8 | #if defined(USB_DEBUG_PRINT) 9 | extern char USB_PRINTF_BUF[256]; 10 | extern int USB_PRINTF_BUF_LENGHT; 11 | #define PR_DEBUG(fmt,...) \ 12 | USB_PRINTF_BUF_LENGHT = sprintf(USB_PRINTF_BUF,fmt, ##__VA_ARGS__); \ 13 | UserToPMABufferCopy((unsigned char*)USB_PRINTF_BUF, ENDP1_TXADDR, USB_PRINTF_BUF_LENGHT); \ 14 | SetEPTxCount(ENDP1, USB_PRINTF_BUF_LENGHT); \ 15 | SetEPTxValid(ENDP1) 16 | 17 | #elif defined(ITM_DEBUG_PRINT) 18 | #define PR_DEBUG(fmt,...) \ 19 | printf(fmt,##__VA_ARGS__) 20 | 21 | #elif defined(UART1_DEBUG_PRINT) 22 | #define PR_DEBUG(fmt,...) \ 23 | printf(fmt,##__VA_ARGS__) 24 | #define PR_BUFFER(buf,len) \ 25 | USB_To_USART_Send_Data(buf,len) 26 | 27 | #else 28 | #define PR_DEBUG(fmt,...) 29 | #endif 30 | 31 | #endif /*__DEBUG_H_*/ 32 | -------------------------------------------------------------------------------- /software/cgminer/driver-gridseed.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_DRIVER_GRIDSEED_H 2 | #define INCLUDE_DRIVER_GRIDSEED_H 3 | 4 | #ifdef USE_GRIDSEED 5 | 6 | #include "util.h" 7 | 8 | #define GRIDSEED_MINER_THREADS 1 9 | #define GRIDSEED_LATENCY 4 10 | 11 | #define GRIDSEED_DEFAULT_BAUD 115200 12 | #define GRIDSEED_DEFAULT_FREQUENCY "600" 13 | #define GRIDSEED_DEFAULT_CHIPS 5 14 | #define GRIDSEED_DEFAULT_MODULES 1 15 | #define GRIDSEED_DEFAULT_USEFIFO 0 16 | #define GRIDSEED_DEFAULT_BTCORE 16 17 | 18 | #define GRIDSEED_COMMAND_DELAY 20 19 | #define GRIDSEED_READ_SIZE 12 20 | #define GRIDSEED_MCU_QUEUE_LEN 8 21 | #define GRIDSEED_SOFT_QUEUE_LEN (GRIDSEED_MCU_QUEUE_LEN+2) 22 | #define GRIDSEED_READBUF_SIZE 8192 23 | 24 | #define GRIDSEED_PROXY_PORT 3350 25 | 26 | #define transfer(gridseed, request_type, bRequest, wValue, wIndex, cmd) \ 27 | _transfer(gridseed, request_type, bRequest, wValue, wIndex, NULL, 0, cmd) 28 | 29 | #endif 30 | 31 | #endif /* INCLUDE_DRIVER_GRIDSEED_H */ 32 | -------------------------------------------------------------------------------- /software/cpuminer/compat/jansson/strbuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2010 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef STRBUFFER_H 9 | #define STRBUFFER_H 10 | 11 | typedef struct { 12 | char *value; 13 | int length; /* bytes used */ 14 | int size; /* bytes allocated */ 15 | } strbuffer_t; 16 | 17 | int strbuffer_init(strbuffer_t *strbuff); 18 | void strbuffer_close(strbuffer_t *strbuff); 19 | 20 | void strbuffer_clear(strbuffer_t *strbuff); 21 | 22 | const char *strbuffer_value(const strbuffer_t *strbuff); 23 | char *strbuffer_steal_value(strbuffer_t *strbuff); 24 | 25 | int strbuffer_append(strbuffer_t *strbuff, const char *string); 26 | int strbuffer_append_byte(strbuffer_t *strbuff, char byte); 27 | int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, int size); 28 | 29 | char strbuffer_pop(strbuffer_t *strbuff); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/strbuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef STRBUFFER_H 9 | #define STRBUFFER_H 10 | 11 | typedef struct { 12 | char *value; 13 | size_t length; /* bytes used */ 14 | size_t size; /* bytes allocated */ 15 | } strbuffer_t; 16 | 17 | int strbuffer_init(strbuffer_t *strbuff); 18 | void strbuffer_close(strbuffer_t *strbuff); 19 | 20 | void strbuffer_clear(strbuffer_t *strbuff); 21 | 22 | const char *strbuffer_value(const strbuffer_t *strbuff); 23 | 24 | /* Steal the value and close the strbuffer */ 25 | char *strbuffer_steal_value(strbuffer_t *strbuff); 26 | 27 | int strbuffer_append(strbuffer_t *strbuff, const char *string); 28 | int strbuffer_append_byte(strbuffer_t *strbuff, char byte); 29 | int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size); 30 | 31 | char strbuffer_pop(strbuffer_t *strbuff); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /software/cgminer/bitstreams/COPYING_fpgaminer: -------------------------------------------------------------------------------- 1 | All the bitstream files included in this directory that follow the name pattern fpgaminer_*.ncd are: 2 | 3 | ---- 4 | 5 | Copyright (c) 2011-2012 fpgaminer@bitcoin-mining.com 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | 20 | ---- 21 | 22 | You can find the original sources at the Open Source FPGA Bitcoin Miner project GitHub repository: 23 | https://github.com/progranism/Open-Source-FPGA-Bitcoin-Miner/tree/master/projects/X6000_ztex_comm4/hdl 24 | -------------------------------------------------------------------------------- /software/cpuminer/compat/jansson/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, 2010 Petri Lehtinen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2013 Petri Lehtinen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/utf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef UTF_H 9 | #define UTF_H 10 | 11 | #ifdef HAVE_CONFIG_H 12 | #include 13 | 14 | #ifdef HAVE_INTTYPES_H 15 | /* inttypes.h includes stdint.h in a standard environment, so there's 16 | no need to include stdint.h separately. If inttypes.h doesn't define 17 | int32_t, it's defined in config.h. */ 18 | #include 19 | #endif /* HAVE_INTTYPES_H */ 20 | 21 | #else /* !HAVE_CONFIG_H */ 22 | #ifdef _WIN32 23 | typedef int int32_t; 24 | #else /* !_WIN32 */ 25 | /* Assume a standard environment */ 26 | #include 27 | #endif /* _WIN32 */ 28 | 29 | #endif /* HAVE_CONFIG_H */ 30 | 31 | int utf8_encode(int codepoint, char *buffer, int *size); 32 | 33 | int utf8_check_first(char byte); 34 | int utf8_check_full(const char *buffer, int size, int32_t *codepoint); 35 | const char *utf8_iterate(const char *buffer, int32_t *codepoint); 36 | 37 | int utf8_check_string(const char *string, int length); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/AUTHORS: -------------------------------------------------------------------------------- 1 | Copyright (C) 2007-2009 Daniel Drake 2 | Copyright (c) 2001 Johannes Erdfelt 3 | Copyright (C) 2008-2013 Nathan Hjelm 4 | Copyright (C) 2009-2012 Pete Batard 5 | Copyright (C) 2010 Michael Plante 6 | Copyright (C) 2010-2012 Peter Stuge 7 | Copyright (C) 2011-2012 Hans de Goede 8 | Copyright (C) 2012 Martin Pieuchot 9 | 10 | Other contributors: 11 | Alan Ott 12 | Alan Stern 13 | Alex Vatchenko 14 | Artem Egorkine 15 | Aurelien Jarno 16 | Bastien Nocera 17 | Brian Shirley 18 | David Engraf 19 | David Moore 20 | Felipe Balbi 21 | Graeme Gill 22 | Hans de Goede 23 | Hans Ulrich Niedermann 24 | Hector Martin 25 | Hoi-Ho Chan 26 | James Hanko 27 | Konrad Rzepecki 28 | Ludovic Rousseau 29 | Martin Koegler 30 | Martin Pieuchot 31 | Maya Erez 32 | Mike Frysinger 33 | Mikhail Gusarov 34 | Orin Eman 35 | Pekka Nikander 36 | Peter Stuge 37 | Rob Walker 38 | Sean McBride 39 | Sebastian Pipping 40 | Stephan Meyer 41 | Thomas Röfer 42 | Toby Peterson 43 | Trygve Laugstøl 44 | Vasily Khoruzhick 45 | Vitali Lovich 46 | Xiaofan Chen 47 | -------------------------------------------------------------------------------- /software/cgminer/driver-bitfury.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Con Kolivas 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation; either version 3 of the License, or (at your option) 7 | * any later version. See COPYING for more details. 8 | */ 9 | 10 | #ifndef BITFURY_H 11 | #define BITFURY_H 12 | 13 | #include "miner.h" 14 | #include "usbutils.h" 15 | 16 | struct bitfury_info { 17 | struct cgpu_info *base_cgpu; 18 | struct thr_info *thr; 19 | enum sub_ident ident; 20 | int nonces; 21 | int total_nonces; 22 | double saved_nonces; 23 | int cycles; 24 | bool valid; /* Set on first valid data being found */ 25 | 26 | /* BF1 specific data */ 27 | uint8_t version; 28 | char product[8]; 29 | uint32_t serial; 30 | struct timeval tv_start; 31 | 32 | /* BXF specific data */ 33 | pthread_mutex_t lock; 34 | pthread_t read_thr; 35 | double temperature; 36 | int work_id; // Current work->subid 37 | int no_matching_work; 38 | int maxroll; // Last maxroll sent to device 39 | int ver_major; 40 | int ver_minor; 41 | int hw_rev; 42 | int chips; 43 | }; 44 | 45 | #endif /* BITFURY_H */ 46 | -------------------------------------------------------------------------------- /software/cpuminer/nomacro.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Copyright 2012 pooler@litecoinpool.org 3 | # 4 | # This program is free software; you can redistribute it and/or modify it 5 | # under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation; either version 2 of the License, or (at your option) 7 | # any later version. See COPYING for more details. 8 | # 9 | # nomacro.pl - convert assembler macros to C preprocessor macros. 10 | 11 | use strict; 12 | 13 | foreach my $f (<*.S>) { 14 | rename $f, "$f.orig"; 15 | open FIN, "$f.orig"; 16 | open FOUT, ">$f"; 17 | my $inmacro = 0; 18 | my %macros = (); 19 | while () { 20 | if (m/^\.macro\s+([_0-9A-Z]+)(?:\s*)(.*)$/i) { 21 | print FOUT "#define $1($2) \\\n"; 22 | $macros{$1} = 1; 23 | $inmacro = 1; 24 | next; 25 | } 26 | if (m/^\.endm/) { 27 | print FOUT "\n"; 28 | $inmacro = 0; 29 | next; 30 | } 31 | for my $m (keys %macros) { 32 | s/^([ \t]*)($m)(?:[ \t]+([^#\n]*))?([;\n])/\1\2(\3)\4/; 33 | } 34 | if ($inmacro) { 35 | if (m/^\s*#if/) { 36 | $_ = while (!m/^\s*#endif/); 37 | next; 38 | } 39 | next if (m/^\s*$/); 40 | s/\\//g; 41 | s/$/; \\/; 42 | } 43 | print FOUT; 44 | } 45 | close FOUT; 46 | close FIN; 47 | } 48 | -------------------------------------------------------------------------------- /software/cgminer/arg-nonnull.h: -------------------------------------------------------------------------------- 1 | /* A C macro for declaring that specific arguments must not be NULL. 2 | Copyright (C) 2009-2011 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify it 5 | under the terms of the GNU General Public License as published 6 | by the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 18 | that the values passed as arguments n, ..., m must be non-NULL pointers. 19 | n = 1 stands for the first argument, n = 2 for the second argument etc. */ 20 | #ifndef _GL_ARG_NONNULL 21 | # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 22 | # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 23 | # else 24 | # define _GL_ARG_NONNULL(params) 25 | # endif 26 | #endif 27 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/memory.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * Copyright (c) 2011-2012 Basile Starynkevitch 4 | * 5 | * Jansson is free software; you can redistribute it and/or modify it 6 | * under the terms of the MIT license. See LICENSE for details. 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | #include "jansson.h" 13 | #include "jansson_private.h" 14 | 15 | /* memory function pointers */ 16 | static json_malloc_t do_malloc = malloc; 17 | static json_free_t do_free = free; 18 | 19 | void *jsonp_malloc(size_t size) 20 | { 21 | if(!size) 22 | return NULL; 23 | 24 | return (*do_malloc)(size); 25 | } 26 | 27 | void jsonp_free(void *ptr) 28 | { 29 | if(!ptr) 30 | return; 31 | 32 | (*do_free)(ptr); 33 | } 34 | 35 | char *jsonp_strdup(const char *str) 36 | { 37 | char *new_str; 38 | size_t len; 39 | 40 | len = strlen(str); 41 | if(len == (size_t)-1) 42 | return NULL; 43 | 44 | new_str = jsonp_malloc(len + 1); 45 | if(!new_str) 46 | return NULL; 47 | 48 | memcpy(new_str, str, len + 1); 49 | return new_str; 50 | } 51 | 52 | void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn) 53 | { 54 | do_malloc = malloc_fn; 55 | do_free = free_fn; 56 | } 57 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/trans_buffers.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRANS_BUFFERS_H_ 2 | #define __TRANS_BUFFERS_H_ 3 | 4 | #define UART_TRANS_BUFFER_SIZE 64 5 | #define USB_TRANS_BUFFER_SIZE 2048 6 | 7 | struct TRANS_BUFFER { 8 | uint8_t * buffer; 9 | uint32_t size; 10 | uint32_t in; 11 | uint32_t out; 12 | }; 13 | 14 | void init_trans_buffer(struct TRANS_BUFFER * tb, uint8_t * buffer, uint32_t size); 15 | void reset_trans_buffer(struct TRANS_BUFFER *tb); 16 | int put_trans_buffer(struct TRANS_BUFFER *tb, uint8_t * buffer, uint32_t length); 17 | int get_trans_buffer(struct TRANS_BUFFER *tb, uint8_t * buffer, uint32_t max_length); 18 | int get_trans_buffer_cmd(struct TRANS_BUFFER *tb, uint8_t * buffer); 19 | void flush_trans_buffer(struct TRANS_BUFFER *tb); 20 | int trans_buffer_out_length(struct TRANS_BUFFER *tb); 21 | void copy_buffer(u8 * dst, u8 * src, u32 length); 22 | void trans_buf_to_usb(u8 *buf, u32 length); 23 | void trans_buf_to_uart(USART_TypeDef* USARTx,u8 *buf, u32 length); 24 | u8 get_next_n_out(struct TRANS_BUFFER *tb, int n); 25 | int trans_buffer_has_cmd(struct TRANS_BUFFER *tb); 26 | void USART_to_trans_buffer(USART_TypeDef* USARTx, struct TRANS_BUFFER *tb); 27 | 28 | extern struct TRANS_BUFFER usb_trans_buffer; 29 | extern struct TRANS_BUFFER uart_trans_buffer[COMn]; 30 | 31 | #endif /*__TRANS_BUFFERS_H_*/ 32 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/jansson_config.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | * 7 | * 8 | * This file specifies a part of the site-specific configuration for 9 | * Jansson, namely those things that affect the public API in 10 | * jansson.h. 11 | * 12 | * The configure script copies this file to jansson_config.h and 13 | * replaces @var@ substitutions by values that fit your system. If you 14 | * cannot run the configure script, you can do the value substitution 15 | * by hand. 16 | */ 17 | 18 | #ifndef JANSSON_CONFIG_H 19 | #define JANSSON_CONFIG_H 20 | 21 | /* If your compiler supports the inline keyword in C, JSON_INLINE is 22 | defined to `inline', otherwise empty. In C++, the inline is always 23 | supported. */ 24 | #ifdef __cplusplus 25 | #define JSON_INLINE inline 26 | #else 27 | #define JSON_INLINE @json_inline@ 28 | #endif 29 | 30 | /* If your compiler supports the `long long` type and the strtoll() 31 | library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, 32 | otherwise to 0. */ 33 | #define JSON_INTEGER_IS_LONG_LONG @json_have_long_long@ 34 | 35 | /* If locale.h and localeconv() are available, define to 1, 36 | otherwise to 0. */ 37 | #define JSON_HAVE_LOCALECONV @json_have_localeconv@ 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /software/cgminer/m4/sigaction.m4: -------------------------------------------------------------------------------- 1 | # sigaction.m4 serial 6 2 | dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # Determine if sigaction interface is present. 8 | AC_DEFUN([gl_SIGACTION], 9 | [ 10 | AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) 11 | AC_CHECK_FUNCS_ONCE([sigaction]) 12 | if test $ac_cv_func_sigaction = yes; then 13 | AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , , 14 | [[#include ]]) 15 | if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then 16 | HAVE_STRUCT_SIGACTION_SA_SIGACTION=0 17 | fi 18 | else 19 | HAVE_SIGACTION=0 20 | fi 21 | ]) 22 | 23 | # Prerequisites of the part of lib/signal.in.h and of lib/sigaction.c. 24 | AC_DEFUN([gl_PREREQ_SIGACTION], 25 | [ 26 | AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) 27 | AC_REQUIRE([AC_C_RESTRICT]) 28 | AC_REQUIRE([AC_TYPE_UID_T]) 29 | AC_REQUIRE([gl_PREREQ_SIG_HANDLER_H]) 30 | AC_CHECK_FUNCS_ONCE([sigaltstack siginterrupt]) 31 | AC_CHECK_TYPES([siginfo_t], [], [], [[ 32 | #include 33 | ]]) 34 | if test $ac_cv_type_siginfo_t = no; then 35 | HAVE_SIGINFO_T=0 36 | fi 37 | ]) 38 | 39 | # Prerequisites of lib/sig-handler.h. 40 | AC_DEFUN([gl_PREREQ_SIG_HANDLER_H], 41 | [ 42 | AC_REQUIRE([AC_C_INLINE]) 43 | ]) 44 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/CMSIS/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 11. November 2010 5 | * $Revision: V1.0.2 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Version 1.0.2 2010/11/11 15 | * Documentation updated. 16 | * 17 | * Version 1.0.1 2010/10/05 18 | * Production release and review comments incorporated. 19 | * 20 | * Version 1.0.0 2010/09/20 21 | * Production release and review comments incorporated. 22 | * -------------------------------------------------------------------- */ 23 | 24 | #ifndef _ARM_COMMON_TABLES_H 25 | #define _ARM_COMMON_TABLES_H 26 | 27 | #include "arm_math.h" 28 | 29 | extern const uint16_t armBitRevTable[1024]; 30 | extern const q15_t armRecipTableQ15[64]; 31 | extern const q31_t armRecipTableQ31[64]; 32 | extern const q31_t realCoefAQ31[1024]; 33 | extern const q31_t realCoefBQ31[1024]; 34 | extern const float32_t twiddleCoef[6144]; 35 | extern const q31_t twiddleCoefQ31[6144]; 36 | extern const q15_t twiddleCoefQ15[6144]; 37 | 38 | #endif /* ARM_COMMON_TABLES_H */ 39 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ([2.60]) 2 | AC_INIT([jansson], [2.5], [petri@digip.org]) 3 | 4 | AC_CONFIG_MACRO_DIR([m4]) 5 | 6 | AM_INIT_AUTOMAKE([1.10 foreign]) 7 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 8 | 9 | AC_CONFIG_SRCDIR([src/value.c]) 10 | AC_CONFIG_HEADERS([config.h]) 11 | 12 | # Checks for programs. 13 | AC_PROG_CC 14 | AC_PROG_LIBTOOL 15 | AM_CONDITIONAL([GCC], [test x$GCC = xyes]) 16 | 17 | # Checks for libraries. 18 | 19 | # Checks for header files. 20 | AC_CHECK_HEADERS([locale.h]) 21 | 22 | # Checks for typedefs, structures, and compiler characteristics. 23 | AC_TYPE_INT32_T 24 | AC_TYPE_LONG_LONG_INT 25 | 26 | AC_C_INLINE 27 | case $ac_cv_c_inline in 28 | yes) json_inline=inline;; 29 | no) json_inline=;; 30 | *) json_inline=$ac_cv_c_inline;; 31 | esac 32 | AC_SUBST([json_inline]) 33 | 34 | # Checks for library functions. 35 | AC_CHECK_FUNCS([strtoll localeconv]) 36 | 37 | case "$ac_cv_type_long_long_int$ac_cv_func_strtoll" in 38 | yesyes) json_have_long_long=1;; 39 | *) json_have_long_long=0;; 40 | esac 41 | AC_SUBST([json_have_long_long]) 42 | 43 | case "$ac_cv_header_locale_h$ac_cv_func_localeconv" in 44 | yesyes) json_have_localeconv=1;; 45 | *) json_have_localeconv=0;; 46 | esac 47 | AC_SUBST([json_have_localeconv]) 48 | 49 | AC_CONFIG_FILES([ 50 | jansson.pc 51 | Makefile 52 | src/Makefile 53 | src/jansson_config.h 54 | ]) 55 | AC_OUTPUT 56 | -------------------------------------------------------------------------------- /software/cgminer/m4/00gnulib.m4: -------------------------------------------------------------------------------- 1 | # 00gnulib.m4 serial 2 2 | dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl This file must be named something that sorts before all other 8 | dnl gnulib-provided .m4 files. It is needed until such time as we can 9 | dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics. 10 | 11 | # AC_DEFUN_ONCE([NAME], VALUE) 12 | # ---------------------------- 13 | # Define NAME to expand to VALUE on the first use (whether by direct 14 | # expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. 15 | # Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This 16 | # definition is slower than the version in Autoconf 2.64, because it 17 | # can only use interfaces that existed since 2.59; but it achieves the 18 | # same effect. Quoting is necessary to avoid confusing Automake. 19 | m4_version_prereq([2.63.263], [], 20 | [m4_define([AC][_DEFUN_ONCE], 21 | [AC][_DEFUN([$1], 22 | [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], 23 | [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl 24 | [AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) 25 | 26 | # gl_00GNULIB 27 | # ----------- 28 | # Witness macro that this file has been included. Needed to force 29 | # Automake to include this file prior to all other gnulib .m4 files. 30 | AC_DEFUN([gl_00GNULIB]) 31 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/jansson.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | json_delete 3 | json_true 4 | json_false 5 | json_null 6 | json_string 7 | json_string_nocheck 8 | json_string_value 9 | json_string_set 10 | json_string_set_nocheck 11 | json_integer 12 | json_integer_value 13 | json_integer_set 14 | json_real 15 | json_real_value 16 | json_real_set 17 | json_number_value 18 | json_array 19 | json_array_size 20 | json_array_get 21 | json_array_set_new 22 | json_array_append_new 23 | json_array_insert_new 24 | json_array_remove 25 | json_array_clear 26 | json_array_extend 27 | json_object 28 | json_object_size 29 | json_object_get 30 | json_object_set_new 31 | json_object_set_new_nocheck 32 | json_object_del 33 | json_object_clear 34 | json_object_update 35 | json_object_update_existing 36 | json_object_update_missing 37 | json_object_iter 38 | json_object_iter_at 39 | json_object_iter_next 40 | json_object_iter_key 41 | json_object_iter_value 42 | json_object_iter_set_new 43 | json_object_key_to_iter 44 | json_dumps 45 | json_dumpf 46 | json_dump_file 47 | json_dump_callback 48 | json_loads 49 | json_loadb 50 | json_loadf 51 | json_load_file 52 | json_load_callback 53 | json_equal 54 | json_copy 55 | json_deep_copy 56 | json_pack 57 | json_pack_ex 58 | json_vpack_ex 59 | json_unpack 60 | json_unpack_ex 61 | json_vunpack_ex 62 | json_set_alloc_funcs 63 | 64 | -------------------------------------------------------------------------------- /software/cgminer/m4/signalblocking.m4: -------------------------------------------------------------------------------- 1 | # signalblocking.m4 serial 11 2 | dnl Copyright (C) 2001-2002, 2006-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # Determine available signal blocking primitives. Three different APIs exist: 8 | # 1) POSIX: sigemptyset, sigaddset, sigprocmask 9 | # 2) SYSV: sighold, sigrelse 10 | # 3) BSD: sigblock, sigsetmask 11 | # For simplicity, here we check only for the POSIX signal blocking. 12 | AC_DEFUN([gl_SIGNALBLOCKING], 13 | [ 14 | AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) 15 | signals_not_posix= 16 | AC_EGREP_HEADER([sigset_t], [signal.h], , [signals_not_posix=1]) 17 | if test -z "$signals_not_posix"; then 18 | AC_CHECK_FUNC([sigprocmask], [gl_cv_func_sigprocmask=1]) 19 | fi 20 | if test -z "$gl_cv_func_sigprocmask"; then 21 | HAVE_POSIX_SIGNALBLOCKING=0 22 | fi 23 | ]) 24 | 25 | # Prerequisites of the part of lib/signal.in.h and of lib/sigprocmask.c. 26 | AC_DEFUN([gl_PREREQ_SIGPROCMASK], 27 | [ 28 | AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) 29 | AC_CHECK_TYPES([sigset_t], 30 | [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no], 31 | [#include 32 | /* Mingw defines sigset_t not in , but in . */ 33 | #include ]) 34 | if test $gl_cv_type_sigset_t != yes; then 35 | HAVE_SIGSET_T=0 36 | fi 37 | dnl HAVE_SIGSET_T is 1 if the system lacks the sigprocmask function but has 38 | dnl the sigset_t type. 39 | AC_SUBST([HAVE_SIGSET_T]) 40 | ]) 41 | -------------------------------------------------------------------------------- /software/cpuminer/compat/jansson/jansson_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2010 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef JANSSON_PRIVATE_H 9 | #define JANSSON_PRIVATE_H 10 | 11 | #include "jansson.h" 12 | #include "hashtable.h" 13 | 14 | #define container_of(ptr_, type_, member_) \ 15 | ((type_ *)((char *)ptr_ - (size_t)&((type_ *)0)->member_)) 16 | 17 | typedef struct { 18 | json_t json; 19 | hashtable_t hashtable; 20 | unsigned long serial; 21 | int visited; 22 | } json_object_t; 23 | 24 | typedef struct { 25 | json_t json; 26 | unsigned int size; 27 | unsigned int entries; 28 | json_t **table; 29 | int visited; 30 | } json_array_t; 31 | 32 | typedef struct { 33 | json_t json; 34 | char *value; 35 | } json_string_t; 36 | 37 | typedef struct { 38 | json_t json; 39 | double value; 40 | } json_real_t; 41 | 42 | typedef struct { 43 | json_t json; 44 | int value; 45 | } json_integer_t; 46 | 47 | #define json_to_object(json_) container_of(json_, json_object_t, json) 48 | #define json_to_array(json_) container_of(json_, json_array_t, json) 49 | #define json_to_string(json_) container_of(json_, json_string_t, json) 50 | #define json_to_real(json_) container_of(json_, json_real_t, json) 51 | #define json_to_integer(json_) container_of(json_, json_integer_t, json) 52 | 53 | typedef struct { 54 | unsigned long serial; 55 | char key[]; 56 | } object_key_t; 57 | 58 | const object_key_t *jsonp_object_iter_fullkey(void *iter); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libusb-1.0.la 2 | 3 | LINUX_USBFS_SRC = os/linux_usbfs.c 4 | DARWIN_USB_SRC = os/darwin_usb.c 5 | OPENBSD_USB_SRC = os/openbsd_usb.c 6 | WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc \ 7 | libusb-1.0.def 8 | 9 | EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \ 10 | $(WINDOWS_USB_SRC) os/threads_posix.c os/threads_windows.c \ 11 | os/linux_udev.c os/linux_netlink.c 12 | 13 | if OS_LINUX 14 | 15 | if USE_UDEV 16 | OS_SRC = $(LINUX_USBFS_SRC) os/linux_udev.c 17 | else 18 | OS_SRC = $(LINUX_USBFS_SRC) os/linux_netlink.c 19 | endif 20 | 21 | endif 22 | 23 | if OS_DARWIN 24 | OS_SRC = $(DARWIN_USB_SRC) 25 | AM_CFLAGS_EXT = -no-cpp-precomp 26 | endif 27 | 28 | if OS_OPENBSD 29 | OS_SRC = $(OPENBSD_USB_SRC) 30 | endif 31 | 32 | if OS_WINDOWS 33 | OS_SRC = $(WINDOWS_USB_SRC) 34 | 35 | .rc.lo: 36 | $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@ 37 | 38 | libusb-1.0.rc: version.h 39 | endif 40 | 41 | if THREADS_POSIX 42 | THREADS_SRC = os/threads_posix.h os/threads_posix.c 43 | else 44 | THREADS_SRC = os/threads_windows.h os/threads_windows.c 45 | endif 46 | 47 | libusb_1_0_la_CFLAGS = $(AM_CFLAGS) \ 48 | -DLIBUSB_DESCRIBE=\"`git --git-dir "$(top_srcdir)/.git" describe --tags 2>/dev/null`\" 49 | libusb_1_0_la_LDFLAGS = $(LTLDFLAGS) 50 | libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c sync.c $(OS_SRC) \ 51 | hotplug.h hotplug.c os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h \ 52 | $(THREADS_SRC) os/poll_posix.h os/poll_windows.h 53 | 54 | hdrdir = $(includedir)/libusb-1.0 55 | hdr_HEADERS = libusb.h 56 | -------------------------------------------------------------------------------- /software/cgminer/01-cgminer.rules: -------------------------------------------------------------------------------- 1 | # Butterfly Labs FPGA and ASIC devices 2 | ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 3 | 4 | # ModMinerQuad 5 | ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0003", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 6 | 7 | # Lancelot and Avalon 8 | ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 9 | 10 | # Icarus 11 | ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 12 | 13 | # AsicminerUSB 14 | ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 15 | 16 | # Cairnsmore1 17 | ATTRS{idVendor}=="067b", ATTRS{idProduct}=="0230", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 18 | 19 | # Cairnsmore1-2 20 | ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8350", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 21 | 22 | # Ztex 23 | ATTRS{idVendor}=="221a", ATTRS{idProduct}=="0100", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 24 | 25 | # BF1 26 | ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204b", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 27 | 28 | #Klondike 29 | ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f60a", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 30 | 31 | #HashFast 32 | ATTRS{idVendor}=="297c", ATTRS{idProduct}=="0001", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev", ENV{ID_MM_DEVICE_IGNORE}="1" 33 | 34 | # BXF 35 | ATTRS{idVendor}=="198c", ATTRS{idProduct}=="b1f1", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 36 | -------------------------------------------------------------------------------- /software/cgminer/m4/stddef_h.m4: -------------------------------------------------------------------------------- 1 | dnl A placeholder for POSIX 2008 , for platforms that have issues. 2 | # stddef_h.m4 serial 4 3 | dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | AC_DEFUN([gl_STDDEF_H], 9 | [ 10 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) 11 | AC_REQUIRE([gt_TYPE_WCHAR_T]) 12 | STDDEF_H= 13 | if test $gt_cv_c_wchar_t = no; then 14 | HAVE_WCHAR_T=0 15 | STDDEF_H=stddef.h 16 | fi 17 | AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], 18 | [gl_cv_decl_null_works], 19 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include 20 | int test[2 * (sizeof NULL == sizeof (void *)) -1]; 21 | ]])], 22 | [gl_cv_decl_null_works=yes], 23 | [gl_cv_decl_null_works=no])]) 24 | if test $gl_cv_decl_null_works = no; then 25 | REPLACE_NULL=1 26 | STDDEF_H=stddef.h 27 | fi 28 | AC_SUBST([STDDEF_H]) 29 | AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) 30 | if test -n "$STDDEF_H"; then 31 | gl_NEXT_HEADERS([stddef.h]) 32 | fi 33 | ]) 34 | 35 | AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], 36 | [ 37 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 38 | AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) 39 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) 40 | ]) 41 | 42 | AC_DEFUN([gl_STDDEF_H_DEFAULTS], 43 | [ 44 | dnl Assume proper GNU behavior unless another module says otherwise. 45 | REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) 46 | HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) 47 | ]) 48 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/README.rst: -------------------------------------------------------------------------------- 1 | Jansson README 2 | ============== 3 | 4 | .. image:: https://travis-ci.org/akheron/jansson.png 5 | :alt: Build status 6 | :target: https://travis-ci.org/akheron/jansson 7 | 8 | Jansson_ is a C library for encoding, decoding and manipulating JSON 9 | data. Its main features and design principles are: 10 | 11 | - Simple and intuitive API and data model 12 | 13 | - Comprehensive documentation 14 | 15 | - No dependencies on other libraries 16 | 17 | - Full Unicode support (UTF-8) 18 | 19 | - Extensive test suite 20 | 21 | Jansson is licensed under the `MIT license`_; see LICENSE in the 22 | source distribution for details. 23 | 24 | 25 | Compilation and Installation 26 | ---------------------------- 27 | 28 | If you obtained a source tarball, just use the standard autotools 29 | commands:: 30 | 31 | $ ./configure 32 | $ make 33 | $ make install 34 | 35 | To run the test suite, invoke:: 36 | 37 | $ make check 38 | 39 | If the source has been checked out from a Git repository, the 40 | ./configure script has to be generated first. The easiest way is to 41 | use autoreconf:: 42 | 43 | $ autoreconf -i 44 | 45 | 46 | Documentation 47 | ------------- 48 | 49 | Prebuilt HTML documentation is available at 50 | http://www.digip.org/jansson/doc/. 51 | 52 | The documentation source is in the ``doc/`` subdirectory. To generate 53 | HTML documentation, invoke:: 54 | 55 | $ make html 56 | 57 | Then, point your browser to ``doc/_build/html/index.html``. Sphinx_ 58 | 1.0 or newer is required to generate the documentation. 59 | 60 | 61 | .. _Jansson: http://www.digip.org/jansson/ 62 | .. _`MIT license`: http://www.opensource.org/licenses/mit-license.php 63 | .. _Sphinx: http://sphinx.pocoo.org/ 64 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/error.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "jansson_private.h" 3 | 4 | void jsonp_error_init(json_error_t *error, const char *source) 5 | { 6 | if(error) 7 | { 8 | error->text[0] = '\0'; 9 | error->line = -1; 10 | error->column = -1; 11 | error->position = 0; 12 | if(source) 13 | jsonp_error_set_source(error, source); 14 | else 15 | error->source[0] = '\0'; 16 | } 17 | } 18 | 19 | void jsonp_error_set_source(json_error_t *error, const char *source) 20 | { 21 | size_t length; 22 | 23 | if(!error || !source) 24 | return; 25 | 26 | length = strlen(source); 27 | if(length < JSON_ERROR_SOURCE_LENGTH) 28 | strcpy(error->source, source); 29 | else { 30 | size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4; 31 | strcpy(error->source, "..."); 32 | strcpy(error->source + 3, source + extra); 33 | } 34 | } 35 | 36 | void jsonp_error_set(json_error_t *error, int line, int column, 37 | size_t position, const char *msg, ...) 38 | { 39 | va_list ap; 40 | 41 | va_start(ap, msg); 42 | jsonp_error_vset(error, line, column, position, msg, ap); 43 | va_end(ap); 44 | } 45 | 46 | void jsonp_error_vset(json_error_t *error, int line, int column, 47 | size_t position, const char *msg, va_list ap) 48 | { 49 | if(!error) 50 | return; 51 | 52 | if(error->text[0] != '\0') { 53 | /* error already set */ 54 | return; 55 | } 56 | 57 | error->line = line; 58 | error->column = column; 59 | error->position = position; 60 | 61 | vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap); 62 | error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; 63 | } 64 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb/os/threads_posix.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libusb synchronization using POSIX Threads 3 | * 4 | * Copyright (C) 2011 Vitali Lovich 5 | * Copyright (C) 2011 Peter Stuge 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifdef _XOPEN_SOURCE 23 | # if _XOPEN_SOURCE < 500 24 | # undef _XOPEN_SOURCE 25 | # define _XOPEN_SOURCE 500 26 | # endif 27 | #else 28 | #define _XOPEN_SOURCE 500 29 | #endif /* _XOPEN_SOURCE */ 30 | 31 | #include "threads_posix.h" 32 | 33 | int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr) 34 | { 35 | int err; 36 | pthread_mutexattr_t stack_attr; 37 | if (!attr) { 38 | attr = &stack_attr; 39 | err = pthread_mutexattr_init(&stack_attr); 40 | if (err != 0) 41 | return err; 42 | } 43 | 44 | err = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE); 45 | if (err != 0) 46 | goto finish; 47 | 48 | err = pthread_mutex_init(mutex, attr); 49 | 50 | finish: 51 | if (attr == &stack_attr) 52 | pthread_mutexattr_destroy(&stack_attr); 53 | 54 | return err; 55 | } 56 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/NEWS: -------------------------------------------------------------------------------- 1 | This file lists notable changes in each release. For the full history of all 2 | changes, see ChangeLog. 3 | 4 | 2012-04-20: 1.0.9 5 | * Numerous bug fixes and improvements 6 | * Backend for Windows, for devices using the WinUSB.sys driver 7 | * Backend for OpenBSD and NetBSD, for devices using the ugen driver 8 | * Add libusb_get_device_speed() 9 | * Add libusb_has_capability() 10 | * Add libusb_error_name() 11 | * Add libusb_get_version() 12 | 13 | 2010-05-07: v1.0.8 14 | * Bug fixes 15 | 16 | 2010-04-19: v1.0.7 17 | * Bug fixes and documentation tweaks 18 | * Add more interface class definitions 19 | 20 | 2009-11-22: v1.0.6 21 | * Bug fixes 22 | * Increase libusb_handle_events() timeout to 60s for powersaving 23 | 24 | 2009-11-15: v1.0.5 25 | * Use timerfd when available for timer management 26 | * Small fixes/updates 27 | 28 | 2009-11-06: v1.0.4 release 29 | * Bug fixes including transfer locking to fix some potential threading races 30 | * More flexibility with clock types on Linux 31 | * Use new bulk continuation tracking in Linux 2.6.32 for improved handling 32 | of short/failed transfers 33 | 34 | 2009-08-27: v1.0.3 release 35 | * Bug fixes 36 | * Add libusb_get_max_iso_packet_size() 37 | 38 | 2009-06-13: v1.0.2 release 39 | * Bug fixes 40 | 41 | 2009-05-12: v1.0.1 release 42 | * Bug fixes 43 | * Darwin backend 44 | 45 | 2008-12-13: v1.0.0 release 46 | * Bug fixes 47 | 48 | 2008-11-21: v0.9.4 release 49 | * Bug fixes 50 | * Add libusb_attach_kernel_driver() 51 | 52 | 2008-08-23: v0.9.3 release 53 | * Bug fixes 54 | 55 | 2008-07-19: v0.9.2 release 56 | * Bug fixes 57 | 58 | 2008-06-28: v0.9.1 release 59 | * Bug fixes 60 | * Introduce contexts to the API 61 | * Compatibility with new Linux kernel features 62 | 63 | 2008-05-25: v0.9.0 release 64 | * First libusb-1.0 beta release 65 | 66 | -------------------------------------------------------------------------------- /software/cgminer/lib/dummy.c: -------------------------------------------------------------------------------- 1 | /* A dummy file, to prevent empty libraries from breaking builds. 2 | Copyright (C) 2004, 2007, 2009-2011 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Some systems, reportedly OpenBSD and Mac OS X, refuse to create 18 | libraries without any object files. You might get an error like: 19 | 20 | > ar cru .libs/libgl.a 21 | > ar: no archive members specified 22 | 23 | Compiling this file, and adding its object file to the library, will 24 | prevent the library from being empty. */ 25 | 26 | /* Some systems, such as Solaris with cc 5.0, refuse to work with libraries 27 | that don't export any symbol. You might get an error like: 28 | 29 | > cc ... libgnu.a 30 | > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a 31 | 32 | Compiling this file, and adding its object file to the library, will 33 | prevent the library from exporting no symbols. */ 34 | 35 | #ifdef __sun 36 | /* This declaration ensures that the library will export at least 1 symbol. */ 37 | int gl_dummy_symbol; 38 | #else 39 | /* This declaration is solely to ensure that after preprocessing 40 | this file is never empty. */ 41 | typedef int dummy; 42 | #endif 43 | -------------------------------------------------------------------------------- /software/cgminer/lib/sig-handler.h: -------------------------------------------------------------------------------- 1 | /* Convenience declarations when working with . 2 | 3 | Copyright (C) 2008-2011 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_SIG_HANDLER_H 19 | #define _GL_SIG_HANDLER_H 20 | 21 | #include 22 | 23 | /* Convenience type when working with signal handlers. */ 24 | typedef void (*sa_handler_t) (int); 25 | 26 | /* Return the handler of a signal, as a sa_handler_t value regardless 27 | of its true type. The resulting function can be compared to 28 | special values like SIG_IGN but it is not portable to call it. */ 29 | static inline sa_handler_t 30 | get_handler (struct sigaction const *a) 31 | { 32 | #ifdef SA_SIGINFO 33 | /* POSIX says that special values like SIG_IGN can only occur when 34 | action.sa_flags does not contain SA_SIGINFO. But in Linux 2.4, 35 | for example, sa_sigaction and sa_handler are aliases and a signal 36 | is ignored if sa_sigaction (after casting) equals SIG_IGN. So 37 | use (and cast) sa_sigaction in that case. */ 38 | if (a->sa_flags & SA_SIGINFO) 39 | return (sa_handler_t) a->sa_sigaction; 40 | #endif 41 | return a->sa_handler; 42 | } 43 | 44 | #endif /* _GL_SIG_HANDLER_H */ 45 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb/libusb-1.0.rc: -------------------------------------------------------------------------------- 1 | /* 2 | * For Windows: input this file to the Resoure Compiler to produce a binary 3 | * .res file. This is then embedded in the resultant library (like any other 4 | * compilation object). 5 | * The information can then be queried using standard APIs and can also be 6 | * viewed with utilities such as Windows Explorer. 7 | */ 8 | #include "winresrc.h" 9 | 10 | #include "version.h" 11 | #ifndef LIBUSB_VERSIONSTRING 12 | #define LU_STR(s) #s 13 | #define LU_XSTR(s) LU_STR(s) 14 | #if LIBUSB_NANO > 0 15 | #define LIBUSB_VERSIONSTRING LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) LIBUSB_RC "\0" 16 | #else 17 | #define LIBUSB_VERSIONSTRING LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." LU_XSTR(LIBUSB_MICRO) LIBUSB_RC "\0" 18 | #endif 19 | #endif 20 | 21 | VS_VERSION_INFO VERSIONINFO 22 | FILEVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO 23 | PRODUCTVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO 24 | FILEFLAGSMASK 0x3fL 25 | #ifdef _DEBUG 26 | FILEFLAGS 0x1L 27 | #else 28 | FILEFLAGS 0x0L 29 | #endif 30 | FILEOS 0x40004L 31 | FILETYPE 0x2L 32 | FILESUBTYPE 0x0L 33 | BEGIN 34 | BLOCK "StringFileInfo" 35 | BEGIN 36 | BLOCK "040904b0" 37 | BEGIN 38 | VALUE "Comments", "\0" 39 | VALUE "CompanyName", "libusb.org\0" 40 | VALUE "FileDescription", "C library for writing portable USB drivers in userspace\0" 41 | VALUE "FileVersion", LIBUSB_VERSIONSTRING 42 | VALUE "InternalName", "libusb\0" 43 | VALUE "LegalCopyright", "See individual source files, GNU LGPL v2.1 or later.\0" 44 | VALUE "LegalTrademarks", "http://www.gnu.org/licenses/lgpl-2.1.html\0" 45 | VALUE "OriginalFilename", "libusb-1.0.dll\0" 46 | VALUE "PrivateBuild", "\0" 47 | VALUE "ProductName", "libusb-1.0\0" 48 | VALUE "ProductVersion", LIBUSB_VERSIONSTRING 49 | VALUE "SpecialBuild", "\0" 50 | END 51 | END 52 | BLOCK "VarFileInfo" 53 | BEGIN 54 | VALUE "Translation", 0x409, 1200 55 | END 56 | END 57 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb/os/threads_posix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libusb synchronization using POSIX Threads 3 | * 4 | * Copyright (C) 2010 Peter Stuge 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef LIBUSB_THREADS_POSIX_H 22 | #define LIBUSB_THREADS_POSIX_H 23 | 24 | #include 25 | 26 | #define usbi_mutex_static_t pthread_mutex_t 27 | #define USBI_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER 28 | #define usbi_mutex_static_lock pthread_mutex_lock 29 | #define usbi_mutex_static_unlock pthread_mutex_unlock 30 | 31 | #define usbi_mutex_t pthread_mutex_t 32 | #define usbi_mutex_init pthread_mutex_init 33 | #define usbi_mutex_lock pthread_mutex_lock 34 | #define usbi_mutex_unlock pthread_mutex_unlock 35 | #define usbi_mutex_trylock pthread_mutex_trylock 36 | #define usbi_mutex_destroy pthread_mutex_destroy 37 | 38 | #define usbi_cond_t pthread_cond_t 39 | #define usbi_cond_init pthread_cond_init 40 | #define usbi_cond_wait pthread_cond_wait 41 | #define usbi_cond_timedwait pthread_cond_timedwait 42 | #define usbi_cond_broadcast pthread_cond_broadcast 43 | #define usbi_cond_destroy pthread_cond_destroy 44 | #define usbi_cond_signal pthread_cond_signal 45 | 46 | extern int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr); 47 | 48 | #endif /* LIBUSB_THREADS_POSIX_H */ 49 | -------------------------------------------------------------------------------- /software/cgminer/compat.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMPAT_H__ 2 | #define __COMPAT_H__ 3 | 4 | #ifdef WIN32 5 | #include "config.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "miner.h" // for timersub 12 | #include "util.h" 13 | 14 | #include 15 | 16 | #ifndef HAVE_LIBWINPTHREAD 17 | static inline int nanosleep(const struct timespec *req, struct timespec *rem) 18 | { 19 | struct timeval tstart; 20 | DWORD msecs; 21 | 22 | cgtime(&tstart); 23 | msecs = (req->tv_sec * 1000) + ((999999 + req->tv_nsec) / 1000000); 24 | 25 | if (SleepEx(msecs, true) == WAIT_IO_COMPLETION) { 26 | if (rem) { 27 | struct timeval tdone, tnow, tleft; 28 | tdone.tv_sec = tstart.tv_sec + req->tv_sec; 29 | tdone.tv_usec = tstart.tv_usec + ((999 + req->tv_nsec) / 1000); 30 | if (tdone.tv_usec > 1000000) { 31 | tdone.tv_usec -= 1000000; 32 | ++tdone.tv_sec; 33 | } 34 | 35 | cgtime(&tnow); 36 | if (timercmp(&tnow, &tdone, >)) 37 | return 0; 38 | timersub(&tdone, &tnow, &tleft); 39 | 40 | rem->tv_sec = tleft.tv_sec; 41 | rem->tv_nsec = tleft.tv_usec * 1000; 42 | } 43 | errno = EINTR; 44 | return -1; 45 | } 46 | return 0; 47 | } 48 | #endif 49 | 50 | static inline int sleep(unsigned int secs) 51 | { 52 | struct timespec req, rem; 53 | req.tv_sec = secs; 54 | req.tv_nsec = 0; 55 | if (!nanosleep(&req, &rem)) 56 | return 0; 57 | return rem.tv_sec + (rem.tv_nsec ? 1 : 0); 58 | } 59 | 60 | enum { 61 | PRIO_PROCESS = 0, 62 | }; 63 | 64 | static inline int setpriority(__maybe_unused int which, __maybe_unused int who, __maybe_unused int prio) 65 | { 66 | /* FIXME - actually do something */ 67 | return 0; 68 | } 69 | 70 | typedef unsigned long int ulong; 71 | typedef unsigned short int ushort; 72 | typedef unsigned int uint; 73 | 74 | #ifndef __SUSECONDS_T_TYPE 75 | typedef long suseconds_t; 76 | #endif 77 | 78 | #ifdef HAVE_LIBWINPTHREAD 79 | #define PTH(thr) ((thr)->pth) 80 | #else 81 | #define PTH(thr) ((thr)->pth.p) 82 | #endif 83 | 84 | #else 85 | #define PTH(thr) ((thr)->pth) 86 | #endif /* WIN32 */ 87 | 88 | #endif /* __COMPAT_H__ */ 89 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32_USB-FS-Device_Driver/inc/usb_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_int.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Endpoint CTR (Low and High) interrupt's service routines prototypes 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_INT_H 31 | #define __USB_INT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void CTR_LP(void); 39 | void CTR_HP(void); 40 | 41 | /* External variables --------------------------------------------------------*/ 42 | 43 | #endif /* __USB_INT_H */ 44 | 45 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /software/cgminer/m4/mmap-anon.m4: -------------------------------------------------------------------------------- 1 | # mmap-anon.m4 serial 9 2 | dnl Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # Detect how mmap can be used to create anonymous (not file-backed) memory 8 | # mappings. 9 | # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS 10 | # and MAP_ANON exist and have the same value. 11 | # - On HP-UX, only MAP_ANONYMOUS exists. 12 | # - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. 13 | # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be 14 | # used. 15 | 16 | AC_DEFUN([gl_FUNC_MMAP_ANON], 17 | [ 18 | dnl Persuade glibc to define MAP_ANONYMOUS. 19 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 20 | 21 | # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it 22 | # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is 23 | # irrelevant for anonymous mappings. 24 | AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) 25 | 26 | # Try to allow MAP_ANONYMOUS. 27 | gl_have_mmap_anonymous=no 28 | if test $gl_have_mmap = yes; then 29 | AC_MSG_CHECKING([for MAP_ANONYMOUS]) 30 | AC_EGREP_CPP([I cant identify this map.], [ 31 | #include 32 | #ifdef MAP_ANONYMOUS 33 | I cant identify this map. 34 | #endif 35 | ], 36 | [gl_have_mmap_anonymous=yes]) 37 | if test $gl_have_mmap_anonymous != yes; then 38 | AC_EGREP_CPP([I cant identify this map.], [ 39 | #include 40 | #ifdef MAP_ANON 41 | I cant identify this map. 42 | #endif 43 | ], 44 | [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], 45 | [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) 46 | gl_have_mmap_anonymous=yes]) 47 | fi 48 | AC_MSG_RESULT([$gl_have_mmap_anonymous]) 49 | if test $gl_have_mmap_anonymous = yes; then 50 | AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], 51 | [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including 52 | config.h and .]) 53 | fi 54 | fi 55 | ]) 56 | -------------------------------------------------------------------------------- /software/cgminer/m4/multiarch.m4: -------------------------------------------------------------------------------- 1 | # multiarch.m4 serial 6 2 | dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # Determine whether the compiler is or may be producing universal binaries. 8 | # 9 | # On MacOS X 10.5 and later systems, the user can create libraries and 10 | # executables that work on multiple system types--known as "fat" or 11 | # "universal" binaries--by specifying multiple '-arch' options to the 12 | # compiler but only a single '-arch' option to the preprocessor. Like 13 | # this: 14 | # 15 | # ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 16 | # CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 17 | # CPP="gcc -E" CXXCPP="g++ -E" 18 | # 19 | # Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly. 20 | 21 | AC_DEFUN_ONCE([gl_MULTIARCH], 22 | [ 23 | dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. 24 | gl_cv_c_multiarch=no 25 | AC_COMPILE_IFELSE( 26 | [AC_LANG_SOURCE( 27 | [[#ifndef __APPLE_CC__ 28 | not a universal capable compiler 29 | #endif 30 | typedef int dummy; 31 | ]])], 32 | [ 33 | dnl Check for potential -arch flags. It is not universal unless 34 | dnl there are at least two -arch flags with different values. 35 | arch= 36 | prev= 37 | for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do 38 | if test -n "$prev"; then 39 | case $word in 40 | i?86 | x86_64 | ppc | ppc64) 41 | if test -z "$arch" || test "$arch" = "$word"; then 42 | arch="$word" 43 | else 44 | gl_cv_c_multiarch=yes 45 | fi 46 | ;; 47 | esac 48 | prev= 49 | else 50 | if test "x$word" = "x-arch"; then 51 | prev=arch 52 | fi 53 | fi 54 | done 55 | ]) 56 | if test $gl_cv_c_multiarch = yes; then 57 | APPLE_UNIVERSAL_BUILD=1 58 | else 59 | APPLE_UNIVERSAL_BUILD=0 60 | fi 61 | AC_SUBST([APPLE_UNIVERSAL_BUILD]) 62 | ]) 63 | -------------------------------------------------------------------------------- /software/cgminer/m4/warn-on-use.m4: -------------------------------------------------------------------------------- 1 | # warn-on-use.m4 serial 2 2 | dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) 8 | # --------------------------------------- 9 | # For each whitespace-separated element in the list of NAMES, define 10 | # HAVE_RAW_DECL_name if the function has a declaration among INCLUDES 11 | # even after being undefined as a macro. 12 | # 13 | # See warn-on-use.h for some hints on how to poison function names, as 14 | # well as ideas on poisoning global variables and macros. NAMES may 15 | # include global variables, but remember that only functions work with 16 | # _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single 17 | # header, but if the replacement header pulls in other headers because 18 | # some systems declare functions in the wrong header, then INCLUDES 19 | # should do likewise. 20 | # 21 | # If you assume C89, then it is generally safe to assume declarations 22 | # for functions declared in that standard (such as gets) without 23 | # needing gl_WARN_ON_USE_PREPARE. 24 | AC_DEFUN([gl_WARN_ON_USE_PREPARE], 25 | [ 26 | m4_foreach_w([gl_decl], [$2], 27 | [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), 28 | [Define to 1 if ]m4_defn([gl_decl])[ is declared even after 29 | undefining macros.])])dnl 30 | for gl_func in m4_flatten([$2]); do 31 | AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl 32 | AC_CACHE_CHECK([whether $gl_func is declared without a macro], 33 | gl_Symbol, 34 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], 35 | [@%:@undef $gl_func 36 | (void) $gl_func;])], 37 | [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) 38 | AS_VAR_IF(gl_Symbol, [yes], 39 | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) 40 | dnl shortcut - if the raw declaration exists, then set a cache 41 | dnl variable to allow skipping any later AC_CHECK_DECL efforts 42 | eval ac_cv_have_decl_$gl_func=yes]) 43 | AS_VAR_POPDEF([gl_Symbol])dnl 44 | done 45 | ]) 46 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32_USB-FS-Device_Driver/inc/usb_type.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_type.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Type definitions used by the USB Library 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_TYPE_H 31 | #define __USB_TYPE_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | #ifndef NULL 39 | #define NULL ((void *)0) 40 | #endif 41 | 42 | typedef enum 43 | { 44 | FALSE = 0, TRUE = !FALSE 45 | } 46 | bool; 47 | 48 | /* Exported macro ------------------------------------------------------------*/ 49 | /* Exported functions ------------------------------------------------------- */ 50 | /* External variables --------------------------------------------------------*/ 51 | 52 | #endif /* __USB_TYPE_H */ 53 | 54 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32_USB-FS-Device_Driver/inc/usb_mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_mem.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Utility prototypes functions for memory/PMA transfers 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_MEM_H 31 | #define __USB_MEM_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 39 | void PMAToUserBufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 40 | 41 | /* External variables --------------------------------------------------------*/ 42 | 43 | #endif /*__USB_MEM_H*/ 44 | 45 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32_USB-FS-Device_Driver/inc/usb_sil.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_sil.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Simplified Interface Layer function prototypes. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_SIL_H 31 | #define __USB_SIL_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | 39 | uint32_t USB_SIL_Init(void); 40 | uint32_t USB_SIL_Write(uint8_t bEpAddr, uint8_t* pBufferPointer, uint32_t wBufferSize); 41 | uint32_t USB_SIL_Read(uint8_t bEpAddr, uint8_t* pBufferPointer); 42 | 43 | /* External variables --------------------------------------------------------*/ 44 | 45 | #endif /* __USB_SIL_H */ 46 | 47 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32_USB-FS-Device_Driver/inc/usb_lib.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_lib.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief USB library include files 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_LIB_H 31 | #define __USB_LIB_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "hw_config.h" 35 | #include "usb_type.h" 36 | #include "usb_regs.h" 37 | #include "usb_def.h" 38 | #include "usb_core.h" 39 | #include "usb_init.h" 40 | #include "usb_sil.h" 41 | #include "usb_mem.h" 42 | #include "usb_int.h" 43 | 44 | /* Exported types ------------------------------------------------------------*/ 45 | /* Exported constants --------------------------------------------------------*/ 46 | /* Exported macro ------------------------------------------------------------*/ 47 | /* Exported functions ------------------------------------------------------- */ 48 | /* External variables --------------------------------------------------------*/ 49 | 50 | #endif /* __USB_LIB_H */ 51 | 52 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 53 | -------------------------------------------------------------------------------- /software/cgminer/hexdump.c: -------------------------------------------------------------------------------- 1 | /* 2 | * hexdump implementation without depenecies to *printf() 3 | * output is equal to 'hexdump -C' 4 | * should be compatible to 64bit architectures 5 | * 6 | * Copyright (c) 2009 Daniel Mack 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #define hex_print(p) applog(LOG_DEBUG, "%s", p) 23 | 24 | static char nibble[] = { 25 | '0', '1', '2', '3', '4', '5', '6', '7', 26 | '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; 27 | 28 | #define BYTES_PER_LINE 0x10 29 | 30 | void hexdump(const uint8_t *p, unsigned int len) 31 | { 32 | unsigned int i, addr; 33 | unsigned int wordlen = sizeof(void*); 34 | unsigned char v, line[BYTES_PER_LINE * 5]; 35 | 36 | for (addr = 0; addr < len; addr += BYTES_PER_LINE) { 37 | /* clear line */ 38 | for (i = 0; i < sizeof(line); i++) { 39 | if (i == wordlen * 2 + 52 || 40 | i == wordlen * 2 + 69) { 41 | line[i] = '|'; 42 | continue; 43 | } 44 | 45 | if (i == wordlen * 2 + 70) { 46 | line[i] = '\0'; 47 | continue; 48 | } 49 | 50 | line[i] = ' '; 51 | } 52 | 53 | /* print address */ 54 | for (i = 0; i < wordlen * 2; i++) { 55 | v = addr >> ((wordlen * 2 - i - 1) * 4); 56 | line[i] = nibble[v & 0xf]; 57 | } 58 | 59 | /* dump content */ 60 | for (i = 0; i < BYTES_PER_LINE; i++) { 61 | int pos = (wordlen * 2) + 3 + (i / 8); 62 | 63 | if (addr + i >= len) 64 | break; 65 | 66 | v = p[addr + i]; 67 | line[pos + (i * 3) + 0] = nibble[v >> 4]; 68 | line[pos + (i * 3) + 1] = nibble[v & 0xf]; 69 | 70 | /* character printable? */ 71 | line[(wordlen * 2) + 53 + i] = 72 | (v >= ' ' && v <= '~') ? v : '.'; 73 | } 74 | 75 | hex_print(line); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /software/cgminer/logging.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-2012 Con Kolivas 3 | * Copyright 2013 Andrew Smith 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License as published by the Free 7 | * Software Foundation; either version 3 of the License, or (at your option) 8 | * any later version. See COPYING for more details. 9 | */ 10 | 11 | #include "config.h" 12 | 13 | #include 14 | 15 | #include "logging.h" 16 | #include "miner.h" 17 | 18 | bool opt_debug = false; 19 | bool opt_log_output = false; 20 | 21 | /* per default priorities higher than LOG_NOTICE are logged */ 22 | int opt_log_level = LOG_NOTICE; 23 | 24 | static void my_log_curses(int prio, const char *datetime, const char *str, bool force) 25 | { 26 | if (opt_quiet && prio != LOG_ERR) 27 | return; 28 | 29 | /* Mutex could be locked by dead thread on shutdown so forcelog will 30 | * invalidate any console lock status. */ 31 | if (force) { 32 | mutex_trylock(&console_lock); 33 | mutex_unlock(&console_lock); 34 | } 35 | #ifdef HAVE_CURSES 36 | extern bool use_curses; 37 | if (use_curses && log_curses_only(prio, datetime, str)) 38 | ; 39 | else 40 | #endif 41 | { 42 | mutex_lock(&console_lock); 43 | printf("%s%s%s", datetime, str, " \n"); 44 | mutex_unlock(&console_lock); 45 | } 46 | } 47 | 48 | /* high-level logging function, based on global opt_log_level */ 49 | 50 | /* 51 | * log function 52 | */ 53 | void _applog(int prio, const char *str, bool force) 54 | { 55 | #ifdef HAVE_SYSLOG_H 56 | if (use_syslog) { 57 | syslog(prio, "%s", str); 58 | } 59 | #else 60 | if (0) {} 61 | #endif 62 | else { 63 | char datetime[64]; 64 | struct timeval tv = {0, 0}; 65 | struct tm *tm; 66 | 67 | cgtime(&tv); 68 | 69 | const time_t tmp_time = tv.tv_sec; 70 | tm = localtime(&tmp_time); 71 | 72 | snprintf(datetime, sizeof(datetime), " [%d-%02d-%02d %02d:%02d:%02d] ", 73 | tm->tm_year + 1900, 74 | tm->tm_mon + 1, 75 | tm->tm_mday, 76 | tm->tm_hour, 77 | tm->tm_min, 78 | tm->tm_sec); 79 | 80 | /* Only output to stderr if it's not going to the screen as well */ 81 | if (!isatty(fileno((FILE *)stderr))) { 82 | fprintf(stderr, "%s%s\n", datetime, str); /* atomic write to stderr */ 83 | fflush(stderr); 84 | } 85 | 86 | my_log_curses(prio, datetime, str, force); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /software/cpuminer/compat/jansson/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated from config.h.in by configure. */ 2 | /* config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* Define to 1 if you have the header file. */ 5 | #define HAVE_DLFCN_H 1 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #define HAVE_INTTYPES_H 1 9 | 10 | /* Define to 1 if you have the header file. */ 11 | #define HAVE_MEMORY_H 1 12 | 13 | /* Define to 1 if you have the header file. */ 14 | #define HAVE_STDINT_H 1 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #define HAVE_STDLIB_H 1 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #define HAVE_STRINGS_H 1 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #define HAVE_STRING_H 1 24 | 25 | /* Define to 1 if you have the header file. */ 26 | #define HAVE_SYS_STAT_H 1 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #define HAVE_SYS_TYPES_H 1 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_UNISTD_H 1 33 | 34 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 35 | */ 36 | #define LT_OBJDIR ".libs/" 37 | 38 | /* Name of package */ 39 | #define PACKAGE "jansson" 40 | 41 | /* Define to the address where bug reports for this package should be sent. */ 42 | #define PACKAGE_BUGREPORT "petri@digip.org" 43 | 44 | /* Define to the full name of this package. */ 45 | #define PACKAGE_NAME "jansson" 46 | 47 | /* Define to the full name and version of this package. */ 48 | #define PACKAGE_STRING "jansson 1.3" 49 | 50 | /* Define to the one symbol short name of this package. */ 51 | #define PACKAGE_TARNAME "jansson" 52 | 53 | /* Define to the home page for this package. */ 54 | #define PACKAGE_URL "" 55 | 56 | /* Define to the version of this package. */ 57 | #define PACKAGE_VERSION "1.3" 58 | 59 | /* Define to 1 if you have the ANSI C header files. */ 60 | #define STDC_HEADERS 1 61 | 62 | /* Version number of package */ 63 | #define VERSION "1.3" 64 | 65 | /* Define to `__inline__' or `__inline' if that's what the C compiler 66 | calls it, or to nothing if 'inline' is not supported under any name. */ 67 | #ifndef __cplusplus 68 | /* #undef inline */ 69 | #endif 70 | 71 | /* Define to the type of a signed integer type of width exactly 32 bits if 72 | such a type exists and the standard includes do not define it. */ 73 | /* #undef int32_t */ 74 | -------------------------------------------------------------------------------- /software/cgminer/m4/signal_h.m4: -------------------------------------------------------------------------------- 1 | # signal_h.m4 serial 12 2 | dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_SIGNAL_H], 8 | [ 9 | AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) 10 | gl_NEXT_HEADERS([signal.h]) 11 | 12 | # AIX declares sig_atomic_t to already include volatile, and C89 compilers 13 | # then choke on 'volatile sig_atomic_t'. C99 requires that it compile. 14 | AC_CHECK_TYPE([volatile sig_atomic_t], [], 15 | [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[ 16 | #include 17 | ]]) 18 | 19 | AC_REQUIRE([AC_TYPE_UID_T]) 20 | 21 | dnl Persuade glibc to define sighandler_t. 22 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 23 | AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[ 24 | #include 25 | ]]) 26 | 27 | dnl Check for declarations of anything we want to poison if the 28 | dnl corresponding gnulib module is not in use. 29 | gl_WARN_ON_USE_PREPARE([[#include 30 | ]], [sigaction sigaddset sigdelset sigemptyset sigfillset sigismember 31 | sigpending sigprocmask]) 32 | ]) 33 | 34 | AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], 35 | [ 36 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 37 | AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) 38 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) 39 | dnl Define it also as a C macro, for the benefit of the unit tests. 40 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) 41 | ]) 42 | 43 | AC_DEFUN([gl_SIGNAL_H_DEFAULTS], 44 | [ 45 | GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE]) 46 | GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK]) 47 | GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) 48 | dnl Assume proper GNU behavior unless another module says otherwise. 49 | HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) 50 | HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) 51 | HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T]) 52 | HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION]) 53 | HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; 54 | AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION]) 55 | HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; 56 | AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T]) 57 | HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T]) 58 | ]) 59 | -------------------------------------------------------------------------------- /software/cpuminer/compat/jansson/strbuffer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2010 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #define _GNU_SOURCE 9 | #include 10 | #include 11 | #include "strbuffer.h" 12 | #include "util.h" 13 | 14 | #define STRBUFFER_MIN_SIZE 16 15 | #define STRBUFFER_FACTOR 2 16 | 17 | int strbuffer_init(strbuffer_t *strbuff) 18 | { 19 | strbuff->size = STRBUFFER_MIN_SIZE; 20 | strbuff->length = 0; 21 | 22 | strbuff->value = malloc(strbuff->size); 23 | if(!strbuff->value) 24 | return -1; 25 | 26 | /* initialize to empty */ 27 | strbuff->value[0] = '\0'; 28 | return 0; 29 | } 30 | 31 | void strbuffer_close(strbuffer_t *strbuff) 32 | { 33 | free(strbuff->value); 34 | strbuff->size = 0; 35 | strbuff->length = 0; 36 | strbuff->value = NULL; 37 | } 38 | 39 | void strbuffer_clear(strbuffer_t *strbuff) 40 | { 41 | strbuff->length = 0; 42 | strbuff->value[0] = '\0'; 43 | } 44 | 45 | const char *strbuffer_value(const strbuffer_t *strbuff) 46 | { 47 | return strbuff->value; 48 | } 49 | 50 | char *strbuffer_steal_value(strbuffer_t *strbuff) 51 | { 52 | char *result = strbuff->value; 53 | strbuffer_init(strbuff); 54 | return result; 55 | } 56 | 57 | int strbuffer_append(strbuffer_t *strbuff, const char *string) 58 | { 59 | return strbuffer_append_bytes(strbuff, string, strlen(string)); 60 | } 61 | 62 | int strbuffer_append_byte(strbuffer_t *strbuff, char byte) 63 | { 64 | return strbuffer_append_bytes(strbuff, &byte, 1); 65 | } 66 | 67 | int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, int size) 68 | { 69 | if(strbuff->length + size >= strbuff->size) 70 | { 71 | strbuff->size = max(strbuff->size * STRBUFFER_FACTOR, 72 | strbuff->length + size + 1); 73 | 74 | strbuff->value = realloc(strbuff->value, strbuff->size); 75 | if(!strbuff->value) 76 | return -1; 77 | } 78 | 79 | memcpy(strbuff->value + strbuff->length, data, size); 80 | strbuff->length += size; 81 | strbuff->value[strbuff->length] = '\0'; 82 | 83 | return 0; 84 | } 85 | 86 | char strbuffer_pop(strbuffer_t *strbuff) 87 | { 88 | if(strbuff->length > 0) { 89 | char c = strbuff->value[--strbuff->length]; 90 | strbuff->value[strbuff->length] = '\0'; 91 | return c; 92 | } 93 | else 94 | return '\0'; 95 | } 96 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/stm32_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_it.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32_IT_H 31 | #define __STM32_IT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "platform_config.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void NMI_Handler(void); 42 | void HardFault_Handler(void); 43 | void MemManage_Handler(void); 44 | void BusFault_Handler(void); 45 | void UsageFault_Handler(void); 46 | void SVC_Handler(void); 47 | void DebugMon_Handler(void); 48 | void PendSV_Handler(void); 49 | void SysTick_Handler(void); 50 | void USB_LP_CAN1_RX0_IRQHandler(void); 51 | 52 | #if defined (USE_STM32L152_EVAL) || (USE_STM32373C_EVAL) 53 | void USART2_IRQHandler(void); 54 | #else 55 | void USART1_IRQHandler(void); 56 | #endif /* USE_STM32L152_EVAL */ 57 | #endif /* __STM32_IT_H */ 58 | 59 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 60 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the `localeconv' function. */ 10 | #undef HAVE_LOCALECONV 11 | 12 | /* Define to 1 if you have the header file. */ 13 | #undef HAVE_LOCALE_H 14 | 15 | /* Define to 1 if the system has the type `long long int'. */ 16 | #undef HAVE_LONG_LONG_INT 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_MEMORY_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STDINT_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STDLIB_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_STRINGS_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_STRING_H 32 | 33 | /* Define to 1 if you have the `strtoll' function. */ 34 | #undef HAVE_STRTOLL 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_SYS_STAT_H 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_SYS_TYPES_H 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #undef HAVE_UNISTD_H 44 | 45 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 46 | */ 47 | #undef LT_OBJDIR 48 | 49 | /* Name of package */ 50 | #undef PACKAGE 51 | 52 | /* Define to the address where bug reports for this package should be sent. */ 53 | #undef PACKAGE_BUGREPORT 54 | 55 | /* Define to the full name of this package. */ 56 | #undef PACKAGE_NAME 57 | 58 | /* Define to the full name and version of this package. */ 59 | #undef PACKAGE_STRING 60 | 61 | /* Define to the one symbol short name of this package. */ 62 | #undef PACKAGE_TARNAME 63 | 64 | /* Define to the home page for this package. */ 65 | #undef PACKAGE_URL 66 | 67 | /* Define to the version of this package. */ 68 | #undef PACKAGE_VERSION 69 | 70 | /* Define to 1 if you have the ANSI C header files. */ 71 | #undef STDC_HEADERS 72 | 73 | /* Version number of package */ 74 | #undef VERSION 75 | 76 | /* Define to `__inline__' or `__inline' if that's what the C compiler 77 | calls it, or to nothing if 'inline' is not supported under any name. */ 78 | #ifndef __cplusplus 79 | #undef inline 80 | #endif 81 | 82 | /* Define to the type of a signed integer type of width exactly 32 bits if 83 | such a type exists and the standard includes do not define it. */ 84 | #undef int32_t 85 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/miner.h: -------------------------------------------------------------------------------- 1 | #ifndef __MINER_H_ 2 | #define __MINER_H_ 3 | /* miner.h 4 | */ 5 | #define USE_USB_AS_HOST_IF 6 | //#define USE_UART1_AS_HOST_IF 7 | #define FW_VER_HH 0x01 8 | #define FW_VER_HL 0x14 9 | #define FW_VER_LH 0x01 10 | #define FW_VER_LL 0x13 11 | 12 | #define DISPATCH_CMD_FRAME_INTERVAL 6 13 | #define CMD_WAIT_TIME 1200 /* us */ 14 | #define BTC_COM1 EVAL_COM2 15 | #define BTC_COM2 EVAL_COM4 16 | #define LTC_COM1 EVAL_COM3 17 | #define LTC_COM2 EVAL_COM5 18 | 19 | #define GC3355_NUM 0x05 20 | #define HEADER_55 0x55 21 | #define HEADER_AA 0xaa 22 | #define BTC_TASK_FIFO_LEN 0x08 23 | #define CMD_MAX_LENGTH 256 24 | #define REPORT_MAX_LENGTH 12 25 | 26 | #define SUB_CHIP 0xC0C0C0C0 27 | #define BTC_RESET 0xE0E0E0E0 28 | #define FIFO_RESET 0xf0f0f0f0 29 | #define USB_RESET 0x10101010 30 | #define GCP_RESET 0x80808080 31 | #define GET_FWVER 0x90909090 32 | #define FW_VER_HH 0x01 33 | #define FW_VER_HL 0x14 34 | #define FW_VER_LH 0x01 35 | #define FW_VER_LL 0x13 36 | #define SET_BRATE 0xB0B0B0B0 37 | #define GET_FREE_FIFO 0xA0A0A0A0 38 | #define EN_DIS_FIFO 0xD0D0D0D0 39 | #define GET_BTC_INFIFO 0x70707070 40 | 41 | enum CMD_TYPE 42 | { 43 | BTC = 0x00, 44 | LTC = 0x10, 45 | CPM = 0xe0, 46 | BTA = 0xf0, 47 | MCU = 0xc0, 48 | ERR = 0xff 49 | }; 50 | 51 | typedef struct _MINER_CMD_ { 52 | u8 *cmd; 53 | u32 length; 54 | u32 cmd_type; 55 | }MINER_CMD; 56 | 57 | typedef struct _BTC_TASK_CMD_{ 58 | u8 header[4]; 59 | u32 nonce; 60 | u8 data[40]; 61 | u32 taskid; 62 | }BTC_TASK_CMD; 63 | 64 | typedef struct _LTC_TASK_CMD_{ 65 | u8 header[4]; 66 | u8 data[140]; 67 | u32 nonce_min; 68 | u32 nonce_max; 69 | u32 taskid; 70 | }LTC_TASK_CMD; 71 | 72 | typedef struct _TASK_NONCE_ { 73 | u8 header[4]; 74 | u32 nonce; 75 | u32 taskid; 76 | }TASK_NONCE; 77 | 78 | typedef struct _LTC_NONCE_INIT_ { 79 | u8 header[4]; 80 | u32 nonce_min; 81 | u32 nonce_max; 82 | }LTC_NONCE_INIT; 83 | 84 | typedef struct _GENENAL_CMD_{ 85 | u8 header[4]; 86 | u8 data[156]; 87 | u32 length; 88 | }GENENAL_CMD; 89 | 90 | typedef struct _MCU_CMD_{ 91 | u8 header[4]; 92 | u32 reg_addr; 93 | u32 reg_value; 94 | u32 reg_len; 95 | }MCU_CMD; 96 | 97 | typedef struct _TASK_FIFO_ { 98 | BTC_TASK_CMD task[BTC_TASK_FIFO_LEN + 1]; 99 | u32 size; 100 | u32 in; 101 | u32 out; 102 | u32 full; 103 | }TASK_FIFO; 104 | 105 | void dispatch_host_cmd(void); 106 | void report_nonce_to_host(void); 107 | #endif /*__MINER_H_*/ 108 | -------------------------------------------------------------------------------- /software/cgminer/api-example.php: -------------------------------------------------------------------------------- 1 | 0) 71 | { 72 | $items = explode(',', $obj); 73 | $item = $items[0]; 74 | $id = explode('=', $items[0], 2); 75 | if (count($id) == 1 or !ctype_digit($id[1])) 76 | $name = $id[0]; 77 | else 78 | $name = $id[0].$id[1]; 79 | 80 | if (strlen($name) == 0) 81 | $name = 'null'; 82 | 83 | if (isset($data[$name])) 84 | { 85 | $num = 1; 86 | while (isset($data[$name.$num])) 87 | $num++; 88 | $name .= $num; 89 | } 90 | 91 | $counter = 0; 92 | foreach ($items as $item) 93 | { 94 | $id = explode('=', $item, 2); 95 | if (count($id) == 2) 96 | $data[$name][$id[0]] = $id[1]; 97 | else 98 | $data[$name][$counter] = $id[0]; 99 | 100 | $counter++; 101 | } 102 | } 103 | } 104 | 105 | return $data; 106 | } 107 | 108 | return null; 109 | } 110 | # 111 | if (isset($argv) and count($argv) > 1) 112 | $r = request($argv[1]); 113 | else 114 | $r = request('summary'); 115 | # 116 | echo print_r($r, true)."\n"; 117 | # 118 | ?> 119 | -------------------------------------------------------------------------------- /software/cgminer/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | ACLOCAL_AMFLAGS = -I m4 3 | 4 | JANSSON_CPPFLAGS= -I$(top_builddir)/compat/jansson-2.5/src -I$(top_srcdir)/compat/jansson-2.5/src 5 | 6 | if WANT_USBUTILS 7 | USBUTILS_CPPFLAGS = -I$(top_builddir)/compat/libusb-1.0/libusb -I$(top_srcdir)/compat/libusb-1.0/libusb 8 | else 9 | USBUTILS_CPPFLAGS = 10 | endif 11 | 12 | EXTRA_DIST = example.conf linux-usb-cgminer \ 13 | api-example.php miner.php \ 14 | API.class API.java api-example.c windows-build.txt \ 15 | bitstreams/* API-README FPGA-README \ 16 | bitforce-firmware-flash.c hexdump.c ASIC-README \ 17 | 01-cgminer.rules 18 | 19 | SUBDIRS = lib compat ccan 20 | 21 | cgminer_CPPFLAGS = $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_CPPFLAGS) $(USBUTILS_CPPFLAGS) 22 | 23 | bin_PROGRAMS = cgminer 24 | 25 | cgminer_LDFLAGS = $(PTHREAD_FLAGS) 26 | cgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \ 27 | @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \ 28 | @LIBUSB_LIBS@ @MM_LIBS@ @RT_LIBS@ \ 29 | @MATH_LIBS@ lib/libgnu.a ccan/libccan.a 30 | 31 | cgminer_CPPFLAGS += -I$(top_builddir)/lib -I$(top_srcdir)/lib 32 | 33 | if !HAVE_WINDOWS 34 | cgminer_CPPFLAGS += @LIBCURL_CFLAGS@ 35 | endif 36 | 37 | # common sources 38 | cgminer_SOURCES := cgminer.c 39 | 40 | cgminer_SOURCES += elist.h miner.h compat.h bench_block.h \ 41 | util.c util.h uthash.h logging.h \ 42 | sha2.c sha2.h api.c 43 | 44 | cgminer_SOURCES += logging.c 45 | 46 | if NEED_FPGAUTILS 47 | cgminer_SOURCES += fpgautils.c fpgautils.h 48 | endif 49 | 50 | if WANT_USBUTILS 51 | cgminer_SOURCES += usbutils.c usbutils.h 52 | endif 53 | 54 | # Device drivers 55 | if HAS_AVALON 56 | cgminer_SOURCES += driver-avalon.c driver-avalon.h 57 | endif 58 | 59 | if HAS_KNC 60 | cgminer_SOURCES += driver-knc-spi-fpga.c 61 | endif 62 | 63 | if HAS_BFLSC 64 | cgminer_SOURCES += driver-bflsc.c driver-bflsc.h 65 | endif 66 | 67 | if HAS_BITFORCE 68 | cgminer_SOURCES += driver-bitforce.c 69 | endif 70 | 71 | if HAS_GRIDSEED 72 | cgminer_SOURCES += driver-gridseed.c driver-gridseed.h 73 | endif 74 | 75 | if HAS_HASHFAST 76 | cgminer_SOURCES += driver-hashfast.c driver-hashfast.h hf_protocol.h hf_protocol_be.h 77 | endif 78 | 79 | if HAS_BITFURY 80 | cgminer_SOURCES += driver-bitfury.c driver-bitfury.h 81 | endif 82 | 83 | if HAS_ICARUS 84 | cgminer_SOURCES += driver-icarus.c 85 | endif 86 | 87 | if HAS_KLONDIKE 88 | cgminer_SOURCES += driver-klondike.c 89 | endif 90 | 91 | if HAS_BAB 92 | cgminer_SOURCES += driver-bab.c 93 | endif 94 | 95 | if HAS_MODMINER 96 | cgminer_SOURCES += driver-modminer.c 97 | bitstreamsdir = $(bindir)/bitstreams 98 | dist_bitstreams_DATA = $(top_srcdir)/bitstreams/* 99 | endif 100 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/usb_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_pwr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Connection/disconnection & power management header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_PWR_H 31 | #define __USB_PWR_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | typedef enum _RESUME_STATE 36 | { 37 | RESUME_EXTERNAL, 38 | RESUME_INTERNAL, 39 | RESUME_LATER, 40 | RESUME_WAIT, 41 | RESUME_START, 42 | RESUME_ON, 43 | RESUME_OFF, 44 | RESUME_ESOF 45 | } RESUME_STATE; 46 | 47 | typedef enum _DEVICE_STATE 48 | { 49 | UNCONNECTED, 50 | ATTACHED, 51 | POWERED, 52 | SUSPENDED, 53 | ADDRESSED, 54 | CONFIGURED 55 | } DEVICE_STATE; 56 | 57 | /* Exported constants --------------------------------------------------------*/ 58 | /* Exported macro ------------------------------------------------------------*/ 59 | /* Exported functions ------------------------------------------------------- */ 60 | void Suspend(void); 61 | void Resume_Init(void); 62 | void Resume(RESUME_STATE eResumeSetVal); 63 | RESULT PowerOn(void); 64 | RESULT PowerOff(void); 65 | 66 | /* External variables --------------------------------------------------------*/ 67 | extern __IO uint32_t bDeviceState; /* USB device status */ 68 | extern __IO bool fSuspendEnabled; /* true when suspend is possible */ 69 | 70 | #endif /*__USB_PWR_H*/ 71 | 72 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 73 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/CMSIS/Device/ST/STM32F10x/Include/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 09-March-2012 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f10x_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F10X_H 40 | #define __SYSTEM_STM32F10X_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F10x_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F10x_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @addtogroup STM32F10x_System_Exported_Constants 66 | * @{ 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @addtogroup STM32F10x_System_Exported_Macros 74 | * @{ 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @addtogroup STM32F10x_System_Exported_Functions 82 | * @{ 83 | */ 84 | 85 | extern void SystemInit(void); 86 | extern void SystemCoreClockUpdate(void); 87 | /** 88 | * @} 89 | */ 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /*__SYSTEM_STM32F10X_H */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 105 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_CRC_H 31 | #define __STM32F10x_CRC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup CRC 45 | * @{ 46 | */ 47 | 48 | /** @defgroup CRC_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup CRC_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup CRC_Exported_Macros 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup CRC_Exported_Functions 73 | * @{ 74 | */ 75 | 76 | void CRC_ResetDR(void); 77 | uint32_t CRC_CalcCRC(uint32_t Data); 78 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 79 | uint32_t CRC_GetCRC(void); 80 | void CRC_SetIDRegister(uint8_t IDValue); 81 | uint8_t CRC_GetIDRegister(void); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif /* __STM32F10x_CRC_H */ 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 101 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb/hotplug.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; indent-tabs-mode:nil ; c-basic-offset:8 -*- */ 2 | /* 3 | * Hotplug support for libusb 1.0 4 | * Copyright (C) 2012 Nathan Hjelm 5 | * Copyright (C) 2012 Peter Stuge 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #if !defined(USBI_HOTPLUG_H) 23 | #define USBI_HOTPLUG_H 24 | 25 | /** \ingroup hotplug 26 | * The hotplug callback structure. The user populates this structure with 27 | * libusb_hotplug_prepare_callback() and then calls libusb_hotplug_register_callback() 28 | * to receive notification of hotplug events. 29 | */ 30 | struct libusb_hotplug_callback { 31 | /** Context this callback is associated with */ 32 | struct libusb_context *ctx; 33 | 34 | /** Vendor ID to match or LIBUSB_HOTPLUG_MATCH_ANY */ 35 | int vendor_id; 36 | 37 | /** Product ID to match or LIBUSB_HOTPLUG_MATCH_ANY */ 38 | int product_id; 39 | 40 | /** Device class to match or LIBUSB_HOTPLUG_MATCH_ANY */ 41 | int dev_class; 42 | 43 | /** Hotplug callback flags */ 44 | libusb_hotplug_flag flags; 45 | 46 | /** Event(s) that will trigger this callback */ 47 | libusb_hotplug_event events; 48 | 49 | /** Callback function to invoke for matching event/device */ 50 | libusb_hotplug_callback_fn cb; 51 | 52 | /** Handle for this callback (used to match on deregister) */ 53 | libusb_hotplug_callback_handle handle; 54 | 55 | /** User data that will be passed to the callback function */ 56 | void *user_data; 57 | 58 | /** Callback is marked for deletion */ 59 | int needs_free; 60 | 61 | /** List this callback is registered in (ctx->hotplug_cbs) */ 62 | struct list_head list; 63 | }; 64 | 65 | typedef struct libusb_hotplug_callback libusb_hotplug_callback; 66 | 67 | struct libusb_hotplug_message { 68 | libusb_hotplug_event event; 69 | struct libusb_device *device; 70 | }; 71 | 72 | typedef struct libusb_hotplug_message libusb_hotplug_message; 73 | 74 | void usbi_hotplug_deregister_all(struct libusb_context *ctx); 75 | void usbi_hotplug_match(struct libusb_device *dev, libusb_hotplug_event event); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/jansson_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef JANSSON_PRIVATE_H 9 | #define JANSSON_PRIVATE_H 10 | 11 | #include 12 | #include "jansson.h" 13 | #include "hashtable.h" 14 | #include "strbuffer.h" 15 | 16 | #define container_of(ptr_, type_, member_) \ 17 | ((type_ *)((char *)ptr_ - offsetof(type_, member_))) 18 | 19 | /* On some platforms, max() may already be defined */ 20 | #ifndef max 21 | #define max(a, b) ((a) > (b) ? (a) : (b)) 22 | #endif 23 | 24 | /* va_copy is a C99 feature. In C89 implementations, it's sometimes 25 | available as __va_copy. If not, memcpy() should do the trick. */ 26 | #ifndef va_copy 27 | #ifdef __va_copy 28 | #define va_copy __va_copy 29 | #else 30 | #define va_copy(a, b) memcpy(&(a), &(b), sizeof(va_list)) 31 | #endif 32 | #endif 33 | 34 | typedef struct { 35 | json_t json; 36 | hashtable_t hashtable; 37 | size_t serial; 38 | int visited; 39 | } json_object_t; 40 | 41 | typedef struct { 42 | json_t json; 43 | size_t size; 44 | size_t entries; 45 | json_t **table; 46 | int visited; 47 | } json_array_t; 48 | 49 | typedef struct { 50 | json_t json; 51 | char *value; 52 | } json_string_t; 53 | 54 | typedef struct { 55 | json_t json; 56 | double value; 57 | } json_real_t; 58 | 59 | typedef struct { 60 | json_t json; 61 | json_int_t value; 62 | } json_integer_t; 63 | 64 | #define json_to_object(json_) container_of(json_, json_object_t, json) 65 | #define json_to_array(json_) container_of(json_, json_array_t, json) 66 | #define json_to_string(json_) container_of(json_, json_string_t, json) 67 | #define json_to_real(json_) container_of(json_, json_real_t, json) 68 | #define json_to_integer(json_) container_of(json_, json_integer_t, json) 69 | 70 | void jsonp_error_init(json_error_t *error, const char *source); 71 | void jsonp_error_set_source(json_error_t *error, const char *source); 72 | void jsonp_error_set(json_error_t *error, int line, int column, 73 | size_t position, const char *msg, ...); 74 | void jsonp_error_vset(json_error_t *error, int line, int column, 75 | size_t position, const char *msg, va_list ap); 76 | 77 | /* Locale independent string<->double conversions */ 78 | int jsonp_strtod(strbuffer_t *strbuffer, double *out); 79 | int jsonp_dtostr(char *buffer, size_t size, double value); 80 | 81 | /* Wrappers for custom memory functions */ 82 | void* jsonp_malloc(size_t size); 83 | void jsonp_free(void *ptr); 84 | char *jsonp_strndup(const char *str, size_t length); 85 | char *jsonp_strdup(const char *str); 86 | 87 | /* Windows compatibility */ 88 | #ifdef _WIN32 89 | #define snprintf _snprintf 90 | #define vsnprintf _vsnprintf 91 | #endif 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32_USB-FS-Device_Driver/inc/usb_init.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_init.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Initialization routines & global variables 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_INIT_H 31 | #define __USB_INIT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void USB_Init(void); 39 | 40 | /* External variables --------------------------------------------------------*/ 41 | /* The number of current endpoint, it will be used to specify an endpoint */ 42 | extern uint8_t EPindex; 43 | /* The number of current device, it is an index to the Device_Table */ 44 | /*extern uint8_t Device_no; */ 45 | /* Points to the DEVICE_INFO structure of current device */ 46 | /* The purpose of this register is to speed up the execution */ 47 | extern DEVICE_INFO* pInformation; 48 | /* Points to the DEVICE_PROP structure of current device */ 49 | /* The purpose of this register is to speed up the execution */ 50 | extern DEVICE_PROP* pProperty; 51 | /* Temporary save the state of Rx & Tx status. */ 52 | /* Whenever the Rx or Tx state is changed, its value is saved */ 53 | /* in this variable first and will be set to the EPRB or EPRA */ 54 | /* at the end of interrupt process */ 55 | extern USER_STANDARD_REQUESTS *pUser_Standard_Requests; 56 | 57 | extern uint16_t SaveState ; 58 | extern uint16_t wInterrupt_Mask; 59 | 60 | #endif /* __USB_INIT_H */ 61 | 62 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 63 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Utilities/STM32_EVAL/Common/fonts.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file fonts.h 4 | * @author MCD Application Team 5 | * @version V5.0.2 6 | * @date 05-March-2012 7 | * @brief Header for fonts.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __FONTS_H 30 | #define __FONTS_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include 38 | 39 | /** @addtogroup Utilities 40 | * @{ 41 | */ 42 | 43 | /** @addtogroup STM32_EVAL 44 | * @{ 45 | */ 46 | 47 | /** @addtogroup Common 48 | * @{ 49 | */ 50 | 51 | /** @addtogroup FONTS 52 | * @{ 53 | */ 54 | 55 | /** @defgroup FONTS_Exported_Types 56 | * @{ 57 | */ 58 | typedef struct _tFont 59 | { 60 | const uint16_t *table; 61 | uint16_t Width; 62 | uint16_t Height; 63 | 64 | } sFONT; 65 | 66 | extern sFONT Font16x24; 67 | extern sFONT Font12x12; 68 | extern sFONT Font8x12; 69 | extern sFONT Font8x8; 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup FONTS_Exported_Constants 76 | * @{ 77 | */ 78 | #define LINE(x) ((x) * (((sFONT *)LCD_GetFont())->Height)) 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup FONTS_Exported_Macros 85 | * @{ 86 | */ 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @defgroup FONTS_Exported_Functions 92 | * @{ 93 | */ 94 | /** 95 | * @} 96 | */ 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | 102 | #endif /* __FONTS_H */ 103 | 104 | /** 105 | * @} 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** 117 | * @} 118 | */ 119 | 120 | /** 121 | * @} 122 | */ 123 | 124 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 125 | -------------------------------------------------------------------------------- /software/cgminer/sha2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FIPS 180-2 SHA-224/256/384/512 implementation 3 | * Last update: 02/02/2007 4 | * Issue date: 04/30/2005 5 | * 6 | * Copyright (C) 2013, Con Kolivas 7 | * Copyright (C) 2005, 2007 Olivier Gay 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. Neither the name of the project nor the names of its contributors 19 | * may be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 | * SUCH DAMAGE. 33 | */ 34 | 35 | #include "config.h" 36 | #include "miner.h" 37 | 38 | #ifndef SHA2_H 39 | #define SHA2_H 40 | 41 | #define SHA256_DIGEST_SIZE ( 256 / 8) 42 | #define SHA256_BLOCK_SIZE ( 512 / 8) 43 | 44 | #define SHFR(x, n) (x >> n) 45 | #define ROTR(x, n) ((x >> n) | (x << ((sizeof(x) << 3) - n))) 46 | #define CH(x, y, z) ((x & y) ^ (~x & z)) 47 | #define MAJ(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) 48 | 49 | #define SHA256_F1(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) 50 | #define SHA256_F2(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) 51 | #define SHA256_F3(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHFR(x, 3)) 52 | #define SHA256_F4(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHFR(x, 10)) 53 | 54 | typedef struct { 55 | unsigned int tot_len; 56 | unsigned int len; 57 | unsigned char block[2 * SHA256_BLOCK_SIZE]; 58 | uint32_t h[8]; 59 | } sha256_ctx; 60 | 61 | extern uint32_t sha256_k[64]; 62 | 63 | void sha256_init(sha256_ctx * ctx); 64 | void sha256_update(sha256_ctx *ctx, const unsigned char *message, 65 | unsigned int len); 66 | void sha256_final(sha256_ctx *ctx, unsigned char *digest); 67 | void sha256(const unsigned char *message, unsigned int len, 68 | unsigned char *digest); 69 | 70 | #endif /* !SHA2_H */ 71 | -------------------------------------------------------------------------------- /software/cgminer/logging.h: -------------------------------------------------------------------------------- 1 | #ifndef __LOGGING_H__ 2 | #define __LOGGING_H__ 3 | 4 | #include "config.h" 5 | #include 6 | #include 7 | 8 | #ifdef HAVE_SYSLOG_H 9 | #include 10 | #else 11 | enum { 12 | LOG_ERR, 13 | LOG_WARNING, 14 | LOG_NOTICE, 15 | LOG_INFO, 16 | LOG_DEBUG, 17 | }; 18 | #endif 19 | 20 | /* debug flags */ 21 | extern bool opt_debug; 22 | extern bool opt_log_output; 23 | extern bool opt_realquiet; 24 | extern bool want_per_device_stats; 25 | 26 | /* global log_level, messages with lower or equal prio are logged */ 27 | extern int opt_log_level; 28 | 29 | #define LOGBUFSIZ 256 30 | 31 | extern void _applog(int prio, const char *str, bool force); 32 | 33 | #define IN_FMT_FFL " in %s %s():%d" 34 | 35 | #define applog(prio, fmt, ...) do { \ 36 | if (opt_debug || prio != LOG_DEBUG) { \ 37 | if (use_syslog || opt_log_output || prio <= opt_log_level) { \ 38 | char tmp42[LOGBUFSIZ]; \ 39 | snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ 40 | _applog(prio, tmp42, false); \ 41 | } \ 42 | } \ 43 | } while (0) 44 | 45 | #define applogsiz(prio, _SIZ, fmt, ...) do { \ 46 | if (opt_debug || prio != LOG_DEBUG) { \ 47 | if (use_syslog || opt_log_output || prio <= opt_log_level) { \ 48 | char tmp42[_SIZ]; \ 49 | snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ 50 | _applog(prio, tmp42, false); \ 51 | } \ 52 | } \ 53 | } while (0) 54 | 55 | #define forcelog(prio, fmt, ...) do { \ 56 | if (opt_debug || prio != LOG_DEBUG) { \ 57 | if (use_syslog || opt_log_output || prio <= opt_log_level) { \ 58 | char tmp42[LOGBUFSIZ]; \ 59 | snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ 60 | _applog(prio, tmp42, true); \ 61 | } \ 62 | } \ 63 | } while (0) 64 | 65 | #define quit(status, fmt, ...) do { \ 66 | if (fmt) { \ 67 | char tmp42[LOGBUFSIZ]; \ 68 | snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ 69 | _applog(LOG_ERR, tmp42, true); \ 70 | } \ 71 | _quit(status); \ 72 | } while (0) 73 | 74 | #define quithere(status, fmt, ...) do { \ 75 | if (fmt) { \ 76 | char tmp42[LOGBUFSIZ]; \ 77 | snprintf(tmp42, sizeof(tmp42), fmt IN_FMT_FFL, \ 78 | ##__VA_ARGS__, __FILE__, __func__, __LINE__); \ 79 | _applog(LOG_ERR, tmp42, true); \ 80 | } \ 81 | _quit(status); \ 82 | } while (0) 83 | 84 | #define quitfrom(status, _file, _func, _line, fmt, ...) do { \ 85 | if (fmt) { \ 86 | char tmp42[LOGBUFSIZ]; \ 87 | snprintf(tmp42, sizeof(tmp42), fmt IN_FMT_FFL, \ 88 | ##__VA_ARGS__, _file, _func, _line); \ 89 | _applog(LOG_ERR, tmp42, true); \ 90 | } \ 91 | _quit(status); \ 92 | } while (0) 93 | 94 | #ifdef HAVE_CURSES 95 | 96 | #define wlog(fmt, ...) do { \ 97 | char tmp42[LOGBUFSIZ]; \ 98 | snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ 99 | _wlog(tmp42); \ 100 | } while (0) 101 | 102 | #define wlogprint(fmt, ...) do { \ 103 | char tmp42[LOGBUFSIZ]; \ 104 | snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ 105 | _wlogprint(tmp42); \ 106 | } while (0) 107 | 108 | #endif 109 | 110 | #endif /* __LOGGING_H__ */ 111 | -------------------------------------------------------------------------------- /software/cpuminer/README: -------------------------------------------------------------------------------- 1 | This is a multi-threaded CPU miner for Litecoin and Bitcoin, 2 | fork of Jeff Garzik's reference cpuminer. 3 | 4 | License: GPLv2. See COPYING for details. 5 | 6 | Downloads: https://sourceforge.net/projects/cpuminer/files/ 7 | Git tree: https://github.com/pooler/cpuminer 8 | 9 | Dependencies: 10 | libcurl http://curl.haxx.se/libcurl/ 11 | jansson http://www.digip.org/jansson/ 12 | (jansson is included in-tree) 13 | 14 | Basic *nix build instructions: 15 | ./autogen.sh # only needed if building from git repo 16 | ./nomacro.pl # only needed if building on Mac OS X or with Clang 17 | ./configure CFLAGS="-O3" 18 | make 19 | 20 | Notes for AIX users: 21 | * To build a 64-bit binary, export OBJECT_MODE=64 22 | * GNU-style long options are not supported, but are accessible 23 | via configuration file 24 | 25 | Basic Windows build instructions, using MinGW: 26 | Install MinGW and the MSYS Developer Tool Kit (http://www.mingw.org/) 27 | * Make sure you have mstcpip.h in MinGW\include 28 | If using MinGW-w64, install pthreads-w64 29 | Install libcurl devel (http://curl.haxx.se/download.html) 30 | * Make sure you have libcurl.m4 in MinGW\share\aclocal 31 | * Make sure you have curl-config in MinGW\bin 32 | In the MSYS shell, run: 33 | ./autogen.sh # only needed if building from git repo 34 | LIBCURL="-lcurldll" ./configure CFLAGS="-O3" 35 | make 36 | 37 | Architecture-specific notes: 38 | ARM: No runtime CPU detection. The miner can take advantage 39 | of some instructions specific to ARMv5E and later processors, 40 | but the decision whether to use them is made at compile time, 41 | based on compiler-defined macros. 42 | To use NEON instructions, add "-mfpu=neon" to CFLAGS. 43 | x86: The miner checks for SSE2 instructions support at runtime, 44 | and uses them if they are available. 45 | x86-64: The miner can take advantage of AVX, AVX2 and XOP instructions, 46 | but only if both the CPU and the operating system support them. 47 | * Linux supports AVX starting from kernel version 2.6.30. 48 | * FreeBSD supports AVX starting with 9.1-RELEASE. 49 | * Mac OS X added AVX support in the 10.6.8 update. 50 | * Windows supports AVX starting from Windows 7 SP1 and 51 | Windows Server 2008 R2 SP1. 52 | The configure script outputs a warning if the assembler 53 | doesn't support some instruction sets. In that case, the miner 54 | can still be built, but unavailable optimizations are left off. 55 | 56 | Usage instructions: Run "minerd --help" to see options. 57 | 58 | Connecting through a proxy: Use the --proxy option. 59 | To use a SOCKS proxy, add a socks4:// or socks5:// prefix to the proxy host. 60 | Protocols socks4a and socks5h, allowing remote name resolving, are also 61 | available since libcurl 7.18.0. 62 | If no protocol is specified, the proxy is assumed to be a HTTP proxy. 63 | When the --proxy option is not used, the program honors the http_proxy 64 | and all_proxy environment variables. 65 | 66 | Also many issues and FAQs are covered in the forum thread 67 | dedicated to this program, 68 | https://bitcointalk.org/index.php?topic=55038.0 69 | -------------------------------------------------------------------------------- /software/cgminer/lib/stddef.in.h: -------------------------------------------------------------------------------- 1 | /* A substitute for POSIX 2008 , for platforms that have issues. 2 | 3 | Copyright (C) 2009-2011 Free Software Foundation, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software Foundation, 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 18 | 19 | /* Written by Eric Blake. */ 20 | 21 | /* 22 | * POSIX 2008 for platforms that have issues. 23 | * 24 | */ 25 | 26 | #if __GNUC__ >= 3 27 | @PRAGMA_SYSTEM_HEADER@ 28 | #endif 29 | @PRAGMA_COLUMNS@ 30 | 31 | #if defined __need_wchar_t || defined __need_size_t \ 32 | || defined __need_ptrdiff_t || defined __need_NULL \ 33 | || defined __need_wint_t 34 | /* Special invocation convention inside gcc header files. In 35 | particular, gcc provides a version of that blindly 36 | redefines NULL even when __need_wint_t was defined, even though 37 | wint_t is not normally provided by . Hence, we must 38 | remember if special invocation has ever been used to obtain wint_t, 39 | in which case we need to clean up NULL yet again. */ 40 | 41 | # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) 42 | # ifdef __need_wint_t 43 | # undef _@GUARD_PREFIX@_STDDEF_H 44 | # define _GL_STDDEF_WINT_T 45 | # endif 46 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ 47 | # endif 48 | 49 | #else 50 | /* Normal invocation convention. */ 51 | 52 | # ifndef _@GUARD_PREFIX@_STDDEF_H 53 | 54 | /* The include_next requires a split double-inclusion guard. */ 55 | 56 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ 57 | 58 | # ifndef _@GUARD_PREFIX@_STDDEF_H 59 | # define _@GUARD_PREFIX@_STDDEF_H 60 | 61 | /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ 62 | #if @REPLACE_NULL@ 63 | # undef NULL 64 | # ifdef __cplusplus 65 | /* ISO C++ says that the macro NULL must expand to an integer constant 66 | expression, hence '((void *) 0)' is not allowed in C++. */ 67 | # if __GNUG__ >= 3 68 | /* GNU C++ has a __null macro that behaves like an integer ('int' or 69 | 'long') but has the same size as a pointer. Use that, to avoid 70 | warnings. */ 71 | # define NULL __null 72 | # else 73 | # define NULL 0L 74 | # endif 75 | # else 76 | # define NULL ((void *) 0) 77 | # endif 78 | #endif 79 | 80 | /* Some platforms lack wchar_t. */ 81 | #if !@HAVE_WCHAR_T@ 82 | # define wchar_t int 83 | #endif 84 | 85 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ 86 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ 87 | #endif /* __need_XXX */ 88 | -------------------------------------------------------------------------------- /software/cgminer/m4/memchr.m4: -------------------------------------------------------------------------------- 1 | # memchr.m4 serial 12 2 | dnl Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN_ONCE([gl_FUNC_MEMCHR], 8 | [ 9 | dnl Check for prerequisites for memory fence checks. 10 | gl_FUNC_MMAP_ANON 11 | AC_CHECK_HEADERS_ONCE([sys/mman.h]) 12 | AC_CHECK_FUNCS_ONCE([mprotect]) 13 | 14 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 15 | m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [ 16 | dnl These days, we assume memchr is present. But if support for old 17 | dnl platforms is desired: 18 | AC_CHECK_FUNCS_ONCE([memchr]) 19 | if test $ac_cv_func_memchr = no; then 20 | HAVE_MEMCHR=0 21 | fi 22 | ]) 23 | if test $HAVE_MEMCHR = 1; then 24 | # Detect platform-specific bugs in some versions of glibc: 25 | # memchr should not dereference anything with length 0 26 | # http://bugzilla.redhat.com/499689 27 | # memchr should not dereference overestimated length after a match 28 | # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 29 | # http://sourceware.org/bugzilla/show_bug.cgi?id=10162 30 | # Assume that memchr works on platforms that lack mprotect. 31 | AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], 32 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 33 | #include 34 | #if HAVE_SYS_MMAN_H 35 | # include 36 | # include 37 | # include 38 | # include 39 | # ifndef MAP_FILE 40 | # define MAP_FILE 0 41 | # endif 42 | #endif 43 | ]], [[ 44 | int result = 0; 45 | char *fence = NULL; 46 | #if HAVE_SYS_MMAN_H && HAVE_MPROTECT 47 | # if HAVE_MAP_ANONYMOUS 48 | const int flags = MAP_ANONYMOUS | MAP_PRIVATE; 49 | const int fd = -1; 50 | # else /* !HAVE_MAP_ANONYMOUS */ 51 | const int flags = MAP_FILE | MAP_PRIVATE; 52 | int fd = open ("/dev/zero", O_RDONLY, 0666); 53 | if (fd >= 0) 54 | # endif 55 | { 56 | int pagesize = getpagesize (); 57 | char *two_pages = 58 | (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, 59 | flags, fd, 0); 60 | if (two_pages != (char *)(-1) 61 | && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) 62 | fence = two_pages + pagesize; 63 | } 64 | #endif 65 | if (fence) 66 | { 67 | if (memchr (fence, 0, 0)) 68 | result |= 1; 69 | strcpy (fence - 9, "12345678"); 70 | if (memchr (fence - 9, 0, 79) != fence - 1) 71 | result |= 2; 72 | if (memchr (fence - 1, 0, 3) != fence - 1) 73 | result |= 4; 74 | } 75 | return result; 76 | ]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], 77 | [dnl Be pessimistic for now. 78 | gl_cv_func_memchr_works="guessing no"])]) 79 | if test "$gl_cv_func_memchr_works" != yes; then 80 | REPLACE_MEMCHR=1 81 | fi 82 | fi 83 | ]) 84 | 85 | # Prerequisites of lib/memchr.c. 86 | AC_DEFUN([gl_PREREQ_MEMCHR], [ 87 | AC_CHECK_HEADERS([bp-sym.h]) 88 | ]) 89 | -------------------------------------------------------------------------------- /software/cgminer/lib/memmem.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2011 Free Software 2 | Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 18 | 19 | /* This particular implementation was written by Eric Blake, 2008. */ 20 | 21 | #ifndef _LIBC 22 | # include 23 | #endif 24 | 25 | /* Specification of memmem. */ 26 | #include 27 | 28 | #ifndef _LIBC 29 | # define __builtin_expect(expr, val) (expr) 30 | #endif 31 | 32 | #define RETURN_TYPE void * 33 | #define AVAILABLE(h, h_l, j, n_l) ((j) <= (h_l) - (n_l)) 34 | #include "str-two-way.h" 35 | 36 | /* Return the first occurrence of NEEDLE in HAYSTACK. Return HAYSTACK 37 | if NEEDLE_LEN is 0, otherwise NULL if NEEDLE is not found in 38 | HAYSTACK. */ 39 | void * 40 | memmem (const void *haystack_start, size_t haystack_len, 41 | const void *needle_start, size_t needle_len) 42 | { 43 | /* Abstract memory is considered to be an array of 'unsigned char' values, 44 | not an array of 'char' values. See ISO C 99 section 6.2.6.1. */ 45 | const unsigned char *haystack = (const unsigned char *) haystack_start; 46 | const unsigned char *needle = (const unsigned char *) needle_start; 47 | 48 | if (needle_len == 0) 49 | /* The first occurrence of the empty string is deemed to occur at 50 | the beginning of the string. */ 51 | return (void *) haystack; 52 | 53 | /* Sanity check, otherwise the loop might search through the whole 54 | memory. */ 55 | if (__builtin_expect (haystack_len < needle_len, 0)) 56 | return NULL; 57 | 58 | /* Use optimizations in memchr when possible, to reduce the search 59 | size of haystack using a linear algorithm with a smaller 60 | coefficient. However, avoid memchr for long needles, since we 61 | can often achieve sublinear performance. */ 62 | if (needle_len < LONG_NEEDLE_THRESHOLD) 63 | { 64 | haystack = memchr (haystack, *needle, haystack_len); 65 | if (!haystack || __builtin_expect (needle_len == 1, 0)) 66 | return (void *) haystack; 67 | haystack_len -= haystack - (const unsigned char *) haystack_start; 68 | if (haystack_len < needle_len) 69 | return NULL; 70 | return two_way_short_needle (haystack, haystack_len, needle, needle_len); 71 | } 72 | else 73 | return two_way_long_needle (haystack, haystack_len, needle, needle_len); 74 | } 75 | 76 | #undef LONG_NEEDLE_THRESHOLD 77 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Utilities/STM32_EVAL/STM3210E_EVAL/stm3210e_eval_fsmc_sram.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm3210e_eval_fsmc_sram.h 4 | * @author MCD Application Team 5 | * @version V5.1.0 6 | * @date 18-January-2013 7 | * @brief This file contains all the functions prototypes for the 8 | * stm3210e_eval_fsmc_sram firmware driver. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2013 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM3210E_EVAL_FSMC_SRAM_H 31 | #define __STM3210E_EVAL_FSMC_SRAM_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup Utilities 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup STM32_EVAL 45 | * @{ 46 | */ 47 | 48 | /** @addtogroup STM3210E_EVAL 49 | * @{ 50 | */ 51 | 52 | /** @addtogroup STM3210E_EVAL_FSMC_SRAM 53 | * @{ 54 | */ 55 | 56 | /** @defgroup STM3210E_EVAL_FSMC_SRAM_Exported_Types 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | /** @defgroup STM3210E_EVAL_FSMC_SRAM_Exported_Constants 64 | * @{ 65 | */ 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup STM3210E_EVAL_FSMC_SRAM_Exported_Macros 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup STM3210E_EVAL_FSMC_SRAM_Exported_Functions 78 | * @{ 79 | */ 80 | 81 | void SRAM_Init(void); 82 | void SRAM_WriteBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite); 83 | void SRAM_ReadBuffer(uint16_t* pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /* __STM3210E_EVAL_FSMC_SRAM_H */ 90 | /** 91 | * @} 92 | */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 111 | -------------------------------------------------------------------------------- /software/cgminer/compat/libusb-1.0/libusb/os/threads_windows.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libusb synchronization on Microsoft Windows 3 | * 4 | * Copyright (C) 2010 Michael Plante 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef LIBUSB_THREADS_WINDOWS_H 22 | #define LIBUSB_THREADS_WINDOWS_H 23 | 24 | #include 25 | 26 | #define usbi_mutex_static_t volatile LONG 27 | #define USBI_MUTEX_INITIALIZER 0 28 | 29 | #define usbi_mutex_t HANDLE 30 | 31 | struct usbi_cond_perthread { 32 | struct list_head list; 33 | DWORD tid; 34 | HANDLE event; 35 | }; 36 | struct usbi_cond_t_ { 37 | // Every time a thread touches the CV, it winds up in one of these lists. 38 | // It stays there until the CV is destroyed, even if the thread 39 | // terminates. 40 | struct list_head waiters; 41 | struct list_head not_waiting; 42 | }; 43 | typedef struct usbi_cond_t_ usbi_cond_t; 44 | 45 | // We *were* getting timespec from pthread.h: 46 | #if (!defined(HAVE_STRUCT_TIMESPEC) && !defined(_TIMESPEC_DEFINED)) 47 | #define HAVE_STRUCT_TIMESPEC 1 48 | #define _TIMESPEC_DEFINED 1 49 | struct timespec { 50 | long tv_sec; 51 | long tv_nsec; 52 | }; 53 | #endif /* HAVE_STRUCT_TIMESPEC | _TIMESPEC_DEFINED */ 54 | 55 | // We *were* getting ETIMEDOUT from pthread.h: 56 | #ifndef ETIMEDOUT 57 | # define ETIMEDOUT 10060 /* This is the value in winsock.h. */ 58 | #endif 59 | 60 | #define usbi_mutexattr_t void 61 | #define usbi_condattr_t void 62 | 63 | // all Windows mutexes are recursive 64 | #define usbi_mutex_init_recursive(mutex, attr) usbi_mutex_init((mutex), (attr)) 65 | 66 | int usbi_mutex_static_lock(usbi_mutex_static_t *mutex); 67 | int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex); 68 | 69 | 70 | int usbi_mutex_init(usbi_mutex_t *mutex, 71 | const usbi_mutexattr_t *attr); 72 | int usbi_mutex_lock(usbi_mutex_t *mutex); 73 | int usbi_mutex_unlock(usbi_mutex_t *mutex); 74 | int usbi_mutex_trylock(usbi_mutex_t *mutex); 75 | int usbi_mutex_destroy(usbi_mutex_t *mutex); 76 | 77 | int usbi_cond_init(usbi_cond_t *cond, 78 | const usbi_condattr_t *attr); 79 | int usbi_cond_destroy(usbi_cond_t *cond); 80 | int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex); 81 | int usbi_cond_timedwait(usbi_cond_t *cond, 82 | usbi_mutex_t *mutex, 83 | const struct timespec *abstime); 84 | int usbi_cond_broadcast(usbi_cond_t *cond); 85 | int usbi_cond_signal(usbi_cond_t *cond); 86 | 87 | #endif /* LIBUSB_THREADS_WINDOWS_H */ 88 | 89 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/usb_istr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_istr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file includes the peripherals header files in the user application. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_ISTR_H 31 | #define __USB_ISTR_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void USB_Istr(void); 42 | 43 | /* function prototypes Automatically built defining related macros */ 44 | 45 | void EP1_IN_Callback(void); 46 | void EP2_IN_Callback(void); 47 | void EP3_IN_Callback(void); 48 | void EP4_IN_Callback(void); 49 | void EP5_IN_Callback(void); 50 | void EP6_IN_Callback(void); 51 | void EP7_IN_Callback(void); 52 | 53 | void EP1_OUT_Callback(void); 54 | void EP2_OUT_Callback(void); 55 | void EP3_OUT_Callback(void); 56 | void EP4_OUT_Callback(void); 57 | void EP5_OUT_Callback(void); 58 | void EP6_OUT_Callback(void); 59 | void EP7_OUT_Callback(void); 60 | 61 | #ifdef CTR_CALLBACK 62 | void CTR_Callback(void); 63 | #endif 64 | 65 | #ifdef DOVR_CALLBACK 66 | void DOVR_Callback(void); 67 | #endif 68 | 69 | #ifdef ERR_CALLBACK 70 | void ERR_Callback(void); 71 | #endif 72 | 73 | #ifdef WKUP_CALLBACK 74 | void WKUP_Callback(void); 75 | #endif 76 | 77 | #ifdef SUSP_CALLBACK 78 | void SUSP_Callback(void); 79 | #endif 80 | 81 | #ifdef RESET_CALLBACK 82 | void RESET_Callback(void); 83 | #endif 84 | 85 | #ifdef SOF_CALLBACK 86 | void SOF_Callback(void); 87 | #endif 88 | 89 | #ifdef ESOF_CALLBACK 90 | void ESOF_Callback(void); 91 | #endif 92 | #endif /*__USB_ISTR_H*/ 93 | 94 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /software/cgminer/ccan/opt/usage.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "private.h" 7 | 8 | /* We only use this for pointer comparisons. */ 9 | const char opt_hidden[1]; 10 | 11 | static unsigned write_short_options(char *str) 12 | { 13 | unsigned int i, num = 0; 14 | const char *p; 15 | 16 | for (p = first_sopt(&i); p; p = next_sopt(p, &i)) { 17 | if (opt_table[i].desc != opt_hidden) 18 | str[num++] = *p; 19 | } 20 | return num; 21 | } 22 | 23 | #define OPT_SPACE_PAD " " 24 | 25 | /* FIXME: Get all purdy. */ 26 | char *opt_usage(const char *argv0, const char *extra) 27 | { 28 | unsigned int i, num, len; 29 | char *ret, *p; 30 | 31 | if (!extra) { 32 | extra = ""; 33 | for (i = 0; i < opt_count; i++) { 34 | if (opt_table[i].cb == (void *)opt_usage_and_exit 35 | && opt_table[i].u.carg) { 36 | extra = opt_table[i].u.carg; 37 | break; 38 | } 39 | } 40 | } 41 | 42 | /* An overestimate of our length. */ 43 | len = strlen("Usage: %s ") + strlen(argv0) 44 | + strlen("[-%.*s]") + opt_num_short + 1 45 | + strlen(" ") + strlen(extra) 46 | + strlen("\n"); 47 | 48 | for (i = 0; i < opt_count; i++) { 49 | if (opt_table[i].type == OPT_SUBTABLE) { 50 | len += strlen("\n") + strlen(opt_table[i].desc) 51 | + strlen(":\n"); 52 | } else if (opt_table[i].desc != opt_hidden) { 53 | len += strlen(opt_table[i].names) + strlen(" "); 54 | len += strlen(OPT_SPACE_PAD) 55 | + strlen(opt_table[i].desc) + 1; 56 | if (opt_table[i].show) { 57 | len += strlen("(default: %s)") 58 | + OPT_SHOW_LEN + sizeof("..."); 59 | } 60 | len += strlen("\n"); 61 | } 62 | } 63 | 64 | p = ret = malloc(len); 65 | if (!ret) 66 | return NULL; 67 | 68 | p += sprintf(p, "Usage: %s", argv0); 69 | p += sprintf(p, " [-"); 70 | num = write_short_options(p); 71 | if (num) { 72 | p += num; 73 | p += sprintf(p, "]"); 74 | } else { 75 | /* Remove start of single-entry options */ 76 | p -= 3; 77 | } 78 | if (extra) 79 | p += sprintf(p, " %s", extra); 80 | p += sprintf(p, "\n"); 81 | 82 | for (i = 0; i < opt_count; i++) { 83 | if (opt_table[i].desc == opt_hidden) 84 | continue; 85 | if (opt_table[i].type == OPT_SUBTABLE) { 86 | p += sprintf(p, "%s:\n", opt_table[i].desc); 87 | continue; 88 | } 89 | len = sprintf(p, "%s", opt_table[i].names); 90 | if (opt_table[i].type == OPT_HASARG 91 | && !strchr(opt_table[i].names, ' ') 92 | && !strchr(opt_table[i].names, '=')) 93 | len += sprintf(p + len, " "); 94 | len += sprintf(p + len, "%.*s", 95 | len < strlen(OPT_SPACE_PAD) 96 | ? (unsigned)strlen(OPT_SPACE_PAD) - len : 1, 97 | OPT_SPACE_PAD); 98 | 99 | len += sprintf(p + len, "%s", opt_table[i].desc); 100 | if (opt_table[i].show) { 101 | char buf[OPT_SHOW_LEN + sizeof("...")]; 102 | strcpy(buf + OPT_SHOW_LEN, "..."); 103 | opt_table[i].show(buf, opt_table[i].u.arg); 104 | len += sprintf(p + len, " (default: %s)", buf); 105 | } 106 | p += len; 107 | p += sprintf(p, "\n"); 108 | } 109 | *p = '\0'; 110 | return ret; 111 | } 112 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/strbuffer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef _GNU_SOURCE 9 | #define _GNU_SOURCE 10 | #endif 11 | 12 | #include 13 | #include 14 | #include "jansson_private.h" 15 | #include "strbuffer.h" 16 | 17 | #define STRBUFFER_MIN_SIZE 16 18 | #define STRBUFFER_FACTOR 2 19 | #define STRBUFFER_SIZE_MAX ((size_t)-1) 20 | 21 | int strbuffer_init(strbuffer_t *strbuff) 22 | { 23 | strbuff->size = STRBUFFER_MIN_SIZE; 24 | strbuff->length = 0; 25 | 26 | strbuff->value = jsonp_malloc(strbuff->size); 27 | if(!strbuff->value) 28 | return -1; 29 | 30 | /* initialize to empty */ 31 | strbuff->value[0] = '\0'; 32 | return 0; 33 | } 34 | 35 | void strbuffer_close(strbuffer_t *strbuff) 36 | { 37 | if(strbuff->value) 38 | jsonp_free(strbuff->value); 39 | 40 | strbuff->size = 0; 41 | strbuff->length = 0; 42 | strbuff->value = NULL; 43 | } 44 | 45 | void strbuffer_clear(strbuffer_t *strbuff) 46 | { 47 | strbuff->length = 0; 48 | strbuff->value[0] = '\0'; 49 | } 50 | 51 | const char *strbuffer_value(const strbuffer_t *strbuff) 52 | { 53 | return strbuff->value; 54 | } 55 | 56 | char *strbuffer_steal_value(strbuffer_t *strbuff) 57 | { 58 | char *result = strbuff->value; 59 | strbuff->value = NULL; 60 | return result; 61 | } 62 | 63 | int strbuffer_append(strbuffer_t *strbuff, const char *string) 64 | { 65 | return strbuffer_append_bytes(strbuff, string, strlen(string)); 66 | } 67 | 68 | int strbuffer_append_byte(strbuffer_t *strbuff, char byte) 69 | { 70 | return strbuffer_append_bytes(strbuff, &byte, 1); 71 | } 72 | 73 | int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size) 74 | { 75 | if(size >= strbuff->size - strbuff->length) 76 | { 77 | size_t new_size; 78 | char *new_value; 79 | 80 | /* avoid integer overflow */ 81 | if (strbuff->size > STRBUFFER_SIZE_MAX / STRBUFFER_FACTOR 82 | || size > STRBUFFER_SIZE_MAX - 1 83 | || strbuff->length > STRBUFFER_SIZE_MAX - 1 - size) 84 | return -1; 85 | 86 | new_size = max(strbuff->size * STRBUFFER_FACTOR, 87 | strbuff->length + size + 1); 88 | 89 | new_value = jsonp_malloc(new_size); 90 | if(!new_value) 91 | return -1; 92 | 93 | memcpy(new_value, strbuff->value, strbuff->length); 94 | 95 | jsonp_free(strbuff->value); 96 | strbuff->value = new_value; 97 | strbuff->size = new_size; 98 | } 99 | 100 | memcpy(strbuff->value + strbuff->length, data, size); 101 | strbuff->length += size; 102 | strbuff->value[strbuff->length] = '\0'; 103 | 104 | return 0; 105 | } 106 | 107 | char strbuffer_pop(strbuffer_t *strbuff) 108 | { 109 | if(strbuff->length > 0) { 110 | char c = strbuff->value[--strbuff->length]; 111 | strbuff->value[strbuff->length] = '\0'; 112 | return c; 113 | } 114 | else 115 | return '\0'; 116 | } 117 | -------------------------------------------------------------------------------- /software/cgminer/fpgautils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Luke Dashjr 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation; either version 3 of the License, or (at your option) 7 | * any later version. See COPYING for more details. 8 | */ 9 | 10 | #ifndef FPGAUTILS_H 11 | #define FPGAUTILS_H 12 | 13 | #include 14 | #include 15 | 16 | typedef bool(*detectone_func_t)(const char*); 17 | typedef int(*autoscan_func_t)(); 18 | 19 | extern int _serial_detect(struct device_drv *drv, detectone_func_t, autoscan_func_t, bool force_autoscan); 20 | #define serial_detect_fauto(drv, detectone, autoscan) \ 21 | _serial_detect(drv, detectone, autoscan, true) 22 | #define serial_detect_auto(drv, detectone, autoscan) \ 23 | _serial_detect(drv, detectone, autoscan, false) 24 | #define serial_detect(drv, detectone) \ 25 | _serial_detect(drv, detectone, NULL, false) 26 | extern int serial_autodetect_devserial(detectone_func_t, const char *prodname); 27 | extern int serial_autodetect_udev(detectone_func_t, const char *prodname); 28 | 29 | extern int serial_open(const char *devpath, unsigned long baud, signed short timeout, bool purge); 30 | extern ssize_t _serial_read(int fd, char *buf, size_t buflen, char *eol); 31 | #define serial_read(fd, buf, count) \ 32 | _serial_read(fd, (char*)(buf), count, NULL) 33 | #define serial_read_line(fd, buf, bufsiz, eol) \ 34 | _serial_read(fd, buf, bufsiz, &eol) 35 | #define serial_close(fd) close(fd) 36 | 37 | extern FILE *open_bitstream(const char *dname, const char *filename); 38 | 39 | extern int get_serial_cts(int fd); 40 | 41 | #ifndef WIN32 42 | extern const struct timeval tv_timeout_default; 43 | extern const struct timeval tv_inter_char_default; 44 | 45 | extern size_t _select_read(int fd, char *buf, size_t bufsiz, struct timeval *timeout, struct timeval *char_timeout, int finished); 46 | extern size_t _select_write(int fd, char *buf, size_t siz, struct timeval *timeout); 47 | 48 | #define select_open(devpath) \ 49 | serial_open(devpath, 0, 0, false) 50 | 51 | #define select_open_purge(devpath, purge)\ 52 | serial_open(devpath, 0, 0, purge) 53 | 54 | #define select_write(fd, buf, siz) \ 55 | _select_write(fd, buf, siz, (struct timeval *)(&tv_timeout_default)) 56 | 57 | #define select_write_full _select_write 58 | 59 | #define select_read(fd, buf, bufsiz) \ 60 | _select_read(fd, buf, bufsiz, (struct timeval *)(&tv_timeout_default), \ 61 | (struct timeval *)(&tv_inter_char_default), -1) 62 | 63 | #define select_read_til(fd, buf, bufsiz, eol) \ 64 | _select_read(fd, buf, bufsiz, (struct timeval *)(&tv_timeout_default), \ 65 | (struct timeval *)(&tv_inter_char_default), eol) 66 | 67 | #define select_read_wait(fd, buf, bufsiz, timeout) \ 68 | _select_read(fd, buf, bufsiz, timeout, \ 69 | (struct timeval *)(&tv_inter_char_default), -1) 70 | 71 | #define select_read_wait_til(fd, buf, bufsiz, timeout, eol) \ 72 | _select_read(fd, buf, bufsiz, timeout, \ 73 | (struct timeval *)(&tv_inter_char_default), eol) 74 | 75 | #define select_read_wait_both(fd, buf, bufsiz, timeout, char_timeout) \ 76 | _select_read(fd, buf, bufsiz, timeout, char_timeout, -1) 77 | 78 | #define select_read_full _select_read 79 | 80 | #define select_close(fd) close(fd) 81 | 82 | #endif // ! WIN32 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/usb_desc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_desc.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Descriptor Header for Virtual COM Port Device 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_DESC_H 31 | #define __USB_DESC_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported define -----------------------------------------------------------*/ 38 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 39 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 40 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 41 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 42 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 43 | 44 | #define VIRTUAL_COM_PORT_DATA_SIZE 64 45 | #define VIRTUAL_COM_PORT_INT_SIZE 8 46 | 47 | #define VIRTUAL_COM_PORT_SIZ_DEVICE_DESC 18 48 | #define VIRTUAL_COM_PORT_SIZ_CONFIG_DESC 67 49 | #define VIRTUAL_COM_PORT_SIZ_STRING_LANGID 4 50 | #define VIRTUAL_COM_PORT_SIZ_STRING_VENDOR 38 51 | #define VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT 50 52 | #define VIRTUAL_COM_PORT_SIZ_STRING_SERIAL 26 53 | 54 | #define STANDARD_ENDPOINT_DESC_SIZE 0x09 55 | 56 | /* Exported functions ------------------------------------------------------- */ 57 | extern const uint8_t Virtual_Com_Port_DeviceDescriptor[VIRTUAL_COM_PORT_SIZ_DEVICE_DESC]; 58 | extern const uint8_t Virtual_Com_Port_ConfigDescriptor[VIRTUAL_COM_PORT_SIZ_CONFIG_DESC]; 59 | 60 | extern const uint8_t Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID]; 61 | extern const uint8_t Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR]; 62 | extern const uint8_t Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT]; 63 | extern uint8_t Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL]; 64 | 65 | #endif /* __USB_DESC_H */ 66 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 67 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32_USB-FS-Device_Driver/inc/usb_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_def.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Definitions related to USB Core 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_DEF_H 30 | #define __USB_DEF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Exported types ------------------------------------------------------------*/ 34 | typedef enum _RECIPIENT_TYPE 35 | { 36 | DEVICE_RECIPIENT, /* Recipient device */ 37 | INTERFACE_RECIPIENT, /* Recipient interface */ 38 | ENDPOINT_RECIPIENT, /* Recipient endpoint */ 39 | OTHER_RECIPIENT 40 | } RECIPIENT_TYPE; 41 | 42 | 43 | typedef enum _STANDARD_REQUESTS 44 | { 45 | GET_STATUS = 0, 46 | CLEAR_FEATURE, 47 | RESERVED1, 48 | SET_FEATURE, 49 | RESERVED2, 50 | SET_ADDRESS, 51 | GET_DESCRIPTOR, 52 | SET_DESCRIPTOR, 53 | GET_CONFIGURATION, 54 | SET_CONFIGURATION, 55 | GET_INTERFACE, 56 | SET_INTERFACE, 57 | TOTAL_sREQUEST, /* Total number of Standard request */ 58 | SYNCH_FRAME = 12 59 | } STANDARD_REQUESTS; 60 | 61 | /* Definition of "USBwValue" */ 62 | typedef enum _DESCRIPTOR_TYPE 63 | { 64 | DEVICE_DESCRIPTOR = 1, 65 | CONFIG_DESCRIPTOR, 66 | STRING_DESCRIPTOR, 67 | INTERFACE_DESCRIPTOR, 68 | ENDPOINT_DESCRIPTOR 69 | } DESCRIPTOR_TYPE; 70 | 71 | /* Feature selector of a SET_FEATURE or CLEAR_FEATURE */ 72 | typedef enum _FEATURE_SELECTOR 73 | { 74 | ENDPOINT_STALL, 75 | DEVICE_REMOTE_WAKEUP 76 | } FEATURE_SELECTOR; 77 | 78 | /* Exported constants --------------------------------------------------------*/ 79 | /* Definition of "USBbmRequestType" */ 80 | #define REQUEST_TYPE 0x60 /* Mask to get request type */ 81 | #define STANDARD_REQUEST 0x00 /* Standard request */ 82 | #define CLASS_REQUEST 0x20 /* Class request */ 83 | #define VENDOR_REQUEST 0x40 /* Vendor request */ 84 | 85 | #define RECIPIENT 0x1F /* Mask to get recipient */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | /* Exported functions ------------------------------------------------------- */ 89 | 90 | #endif /* __USB_DEF_H */ 91 | 92 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 93 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Utilities/STM32_EVAL/Common/lcd_log_conf_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file lcd_log_conf_template.h 4 | * @author MCD Application Team 5 | * @version V5.0.2 6 | * @date 05-March-2012 7 | * @brief lcd_log configuration template file. 8 | * This file should be copied to the application folder and modified 9 | * as follows: 10 | * - Rename it to 'lcd_log_conf.h'. 11 | * - Update the name of the LCD header file depending on the EVAL board 12 | * you are using (see line32 below). 13 | ****************************************************************************** 14 | * @attention 15 | * 16 | *

© COPYRIGHT 2012 STMicroelectronics

17 | * 18 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 19 | * You may not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at: 21 | * 22 | * http://www.st.com/software_license_agreement_liberty_v2 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an "AS IS" BASIS, 26 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | * 30 | ****************************************************************************** 31 | */ 32 | 33 | /* Define to prevent recursive inclusion -------------------------------------*/ 34 | #ifndef __LCD_LOG_CONF_H__ 35 | #define __LCD_LOG_CONF_H__ 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32xxx_eval_lcd.h" /* replace 'stm32xxx' with your EVAL board name, ex: stm3210c_eval_lcd.h */ 39 | #include 40 | 41 | /** @addtogroup LCD_LOG 42 | * @{ 43 | */ 44 | 45 | /** @defgroup LCD_LOG 46 | * @brief This file is the 47 | * @{ 48 | */ 49 | 50 | 51 | /** @defgroup LCD_LOG_CONF_Exported_Defines 52 | * @{ 53 | */ 54 | /* Comment the line below to disable the scroll back and forward features */ 55 | #define LCD_SCROLL_ENABLED 56 | 57 | /* Define the LCD default text color */ 58 | #define LCD_LOG_DEFAULT_COLOR LCD_COLOR_WHITE 59 | 60 | /* Define the display window settings */ 61 | #define YWINDOW_MIN 3 62 | #define YWINDOW_SIZE 12 63 | #define XWINDOW_MAX 50 64 | 65 | /* Define the cache depth */ 66 | #define CACHE_SIZE 50 67 | 68 | /** @defgroup LCD_LOG_CONF_Exported_TypesDefinitions 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | 77 | /** @defgroup LCD_LOG_Exported_Macros 78 | * @{ 79 | */ 80 | 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup LCD_LOG_CONF_Exported_Variables 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup LCD_LOG_CONF_Exported_FunctionsPrototype 95 | * @{ 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | 103 | #endif /* __LCD_LOG_H__ */ 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 114 | -------------------------------------------------------------------------------- /software/cgminer/compat/jansson-2.5/src/strconv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "jansson_private.h" 6 | #include "strbuffer.h" 7 | 8 | /* need config.h to get the correct snprintf */ 9 | #ifdef HAVE_CONFIG_H 10 | #include 11 | #endif 12 | 13 | #if JSON_HAVE_LOCALECONV 14 | #include 15 | 16 | /* 17 | - This code assumes that the decimal separator is exactly one 18 | character. 19 | 20 | - If setlocale() is called by another thread between the call to 21 | localeconv() and the call to sprintf() or strtod(), the result may 22 | be wrong. setlocale() is not thread-safe and should not be used 23 | this way. Multi-threaded programs should use uselocale() instead. 24 | */ 25 | 26 | static void to_locale(strbuffer_t *strbuffer) 27 | { 28 | const char *point; 29 | char *pos; 30 | 31 | point = localeconv()->decimal_point; 32 | if(*point == '.') { 33 | /* No conversion needed */ 34 | return; 35 | } 36 | 37 | pos = strchr(strbuffer->value, '.'); 38 | if(pos) 39 | *pos = *point; 40 | } 41 | 42 | static void from_locale(char *buffer) 43 | { 44 | const char *point; 45 | char *pos; 46 | 47 | point = localeconv()->decimal_point; 48 | if(*point == '.') { 49 | /* No conversion needed */ 50 | return; 51 | } 52 | 53 | pos = strchr(buffer, *point); 54 | if(pos) 55 | *pos = '.'; 56 | } 57 | #endif 58 | 59 | int jsonp_strtod(strbuffer_t *strbuffer, double *out) 60 | { 61 | double value; 62 | char *end; 63 | 64 | #if JSON_HAVE_LOCALECONV 65 | to_locale(strbuffer); 66 | #endif 67 | 68 | errno = 0; 69 | value = strtod(strbuffer->value, &end); 70 | assert(end == strbuffer->value + strbuffer->length); 71 | 72 | if(errno == ERANGE && value != 0) { 73 | /* Overflow */ 74 | return -1; 75 | } 76 | 77 | *out = value; 78 | return 0; 79 | } 80 | 81 | int jsonp_dtostr(char *buffer, size_t size, double value) 82 | { 83 | int ret; 84 | char *start, *end; 85 | size_t length; 86 | 87 | ret = snprintf(buffer, size, "%.17g", value); 88 | if(ret < 0) 89 | return -1; 90 | 91 | length = (size_t)ret; 92 | if(length >= size) 93 | return -1; 94 | 95 | #if JSON_HAVE_LOCALECONV 96 | from_locale(buffer); 97 | #endif 98 | 99 | /* Make sure there's a dot or 'e' in the output. Otherwise 100 | a real is converted to an integer when decoding */ 101 | if(strchr(buffer, '.') == NULL && 102 | strchr(buffer, 'e') == NULL) 103 | { 104 | if(length + 3 >= size) { 105 | /* No space to append ".0" */ 106 | return -1; 107 | } 108 | buffer[length] = '.'; 109 | buffer[length + 1] = '0'; 110 | buffer[length + 2] = '\0'; 111 | length += 2; 112 | } 113 | 114 | /* Remove leading '+' from positive exponent. Also remove leading 115 | zeros from exponents (added by some printf() implementations) */ 116 | start = strchr(buffer, 'e'); 117 | if(start) { 118 | start++; 119 | end = start + 1; 120 | 121 | if(*start == '-') 122 | start++; 123 | 124 | while(*end == '0') 125 | end++; 126 | 127 | if(end != start) { 128 | memmove(start, end, length - (size_t)(end - buffer)); 129 | length -= (size_t)(end - start); 130 | } 131 | } 132 | 133 | return (int)length; 134 | } 135 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/stm32l1xx_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l1xx_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32L1xx_CONF_H 30 | #define __STM32L1xx_CONF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Uncomment the line below to enable peripheral header file inclusion */ 34 | #include "stm32l1xx_adc.h" 35 | #include "stm32l1xx_crc.h" 36 | #include "stm32l1xx_comp.h" 37 | #include "stm32l1xx_dac.h" 38 | #include "stm32l1xx_dbgmcu.h" 39 | #include "stm32l1xx_dma.h" 40 | #include "stm32l1xx_exti.h" 41 | #include "stm32l1xx_flash.h" 42 | #include "stm32l1xx_gpio.h" 43 | #include "stm32l1xx_syscfg.h" 44 | #include "stm32l1xx_i2c.h" 45 | #include "stm32l1xx_iwdg.h" 46 | #include "stm32l1xx_lcd.h" 47 | #include "stm32l1xx_pwr.h" 48 | #include "stm32l1xx_rcc.h" 49 | #include "stm32l1xx_rtc.h" 50 | #include "stm32l1xx_spi.h" 51 | #include "stm32l1xx_tim.h" 52 | #include "stm32l1xx_usart.h" 53 | #include "stm32l1xx_wwdg.h" 54 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 55 | 56 | /* Exported types ------------------------------------------------------------*/ 57 | /* Exported constants --------------------------------------------------------*/ 58 | /* Uncomment the line below to expanse the "assert_param" macro in the 59 | Standard Peripheral Library drivers code */ 60 | /* #define USE_FULL_ASSERT 1 */ 61 | 62 | /* Exported macro ------------------------------------------------------------*/ 63 | #ifdef USE_FULL_ASSERT 64 | 65 | /** 66 | * @brief The assert_param macro is used for function's parameters check. 67 | * @param expr: If expr is false, it calls assert_failed function 68 | * which reports the name of the source file and the source 69 | * line number of the call that failed. 70 | * If expr is true, it returns no value. 71 | * @retval : None 72 | */ 73 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 74 | /* Exported functions ------------------------------------------------------- */ 75 | void assert_failed(uint8_t* file, uint32_t line); 76 | #else 77 | #define assert_param(expr) ((void)0) 78 | #endif /* USE_FULL_ASSERT */ 79 | 80 | #endif /* __STM32L1xx_CONF_H */ 81 | 82 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 83 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32_USB-FS-Device_Driver/src/usb_init.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_init.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Initialization routines & global variables 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "usb_lib.h" 31 | 32 | /* Private typedef -----------------------------------------------------------*/ 33 | /* Private define ------------------------------------------------------------*/ 34 | /* Private macro -------------------------------------------------------------*/ 35 | /* Private variables ---------------------------------------------------------*/ 36 | /* The number of current endpoint, it will be used to specify an endpoint */ 37 | uint8_t EPindex; 38 | /* The number of current device, it is an index to the Device_Table */ 39 | /* uint8_t Device_no; */ 40 | /* Points to the DEVICE_INFO structure of current device */ 41 | /* The purpose of this register is to speed up the execution */ 42 | DEVICE_INFO *pInformation; 43 | /* Points to the DEVICE_PROP structure of current device */ 44 | /* The purpose of this register is to speed up the execution */ 45 | DEVICE_PROP *pProperty; 46 | /* Temporary save the state of Rx & Tx status. */ 47 | /* Whenever the Rx or Tx state is changed, its value is saved */ 48 | /* in this variable first and will be set to the EPRB or EPRA */ 49 | /* at the end of interrupt process */ 50 | uint16_t SaveState ; 51 | uint16_t wInterrupt_Mask; 52 | DEVICE_INFO Device_Info; 53 | USER_STANDARD_REQUESTS *pUser_Standard_Requests; 54 | 55 | /* Extern variables ----------------------------------------------------------*/ 56 | /* Private function prototypes -----------------------------------------------*/ 57 | /* Private functions ---------------------------------------------------------*/ 58 | 59 | /******************************************************************************* 60 | * Function Name : USB_Init 61 | * Description : USB system initialization 62 | * Input : None. 63 | * Output : None. 64 | * Return : None. 65 | *******************************************************************************/ 66 | void USB_Init(void) 67 | { 68 | pInformation = &Device_Info; 69 | pInformation->ControlState = 2; 70 | pProperty = &Device_Property; 71 | pUser_Standard_Requests = &User_Standard_Requests; 72 | /* Initialize devices one by one */ 73 | pProperty->Init(); 74 | } 75 | 76 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/stm32f30x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f30x_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32F30X_CONF_H 30 | #define __STM32F30X_CONF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Comment the line below to disable peripheral header file inclusion */ 34 | #include "stm32f30x_adc.h" 35 | #include "stm32f30x_can.h" 36 | #include "stm32f30x_crc.h" 37 | #include "stm32f30x_comp.h" 38 | #include "stm32f30x_dac.h" 39 | #include "stm32f30x_dbgmcu.h" 40 | #include "stm32f30x_dma.h" 41 | #include "stm32f30x_exti.h" 42 | #include "stm32f30x_flash.h" 43 | #include "stm32f30x_gpio.h" 44 | #include "stm32f30x_syscfg.h" 45 | #include "stm32f30x_i2c.h" 46 | #include "stm32f30x_iwdg.h" 47 | #include "stm32f30x_opamp.h" 48 | #include "stm32f30x_pwr.h" 49 | #include "stm32f30x_rcc.h" 50 | #include "stm32f30x_rtc.h" 51 | #include "stm32f30x_spi.h" 52 | #include "stm32f30x_tim.h" 53 | #include "stm32f30x_usart.h" 54 | #include "stm32f30x_wwdg.h" 55 | #include "stm32f30x_misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | /* Exported constants --------------------------------------------------------*/ 59 | /* Uncomment the line below to expanse the "assert_param" macro in the 60 | Standard Peripheral Library drivers code */ 61 | /* #define USE_FULL_ASSERT 1 */ 62 | 63 | /* Exported macro ------------------------------------------------------------*/ 64 | #ifdef USE_FULL_ASSERT 65 | 66 | /** 67 | * @brief The assert_param macro is used for function's parameters check. 68 | * @param expr: If expr is false, it calls assert_failed function which reports 69 | * the name of the source file and the source line number of the call 70 | * that failed. If expr is true, it returns no value. 71 | * @retval None 72 | */ 73 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 74 | /* Exported functions ------------------------------------------------------- */ 75 | void assert_failed(uint8_t* file, uint32_t line); 76 | #else 77 | #define assert_param(expr) ((void)0) 78 | #endif /* USE_FULL_ASSERT */ 79 | 80 | #endif /* __STM32F30X_CONF_H */ 81 | 82 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 83 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/stm32f37x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f37x_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32F37X_CONF_H 30 | #define __STM32F37X_CONF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Comment the line below to disable peripheral header file inclusion */ 34 | #include "stm32f37x_adc.h" 35 | #include "stm32f37x_can.h" 36 | #include "stm32f37x_cec.h" 37 | #include "stm32f37x_crc.h" 38 | #include "stm32f37x_comp.h" 39 | #include "stm32f37x_dac.h" 40 | #include "stm32f37x_dbgmcu.h" 41 | #include "stm32f37x_dma.h" 42 | #include "stm32f37x_exti.h" 43 | #include "stm32f37x_flash.h" 44 | #include "stm32f37x_gpio.h" 45 | #include "stm32f37x_syscfg.h" 46 | #include "stm32f37x_i2c.h" 47 | #include "stm32f37x_iwdg.h" 48 | #include "stm32f37x_pwr.h" 49 | #include "stm32f37x_rcc.h" 50 | #include "stm32f37x_rtc.h" 51 | #include "stm32f37x_sdadc.h" 52 | #include "stm32f37x_spi.h" 53 | #include "stm32f37x_tim.h" 54 | #include "stm32f37x_usart.h" 55 | #include "stm32f37x_wwdg.h" 56 | #include "stm32f37x_misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Uncomment the line below to expanse the "assert_param" macro in the 61 | Standard Peripheral Library drivers code */ 62 | /* #define USE_FULL_ASSERT 1 */ 63 | 64 | /* Exported macro ------------------------------------------------------------*/ 65 | #ifdef USE_FULL_ASSERT 66 | 67 | /** 68 | * @brief The assert_param macro is used for function's parameters check. 69 | * @param expr: If expr is false, it calls assert_failed function which reports 70 | * the name of the source file and the source line number of the call 71 | * that failed. If expr is true, it returns no value. 72 | * @retval None 73 | */ 74 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 75 | /* Exported functions ------------------------------------------------------- */ 76 | void assert_failed(uint8_t* file, uint32_t line); 77 | #else 78 | #define assert_param(expr) ((void)0) 79 | #endif /* USE_FULL_ASSERT */ 80 | 81 | #endif /* __STM32F37X_CONF_H */ 82 | 83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_WWDG_H 31 | #define __STM32F10x_WWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup WWDG 45 | * @{ 46 | */ 47 | 48 | /** @defgroup WWDG_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup WWDG_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup WWDG_Prescaler 61 | * @{ 62 | */ 63 | 64 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 65 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 66 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 67 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 68 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 69 | ((PRESCALER) == WWDG_Prescaler_2) || \ 70 | ((PRESCALER) == WWDG_Prescaler_4) || \ 71 | ((PRESCALER) == WWDG_Prescaler_8)) 72 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 73 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup WWDG_Exported_Macros 84 | * @{ 85 | */ 86 | /** 87 | * @} 88 | */ 89 | 90 | /** @defgroup WWDG_Exported_Functions 91 | * @{ 92 | */ 93 | 94 | void WWDG_DeInit(void); 95 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 96 | void WWDG_SetWindowValue(uint8_t WindowValue); 97 | void WWDG_EnableIT(void); 98 | void WWDG_SetCounter(uint8_t Counter); 99 | void WWDG_Enable(uint8_t Counter); 100 | FlagStatus WWDG_GetFlagStatus(void); 101 | void WWDG_ClearFlag(void); 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif /* __STM32F10x_WWDG_H */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | -------------------------------------------------------------------------------- /firmware/STM32_Virtual_COM/Projects/Virtual_COM_Port/inc/hw_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file hw_config.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Hardware Configuration & Setup 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __HW_CONFIG_H 31 | #define __HW_CONFIG_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "platform_config.h" 35 | #include "usb_type.h" 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | /* Exported constants --------------------------------------------------------*/ 39 | /* Exported macro ------------------------------------------------------------*/ 40 | /* Exported define -----------------------------------------------------------*/ 41 | #define MASS_MEMORY_START 0x04002000 42 | #define BULK_MAX_PACKET_SIZE 0x00000040 43 | #define LED_ON 0xF0 44 | #define LED_OFF 0xFF 45 | 46 | #define USART_RX_DATA_SIZE 2048 47 | //#define USART_RX_DATA_SIZE 64 48 | 49 | #define COM1_IRQ_FLAG (1<<0) 50 | #define COM2_IRQ_FLAG (1<<1) 51 | #define COM3_IRQ_FLAG (1<<2) 52 | #define COM4_IRQ_FLAG (1<<3) 53 | #define COM5_IRQ_FLAG (1<<4) 54 | #define USBIN_IRQ_FLAG (1<<5) 55 | #define USBOUT_IRQ_FLAG (1<<6) 56 | #define BTC_IRQ_FLAG (1<<7) 57 | 58 | #define SET_IRQ_FLAG(irq) \ 59 | IRQ_FLAG &= ~irq; \ 60 | IRQ_FLAG |= irq 61 | #define CLEAR_IRQ_FLAG(irq) \ 62 | IRQ_FLAG &= ~irq 63 | #define IS_IRQ_FLAG(irq) \ 64 | (IRQ_FLAG & irq) 65 | extern volatile u32 IRQ_FLAG; 66 | 67 | /* Exported functions ------------------------------------------------------- */ 68 | void Set_System(void); 69 | void Set_USBClock(void); 70 | void Enter_LowPowerMode(void); 71 | void Leave_LowPowerMode(void); 72 | void USB_Interrupts_Config(void); 73 | void USB_Cable_Config (FunctionalState NewState); 74 | void USART_Config_Default(void); 75 | bool USART_Config(void); 76 | void btc_ltc_uart_config(u32 bd); 77 | void USB_To_USART_Send_Data(uint8_t* data_buffer, uint8_t Nb_bytes); 78 | void USART_To_USB_Send_Data(USART_TypeDef* USARTx); 79 | void Handle_USBAsynchXfer (void); 80 | void Get_SerialNum(void); 81 | void Reset_GC3355(void); 82 | void gpio_init(void); 83 | void led0(int on); 84 | int led0_revert(void); 85 | int led1_revert(void); 86 | void led1(int on); 87 | void reset_btc_hw(void); 88 | void reset_ltc_hw(void); 89 | void reset_gc3355_chip(void); 90 | 91 | /* External variables --------------------------------------------------------*/ 92 | 93 | #endif /*__HW_CONFIG_H*/ 94 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 95 | --------------------------------------------------------------------------------