4 * $Header: bsd_audioirig.h,v 1.0 93/08/02 12:42:00
7 #ifndef _BSD_AUDIOIRIG_H_
8 #define _BSD_AUDIOIRIG_H_
12 /********************************************************************/
18 #if defined(__STDC__) || (!defined(sun) && !defined(ibm032) && !defined(__GNUC))
19 #define AUDIO_IRIG_OPEN _IO('A', 50)
20 #define AUDIO_IRIG_CLOSE _IO('A', 51)
21 #define AUDIO_IRIG_SETFORMAT _IOWR('A', 52, int)
23 #define AUDIO_IRIG_OPEN _IO(A, 50)
24 #define AUDIO_IRIG_CLOSE _IO(A, 51)
25 #define AUDIO_IRIG_SETFORMAT _IOWR(A, 52, int)
31 #define AUDIO_IRIG_BADSIGNAL 0x01
32 #define AUDIO_IRIG_BADDATA 0x02
33 #define AUDIO_IRIG_BADSYNC 0x04
34 #define AUDIO_IRIG_BADCLOCK 0x08
35 #define AUDIO_IRIG_OLDDATA 0x10
37 /********************************************************************/
42 #define AUIB_SIZE (0x0040)
43 #define AUIB_INC (0x0008)
44 #define AUIB_MOD(k) ((k) & 0x0038)
45 #define AUIB_INIT(ib) ((ib)->ib_head = (ib)->ib_tail = (ib)->ib_lock = \
46 (ib)->phase = (ib)->shi = (ib)->slo = (ib)->high = \
47 (ib)->level0 = (ib)->level1 = \
48 (ib)->shift[0] = (ib)->shift[1] = (ib)->shift[2] = \
49 (ib)->shift[3] = (ib)->sdata[0] = (ib)->sdata[1] = \
50 (ib)->sdata[2] = (ib)->sdata[3] = (ib)->err = 0)
51 #define AUIB_EMPTY(ib) ((ib)->ib_head == (ib)->ib_tail)
52 #define AUIB_LEN(ib) (AUIB_MOD((ib)->ib_tail - (ib)->ib_head))
53 #define AUIB_LEFT(ib) (AUIB_MOD((ib)->ib_head - (ib)->ib_tail - 1))
55 #define IRIGLEVEL 1355
59 * irig_time holds IRIG data for one second
62 struct timeval stamp
; /* timestamp */
63 u_char bits
[13]; /* 100 irig data bits */
64 u_char status
; /* status byte */
65 char time
[14]; /* time string */
69 * auib's are used for IRIG data communication between the trap
70 * handler and the software interrupt.
73 /* driver variables */
74 u_short active
; /* 0=inactive, else=active */
75 u_short format
; /* time output format */
76 struct irig_time timestr
; /* time structure */
77 char buffer
[14]; /* output formation buffer */
79 /* hardware interrupt variables */
80 struct timeval tv1
,tv2
,tv3
; /* time stamps (median filter) */
81 int level0
,level1
; /* lo/hi input levels */
82 int level
; /* decision level */
83 int high
; /* recent largest sample */
84 int sl0
,sl1
; /* recent sample levels */
85 int lasts
; /* last sample value */
86 u_short scount
; /* sample count */
87 u_long eacc
; /* 10-bit element accumulator */
88 u_long ebit
; /* current bit in element */
89 u_char r_level
,mmr1
; /* recording level 0-255 */
90 int shi
,slo
,phase
; /* AGC variables */
91 u_long err
; /* error status bits */
92 int ecount
; /* count of elements this second */
93 long shift
[4]; /* shift register of pos ident */
94 long sdata
[4]; /* shift register of symbols */
96 int ib_head
; /* queue head */
97 int ib_tail
; /* queue tail */
98 u_short ib_lock
; /* queue head lock */
99 u_long ib_data
[AUIB_SIZE
]; /* data buffer */
103 #endif /* _BSD_AUDIOIRIG_H_ */