RE: Setting the ARM as a USB bulk device » usbctrl.h
1 |
#ifndef USB_H
|
---|---|
2 |
#define USB_H
|
3 |
|
4 |
#include <pthread.h>
|
5 |
|
6 |
extern "C" { |
7 |
struct usb_endpoint_descriptor; |
8 |
struct usb_ctrlrequest; |
9 |
};
|
10 |
|
11 |
namespace MityDSP { |
12 |
class tcDspParserBase; |
13 |
};
|
14 |
|
15 |
class tcReportError; |
16 |
|
17 |
class tcUSB { |
18 |
public:
|
19 |
tcUSB(MityDSP::tcDspParserBase* apParser, int anSerial, tcReportError *apError); |
20 |
virtual ~tcUSB(void); |
21 |
|
22 |
int Initialize(); |
23 |
|
24 |
int put(const char* data, int length, int flush = 1); |
25 |
|
26 |
protected:
|
27 |
int HandleControl(struct usb_ctrlrequest *setup); |
28 |
static void* DispatchEP0Handler(void *apThis); |
29 |
static void* DispatchBulkInHandler(void *apThis); |
30 |
int EP0Handler(void); |
31 |
int BulkInHandler(void); |
32 |
int StartIO(void); |
33 |
int StopIO(void); |
34 |
char* build_config(char* cp, const struct usb_endpoint_descriptor **ep); |
35 |
|
36 |
int mnEP0Fd; /* control endpoint file descriptor */ |
37 |
int mnBulkInFd; /* PC input bulk endpoint */ |
38 |
int mnBulkOutFd; /* PC output bulk endpoint */ |
39 |
|
40 |
MityDSP::tcDspParserBase* mpParser; |
41 |
pthread_t mhEP0Thread; |
42 |
pthread_t mhBulkThread; |
43 |
pthread_t mhStartupThread; |
44 |
|
45 |
int mnBytesIn; /* counts the number of bytes received */ |
46 |
tcReportError* mpReportError; /* utility interface for error messages */ |
47 |
bool mbConnected; |
48 |
};
|
49 |
|
50 |
#endif
|