]> git.gag.com Git - fw/stlink/blobdiff - src/stlink-sg.h
Successfully locate and open stlinkv1 by usb
[fw/stlink] / src / stlink-sg.h
index 00b70d12b60d0aef1ad59c73a951766659d520a7..c9776cddb76701202860c2a5b8bb59b0fc77dcdb 100644 (file)
@@ -12,6 +12,7 @@
 extern "C" {
 #endif
     
+#include <libusb-1.0/libusb.h>
 #include "stlink-common.h"
     
         // device access
@@ -39,8 +40,10 @@ extern "C" {
 
 
 
-#if defined(CONFIG_USE_LIBUSB)
     struct stlink_libsg {
+        libusb_context* libusb_ctx;
+        libusb_device_handle *handle;
+        
         int sg_fd;
         int do_scsi_pt_err;
 
@@ -53,19 +56,10 @@ extern "C" {
         // Sense (error information) data
         unsigned char sense_buf[SENSE_BUF_LEN];
 
-        uint32_t st_vid;
-        uint32_t stlink_pid;
-        uint32_t stlink_v;
-        uint32_t jtag_v;
-        uint32_t swim_v;
-        uint32_t core_id;
-
         reg reg;
     };
-#else
-    struct stlink_libsg {};
-#endif
 
+    stlink_t* stlink_v1_open(const char *dev_name, const int verbose);
 
 #ifdef __cplusplus
 }