X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstlink-sg.h;h=7c020285176283602885d285bf38e7e13eef8d98;hb=67fd44b8370cca4994752df8abf0e2c45fdf995d;hp=b3ab9c00e42c6e3adff1dfd9e0d7e90e88b25cc6;hpb=afb487cfb627762590ee1acf750a77417cf73e18;p=fw%2Fstlink diff --git a/src/stlink-sg.h b/src/stlink-sg.h index b3ab9c0..7c02028 100644 --- a/src/stlink-sg.h +++ b/src/stlink-sg.h @@ -1,4 +1,4 @@ -/* +/* * File: stlink-sg.h * Author: karl * @@ -11,14 +11,15 @@ #ifdef __cplusplus extern "C" { #endif - -#include + +#include #include "stlink-common.h" - - // device access + + // device access #define RDWR 0 #define RO 1 #define SG_TIMEOUT_SEC 1 // actually 1 is about 2 sec +#define SG_TIMEOUT_MSEC 3 * 1000 // Each CDB can be a total of 6, 10, 12, or 16 bytes, later version // of the SCSI standard also allow for variable-length CDBs (min. CDB is 6). // the stlink needs max. 10 bytes. @@ -40,8 +41,12 @@ extern "C" { -#if defined(CONFIG_USE_LIBUSB) struct stlink_libsg { + libusb_context* libusb_ctx; + libusb_device_handle *usb_handle; + unsigned ep_rep; + unsigned ep_req; + int sg_fd; int do_scsi_pt_err; @@ -52,15 +57,13 @@ extern "C" { uint32_t q_addr; // Sense (error information) data + // obsolete, this was fed to the scsi tools unsigned char sense_buf[SENSE_BUF_LEN]; reg reg; }; -#else - struct stlink_libsg {}; -#endif - stlink_t* stlink_quirk_open(const char *dev_name, const int verbose); + stlink_t* stlink_v1_open(const int verbose, int reset); #ifdef __cplusplus }