cdk.h
001: 
002: 
003: 
004: 
005: 
006: 
007: 
008: 
009: 
010: 
011: 
012: 
013: 
014: 
015: 
016: 
017: 
018: 
019: 
020: 
021: 
022: 
023: 
024: 
025: #ifndef _CDK_H
026: #define _CDK_H
027: 
028: 
029: #pragma pack(2)
030: 
031: 
032: 
033: 
034: 
035: 
036: 
037: 
038: 
039: 
040: 
041: 
042: 
043: 
044: #define CDK_SIGADDR     0x200
045: #define CDK_FEATADDR    0x280
046: #define CDK_CDKADDR     0x300
047: #define CDK_RDYADDR     0x262
048: 
049: #define CDK_ALIVEMARKER 13
050: 
051: 
052: 
053: 
054: 
055: 
056: 
057: typedef struct cdkecpsig {
058:         unsigned long   magic;
059:         unsigned short  romver;
060:         unsigned short  cputype;
061:         unsigned char   panelid[8];
062: } cdkecpsig_t;
063: 
064: #define ECP_MAGIC       0x21504345
065: 
066: 
067: 
068: 
069: 
070: 
071: 
072: typedef struct cdkonbsig {
073:         unsigned short  magic0;
074:         unsigned short  magic1;
075:         unsigned short  magic2;
076:         unsigned short  magic3;
077:         unsigned short  romver;
078:         unsigned short  memoff;
079:         unsigned short  memseg;
080:         unsigned short  amask0;
081:         unsigned short  pic;
082:         unsigned short  status;
083:         unsigned short  btype;
084:         unsigned short  clkticks;
085:         unsigned short  clkspeed;
086:         unsigned short  amask1;
087:         unsigned short  amask2;
088: } cdkonbsig_t;
089: 
090: #define ONB_MAGIC0      0xf2a7
091: #define ONB_MAGIC1      0xa149
092: #define ONB_MAGIC2      0x6352
093: #define ONB_MAGIC3      0xf121
094: 
095: 
096: 
097: 
098: 
099: 
100: typedef struct cdkfeature {
101:         unsigned long   debug;
102:         unsigned long   banner;
103:         unsigned long   etype;
104:         unsigned long   nrdevs;
105:         unsigned long   brdspec;
106:         unsigned long   txrqsize;
107:         unsigned long   rxrqsize;
108:         unsigned long   flags;
109: } cdkfeature_t;
110: 
111: #define ETYP_DDK        0
112: #define ETYP_CDK        1
113: 
114: 
115: 
116: 
117: 
118: 
119: typedef struct cdkhdr {
120:         unsigned short  command;
121:         unsigned short  status;
122:         unsigned short  port;
123:         unsigned short  mode;
124:         unsigned long   cmd_buf[14];
125:         unsigned short  alive_cnt;
126:         unsigned short  intrpt_mode;
127:         unsigned char   intrpt_id[8];
128:         unsigned char   ver_release;
129:         unsigned char   ver_modification;
130:         unsigned char   ver_fix;
131:         unsigned char   deadman_restart;
132:         unsigned short  deadman;
133:         unsigned short  nrdevs;
134:         unsigned long   memp;
135:         unsigned long   hostp;
136:         unsigned long   slavep;
137:         unsigned char   hostreq;
138:         unsigned char   slavereq;
139:         unsigned char   cmd_reserved[30];
140: } cdkhdr_t;
141: 
142: #define MODE_DDK        0
143: #define MODE_CDK        1
144: 
145: #define IMD_INTR        0x0
146: #define IMD_PPINTR      0x1
147: #define IMD_POLL        0xff
148: 
149: 
150: 
151: 
152: 
153: 
154: 
155: typedef struct cdkmem {
156:         unsigned short  dtype;
157:         unsigned long   offset;
158: } cdkmem_t;
159: 
160: #define TYP_UNDEFINED   0x0
161: #define TYP_ASYNCTRL    0x1
162: #define TYP_ASYNC       0x20
163: #define TYP_PARALLEL    0x40
164: #define TYP_SYNCX21     0x60
165: 
166: 
167: 
168: 
169: 
170: 
171: 
172: 
173: #define ASYCMD          (((unsigned long) 'a') << 8)
174: 
175: #define A_NULL          (ASYCMD | 0)
176: #define A_FLUSH         (ASYCMD | 1)
177: #define A_BREAK         (ASYCMD | 2)
178: #define A_GETPORT       (ASYCMD | 3)
179: #define A_SETPORT       (ASYCMD | 4)
180: #define A_SETPORTF      (ASYCMD | 5)
181: #define A_SETPORTFTX    (ASYCMD | 6)
182: #define A_SETPORTFRX    (ASYCMD | 7)
183: #define A_GETSIGNALS    (ASYCMD | 8)
184: #define A_SETSIGNALS    (ASYCMD | 9)
185: #define A_SETSIGNALSF   (ASYCMD | 10)
186: #define A_SETSIGNALSFTX (ASYCMD | 11)
187: #define A_SETSIGNALSFRX (ASYCMD | 12)
188: #define A_GETNOTIFY     (ASYCMD | 13)
189: #define A_SETNOTIFY     (ASYCMD | 14)
190: #define A_NOTIFY        (ASYCMD | 15)
191: #define A_PORTCTRL      (ASYCMD | 16)
192: #define A_GETSTATS      (ASYCMD | 17)
193: #define A_RQSTATE       (ASYCMD | 18)
194: #define A_FLOWSTATE     (ASYCMD | 19)
195: #define A_CLEARSTATS    (ASYCMD | 20)
196: 
197: 
198: 
199: 
200: #define FLUSHRX         0x1
201: #define FLUSHTX         0x2
202: 
203: #define BREAKON         -1
204: #define BREAKOFF        -2
205: 
206: 
207: 
208: 
209: 
210: 
211: typedef struct asyport {
212:         unsigned long   baudout;
213:         unsigned long   baudin;
214:         unsigned long   iflag;
215:         unsigned long   oflag;
216:         unsigned long   lflag;
217:         unsigned long   pflag;
218:         unsigned long   flow;
219:         unsigned long   spare1;
220:         unsigned short  vtime;
221:         unsigned short  vmin;
222:         unsigned short  txlo;
223:         unsigned short  txhi;
224:         unsigned short  rxlo;
225:         unsigned short  rxhi;
226:         unsigned short  rxhog;
227:         unsigned short  spare2;
228:         unsigned char   csize;
229:         unsigned char   stopbs;
230:         unsigned char   parity;
231:         unsigned char   stopin;
232:         unsigned char   startin;
233:         unsigned char   stopout;
234:         unsigned char   startout;
235:         unsigned char   parmark;
236:         unsigned char   brkmark;
237:         unsigned char   cc[11];
238: } asyport_t;
239: 
240: #define PT_STOP1        0x0
241: #define PT_STOP15       0x1
242: #define PT_STOP2        0x2
243: 
244: #define PT_NOPARITY     0x0
245: #define PT_ODDPARITY    0x1
246: #define PT_EVENPARITY   0x2
247: #define PT_MARKPARITY   0x3
248: #define PT_SPACEPARITY  0x4
249: 
250: #define F_NONE          0x0
251: #define F_IXON          0x1
252: #define F_IXOFF         0x2
253: #define F_IXANY         0x4
254: #define F_IOXANY        0x8
255: #define F_RTSFLOW       0x10
256: #define F_CTSFLOW       0x20
257: #define F_DTRFLOW       0x40
258: #define F_DCDFLOW       0x80
259: #define F_DSROFLOW      0x100
260: #define F_DSRIFLOW      0x200
261: 
262: #define FI_NORX         0x1
263: #define FI_RAW          0x2
264: #define FI_ISTRIP       0x4
265: #define FI_UCLC         0x8
266: #define FI_INLCR        0x10
267: #define FI_ICRNL        0x20
268: #define FI_IGNCR        0x40
269: #define FI_IGNBREAK     0x80
270: #define FI_DSCRDBREAK   0x100
271: #define FI_1MARKBREAK   0x200
272: #define FI_2MARKBREAK   0x400
273: #define FI_XCHNGBREAK   0x800
274: #define FI_IGNRXERRS    0x1000
275: #define FI_DSCDRXERRS   0x2000
276: #define FI_1MARKRXERRS  0x4000
277: #define FI_2MARKRXERRS  0x8000
278: #define FI_XCHNGRXERRS  0x10000
279: #define FI_DSCRDNULL    0x20000
280: 
281: #define FO_OLCUC        0x1
282: #define FO_ONLCR        0x2
283: #define FO_OOCRNL       0x4
284: #define FO_ONOCR        0x8
285: #define FO_ONLRET       0x10
286: #define FO_ONL          0x20
287: #define FO_OBS          0x40
288: #define FO_OVT          0x80
289: #define FO_OFF          0x100
290: #define FO_OTAB1        0x200
291: #define FO_OTAB2        0x400
292: #define FO_OTAB3        0x800
293: #define FO_OCR1         0x1000
294: #define FO_OCR2         0x2000
295: #define FO_OCR3         0x4000
296: #define FO_OFILL        0x8000
297: #define FO_ODELL        0x10000
298: 
299: #define P_RTSLOCK       0x1
300: #define P_CTSLOCK       0x2
301: #define P_MAPRTS        0x4
302: #define P_MAPCTS        0x8
303: #define P_LOOPBACK      0x10
304: #define P_DTRFOLLOW     0x20
305: #define P_FAKEDCD       0x40
306: 
307: #define P_RXIMIN        0x10000
308: #define P_RXITIME       0x20000
309: #define P_RXTHOLD       0x40000
310: 
311: 
312: 
313: 
314: 
315: typedef struct asysigs {
316:         unsigned long   data;
317:         unsigned long   signal;
318:         unsigned long   sigvalue;
319: } asysigs_t;
320: 
321: #define DT_TXBUSY       0x1
322: #define DT_TXEMPTY      0x2
323: #define DT_TXLOW        0x4
324: #define DT_TXHIGH       0x8
325: #define DT_TXFULL       0x10
326: #define DT_TXHOG        0x20
327: #define DT_TXFLOWED     0x40
328: #define DT_TXBREAK      0x80
329: 
330: #define DT_RXBUSY       0x100
331: #define DT_RXEMPTY      0x200
332: #define DT_RXLOW        0x400
333: #define DT_RXHIGH       0x800
334: #define DT_RXFULL       0x1000
335: #define DT_RXHOG        0x2000
336: #define DT_RXFLOWED     0x4000
337: #define DT_RXBREAK      0x8000
338: 
339: #define SG_DTR          0x1
340: #define SG_DCD          0x2
341: #define SG_RTS          0x4
342: #define SG_CTS          0x8
343: #define SG_DSR          0x10
344: #define SG_RI           0x20
345: 
346: 
347: 
348: 
349: 
350: 
351: typedef struct asynotify {
352:         unsigned long   ctrl;
353:         unsigned long   data;
354:         unsigned long   signal;
355:         unsigned long   sigvalue;
356: } asynotify_t;
357: 
358: 
359: 
360: 
361: 
362: typedef struct {
363:         unsigned long   rxctrl;
364:         unsigned long   txctrl;
365:         char            rximdch;
366:         char            tximdch;
367:         char            spare1;
368:         char            spare2;
369: } asyctrl_t;
370: 
371: #define CT_ENABLE       0x1
372: #define CT_DISABLE      0x2
373: #define CT_STOP         0x4
374: #define CT_START        0x8
375: #define CT_STARTFLOW    0x10
376: #define CT_STOPFLOW     0x20
377: #define CT_SENDCHR      0x40
378: 
379: 
380: 
381: 
382: 
383: 
384: typedef struct asystats {
385:         unsigned long   opens;
386:         unsigned long   txchars;
387:         unsigned long   rxchars;
388:         unsigned long   txringq;
389:         unsigned long   rxringq;
390:         unsigned long   txmsgs;
391:         unsigned long   rxmsgs;
392:         unsigned long   txflushes;
393:         unsigned long   rxflushes;
394:         unsigned long   overruns;
395:         unsigned long   framing;
396:         unsigned long   parity;
397:         unsigned long   ringover;
398:         unsigned long   lost;
399:         unsigned long   rxstart;
400:         unsigned long   rxstop;
401:         unsigned long   txstart;
402:         unsigned long   txstop;
403:         unsigned long   dcdcnt;
404:         unsigned long   dtrcnt;
405:         unsigned long   ctscnt;
406:         unsigned long   rtscnt;
407:         unsigned long   dsrcnt;
408:         unsigned long   ricnt;
409:         unsigned long   txbreaks;
410:         unsigned long   rxbreaks;
411:         unsigned long   signals;
412:         unsigned long   state;
413:         unsigned long   hwid;
414: } asystats_t;
415: 
416: 
417: 
418: 
419: 
420: 
421: 
422: 
423: 
424: typedef struct cdkctrl {
425:         unsigned char   open;
426:         unsigned char   close;
427:         unsigned long   openarg;
428:         unsigned long   closearg;
429:         unsigned long   cmd;
430:         unsigned long   status;
431:         unsigned long   args[32];
432: } cdkctrl_t;
433: 
434: 
435: 
436: 
437: 
438: 
439: 
440: 
441: typedef struct cdkasyrq {
442:         unsigned long   offset;
443:         unsigned short  size;
444:         unsigned short  head;
445:         unsigned short  tail;
446: } cdkasyrq_t;
447: 
448: 
449: 
450: 
451: 
452: 
453: typedef struct cdkasy {
454:         cdkctrl_t       ctrl;
455:         unsigned short  notify;
456:         asynotify_t     changed;
457:         unsigned short  receive;
458:         cdkasyrq_t      rxq;
459:         unsigned short  transmit;
460:         cdkasyrq_t      txq;
461: } cdkasy_t;
462: 
463: #pragma pack()
464: 
465: 
466: 
467: 
468: 
469: 
470: 
471: 
472: #include <linux/ioctl.h>
473: 
474: #define STL_BINTR       _IO('s',20)
475: #define STL_BSTART      _IO('s',21)
476: #define STL_BSTOP       _IO('s',22)
477: #define STL_BRESET      _IO('s',23)
478: 
479: 
480: 
481: 
482: #define STL_GETPFLAG    _IO('s',80)
483: #define STL_SETPFLAG    _IO('s',81)
484: 
485: 
486: #endif
487: 
      
      
      
      
   
      
      
         
            
            © Andrew Scott 2006 -
            2025, 
            All Rights Reserved