libsigrok
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
command.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of the sigrok project.
00003  *
00004  * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
00005  *
00006  * This program is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef LIBSIGROK_HARDWARE_FX2LAFW_COMMAND_H
00021 #define LIBSIGROK_HARDWARE_FX2LAFW_COMMAND_H
00022 
00023 #include "sigrok.h"
00024 
00025 /* Protocol commands */
00026 #define CMD_GET_FW_VERSION              0xb0
00027 #define CMD_START                       0xb1
00028 #define CMD_GET_REVID_VERSION           0xb2
00029 
00030 #define CMD_START_FLAGS_CLK_SRC_POS     6
00031 
00032 #define CMD_START_FLAGS_CLK_30MHZ       (0 << CMD_START_FLAGS_CLK_SRC_POS)
00033 #define CMD_START_FLAGS_CLK_48MHZ       (1 << CMD_START_FLAGS_CLK_SRC_POS)
00034 
00035 #pragma pack(push, 1)
00036 
00037 struct version_info {
00038         uint8_t major;
00039         uint8_t minor;
00040 };
00041 
00042 struct cmd_start_acquisition {
00043         uint8_t flags;
00044         uint8_t sample_delay_h;
00045         uint8_t sample_delay_l;
00046 };
00047 
00048 #pragma pack(pop)
00049 
00050 SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl,
00051                                    struct version_info *vi);
00052 SR_PRIV int command_get_revid_version(libusb_device_handle *devhdl,
00053                                       uint8_t *revid);
00054 SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl,
00055                                       uint64_t samplerate);
00056 
00057 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines