/ driver-spondoolies-sp10.h
driver-spondoolies-sp10.h
1 /* 2 * Copyright 2014 Con Kolivas <kernel@kolivas.org> 3 * Copyright 2014 Zvi 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 11 #ifndef SPONDA_HFILE 12 #define SPONDA_HFILE 13 14 #include "miner.h" 15 #include "driver-spondoolies-sp10-p.h" 16 17 18 #define SP_NTIME 19 20 typedef enum adapter_state { 21 ADAPTER_STATE_INIT, 22 ADAPTER_STATE_OPERATIONAL, 23 } ADAPTER_STATE; 24 25 typedef enum spond_work_state { 26 SPONDWORK_STATE_EMPTY, 27 SPONDWORK_STATE_IN_BUSY, 28 } SPONDWORK_STATE; 29 30 #define MAX_JOBS_IN_MINERGATE MINERGATE_TOTAL_QUEUE // 1.5 sec worth of jobs 31 #define MAX_NROLES 50 32 33 typedef struct { 34 struct work *cgminer_work; 35 SPONDWORK_STATE state; 36 uint32_t merkle_root; 37 time_t start_time; 38 int job_id[MAX_NROLES]; 39 int ntime_clones; 40 } spond_driver_work; 41 42 struct spond_adapter { 43 pthread_mutex_t lock; 44 ADAPTER_STATE adapter_state; 45 void *cgpu; 46 47 // Statistics 48 int wins; 49 int good; 50 int empty; 51 int bad; 52 int overflow; 53 // state 54 int works_in_driver; 55 int works_in_minergate_and_pending_tx; 56 int works_pending_tx; 57 int socket_fd; 58 int reset_mg_queue; // 2=reset, 1=fast send, 0=nada 59 int current_job_id; 60 int parse_resp; 61 minergate_req_packet* mp_next_req; 62 minergate_rsp_packet* mp_last_rsp; 63 spond_driver_work my_jobs[MAX_JOBS_IN_MINERGATE]; 64 65 // Temperature statistics 66 int temp_rate; 67 int front_temp; 68 int rear_temp_top; 69 int rear_temp_bot; 70 71 // Last second we polled stats 72 time_t last_stats; 73 }; 74 75 // returns non-zero if needs to change ASICs. 76 int spond_one_sec_timer_scaling(struct spond_adapter *a, int t); 77 int spond_do_scaling(struct spond_adapter *a); 78 79 extern void one_sec_spondoolies_watchdog(int uptime); 80 81 #define REQUEST_PERIOD (100000) // times per second - in usec 82 #define REQUEST_SIZE 100 // jobs per request 83 84 #endif