]>
Commit | Line | Data |
---|---|---|
a1bb33af UH |
1 | /* |
2 | Copyright (c) 2010 Sven Peter <sven@fail0verflow.com> | |
3 | Copyright (c) 2010 Haxx Enterprises <bushing@gmail.com> | |
4 | All rights reserved. | |
5 | ||
6 | Redistribution and use in source and binary forms, with or | |
7 | without modification, are permitted provided that the following | |
8 | conditions are met: | |
9 | ||
10 | * Redistributions of source code must retain the above copyright notice, | |
11 | this list of conditions and the following disclaimer. | |
12 | ||
13 | * Redistributions in binary form must reproduce the above copyright notice, | |
14 | this list of conditions and the following disclaimer in the documentation | |
15 | and/or other materials provided with the distribution. | |
16 | ||
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
27 | THE POSSIBILITY OF SUCH DAMAGE. | |
28 | ||
29 | */ | |
30 | #ifndef ANALYZER_H__ | |
31 | #define ANALYZER_H__ 1 | |
32 | #include <libusb.h> | |
33 | #define STATUS_FLAG_NONE 0x00 | |
34 | #define STATUS_FLAG_RESET 0x01 | |
35 | #define STATUS_FLAG_INIT 0x02 | |
36 | #define STATUS_FLAG_GO 0x04 | |
37 | #define STATUS_FLAG_PAUSE 0x08 | |
38 | #define STATUS_FLAG_READ 0x10 | |
39 | #define STATUS_FLAG_20 0x20 | |
40 | ||
41 | #define MEMORY_SIZE_8K 0x00 | |
42 | #define MEMORY_SIZE_64K 0x01 | |
43 | #define MEMORY_SIZE_128K 0x02 | |
44 | #define MEMORY_SIZE_512K 0x04 | |
45 | ||
46 | #define STATUS_BUSY 0x01 // WTF / ??? | |
47 | #define STATUS_READY 0x02 | |
48 | #define STATUS_BUTTON_PRESSED 0x04 | |
49 | ||
50 | #define CHANNEL_A 0x1000 | |
51 | #define CHANNEL_B 0x2000 | |
52 | #define CHANNEL_C 0x3000 | |
53 | #define CHANNEL_D 0x4000 | |
54 | ||
55 | #define FREQ_SCALE_HZ 0 | |
56 | #define FREQ_SCALE_KHZ 1 | |
57 | #define FREQ_SCALE_MHZ 2 | |
58 | ||
59 | #define FILTER_HIGH 0 | |
60 | #define FILTER_LOW 1 | |
61 | ||
62 | #define COMPRESSION_NONE 0x0001 | |
63 | #define COMPRESSION_ENABLE 0x8001 | |
64 | #define COMPRESSION_DOUBLE 0x8002 | |
65 | ||
66 | enum { | |
67 | TRIGGER_HIGH = 0, | |
68 | TRIGGER_LOW, | |
69 | TRIGGER_POSEDGE, | |
70 | TRIGGER_NEGEDGE, | |
71 | TRIGGER_ANYEDGE | |
72 | }; | |
73 | ||
74 | void analyzer_set_freq(int freq, int scale); | |
75 | void analyzer_set_ramsize_trigger_address(unsigned int address); | |
76 | void analyzer_set_triggerbar_address(unsigned int address); | |
77 | void analyzer_set_compression(unsigned int type); | |
78 | void analyzer_set_memory_size(unsigned int size); | |
79 | void analyzer_add_trigger(int channel, int type); | |
80 | void analyzer_set_trigger_count(int count); | |
81 | void analyzer_add_filter(int channel, int type); | |
82 | ||
83 | unsigned int analyzer_read_id(libusb_device_handle *devh); | |
84 | unsigned int analyzer_get_stop_address(libusb_device_handle *devh); | |
85 | unsigned int analyzer_get_now_address(libusb_device_handle *devh); | |
86 | unsigned int analyzer_get_trigger_address(libusb_device_handle *devh); | |
87 | int analyzer_decompress(void *input, unsigned int input_len, void *output, unsigned int output_len); | |
88 | ||
89 | void analyzer_reset(libusb_device_handle *devh); | |
90 | void analyzer_initialize(libusb_device_handle *devh); | |
91 | void analyzer_wait(libusb_device_handle *devh, int set, int unset); | |
92 | void analyzer_read_start(libusb_device_handle *devh); | |
93 | int analyzer_read_data(libusb_device_handle *devh, void *buffer, unsigned int size); | |
94 | void analyzer_read_stop(libusb_device_handle *devh); | |
95 | void analyzer_start(libusb_device_handle *devh); | |
96 | void analyzer_configure(libusb_device_handle *devh); | |
97 | ||
98 | void analyzer_wait_button(libusb_device_handle *devh); | |
99 | void analyzer_wait_data(libusb_device_handle *devh); | |
100 | #endif |