1 |
199 |
simons |
#define __NO_VERSION__
|
2 |
|
|
#include "includes.h"
|
3 |
|
|
#include "hardware.h"
|
4 |
|
|
#include "message.h"
|
5 |
|
|
#include "card.h"
|
6 |
|
|
#include "scioc.h"
|
7 |
|
|
|
8 |
|
|
extern int indicate_status(int, int, unsigned long, char *);
|
9 |
|
|
extern int startproc(int);
|
10 |
|
|
extern int loadproc(int, char *record);
|
11 |
|
|
extern int reset(int);
|
12 |
|
|
extern int send_and_receive(int, unsigned int, unsigned char,unsigned char,
|
13 |
|
|
unsigned char,unsigned char,
|
14 |
|
|
unsigned char, unsigned char *, RspMessage *, int);
|
15 |
|
|
|
16 |
|
|
extern board *adapter[];
|
17 |
|
|
|
18 |
|
|
#if 0
|
19 |
|
|
static char *ChannelStates[] = { "Idle", "Ready", "Connecting", "Connected", "Disconnecting" };
|
20 |
|
|
#endif
|
21 |
|
|
|
22 |
|
|
int GetStatus(int card, boardInfo *);
|
23 |
|
|
|
24 |
|
|
/*
|
25 |
|
|
* Process private IOCTL messages (typically from scctrl)
|
26 |
|
|
*/
|
27 |
|
|
int sc_ioctl(int card, scs_ioctl *data)
|
28 |
|
|
{
|
29 |
|
|
switch(data->command) {
|
30 |
|
|
case SCIOCRESET: /* Perform a hard reset of the adapter */
|
31 |
|
|
{
|
32 |
|
|
pr_debug("%s: SCIOCRESET: ioctl received\n", adapter[card]->devicename);
|
33 |
|
|
adapter[card]->StartOnReset = 0;
|
34 |
|
|
return (reset(card));
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
case SCIOCLOAD:
|
38 |
|
|
{
|
39 |
|
|
RspMessage rcvmsg;
|
40 |
|
|
char srec[SCIOC_SRECSIZE];
|
41 |
|
|
int status, err;
|
42 |
|
|
|
43 |
|
|
pr_debug("%s: SCIOLOAD: ioctl received\n", adapter[card]->devicename);
|
44 |
|
|
if(adapter[card]->EngineUp) {
|
45 |
|
|
pr_debug("%s: SCIOCLOAD: Command Failed, LoadProc while engine running.\n",
|
46 |
|
|
adapter[card]->devicename);
|
47 |
|
|
return -1;
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
/*
|
51 |
|
|
* Get the SRec from user space
|
52 |
|
|
*/
|
53 |
|
|
if ((err = copy_from_user(srec, (char *) data->dataptr, sizeof(srec))))
|
54 |
|
|
return err;
|
55 |
|
|
|
56 |
|
|
status = send_and_receive(card, CMPID, cmReqType2, cmReqClass0, cmReqLoadProc,
|
57 |
|
|
0, sizeof(srec), srec, &rcvmsg, SAR_TIMEOUT);
|
58 |
|
|
if(status) {
|
59 |
|
|
pr_debug("%s: SCIOCLOAD: Command Failed, status = %d\n",
|
60 |
|
|
adapter[card]->devicename, status);
|
61 |
|
|
return -1;
|
62 |
|
|
}
|
63 |
|
|
else {
|
64 |
|
|
pr_debug("%s: SCIOCLOAD: Command Sucessful\n", adapter[card]->devicename);
|
65 |
|
|
return 0;
|
66 |
|
|
}
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
case SCIOCSTART:
|
70 |
|
|
{
|
71 |
|
|
pr_debug("%s: SCIOSTART: ioctl received\n", adapter[card]->devicename);
|
72 |
|
|
if(adapter[card]->EngineUp) {
|
73 |
|
|
pr_debug("%s: SCIOCSTART: Command Failed, Engine already running.\n",
|
74 |
|
|
adapter[card]->devicename);
|
75 |
|
|
return -1;
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
adapter[card]->StartOnReset = 1;
|
79 |
|
|
startproc(card);
|
80 |
|
|
return 0;
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
case SCIOCSETSWITCH:
|
84 |
|
|
{
|
85 |
|
|
RspMessage rcvmsg;
|
86 |
|
|
char switchtype;
|
87 |
|
|
int status, err;
|
88 |
|
|
|
89 |
|
|
pr_debug("%s: SCIOSETSWITCH: ioctl received\n", adapter[card]->devicename);
|
90 |
|
|
|
91 |
|
|
/*
|
92 |
|
|
* Get the switch type from user space
|
93 |
|
|
*/
|
94 |
|
|
if ((err = copy_from_user(&switchtype, (char *) data->dataptr, sizeof(char))))
|
95 |
|
|
return err;
|
96 |
|
|
|
97 |
|
|
pr_debug("%s: SCIOCSETSWITCH: Setting switch type to %d\n", adapter[card]->devicename,
|
98 |
|
|
switchtype);
|
99 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallSetSwitchType,
|
100 |
|
|
0, sizeof(char),&switchtype,&rcvmsg, SAR_TIMEOUT);
|
101 |
|
|
if(!status && !rcvmsg.rsp_status) {
|
102 |
|
|
pr_debug("%s: SCIOCSETSWITCH: Command Successful\n", adapter[card]->devicename);
|
103 |
|
|
return 0;
|
104 |
|
|
}
|
105 |
|
|
else {
|
106 |
|
|
pr_debug("%s: SCIOCSETSWITCH: Command Failed (status = %d)\n",
|
107 |
|
|
adapter[card]->devicename, status);
|
108 |
|
|
return status;
|
109 |
|
|
}
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
case SCIOCGETSWITCH:
|
113 |
|
|
{
|
114 |
|
|
RspMessage rcvmsg;
|
115 |
|
|
char switchtype;
|
116 |
|
|
int status, err;
|
117 |
|
|
|
118 |
|
|
pr_debug("%s: SCIOGETSWITCH: ioctl received\n", adapter[card]->devicename);
|
119 |
|
|
|
120 |
|
|
/*
|
121 |
|
|
* Get the switch type from the board
|
122 |
|
|
*/
|
123 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0,
|
124 |
|
|
ceReqCallGetSwitchType, 0, 0, 0, &rcvmsg, SAR_TIMEOUT);
|
125 |
|
|
if (!status && !rcvmsg.rsp_status) {
|
126 |
|
|
pr_debug("%s: SCIOCGETSWITCH: Command Sucessful\n", adapter[card]->devicename);
|
127 |
|
|
}
|
128 |
|
|
else {
|
129 |
|
|
pr_debug("%s: SCIOCGETSWITCH: Command Failed (status = %d)\n",
|
130 |
|
|
adapter[card]->devicename, status);
|
131 |
|
|
return status;
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
switchtype = rcvmsg.msg_data.byte_array[0];
|
135 |
|
|
|
136 |
|
|
/*
|
137 |
|
|
* Package the switch type and send to user space
|
138 |
|
|
*/
|
139 |
|
|
if ((err = copy_to_user((char *) data->dataptr, &switchtype, sizeof(char))))
|
140 |
|
|
return err;
|
141 |
|
|
|
142 |
|
|
return 0;
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
case SCIOCGETSPID:
|
146 |
|
|
{
|
147 |
|
|
RspMessage rcvmsg;
|
148 |
|
|
char spid[SCIOC_SPIDSIZE];
|
149 |
|
|
int status, err;
|
150 |
|
|
|
151 |
|
|
pr_debug("%s: SCIOGETSPID: ioctl received\n", adapter[card]->devicename);
|
152 |
|
|
|
153 |
|
|
/*
|
154 |
|
|
* Get the spid from the board
|
155 |
|
|
*/
|
156 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetSPID,
|
157 |
|
|
data->channel, 0, 0, &rcvmsg, SAR_TIMEOUT);
|
158 |
|
|
if (!status) {
|
159 |
|
|
pr_debug("%s: SCIOCGETSPID: Command Sucessful\n", adapter[card]->devicename);
|
160 |
|
|
}
|
161 |
|
|
else {
|
162 |
|
|
pr_debug("%s: SCIOCGETSPID: Command Failed (status = %d)\n",
|
163 |
|
|
adapter[card]->devicename, status);
|
164 |
|
|
return status;
|
165 |
|
|
}
|
166 |
|
|
strcpy(spid, rcvmsg.msg_data.byte_array);
|
167 |
|
|
|
168 |
|
|
/*
|
169 |
|
|
* Package the switch type and send to user space
|
170 |
|
|
*/
|
171 |
|
|
if ((err = copy_to_user((char *) data->dataptr, spid, sizeof(spid))))
|
172 |
|
|
return err;
|
173 |
|
|
|
174 |
|
|
return 0;
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
case SCIOCSETSPID:
|
178 |
|
|
{
|
179 |
|
|
RspMessage rcvmsg;
|
180 |
|
|
char spid[SCIOC_SPIDSIZE];
|
181 |
|
|
int status, err;
|
182 |
|
|
|
183 |
|
|
pr_debug("%s: DCBIOSETSPID: ioctl received\n", adapter[card]->devicename);
|
184 |
|
|
|
185 |
|
|
/*
|
186 |
|
|
* Get the spid from user space
|
187 |
|
|
*/
|
188 |
|
|
if ((err = copy_from_user(spid, (char *) data->dataptr, sizeof(spid))))
|
189 |
|
|
return err;
|
190 |
|
|
|
191 |
|
|
pr_debug("%s: SCIOCSETSPID: Setting channel %d spid to %s\n",
|
192 |
|
|
adapter[card]->devicename, data->channel, spid);
|
193 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall,
|
194 |
|
|
ceReqClass0, ceReqCallSetSPID, data->channel,
|
195 |
|
|
strlen(spid), spid, &rcvmsg, SAR_TIMEOUT);
|
196 |
|
|
if(!status && !rcvmsg.rsp_status) {
|
197 |
|
|
pr_debug("%s: SCIOCSETSPID: Command Successful\n",
|
198 |
|
|
adapter[card]->devicename);
|
199 |
|
|
return 0;
|
200 |
|
|
}
|
201 |
|
|
else {
|
202 |
|
|
pr_debug("%s: SCIOCSETSPID: Command Failed (status = %d)\n",
|
203 |
|
|
adapter[card]->devicename, status);
|
204 |
|
|
return status;
|
205 |
|
|
}
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
case SCIOCGETDN:
|
209 |
|
|
{
|
210 |
|
|
RspMessage rcvmsg;
|
211 |
|
|
char dn[SCIOC_DNSIZE];
|
212 |
|
|
int status, err;
|
213 |
|
|
|
214 |
|
|
pr_debug("%s: SCIOGETDN: ioctl received\n", adapter[card]->devicename);
|
215 |
|
|
|
216 |
|
|
/*
|
217 |
|
|
* Get the dn from the board
|
218 |
|
|
*/
|
219 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber,
|
220 |
|
|
data->channel, 0, 0, &rcvmsg, SAR_TIMEOUT);
|
221 |
|
|
if (!status) {
|
222 |
|
|
pr_debug("%s: SCIOCGETDN: Command Sucessful\n", adapter[card]->devicename);
|
223 |
|
|
}
|
224 |
|
|
else {
|
225 |
|
|
pr_debug("%s: SCIOCGETDN: Command Failed (status = %d)\n",
|
226 |
|
|
adapter[card]->devicename, status);
|
227 |
|
|
return status;
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
strcpy(dn, rcvmsg.msg_data.byte_array);
|
231 |
|
|
|
232 |
|
|
/*
|
233 |
|
|
* Package the dn and send to user space
|
234 |
|
|
*/
|
235 |
|
|
if ((err = copy_to_user((char *) data->dataptr, dn, sizeof(dn))))
|
236 |
|
|
return err;
|
237 |
|
|
|
238 |
|
|
return 0;
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
case SCIOCSETDN:
|
242 |
|
|
{
|
243 |
|
|
RspMessage rcvmsg;
|
244 |
|
|
char dn[SCIOC_DNSIZE];
|
245 |
|
|
int status, err;
|
246 |
|
|
|
247 |
|
|
pr_debug("%s: SCIOSETDN: ioctl received\n", adapter[card]->devicename);
|
248 |
|
|
|
249 |
|
|
/*
|
250 |
|
|
* Get the spid from user space
|
251 |
|
|
*/
|
252 |
|
|
if ((err = copy_from_user(dn, (char *) data->dataptr, sizeof(dn))))
|
253 |
|
|
return err;
|
254 |
|
|
|
255 |
|
|
pr_debug("%s: SCIOCSETDN: Setting channel %d dn to %s\n",
|
256 |
|
|
adapter[card]->devicename, data->channel, dn);
|
257 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall,
|
258 |
|
|
ceReqClass0, ceReqCallSetMyNumber, data->channel,
|
259 |
|
|
strlen(dn),dn,&rcvmsg, SAR_TIMEOUT);
|
260 |
|
|
if(!status && !rcvmsg.rsp_status) {
|
261 |
|
|
pr_debug("%s: SCIOCSETDN: Command Successful\n",
|
262 |
|
|
adapter[card]->devicename);
|
263 |
|
|
return 0;
|
264 |
|
|
}
|
265 |
|
|
else {
|
266 |
|
|
pr_debug("%s: SCIOCSETDN: Command Failed (status = %d)\n",
|
267 |
|
|
adapter[card]->devicename, status);
|
268 |
|
|
return status;
|
269 |
|
|
}
|
270 |
|
|
}
|
271 |
|
|
|
272 |
|
|
case SCIOCTRACE:
|
273 |
|
|
|
274 |
|
|
pr_debug("%s: SCIOTRACE: ioctl received\n", adapter[card]->devicename);
|
275 |
|
|
/* adapter[card]->trace = !adapter[card]->trace;
|
276 |
|
|
pr_debug("%s: SCIOCTRACE: Tracing turned %s\n", adapter[card]->devicename,
|
277 |
|
|
adapter[card]->trace ? "ON" : "OFF"); */
|
278 |
|
|
break;
|
279 |
|
|
|
280 |
|
|
case SCIOCSTAT:
|
281 |
|
|
{
|
282 |
|
|
boardInfo bi;
|
283 |
|
|
int err;
|
284 |
|
|
|
285 |
|
|
pr_debug("%s: SCIOSTAT: ioctl received\n", adapter[card]->devicename);
|
286 |
|
|
GetStatus(card, &bi);
|
287 |
|
|
|
288 |
|
|
if ((err = copy_to_user((boardInfo *) data->dataptr, &bi, sizeof(boardInfo))))
|
289 |
|
|
return err;
|
290 |
|
|
|
291 |
|
|
return 0;
|
292 |
|
|
}
|
293 |
|
|
|
294 |
|
|
case SCIOCGETSPEED:
|
295 |
|
|
{
|
296 |
|
|
RspMessage rcvmsg;
|
297 |
|
|
char speed;
|
298 |
|
|
int status, err;
|
299 |
|
|
|
300 |
|
|
pr_debug("%s: SCIOGETSPEED: ioctl received\n", adapter[card]->devicename);
|
301 |
|
|
|
302 |
|
|
/*
|
303 |
|
|
* Get the speed from the board
|
304 |
|
|
*/
|
305 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0,
|
306 |
|
|
ceReqCallGetCallType, data->channel, 0, 0, &rcvmsg, SAR_TIMEOUT);
|
307 |
|
|
if (!status && !rcvmsg.rsp_status) {
|
308 |
|
|
pr_debug("%s: SCIOCGETSPEED: Command Sucessful\n",
|
309 |
|
|
adapter[card]->devicename);
|
310 |
|
|
}
|
311 |
|
|
else {
|
312 |
|
|
pr_debug("%s: SCIOCGETSPEED: Command Failed (status = %d)\n",
|
313 |
|
|
adapter[card]->devicename, status);
|
314 |
|
|
return status;
|
315 |
|
|
}
|
316 |
|
|
|
317 |
|
|
speed = rcvmsg.msg_data.byte_array[0];
|
318 |
|
|
|
319 |
|
|
/*
|
320 |
|
|
* Package the switch type and send to user space
|
321 |
|
|
*/
|
322 |
|
|
if ((err = copy_to_user((char *) data->dataptr, &speed, sizeof(char))))
|
323 |
|
|
return err;
|
324 |
|
|
|
325 |
|
|
return 0;
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
case SCIOCSETSPEED:
|
329 |
|
|
pr_debug("%s: SCIOCSETSPEED: ioctl received\n", adapter[card]->devicename);
|
330 |
|
|
break;
|
331 |
|
|
|
332 |
|
|
case SCIOCLOOPTST:
|
333 |
|
|
pr_debug("%s: SCIOCLOOPTST: ioctl received\n", adapter[card]->devicename);
|
334 |
|
|
break;
|
335 |
|
|
|
336 |
|
|
default:
|
337 |
|
|
return -1;
|
338 |
|
|
}
|
339 |
|
|
|
340 |
|
|
return 0;
|
341 |
|
|
}
|
342 |
|
|
|
343 |
|
|
int GetStatus(int card, boardInfo *bi)
|
344 |
|
|
{
|
345 |
|
|
RspMessage rcvmsg;
|
346 |
|
|
int i, status;
|
347 |
|
|
|
348 |
|
|
/*
|
349 |
|
|
* Fill in some of the basic info about the board
|
350 |
|
|
*/
|
351 |
|
|
bi->modelid = adapter[card]->model;
|
352 |
|
|
strcpy(bi->serial_no, adapter[card]->hwconfig.serial_no);
|
353 |
|
|
strcpy(bi->part_no, adapter[card]->hwconfig.part_no);
|
354 |
|
|
bi->iobase = adapter[card]->iobase;
|
355 |
|
|
bi->rambase = adapter[card]->rambase;
|
356 |
|
|
bi->irq = adapter[card]->interrupt;
|
357 |
|
|
bi->ramsize = adapter[card]->hwconfig.ram_size;
|
358 |
|
|
bi->interface = adapter[card]->hwconfig.st_u_sense;
|
359 |
|
|
strcpy(bi->load_ver, adapter[card]->load_ver);
|
360 |
|
|
strcpy(bi->proc_ver, adapter[card]->proc_ver);
|
361 |
|
|
|
362 |
|
|
/*
|
363 |
|
|
* Get the current PhyStats and LnkStats
|
364 |
|
|
*/
|
365 |
|
|
status = send_and_receive(card, CEPID, ceReqTypePhy, ceReqClass2,
|
366 |
|
|
ceReqPhyStatus, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
367 |
|
|
if(!status) {
|
368 |
|
|
if(adapter[card]->model < PRI_BOARD) {
|
369 |
|
|
bi->l1_status = rcvmsg.msg_data.byte_array[2];
|
370 |
|
|
for(i = 0 ; i < BRI_CHANNELS ; i++)
|
371 |
|
|
bi->status.bristats[i].phy_stat =
|
372 |
|
|
rcvmsg.msg_data.byte_array[i];
|
373 |
|
|
}
|
374 |
|
|
else {
|
375 |
|
|
bi->l1_status = rcvmsg.msg_data.byte_array[0];
|
376 |
|
|
bi->l2_status = rcvmsg.msg_data.byte_array[1];
|
377 |
|
|
for(i = 0 ; i < PRI_CHANNELS ; i++)
|
378 |
|
|
bi->status.pristats[i].phy_stat =
|
379 |
|
|
rcvmsg.msg_data.byte_array[i+2];
|
380 |
|
|
}
|
381 |
|
|
}
|
382 |
|
|
|
383 |
|
|
/*
|
384 |
|
|
* Get the call types for each channel
|
385 |
|
|
*/
|
386 |
|
|
for (i = 0 ; i < adapter[card]->nChannels ; i++) {
|
387 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0,
|
388 |
|
|
ceReqCallGetCallType, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
389 |
|
|
if(!status) {
|
390 |
|
|
if (adapter[card]->model == PRI_BOARD) {
|
391 |
|
|
bi->status.pristats[i].call_type =
|
392 |
|
|
rcvmsg.msg_data.byte_array[0];
|
393 |
|
|
}
|
394 |
|
|
else {
|
395 |
|
|
bi->status.bristats[i].call_type =
|
396 |
|
|
rcvmsg.msg_data.byte_array[0];
|
397 |
|
|
}
|
398 |
|
|
}
|
399 |
|
|
}
|
400 |
|
|
|
401 |
|
|
/*
|
402 |
|
|
* If PRI, get the call states and service states for each channel
|
403 |
|
|
*/
|
404 |
|
|
if (adapter[card]->model == PRI_BOARD) {
|
405 |
|
|
/*
|
406 |
|
|
* Get the call states
|
407 |
|
|
*/
|
408 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeStat, ceReqClass2,
|
409 |
|
|
ceReqPhyChCallState, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
410 |
|
|
if(!status) {
|
411 |
|
|
for( i = 0 ; i < PRI_CHANNELS ; i++ )
|
412 |
|
|
bi->status.pristats[i].call_state =
|
413 |
|
|
rcvmsg.msg_data.byte_array[i];
|
414 |
|
|
}
|
415 |
|
|
|
416 |
|
|
/*
|
417 |
|
|
* Get the service states
|
418 |
|
|
*/
|
419 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeStat, ceReqClass2,
|
420 |
|
|
ceReqPhyChServState, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
421 |
|
|
if(!status) {
|
422 |
|
|
for( i = 0 ; i < PRI_CHANNELS ; i++ )
|
423 |
|
|
bi->status.pristats[i].serv_state =
|
424 |
|
|
rcvmsg.msg_data.byte_array[i];
|
425 |
|
|
}
|
426 |
|
|
|
427 |
|
|
/*
|
428 |
|
|
* Get the link stats for the channels
|
429 |
|
|
*/
|
430 |
|
|
for (i = 1 ; i <= PRI_CHANNELS ; i++) {
|
431 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0,
|
432 |
|
|
ceReqLnkGetStats, i, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
433 |
|
|
if (!status) {
|
434 |
|
|
bi->status.pristats[i-1].link_stats.tx_good =
|
435 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[0];
|
436 |
|
|
bi->status.pristats[i-1].link_stats.tx_bad =
|
437 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[4];
|
438 |
|
|
bi->status.pristats[i-1].link_stats.rx_good =
|
439 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[8];
|
440 |
|
|
bi->status.pristats[i-1].link_stats.rx_bad =
|
441 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[12];
|
442 |
|
|
}
|
443 |
|
|
}
|
444 |
|
|
|
445 |
|
|
/*
|
446 |
|
|
* Link stats for the D channel
|
447 |
|
|
*/
|
448 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0,
|
449 |
|
|
ceReqLnkGetStats, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
450 |
|
|
if (!status) {
|
451 |
|
|
bi->dch_stats.tx_good = (unsigned long)rcvmsg.msg_data.byte_array[0];
|
452 |
|
|
bi->dch_stats.tx_bad = (unsigned long)rcvmsg.msg_data.byte_array[4];
|
453 |
|
|
bi->dch_stats.rx_good = (unsigned long)rcvmsg.msg_data.byte_array[8];
|
454 |
|
|
bi->dch_stats.rx_bad = (unsigned long)rcvmsg.msg_data.byte_array[12];
|
455 |
|
|
}
|
456 |
|
|
|
457 |
|
|
return 0;
|
458 |
|
|
}
|
459 |
|
|
|
460 |
|
|
/*
|
461 |
|
|
* If BRI or POTS, Get SPID, DN and call types for each channel
|
462 |
|
|
*/
|
463 |
|
|
|
464 |
|
|
/*
|
465 |
|
|
* Get the link stats for the channels
|
466 |
|
|
*/
|
467 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0,
|
468 |
|
|
ceReqLnkGetStats, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
469 |
|
|
if (!status) {
|
470 |
|
|
bi->dch_stats.tx_good = (unsigned long)rcvmsg.msg_data.byte_array[0];
|
471 |
|
|
bi->dch_stats.tx_bad = (unsigned long)rcvmsg.msg_data.byte_array[4];
|
472 |
|
|
bi->dch_stats.rx_good = (unsigned long)rcvmsg.msg_data.byte_array[8];
|
473 |
|
|
bi->dch_stats.rx_bad = (unsigned long)rcvmsg.msg_data.byte_array[12];
|
474 |
|
|
bi->status.bristats[0].link_stats.tx_good =
|
475 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[16];
|
476 |
|
|
bi->status.bristats[0].link_stats.tx_bad =
|
477 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[20];
|
478 |
|
|
bi->status.bristats[0].link_stats.rx_good =
|
479 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[24];
|
480 |
|
|
bi->status.bristats[0].link_stats.rx_bad =
|
481 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[28];
|
482 |
|
|
bi->status.bristats[1].link_stats.tx_good =
|
483 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[32];
|
484 |
|
|
bi->status.bristats[1].link_stats.tx_bad =
|
485 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[36];
|
486 |
|
|
bi->status.bristats[1].link_stats.rx_good =
|
487 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[40];
|
488 |
|
|
bi->status.bristats[1].link_stats.rx_bad =
|
489 |
|
|
(unsigned long)rcvmsg.msg_data.byte_array[44];
|
490 |
|
|
}
|
491 |
|
|
|
492 |
|
|
/*
|
493 |
|
|
* Get the SPIDs
|
494 |
|
|
*/
|
495 |
|
|
for (i = 0 ; i < BRI_CHANNELS ; i++) {
|
496 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0,
|
497 |
|
|
ceReqCallGetSPID, i+1, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
498 |
|
|
if (!status)
|
499 |
|
|
strcpy(bi->status.bristats[i].spid, rcvmsg.msg_data.byte_array);
|
500 |
|
|
}
|
501 |
|
|
|
502 |
|
|
/*
|
503 |
|
|
* Get the DNs
|
504 |
|
|
*/
|
505 |
|
|
for (i = 0 ; i < BRI_CHANNELS ; i++) {
|
506 |
|
|
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0,
|
507 |
|
|
ceReqCallGetMyNumber, i+1, 0, NULL, &rcvmsg, SAR_TIMEOUT);
|
508 |
|
|
if (!status)
|
509 |
|
|
strcpy(bi->status.bristats[i].dn, rcvmsg.msg_data.byte_array);
|
510 |
|
|
}
|
511 |
|
|
|
512 |
|
|
return 0;
|
513 |
|
|
}
|