lowlevel.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. const char *dname;
  9. struct lowlevel_device_info *(*devinfo_scan)();
  10. void (*devinfo_free)(struct lowlevel_device_info *);
  11. };
  12. struct lowlevel_device_info {
  13. char *manufacturer;
  14. char *product;
  15. char *serial;
  16. char *path;
  17. char *devid;
  18. struct lowlevel_driver *lowl;
  19. void *lowl_data;
  20. struct lowlevel_device_info *next;
  21. UT_hash_handle hh;
  22. };
  23. extern void lowlevel_scan();
  24. extern int _lowlevel_detect(lowl_found_devinfo_func_t, const char *serial, const char **product_needles, void *);
  25. #define lowlevel_detect(func, ...) _lowlevel_detect(func, NULL, (const char *[]){__VA_ARGS__, NULL}, NULL)
  26. #define lowlevel_detect_serial(func, serial) _lowlevel_detect(func, serial, (const char *[]){NULL}, NULL)
  27. extern void lowlevel_scan_free();
  28. extern void lowlevel_devinfo_free(struct lowlevel_device_info *);
  29. #ifdef USE_X6500
  30. extern struct lowlevel_driver lowl_ft232r;
  31. #endif
  32. #ifdef USE_NANOFURY
  33. extern struct lowlevel_driver lowl_mcp2210;
  34. #endif
  35. #ifdef HAVE_FPGAUTILS
  36. extern struct lowlevel_driver lowl_vcom;
  37. #endif
  38. #endif