gc3355.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2014 Nate Woolls
  3. * Copyright 2014 GridSeed Team
  4. * Copyright 2014 Dualminer Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the Free
  8. * Software Foundation; either version 3 of the License, or (at your option)
  9. * any later version. See COPYING for more details.
  10. */
  11. #ifndef bfgminer_gc3355_h
  12. #define bfgminer_gc3355_h
  13. #include <stdbool.h>
  14. #include <stdint.h>
  15. #include "miner.h"
  16. // options configurable by the end-user
  17. extern int opt_sha2_units;
  18. extern
  19. int opt_pll_freq;
  20. // GridSeed common code begins here
  21. #define GC3355_COMMAND_DELAY_MS 20
  22. #define GC3355_ORB_DEFAULT_CHIPS 5
  23. #define GC3355_READ_SIZE 12
  24. struct gc3355_orb_info
  25. {
  26. uint16_t freq;
  27. struct timeval scanhash_time;
  28. };
  29. #define gc3355_open(path) serial_open(path, 115200, 1, true)
  30. #define gc3355_close(fd) serial_close(fd)
  31. extern int gc3355_read(int fd, char *buf, size_t size);
  32. extern ssize_t gc3355_write(int fd, const void * const buf, const size_t size);
  33. extern void gc3355_init_usborb(int fd, int pll_freq, bool scrypt_only, bool detect_only);
  34. extern
  35. void gc3355_reset_dtr(int fd);
  36. extern void gc3355_init_usbstick(int fd, int pll_freq, bool scrypt_only, bool detect_only);
  37. extern void gc3355_scrypt_reset(int fd);
  38. extern
  39. void gc3355_scrypt_only_reset(int fd);
  40. extern void gc3355_scrypt_prepare_work(unsigned char cmd[156], struct work *);
  41. extern void gc3355_sha2_prepare_work(unsigned char cmd[52], struct work *, bool simple);
  42. extern uint32_t gc3355_get_firmware_version(int fd);
  43. extern void gc3355_set_pll_freq(int fd, int pll_freq);
  44. #define gc3355_get_cts_status(fd) ((get_serial_cts(fd) == BGV_LOW) ? 1 : 0)
  45. #endif