lowlevel.h 976 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef _BFG_LOWLEVEL_H
  2. #define _BFG_LOWLEVEL_H
  3. #include <stdbool.h>
  4. struct lowlevel_device_info;
  5. typedef bool (*lowl_found_devinfo_func_t)(struct lowlevel_device_info *);
  6. struct lowlevel_driver {
  7. struct lowlevel_device_info *(*devinfo_scan)();
  8. void (*devinfo_free)(struct lowlevel_device_info *);
  9. };
  10. struct lowlevel_device_info {
  11. char *product;
  12. char *serial;
  13. struct lowlevel_driver *lowl;
  14. void *lowl_data;
  15. struct lowlevel_device_info *next;
  16. };
  17. extern void lowlevel_scan();
  18. extern int _lowlevel_detect(lowl_found_devinfo_func_t, const char *serial, const char **product_needles);
  19. #define lowlevel_detect(func, ...) _lowlevel_detect(func, NULL, (const char *[]){__VA_ARGS__, NULL})
  20. #define lowlevel_detect_serial(func, serial) _lowlevel_detect(func, serial, (const char *[]){NULL})
  21. extern void lowlevel_scan_free();
  22. extern void lowlevel_devinfo_free(struct lowlevel_device_info *);
  23. #ifdef USE_X6500
  24. extern struct lowlevel_driver lowl_ft232r;
  25. #endif
  26. #endif