1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
|
/* $Id: config.c,v 2.50 2000/07/04 10:24:32 keil Exp $
*
* Author Karsten Keil (keil@isdn4linux.de)
* based on the teles driver from Jan den Ouden
*
* This file is (c) under GNU PUBLIC LICENSE
*
*/
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/timer.h>
#include <linux/config.h>
#include <linux/init.h>
#include "hisax.h"
#include <linux/module.h>
#include <linux/kernel_stat.h>
#include <linux/tqueue.h>
#include <linux/interrupt.h>
#define HISAX_STATUS_BUFSIZE 4096
#define INCLUDE_INLINE_FUNCS
/*
* This structure array contains one entry per card. An entry looks
* like this:
*
* { type, protocol, p0, p1, p2, NULL }
*
* type
* 1 Teles 16.0 p0=irq p1=membase p2=iobase
* 2 Teles 8.0 p0=irq p1=membase
* 3 Teles 16.3 p0=irq p1=iobase
* 4 Creatix PNP p0=irq p1=IO0 (ISAC) p2=IO1 (HSCX)
* 5 AVM A1 (Fritz) p0=irq p1=iobase
* 6 ELSA PC [p0=iobase] or nothing (autodetect)
* 7 ELSA Quickstep p0=irq p1=iobase
* 8 Teles PCMCIA p0=irq p1=iobase
* 9 ITK ix1-micro p0=irq p1=iobase
* 10 ELSA PCMCIA p0=irq p1=iobase
* 11 Eicon.Diehl Diva p0=irq p1=iobase
* 12 Asuscom ISDNLink p0=irq p1=iobase
* 13 Teleint p0=irq p1=iobase
* 14 Teles 16.3c p0=irq p1=iobase
* 15 Sedlbauer speed p0=irq p1=iobase
* 15 Sedlbauer PC/104 p0=irq p1=iobase
* 15 Sedlbauer speed pci no parameter
* 16 USR Sportster internal p0=irq p1=iobase
* 17 MIC card p0=irq p1=iobase
* 18 ELSA Quickstep 1000PCI no parameter
* 19 Compaq ISDN S0 ISA card p0=irq p1=IO0 (HSCX) p2=IO1 (ISAC) p3=IO2
* 20 Travers Technologies NETjet-S PCI card
* 21 TELES PCI no parameter
* 22 Sedlbauer Speed Star p0=irq p1=iobase
* 23 reserved
* 24 Dr Neuhaus Niccy PnP/PCI card p0=irq p1=IO0 p2=IO1 (PnP only)
* 25 Teles S0Box p0=irq p1=iobase (from isapnp setup)
* 26 AVM A1 PCMCIA (Fritz) p0=irq p1=iobase
* 27 AVM PnP/PCI p0=irq p1=iobase (PCI no parameter)
* 28 Sedlbauer Speed Fax+ p0=irq p1=iobase (from isapnp setup)
* 29 Siemens I-Surf p0=irq p1=iobase p2=memory (from isapnp setup)
* 30 ACER P10 p0=irq p1=iobase (from isapnp setup)
* 31 HST Saphir p0=irq p1=iobase
* 32 Telekom A4T none
* 33 Scitel Quadro p0=subcontroller (4*S0, subctrl 1...4)
* 34 Gazel ISDN cards
* 35 HFC 2BDS0 PCI none
* 36 Winbond 6692 PCI none
* 37 HFC 2BDS0 S+/SP p0=irq p1=iobase
* 38 Travers Technologies NETspider-U PCI card
*
* protocol can be either ISDN_PTYPE_EURO or ISDN_PTYPE_1TR6 or ISDN_PTYPE_NI1
*
*
*/
const char *CardType[] =
{"No Card", "Teles 16.0", "Teles 8.0", "Teles 16.3", "Creatix/Teles PnP",
"AVM A1", "Elsa ML", "Elsa Quickstep", "Teles PCMCIA", "ITK ix1-micro Rev.2",
"Elsa PCMCIA", "Eicon.Diehl Diva", "ISDNLink", "TeleInt", "Teles 16.3c",
"Sedlbauer Speed Card", "USR Sportster", "ith mic Linux", "Elsa PCI",
"Compaq ISA", "NETjet-S", "Teles PCI", "Sedlbauer Speed Star (PCMCIA)",
"AMD 7930", "NICCY", "S0Box", "AVM A1 (PCMCIA)", "AVM Fritz PnP/PCI",
"Sedlbauer Speed Fax +", "Siemens I-Surf", "Acer P10", "HST Saphir",
"Telekom A4T", "Scitel Quadro", "Gazel", "HFC 2BDS0 PCI", "Winbond 6692",
"HFC 2BDS0 SX", "NETspider-U",
};
void HiSax_closecard(int cardnr);
#ifdef CONFIG_HISAX_ELSA
#define DEFAULT_CARD ISDN_CTYPE_ELSA
#define DEFAULT_CFG {0,0,0,0}
int elsa_init_pcmcia(void*, int, int*, int);
EXPORT_SYMBOL(elsa_init_pcmcia);
#endif /* CONFIG_HISAX_ELSA */
#ifdef CONFIG_HISAX_AVM_A1
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_A1
#define DEFAULT_CFG {10,0x340,0,0}
#endif
#ifdef CONFIG_HISAX_AVM_A1_PCMCIA
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_A1_PCMCIA
#define DEFAULT_CFG {11,0x170,0,0}
int avm_a1_init_pcmcia(void*, int, int*, int);
EXPORT_SYMBOL(avm_a1_init_pcmcia);
#endif /* CONFIG_HISAX_AVM_A1_PCMCIA */
#ifdef CONFIG_HISAX_FRITZPCI
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_FRITZPCI
#define DEFAULT_CFG {0,0,0,0}
#endif
#ifdef CONFIG_HISAX_16_3
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_16_3
#define DEFAULT_CFG {15,0x180,0,0}
#endif
#ifdef CONFIG_HISAX_S0BOX
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_S0BOX
#define DEFAULT_CFG {7,0x378,0,0}
#endif
#ifdef CONFIG_HISAX_16_0
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_16_0
#define DEFAULT_CFG {15,0xd0000,0xd80,0}
#endif
#ifdef CONFIG_HISAX_TELESPCI
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_TELESPCI
#define DEFAULT_CFG {0,0,0,0}
#endif
#ifdef CONFIG_HISAX_IX1MICROR2
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_IX1MICROR2
#define DEFAULT_CFG {5,0x390,0,0}
#endif
#ifdef CONFIG_HISAX_DIEHLDIVA
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_DIEHLDIVA
#define DEFAULT_CFG {0,0x0,0,0}
#endif
#ifdef CONFIG_HISAX_ASUSCOM
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_ASUSCOM
#define DEFAULT_CFG {5,0x200,0,0}
#endif
#ifdef CONFIG_HISAX_TELEINT
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_TELEINT
#define DEFAULT_CFG {5,0x300,0,0}
#endif
#ifdef CONFIG_HISAX_SEDLBAUER
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_SEDLBAUER
#define DEFAULT_CFG {11,0x270,0,0}
int sedl_init_pcmcia(void*, int, int*, int);
EXPORT_SYMBOL(sedl_init_pcmcia);
#endif /* CONFIG_HISAX_SEDLBAUER */
#ifdef CONFIG_HISAX_SPORTSTER
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_SPORTSTER
#define DEFAULT_CFG {7,0x268,0,0}
#endif
#ifdef CONFIG_HISAX_MIC
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_MIC
#define DEFAULT_CFG {12,0x3e0,0,0}
#endif
#ifdef CONFIG_HISAX_NETJET
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_NETJET_S
#define DEFAULT_CFG {0,0,0,0}
#endif
#ifdef CONFIG_HISAX_HFCS
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_TELES3C
#define DEFAULT_CFG {5,0x500,0,0}
#endif
#ifdef CONFIG_HISAX_HFC_PCI
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_HFC_PCI
#define DEFAULT_CFG {0,0,0,0}
#endif
#ifdef CONFIG_HISAX_HFC_SX
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_HFC_SX
#define DEFAULT_CFG {5,0x2E0,0,0}
#endif
#ifdef CONFIG_HISAX_AMD7930
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_AMD7930
#define DEFAULT_CFG {12,0x3e0,0,0}
#endif
#ifdef CONFIG_HISAX_NICCY
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_NICCY
#define DEFAULT_CFG {0,0x0,0,0}
#endif
#ifdef CONFIG_HISAX_ISURF
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_ISURF
#define DEFAULT_CFG {5,0x100,0xc8000,0}
#endif
#ifdef CONFIG_HISAX_HSTSAPHIR
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_HSTSAPHIR
#define DEFAULT_CFG {5,0x250,0,0}
#endif
#ifdef CONFIG_HISAX_BKM_A4T
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_BKM_A4T
#define DEFAULT_CFG {0,0x0,0,0}
#endif
#ifdef CONFIG_HISAX_SCT_QUADRO
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_SCT_QUADRO
#define DEFAULT_CFG {1,0x0,0,0}
#endif
#ifdef CONFIG_HISAX_GAZEL
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_GAZEL
#define DEFAULT_CFG {15,0x180,0,0}
#endif
#ifdef CONFIG_HISAX_W6692
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_W6692
#define DEFAULT_CFG {0,0,0,0}
#endif
#ifdef CONFIG_HISAX_NETJET_U
#undef DEFAULT_CARD
#undef DEFAULT_CFG
#define DEFAULT_CARD ISDN_CTYPE_NETJET_U
#define DEFAULT_CFG {0,0,0,0}
#endif
#ifdef CONFIG_HISAX_1TR6
#define DEFAULT_PROTO ISDN_PTYPE_1TR6
#define DEFAULT_PROTO_NAME "1TR6"
#endif
#ifdef CONFIG_HISAX_NI1
#undef DEFAULT_PROTO
#define DEFAULT_PROTO ISDN_PTYPE_NI1
#undef DEFAULT_PROTO_NAME
#define DEFAULT_PROTO_NAME "NI1"
#endif
#ifdef CONFIG_HISAX_EURO
#undef DEFAULT_PROTO
#define DEFAULT_PROTO ISDN_PTYPE_EURO
#undef DEFAULT_PROTO_NAME
#define DEFAULT_PROTO_NAME "EURO"
#endif
#ifndef DEFAULT_PROTO
#define DEFAULT_PROTO ISDN_PTYPE_UNKNOWN
#define DEFAULT_PROTO_NAME "UNKNOWN"
#endif
#ifndef DEFAULT_CARD
#error "HiSax: No cards configured"
#endif
int hisax_init_pcmcia(void *, int *, struct IsdnCard *);
EXPORT_SYMBOL(hisax_init_pcmcia);
EXPORT_SYMBOL(HiSax_closecard);
#define FIRST_CARD { \
DEFAULT_CARD, \
DEFAULT_PROTO, \
DEFAULT_CFG, \
NULL, \
}
#define EMPTY_CARD {0, DEFAULT_PROTO, {0, 0, 0, 0}, NULL}
struct IsdnCard cards[] =
{
FIRST_CARD,
EMPTY_CARD,
EMPTY_CARD,
EMPTY_CARD,
EMPTY_CARD,
EMPTY_CARD,
EMPTY_CARD,
EMPTY_CARD,
};
static char HiSaxID[64] HISAX_INITDATA = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" \
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" \
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
char *HiSax_id HISAX_INITDATA = HiSaxID;
#ifdef MODULE
/* Variables for insmod */
static int type[] HISAX_INITDATA =
{0, 0, 0, 0, 0, 0, 0, 0};
static int protocol[] HISAX_INITDATA =
{0, 0, 0, 0, 0, 0, 0, 0};
static int io[] HISAX_INITDATA =
{0, 0, 0, 0, 0, 0, 0, 0};
#undef IO0_IO1
#ifdef CONFIG_HISAX_16_3
#define IO0_IO1
#endif
#ifdef CONFIG_HISAX_NICCY
#undef IO0_IO1
#define IO0_IO1
#endif
#ifdef IO0_IO1
static int io0[] HISAX_INITDATA =
{0, 0, 0, 0, 0, 0, 0, 0};
static int io1[] HISAX_INITDATA =
{0, 0, 0, 0, 0, 0, 0, 0};
#endif
static int irq[] HISAX_INITDATA =
{0, 0, 0, 0, 0, 0, 0, 0};
static int mem[] HISAX_INITDATA =
{0, 0, 0, 0, 0, 0, 0, 0};
static char *id HISAX_INITDATA = HiSaxID;
MODULE_AUTHOR("Karsten Keil");
MODULE_PARM(type, "1-8i");
MODULE_PARM(protocol, "1-8i");
MODULE_PARM(io, "1-8i");
MODULE_PARM(irq, "1-8i");
MODULE_PARM(mem, "1-8i");
MODULE_PARM(id, "s");
#ifdef IO0_IO1
MODULE_PARM(io0, "1-8i");
MODULE_PARM(io1, "1-8i");
#endif /* IO0_IO1 */
#endif /* MODULE */
int nrcards;
extern char *l1_revision;
extern char *l2_revision;
extern char *l3_revision;
extern char *lli_revision;
extern char *tei_revision;
HISAX_INITFUNC(char *
HiSax_getrev(const char *revision))
{
char *rev;
char *p;
if ((p = strchr(revision, ':'))) {
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else
rev = "???";
return rev;
}
HISAX_INITFUNC(void
HiSaxVersion(void))
{
char tmp[64];
printk(KERN_INFO "HiSax: Linux Driver for passive ISDN cards\n");
#ifdef MODULE
printk(KERN_INFO "HiSax: Version 3.5 (module)\n");
#else
printk(KERN_INFO "HiSax: Version 3.5 (kernel)\n");
#endif
strcpy(tmp, l1_revision);
printk(KERN_INFO "HiSax: Layer1 Revision %s\n", HiSax_getrev(tmp));
strcpy(tmp, l2_revision);
printk(KERN_INFO "HiSax: Layer2 Revision %s\n", HiSax_getrev(tmp));
strcpy(tmp, tei_revision);
printk(KERN_INFO "HiSax: TeiMgr Revision %s\n", HiSax_getrev(tmp));
strcpy(tmp, l3_revision);
printk(KERN_INFO "HiSax: Layer3 Revision %s\n", HiSax_getrev(tmp));
strcpy(tmp, lli_revision);
printk(KERN_INFO "HiSax: LinkLayer Revision %s\n", HiSax_getrev(tmp));
certification_check(1);
}
void
HiSax_mod_dec_use_count(void)
{
MOD_DEC_USE_COUNT;
}
void
HiSax_mod_inc_use_count(void)
{
MOD_INC_USE_COUNT;
}
#ifdef MODULE
#define HiSax_init init_module
#else
#define MAX_ARG (HISAX_MAX_CARDS*5)
static int __init
HiSax_setup(char *line)
{
int i, j, argc;
int ints[MAX_ARG + 1];
char *str;
str = get_options(line, MAX_ARG, ints);
argc = ints[0];
printk(KERN_DEBUG"HiSax_setup: argc(%d) str(%s)\n", argc, str);
i = 0;
j = 1;
while (argc && (i < HISAX_MAX_CARDS)) {
if (argc) {
cards[i].typ = ints[j];
j++;
argc--;
}
if (argc) {
cards[i].protocol = ints[j];
j++;
argc--;
}
if (argc) {
cards[i].para[0] = ints[j];
j++;
argc--;
}
if (argc) {
cards[i].para[1] = ints[j];
j++;
argc--;
}
if (argc) {
cards[i].para[2] = ints[j];
j++;
argc--;
}
i++;
}
if (str && *str) {
strcpy(HiSaxID, str);
HiSax_id = HiSaxID;
} else {
strcpy(HiSaxID, "HiSax");
HiSax_id = HiSaxID;
}
return(1);
}
__setup("hisax=", HiSax_setup);
#endif /* MODULES */
#if CARD_TELES0
extern int setup_teles0(struct IsdnCard *card);
#endif
#if CARD_TELES3
extern int setup_teles3(struct IsdnCard *card);
#endif
#if CARD_S0BOX
extern int setup_s0box(struct IsdnCard *card);
#endif
#if CARD_TELESPCI
extern int setup_telespci(struct IsdnCard *card);
#endif
#if CARD_AVM_A1
extern int setup_avm_a1(struct IsdnCard *card);
#endif
#if CARD_AVM_A1_PCMCIA
extern int setup_avm_a1_pcmcia(struct IsdnCard *card);
#endif
#if CARD_FRITZPCI
extern int setup_avm_pcipnp(struct IsdnCard *card);
#endif
#if CARD_ELSA
extern int setup_elsa(struct IsdnCard *card);
#endif
#if CARD_IX1MICROR2
extern int setup_ix1micro(struct IsdnCard *card);
#endif
#if CARD_DIEHLDIVA
extern int setup_diva(struct IsdnCard *card);
#endif
#if CARD_ASUSCOM
extern int setup_asuscom(struct IsdnCard *card);
#endif
#if CARD_TELEINT
extern int setup_TeleInt(struct IsdnCard *card);
#endif
#if CARD_SEDLBAUER
extern int setup_sedlbauer(struct IsdnCard *card);
#endif
#if CARD_SPORTSTER
extern int setup_sportster(struct IsdnCard *card);
#endif
#if CARD_MIC
extern int setup_mic(struct IsdnCard *card);
#endif
#if CARD_NETJET_S
extern int setup_netjet_s(struct IsdnCard *card);
#endif
#if CARD_HFCS
extern int setup_hfcs(struct IsdnCard *card);
#endif
#if CARD_HFC_PCI
extern int setup_hfcpci(struct IsdnCard *card);
#endif
#if CARD_HFC_SX
extern int setup_hfcsx(struct IsdnCard *card);
#endif
#if CARD_AMD7930
extern int setup_amd7930(struct IsdnCard *card);
#endif
#if CARD_NICCY
extern int setup_niccy(struct IsdnCard *card);
#endif
#if CARD_ISURF
extern int setup_isurf(struct IsdnCard *card);
#endif
#if CARD_HSTSAPHIR
extern int setup_saphir(struct IsdnCard *card);
#endif
#if CARD_TESTEMU
extern int setup_testemu(struct IsdnCard *card);
#endif
#if CARD_BKM_A4T
extern int setup_bkm_a4t(struct IsdnCard *card);
#endif
#if CARD_SCT_QUADRO
extern int setup_sct_quadro(struct IsdnCard *card);
#endif
#if CARD_GAZEL
extern int setup_gazel(struct IsdnCard *card);
#endif
#if CARD_W6692
extern int setup_w6692(struct IsdnCard *card);
#endif
#if CARD_NETJET_U
extern int setup_netjet_u(struct IsdnCard *card);
#endif
/*
* Find card with given driverId
*/
static inline struct IsdnCardState
*hisax_findcard(int driverid)
{
int i;
for (i = 0; i < nrcards; i++)
if (cards[i].cs)
if (cards[i].cs->myid == driverid)
return (cards[i].cs);
return (NULL);
}
/*
* Find card with given card number
*/
struct IsdnCardState
*hisax_get_card(int cardnr)
{
if ((cardnr <= nrcards) && (cardnr>0))
if (cards[cardnr-1].cs)
return (cards[cardnr-1].cs);
return (NULL);
}
int
HiSax_readstatus(u_char * buf, int len, int user, int id, int channel)
{
int count,cnt;
u_char *p = buf;
struct IsdnCardState *cs = hisax_findcard(id);
if (cs) {
if (len > HISAX_STATUS_BUFSIZE) {
printk(KERN_WARNING "HiSax: status overflow readstat %d/%d\n",
len, HISAX_STATUS_BUFSIZE);
}
count = cs->status_end - cs->status_read +1;
if (count >= len)
count = len;
if (user)
copy_to_user(p, cs->status_read, count);
else
memcpy(p, cs->status_read, count);
cs->status_read += count;
if (cs->status_read > cs->status_end)
cs->status_read = cs->status_buf;
p += count;
count = len - count;
while (count) {
if (count > HISAX_STATUS_BUFSIZE)
cnt = HISAX_STATUS_BUFSIZE;
else
cnt = count;
if (user)
copy_to_user(p, cs->status_read, cnt);
else
memcpy(p, cs->status_read, cnt);
p += cnt;
cs->status_read += cnt % HISAX_STATUS_BUFSIZE;
count -= cnt;
}
return len;
} else {
printk(KERN_ERR
"HiSax: if_readstatus called with invalid driverId!\n");
return -ENODEV;
}
}
inline int
jiftime(char *s, long mark)
{
s += 8;
*s-- = '\0';
*s-- = mark % 10 + '0';
mark /= 10;
*s-- = mark % 10 + '0';
mark /= 10;
*s-- = '.';
*s-- = mark % 10 + '0';
mark /= 10;
*s-- = mark % 6 + '0';
mark /= 6;
*s-- = ':';
*s-- = mark % 10 + '0';
mark /= 10;
*s-- = mark % 10 + '0';
return(8);
}
static u_char tmpbuf[HISAX_STATUS_BUFSIZE];
void
VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args)
{
/* if head == NULL the fmt contains the full info */
long flags;
int count, i;
u_char *p;
isdn_ctrl ic;
int len;
save_flags(flags);
cli();
p = tmpbuf;
if (head) {
p += jiftime(p, jiffies);
p += sprintf(p, " %s", head);
p += vsprintf(p, fmt, args);
*p++ = '\n';
*p = 0;
len = p - tmpbuf;
p = tmpbuf;
} else {
p = fmt;
len = strlen(fmt);
}
if (!cs) {
printk(KERN_WARNING "HiSax: No CardStatus for message %s", p);
restore_flags(flags);
return;
}
if (len > HISAX_STATUS_BUFSIZE) {
printk(KERN_WARNING "HiSax: status overflow %d/%d\n",
len, HISAX_STATUS_BUFSIZE);
restore_flags(flags);
return;
}
count = len;
i = cs->status_end - cs->status_write +1;
if (i >= len)
i = len;
len -= i;
memcpy(cs->status_write, p, i);
cs->status_write += i;
if (cs->status_write > cs->status_end)
cs->status_write = cs->status_buf;
p += i;
if (len) {
memcpy(cs->status_write, p, len);
cs->status_write += len;
}
#ifdef KERNELSTACK_DEBUG
i = (ulong)&len - current->kernel_stack_page;
sprintf(tmpbuf, "kstack %s %lx use %ld\n", current->comm,
current->kernel_stack_page, i);
len = strlen(tmpbuf);
for (p = tmpbuf, i = len; i > 0; i--, p++) {
*cs->status_write++ = *p;
if (cs->status_write > cs->status_end)
cs->status_write = cs->status_buf;
count++;
}
#endif
restore_flags(flags);
if (count) {
ic.command = ISDN_STAT_STAVAIL;
ic.driver = cs->myid;
ic.arg = count;
cs->iif.statcallb(&ic);
}
}
void
HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...)
{
va_list args;
va_start(args, fmt);
VHiSax_putstatus(cs, head, fmt, args);
va_end(args);
}
int
ll_run(struct IsdnCardState *cs, int addfeatures)
{
long flags;
isdn_ctrl ic;
save_flags(flags);
cli();
ic.driver = cs->myid;
ic.command = ISDN_STAT_RUN;
cs->iif.features |= addfeatures;
cs->iif.statcallb(&ic);
restore_flags(flags);
return 0;
}
void
ll_stop(struct IsdnCardState *cs)
{
isdn_ctrl ic;
ic.command = ISDN_STAT_STOP;
ic.driver = cs->myid;
cs->iif.statcallb(&ic);
// CallcFreeChan(cs);
}
static void
ll_unload(struct IsdnCardState *cs)
{
isdn_ctrl ic;
ic.command = ISDN_STAT_UNLOAD;
ic.driver = cs->myid;
cs->iif.statcallb(&ic);
if (cs->status_buf)
kfree(cs->status_buf);
cs->status_read = NULL;
cs->status_write = NULL;
cs->status_end = NULL;
kfree(cs->dlog);
}
static void
closecard(int cardnr)
{
struct IsdnCardState *csta = cards[cardnr].cs;
if (csta->bcs->BC_Close != NULL) {
csta->bcs->BC_Close(csta->bcs + 1);
csta->bcs->BC_Close(csta->bcs);
}
discard_queue(&csta->rq);
discard_queue(&csta->sq);
if (csta->rcvbuf) {
kfree(csta->rcvbuf);
csta->rcvbuf = NULL;
}
if (csta->tx_skb) {
dev_kfree_skb(csta->tx_skb);
csta->tx_skb = NULL;
}
if (csta->DC_Close != NULL) {
csta->DC_Close(csta);
}
csta->cardmsg(csta, CARD_RELEASE, NULL);
if (csta->dbusytimer.function != NULL)
del_timer(&csta->dbusytimer);
ll_unload(csta);
}
HISAX_INITFUNC(static int init_card(struct IsdnCardState *cs))
{
int irq_cnt, cnt = 3;
long flags;
if (!cs->irq)
return(cs->cardmsg(cs, CARD_INIT, NULL));
save_flags(flags);
cli();
irq_cnt = kstat_irqs(cs->irq);
printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], cs->irq,
irq_cnt);
if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) {
printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n",
cs->irq);
restore_flags(flags);
return(1);
}
while (cnt) {
cs->cardmsg(cs, CARD_INIT, NULL);
sti();
set_current_state(TASK_UNINTERRUPTIBLE);
/* Timeout 10ms */
schedule_timeout((10*HZ)/1000);
restore_flags(flags);
printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ],
cs->irq, kstat_irqs(cs->irq));
if (kstat_irqs(cs->irq) == irq_cnt) {
printk(KERN_WARNING
"%s: IRQ(%d) getting no interrupts during init %d\n",
CardType[cs->typ], cs->irq, 4 - cnt);
if (cnt == 1) {
free_irq(cs->irq, cs);
return (2);
} else {
cs->cardmsg(cs, CARD_RESET, NULL);
cnt--;
}
} else {
cs->cardmsg(cs, CARD_TEST, NULL);
return(0);
}
}
restore_flags(flags);
return(3);
}
HISAX_INITFUNC(static int
checkcard(int cardnr, char *id, int *busy_flag))
{
long flags;
int ret = 0;
struct IsdnCard *card = cards + cardnr;
struct IsdnCardState *cs;
save_flags(flags);
cli();
if (!(cs = (struct IsdnCardState *)
kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC))) {
printk(KERN_WARNING
"HiSax: No memory for IsdnCardState(card %d)\n",
cardnr + 1);
restore_flags(flags);
return (0);
}
memset(cs, 0, sizeof(struct IsdnCardState));
card->cs = cs;
cs->chanlimit = 2; /* maximum B-channel number */
cs->logecho = 0; /* No echo logging */
cs->cardnr = cardnr;
cs->debug = L1_DEB_WARN;
cs->HW_Flags = 0;
cs->busy_flag = busy_flag;
cs->irq_flags = I4L_IRQ_FLAG;
#if TEI_PER_CARD
if (card->protocol == ISDN_PTYPE_NI1)
test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
#else
test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
#endif
cs->protocol = card->protocol;
if ((card->typ > 0) && (card->typ <= ISDN_CTYPE_COUNT)) {
if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
printk(KERN_WARNING
"HiSax: No memory for dlog(card %d)\n",
cardnr + 1);
restore_flags(flags);
return (0);
}
if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
printk(KERN_WARNING
"HiSax: No memory for status_buf(card %d)\n",
cardnr + 1);
kfree(cs->dlog);
restore_flags(flags);
return (0);
}
cs->stlist = NULL;
cs->status_read = cs->status_buf;
cs->status_write = cs->status_buf;
cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1;
cs->typ = card->typ;
strcpy(cs->iif.id, id);
cs->iif.channels = 2;
cs->iif.maxbufsize = MAX_DATA_SIZE;
cs->iif.hl_hdrlen = MAX_HEADER_LEN;
cs->iif.features =
ISDN_FEATURE_L2_X75I |
ISDN_FEATURE_L2_HDLC |
ISDN_FEATURE_L2_TRANS |
ISDN_FEATURE_L3_TRANS |
#ifdef CONFIG_HISAX_1TR6
ISDN_FEATURE_P_1TR6 |
#endif
#ifdef CONFIG_HISAX_EURO
ISDN_FEATURE_P_EURO |
#endif
#ifdef CONFIG_HISAX_NI1
ISDN_FEATURE_P_NI1 |
#endif
0;
cs->iif.command = HiSax_command;
cs->iif.writecmd = NULL;
cs->iif.writebuf_skb = HiSax_writebuf_skb;
cs->iif.readstat = HiSax_readstatus;
register_isdn(&cs->iif);
cs->myid = cs->iif.channels;
printk(KERN_INFO
"HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
(card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
(card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
(card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
(card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
"NONE", cs->iif.id, cs->myid);
switch (card->typ) {
#if CARD_TELES0
case ISDN_CTYPE_16_0:
case ISDN_CTYPE_8_0:
ret = setup_teles0(card);
break;
#endif
#if CARD_TELES3
case ISDN_CTYPE_16_3:
case ISDN_CTYPE_PNP:
case ISDN_CTYPE_TELESPCMCIA:
case ISDN_CTYPE_COMPAQ_ISA:
ret = setup_teles3(card);
break;
#endif
#if CARD_S0BOX
case ISDN_CTYPE_S0BOX:
ret = setup_s0box(card);
break;
#endif
#if CARD_TELESPCI
case ISDN_CTYPE_TELESPCI:
ret = setup_telespci(card);
break;
#endif
#if CARD_AVM_A1
case ISDN_CTYPE_A1:
ret = setup_avm_a1(card);
break;
#endif
#if CARD_AVM_A1_PCMCIA
case ISDN_CTYPE_A1_PCMCIA:
ret = setup_avm_a1_pcmcia(card);
break;
#endif
#if CARD_FRITZPCI
case ISDN_CTYPE_FRITZPCI:
ret = setup_avm_pcipnp(card);
break;
#endif
#if CARD_ELSA
case ISDN_CTYPE_ELSA:
case ISDN_CTYPE_ELSA_PNP:
case ISDN_CTYPE_ELSA_PCMCIA:
case ISDN_CTYPE_ELSA_PCI:
ret = setup_elsa(card);
break;
#endif
#if CARD_IX1MICROR2
case ISDN_CTYPE_IX1MICROR2:
ret = setup_ix1micro(card);
break;
#endif
#if CARD_DIEHLDIVA
case ISDN_CTYPE_DIEHLDIVA:
ret = setup_diva(card);
break;
#endif
#if CARD_ASUSCOM
case ISDN_CTYPE_ASUSCOM:
ret = setup_asuscom(card);
break;
#endif
#if CARD_TELEINT
case ISDN_CTYPE_TELEINT:
ret = setup_TeleInt(card);
break;
#endif
#if CARD_SEDLBAUER
case ISDN_CTYPE_SEDLBAUER:
case ISDN_CTYPE_SEDLBAUER_PCMCIA:
case ISDN_CTYPE_SEDLBAUER_FAX:
ret = setup_sedlbauer(card);
break;
#endif
#if CARD_SPORTSTER
case ISDN_CTYPE_SPORTSTER:
ret = setup_sportster(card);
break;
#endif
#if CARD_MIC
case ISDN_CTYPE_MIC:
ret = setup_mic(card);
break;
#endif
#if CARD_NETJET_S
case ISDN_CTYPE_NETJET_S:
ret = setup_netjet_s(card);
break;
#endif
#if CARD_HFCS
case ISDN_CTYPE_TELES3C:
case ISDN_CTYPE_ACERP10:
ret = setup_hfcs(card);
break;
#endif
#if CARD_HFC_PCI
case ISDN_CTYPE_HFC_PCI:
ret = setup_hfcpci(card);
break;
#endif
#if CARD_HFC_SX
case ISDN_CTYPE_HFC_SX:
ret = setup_hfcsx(card);
break;
#endif
#if CARD_NICCY
case ISDN_CTYPE_NICCY:
ret = setup_niccy(card);
break;
#endif
#if CARD_AMD7930
case ISDN_CTYPE_AMD7930:
ret = setup_amd7930(card);
break;
#endif
#if CARD_ISURF
case ISDN_CTYPE_ISURF:
ret = setup_isurf(card);
break;
#endif
#if CARD_HSTSAPHIR
case ISDN_CTYPE_HSTSAPHIR:
ret = setup_saphir(card);
break;
#endif
#if CARD_TESTEMU
case ISDN_CTYPE_TESTEMU:
ret = setup_testemu(card);
break;
#endif
#if CARD_BKM_A4T
case ISDN_CTYPE_BKM_A4T:
ret = setup_bkm_a4t(card);
break;
#endif
#if CARD_SCT_QUADRO
case ISDN_CTYPE_SCT_QUADRO:
ret = setup_sct_quadro(card);
break;
#endif
#if CARD_GAZEL
case ISDN_CTYPE_GAZEL:
ret = setup_gazel(card);
break;
#endif
#if CARD_W6692
case ISDN_CTYPE_W6692:
ret = setup_w6692(card);
break;
#endif
#if CARD_NETJET_U
case ISDN_CTYPE_NETJET_U:
ret = setup_netjet_u(card);
break;
#endif
default:
printk(KERN_WARNING
"HiSax: Support for %s Card not selected\n",
CardType[card->typ]);
ll_unload(cs);
restore_flags(flags);
return (0);
}
} else {
printk(KERN_WARNING
"HiSax: Card Type %d out of range\n",
card->typ);
restore_flags(flags);
return (0);
}
if (!ret) {
ll_unload(cs);
restore_flags(flags);
return (0);
}
if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
printk(KERN_WARNING
"HiSax: No memory for isac rcvbuf\n");
return (1);
}
cs->rcvidx = 0;
cs->tx_skb = NULL;
cs->tx_cnt = 0;
cs->event = 0;
cs->tqueue.next = 0;
cs->tqueue.sync = 0;
cs->tqueue.data = cs;
skb_queue_head_init(&cs->rq);
skb_queue_head_init(&cs->sq);
init_bcstate(cs, 0);
init_bcstate(cs, 1);
ret = init_card(cs);
if (ret) {
closecard(cardnr);
restore_flags(flags);
return (0);
}
init_tei(cs, cs->protocol);
CallcNewChan(cs);
/* ISAR needs firmware download first */
if (!test_bit(HW_ISAR, &cs->HW_Flags))
ll_run(cs, 0);
restore_flags(flags);
return (1);
}
HISAX_INITFUNC(void
HiSax_shiftcards(int idx))
{
int i;
for (i = idx; i < (HISAX_MAX_CARDS - 1); i++)
memcpy(&cards[i], &cards[i + 1], sizeof(cards[i]));
}
HISAX_INITFUNC(int
HiSax_inithardware(int *busy_flag))
{
int foundcards = 0;
int i = 0;
int t = ',';
int flg = 0;
char *id;
char *next_id = HiSax_id;
char ids[20];
if (strchr(HiSax_id, ','))
t = ',';
else if (strchr(HiSax_id, '%'))
t = '%';
while (i < nrcards) {
if (cards[i].typ < 1)
break;
id = next_id;
if ((next_id = strchr(id, t))) {
*next_id++ = 0;
strcpy(ids, id);
flg = i + 1;
} else {
next_id = id;
if (flg >= i)
strcpy(ids, id);
else
sprintf(ids, "%s%d", id, i);
}
if (checkcard(i, ids, busy_flag)) {
foundcards++;
i++;
} else {
printk(KERN_WARNING "HiSax: Card %s not installed !\n",
CardType[cards[i].typ]);
if (cards[i].cs)
kfree((void *) cards[i].cs);
cards[i].cs = NULL;
HiSax_shiftcards(i);
nrcards--;
}
}
return foundcards;
}
void
HiSax_closecard(int cardnr)
{
int i,last=nrcards - 1;
if (cardnr>last)
return;
if (cards[cardnr].cs) {
ll_stop(cards[cardnr].cs);
release_tei(cards[cardnr].cs);
CallcFreeChan(cards[cardnr].cs);
closecard(cardnr);
if (cards[cardnr].cs->irq)
free_irq(cards[cardnr].cs->irq, cards[cardnr].cs);
kfree((void *) cards[cardnr].cs);
cards[cardnr].cs = NULL;
}
i = cardnr;
while (i!=last) {
cards[i] = cards[i+1];
i++;
}
nrcards--;
}
void
HiSax_reportcard(int cardnr, int sel)
{
struct IsdnCardState *cs = cards[cardnr].cs;
printk(KERN_DEBUG "HiSax: reportcard No %d\n", cardnr + 1);
printk(KERN_DEBUG "HiSax: Type %s\n", CardType[cs->typ]);
printk(KERN_DEBUG "HiSax: debuglevel %x\n", cs->debug);
printk(KERN_DEBUG "HiSax: HiSax_reportcard address 0x%lX\n",
(ulong) & HiSax_reportcard);
printk(KERN_DEBUG "HiSax: cs 0x%lX\n", (ulong) cs);
printk(KERN_DEBUG "HiSax: HW_Flags %x bc0 flg %x bc1 flg %x\n",
cs->HW_Flags, cs->bcs[0].Flag, cs->bcs[1].Flag);
printk(KERN_DEBUG "HiSax: bcs 0 mode %d ch%d\n",
cs->bcs[0].mode, cs->bcs[0].channel);
printk(KERN_DEBUG "HiSax: bcs 1 mode %d ch%d\n",
cs->bcs[1].mode, cs->bcs[1].channel);
#ifdef ERROR_STATISTIC
printk(KERN_DEBUG "HiSax: dc errors(rx,crc,tx) %d,%d,%d\n",
cs->err_rx, cs->err_crc, cs->err_tx);
printk(KERN_DEBUG "HiSax: bc0 errors(inv,rdo,crc,tx) %d,%d,%d,%d\n",
cs->bcs[0].err_inv, cs->bcs[0].err_rdo, cs->bcs[0].err_crc, cs->bcs[0].err_tx);
printk(KERN_DEBUG "HiSax: bc1 errors(inv,rdo,crc,tx) %d,%d,%d,%d\n",
cs->bcs[1].err_inv, cs->bcs[1].err_rdo, cs->bcs[1].err_crc, cs->bcs[1].err_tx);
if (sel == 99) {
cs->err_rx = 0;
cs->err_crc = 0;
cs->err_tx = 0;
cs->bcs[0].err_inv = 0;
cs->bcs[0].err_rdo = 0;
cs->bcs[0].err_crc = 0;
cs->bcs[0].err_tx = 0;
cs->bcs[1].err_inv = 0;
cs->bcs[1].err_rdo = 0;
cs->bcs[1].err_crc = 0;
cs->bcs[1].err_tx = 0;
}
#endif
}
__initfunc(int
HiSax_init(void))
{
int i,j;
#ifdef MODULE
int nzproto = 0;
if (!type[0]) {
/* We 'll register drivers later, but init basic functions*/
CallcNew();
Isdnl3New();
Isdnl2New();
TeiNew();
Isdnl1New();
return 0;
}
#ifdef CONFIG_HISAX_ELSA
if (type[0] == ISDN_CTYPE_ELSA_PCMCIA) {
/* we have exported and return in this case */
return 0;
}
#endif
#ifdef CONFIG_HISAX_SEDLBAUER
if (type[0] == ISDN_CTYPE_SEDLBAUER_PCMCIA) {
/* we have to export and return in this case */
return 0;
}
#endif
#ifdef CONFIG_HISAX_AVM_A1_PCMCIA
if (type[0] == ISDN_CTYPE_A1_PCMCIA) {
/* we have to export and return in this case */
return 0;
}
#endif
#endif
nrcards = 0;
HiSaxVersion();
#ifdef MODULE
if (id) /* If id= string used */
HiSax_id = id;
for (i = j = 0; j < HISAX_MAX_CARDS; i++) {
cards[j].typ = type[i];
if (protocol[i]) {
cards[j].protocol = protocol[i];
nzproto++;
}
switch (type[i]) {
case ISDN_CTYPE_16_0:
cards[j].para[0] = irq[i];
cards[j].para[1] = mem[i];
cards[j].para[2] = io[i];
break;
case ISDN_CTYPE_8_0:
cards[j].para[0] = irq[i];
cards[j].para[1] = mem[i];
break;
#ifdef IO0_IO1
case ISDN_CTYPE_PNP:
case ISDN_CTYPE_NICCY:
cards[j].para[0] = irq[i];
cards[j].para[1] = io0[i];
cards[j].para[2] = io1[i];
break;
case ISDN_CTYPE_COMPAQ_ISA:
cards[j].para[0] = irq[i];
cards[j].para[1] = io0[i];
cards[j].para[2] = io1[i];
cards[j].para[3] = io[i];
break;
#endif
case ISDN_CTYPE_ELSA:
case ISDN_CTYPE_HFC_PCI:
cards[j].para[0] = io[i];
break;
case ISDN_CTYPE_16_3:
case ISDN_CTYPE_TELESPCMCIA:
case ISDN_CTYPE_A1:
case ISDN_CTYPE_A1_PCMCIA:
case ISDN_CTYPE_ELSA_PNP:
case ISDN_CTYPE_ELSA_PCMCIA:
case ISDN_CTYPE_IX1MICROR2:
case ISDN_CTYPE_DIEHLDIVA:
case ISDN_CTYPE_ASUSCOM:
case ISDN_CTYPE_TELEINT:
case ISDN_CTYPE_SEDLBAUER:
case ISDN_CTYPE_SEDLBAUER_PCMCIA:
case ISDN_CTYPE_SEDLBAUER_FAX:
case ISDN_CTYPE_SPORTSTER:
case ISDN_CTYPE_MIC:
case ISDN_CTYPE_TELES3C:
case ISDN_CTYPE_ACERP10:
case ISDN_CTYPE_S0BOX:
case ISDN_CTYPE_FRITZPCI:
case ISDN_CTYPE_HSTSAPHIR:
case ISDN_CTYPE_GAZEL:
case ISDN_CTYPE_HFC_SX:
cards[j].para[0] = irq[i];
cards[j].para[1] = io[i];
break;
case ISDN_CTYPE_ISURF:
cards[j].para[0] = irq[i];
cards[j].para[1] = io[i];
cards[j].para[2] = mem[i];
break;
case ISDN_CTYPE_ELSA_PCI:
case ISDN_CTYPE_NETJET_S:
case ISDN_CTYPE_AMD7930:
case ISDN_CTYPE_TELESPCI:
case ISDN_CTYPE_W6692:
case ISDN_CTYPE_NETJET_U:
break;
case ISDN_CTYPE_BKM_A4T:
break;
case ISDN_CTYPE_SCT_QUADRO:
if (irq[i]) {
cards[j].para[0] = irq[i];
} else {
/* QUADRO is a 4 BRI card */
cards[j++].para[0] = 1;
cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
cards[j].protocol = protocol[i];
cards[j++].para[0] = 2;
cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
cards[j].protocol = protocol[i];
cards[j++].para[0] = 3;
cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
cards[j].protocol = protocol[i];
cards[j].para[0] = 4;
}
break;
}
j++;
}
if (!nzproto) {
printk(KERN_WARNING "HiSax: Warning - no protocol specified\n");
printk(KERN_WARNING "HiSax: Note! module load syntax has changed.\n");
printk(KERN_WARNING "HiSax: using protocol %s\n", DEFAULT_PROTO_NAME);
}
#endif
if (!HiSax_id)
HiSax_id = HiSaxID;
if (!HiSaxID[0])
strcpy(HiSaxID, "HiSax");
for (i = 0; i < HISAX_MAX_CARDS; i++)
if (cards[i].typ > 0)
nrcards++;
printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
nrcards, (nrcards > 1) ? "s" : "");
CallcNew();
Isdnl3New();
Isdnl2New();
TeiNew();
Isdnl1New();
if (HiSax_inithardware(NULL)) {
/* Install only, if at least one card found */
#ifdef MODULE
#endif /* MODULE */
return (0);
} else {
Isdnl1Free();
TeiFree();
Isdnl2Free();
Isdnl3Free();
CallcFree();
return -EIO;
}
}
#ifdef MODULE
void
cleanup_module(void)
{
int cardnr = nrcards -1;
long flags;
save_flags(flags);
cli();
while(cardnr>=0)
HiSax_closecard(cardnr--);
Isdnl1Free();
TeiFree();
Isdnl2Free();
Isdnl3Free();
CallcFree();
restore_flags(flags);
printk(KERN_INFO "HiSax module removed\n");
}
#endif
#ifdef CONFIG_HISAX_ELSA
int elsa_init_pcmcia(void *pcm_iob, int pcm_irq, int *busy_flag, int prot)
{
#ifdef MODULE
int i;
int nzproto = 0;
nrcards = 0;
HiSaxVersion();
/* Initialize all structs, even though we only accept
two pcmcia cards
*/
for (i = 0; i < HISAX_MAX_CARDS; i++) {
cards[i].para[0] = irq[i];
cards[i].para[1] = io[i];
cards[i].typ = type[i];
if (protocol[i]) {
cards[i].protocol = protocol[i];
nzproto++;
}
}
cards[0].para[0] = pcm_irq;
cards[0].para[1] = (int)pcm_iob;
cards[0].protocol = prot;
cards[0].typ = 10;
nzproto = 1;
if (!HiSax_id)
HiSax_id = HiSaxID;
if (!HiSaxID[0])
strcpy(HiSaxID, "HiSax");
for (i = 0; i < HISAX_MAX_CARDS; i++)
if (cards[i].typ > 0)
nrcards++;
printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
nrcards, (nrcards > 1) ? "s" : "");
Isdnl1New();
CallcNew();
Isdnl3New();
Isdnl2New();
TeiNew();
HiSax_inithardware(busy_flag);
printk(KERN_NOTICE "HiSax: module installed\n");
#endif
return (0);
}
#endif
#ifdef CONFIG_HISAX_SEDLBAUER
int sedl_init_pcmcia(void *pcm_iob, int pcm_irq, int *busy_flag, int prot)
{
#ifdef MODULE
int i;
int nzproto = 0;
nrcards = 0;
HiSaxVersion();
/* Initialize all structs, even though we only accept
two pcmcia cards
*/
for (i = 0; i < HISAX_MAX_CARDS; i++) {
cards[i].para[0] = irq[i];
cards[i].para[1] = io[i];
cards[i].typ = type[i];
if (protocol[i]) {
cards[i].protocol = protocol[i];
nzproto++;
}
}
cards[0].para[0] = pcm_irq;
cards[0].para[1] = (int)pcm_iob;
cards[0].protocol = prot;
cards[0].typ = ISDN_CTYPE_SEDLBAUER_PCMCIA;
nzproto = 1;
if (!HiSax_id)
HiSax_id = HiSaxID;
if (!HiSaxID[0])
strcpy(HiSaxID, "HiSax");
for (i = 0; i < HISAX_MAX_CARDS; i++)
if (cards[i].typ > 0)
nrcards++;
printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
nrcards, (nrcards > 1) ? "s" : "");
CallcNew();
Isdnl3New();
Isdnl2New();
Isdnl1New();
TeiNew();
HiSax_inithardware(busy_flag);
printk(KERN_NOTICE "HiSax: module installed\n");
#endif
return (0);
}
#endif
#ifdef CONFIG_HISAX_AVM_A1_PCMCIA
int avm_a1_init_pcmcia(void *pcm_iob, int pcm_irq, int *busy_flag, int prot)
{
#ifdef MODULE
int i;
int nzproto = 0;
nrcards = 0;
HiSaxVersion();
/* Initialize all structs, even though we only accept
two pcmcia cards
*/
for (i = 0; i < HISAX_MAX_CARDS; i++) {
cards[i].para[0] = irq[i];
cards[i].para[1] = io[i];
cards[i].typ = type[i];
if (protocol[i]) {
cards[i].protocol = protocol[i];
nzproto++;
}
}
cards[0].para[0] = pcm_irq;
cards[0].para[1] = (int)pcm_iob;
cards[0].protocol = prot;
cards[0].typ = ISDN_CTYPE_A1_PCMCIA;
nzproto = 1;
if (!HiSax_id)
HiSax_id = HiSaxID;
if (!HiSaxID[0])
strcpy(HiSaxID, "HiSax");
for (i = 0; i < HISAX_MAX_CARDS; i++)
if (cards[i].typ > 0)
nrcards++;
printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
nrcards, (nrcards > 1) ? "s" : "");
Isdnl1New();
CallcNew();
Isdnl3New();
Isdnl2New();
TeiNew();
HiSax_inithardware(busy_flag);
printk(KERN_NOTICE "HiSax: module installed\n");
#endif
return (0);
}
#endif
int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
{
u_char ids[16];
int ret = -1;
cards[nrcards] = *card;
if (nrcards)
sprintf(ids, "HiSax%d", nrcards);
else
sprintf(ids, "HiSax");
if (!checkcard(nrcards, ids, busy_flag)) {
return(-1);
}
ret = nrcards;
nrcards++;
return (ret);
}
|