driver-spondoolies-sp10-p.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2014-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. This file holds functions needed for minergate packet parsing/creation
  14. by Zvisha Shteingart
  15. */
  16. #include "driver-spondoolies-sp10-p.h"
  17. #include "assert.h"
  18. //#include "spond_debug.h"
  19. minergate_req_packet *allocate_minergate_packet_req(uint8_t requester_id, uint8_t request_id)
  20. {
  21. minergate_req_packet *p = cgmalloc(sizeof(minergate_req_packet));
  22. p->requester_id = requester_id;
  23. p->req_count = 0;
  24. p->protocol_version = MINERGATE_PROTOCOL_VERSION;
  25. p->request_id = request_id;
  26. p->magic = 0xcaf4;
  27. p->mask |= 0x01; // first packet
  28. return p;
  29. }
  30. minergate_rsp_packet *allocate_minergate_packet_rsp(uint8_t requester_id, uint8_t request_id)
  31. {
  32. minergate_rsp_packet *p = cgmalloc(sizeof(minergate_rsp_packet));
  33. p->requester_id = requester_id;
  34. p->rsp_count = 0;
  35. p->protocol_version = MINERGATE_PROTOCOL_VERSION;
  36. p->request_id = request_id;
  37. p->magic = 0xcaf4;
  38. p->gh_div_10_rate = 0;
  39. return p;
  40. }