00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MUSBSTD_H
00013 #define MUSBSTD_H
00014
00015 #if defined(HAVE_LIBUSB)
00016
00017 #include <usb.h>
00018
00019 typedef struct {
00020 usb_dev_handle *dev;
00021 int usb_configuration;
00022 int usb_interface;
00023 int usb_type;
00024 } MUSB_INTERFACE;
00025
00026 #elif defined(_MSC_VER)
00027
00028 #include <windows.h>
00029
00030 typedef struct {
00031 HANDLE rhandle;
00032 HANDLE whandle;
00033 int usb_type;
00034 } MUSB_INTERFACE;
00035
00036 #elif defined(OS_DARWIN)
00037
00038 typedef struct {
00039 void *device;
00040 void *interface;
00041 int usb_configuration;
00042 int usb_interface;
00043 } MUSB_INTERFACE;
00044
00045 #else
00046 #error Do not know how to access USB devices
00047 #endif
00048
00049
00050
00051 #define MUSB_SUCCESS 1
00052 #define MUSB_NOT_FOUND 2
00053 #define MUSB_INVALID_PARAM 3
00054 #define MUSB_NO_MEM 4
00055 #define MUSB_ACCESS_ERROR 5
00056
00057
00058 #ifdef __cplusplus
00059 extern "C" {
00060 #endif
00061
00062
00063 #ifndef EXPRT
00064 #if defined(_MSC_VER) && defined(_USRDLL)
00065 #define EXPRT __declspec(dllexport)
00066 #else
00067 #define EXPRT
00068 #endif
00069 #endif
00070
00071 int EXPRT musb_open(MUSB_INTERFACE **musb_interface, int vendor, int product, int instance, int configuration, int usbinterface);
00072 int EXPRT musb_close(MUSB_INTERFACE *musb_interface);
00073 int EXPRT musb_write(MUSB_INTERFACE *musb_interface,int endpoint,const void *buf,int count,int timeout_ms);
00074 int EXPRT musb_read(MUSB_INTERFACE *musb_interface,int endpoint,void *buf,int count,int timeout_ms);
00075 int EXPRT musb_reset(MUSB_INTERFACE *musb_interface);
00076 int EXPRT musb_set_altinterface(MUSB_INTERFACE *musb_interface, int index);
00077
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081
00082 #endif // MUSBSTD_H