driver-spondoolies-sp30-p.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright 2014 Zvi (Zvisha) Shteingart - Spondoolies-tech.com
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the Free
  6. * Software Foundation; either version 3 of the License, or (at your option)
  7. * any later version. See COPYING for more details.
  8. */
  9. /*
  10. This file holds functions needed for minergate packet parsing/creation
  11. */
  12. #include "driver-spondoolies-sp30-p.h"
  13. #include "assert.h"
  14. //#include "spond_debug.h"
  15. #ifndef passert
  16. #define passert assert
  17. #endif
  18. minergate_req_packet_sp30 *allocate_minergate_packet_req_sp30(uint8_t requester_id,
  19. uint8_t request_id) {
  20. minergate_req_packet_sp30 *p =
  21. (minergate_req_packet_sp30 *)malloc(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 =
  33. (minergate_rsp_packet_sp30 *)malloc(sizeof(minergate_rsp_packet_sp30));
  34. p->requester_id = requester_id;
  35. p->rsp_count = 0;
  36. p->protocol_version = MINERGATE_PROTOCOL_VERSION_SP30;
  37. p->request_id = request_id;
  38. p->magic = 0xcaf4;
  39. p->gh_div_50_rate= 0;
  40. return p;
  41. }