lowlevel.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef _BFG_LOWLEVEL_H
  2. #define _BFG_LOWLEVEL_H
  3. #include <stdbool.h>
  4. #include <uthash.h>
  5. struct lowlevel_device_info;
  6. typedef bool (*lowl_found_devinfo_func_t)(struct lowlevel_device_info *, void *);
  7. struct lowlevel_driver {
  8. struct lowlevel_device_info *(*devinfo_scan)();
  9. void (*devinfo_free)(struct lowlevel_device_info *);
  10. };
  11. struct lowlevel_device_info {
  12. char *manufacturer;
  13. char *product;
  14. char *serial;
  15. char *path;
  16. char *devid;
  17. struct lowlevel_driver *lowl;
  18. void *lowl_data;
  19. struct lowlevel_device_info *next;
  20. UT_hash_handle hh;
  21. };
  22. extern void lowlevel_scan();
  23. extern int _lowlevel_detect(lowl_found_devinfo_func_t, const char *serial, const char **product_needles, void *);
  24. #define lowlevel_detect(func, ...) _lowlevel_detect(func, NULL, (const char *[]){__VA_ARGS__, NULL}, NULL)
  25. #define lowlevel_detect_serial(func, serial) _lowlevel_detect(func, serial, (const char *[]){NULL}, NULL)
  26. extern void lowlevel_scan_free();
  27. extern void lowlevel_devinfo_free(struct lowlevel_device_info *);
  28. #ifdef USE_X6500
  29. extern struct lowlevel_driver lowl_ft232r;
  30. #endif
  31. #ifdef USE_NANOFURY
  32. extern struct lowlevel_driver lowl_mcp2210;
  33. #endif
  34. #ifdef HAVE_FPGAUTILS
  35. extern struct lowlevel_driver lowl_vcom;
  36. #endif
  37. #endif