00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef USB_LIBUSB10
00028 #define USB_LIBUSB10
00029
00030 #include <libusb-1.0/libusb.h>
00031
00032 #if defined(__APPLE__)
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define PKTS_PER_XFER 128
00048 #define NUM_XFERS 4
00049 #define DEPTH_PKTBUF 2048
00050 #define RGB_PKTBUF 2048
00051 #else
00052 #define PKTS_PER_XFER 16
00053 #define NUM_XFERS 16
00054 #define DEPTH_PKTBUF 1920
00055 #define RGB_PKTBUF 1920
00056 #endif
00057
00058 typedef struct {
00059 libusb_context *ctx;
00060 int should_free_ctx;
00061 } fnusb_ctx;
00062
00063 typedef struct {
00064 freenect_device *parent;
00065 libusb_device_handle *dev;
00066 } fnusb_dev;
00067
00068 typedef struct {
00069 fnusb_dev *parent;
00070 struct libusb_transfer **xfers;
00071 uint8_t *buffer;
00072 fnusb_iso_cb cb;
00073 int num_xfers;
00074 int pkts;
00075 int len;
00076 int dead;
00077 int dead_xfers;
00078 } fnusb_isoc_stream;
00079
00080 int fnusb_init(fnusb_ctx *ctx, freenect_usb_context *usb_ctx);
00081 int fnusb_shutdown(fnusb_ctx *ctx);
00082 int fnusb_process_events(fnusb_ctx *ctx);
00083
00084 int fnusb_open_subdevices(freenect_device *dev, int index);
00085
00086 int fnusb_start_iso(fnusb_dev *dev, fnusb_isoc_stream *strm, fnusb_iso_cb cb, int ep, int xfers, int pkts, int len);
00087 int fnusb_stop_iso(fnusb_dev *dev, fnusb_isoc_stream *strm);
00088
00089 int fnusb_control(fnusb_dev *dev, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint8_t *data, uint16_t wLength);
00090
00091
00092 #endif