2 * Middle-level code for Cronyx Tau32-PCI adapters.
4 * Copyright (C) 2004 Cronyx Engineering
5 * Copyright (C) 2004 Roman Kurakin <rik@FreeBSD.org>
7 * This software is distributed with NO WARRANTIES, not even the implied
8 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 * Authors grant any other persons or organisations a permission to use,
11 * modify and redistribute this software in source and binary forms,
12 * as long as this message is kept with the software, all derivative
13 * works or modified versions.
15 * $Cronyx: ceddk.h,v 1.2.6.1 2005/11/09 13:01:39 rik Exp $
19 #define TAU32_UserContext_Add void *sys;
20 #define TAU32_UserRequest_Add void *sys; TAU32_UserRequest *next;
22 #include <dev/ce/tau32-ddk.h>
24 #define NCHAN TAU32_CHANNELS
34 typedef struct _ce_buf_item_t {
35 TAU32_UserRequest req;
36 unsigned char buf [BUFSZ+4];
40 typedef struct _ce_buf_t {
41 ce_buf_item_t tx_item[TAU32_IO_QUEUE];
42 ce_buf_item_t rx_item[TAU32_IO_QUEUE];
46 unsigned long bpv; /* bipolar violations */
47 unsigned long fse; /* frame sync errors */
48 unsigned long crce; /* CRC errors */
49 unsigned long rcrce; /* remote CRC errors (E-bit) */
50 unsigned long uas; /* unavailable seconds */
51 unsigned long les; /* line errored seconds */
52 unsigned long es; /* errored seconds */
53 unsigned long bes; /* bursty errored seconds */
54 unsigned long ses; /* severely errored seconds */
55 unsigned long oofs; /* out of frame seconds */
56 unsigned long css; /* controlled slip seconds */
57 unsigned long dm; /* degraded minutes */
60 typedef struct _ce_chan_t {
63 #define T_NONE 0 /* no channel */
64 #define T_E1 3 /* E1 */
65 #define T_DATA 6 /* no physical interface */
67 struct _ce_board_t *board;
70 ce_buf_item_t *tx_item;
71 ce_buf_item_t *rx_item;
72 TAU32_UserRequest *rx_queue;
73 TAU32_UserRequest *tx_queue;
75 unsigned char debug_shadow;
76 void (*transmit) (struct _ce_chan_t*, void*, int);
77 void (*receive) (struct _ce_chan_t*, unsigned char*, int);
78 void (*error) (struct _ce_chan_t*, int);
92 unsigned long underrun;
93 unsigned long overrun;
97 unsigned short status; /* E1/G.703 line status bit mask */
98 #define ESTS_NOALARM 0x0001 /* no alarm present */
99 #define ESTS_FARLOF 0x0002 /* receiving far loss of framing */
100 #define ESTS_AIS 0x0008 /* receiving all ones */
101 #define ESTS_LOF 0x0020 /* loss of framing */
102 #define ESTS_LOS 0x0040 /* loss of signal */
103 #define ESTS_AIS16 0x0100 /* receiving all ones in timeslot 16 */
104 #define ESTS_FARLOMF 0x0200 /* receiving alarm in timeslot 16 */
105 #define ESTS_LOMF 0x0400 /* loss of multiframe sync */
106 #define ESTS_TSTREQ 0x0800 /* test code detected */
107 #define ESTS_TSTERR 0x1000 /* test error */
109 unsigned long totsec; /* total seconds elapsed */
110 unsigned long cursec; /* current seconds elapsed */
111 unsigned long degsec; /* degraded seconds */
112 unsigned long degerr; /* errors during degraded seconds */
113 ce_gstat_t currnt; /* current 15-min interval data */
114 ce_gstat_t total; /* total statistics data */
115 ce_gstat_t interval [48]; /* 12 hour period data */
117 unsigned int acc_status;
118 unsigned long config;
121 unsigned long ts_mask;
125 unsigned char higain;
127 unsigned char scrambler;
128 unsigned char unfram;
129 unsigned char monitor;
132 unsigned char gsyn; /* G.703 clock mode */
133 #define GSYN_INT 0 /* internal transmit clock source */
134 #define GSYN_RCV 1 /* transmit clock source = receive */
135 #define GSYN_RCV0 2 /* tclk = rclk from channel 0 */
136 #define GSYN_RCV1 3 /* ...from channel 1 */
141 #define CONFREQSZ 128
142 typedef struct _ce_conf_req {
143 TAU32_UserRequest req[CONFREQSZ+10];
144 TAU32_UserRequest *queue;
148 typedef struct _ce_board_t {
149 TAU32_UserContext ddk;
150 ce_chan_t chan[NCHAN];
153 #define TAU32_BASE_NAME "Tau-PCI-32"
154 #define TAU32_LITE_NAME "Tau-PCI-32/Lite"
155 #define TAU32_ADPCM_NAME "Tau-PCI-32/ADPCM"
156 #define TAU32_UNKNOWN_NAME "Unknown Tau-PCI-32"
159 TAU32_CrossMatrix dxc;
164 void ce_set_dtr (ce_chan_t *c, int on);
165 void ce_set_rts (ce_chan_t *c, int on);
166 int ce_get_cd (ce_chan_t *c);
167 int ce_get_cts (ce_chan_t *c);
168 int ce_get_dsr (ce_chan_t *c);
170 int ce_transmit_space (ce_chan_t *c);
171 int ce_send_packet (ce_chan_t *c, unsigned char *buf, int len, void *tag);
172 void ce_start_chan (ce_chan_t *c, int tx, int rx, ce_buf_t *cb, unsigned long phys);
173 void ce_stop_chan (ce_chan_t *c);
174 void ce_register_transmit (ce_chan_t *c, void (*func) (ce_chan_t*, void*, int));
175 void ce_register_receive (ce_chan_t *c, void (*func) (ce_chan_t*,
176 unsigned char*, int));
177 void ce_register_error (ce_chan_t *c, void (*func) (ce_chan_t*, int));
179 void TAU32_CALLBACK_TYPE
180 ce_error_callback(TAU32_UserContext *pContext, int Item,
181 unsigned NotifyBits);
182 void TAU32_CALLBACK_TYPE
183 ce_status_callback(TAU32_UserContext *pContext, int Item,
184 unsigned NotifyBits);
186 void ce_set_baud (ce_chan_t *c, unsigned long baud);
187 void ce_set_lloop (ce_chan_t *c, unsigned char on);
188 void ce_set_rloop (ce_chan_t *c, unsigned char on);
189 void ce_set_higain (ce_chan_t *c, unsigned char on);
190 void ce_set_unfram (ce_chan_t *c, unsigned char on);
191 void ce_set_ts (ce_chan_t *c, unsigned long ts);
192 void ce_set_phony (ce_chan_t *c, unsigned char on);
193 void ce_set_scrambler (ce_chan_t *c, unsigned char on);
194 void ce_set_monitor (ce_chan_t *c, unsigned char on);
195 void ce_set_use16 (ce_chan_t *c, unsigned char on);
196 void ce_set_crc4 (ce_chan_t *c, unsigned char on);
197 void ce_set_gsyn (ce_chan_t *c, int syn);
199 int ce_get_cable (ce_chan_t *c);
200 void ce_set_dir (ce_chan_t *c, int dir);
201 void ce_e1_timer (ce_chan_t *c);
202 void ce_init_board (ce_board_t *b);