X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstlink-sg.h;h=beecac324e63b9408f1353789c70dedbacb17bb3;hb=b0a477d2a7deaf628013a9a8651f5c10f180e5d0;hp=00b70d12b60d0aef1ad59c73a951766659d520a7;hpb=d060c3c040681c13e95d6b63982ccd16eeb83800;p=fw%2Fstlink diff --git a/src/stlink-sg.h b/src/stlink-sg.h index 00b70d1..beecac3 100644 --- a/src/stlink-sg.h +++ b/src/stlink-sg.h @@ -12,12 +12,14 @@ extern "C" { #endif +#include #include "stlink-common.h" // 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. @@ -39,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; @@ -51,21 +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]; - 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 int verbose); #ifdef __cplusplus }