st-probe: Initial working stlink_probe_* API and CLI tool
[fw/stlink] / src / stlink-usb.h
index 4b8b46b08b370d91b827192dcda074854370c658..801cafad3232b9f333b9fec5ac2e453584d74183 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * File:   stlink-usb.h
  * Author: karl
  *
 extern "C" {
 #endif
 
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
 #include "stlink-common.h"
 
-#if defined(CONFIG_USE_LIBUSB)
+#define STLINK_SG_SIZE 31
+#define STLINK_CMD_SIZE 16
+
     struct stlink_libusb {
         libusb_context* libusb_ctx;
         libusb_device_handle* usb_handle;
-        struct libusb_transfer* req_trans;
-        struct libusb_transfer* rep_trans;
         unsigned int ep_req;
         unsigned int ep_rep;
+        int protocoll;
+        unsigned int sg_transfer_idx;
+        unsigned int cmd_len;
     };
-#else
-#error "it's all bad!"
-    struct stlink_libusb {};
-#endif
-
-    
-    stlink_t* stlink_open_usb(const char *dev_name, const int verbose);
 
+    stlink_t* stlink_open_usb(const int verbose, int reset, char *p_usb_iserial);
+    size_t stlink_probe_usb(stlink_t **stdevs[]);
+    void stlink_probe_usb_free(stlink_t **stdevs[], size_t size);
 
 #ifdef __cplusplus
 }