1 /*
2  * Changes for use with CM11A copyright 1996, 1997 Daniel B. Suthers,
3  * Pleasanton Ca, 94588 USA
4  * E-mail dbs@tanj.com
5  *
6  */
7 /*
8  * Copyright 1986 by Larry Campbell, 73 Concord Street, Maynard MA 01754 USA
9  * (maynard!campbell).
10  *
11  * John Chmielewski (tesla!jlc until 9/1/86, then rogue!jlc) assisted
12  * by doing the System V port and adding some nice features.  Thanks!
13  */
14 
15 /*
16  *   This program is free software: you can redistribute it and/or modify
17  *   it under the terms of the GNU General Public License as published by
18  *   the Free Software Foundation, either version 3 of the License, or
19  *   (at your option) any later version.
20  *
21  *   This program is distributed in the hope that it will be useful,
22  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
23  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  *   GNU General Public License for more details.
25  *
26  *   You should have received a copy of the GNU General Public License
27  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
28  *
29  */
30 
31 /*
32  * X-10 CM11 Computer Interface Definitions
33  */
34 
35 /***********************************************************************/
36 /* You probably only need to hack this section to reconfigure for      */
37 /* your system                                                         */
38 /***********************************************************************/
39 
40 #ifndef _x10_header
41 #define _x10_header
42 
43 /* Some lints don't know about the void type */
44 #include "local.h"
45 
46 #ifdef VOID
47 #define void int
48 #endif
49 
50 #ifdef  SCO
51 #define _IBCS2
52 #endif
53 
54 #if 0
55 #ifndef XDIR
56 #define XDIR "."		/* directory containing X10 files */
57 #endif
58 #endif
59 
60 /* directory for spool file */
61 #ifndef SPOOLDIR
62 #define SPOOLDIR "/var/tmp/heyu"
63 #endif
64 
65 /* directory used for locks, specified in the Filesystem Hierarchy Standard */
66 #ifndef LOCKDIR
67 #define LOCKDIR "/var/lock"
68 #endif
69 
70 /* Base directory under user $HOME */
71 #define HOMEBASEDIR           ".heyu/"
72 
73 /* system-wide Heyu base directory */
74 #ifndef SYSBASEDIR
75 #define SYSBASEDIR "/etc/heyu"
76 #endif
77 
78 #define SPOOLFILE  "heyu.out"
79 #define RELAYFILE  "heyu.relay"
80 #define WRITEFILE  "heyu.write"
81 #define AUXFILE    "heyu.aux"
82 #define LOGFILE    "heyu.log"
83 
84 #if 0
85 #define IDFILE "/x10id"		/* description file for X10 modules */
86 #define ALIASFILE "/.x10config"	/* description file for X10 modules */
87 #endif
88 
89 #ifdef  MINIEXCH		/* if talking through a DEC Mini-Exchange */
90 #define MINIXPORT 3		/* port number X10 gizmo is plugged in to */
91 #endif
92 
93 #ifdef  VENIX
94 #define SMALLPAUSE -10		/* 1/6th of a second sleep(3) (VENIX only) */
95 #else
96 #define SMALLPAUSE 1
97 #endif
98 
99 #define TIMEOUT 10		/* seconds to wait for data */
100 #if 0
101 #define DTIMEOUT 15		/* timeout for dim and diagnostic commands */
102 #endif
103 
104 /***********************************************************************/
105 /*                  End of configuration section                       */
106 /***********************************************************************/
107 
108 /* Bitmaps for bits 0-3 of the CM11a send status block - (per CWS) */
109 #define  RESERVED_STATUS_BIT      8
110 #define  PURGE_DELAYED_MACROS     4
111 #define  RESET_BATTERY_TIMER      2
112 #define  MONITORED_STATUS_CLEAR   1
113 
114 #if 0
115 #define SYNCN 16		/* number of FF chars to send before packet */
116 
117 #define CHKSUM(buf) chksum(buf, sizeof(buf))
118 #endif
119 
120 #define DIM 0x4
121 #define BRIGHT 0x5
122 #define EXTCODE 0x7
123 #define EXTEND 0xC
124 #define PRESET1 0xA
125 #define PRESET2 0xB
126 
127 #if 0
128 /* Event item as stored in event file */
129 
130 struct evitem
131     {
132     unsigned e_num;
133     unsigned char e_buf[8];
134     };
135 
136 #define EVSIZE sizeof(struct evitem)
137 
138 #define EVENTS "events"		/* event data keyword */
139 #define ETOTAL 128		/* total number of events */
140 #define ESIZE  8		/* size of event data field */
141 #define EVCMD  12		/* size of event command */
142 
143 /* Data item as stored in data file */
144 
145 struct ditem
146     {
147     unsigned d_num;
148     unsigned char d_buf[2];
149     };
150 
151 #define DISIZE 6	/* sizeof not used as it includes holes */
152 
153 #define DATA   "data"		/* id data keyword */
154 #define DTOTAL 256		/* total number of id's */
155 #define DSIZE  2		/* size of id data field */
156 #define DICMD  6		/* size of data command */
157 
158 /* description field structure */
159 
160 #define DLENGTH 40		/* length of the description field */
161 
162 struct id
163     {
164     char describe[DLENGTH];
165     };
166 
167 /* Command codes */
168 
169 #define SETHCODE	0	/* load house code */
170 #define DIRCMD		1	/* direct command */
171 #define SETCLK		2	/* set clock */
172 #define DATALOAD	3	/* timer/graphics data download */
173 #define GETINFO		4	/* get house code and clock */
174 #define GETEVENTS	5	/* get timer events */
175 #define GETDATA		6	/* get graphics data */
176 #define DIAGNOSE	7	/* run diagnostic */
177 
178 #define XMTSYNC		16	/* transmitted sync length */
179 #define RCVSYNC		6	/* received sync length */
180 
181 /* House code magic numbers */
182 
183 #define HC_A	06
184 #define HC_B	016
185 #define HC_C	02
186 #define HC_D	012
187 #define HC_E	01
188 #define HC_F	011
189 #define HC_G	05
190 #define HC_H	015
191 #define HC_I	07
192 #define HC_J	017
193 #define HC_K	03
194 #define HC_L	013
195 #define HC_M	0
196 #define HC_N	010
197 #define HC_O	04
198 #define HC_P	014
199 
200 struct hstruct
201     {
202     unsigned char h_code;
203     char h_letter;
204     };
205 
206 struct nstruct
207     {
208     char *n_name;
209     char n_code;
210     };
211 #endif
212 
213 /* Message definitions */
214 
215 #define EM_2MANY	"Too many command line arguments"
216 #define EM_INVCN	"Invalid command name"
217 #define EM_WNA		"Wrong number of arguments"
218 #define EM_NMA		"Need more command line arguments"
219 #define EM_NOCMD	"No command argument specified"
220 
221 /* External Variables */
222 
223 extern char *E_2MANY, *E_INVCN, *E_WNA, *E_NMA, *E_NOCMD;
224 extern void display();
225 #endif	/* _x10_header */
226