driver-spondoolies-sp30-p.c 1.5 KB

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