Add support for newer CPU models.
[dragonfly.git] / usr.sbin / i4b / isdnphone / defs.h
blob7cf1c5ebea95adacc8498d5595379a290b4f5983
1 /*
2 * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
25 *---------------------------------------------------------------------------
27 * isdnphone - header file
28 * =======================
30 * $Id: defs.h,v 1.6 1999/12/13 21:25:26 hm Exp $
32 * $FreeBSD: src/usr.sbin/i4b/isdnphone/defs.h,v 1.2.2.1 2001/08/01 17:45:06 obrien Exp $
33 * $DragonFly: src/usr.sbin/i4b/isdnphone/defs.h,v 1.3 2003/08/08 04:18:45 dillon Exp $
35 * last edit-date: [Mon Dec 13 21:52:46 1999]
37 *----------------------------------------------------------------------------*/
39 #include <ncurses.h>
40 #include <stdio.h>
41 #include <stdarg.h>
42 #include <signal.h>
43 #include <errno.h>
44 #include <string.h>
45 #include <stdlib.h>
46 #include <unistd.h>
47 #include <fcntl.h>
48 #include <ctype.h>
50 #include <sys/stat.h>
51 #include <sys/wait.h>
52 #include <sys/ioctl.h>
53 #include <sys/soundcard.h>
54 #include <sys/types.h>
55 #include <sys/time.h>
56 #include <sys/param.h>
58 #include <i4b_machine/i4b_ioctl.h>
59 #include <i4b_machine/i4b_tel_ioctl.h>
61 /* device file prefixes */
63 #define I4BTELDEVICE "/dev/i4btel"
64 #define I4BTELDDEVICE "/dev/i4bteld"
65 #define AUDIODEVICE "/dev/audio"
67 #define GOOD 0
68 #define ERROR (-1)
69 #define WARNING (-2)
71 /* main window dimensions */
73 #define MW_ROW 5
74 #define MW_COL 8
76 #define MW_WIDTH 60
77 #define MW_HEIGHT 8
79 #define DB_ROW 15
80 #define DB_COL 1
81 #define DB_WID 79
82 #define DB_HGT 9
84 #define MW_STATEY 2
85 #define MW_STATEX 1
86 #define MW_STX 10
88 #define MW_NUMY 4
89 #define MW_NUMX 1
90 #define MW_NUX 10
92 #define MW_MSGY 6
93 #define MW_MSGX 1
94 #define MW_MSX 10
96 /* fullscreen mode menu window */
98 #define WMITEMS 4 /* no of items */
99 #define WMENU_LEN 18 /* window width */
100 #define WMENU_HGT (WMITEMS+4) /* window height */
101 #define WMENU_TITLE "Command"
102 #define WMENU_POSLN 8 /* window position: lines */
103 #define WMENU_POSCO 20 /* window position: columns */
105 #define CR 0x0d
106 #define LF 0x0a
107 #define TAB 0x09
108 #define CNTRL_D 0x04
109 #define CNTRL_L 0x0c
111 #define ST_IDLE 0
112 #define ST_DIALING 1
113 #define ST_ACTIVE 2
114 #define ST_MAX 2
116 #define AUDIORATE 8000
118 #ifdef MAIN
120 WINDOW *main_w; /* curses main window pointer */
121 WINDOW *dbg_w;
123 int curses_ready = 0; /* flag, curses display is initialized */
124 int state = ST_IDLE;
126 char *states[] = {
127 "IDLE",
128 "DIALING",
129 "ACTIVE"
132 int dialerfd = -1;
133 int audiofd = -1;
134 int telfd = -1;
135 int curx;
136 char numberbuffer[TELNO_MAX];
138 int play_fmt = AFMT_MU_LAW;
139 int rec_fmt = AFMT_MU_LAW;
141 int opt_unit = 0;
142 int opt_d = 0;
143 #else
145 extern WINDOW *main_w;
146 extern WINDOW *dbg_w;
148 extern int curses_ready;
149 extern int state;
151 extern char *states[];
153 extern int dialerfd;
154 extern int audiofd;
155 extern int telfd;
156 extern int curx;
157 extern char numberbuffer[];
159 extern int play_fmt;
160 extern int rec_fmt;
162 int opt_unit;
163 int opt_d;
165 #endif
167 extern void audio_hdlr ( void );
168 extern void tel_hdlr ( void );
169 extern void init_mainw ( void );
170 extern int init_audio ( char * );
171 extern void do_menu ( void );
172 extern int main ( int argc, char **argv );
173 extern void do_quit ( int exitval );
174 extern void fatal ( char *fmt, ... );
175 extern void message ( char *fmt, ... );
176 extern void do_dial ( char *number );
177 extern void do_hangup ( void );
179 extern void audiowrite ( int, unsigned char * );
180 extern void telwrite ( int, unsigned char * );
182 extern void newstate ( int newstate );
184 int init_dial(char *device);
185 void dial_hdlr(void);
186 int init_tel(char *device);
188 extern void debug ( char *fmt, ... );
190 /* EOF */