libsigrok
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
analyzer.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of the sigrok project.
00003  *
00004  * Copyright (C) 2010 Sven Peter <sven@fail0verflow.com>
00005  * Copyright (C) 2010 Haxx Enterprises <bushing@gmail.com>
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or
00009  * without modification, are permitted provided that the following
00010  * conditions are met:
00011  *
00012  * * Redistributions of source code must retain the above copyright notice,
00013  *   this list of conditions and the following disclaimer.
00014  *
00015  * * Redistributions in binary form must reproduce the above copyright notice,
00016  *   this list of conditions and the following disclaimer in the documentation
00017  *   and/or other materials provided with the distribution.
00018  *
00019  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00023  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
00029  *  THE POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 #ifndef LIBSIGROK_HARDWARE_ZEROPLUS_LOGIC_CUBE_ANALYZER_H
00033 #define LIBSIGROK_HARDWARE_ZEROPLUS_LOGIC_CUBE_ANALYZER_H
00034 
00035 #include <libusb.h>
00036 #include "sigrok.h"
00037 
00038 #define STATUS_FLAG_NONE        0x00
00039 #define STATUS_FLAG_RESET       0x01
00040 #define STATUS_FLAG_INIT        0x02
00041 #define STATUS_FLAG_GO          0x04
00042 #define STATUS_FLAG_PAUSE       0x08
00043 #define STATUS_FLAG_READ        0x10
00044 #define STATUS_FLAG_20          0x20
00045 
00046 #define MEMORY_SIZE_8K          0x00
00047 #define MEMORY_SIZE_64K         0x01
00048 #define MEMORY_SIZE_128K        0x02
00049 #define MEMORY_SIZE_512K        0x04
00050 
00051 #define STATUS_BUSY             0x01    /* WTF / ??? */
00052 #define STATUS_READY            0x02
00053 #define STATUS_BUTTON_PRESSED   0x04
00054 
00055 #define CHANNEL_A               0x1000
00056 #define CHANNEL_B               0x2000
00057 #define CHANNEL_C               0x3000
00058 #define CHANNEL_D               0x4000
00059 
00060 #define FREQ_SCALE_HZ           0
00061 #define FREQ_SCALE_KHZ          1
00062 #define FREQ_SCALE_MHZ          2
00063 
00064 #define FILTER_HIGH             0
00065 #define FILTER_LOW              1
00066 
00067 #define COMPRESSION_NONE        0x0001
00068 #define COMPRESSION_ENABLE      0x8001
00069 #define COMPRESSION_DOUBLE      0x8002
00070 
00071 enum {
00072         TRIGGER_HIGH = 0,
00073         TRIGGER_LOW,
00074         TRIGGER_POSEDGE,
00075         TRIGGER_NEGEDGE,
00076         TRIGGER_ANYEDGE,
00077 };
00078 
00079 SR_PRIV void analyzer_set_freq(int freq, int scale);
00080 SR_PRIV void analyzer_set_ramsize_trigger_address(unsigned int address);
00081 SR_PRIV void analyzer_set_triggerbar_address(unsigned int address);
00082 SR_PRIV void analyzer_set_compression(unsigned int type);
00083 SR_PRIV void analyzer_set_memory_size(unsigned int size);
00084 SR_PRIV void analyzer_add_trigger(int channel, int type);
00085 SR_PRIV void analyzer_set_trigger_count(int count);
00086 SR_PRIV void analyzer_add_filter(int channel, int type);
00087 
00088 SR_PRIV unsigned int analyzer_read_id(libusb_device_handle *devh);
00089 SR_PRIV unsigned int analyzer_get_stop_address(libusb_device_handle *devh);
00090 SR_PRIV unsigned int analyzer_get_now_address(libusb_device_handle *devh);
00091 SR_PRIV unsigned int analyzer_get_trigger_address(libusb_device_handle *devh);
00092 SR_PRIV int analyzer_decompress(void *input, unsigned int input_len,
00093                                 void *output, unsigned int output_len);
00094 
00095 SR_PRIV void analyzer_reset(libusb_device_handle *devh);
00096 SR_PRIV void analyzer_initialize(libusb_device_handle *devh);
00097 SR_PRIV void analyzer_wait(libusb_device_handle *devh, int set, int unset);
00098 SR_PRIV void analyzer_read_start(libusb_device_handle *devh);
00099 SR_PRIV int analyzer_read_data(libusb_device_handle *devh, void *buffer,
00100                                unsigned int size);
00101 SR_PRIV void analyzer_read_stop(libusb_device_handle *devh);
00102 SR_PRIV void analyzer_start(libusb_device_handle *devh);
00103 SR_PRIV void analyzer_configure(libusb_device_handle *devh);
00104 
00105 SR_PRIV void analyzer_wait_button(libusb_device_handle *devh);
00106 SR_PRIV void analyzer_wait_data(libusb_device_handle *devh);
00107 
00108 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines