]> sigrok.org Git - libsigrok.git/blame - hardware/zeroplus-logic-cube/analyzer.h
OLS: Coding style fixes.
[libsigrok.git] / hardware / zeroplus-logic-cube / analyzer.h
CommitLineData
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
66enum {
67 TRIGGER_HIGH = 0,
68 TRIGGER_LOW,
69 TRIGGER_POSEDGE,
70 TRIGGER_NEGEDGE,
71 TRIGGER_ANYEDGE
72};
73
74void analyzer_set_freq(int freq, int scale);
75void analyzer_set_ramsize_trigger_address(unsigned int address);
76void analyzer_set_triggerbar_address(unsigned int address);
77void analyzer_set_compression(unsigned int type);
78void analyzer_set_memory_size(unsigned int size);
79void analyzer_add_trigger(int channel, int type);
80void analyzer_set_trigger_count(int count);
81void analyzer_add_filter(int channel, int type);
82
83unsigned int analyzer_read_id(libusb_device_handle *devh);
84unsigned int analyzer_get_stop_address(libusb_device_handle *devh);
85unsigned int analyzer_get_now_address(libusb_device_handle *devh);
86unsigned int analyzer_get_trigger_address(libusb_device_handle *devh);
87int analyzer_decompress(void *input, unsigned int input_len, void *output, unsigned int output_len);
88
89void analyzer_reset(libusb_device_handle *devh);
90void analyzer_initialize(libusb_device_handle *devh);
91void analyzer_wait(libusb_device_handle *devh, int set, int unset);
92void analyzer_read_start(libusb_device_handle *devh);
93int analyzer_read_data(libusb_device_handle *devh, void *buffer, unsigned int size);
94void analyzer_read_stop(libusb_device_handle *devh);
95void analyzer_start(libusb_device_handle *devh);
96void analyzer_configure(libusb_device_handle *devh);
97
98void analyzer_wait_button(libusb_device_handle *devh);
99void analyzer_wait_data(libusb_device_handle *devh);
100#endif