OpenCBM
dynlibusb.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Copyright 2010 Spiro Trikaliotis
8  *
9 */
10 
20 #ifndef OPENCBM_LIBMISC_DYNLIBUSB_H
21 #define OPENCBM_LIBMISC_DYNLIBUSB_H
22 
23 #include <usb.h>
24 
25 #include "getpluginaddress.h"
26 
27 #ifndef LIBUSB_APIDECL
28 # define LIBUSB_APIDECL
29 #endif
30 
31 typedef
32 struct usb_dll_s {
33  SHARED_OBJECT_HANDLE shared_object_handle;
34 
35  /*
36  * these definitions are taken directly from libusb.h.
37  * commented out entries are not currently unused.
38  */
39 
40  usb_dev_handle * (LIBUSB_APIDECL *open)(struct usb_device *dev);
41  int (LIBUSB_APIDECL *close)(usb_dev_handle *dev);
42 // int (LIBUSB_APIDECL *get_string)(usb_dev_handle *dev, int index, int langid, char *buf, size_t buflen);
43 // int (LIBUSB_APIDECL *get_string_simple)(usb_dev_handle *dev, int index, char *buf, size_t buflen);
44 
45 // int (LIBUSB_APIDECL *get_descriptor_by_endpoint)(usb_dev_handle *udev, int ep, unsigned char type, unsigned char index, void *buf, int size);
46 // int (LIBUSB_APIDECL *get_descriptor)(usb_dev_handle *udev, unsigned char type, unsigned char index, void *buf, int size);
47 
48  int (LIBUSB_APIDECL *bulk_write)(usb_dev_handle *dev, int ep, const char *bytes, int size, int timeout);
49  int (LIBUSB_APIDECL *bulk_read)(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout);
50 // int (LIBUSB_APIDECL *interrupt_write)(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout);
51 // int (LIBUSB_APIDECL *interrupt_read)(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout);
52  int (LIBUSB_APIDECL *control_msg)(usb_dev_handle *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout);
53  int (LIBUSB_APIDECL *set_configuration)(usb_dev_handle *dev, int configuration);
54  int (LIBUSB_APIDECL *claim_interface)(usb_dev_handle *dev, int interface);
55  int (LIBUSB_APIDECL *release_interface)(usb_dev_handle *dev, int interface);
56 // int (LIBUSB_APIDECL *set_altinterface)(usb_dev_handle *dev, int alternate);
57  int (LIBUSB_APIDECL *resetep)(usb_dev_handle *dev, unsigned int ep);
58  int (LIBUSB_APIDECL *clear_halt)(usb_dev_handle *dev, unsigned int ep);
59 // int (LIBUSB_APIDECL *reset)(usb_dev_handle *dev);
60 
61  char * (LIBUSB_APIDECL *strerror)(void);
62 
63  void (LIBUSB_APIDECL *init)(void);
64 // void (LIBUSB_APIDECL *set_debug)(int level);
65  int (LIBUSB_APIDECL *find_busses)(void);
66  int (LIBUSB_APIDECL *find_devices)(void);
67  struct usb_device * (LIBUSB_APIDECL *device)(usb_dev_handle *dev);
68  struct usb_bus * (LIBUSB_APIDECL *get_busses)(void);
69 
70 } usb_dll_t;
71 
72 extern usb_dll_t usb;
73 
74 extern int dynlibusb_init(void);
75 extern void dynlibusb_uninit(void);
76 
77 #endif /* #ifndef OPENCBM_LIBMISC_DYNLIBUSB_H */
void * SHARED_OBJECT_HANDLE
@@@
Shared library / DLL for accessing the driver Functions for obtaining the addresses of plugin functio...
Definition: usb.h:260