-
Notifications
You must be signed in to change notification settings - Fork 0
/
state.h
79 lines (66 loc) · 2.1 KB
/
state.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* -*- linux-c -*-
*
* Main state definition
*
* This file is part of oblsc.
*
* Copyright (C) 2010-2011 Frej Drejhammar <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef _STATE_H_
#define _STATE_H_
#include <glib.h>
#include <termios.h>
#include <unistd.h>
#include "sump.h"
#define MEMORY_SIZE (24*1024) /* bytes */
#define CLOCK_FREQ 100000000 /* Hz */
#define NOOF_TRIGGERS 4
#define MAX_SAMPLE_DELAY 0xFFFF
struct signal_def {
gint index;
gchar *name;
gint noof_bits;
guint32 mask;
GList *channels; /* gints */
};
struct state {
/* Command line parameters */
gchar *device;
gchar *outfile;
speed_t baudrate;
glong sample_rate;
gboolean external_clock;
gboolean external_invert;
gboolean filter;
gchar *trigger_spec;
gint trigger_holdoff;
guint32 channels_in_use; /* Bit-vector of used channels */
gint noof_signals;
GList *signals; /* struct signal_def* */
struct sump_trigger triggers[NOOF_TRIGGERS];
};
/* channels is a list of gints */
void state_add_signal(struct state *state, gchar *name, GList *channels);
gint state_noof_channel_groups_in_use(struct state *state);
/* Return the size of the buffer in number of samples */
gint state_buffer_capacity(struct state *state);
/* Return NULL if no such signal is defined */
struct signal_def *state_lookup_signal(struct state *state, gchar *name);
guint32 state_signal_value(struct signal_def *signal,
guint32 value);
guint32 state_signal_mask(struct signal_def *signal);
#endif /* _STATE_H_ */