File: proscope.h

package info (click to toggle)
xoscope 2.0-3.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,760 kB
  • ctags: 1,110
  • sloc: ansic: 9,820; sh: 3,369; makefile: 86; perl: 42
file content (66 lines) | stat: -rw-r--r-- 1,730 bytes parent folder | download | duplicates (2)
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
/*
 * @(#)$Id: proscope.h,v 2.0 2008/12/17 17:35:46 baccala Exp $
 *
 * Copyright (C) 1997 - 2000 Tim Witham <twitham@quiknet.com>
 *
 * (see the files README and COPYING for more details)
 *
 * This file defines ProbeScope serial bits and function prototypes.
 *
 */

/* convenience/readability macro */
#define BIT_MASK(bitnum)	(1 << (bitnum))

/* Radio Shack ProbeScope serial data protocol bit definitions */

#define PS_WAIT		BIT_MASK(0) /* WAITING! for trigger? */

#define PS_10V		BIT_MASK(2) /* voltage switch */
#define PS_100V		BIT_MASK(3)
#define PS_AC		BIT_MASK(4) /* coupling switch */
#define PS_DC		BIT_MASK(5)

#define PS_SINGLE	BIT_MASK(0) /* trigger mode */
#define PS_MEXT		BIT_MASK(3) /* trigger type Plus/Minus Ext/Int */
#define PS_PEXT		BIT_MASK(4)
#define PS_MINT		BIT_MASK(5) /* (documentation was off-by-one here) */
#define PS_PINT		BIT_MASK(6)

#define PS_TP5		BIT_MASK(2) /* Trigger Plus/Minus 0.n */
#define PS_TP3		BIT_MASK(3)
#define PS_TP1		BIT_MASK(4)
#define PS_TM1		BIT_MASK(5)
#define PS_TM3		BIT_MASK(6)

#define PS_OVERFLOW	BIT_MASK(0)
#define PS_UNDERFLOW	BIT_MASK(1)
#define PS_MINUS	BIT_MASK(3)

#ifdef PSDEBUG
#undef PSDEBUG
#define PSDEBUG(format, arg) printf(format, arg)
#else
#define PSDEBUG(format, arg) ;
#endif

typedef struct ProbeScope {	/* The state of the ProbeScope */
  short probed;
  short found;
  short wait;
  short volts;
  char *coupling;
  unsigned char trigger;
  short level;
  short dvm;
  unsigned char flags;
} ProbeScope;
extern ProbeScope ps;

extern int init_serial_probescope(void);
extern int init_serial_bitscope(void);
extern void flush_serial(int fd);
extern void cleanup_serial(int fd);
extern int getonebyte(int fd);

extern int idprobescope(int fd);