Merge pull request #397 from xor-gate/st-probe-libusb-fix
[fw/stlink] / src / stlink-usb.h
1 /*
2  * File:   stlink-usb.h
3  * Author: karl
4  *
5  * Created on October 1, 2011, 11:29 PM
6  */
7
8 #ifndef STLINK_USB_H
9 #define STLINK_USB_H
10
11 #ifdef  __cplusplus
12 extern "C" {
13 #endif
14
15 #include <libusb.h>
16 #include "stlink-common.h"
17
18 #define STLINK_SG_SIZE 31
19 #define STLINK_CMD_SIZE 16
20
21     struct stlink_libusb {
22         libusb_context* libusb_ctx;
23         libusb_device_handle* usb_handle;
24         unsigned int ep_req;
25         unsigned int ep_rep;
26         int protocoll;
27         unsigned int sg_transfer_idx;
28         unsigned int cmd_len;
29     };
30
31     stlink_t* stlink_open_usb(const int verbose, int reset, char *p_usb_iserial);
32     size_t stlink_probe_usb(stlink_t **stdevs[]);
33     void stlink_probe_usb_free(stlink_t **stdevs[], size_t size);
34
35 #ifdef  __cplusplus
36 }
37 #endif
38
39 #endif  /* STLINK_USB_H */
40