/ driver-spondoolies-sp30-p.c
driver-spondoolies-sp30-p.c
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 11 /* 12 This file holds functions needed for minergate packet parsing/creation 13 */ 14 15 #include "driver-spondoolies-sp30-p.h" 16 #include "assert.h" 17 //#include "spond_debug.h" 18 19 #ifndef passert 20 #define passert assert 21 #endif 22 23 minergate_req_packet_sp30 *allocate_minergate_packet_req_sp30(uint8_t requester_id, 24 uint8_t request_id) { 25 minergate_req_packet_sp30 *p = cgmalloc(sizeof(minergate_req_packet_sp30)); 26 p->requester_id = requester_id; 27 p->req_count = 0; 28 p->protocol_version = MINERGATE_PROTOCOL_VERSION_SP30; 29 p->request_id = request_id; 30 p->magic = 0xcaf4; 31 p->mask = 0; 32 return p; 33 } 34 35 minergate_rsp_packet_sp30 *allocate_minergate_packet_rsp_sp30(uint8_t requester_id, 36 uint8_t request_id) { 37 38 minergate_rsp_packet_sp30 *p = cgmalloc(sizeof(minergate_rsp_packet_sp30)); 39 p->requester_id = requester_id; 40 p->rsp_count = 0; 41 p->protocol_version = MINERGATE_PROTOCOL_VERSION_SP30; 42 p->request_id = request_id; 43 p->magic = 0xcaf4; 44 p->gh_div_50_rate= 0; 45 return p; 46 }