driver-x6500.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright 2012 Luke Dashjr
  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. #include <libusb-1.0/libusb.h>
  10. #include "dynclock.h"
  11. #include "logging.h"
  12. #include "miner.h"
  13. #include "fpgautils.h"
  14. #include "ft232r.h"
  15. #define X6500_USB_PRODUCT "X6500 FPGA Miner"
  16. #define X6500_BITSTREAM_FILENAME "fpgaminer_top_fixed7_197MHz.bit"
  17. #define X6500_BISTREAM_USERID "\2\4$B"
  18. #define X6500_MINIMUM_CLOCK 2
  19. #define X6500_DEFAULT_CLOCK 200
  20. #define X6500_MAXIMUM_CLOCK 210
  21. struct device_api x6500_api;
  22. static bool x6500_foundusb(libusb_device *dev, const char *product, const char *serial)
  23. {
  24. struct cgpu_info *x6500;
  25. x6500 = calloc(1, sizeof(*x6500));
  26. x6500->api = &x6500_api;
  27. mutex_init(&x6500->device_mutex);
  28. x6500->device_path = strdup(serial);
  29. x6500->device_fd = -1;
  30. x6500->deven = DEV_ENABLED;
  31. x6500->threads = 2;
  32. x6500->name = strdup(product);
  33. x6500->cutofftemp = 85;
  34. x6500->cgpu_data = dev;
  35. return add_cgpu(x6500);
  36. }
  37. static bool x6500_detect_one(const char *serial)
  38. {
  39. return ft232r_detect(X6500_USB_PRODUCT, serial, x6500_foundusb);
  40. }
  41. static int x6500_detect_auto()
  42. {
  43. return ft232r_detect(X6500_USB_PRODUCT, NULL, x6500_foundusb);
  44. }
  45. static void x6500_detect()
  46. {
  47. serial_detect_auto(&x6500_api, x6500_detect_one, x6500_detect_auto);
  48. }
  49. struct device_api x6500_api = {
  50. .dname = "x6500",
  51. .name = "XBS",
  52. .api_detect = x6500_detect,
  53. // .thread_init = x6500_fpga_init,
  54. // .scanhash = x6500_fpga_scanhash,
  55. // .thread_shutdown = x6500_fpga_shutdown,
  56. };