]>
Commit | Line | Data |
---|---|---|
8f4e922f UH |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2014 Uwe Hermann <uwe@hermann-uwe.de> | |
25abc8dd | 5 | * Copyright (C) 2014 Matthias Heidbrink <m-sigrok@heidbrink.biz> |
8f4e922f UH |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | */ | |
21 | ||
22 | #ifndef LIBSIGROK_HARDWARE_MANSON_HCS_3XXX_PROTOCOL_H | |
23 | #define LIBSIGROK_HARDWARE_MANSON_HCS_3XXX_PROTOCOL_H | |
24 | ||
25 | #include <stdint.h> | |
b5e92647 UH |
26 | #include <string.h> |
27 | #include <math.h> | |
8f4e922f UH |
28 | #include <glib.h> |
29 | #include "libsigrok.h" | |
30 | #include "libsigrok-internal.h" | |
31 | ||
32 | #define LOG_PREFIX "manson-hcs-3xxx" | |
33 | ||
b5e92647 | 34 | enum { |
25abc8dd MH |
35 | MANSON_HCS_3100, |
36 | MANSON_HCS_3102, | |
37 | MANSON_HCS_3104, | |
38 | MANSON_HCS_3150, | |
b5e92647 UH |
39 | MANSON_HCS_3200, |
40 | MANSON_HCS_3202, | |
41 | MANSON_HCS_3204, | |
25abc8dd MH |
42 | MANSON_HCS_3300, |
43 | MANSON_HCS_3302, | |
44 | MANSON_HCS_3304, | |
45 | MANSON_HCS_3400, | |
46 | MANSON_HCS_3402, | |
47 | MANSON_HCS_3404, | |
48 | MANSON_HCS_3600, | |
49 | MANSON_HCS_3602, | |
50 | MANSON_HCS_3604, | |
b5e92647 UH |
51 | }; |
52 | ||
53 | struct hcs_model { | |
25abc8dd MH |
54 | int model_id; /**< Model info */ |
55 | char *name; /**< Model name */ | |
56 | char *id; /**< Model ID, like delivered by interface */ | |
57 | double voltage[3]; /**< Min, max, step */ | |
58 | double current[3]; /**< Min, max, step */ | |
b5e92647 UH |
59 | }; |
60 | ||
8f4e922f UH |
61 | /** Private, per-device-instance driver context. */ |
62 | struct dev_context { | |
b5e92647 UH |
63 | struct hcs_model *model; |
64 | ||
65 | uint64_t limit_samples; | |
66 | uint64_t limit_msec; | |
67 | uint64_t num_samples; | |
68 | int64_t starttime; | |
69 | int64_t req_sent_at; | |
70 | gboolean reply_pending; | |
71 | ||
72 | void *cb_data; | |
73 | ||
74 | float voltage; | |
75 | float current; | |
76 | gboolean cc_mode; | |
77 | ||
78 | char buf[50]; | |
79 | int buflen; | |
8f4e922f UH |
80 | }; |
81 | ||
b5e92647 | 82 | SR_PRIV int hcs_receive_data(int fd, int revents, void *cb_data); |
8f4e922f UH |
83 | |
84 | #endif |