]> sigrok.org Git - libsigrok.git/blob - src/hardware/sysclk-sla5032/sla5032.h
sysclk-sla5032: Shorten sla5032_start_sample() a bit.
[libsigrok.git] / src / hardware / sysclk-sla5032 / sla5032.h
1 /*
2  * This file is part of the libsigrok project.
3  *
4  * Copyright (C) 2019 Vitaliy Vorobyov
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef LIBSIGROK_HARDWARE_SYSCLK_SLA5032_SLA5032_H
21 #define LIBSIGROK_HARDWARE_SYSCLK_SLA5032_SLA5032_H
22
23 #include <stdint.h>
24 #include <libusb.h>
25 #include <glib.h>
26 #include <libsigrok/libsigrok.h>
27
28 /** SLA5032 protocol command ID codes. */
29 enum command_id {
30         CMD_INIT_FW_UPLOAD = 1,
31         CMD_UPLOAD_FW_CHUNK = 2,
32         CMD_READ_REG = 3,
33         CMD_WRITE_REG = 4,
34         CMD_READ_MEM = 5,
35         CMD_READ_DATA = 7,
36 };
37
38 struct sr_usb_dev_inst;
39
40 SR_PRIV int sla5032_apply_fpga_config(const struct sr_dev_inst* sdi);
41 SR_PRIV int sla5032_start_sample(const struct sr_usb_dev_inst *usb);
42 SR_PRIV int sla5032_get_status(const struct sr_usb_dev_inst *usb, uint32_t status[3]);
43 SR_PRIV int sla5032_set_read_back(const struct sr_usb_dev_inst *usb);
44 SR_PRIV int sla5032_read_data_chunk(const struct sr_usb_dev_inst *usb, void *buf, unsigned int len, int *xfer_len);
45 SR_PRIV int sla5032_set_depth(const struct sr_usb_dev_inst *usb, uint32_t pre, uint32_t post);
46 SR_PRIV int sla5032_set_triggers(const struct sr_usb_dev_inst *usb,  uint32_t trg_value, uint32_t trg_edge_mask, uint32_t trg_mask);
47 SR_PRIV int sla5032_set_samplerate(const struct sr_usb_dev_inst *usb, unsigned int sr);
48 SR_PRIV int sla5032_set_pwm1(const struct sr_usb_dev_inst *usb, uint32_t hi, uint32_t lo);
49 SR_PRIV int sla5032_set_pwm2(const struct sr_usb_dev_inst* usb, uint32_t hi, uint32_t lo);
50 SR_PRIV int sla5032_write_reg14_zero(const struct sr_usb_dev_inst* usb);
51
52 #endif