1 /*
2  * External IDI interface
3  *
4  * Copyright (C) Eicon Technology Corporation, 2000.
5  *
6  * Eicon File Revision :    1.0
7  *
8  * This software may be used and distributed according to the terms
9  * of the GNU General Public License, incorporated herein by reference.
10  *
11  */
12 
13 #if !defined(IDI_H)
14 #define IDI_H
15 
16 #include "sys.h"
17 
18 /* typedefs for our data structures */
19 
20 typedef struct get_name_s GET_NAME;
21 typedef struct entity_s ENTITY;
22 typedef struct buffers_s BUFFERS;
23 
24 /* IDI request/callback function pointer */
25 
26 typedef void (* IDI_CALL)(ENTITY *);
27 
28 typedef struct {
29   word length;          /* length of data/parameter field           */
30   byte P[270];          /* data/parameter field                     */
31 } DBUFFER;
32 
33 #define REQ_NAME	0x0100
34 #define BOARD_NAME_LENGTH 9
35 struct get_name_s {
36   word command;         /* command = 0x0100 */
37   byte name[BOARD_NAME_LENGTH];
38 };
39 
40 #define REQ_REMOVE    0x0000    /* pointer to word which is 0 */
41 #define REQ_SERIAL    0x0200
42 struct get_serial_s {
43   word      command;            /* command = 0x0200 */
44   dword     serial;             /* serial number */
45 };
46 
47 #define REQ_POSTCALL  0x0300
48 struct postcall_s {
49   word        command;         /* command = 0x0300 */
50   word        dummy;           /* not used */
51   IDI_CALL    callback;        /* routine address to call back */
52   ENTITY      *contxt;         /* ptr to entity to use */
53 };
54 
55 #define REQ_XLOG      0x0400   /* structure is card dependent/defined locally */
56 
57 struct buffers_s {
58   word PLength;
59   byte *P;
60 };
61 
62 struct entity_s {
63   byte                  Req;            /* pending request          */
64   byte                  Rc;             /* return code received     */
65   byte                  Ind;            /* indication received      */
66   byte                  ReqCh;          /* channel of current Req   */
67   byte                  RcCh;           /* channel of current Rc    */
68   byte                  IndCh;          /* channel of current Ind   */
69   byte                  Id;             /* ID used by this entity   */
70   byte                  GlobalId;       /* reserved field           */
71   byte                  XNum;           /* number of X-buffers      */
72   byte                  RNum;           /* number of R-buffers      */
73   BUFFERS               *X;        		/* pointer to X-buffer list */
74   BUFFERS               *R;        		/* pointer to R-buffer list */
75   word                  RLength;        /* length of current R-data */
76   DBUFFER               *RBuffer;       /* buffer of current R-data */
77   byte                  RNR;            /* receive not ready flag   */
78   byte                  complete;       /* receive complete status  */
79   IDI_CALL              callback;
80 
81   word                  user[2];
82 
83         /* fields used by the driver internally                     */
84   byte                  No;             /* entity number            */
85   byte                  reserved2;      /* reserved field           */
86   byte                  More;           /* R/X More flags           */
87   byte                  MInd;           /* MDATA coding for this ID */
88   byte                  XCurrent;       /* current transmit buffer  */
89   byte                  RCurrent;       /* current receive buffer   */
90   word                  XOffset;        /* offset in x-buffer       */
91   word                  ROffset;        /* offset in r-buffer       */
92 };
93 
94 typedef struct {
95   byte                  type;
96   byte                  channels;
97   word                  features;
98   /* dword		serial; */
99   IDI_CALL              request;
100 } DESCRIPTOR;
101 
102 extern void    DIVA_DIDD_Read(DESCRIPTOR *, int);
103 
104         /* descriptor type field coding */
105 #define IDI_ADAPTER_S           1
106 #define IDI_ADAPTER_PR          2
107 #define IDI_ADAPTER_DIVA        3
108 #define IDI_ADAPTER_MAESTRA     4
109 #define IDI_ADAPTER_MAESTRAQ    5
110 #define IDI_ADAPTER_MAESTRAP    6
111 #define IDI_VADAPTER            0x40
112 #define IDI_DRIVER              0x80
113 #define IDI_DIMAINT             0xff
114 
115 /* feature bit mask values */
116 
117 #define DI_VOICE        0x0 /* obsolete define */
118 #define DI_FAX3         0x1
119 #define DI_MODEM        0x2
120 #define DI_POST         0x4
121 #define DI_V110         0x8
122 #define DI_V120         0x10
123 #define DI_POTS         0x20
124 #define DI_CODEC        0x40
125 #define DI_MANAGE       0x80
126 #define DI_V_42         0x0100
127 #define DI_EXTD_FAX     0x0200 /* Extended FAX (ECM, 2D, T.6, Polling) */
128 
129 #endif /* IDI_H */
130