main
Line | |
---|
1 | /* CrO2 datassette emulator
|
---|
2 | * Copyright 2012, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
|
---|
3 | *
|
---|
4 | * Distributed under the terms of the MIT licence.
|
---|
5 | *
|
---|
6 | * Handles device communication through libusb
|
---|
7 | */
|
---|
8 |
|
---|
9 | #include <stdint.h>
|
---|
10 | #include <lusb0_usb.h>
|
---|
11 |
|
---|
12 | class Tape;
|
---|
13 |
|
---|
14 | class Device
|
---|
15 | {
|
---|
16 | public:
|
---|
17 | static Device& getDevice() throw(const char*);
|
---|
18 |
|
---|
19 | ~Device();
|
---|
20 |
|
---|
21 | int read(uint8_t* buffer, size_t max); // Fill the buffer with data from device
|
---|
22 | int write(const uint8_t* buffer, size_t size, int blktype);
|
---|
23 | void write(const Tape& file) throw (const char*);
|
---|
24 | uint8_t getStatus();
|
---|
25 |
|
---|
26 | private:
|
---|
27 | Device() throw(const char*); // Open device and set it up for communication
|
---|
28 | Device(const Device& other);
|
---|
29 |
|
---|
30 |
|
---|
31 | usb_dev_handle* handle;
|
---|
32 |
|
---|
33 | static bool initOnce;
|
---|
34 | static Device* instance;
|
---|
35 |
|
---|
36 | static const uint32_t vid;
|
---|
37 | static const uint32_t pid;
|
---|
38 | static const char* vendor;
|
---|
39 | static const char* product;
|
---|
40 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.