/ driver-spondoolies-sp30-p.h
driver-spondoolies-sp30-p.h
1 /* 2 * Copyright 2015 Con Kolivas <kernel@kolivas.org> 3 * Copyright 2014 Zvi (Zvisha) Shteingart - Spondoolies-tech.com 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 * Note that changing this SW will void your miners guaranty 11 */ 12 13 14 #ifndef ____MINERGATE_LIB30_H___ 15 #define ____MINERGATE_LIB30_H___ 16 17 #include "config.h" 18 19 #include <stdio.h> 20 #include <stdlib.h> 21 #include <getopt.h> 22 #include <fcntl.h> 23 #include <sys/ioctl.h> 24 #include <linux/types.h> 25 #include <linux/spi/spidev.h> 26 #include <netinet/in.h> 27 28 #include "miner.h" 29 #include "util.h" 30 31 #define MINERGATE_PROTOCOL_VERSION_SP30 30 32 #define MINERGATE_SOCKET_FILE_SP30 "/tmp/connection_pipe_sp30" 33 34 typedef enum { 35 MINERGATE_DATA_ID_DO_JOB_REQ_SP30 = 5, 36 MINERGATE_DATA_ID_DO_JOB_RSP_SP30 = 6, 37 } MINERGATE_DATA_ID_SP30; 38 39 typedef struct { 40 uint32_t work_id_in_sw; 41 uint32_t difficulty; 42 uint32_t timestamp; 43 uint32_t mrkle_root; 44 uint32_t midstate[8]; 45 uint8_t leading_zeroes; 46 uint8_t ntime_limit; // max ntime - should be 60 47 uint8_t resr2; 48 uint8_t resr1; 49 } minergate_do_job_req_sp30; 50 51 #define MAX_REQUESTS_SP30 30 52 #define MAX_RESPONDS_SP30 60 53 #define MINERGATE_ADAPTER_QUEUE_SP30 40 54 55 typedef struct { 56 uint32_t work_id_in_sw; 57 uint32_t mrkle_root; // to validate 58 uint32_t winner_nonce; 59 uint8_t ntime_offset; 60 uint8_t res; // 0 = done, 1 = overflow, 2 = dropped bist 61 uint8_t job_complete; 62 uint8_t resrv2; 63 } minergate_do_job_rsp_sp30; 64 65 typedef struct { 66 uint8_t requester_id; 67 uint8_t request_id; 68 uint8_t protocol_version; 69 uint8_t mask; // 0x01 = first request, 0x2 = drop old work 70 uint16_t magic; // 0xcaf4 71 uint16_t req_count; 72 minergate_do_job_req_sp30 req[MAX_REQUESTS_SP30]; // array of requests 73 } minergate_req_packet_sp30; 74 75 typedef struct { 76 uint8_t requester_id; 77 uint8_t request_id; 78 uint8_t protocol_version; 79 uint8_t gh_div_50_rate; 80 uint16_t magic; // 0xcaf4 81 uint16_t rsp_count; 82 minergate_do_job_rsp_sp30 rsp[MAX_RESPONDS_SP30]; // array of responces 83 } minergate_rsp_packet_sp30; 84 85 minergate_req_packet_sp30* allocate_minergate_packet_req_sp30(uint8_t requester_id,uint8_t request_id); 86 minergate_rsp_packet_sp30* allocate_minergate_packet_rsp_sp30(uint8_t requester_id,uint8_t request_id); 87 88 #endif