]>
Commit | Line | Data |
---|---|---|
a5c0259c GS |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2018 Gerhard Sittig <gerhard.sittig@gmx.net> | |
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_MICROCHIP_PICKIT2_PROTOCOL_H | |
21 | #define LIBSIGROK_HARDWARE_MICROCHIP_PICKIT2_PROTOCOL_H | |
22 | ||
a5c0259c | 23 | #include <glib.h> |
bde6a99b GS |
24 | #include <stdint.h> |
25 | #include <stdlib.h> | |
a5c0259c GS |
26 | #include <libsigrok/libsigrok.h> |
27 | #include "libsigrok-internal.h" | |
28 | ||
29 | #define LOG_PREFIX "microchip-pickit2" | |
30 | ||
bde6a99b GS |
31 | #define PICKIT2_CHANNEL_COUNT 3 |
32 | #define PICKIT2_SAMPLE_COUNT 1024 | |
33 | #define PICKIT2_SAMPLE_RAWLEN (4 * 128) | |
34 | ||
35 | enum pickit_state { | |
36 | STATE_IDLE, | |
37 | STATE_CONF, | |
38 | STATE_WAIT, | |
39 | STATE_DATA, | |
40 | }; | |
41 | ||
a5c0259c | 42 | struct dev_context { |
bde6a99b GS |
43 | enum pickit_state state; |
44 | const uint64_t *samplerates; | |
45 | size_t num_samplerates; | |
46 | size_t curr_samplerate_idx; | |
47 | const uint64_t *captureratios; | |
48 | size_t num_captureratios; | |
49 | size_t curr_captureratio_idx; | |
50 | struct sr_sw_limits sw_limits; | |
51 | gboolean detached_kernel_driver; | |
e760f2cd | 52 | int32_t triggers[PICKIT2_CHANNEL_COUNT]; /**@< see @ref SR_TRIGGER_ZERO et al */ |
bde6a99b GS |
53 | size_t trigpos; |
54 | uint8_t samples_raw[PICKIT2_SAMPLE_RAWLEN]; | |
55 | uint8_t samples_conv[PICKIT2_SAMPLE_COUNT]; | |
a5c0259c GS |
56 | }; |
57 | ||
bde6a99b | 58 | SR_PRIV int microchip_pickit2_setup_trigger(const struct sr_dev_inst *sdi); |
a5c0259c GS |
59 | SR_PRIV int microchip_pickit2_receive_data(int fd, int revents, void *cb_data); |
60 | ||
61 | #endif |