From 6bba9b42448c966b4d7425ab0ca6f86f26564fb5 Mon Sep 17 00:00:00 2001 From: bz Date: Mon, 26 May 2008 10:40:09 +0000 Subject: [PATCH] Remove ISDN4BSD (I4B) from HEAD as it is not MPSAFE and parts relied on the now removed NET_NEEDS_GIANT. Most of I4B has been disconnected from the build since July 2007 in HEAD/RELENG_7. This is what was removed: - configuration in /etc/isdn - examples - man pages - kernel configuration - sys/i4b (drivers, layers, include files) - user space tools - i4b support from ppp - further documentation Discussed with: rwatson, re --- ObsoleteFiles.inc | 114 + UPDATING | 4 + etc/Makefile | 3 - etc/defaults/rc.conf | 13 +- etc/isdn/Makefile | 25 - etc/isdn/answer | 97 - etc/isdn/holidays.D | 51 - etc/isdn/isdnd.rates.A | 39 - etc/isdn/isdnd.rates.D | 50 - etc/isdn/isdnd.rates.F | 152 -- etc/isdn/isdnd.rates.L | 45 - etc/isdn/isdnd.rates.UK.BT | 61 - etc/isdn/isdnd.rc.sample | 409 ---- etc/isdn/isdntel.alias.sample | 21 - etc/isdn/isdntel.sh | 98 - etc/isdn/record | 99 - etc/isdn/tell | 87 - etc/isdn/tell-record | 89 - etc/isdn/unknown_incoming | 79 - etc/mtree/BSD.include.dist | 2 - etc/mtree/BSD.root.dist | 2 - etc/mtree/BSD.usr.dist | 10 - etc/netstart | 1 - etc/rc.d/Makefile | 2 +- etc/rc.d/NETWORKING | 2 +- etc/rc.d/isdnd | 56 - etc/rc.d/ppp | 2 +- include/Makefile | 15 - share/Makefile | 5 - share/examples/Makefile | 32 - share/examples/isdn/FAQ | 1079 --------- share/examples/isdn/KERNEL | 82 - share/examples/isdn/Overview | 307 --- share/examples/isdn/README | 342 --- share/examples/isdn/ROADMAP | 86 - share/examples/isdn/ReleaseNotes | 196 -- share/examples/isdn/Resources | 82 - share/examples/isdn/SupportedCards | 196 -- share/examples/isdn/ThankYou | 289 --- share/examples/isdn/contrib/README | 42 - share/examples/isdn/contrib/anleitung.ppp | 142 -- share/examples/isdn/contrib/answer.c | 178 -- share/examples/isdn/contrib/answer.sh | 111 - share/examples/isdn/contrib/convert.sh | 86 - share/examples/isdn/contrib/hplay.c | 241 -- .../examples/isdn/contrib/i4b-ppp-newbie.txt | 237 -- share/examples/isdn/contrib/isdnctl | 111 - share/examples/isdn/contrib/isdnd_acct | 137 -- share/examples/isdn/contrib/isdnd_acct.pl | 258 -- share/examples/isdn/contrib/isdntelmux.c | 197 -- share/examples/isdn/contrib/mrtg-isp0.sh | 53 - share/examples/isdn/i4brunppp/Makefile | 19 - share/examples/isdn/i4brunppp/README | 18 - .../isdn/i4brunppp/i4brunppp-isdnd.rc | 65 - share/examples/isdn/i4brunppp/i4brunppp.8 | 51 - share/examples/isdn/i4brunppp/i4brunppp.c | 224 -- share/examples/isdn/v21/Makefile | 13 - share/examples/isdn/v21/README | 50 - share/examples/isdn/v21/v21modem.c | 394 --- share/examples/ppp/isdnd.rc | 69 - share/examples/ppp/ppp.conf.isdn | 98 - share/examples/ppp/ppp.conf.sample | 2 - share/isdn/0.al.uu | 323 --- share/isdn/1.al.uu | 323 --- share/isdn/2.al.uu | 278 --- share/isdn/3.al.uu | 323 --- share/isdn/4.al.uu | 323 --- share/isdn/5.al.uu | 369 --- share/isdn/6.al.uu | 278 --- share/isdn/7.al.uu | 232 -- share/isdn/8.al.uu | 323 --- share/isdn/9.al.uu | 232 -- share/isdn/Makefile | 15 - share/isdn/beep.al.uu | 107 - share/isdn/msg.al.uu | 1506 ------------ share/man/man4/netgraph.4 | 15 +- share/man/man4/sppp.4 | 4 +- share/man/man5/rc.conf.5 | 73 +- share/man/man5/src.conf.5 | 5 +- share/man/man7/hier.7 | 8 +- share/mk/bsd.own.mk | 2 - sys/Makefile | 2 +- sys/amd64/conf/NOTES | 114 - sys/conf/files | 60 +- sys/conf/files.i386 | 77 - sys/conf/files.pc98 | 77 - sys/conf/options | 8 - sys/conf/options.amd64 | 13 - sys/conf/options.i386 | 36 - sys/conf/options.pc98 | 13 - sys/i386/conf/NOTES | 230 -- sys/i4b/capi/README | 150 -- sys/i4b/capi/capi.h | 130 - sys/i4b/capi/capi_l4if.c | 447 ---- sys/i4b/capi/capi_llif.c | 163 -- sys/i4b/capi/capi_msgs.c | 950 -------- sys/i4b/capi/capi_msgs.h | 381 --- sys/i4b/capi/iavc/iavc.h | 446 ---- sys/i4b/capi/iavc/iavc_card.c | 285 --- sys/i4b/capi/iavc/iavc_isa.c | 289 --- sys/i4b/capi/iavc/iavc_lli.c | 986 -------- sys/i4b/capi/iavc/iavc_pci.c | 272 --- sys/i4b/driver/i4b_ctl.c | 213 -- sys/i4b/driver/i4b_ing.c | 856 ------- sys/i4b/driver/i4b_ipr.c | 1034 -------- sys/i4b/driver/i4b_isppp.c | 677 ------ sys/i4b/driver/i4b_rbch.c | 826 ------- sys/i4b/driver/i4b_tel.c | 1664 ------------- sys/i4b/driver/i4b_trace.c | 430 ---- sys/i4b/include/i4b_cause.h | 148 -- sys/i4b/include/i4b_debug.h | 302 --- sys/i4b/include/i4b_global.h | 130 - sys/i4b/include/i4b_ioctl.h | 744 ------ sys/i4b/include/i4b_isdnq931.h | 167 -- sys/i4b/include/i4b_l1l2.h | 90 - sys/i4b/include/i4b_l2l3.h | 116 - sys/i4b/include/i4b_l3l4.h | 274 --- sys/i4b/include/i4b_mbuf.h | 56 - sys/i4b/include/i4b_rbch_ioctl.h | 54 - sys/i4b/include/i4b_tel_ioctl.h | 94 - sys/i4b/include/i4b_trace.h | 91 - sys/i4b/layer1/i4b_hdlc.c | 135 -- sys/i4b/layer1/i4b_hdlc.h | 300 --- sys/i4b/layer1/i4b_l1.h | 87 - sys/i4b/layer1/i4b_l1dmux.c | 421 ---- sys/i4b/layer1/i4b_l1lib.c | 75 - sys/i4b/layer1/ifpi/i4b_ifpi_ext.h | 62 - sys/i4b/layer1/ifpi/i4b_ifpi_isac.c | 658 ----- sys/i4b/layer1/ifpi/i4b_ifpi_l1.c | 236 -- sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c | 509 ---- sys/i4b/layer1/ifpi/i4b_ifpi_pci.c | 1494 ------------ sys/i4b/layer1/ifpi2/i4b_ifpi2_ext.h | 65 - sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c | 593 ----- sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.h | 574 ----- sys/i4b/layer1/ifpi2/i4b_ifpi2_l1.c | 236 -- sys/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c | 508 ---- sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c | 1449 ----------- sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c | 1397 ----------- sys/i4b/layer1/ifpnp/i4b_ifpnp_ext.h | 63 - sys/i4b/layer1/ifpnp/i4b_ifpnp_isac.c | 659 ----- sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c | 237 -- sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c | 510 ---- sys/i4b/layer1/ihfc/i4b_ihfc.h | 338 --- sys/i4b/layer1/ihfc/i4b_ihfc_drv.c | 1760 -------------- sys/i4b/layer1/ihfc/i4b_ihfc_drv.h | 231 -- sys/i4b/layer1/ihfc/i4b_ihfc_ext.h | 63 - sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c | 510 ---- sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c | 445 ---- sys/i4b/layer1/isic/i4b_asuscom_ipac.c | 234 -- sys/i4b/layer1/isic/i4b_avm_a1.c | 413 ---- sys/i4b/layer1/isic/i4b_bchan.c | 398 --- sys/i4b/layer1/isic/i4b_ctx_s0P.c | 316 --- sys/i4b/layer1/isic/i4b_diva.c | 398 --- sys/i4b/layer1/isic/i4b_drn_ngo.c | 260 -- sys/i4b/layer1/isic/i4b_dynalink.c | 233 -- sys/i4b/layer1/isic/i4b_elsa_pcc16.c | 391 --- sys/i4b/layer1/isic/i4b_elsa_qs1i.c | 237 -- sys/i4b/layer1/isic/i4b_elsa_qs1p.c | 353 --- sys/i4b/layer1/isic/i4b_hscx.c | 648 ----- sys/i4b/layer1/isic/i4b_hscx.h | 298 --- sys/i4b/layer1/isic/i4b_ipac.h | 205 -- sys/i4b/layer1/isic/i4b_isac.c | 655 ----- sys/i4b/layer1/isic/i4b_isac.h | 389 --- sys/i4b/layer1/isic/i4b_isic.c | 494 ---- sys/i4b/layer1/isic/i4b_isic.h | 330 --- sys/i4b/layer1/isic/i4b_isic_ext.h | 49 - sys/i4b/layer1/isic/i4b_isic_isa.c | 207 -- sys/i4b/layer1/isic/i4b_isic_pnp.c | 333 --- sys/i4b/layer1/isic/i4b_itk_ix1.c | 402 ---- sys/i4b/layer1/isic/i4b_l1.c | 249 -- sys/i4b/layer1/isic/i4b_l1fsm.c | 506 ---- sys/i4b/layer1/isic/i4b_siemens_isurf.c | 230 -- sys/i4b/layer1/isic/i4b_sws.c | 212 -- sys/i4b/layer1/isic/i4b_tel_s016.c | 372 --- sys/i4b/layer1/isic/i4b_tel_s0163.c | 375 --- sys/i4b/layer1/isic/i4b_tel_s08.c | 302 --- sys/i4b/layer1/isic/i4b_usr_sti.c | 498 ---- sys/i4b/layer1/itjc/i4b_hdlc.h | 319 --- sys/i4b/layer1/itjc/i4b_itjc_ext.h | 60 - sys/i4b/layer1/itjc/i4b_itjc_isac.c | 545 ----- sys/i4b/layer1/itjc/i4b_itjc_l1.c | 236 -- sys/i4b/layer1/itjc/i4b_itjc_l1fsm.c | 513 ---- sys/i4b/layer1/itjc/i4b_itjc_pci.c | 2142 ----------------- sys/i4b/layer1/iwic/i4b_iwic.h | 223 -- sys/i4b/layer1/iwic/i4b_iwic_bchan.c | 767 ------ sys/i4b/layer1/iwic/i4b_iwic_dchan.c | 467 ---- sys/i4b/layer1/iwic/i4b_iwic_ext.h | 49 - sys/i4b/layer1/iwic/i4b_iwic_fsm.c | 223 -- sys/i4b/layer1/iwic/i4b_iwic_l1if.c | 145 -- sys/i4b/layer1/iwic/i4b_iwic_pci.c | 310 --- sys/i4b/layer1/iwic/i4b_w6692.h | 263 -- sys/i4b/layer2/i4b_iframe.c | 270 --- sys/i4b/layer2/i4b_l2.c | 385 --- sys/i4b/layer2/i4b_l2.h | 351 --- sys/i4b/layer2/i4b_l2fsm.c | 1578 ------------ sys/i4b/layer2/i4b_l2fsm.h | 82 - sys/i4b/layer2/i4b_l2timer.c | 232 -- sys/i4b/layer2/i4b_lme.c | 135 -- sys/i4b/layer2/i4b_mbuf.c | 217 -- sys/i4b/layer2/i4b_sframe.c | 207 -- sys/i4b/layer2/i4b_tei.c | 278 --- sys/i4b/layer2/i4b_uframe.c | 277 --- sys/i4b/layer2/i4b_util.c | 305 --- sys/i4b/layer3/i4b_l2if.c | 680 ------ sys/i4b/layer3/i4b_l3.h | 83 - sys/i4b/layer3/i4b_l3fsm.c | 1037 -------- sys/i4b/layer3/i4b_l3fsm.h | 106 - sys/i4b/layer3/i4b_l3timer.c | 325 --- sys/i4b/layer3/i4b_l4if.c | 322 --- sys/i4b/layer3/i4b_q931.c | 714 ------ sys/i4b/layer3/i4b_q931.h | 125 - sys/i4b/layer3/i4b_q932fac.c | 541 ----- sys/i4b/layer3/i4b_q932fac.h | 168 -- sys/i4b/layer4/i4b_i4bdrv.c | 865 ------- sys/i4b/layer4/i4b_l4.c | 1097 --------- sys/i4b/layer4/i4b_l4.h | 73 - sys/i4b/layer4/i4b_l4mgmt.c | 436 ---- sys/i4b/layer4/i4b_l4timer.c | 88 - sys/pc98/conf/NOTES | 138 -- tools/build/mk/OptionalObsoleteFiles.inc | 57 - tools/build/options/WITHOUT_I4B | 2 - tools/kerneldoc/subsys/Dependencies | 2 - tools/kerneldoc/subsys/Doxyfile-i4b | 21 - usr.sbin/Makefile | 4 - usr.sbin/i4b/Makefile | 7 - usr.sbin/i4b/Makefile.inc | 16 - usr.sbin/i4b/dtmfdecode/Makefile | 19 - usr.sbin/i4b/dtmfdecode/dtmfdecode.1 | 70 - usr.sbin/i4b/dtmfdecode/dtmfdecode.c | 152 -- usr.sbin/i4b/dtmfdecode/dtmfsounds.al.uu | 2098 ---------------- usr.sbin/i4b/g711conv/Makefile | 11 - usr.sbin/i4b/g711conv/g711conv.1 | 93 - usr.sbin/i4b/g711conv/g711conv.c | 307 --- usr.sbin/i4b/isdnd/Makefile | 37 - usr.sbin/i4b/isdnd/alias.c | 193 -- usr.sbin/i4b/isdnd/config.h | 61 - usr.sbin/i4b/isdnd/controller.c | 539 ----- usr.sbin/i4b/isdnd/curses.c | 891 ------- usr.sbin/i4b/isdnd/dial.c | 161 -- usr.sbin/i4b/isdnd/exec.c | 407 ---- usr.sbin/i4b/isdnd/fsm.c | 446 ---- usr.sbin/i4b/isdnd/holiday.c | 198 -- usr.sbin/i4b/isdnd/isdnd.8 | 428 ---- usr.sbin/i4b/isdnd/isdnd.acct.5 | 108 - usr.sbin/i4b/isdnd/isdnd.h | 907 ------- usr.sbin/i4b/isdnd/isdnd.rates.5 | 117 - usr.sbin/i4b/isdnd/isdnd.rc.5 | 1115 --------- usr.sbin/i4b/isdnd/log.c | 249 -- usr.sbin/i4b/isdnd/main.c | 840 ------- usr.sbin/i4b/isdnd/monitor.c | 1284 ---------- usr.sbin/i4b/isdnd/msghdl.c | 1350 ----------- usr.sbin/i4b/isdnd/pathnames.h | 61 - usr.sbin/i4b/isdnd/pcause.c | 230 -- usr.sbin/i4b/isdnd/process.c | 219 -- usr.sbin/i4b/isdnd/rates.c | 509 ---- usr.sbin/i4b/isdnd/rc_config.c | 1865 -------------- usr.sbin/i4b/isdnd/rc_parse.y | 539 ----- usr.sbin/i4b/isdnd/rc_scan.l | 209 -- usr.sbin/i4b/isdnd/support.c | 1169 --------- usr.sbin/i4b/isdnd/timer.c | 447 ---- usr.sbin/i4b/isdndebug/Makefile | 7 - usr.sbin/i4b/isdndebug/isdndebug.8 | 111 - usr.sbin/i4b/isdndebug/main.c | 633 ----- usr.sbin/i4b/isdndecode/Makefile | 8 - usr.sbin/i4b/isdndecode/decode.h | 76 - usr.sbin/i4b/isdndecode/facility.c | 1111 --------- usr.sbin/i4b/isdndecode/facility.h | 180 -- usr.sbin/i4b/isdndecode/isdndecode.8 | 176 -- usr.sbin/i4b/isdndecode/layer1.c | 82 - usr.sbin/i4b/isdndecode/layer2.c | 300 --- usr.sbin/i4b/isdndecode/layer3.c | 516 ---- usr.sbin/i4b/isdndecode/layer3_subr.c | 1122 --------- usr.sbin/i4b/isdndecode/main.c | 794 ------ usr.sbin/i4b/isdndecode/pcause.c | 330 --- usr.sbin/i4b/isdndecode/pcause.h | 111 - usr.sbin/i4b/isdnmonitor/Makefile | 17 - usr.sbin/i4b/isdnmonitor/curses.c | 624 ----- usr.sbin/i4b/isdnmonitor/isdnmonitor.8 | 178 -- usr.sbin/i4b/isdnmonitor/main.c | 1196 --------- usr.sbin/i4b/isdnmonitor/monitor.h | 299 --- usr.sbin/i4b/isdnmonitor/monprivate.h | 210 -- usr.sbin/i4b/isdnphone/Makefile | 10 - usr.sbin/i4b/isdnphone/audio.c | 159 -- usr.sbin/i4b/isdnphone/defs.h | 189 -- usr.sbin/i4b/isdnphone/display.c | 246 -- usr.sbin/i4b/isdnphone/isdn.c | 191 -- usr.sbin/i4b/isdnphone/isdnphone.8 | 88 - usr.sbin/i4b/isdnphone/main.c | 533 ---- usr.sbin/i4b/isdntel/Makefile | 10 - usr.sbin/i4b/isdntel/alias.c | 141 -- usr.sbin/i4b/isdntel/alias.h | 51 - usr.sbin/i4b/isdntel/defs.h | 157 -- usr.sbin/i4b/isdntel/display.c | 254 -- usr.sbin/i4b/isdntel/files.c | 308 --- usr.sbin/i4b/isdntel/isdntel.8 | 103 - usr.sbin/i4b/isdntel/main.c | 399 --- usr.sbin/i4b/isdntelctl/Makefile | 7 - usr.sbin/i4b/isdntelctl/isdntelctl.8 | 99 - usr.sbin/i4b/isdntelctl/main.c | 228 -- usr.sbin/i4b/isdntest/Makefile | 10 - usr.sbin/i4b/isdntest/isdntest.8 | 116 - usr.sbin/i4b/isdntest/main.c | 745 ------ usr.sbin/i4b/isdntrace/1tr6.c | 756 ------ usr.sbin/i4b/isdntrace/Makefile | 9 - usr.sbin/i4b/isdntrace/cable.txt | 62 - usr.sbin/i4b/isdntrace/isdntrace.8 | 228 -- usr.sbin/i4b/isdntrace/pcause_1tr6.c | 166 -- usr.sbin/i4b/isdntrace/pcause_1tr6.h | 70 - usr.sbin/i4b/isdntrace/pcause_q850.c | 330 --- usr.sbin/i4b/isdntrace/pcause_q850.h | 111 - usr.sbin/i4b/isdntrace/q921.c | 268 --- usr.sbin/i4b/isdntrace/q931.c | 800 ------ usr.sbin/i4b/isdntrace/q931_util.c | 1047 -------- usr.sbin/i4b/isdntrace/q932_fac.c | 1236 ---------- usr.sbin/i4b/isdntrace/q932_fac.h | 180 -- usr.sbin/i4b/isdntrace/trace.c | 848 ------- usr.sbin/i4b/isdntrace/trace.h | 93 - usr.sbin/i4b/isdntrace/unknownl3.c | 106 - usr.sbin/i4b/man/Makefile | 9 - usr.sbin/i4b/man/i4b.4 | 110 - usr.sbin/i4b/man/i4bcapi.4 | 59 - usr.sbin/i4b/man/i4bctl.4 | 50 - usr.sbin/i4b/man/i4bing.4 | 63 - usr.sbin/i4b/man/i4bipr.4 | 96 - usr.sbin/i4b/man/i4bisppp.4 | 123 - usr.sbin/i4b/man/i4bq921.4 | 48 - usr.sbin/i4b/man/i4bq931.4 | 48 - usr.sbin/i4b/man/i4brbch.4 | 49 - usr.sbin/i4b/man/i4btel.4 | 133 - usr.sbin/i4b/man/i4btrc.4 | 54 - usr.sbin/i4b/man/iavc.4 | 73 - usr.sbin/i4b/man/ifpi.4 | 64 - usr.sbin/i4b/man/ifpi2.4 | 60 - usr.sbin/i4b/man/ifpnp.4 | 67 - usr.sbin/i4b/man/ihfc.4 | 71 - usr.sbin/i4b/man/isic.4 | 359 --- usr.sbin/i4b/man/itjc.4 | 66 - usr.sbin/i4b/man/iwic.4 | 68 - usr.sbin/mergemaster/mergemaster.sh | 4 +- usr.sbin/ppp/Makefile | 10 - usr.sbin/ppp/i4b.c | 446 ---- usr.sbin/ppp/physical.c | 10 - usr.sbin/ppp/ppp.8.m4 | 20 +- 343 files changed, 136 insertions(+), 103830 deletions(-) delete mode 100644 etc/isdn/Makefile delete mode 100755 etc/isdn/answer delete mode 100644 etc/isdn/holidays.D delete mode 100644 etc/isdn/isdnd.rates.A delete mode 100644 etc/isdn/isdnd.rates.D delete mode 100644 etc/isdn/isdnd.rates.F delete mode 100644 etc/isdn/isdnd.rates.L delete mode 100644 etc/isdn/isdnd.rates.UK.BT delete mode 100644 etc/isdn/isdnd.rc.sample delete mode 100644 etc/isdn/isdntel.alias.sample delete mode 100755 etc/isdn/isdntel.sh delete mode 100755 etc/isdn/record delete mode 100755 etc/isdn/tell delete mode 100755 etc/isdn/tell-record delete mode 100755 etc/isdn/unknown_incoming delete mode 100644 etc/rc.d/isdnd delete mode 100644 share/examples/isdn/FAQ delete mode 100644 share/examples/isdn/KERNEL delete mode 100644 share/examples/isdn/Overview delete mode 100644 share/examples/isdn/README delete mode 100644 share/examples/isdn/ROADMAP delete mode 100644 share/examples/isdn/ReleaseNotes delete mode 100644 share/examples/isdn/Resources delete mode 100644 share/examples/isdn/SupportedCards delete mode 100644 share/examples/isdn/ThankYou delete mode 100644 share/examples/isdn/contrib/README delete mode 100644 share/examples/isdn/contrib/anleitung.ppp delete mode 100644 share/examples/isdn/contrib/answer.c delete mode 100644 share/examples/isdn/contrib/answer.sh delete mode 100644 share/examples/isdn/contrib/convert.sh delete mode 100644 share/examples/isdn/contrib/hplay.c delete mode 100644 share/examples/isdn/contrib/i4b-ppp-newbie.txt delete mode 100644 share/examples/isdn/contrib/isdnctl delete mode 100644 share/examples/isdn/contrib/isdnd_acct delete mode 100644 share/examples/isdn/contrib/isdnd_acct.pl delete mode 100644 share/examples/isdn/contrib/isdntelmux.c delete mode 100644 share/examples/isdn/contrib/mrtg-isp0.sh delete mode 100644 share/examples/isdn/i4brunppp/Makefile delete mode 100644 share/examples/isdn/i4brunppp/README delete mode 100644 share/examples/isdn/i4brunppp/i4brunppp-isdnd.rc delete mode 100644 share/examples/isdn/i4brunppp/i4brunppp.8 delete mode 100644 share/examples/isdn/i4brunppp/i4brunppp.c delete mode 100644 share/examples/isdn/v21/Makefile delete mode 100644 share/examples/isdn/v21/README delete mode 100644 share/examples/isdn/v21/v21modem.c delete mode 100644 share/examples/ppp/isdnd.rc delete mode 100644 share/examples/ppp/ppp.conf.isdn delete mode 100644 share/isdn/0.al.uu delete mode 100644 share/isdn/1.al.uu delete mode 100644 share/isdn/2.al.uu delete mode 100644 share/isdn/3.al.uu delete mode 100644 share/isdn/4.al.uu delete mode 100644 share/isdn/5.al.uu delete mode 100644 share/isdn/6.al.uu delete mode 100644 share/isdn/7.al.uu delete mode 100644 share/isdn/8.al.uu delete mode 100644 share/isdn/9.al.uu delete mode 100644 share/isdn/Makefile delete mode 100644 share/isdn/beep.al.uu delete mode 100644 share/isdn/msg.al.uu delete mode 100644 sys/i4b/capi/README delete mode 100644 sys/i4b/capi/capi.h delete mode 100644 sys/i4b/capi/capi_l4if.c delete mode 100644 sys/i4b/capi/capi_llif.c delete mode 100644 sys/i4b/capi/capi_msgs.c delete mode 100644 sys/i4b/capi/capi_msgs.h delete mode 100644 sys/i4b/capi/iavc/iavc.h delete mode 100644 sys/i4b/capi/iavc/iavc_card.c delete mode 100644 sys/i4b/capi/iavc/iavc_isa.c delete mode 100644 sys/i4b/capi/iavc/iavc_lli.c delete mode 100644 sys/i4b/capi/iavc/iavc_pci.c delete mode 100644 sys/i4b/driver/i4b_ctl.c delete mode 100644 sys/i4b/driver/i4b_ing.c delete mode 100644 sys/i4b/driver/i4b_ipr.c delete mode 100644 sys/i4b/driver/i4b_isppp.c delete mode 100644 sys/i4b/driver/i4b_rbch.c delete mode 100644 sys/i4b/driver/i4b_tel.c delete mode 100644 sys/i4b/driver/i4b_trace.c delete mode 100644 sys/i4b/include/i4b_cause.h delete mode 100644 sys/i4b/include/i4b_debug.h delete mode 100644 sys/i4b/include/i4b_global.h delete mode 100644 sys/i4b/include/i4b_ioctl.h delete mode 100644 sys/i4b/include/i4b_isdnq931.h delete mode 100644 sys/i4b/include/i4b_l1l2.h delete mode 100644 sys/i4b/include/i4b_l2l3.h delete mode 100644 sys/i4b/include/i4b_l3l4.h delete mode 100644 sys/i4b/include/i4b_mbuf.h delete mode 100644 sys/i4b/include/i4b_rbch_ioctl.h delete mode 100644 sys/i4b/include/i4b_tel_ioctl.h delete mode 100644 sys/i4b/include/i4b_trace.h delete mode 100644 sys/i4b/layer1/i4b_hdlc.c delete mode 100644 sys/i4b/layer1/i4b_hdlc.h delete mode 100644 sys/i4b/layer1/i4b_l1.h delete mode 100644 sys/i4b/layer1/i4b_l1dmux.c delete mode 100644 sys/i4b/layer1/i4b_l1lib.c delete mode 100644 sys/i4b/layer1/ifpi/i4b_ifpi_ext.h delete mode 100644 sys/i4b/layer1/ifpi/i4b_ifpi_isac.c delete mode 100644 sys/i4b/layer1/ifpi/i4b_ifpi_l1.c delete mode 100644 sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c delete mode 100644 sys/i4b/layer1/ifpi/i4b_ifpi_pci.c delete mode 100644 sys/i4b/layer1/ifpi2/i4b_ifpi2_ext.h delete mode 100644 sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c delete mode 100644 sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.h delete mode 100644 sys/i4b/layer1/ifpi2/i4b_ifpi2_l1.c delete mode 100644 sys/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c delete mode 100644 sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c delete mode 100644 sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c delete mode 100644 sys/i4b/layer1/ifpnp/i4b_ifpnp_ext.h delete mode 100644 sys/i4b/layer1/ifpnp/i4b_ifpnp_isac.c delete mode 100644 sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c delete mode 100644 sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c delete mode 100644 sys/i4b/layer1/ihfc/i4b_ihfc.h delete mode 100644 sys/i4b/layer1/ihfc/i4b_ihfc_drv.c delete mode 100644 sys/i4b/layer1/ihfc/i4b_ihfc_drv.h delete mode 100644 sys/i4b/layer1/ihfc/i4b_ihfc_ext.h delete mode 100644 sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c delete mode 100644 sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c delete mode 100644 sys/i4b/layer1/isic/i4b_asuscom_ipac.c delete mode 100644 sys/i4b/layer1/isic/i4b_avm_a1.c delete mode 100644 sys/i4b/layer1/isic/i4b_bchan.c delete mode 100644 sys/i4b/layer1/isic/i4b_ctx_s0P.c delete mode 100644 sys/i4b/layer1/isic/i4b_diva.c delete mode 100644 sys/i4b/layer1/isic/i4b_drn_ngo.c delete mode 100644 sys/i4b/layer1/isic/i4b_dynalink.c delete mode 100644 sys/i4b/layer1/isic/i4b_elsa_pcc16.c delete mode 100644 sys/i4b/layer1/isic/i4b_elsa_qs1i.c delete mode 100644 sys/i4b/layer1/isic/i4b_elsa_qs1p.c delete mode 100644 sys/i4b/layer1/isic/i4b_hscx.c delete mode 100644 sys/i4b/layer1/isic/i4b_hscx.h delete mode 100644 sys/i4b/layer1/isic/i4b_ipac.h delete mode 100644 sys/i4b/layer1/isic/i4b_isac.c delete mode 100644 sys/i4b/layer1/isic/i4b_isac.h delete mode 100644 sys/i4b/layer1/isic/i4b_isic.c delete mode 100644 sys/i4b/layer1/isic/i4b_isic.h delete mode 100644 sys/i4b/layer1/isic/i4b_isic_ext.h delete mode 100644 sys/i4b/layer1/isic/i4b_isic_isa.c delete mode 100644 sys/i4b/layer1/isic/i4b_isic_pnp.c delete mode 100644 sys/i4b/layer1/isic/i4b_itk_ix1.c delete mode 100644 sys/i4b/layer1/isic/i4b_l1.c delete mode 100644 sys/i4b/layer1/isic/i4b_l1fsm.c delete mode 100644 sys/i4b/layer1/isic/i4b_siemens_isurf.c delete mode 100644 sys/i4b/layer1/isic/i4b_sws.c delete mode 100644 sys/i4b/layer1/isic/i4b_tel_s016.c delete mode 100644 sys/i4b/layer1/isic/i4b_tel_s0163.c delete mode 100644 sys/i4b/layer1/isic/i4b_tel_s08.c delete mode 100644 sys/i4b/layer1/isic/i4b_usr_sti.c delete mode 100644 sys/i4b/layer1/itjc/i4b_hdlc.h delete mode 100644 sys/i4b/layer1/itjc/i4b_itjc_ext.h delete mode 100644 sys/i4b/layer1/itjc/i4b_itjc_isac.c delete mode 100644 sys/i4b/layer1/itjc/i4b_itjc_l1.c delete mode 100644 sys/i4b/layer1/itjc/i4b_itjc_l1fsm.c delete mode 100644 sys/i4b/layer1/itjc/i4b_itjc_pci.c delete mode 100644 sys/i4b/layer1/iwic/i4b_iwic.h delete mode 100644 sys/i4b/layer1/iwic/i4b_iwic_bchan.c delete mode 100644 sys/i4b/layer1/iwic/i4b_iwic_dchan.c delete mode 100644 sys/i4b/layer1/iwic/i4b_iwic_ext.h delete mode 100644 sys/i4b/layer1/iwic/i4b_iwic_fsm.c delete mode 100644 sys/i4b/layer1/iwic/i4b_iwic_l1if.c delete mode 100644 sys/i4b/layer1/iwic/i4b_iwic_pci.c delete mode 100644 sys/i4b/layer1/iwic/i4b_w6692.h delete mode 100644 sys/i4b/layer2/i4b_iframe.c delete mode 100644 sys/i4b/layer2/i4b_l2.c delete mode 100644 sys/i4b/layer2/i4b_l2.h delete mode 100644 sys/i4b/layer2/i4b_l2fsm.c delete mode 100644 sys/i4b/layer2/i4b_l2fsm.h delete mode 100644 sys/i4b/layer2/i4b_l2timer.c delete mode 100644 sys/i4b/layer2/i4b_lme.c delete mode 100644 sys/i4b/layer2/i4b_mbuf.c delete mode 100644 sys/i4b/layer2/i4b_sframe.c delete mode 100644 sys/i4b/layer2/i4b_tei.c delete mode 100644 sys/i4b/layer2/i4b_uframe.c delete mode 100644 sys/i4b/layer2/i4b_util.c delete mode 100644 sys/i4b/layer3/i4b_l2if.c delete mode 100644 sys/i4b/layer3/i4b_l3.h delete mode 100644 sys/i4b/layer3/i4b_l3fsm.c delete mode 100644 sys/i4b/layer3/i4b_l3fsm.h delete mode 100644 sys/i4b/layer3/i4b_l3timer.c delete mode 100644 sys/i4b/layer3/i4b_l4if.c delete mode 100644 sys/i4b/layer3/i4b_q931.c delete mode 100644 sys/i4b/layer3/i4b_q931.h delete mode 100644 sys/i4b/layer3/i4b_q932fac.c delete mode 100644 sys/i4b/layer3/i4b_q932fac.h delete mode 100644 sys/i4b/layer4/i4b_i4bdrv.c delete mode 100644 sys/i4b/layer4/i4b_l4.c delete mode 100644 sys/i4b/layer4/i4b_l4.h delete mode 100644 sys/i4b/layer4/i4b_l4mgmt.c delete mode 100644 sys/i4b/layer4/i4b_l4timer.c delete mode 100644 tools/build/options/WITHOUT_I4B delete mode 100644 tools/kerneldoc/subsys/Doxyfile-i4b delete mode 100644 usr.sbin/i4b/Makefile delete mode 100644 usr.sbin/i4b/Makefile.inc delete mode 100644 usr.sbin/i4b/dtmfdecode/Makefile delete mode 100644 usr.sbin/i4b/dtmfdecode/dtmfdecode.1 delete mode 100644 usr.sbin/i4b/dtmfdecode/dtmfdecode.c delete mode 100644 usr.sbin/i4b/dtmfdecode/dtmfsounds.al.uu delete mode 100644 usr.sbin/i4b/g711conv/Makefile delete mode 100644 usr.sbin/i4b/g711conv/g711conv.1 delete mode 100644 usr.sbin/i4b/g711conv/g711conv.c delete mode 100644 usr.sbin/i4b/isdnd/Makefile delete mode 100644 usr.sbin/i4b/isdnd/alias.c delete mode 100644 usr.sbin/i4b/isdnd/config.h delete mode 100644 usr.sbin/i4b/isdnd/controller.c delete mode 100644 usr.sbin/i4b/isdnd/curses.c delete mode 100644 usr.sbin/i4b/isdnd/dial.c delete mode 100644 usr.sbin/i4b/isdnd/exec.c delete mode 100644 usr.sbin/i4b/isdnd/fsm.c delete mode 100644 usr.sbin/i4b/isdnd/holiday.c delete mode 100644 usr.sbin/i4b/isdnd/isdnd.8 delete mode 100644 usr.sbin/i4b/isdnd/isdnd.acct.5 delete mode 100644 usr.sbin/i4b/isdnd/isdnd.h delete mode 100644 usr.sbin/i4b/isdnd/isdnd.rates.5 delete mode 100644 usr.sbin/i4b/isdnd/isdnd.rc.5 delete mode 100644 usr.sbin/i4b/isdnd/log.c delete mode 100644 usr.sbin/i4b/isdnd/main.c delete mode 100644 usr.sbin/i4b/isdnd/monitor.c delete mode 100644 usr.sbin/i4b/isdnd/msghdl.c delete mode 100644 usr.sbin/i4b/isdnd/pathnames.h delete mode 100644 usr.sbin/i4b/isdnd/pcause.c delete mode 100644 usr.sbin/i4b/isdnd/process.c delete mode 100644 usr.sbin/i4b/isdnd/rates.c delete mode 100644 usr.sbin/i4b/isdnd/rc_config.c delete mode 100644 usr.sbin/i4b/isdnd/rc_parse.y delete mode 100644 usr.sbin/i4b/isdnd/rc_scan.l delete mode 100644 usr.sbin/i4b/isdnd/support.c delete mode 100644 usr.sbin/i4b/isdnd/timer.c delete mode 100644 usr.sbin/i4b/isdndebug/Makefile delete mode 100644 usr.sbin/i4b/isdndebug/isdndebug.8 delete mode 100644 usr.sbin/i4b/isdndebug/main.c delete mode 100644 usr.sbin/i4b/isdndecode/Makefile delete mode 100644 usr.sbin/i4b/isdndecode/decode.h delete mode 100644 usr.sbin/i4b/isdndecode/facility.c delete mode 100644 usr.sbin/i4b/isdndecode/facility.h delete mode 100644 usr.sbin/i4b/isdndecode/isdndecode.8 delete mode 100644 usr.sbin/i4b/isdndecode/layer1.c delete mode 100644 usr.sbin/i4b/isdndecode/layer2.c delete mode 100644 usr.sbin/i4b/isdndecode/layer3.c delete mode 100644 usr.sbin/i4b/isdndecode/layer3_subr.c delete mode 100644 usr.sbin/i4b/isdndecode/main.c delete mode 100644 usr.sbin/i4b/isdndecode/pcause.c delete mode 100644 usr.sbin/i4b/isdndecode/pcause.h delete mode 100644 usr.sbin/i4b/isdnmonitor/Makefile delete mode 100644 usr.sbin/i4b/isdnmonitor/curses.c delete mode 100644 usr.sbin/i4b/isdnmonitor/isdnmonitor.8 delete mode 100644 usr.sbin/i4b/isdnmonitor/main.c delete mode 100644 usr.sbin/i4b/isdnmonitor/monitor.h delete mode 100644 usr.sbin/i4b/isdnmonitor/monprivate.h delete mode 100644 usr.sbin/i4b/isdnphone/Makefile delete mode 100644 usr.sbin/i4b/isdnphone/audio.c delete mode 100644 usr.sbin/i4b/isdnphone/defs.h delete mode 100644 usr.sbin/i4b/isdnphone/display.c delete mode 100644 usr.sbin/i4b/isdnphone/isdn.c delete mode 100644 usr.sbin/i4b/isdnphone/isdnphone.8 delete mode 100644 usr.sbin/i4b/isdnphone/main.c delete mode 100644 usr.sbin/i4b/isdntel/Makefile delete mode 100644 usr.sbin/i4b/isdntel/alias.c delete mode 100644 usr.sbin/i4b/isdntel/alias.h delete mode 100644 usr.sbin/i4b/isdntel/defs.h delete mode 100644 usr.sbin/i4b/isdntel/display.c delete mode 100644 usr.sbin/i4b/isdntel/files.c delete mode 100644 usr.sbin/i4b/isdntel/isdntel.8 delete mode 100644 usr.sbin/i4b/isdntel/main.c delete mode 100644 usr.sbin/i4b/isdntelctl/Makefile delete mode 100644 usr.sbin/i4b/isdntelctl/isdntelctl.8 delete mode 100644 usr.sbin/i4b/isdntelctl/main.c delete mode 100644 usr.sbin/i4b/isdntest/Makefile delete mode 100644 usr.sbin/i4b/isdntest/isdntest.8 delete mode 100644 usr.sbin/i4b/isdntest/main.c delete mode 100644 usr.sbin/i4b/isdntrace/1tr6.c delete mode 100644 usr.sbin/i4b/isdntrace/Makefile delete mode 100644 usr.sbin/i4b/isdntrace/cable.txt delete mode 100644 usr.sbin/i4b/isdntrace/isdntrace.8 delete mode 100644 usr.sbin/i4b/isdntrace/pcause_1tr6.c delete mode 100644 usr.sbin/i4b/isdntrace/pcause_1tr6.h delete mode 100644 usr.sbin/i4b/isdntrace/pcause_q850.c delete mode 100644 usr.sbin/i4b/isdntrace/pcause_q850.h delete mode 100644 usr.sbin/i4b/isdntrace/q921.c delete mode 100644 usr.sbin/i4b/isdntrace/q931.c delete mode 100644 usr.sbin/i4b/isdntrace/q931_util.c delete mode 100644 usr.sbin/i4b/isdntrace/q932_fac.c delete mode 100644 usr.sbin/i4b/isdntrace/q932_fac.h delete mode 100644 usr.sbin/i4b/isdntrace/trace.c delete mode 100644 usr.sbin/i4b/isdntrace/trace.h delete mode 100644 usr.sbin/i4b/isdntrace/unknownl3.c delete mode 100644 usr.sbin/i4b/man/Makefile delete mode 100644 usr.sbin/i4b/man/i4b.4 delete mode 100644 usr.sbin/i4b/man/i4bcapi.4 delete mode 100644 usr.sbin/i4b/man/i4bctl.4 delete mode 100644 usr.sbin/i4b/man/i4bing.4 delete mode 100644 usr.sbin/i4b/man/i4bipr.4 delete mode 100644 usr.sbin/i4b/man/i4bisppp.4 delete mode 100644 usr.sbin/i4b/man/i4bq921.4 delete mode 100644 usr.sbin/i4b/man/i4bq931.4 delete mode 100644 usr.sbin/i4b/man/i4brbch.4 delete mode 100644 usr.sbin/i4b/man/i4btel.4 delete mode 100644 usr.sbin/i4b/man/i4btrc.4 delete mode 100644 usr.sbin/i4b/man/iavc.4 delete mode 100644 usr.sbin/i4b/man/ifpi.4 delete mode 100644 usr.sbin/i4b/man/ifpi2.4 delete mode 100644 usr.sbin/i4b/man/ifpnp.4 delete mode 100644 usr.sbin/i4b/man/ihfc.4 delete mode 100644 usr.sbin/i4b/man/isic.4 delete mode 100644 usr.sbin/i4b/man/itjc.4 delete mode 100644 usr.sbin/i4b/man/iwic.4 delete mode 100644 usr.sbin/ppp/i4b.c diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 295125f42d0e..b51f4625812e 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -14,6 +14,120 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20080525: I4B removed +OLD_FILES+=etc/isdn/answer +OLD_FILES+=etc/isdn/isdntel +OLD_FILES+=etc/isdn/record +OLD_FILES+=etc/isdn/tell +OLD_FILES+=etc/isdn/tell-record +OLD_FILES+=etc/isdn/unknown_incoming +OLD_FILES+=etc/isdn/holidays.D +OLD_FILES+=etc/isdn/isdnd.rates.A +OLD_FILES+=etc/isdn/isdnd.rates.D +OLD_FILES+=etc/isdn/isdnd.rates.F +OLD_FILES+=etc/isdn/isdnd.rates.L +OLD_FILES+=etc/isdn/isdnd.rates.UK.BT +OLD_FILES+=etc/isdn/isdnd.rc.sample +OLD_FILES+=etc/isdn/isdntel.alias.sample +OLD_DIRS+=etc/isdn +OLD_FILES+=etc/rc.d/isdnd +OLD_FILES+=usr/include/i4b/i4b_cause.h +OLD_FILES+=usr/include/i4b/i4b_debug.h +OLD_FILES+=usr/include/i4b/i4b_ioctl.h +OLD_FILES+=usr/include/i4b/i4b_rbch_ioctl.h +OLD_FILES+=usr/include/i4b/i4b_tel_ioctl.h +OLD_FILES+=usr/include/i4b/i4b_trace.h +OLD_DIRS+=usr/include/i4b +OLD_FILES+=usr/sbin/dtmfdecode +OLD_FILES+=usr/sbin/g711conv +OLD_FILES+=usr/sbin/isdnd +OLD_FILES+=usr/sbin/isdndebug +OLD_FILES+=usr/sbin/isdndecode +OLD_FILES+=usr/sbin/isdnmonitor +OLD_FILES+=usr/sbin/isdnphone +OLD_FILES+=usr/sbin/isdntel +OLD_FILES+=usr/sbin/isdntelctl +OLD_FILES+=usr/sbin/isdntrace +OLD_FILES+=usr/share/isdn/0.al +OLD_FILES+=usr/share/isdn/1.al +OLD_FILES+=usr/share/isdn/2.al +OLD_FILES+=usr/share/isdn/3.al +OLD_FILES+=usr/share/isdn/4.al +OLD_FILES+=usr/share/isdn/5.al +OLD_FILES+=usr/share/isdn/6.al +OLD_FILES+=usr/share/isdn/7.al +OLD_FILES+=usr/share/isdn/8.al +OLD_FILES+=usr/share/isdn/9.al +OLD_FILES+=usr/share/isdn/beep.al +OLD_FILES+=usr/share/isdn/msg.al +OLD_DIRS+=usr/share/isdn +OLD_FILES+=usr/share/man/man1/dtmfdecode.1.gz +OLD_FILES+=usr/share/man/man1/g711conv.1.gz +OLD_FILES+=usr/share/man/man4/i4b.4.gz +OLD_FILES+=usr/share/man/man4/i4bcapi.4.gz +OLD_FILES+=usr/share/man/man4/i4bctl.4.gz +OLD_FILES+=usr/share/man/man4/i4bing.4.gz +OLD_FILES+=usr/share/man/man4/i4bipr.4.gz +OLD_FILES+=usr/share/man/man4/i4bisppp.4.gz +OLD_FILES+=usr/share/man/man4/i4bq921.4.gz +OLD_FILES+=usr/share/man/man4/i4bq931.4.gz +OLD_FILES+=usr/share/man/man4/i4brbch.4.gz +OLD_FILES+=usr/share/man/man4/i4btel.4.gz +OLD_FILES+=usr/share/man/man4/i4btrc.4.gz +OLD_FILES+=usr/share/man/man4/iavc.4.gz +OLD_FILES+=usr/share/man/man4/isic.4.gz +OLD_FILES+=usr/share/man/man4/ifpi.4.gz +OLD_FILES+=usr/share/man/man4/ifpi2.4.gz +OLD_FILES+=usr/share/man/man4/ifpnp.4.gz +OLD_FILES+=usr/share/man/man4/ihfc.4.gz +OLD_FILES+=usr/share/man/man4/itjc.4.gz +OLD_FILES+=usr/share/man/man4/iwic.4.gz +OLD_FILES+=usr/share/man/man5/isdnd.rc.5.gz +OLD_FILES+=usr/share/man/man5/isdnd.rates.5.gz +OLD_FILES+=usr/share/man/man5/isdnd.acct.5.gz +OLD_FILES+=usr/share/man/man8/isdnd.8.gz +OLD_FILES+=usr/share/man/man8/isdndebug.8.gz +OLD_FILES+=usr/share/man/man8/isdndecode.8.gz +OLD_FILES+=usr/share/man/man8/isdnmonitor.8.gz +OLD_FILES+=usr/share/man/man8/isdnphone.8.gz +OLD_FILES+=usr/share/man/man8/isdntel.8.gz +OLD_FILES+=usr/share/man/man8/isdntelctl.8.gz +OLD_FILES+=usr/share/man/man8/isdntrace.8.gz +OLD_FILES+=usr/share/examples/isdn/contrib/README +OLD_FILES+=usr/share/examples/isdn/contrib/anleitung.ppp +OLD_FILES+=usr/share/examples/isdn/contrib/answer.c +OLD_FILES+=usr/share/examples/isdn/contrib/answer.sh +OLD_FILES+=usr/share/examples/isdn/contrib/convert.sh +OLD_FILES+=usr/share/examples/isdn/contrib/hplay.c +OLD_FILES+=usr/share/examples/isdn/contrib/i4b-ppp-newbie.txt +OLD_FILES+=usr/share/examples/isdn/contrib/isdnctl +OLD_FILES+=usr/share/examples/isdn/contrib/isdnd_acct +OLD_FILES+=usr/share/examples/isdn/contrib/isdnd_acct.pl +OLD_FILES+=usr/share/examples/isdn/contrib/isdntelmux.c +OLD_FILES+=usr/share/examples/isdn/contrib/mrtg-isp0.sh +OLD_FILES+=usr/share/examples/isdn/i4brunppp/Makefile +OLD_FILES+=usr/share/examples/isdn/i4brunppp/README +OLD_FILES+=usr/share/examples/isdn/i4brunppp/i4brunppp-isdnd.rc +OLD_FILES+=usr/share/examples/isdn/i4brunppp/i4brunppp.8 +OLD_FILES+=usr/share/examples/isdn/i4brunppp/i4brunppp.c +OLD_FILES+=usr/share/examples/isdn/v21/Makefile +OLD_FILES+=usr/share/examples/isdn/v21/README +OLD_FILES+=usr/share/examples/isdn/v21/v21modem.c +OLD_FILES+=usr/share/examples/isdn/FAQ +OLD_FILES+=usr/share/examples/isdn/KERNEL +OLD_FILES+=usr/share/examples/isdn/Overview +OLD_FILES+=usr/share/examples/isdn/README +OLD_FILES+=usr/share/examples/isdn/ROADMAP +OLD_FILES+=usr/share/examples/isdn/ReleaseNotes +OLD_FILES+=usr/share/examples/isdn/Resources +OLD_FILES+=usr/share/examples/isdn/SupportedCards +OLD_FILES+=usr/share/examples/isdn/ThankYou +OLD_DIRS+=usr/share/examples/isdn/contrib +OLD_DIRS+=usr/share/examples/isdn/i4brunppp +OLD_DIRS+=usr/share/examples/isdn/v21 +OLD_DIRS+=usr/share/examples/isdn +OLD_FILES+=usr/share/examples/ppp/isdnd.rc +OLD_FILES+=usr/share/examples/ppp/ppp.conf.isdn # 20080420: Symbol card support dropped OLD_FILES+=usr/include/dev/wi/spectrum24t_cf.h # 20080420: awi removal diff --git a/UPDATING b/UPDATING index 43fee7d19b09..2dd076741066 100644 --- a/UPDATING +++ b/UPDATING @@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW: to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20080525: + ISDN4BSD (I4B) was removed from the src tree. You may need to + update a your kernel configuration and remove relevant entries. + 20080509: I have checked in code to support multiple routing tables. see the man pages setfib(1) and setfib(2). diff --git a/etc/Makefile b/etc/Makefile index 2483814b192a..29e72aa52ebe 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -127,9 +127,6 @@ distribution: ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR} cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \ ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR} -.if ${MK_I4B} != "no" - ${_+_}cd ${.CURDIR}/isdn; ${MAKE} install -.endif .if ${MK_BIND_MTREE} != "no" @if [ ! -e ${DESTDIR}/etc/namedb ]; then \ set -x; \ diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 3d03b048d618..177f4d529dba 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -194,8 +194,8 @@ ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration. # If you have any sppp(4) interfaces above, you might also want to set # the following parameters. Refer to spppcontrol(8) for their meaning. sppp_interfaces="" # List of sppp interfaces. -#sppp_interfaces="isp0" # example: sppp over ISDN -#spppconfig_isp0="authproto=chap myauthname=foo myauthsecret='top secret' hisauthname=some-gw hisauthsecret='another secret'" +#sppp_interfaces="...0" # example: sppp over ... +#spppconfig_...0="authproto=chap myauthname=foo myauthsecret='top secret' hisauthname=some-gw hisauthsecret='another secret'" gif_interfaces="" # List of GIF tunnels. #gif_interfaces="gif0 gif1" # Examples typically for a router. # Choose correct tunnel addrs. @@ -363,15 +363,6 @@ atm_enable="NO" # Configure ATM interfaces (or NO). atm_pvcs="" # Set to PVC list (or leave empty). atm_arps="" # Set to permanent ARP list (or leave empty). -### ISDN interface options: (see also: /usr/share/examples/isdn) ### -isdn_enable="NO" # Enable the ISDN subsystem (or NO). -isdn_fsdev="NO" # Output device for fullscreen mode (or NO for daemon mode). -isdn_flags="-dn -d0x1f9" # Flags for isdnd -isdn_ttype="cons25" # terminal type for fullscreen mode -isdn_screenflags="NO" # screenflags for ${isdn_fsdev} -isdn_trace="NO" # Enable the ISDN trace subsystem (or NO). -isdn_traceflags="-f /var/tmp/isdntrace0" # Flags for isdntrace - ### Bluetooth ### hcsecd_enable="NO" # Enable hcsecd(8) (or NO) hcsecd_config="/etc/bluetooth/hcsecd.conf" # hcsecd(8) configuration file diff --git a/etc/isdn/Makefile b/etc/isdn/Makefile deleted file mode 100644 index 0f27b5021f83..000000000000 --- a/etc/isdn/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# $FreeBSD$ - -NO_OBJ= - -SCRIPTS= answer \ - isdntel.sh \ - record \ - tell \ - tell-record \ - unknown_incoming - -FILES= holidays.D \ - isdnd.rates.A \ - isdnd.rates.D \ - isdnd.rates.F \ - isdnd.rates.L \ - isdnd.rates.UK.BT \ - isdnd.rc.sample \ - isdntel.alias.sample - -BINDIR= /etc/isdn -BINMODE= 700 -FILESMODE= 600 - -.include diff --git a/etc/isdn/answer b/etc/isdn/answer deleted file mode 100755 index d39a98331206..000000000000 --- a/etc/isdn/answer +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------------------- -# -# answer script for i4b isdnd -# --------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Thu May 20 11:44:38 1999] -# -#--------------------------------------------------------------------------- -VARDIR=/var/isdn - -#FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS -#LIBDIR=/usr/local/lib/isdn -#FreeBSD 3.1 and up -LIBDIR=/usr/share/isdn - -LOGFILE=/tmp/answer.log -NCALLFILE=${VARDIR}/ncall -DATE=`date +%d%H` -DF=0 -dF=0 -sF=0 - -if ! set -- `getopt D:d:s: $*`; then - echo 'Usage: answer -D device -d destination -s source' - exit 1 -fi - -for i ; do - case ${i} in - -D) - DEVICE=$2 - DF=1 - shift - shift - ;; - -d) - DEST=$2 - dF=1 - shift - shift - ;; - -s) - SRC=$2 - sF=1 - shift - shift - ;; - --) - shift - break - ;; - esac -done - -echo "" >>${LOGFILE} - -if [ "${DF}" -eq 0 -o "${dF}" -eq 0 -o "${sF}" -eq 0 ]; then - echo 'Usage: answer -D device -d destination -s source' - exit 1 -fi - -echo "answer: device ${DEVICE} destination ${DEST} source ${SRC} " >>${LOGFILE} - -if [ -r "${NCALLFILE}" ]; then - NCALL=`cat ${NCALLFILE}` -else - NCALL=0 -fi - -NCALL=`printf "%.4d" ${NCALL}` - -echo Date: `date` >> ${VARDIR}/I.${NCALL}.${DATE} - -if [ -n "${SRC}" ]; then - echo "From: ${SRC}" >> ${VARDIR}/I.${NCALL}.${DATE} -fi - -if [ -n "${DEST}" ]; then - echo "To: ${DEST}" >> ${VARDIR}/I.${NCALL}.${DATE} -fi - -if [ -r "${LIBDIR}/beep.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k # >/dev/null 2>&1 -fi - -if [ -r "${LIBDIR}/msg.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/msg.al bs=2k # >/dev/null 2>&1 - if [ -r "${LIBDIR}/beep.al" ] - then - dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k # >/dev/null 2>&1 - fi -fi - -echo `expr ${NCALL} + 1` >${NCALLFILE} diff --git a/etc/isdn/holidays.D b/etc/isdn/holidays.D deleted file mode 100644 index 80b725910846..000000000000 --- a/etc/isdn/holidays.D +++ /dev/null @@ -1,51 +0,0 @@ -#--------------------------------------------------------------------------- -# -# german national holidays 2002/2003/2004 -# bundeseinheitliche Feiertage 2002/2003/2004 -# ------------------------------------------------------------- -# -# last edit-date: [Sat Apr 13 14:22:43 2002] -# -# got from: http://www.ferienkalender.com/ -# -# This file is only of value for installations which are -# using the german Telekom "T-ISDN XXL" tariff where calls -# on sundays and holidays are free of charge. Additional -# configuration of /etc/isdnd.rc has to take place to enable -# support for this tariff, see output of "man isdnd.rc" and -# search for keyword "valid". -# -# $FreeBSD$ -# -#--------------------------------------------------------------------------- -# -# same day/month each year -# -1.1 Neujahr -1.5 Tag der Arbeit -3.10 Tag der deutschen Einheit -25.12 1. Weihnachtsfeiertag -26.12 2. Weihnachtsfeiertag -# -# 2002 - different day/month each year -# -29.3.2002 Karfreitag -1.4.2002 Ostermontag -9.5.2002 Christi Himmelfahrt -20.5.2002 Pfingstmontag -# -# 2003 - different day/month each year -# -18.4.2003 Karfreitag -21.4.2003 Ostermontag -29.5.2003 Christi Himmelfahrt -9.6.2003 Pfingstmontag -# -# 2004 - different day/month each year -# -9.4.2004 Karfreitag -12.4.2004 Ostermontag -20.5.2004 Christi Himmelfahrt -31.5.2004 Pfingstmontag -# -# EOF diff --git a/etc/isdn/isdnd.rates.A b/etc/isdn/isdnd.rates.A deleted file mode 100644 index fa25b22e9e49..000000000000 --- a/etc/isdn/isdnd.rates.A +++ /dev/null @@ -1,39 +0,0 @@ -#--------------------------------------------------------------------------- -# -# i4b - PTA Telekom charging rates config file -# -------------------------------------------- -# -# $Id: isdnd.rates.A,v 1.2 1999/12/13 21:25:24 hm Exp $ -# -# $FreeBSD$ -# -# last edit-date: [Mon Dec 13 21:42:02 1999] -# -# -mr updated to reflect last Telekom changes as of 1.9.99 -# -#--------------------------------------------------------------------------- -# -# reference: http://www.pta.at/ -# -#--------------------------------------------------------------------------- -# -# Syntax: -# ------- -# rate-code: ra0 = Online Tarif -# Day-No: 0-6, where 0 = Sunday, 1 = Monday, etc. -# Rate: start_hour.minutes-end_hour.minutes:period in seconds -# -#------------------------------------------------------------------------------ -# -#=================== Online ================================== -# -#rate-code Day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra0 0 00.00-24.00:360 -ra0 1 00.00-08.00:360 08.00-18.00:120 18.00-24.00:360 -ra0 2 00.00-08.00:360 08.00-18.00:120 18.00-24.00:360 -ra0 3 00.00-08.00:360 08.00-18.00:120 18.00-24.00:360 -ra0 4 00.00-08.00:360 08.00-18.00:120 18.00-24.00:360 -ra0 5 00.00-08.00:360 08.00-18.00:120 18.00-24.00:360 -ra0 6 00.00-24.00:360 -#================== EOF ====================================== diff --git a/etc/isdn/isdnd.rates.D b/etc/isdn/isdnd.rates.D deleted file mode 100644 index 388770ea0770..000000000000 --- a/etc/isdn/isdnd.rates.D +++ /dev/null @@ -1,50 +0,0 @@ -#--------------------------------------------------------------------------- -# -# i4b - Deutsche Telekom charging rates config file -# ------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Sun Jan 17 18:38:29 1999] -# -# -hm updated to reflect last Telekom changes as of 1.1.99 -# -#--------------------------------------------------------------------------- -# -# reference: http://www.telekom.de/untern/tarife/inland/index.htm -# -#--------------------------------------------------------------------------- -# -# Syntax: -# ------- -# rate-code: ra0 = City, ra1 = Deutschland -# Day-No: 0-6, where 0 = Sunday, 1 = Monday, etc. -# Rate: start_hour.minutes-end_hour.minutes:period in seconds -# -#------------------------------------------------------------------------------ -# -#=================== T-ISDN City ============================================================= -# -#rate-code Day rate1 rate2 rate3 rate4 rate5 -#--------- --- --------------- --------------- --------------- --------------- --------------- -ra0 0 00.00-05.00:240 05.00-21.00:150 21.00-24.00:240 -ra0 1 00.00-05.00:240 05.00-09.00:150 09.00-18.00:90 18.00-21.00:150 21.00-24.00:240 -ra0 2 00.00-05.00:240 05.00-09.00:150 09.00-18.00:90 18.00-21.00:150 21.00-24.00:240 -ra0 3 00.00-05.00:240 05.00-09.00:150 09.00-18.00:90 18.00-21.00:150 21.00-24.00:240 -ra0 4 00.00-05.00:240 05.00-09.00:150 09.00-18.00:90 18.00-21.00:150 21.00-24.00:240 -ra0 5 00.00-05.00:240 05.00-09.00:150 09.00-18.00:90 18.00-21.00:150 21.00-24.00:240 -ra0 6 00.00-05.00:240 05.00-21.00:150 21.00-24.00:240 -# -#=================== T-ISDN Deutschland ====================================================== -# -#rate-code Day rate1 rate2 rate3 rate4 rate5 -#--------- --- --------------- --------------- --------------- --------------- --------------- -ra1 0 00.00-24.00:60 -ra1 1 00.00-02.00:60 02.00-05.00:120 05.00-09.00:60 09.00-18.00:30 18.00-24.00:60 -ra1 2 00.00-02.00:60 02.00-05.00:120 05.00-09.00:60 09.00-18.00:30 18.00-24.00:60 -ra1 3 00.00-02.00:60 02.00-05.00:120 05.00-09.00:60 09.00-18.00:30 18.00-24.00:60 -ra1 4 00.00-02.00:60 02.00-05.00:120 05.00-09.00:60 09.00-18.00:30 18.00-24.00:60 -ra1 5 00.00-02.00:60 02.00-05.00:120 05.00-09.00:60 09.00-18.00:30 18.00-24.00:60 -ra1 6 00.00-24.00:60 -# -#================== EOF ====================================================================== diff --git a/etc/isdn/isdnd.rates.F b/etc/isdn/isdnd.rates.F deleted file mode 100644 index 6a73b75f2c42..000000000000 --- a/etc/isdn/isdnd.rates.F +++ /dev/null @@ -1,152 +0,0 @@ -#--------------------------------------------------------------------------- -# -# i4b - Tarifs France Telecom -# --------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Thu Mar 19 20:05:18 1998] -# -# -hm got from Aurelien Bargy -# -#--------------------------------------------------------------------------- -# -# a jour au 1.10.97 -# Aurelien Bargy - 18.03.97 -# -# I wrote a rates file for France. It is rather approximative -# because some time ago France Telecom decided to abandon the charging -# units system. The problem is, on ISDN lines charging units are still -# used for the aocd system, even as it gives a completely false price -# for a communication, so "abandoning" the msg_charging_unit system for -# French users of i4b is not a good idea :)) -# -#--------------------------------------------------------------------------- -# -# Syntax: -# ------- -# rate-code: ra0 = local ; ra1 = zone 1 ; ra2 = zone 2... -# plus quelques tarifs internationaux -# Day-No: 0-6, where 0 = Sunday, 1 = Monday, etc. -# Rate: start_hour.minutes-end_hour.minutes:period in seconds -# -#------------------------------------------------------------------------ -# -#========================== Communications locales ====================== -#rate-code Day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra0 0 00.00-24.00:317 -ra0 1 00.00-08.00:317 08.00-19.00:158 19.00-24.00:317 -ra0 2 00.00-08.00:317 08.00-19.00:158 19.00-24.00:317 -ra0 3 00.00-08.00:317 08.00-19.00:158 19.00-24.00:317 -ra0 4 00.00-08.00:317 08.00-19.00:158 19.00-24.00:317 -ra0 5 00.00-08.00:317 08.00-19.00:158 19.00-24.00:317 -ra0 6 00.00-08.00:317 08.00-12.00:158 12.00-24.00:317 -# -# -# -#================== Zone 1 : < 25 km ================================== -# -#rate-code Day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra1 0 00.00-24.00:222 -ra1 1 00.00-08.00:222 08.00-19.00:111 19.00-24.00:222 -ra1 2 00.00-08.00:222 08.00-19.00:111 19.00-24.00:222 -ra1 3 00.00-08.00:222 08.00-19.00:111 19.00-24.00:222 -ra1 4 00.00-08.00:222 08.00-19.00:111 19.00-24.00:222 -ra1 5 00.00-08.00:222 08.00-19.00:111 19.00-24.00:222 -ra1 6 00.00-08.00:222 08.00-12.00:111 12.00-24.00:222 -# -# -# -#================== Zone 2 : 25-30 km ================================= -# -#rate-code Day rate1 rate2 rate3 -#--------- --- --------------- --------------- -------------- -ra2 0 00.00-24.00:148 -ra2 1 00.00-08.00:148 08.00-19.00:74 19.00-24.00:148 -ra2 2 00.00-08.00:148 08.00-19.00:74 19.00-24.00:148 -ra2 3 00.00-08.00:148 08.00-19.00:74 19.00-24.00:148 -ra2 4 00.00-08.00:148 08.00-19.00:74 19.00-24.00:148 -ra2 5 00.00-08.00:148 08.00-19.00:74 19.00-24.00:148 -ra2 6 00.00-08.00:148 08.00-12.00:74 12.00-24.00:148 -# -#=================== Zone 3 : 30-52 km ================================ -# -#rate-code day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra3 0 00.00-24.00:94 -ra3 1 00.00-08.00:94 08.00-19.00:47 19.00-24.00:94 -ra3 2 00.00-08.00:94 08.00-19.00:47 19.00-24.00:94 -ra3 3 00.00-08.00:94 08.00-19.00:47 19.00-24.00:94 -ra3 4 00.00-08.00:94 08.00-19.00:47 19.00-24.00:94 -ra3 5 00.00-08.00:94 08.00-19.00:47 19.00-24.00:94 -ra3 6 00.00-08.00:94 08.00-12.00:47 12.00-24.00:94 -# -# -#=================== Zone 4 : > 52 km ================================= -# -#rate-code day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra4 0 00.00-24.00:78 -ra4 1 00.00-08.00:78 08.00-19.00:39 19.00-24.00:78 -ra4 2 00.00-08.00:78 08.00-19.00:39 19.00-24.00:78 -ra4 3 00.00-08.00:78 08.00-19.00:39 19.00-24.00:78 -ra4 4 00.00-08.00:78 08.00-19.00:39 19.00-24.00:78 -ra4 5 00.00-08.00:78 08.00-19.00:39 19.00-24.00:78 -ra4 6 00.00-08.00:78 08.00-12.00:39 12.00-24.00:78 -# -# -#=================== INTERNATIONAL : Allemagne ======================== -# (pour appeler Hellmuth) -# -#rate-code day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra5 0 00.00-24.00:27 -ra5 1 00.00-08.00:27 08.00-19.00:21 19.00-24.00:27 -ra5 2 00.00-08.00:27 08.00-19.00:21 19.00-24.00:27 -ra5 3 00.00-08.00:27 08.00-19.00:21 19.00-24.00:27 -ra5 4 00.00-08.00:27 08.00-19.00:21 19.00-24.00:27 -ra5 5 00.00-08.00:27 08.00-19.00:21 19.00-24.00:27 -ra5 6 00.00-08.00:27 08.00-12.00:21 12.00-24.00:27 -# -# -#=================== INTERNATIONAL : Pays-Bas ========================== -# -#rate-code day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra6 0 00.00-24.00:25 -ra6 1 00.00-08.00:25 08.00-19.00:20 19.00-24.00:25 -ra6 2 00.00-08.00:25 08.00-19.00:20 19.00-24.00:25 -ra6 3 00.00-08.00:25 08.00-19.00:20 19.00-24.00:25 -ra6 4 00.00-08.00:25 08.00-19.00:20 19.00-24.00:25 -ra6 5 00.00-08.00:25 08.00-19.00:20 19.00-24.00:25 -ra6 6 00.00-08.00:25 08.00-12.00:20 12.00-24.00:25 -# -# -#=================== INTERNATIONAL : Portugal =========================== -# -#rate-code day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra7 0 00.00-24.00:22 -ra7 1 00.00-08.00:22 08.00-19.00:18 19.00-24.00:22 -ra7 2 00.00-08.00:22 08.00-19.00:18 19.00-24.00:22 -ra7 3 00.00-08.00:22 08.00-19.00:18 19.00-24.00:22 -ra7 4 00.00-08.00:22 08.00-19.00:18 19.00-24.00:22 -ra7 5 00.00-08.00:22 08.00-19.00:18 19.00-24.00:22 -ra7 6 00.00-08.00:22 08.00-12.00:18 12.00-24.00:22 -# -# -#=================== INTERNATIONAL : USA/Canada ======================== -# -#rate-code day rate1 rate2 rate3 -#--------- --- --------------- --------------- --------------- -ra8 0 00.00-24.00:25 -ra8 1 00.00-13.00:25 13.00-19.00:20 19.00-24.00:25 -ra8 2 00.00-13.00:25 13.00-19.00:20 19.00-24.00:25 -ra8 3 00.00-13.00:25 13.00-19.00:20 19.00-24.00:25 -ra8 4 00.00-13.00:25 13.00-19.00:20 19.00-24.00:25 -ra8 5 00.00-13.00:25 13.00-19.00:20 19.00-24.00:25 -ra8 6 00.00-24.00:25 -# -#================== EOF ============================================== diff --git a/etc/isdn/isdnd.rates.L b/etc/isdn/isdnd.rates.L deleted file mode 100644 index d3992b052d38..000000000000 --- a/etc/isdn/isdnd.rates.L +++ /dev/null @@ -1,45 +0,0 @@ -#--------------------------------------------------------------------------- -# -# i4b - Luxembourg PT charging rates config file -# ------------------------------------------------- -# -# $Id: isdnd.rates.L,v 1.2 1999/12/13 21:25:24 hm Exp $ -# -# $FreeBSD$ -# -# last edit-date: [Mon Dec 13 21:42:33 1999] -# -# Sent in by Joakim Hernberg, Digital Design Luxembourg sarl, jbh@ddl.lu -# -#--------------------------------------------------------------------------- -# -# reference: http://www.pt.lu -# -#--------------------------------------------------------------------------- -# -# Syntax: -# ------- -# rate-code: ra0 = Luxembourg normal isdn call -# rate-code: ra1 = Luxembourg PT Internet access -# Day-No: 0-6, where 0 = Sunday, 1 = Monday, etc. -# Rate: start_hour.minutes-end_hour.minutes:period in seconds -# -#------------------------------------------------------------------------------ -# -#rate-code Day rate1 rate2 rate3 rate4 rate5 -#--------- --- --------------- --------------- --------------- --------------- ---------------- -ra0 0 00.00-24.00:960 -ra0 1 00.00-06.00:960 06.00-08.00:480 08.00-19.00:240 19.00-23.00:480 23.00-24.00:960 -ra0 2 00.00-06.00:960 06.00-08.00:480 08.00-19.00:240 19.00-23.00:480 23.00-24.00:960 -ra0 3 00.00-06.00:960 06.00-08.00:480 08.00-19.00:240 19.00-23.00:480 23.00-24.00:960 -ra0 4 00.00-06.00:960 06.00-08.00:480 08.00-19.00:240 19.00-23.00:480 23.00-24.00:960 -ra0 5 00.00-06.00:960 06.00-08.00:480 08.00-19.00:240 19.00-23.00:480 23.00-24.00:960 -ra0 6 00.00-06.00:960 06.00-23.00:480 23.00-24.00:960 - -ra1 0 00.00-24.00:60 -ra1 1 00.00-24.00:60 -ra1 2 00.00-24.00:60 -ra1 3 00.00-24.00:60 -ra1 4 00.00-24.00:60 -ra1 5 00.00-24.00:60 -ra1 6 00.00-24.00:60 diff --git a/etc/isdn/isdnd.rates.UK.BT b/etc/isdn/isdnd.rates.UK.BT deleted file mode 100644 index c4d34ec3a6d6..000000000000 --- a/etc/isdn/isdnd.rates.UK.BT +++ /dev/null @@ -1,61 +0,0 @@ -#--------------------------------------------------------------------------- -# -# i4b - BT charges -# ------------------------------------------------- -# -# $FreeBSD$ -# -# Barry A. Scott barry@scottb.demon.co.uk -# -#--------------------------------------------------------------------------- -# -# reference: http://www.bt.com/Business/price_frm.htm -# (I use the bussiness figures as the Ex VAT gives more -# accurate rate data because BT round the Inc VAT figures) -# -#--------------------------------------------------------------------------- -# -# Syntax: -# ------- -# rate-code: ra0 = Local, ra1 = Regional, ra2 = National -# Day-No: 0-6, where 0 = Sunday, 1 = Monday, etc. -# Rate: start_hour.minutes-end_hour.minutes:period in seconds -# -#------------------------------------------------------------------------------ -# -#=================== Local ========================================================================= -# -#rate-code Day rate1 rate2 rate1 -#--------- --- --------------- --------------- --------------- -ra0 0 00.00-24.00:296 -ra0 1 00.00-08.00:200 08.00-18.00:75 18.00-00.00:200 -ra0 2 00.00-08.00:200 08.00-18.00:75 18.00-00.00:200 -ra0 3 00.00-08.00:200 08.00-18.00:75 18.00-00.00:200 -ra0 4 00.00-08.00:200 08.00-18.00:75 18.00-00.00:200 -ra0 5 00.00-08.00:200 08.00-18.00:75 18.00-00.00:200 -ra0 6 00.00-24.00:296 -# -#=================== Regional ========================================================================= -# -#rate-code Day rate1 rate2 rate1 -#--------- --- --------------- --------------- --------------- -ra1 0 00.00-24.00:100 -ra1 1 00.00-08.00:75 08.00-18.00:37 18.00-00.00:75 -ra1 2 00.00-08.00:75 08.00-18.00:37 18.00-00.00:75 -ra1 3 00.00-08.00:75 08.00-18.00:37 18.00-00.00:75 -ra1 4 00.00-08.00:75 08.00-18.00:37 18.00-00.00:75 -ra1 5 00.00-08.00:75 08.00-18.00:37 18.00-00.00:75 -ra1 6 00.00-24.00:100 -# -#=================== National ========================================================================= -# -#rate-code Day rate1 rate2 rate1 -#--------- --- --------------- --------------- --------------- -ra2 0 00.00-24.00:100 -ra2 1 00.00-08.00:71 08.00-18.00:37 18.00-00.00:71 -ra2 2 00.00-08.00:71 08.00-18.00:37 18.00-00.00:71 -ra2 3 00.00-08.00:71 08.00-18.00:37 18.00-00.00:71 -ra2 4 00.00-08.00:71 08.00-18.00:37 18.00-00.00:71 -ra2 5 00.00-08.00:71 08.00-18.00:37 18.00-00.00:71 -ra2 6 00.00-24.00:100 -#================== EOF ============================================================================================================ diff --git a/etc/isdn/isdnd.rc.sample b/etc/isdn/isdnd.rc.sample deleted file mode 100644 index 3878e7c80f06..000000000000 --- a/etc/isdn/isdnd.rc.sample +++ /dev/null @@ -1,409 +0,0 @@ -#------------------------------------------------------------------------------ -# -# example of a configuration file for the isdn daemon -# --------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Sun May 27 09:33:59 2001] -# -# NOTICE: -# ======= -# This configuration file is an EXAMPLE only and MUST be edited -# carefully to get the desired results! -# -# Please read the "isdnd.rc" manual page (execute "man isdnd.rc") -# for reference ! -# -#------------------------------------------------------------------------------ - -#============================================================================== -# SYSTEM section: isdnd global configuration parameters -#============================================================================== -system - -# accounting -# ---------- - -acctall = on # generate info for everything -acctfile = /var/log/isdnd.acct # name & location of accounting file -useacctfile = yes # generate accouting info to file - -# monitor -# ------- - -monitor-allowed = no # global switch: monitor on/off -monitor-port = 451 # default monitor TCP port - -# Monitor rights are granted due to the most specific host/net spec, i.e. in -# the example below host 192.168.1.2 will have the rights specified on that -# line, even so it belongs to net 192.168.1.0/24 as well. -# -# A monitor specification may either be: -# -# - the name of a local (UNIX-domain) socket; this MUST start with a "/" -monitor = "/var/run/isdn-monitor" -monitor-access = fullcmd -monitor-access = channelstate, logevents -monitor-access = callin, callout -# -# - a dotted-quad host spec -monitor = "192.168.1.2" -monitor-access = restrictedcmd, channelstate, callin, callout -# -# - a dotted-quad net spec with "/len" (CIDR-style) netmask spec -monitor = "192.168.1.0/24" -monitor-access = restrictedcmd, channelstate, callin, callout -# -# - a resolveable host name -monitor = "rumolt" -monitor-access = restrictedcmd, channelstate, callin, callout -# -# - a resolveable net name with "/len" netmask (s.a.) appended -monitor = "up-vision-net/24" -monitor-access = restrictedcmd, channelstate, callin, callout - -# ratesfile -# --------- - -ratesfile = /etc/isdn/isdnd.rates # name & location of rates file - -# regular expression pattern matching -# ----------------------------------- - -#regexpr = "connected.*XXX" # look for matches in log messages -#regprog = connectXXX # execute program when match is found - -regexpr = " incoming call from" -regprog = unknown_incoming # execute program whan match is found - -# realtime priority section -# ------------------------- - -rtprio = 25 # modify isdnd's process priority - -#=========================================================================== -# controller section -#=========================================================================== -controller - -firmware = /etc/isdn/b1.t4 # microcode for an AVM B1 controller - -#============================================================================== -# entry section: IP over ISDN example - i call back the remote end -#============================================================================== -entry - -name = I4BIP # name for reference. This name will - # be used in the logfile to identfy - # this entry. - - # the network or telephone device - # the data traffic should be routed to: -usrdevicename = ipr # ipr, isp, tel, rbch -usrdeviceunit = 0 # unit number - - # the ISDN controller number to be - # used for this entry: -isdncontroller = 0 # controller to use or -1 to use any -isdnchannel = -1 # channel (1/2) to use or 0 or -1 for any - - # incoming only, outgoing only or both: -direction = inout # in, out, inout - - # numbers used to verify a DIAL IN: -local-phone-incoming = 321 # this is my number -remote-phone-incoming = 0123456789 # this one can call in - - # numbers used at DIAL OUT time: -local-phone-dialout = 321 # this is my number -remote-phone-dialout = 00123456789 # i call this remote number - - # in case i have several remote - # telephone numbers specified, this - # is used to specify which one is - # used next on dial fail or retry: -remdial-handling = first # first, last or next - - # what happenes if someone dials in: -dialin-reaction = callback # accept, reject, ignore, answer, callback - - # normal dialout or do i call back: -dialout-type = normal # normal / calledback - -callbackwait = 1 # no of secs to wait before calling back - - # type of protocol on the B-channel: - # hdlc must be specified for IP (the - # ipr and isp drivers), raw must be - # specified for telephone answering -b1protocol = hdlc # hdlc, raw - - # shorthold mode and idle time - # configuration: -ratetype = 0 # ratesfile entry to use -unitlength = 90 # unitlength to assume -unitlengthsrc = rate # none, rate, cmdl, conf, aocd -idletime-incoming = 120 # incoming call idle timeout -idletime-outgoing = 60 # outgoing call idle timeout -earlyhangup = 5 # time to hangup before an expected - # next charging unit will occur - - # retry and recovery parameters -dialretries = 3 # # of dial retries -dialrandincr = off # random dial increment time -recoverytime = 5 # time to wait between 2 dial tries -usedown = off # set i/f down -downtries = 5 # retry cycles before set down -downtime = 30 # time to be in down before going up - -#connectprog = "ip-up" # run /etc/isdn/ip-up when an interface - # has established its network connection. - # example parameters are: - # /etc/isdn/ip-up -d isp0 -f up -a 192.110.12.14 -#disconnectprog = "ip-down" # like connectprog, but run after the connection - # is closed (ISDN layer down). The actual - # interface address might not be known - # any more. example parameters are: - # /etc/isdn/ip-up -d isp0 -f down -a 0.0.0.0 - -#============================================================================== -# entry section: IP over ISDN example - i am called back by the remote end -#============================================================================== -entry - -name = I4BIP1 # name for reference - -usrdevicename = ipr # ipr, tel, rbch -usrdeviceunit = 1 # unit number - -isdncontroller = 0 # controller to use or -1 to use any -isdnchannel = -1 # channel (1/2) to use or 0 or -1 for any - - # numbers used to DIAL OUT -remote-phone-dialout = 00401234567 # remote number to dial -local-phone-dialout = 38 # our number to tell remote - - # numbers used to verify at DIAL IN -local-phone-incoming = 38 # we take calls for this local number -remote-phone-incoming = 00401234567 # we take calls from this remote machine - -b1protocol = hdlc # hdlc, raw - -ratetype = 0 # city -unitlength = 90 # default unit length -earlyhangup = 5 # safety zone -unitlengthsrc = aocd # none, rate, cmdl, conf, aocd - -dialin-reaction = accept # accept, reject, ignore, anwer, callback - -dialout-type = calledback # normal or calledback - -dialretries = 3 -recoverytime = 3 -calledbackwait = 20 -dialrandincr = off - -usedown = off -downtries = 2 -downtime = 30 - -idletime-incoming = 300 -idletime-outgoing = 30 - -#============================================================================== -# entry section: answering machine example -#============================================================================== -entry - -name = I4BTEL # name for reference -usrdevicename = tel # ipr, tel, rbch -usrdeviceunit = 0 # unit number - -isdncontroller = 0 # controller to use or -1 to use any -isdnchannel = -1 # channel (1/2) to use or 0 or -1 for any - - # numbers used to verify at DIAL IN -local-phone-incoming = 456 # this is my number -remote-phone-incoming = * # anyone can call in - -dialin-reaction = answer # accept, reject, ignore, answer - -answerprog = answer # program to run - -b1protocol = raw # hdlc, raw - -idletime-incoming = 5 # 5 seconds idle timeout - -#============================================================================== -# kernel PPP (with budget handling) - Sunday & Holidays, we call back -#============================================================================== -entry - -valid = "0,7" # sundays & holidays - -name = KPPPs # name for reference - -usrdevicename = isp # ipr, tel, rbch -usrdeviceunit = 0 # unit number - -isdncontroller = 1 # controller to use or -1 to use any -isdnchannel = -1 # channel (1/2) to use or 0 or -1 for any - - # numbers used to verify at DIAL IN -local-phone-incoming = 29 # this is my number -remote-phone-incoming = 00401234567 # this one can call in - - # numbers used to DIAL OUT -local-phone-dialout = 29 # this is my number -remote-phone-dialout = 00401234567 # i call this number - -remdial-handling = first # first, last or next - -dialin-reaction = callback # accept, reject, ignore, answer, callback - -dialout-type = normal # normal / calledback - -b1protocol = hdlc # hdlc, raw - -idletime-incoming = 30 # incoming call idle timeout -idletime-outgoing = 120 # outgoing call idle timeout - -unitlength = 360 # unitlength to assume -unitlengthsrc = conf # none, rate, cmdl, conf, aocd - -dialretries = 5 # # of dial retries -dialrandincr = on # random dial increment time -recoverytime = 3 # time to wait between 2 dial tries - -callbackwait = 5 # time to wait to call back - -usedown = off # set i/f down -downtries = 5 # retry cycles before set down -downtime = 60 # time to be in down before going up - -budget-callbackperiod = 10800 # 3 hours -budget-callbackncalls = 1000 # 2 callbacks in 3 hours -budget-callbacksfile = /var/log/isdn/callbacks.isp0 -budget-callbacksfile-rotate = yes - -budget-calloutperiod = 3600 # 1 hour -budget-calloutncalls = 1000 # 3 calls in 1 hour -budget-calloutsfile = /var/log/isdn/callouts.isp0 -budget-calloutsfile-rotate = yes - -#============================================================================== -# kernel PPP (with budget handling) - Monday-Saturday, 9:00-18:00: we call back -#============================================================================== -entry - -valid = "1,2,3,4,5,6,9:00-18:00" # Monday-Saturday, day - -name = KPPPd # name for reference - -usrdevicename = isp # ipr, tel, rbch -usrdeviceunit = 0 # unit number - -isdncontroller = 1 # controller to use or -1 to use any -isdnchannel = -1 # channel (1/2) to use or 0 or -1 for any - - # numbers used to verify at DIAL IN -local-phone-incoming = 29 # this is my number -remote-phone-incoming = 00401234567 # this one can call in - - # numbers used to DIAL OUT -local-phone-dialout = 29 # this is my number -remote-phone-dialout = 00401234567 # i call this number - -remdial-handling = first # first, last or next - -dialin-reaction = callback # accept, reject, ignore, answer, callback - -dialout-type = normal # normal / calledback - -b1protocol = hdlc # hdlc, raw - -idletime-incoming = 30 # incoming call idle timeout -idletime-outgoing = 30 # outgoing call idle timeout - -unitlength = 60 # unitlength to assume -unitlengthsrc = conf # none, rate, cmdl, conf, aocd - -dialretries = 5 # # of dial retries -dialrandincr = on # random dial increment time -recoverytime = 3 # time to wait between 2 dial tries - -callbackwait = 5 # time to wait to call back - -usedown = off # set i/f down -downtries = 5 # retry cycles before set down -downtime = 60 # time to be in down before going up - -budget-callbackperiod = 10800 # 3 hours -budget-callbackncalls = 1 # 1 callbacks in 3 hours -budget-callbacksfile = /var/log/isdn/callbacks.isp0 -budget-callbacksfile-rotate = yes - -budget-calloutperiod = 3600 # 1 hour -budget-calloutncalls = 3 # 3 calls in 1 hour -budget-calloutsfile = /var/log/isdn/callouts.isp0 -budget-calloutsfile-rotate = yes - -#============================================================================== -# kernel PPP (with budget handling) - Monday-Saturday: we call back -#============================================================================== -entry - -valid = "1,2,3,4,5,6,18:00-9:00" # Monday-Saturday, night - -name = KPPPn # name for reference - -usrdevicename = isp # ipr, tel, rbch -usrdeviceunit = 0 # unit number - -isdncontroller = 1 # controller to use or -1 to use any -isdnchannel = -1 # channel (1/2) to use or 0 or -1 for any - - # numbers used to verify at DIAL IN -local-phone-incoming = 29 # this is my number -remote-phone-incoming = 00401234567 # this one can call in - - # numbers used to DIAL OUT -local-phone-dialout = 29 # this is my number -remote-phone-dialout = 00401234567 # i call this number - -remdial-handling = first # first, last or next - -dialin-reaction = callback # accept, reject, ignore, answer, callback - -dialout-type = normal # normal / calledback - -b1protocol = hdlc # hdlc, raw - -idletime-incoming = 30 # incoming call idle timeout -idletime-outgoing = 30 # outgoing call idle timeout - -unitlength = 60 # unitlength to assume -unitlengthsrc = conf # none, rate, cmdl, conf, aocd - -dialretries = 5 # # of dial retries -dialrandincr = on # random dial increment time -recoverytime = 3 # time to wait between 2 dial tries - -callbackwait = 5 # time to wait to call back - -usedown = off # set i/f down -downtries = 5 # retry cycles before set down -downtime = 60 # time to be in down before going up - -budget-callbackperiod = 7200 # 2 hours -budget-callbackncalls = 2 # 2 callbacks in 2 hours -budget-callbacksfile = /var/log/isdn/callbacks.isp0 -budget-callbacksfile-rotate = yes - -budget-calloutperiod = 3600 # 1 hour -budget-calloutncalls = 3 # 3 calls in 1 hour -budget-calloutsfile = /var/log/isdn/callouts.isp0 -budget-calloutsfile-rotate = yes - -# EOF ######################################################################### diff --git a/etc/isdn/isdntel.alias.sample b/etc/isdn/isdntel.alias.sample deleted file mode 100644 index c06bc1942a08..000000000000 --- a/etc/isdn/isdntel.alias.sample +++ /dev/null @@ -1,21 +0,0 @@ -#--------------------------------------------------------------------------- -# -# alias file for the isdntel(1) application -# ----------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Fri Dec 18 18:06:03 1998] -# -# -hm cleanup for release -# -# -# the format is simple: the number beginning in column one followed -# by one or more spaces or tabs. The rest of the line is taken as -# and alias string for the number. Comment lines start with a "#". -# -#--------------------------------------------------------------------------- -123 alias for 123 -456 alias for 456 -789 alias for 789 - diff --git a/etc/isdn/isdntel.sh b/etc/isdn/isdntel.sh deleted file mode 100755 index 14f528a80927..000000000000 --- a/etc/isdn/isdntel.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------------------- -# -# isdn telephone answering -# ------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Thu May 20 11:45:04 1999] -# -#--------------------------------------------------------------------------- -#FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS -#LIBDIR=/usr/local/lib/isdn -#FreeBSD 3.1 and up -LIBDIR=/usr/share/isdn - -VARDIR=/var/isdn -DEVICE=/dev/i4btel0 - -# sounds -MESSAGE=${LIBDIR}/msg.al -BEEP=${LIBDIR}/beep.al - -# dd options -SKIP=25 - -# max message size -MAXMSIZ=100 - -# src and dst telephone numbers -src= -dst= - -# current date -DATE=`date` - -# check if directory exists -if [ ! -d "${VARDIR}" ] -then - mkdir ${VARDIR} -fi - -# get options -if ! set -- `/usr/bin/getopt D:d:s: $*`; then - echo "usage2: play -D device -d -s " - exit 1 -fi - -# process options -for i ; do - case $i in - -D) - DEVICE=$2; shift; shift; - ;; - -d) - dst=$2; shift; shift; - ;; - -s) - src=$2; shift; shift; - ;; - --) - shift; break; - ;; - esac -done - -# this is a __MUST__ in order to use the fullscreen inteface !!! - -FILEDATE=`date \+%y%m%d%H%M%S` - -# echo message to phone -if [ -r "${MESSAGE}" ]; then - /bin/dd of=${DEVICE} if=${MESSAGE} bs=2k >/dev/null 2>&1 -fi - -# echo beep to phone -if [ -r "${BEEP}" ]; then - /bin/dd of=${DEVICE} if=${BEEP} bs=2k >/dev/null 2>&1 -fi - -# start time -START=`date \+%s` - -# get message from caller -/bin/dd if=${DEVICE} of=${VARDIR}/${FILEDATE}-${dst}-${src} skip=${SKIP} bs=2k count=${MAXMSIZ} >/dev/null 2>&1 - -# end time -END=`date \+%s` - -# duration -TIME=`expr ${END} - ${START}` - -# save recorded message -if [ -r "${VARDIR}/${FILEDATE}-${dst}-${src}" ]; then - mv ${VARDIR}/${FILEDATE}-${dst}-${src} ${VARDIR}/${FILEDATE}-${dst}-${src}-${TIME} -fi - -exit 0 diff --git a/etc/isdn/record b/etc/isdn/record deleted file mode 100755 index 61591fbfe6e6..000000000000 --- a/etc/isdn/record +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------------------- -# -# answer and record message script for i4b isdnd -# ---------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Thu May 20 11:45:10 1999] -# -#--------------------------------------------------------------------------- -VARDIR=/var/isdn - -#FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS -#LIBDIR=/usr/local/lib/isdn -#FreeBSD 3.1 and up -LIBDIR=/usr/share/isdn - -LOGFILE=/tmp/answer.log -NCALLFILE=${VARDIR}/ncall -DATE=`date +%d%H` -DF=0 -dF=0 -sF=0 - -if ! set -- `getopt D:d:s: $*`; then - echo 'Usage: answer -D device -d destination -s source' - exit 1 -fi - -for i ; do - case ${i} in - -D) - DEVICE=$2 - DF=1 - shift - shift - ;; - -d) - DEST=$2 - dF=1 - shift - shift - ;; - -s) - SRC=$2 - sF=1 - shift - shift - ;; - --) - shift - break - ;; - esac -done - -echo "" >>${LOGFILE} - -if [ "${DF}" -eq 0 -o "${dF}" -eq 0 -o "${sF}" -eq 0 ]; then - echo 'Usage: answer -D device -d destination -s source' - exit 1 -fi - -echo "answer: device ${DEVICE} destination ${DEST} source ${SRC} " >>${LOGFILE} - -if [ -r "${NCALLFILE}" ]; then - NCALL=`cat ${NCALLFILE}` -else - NCALL=0 -fi - -NCALL=`printf "%.4d" ${NCALL}` - -echo Date: `date` >> ${VARDIR}/I.${NCALL}.${DATE} - -if [ -n "${SRC}" ]; then - echo "From: ${SRC}" >> ${VARDIR}/I.${NCALL}.${DATE} -fi - -if [ -n "${DEST}" ]; then - echo "To: ${DEST}" >> ${VARDIR}/I.${NCALL}.${DATE} -fi - -if [ -r "${LIBDIR}/beep.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1 -fi - -if [ -r "${LIBDIR}/msg.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/msg.al bs=2k >/dev/null 2>&1 -fi - -if [ -r "${LIBDIR}/beep.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1 -fi - -dd if=${DEVICE} of=${VARDIR}/R.${NCALL}.${DATE} bs=2k >/dev/null 2>&1 - -echo `expr $NCALL + 1` >$NCALLFILE diff --git a/etc/isdn/tell b/etc/isdn/tell deleted file mode 100755 index 047c834b51f6..000000000000 --- a/etc/isdn/tell +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------------------- -# -# tell called and calling numbers answer script for i4b isdnd -# ----------------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Thu May 20 11:45:15 1999] -# -#--------------------------------------------------------------------------- -VARDIR=/var/isdn - -#FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS -#LIBDIR=/usr/local/lib/isdn -#FreeBSD 3.1 and up -LIBDIR=/usr/share/isdn - -LOGFILE=/tmp/answer.log -NCALLFILE=${VARDIR}/ncall -DATE=`date +%d%H` -DF=0 -dF=0 -sF=0 - -if ! set -- `getopt D:d:s: $*`; then - echo 'Usage: answer -D device -d destination -s source' - exit 1 -fi - -for i ; do - case ${i} in - -D) - DEVICE=$2 - DF=1 - shift - shift - ;; - -d) - DEST=$2 - dF=1 - shift - shift - ;; - -s) - SRC=$2 - sF=1 - shift - shift - ;; - --) - shift - break - ;; - esac -done - -echo "" >>${LOGFILE} - -if [ "${DF}" -eq 0 -o "${dF}" -eq 0 -o "${sF}" -eq 0 ]; then - echo 'Usage: answer -D device -d destination -s source' - exit 1 -fi - -echo "answer: device ${DEVICE} destination ${DEST} source ${SRC} " >>${LOGFILE} - -if [ -r "${LIBDIR}/beep.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1 -fi - -# tell the caller the number he is calling from - -POS=1 -LENGTH=`expr ${SRC} : '.*'` - -while : ; do - DIGIT=`echo ${SRC} | cut -c ${POS}` - /bin/dd of=${DEVICE} if=${LIBDIR}/${DIGIT}.al bs=2k >/dev/null 2>&1 - POS=`expr ${POS} + 1` - if [ "${POS}" -gt "${LENGTH}" ]; then - break - fi -done - -if [ -r "${LIBDIR}/beep.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1 -fi diff --git a/etc/isdn/tell-record b/etc/isdn/tell-record deleted file mode 100755 index ae4c8176de1a..000000000000 --- a/etc/isdn/tell-record +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------------------- -# -# tell called and calling numbers answer script for i4b isdnd -# ----------------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Tue Oct 31 10:59:49 2000] -# -#--------------------------------------------------------------------------- -VARDIR=/var/isdn - -#FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS -#LIBDIR=/usr/local/lib/isdn -#FreeBSD 3.1 and up -LIBDIR=/usr/share/isdn - -LOGFILE=/tmp/answer.log -NCALLFILE=${VARDIR}/ncall -DATE=`date +%d%H` -DF=0 -dF=0 -sF=0 - -if ! set -- `getopt D:d:s: $*`; then - echo 'Usage: answer -D device -d destination -s source' - exit 1 -fi - -for i ; do - case ${i} in - -D) - DEVICE=$2 - DF=1 - shift - shift - ;; - -d) - DEST=$2 - dF=1 - shift - shift - ;; - -s) - SRC=$2 - sF=1 - shift - shift - ;; - --) - shift - break - ;; - esac -done - -echo "" >>${LOGFILE} - -if [ "${DF}" -eq 0 -o "${dF}" -eq 0 -o "${sF}" -eq 0 ]; then - echo 'Usage: answer -D device -d destination -s source' - exit 1 -fi - -echo "answer: device ${DEVICE} destination ${DEST} source ${SRC} " >>${LOGFILE} - -if [ -r "${LIBDIR}/beep.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1 -fi - -# tell the caller the number he is calling from - -POS=1 -LENGTH=`expr ${SRC} : '.*'` - -while : ; do - DIGIT=`echo ${SRC} | cut -c ${POS}` - /bin/dd of=${DEVICE} if=${LIBDIR}/${DIGIT}.al bs=2k >/dev/null 2>&1 - POS=`expr ${POS} + 1` - if [ "${POS}" -gt "${LENGTH}" ]; then - break - fi -done - -if [ -r "${LIBDIR}/beep.al" ]; then - dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1 -fi - -dd if=${DEVICE} of=${VARDIR}/recorded.msg bs=2k >/dev/null 2>&1 diff --git a/etc/isdn/unknown_incoming b/etc/isdn/unknown_incoming deleted file mode 100755 index 5debe21fe0e0..000000000000 --- a/etc/isdn/unknown_incoming +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------------------- -# -# unknown_incoming - script for isdnd -# ----------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Wed Jan 10 13:40:36 2001] -# -# This script may be configured to be called by isdnd when an -# unknown incoming call is received. In case the destination -# telephone number is available, it sends mail with the time, -# source and destination numbers to a configurable address. -# -# For this to work, and entry like this: -# -# regexpr = " incoming call from" -# regprog = unknown_incoming -# -# is needed in the system section of /etc/isdn/isdnd.rc. -# -# This script has to be configured to the sites needs, look -# for the comment lines start with "configure:" -# -#--------------------------------------------------------------------------- -# -# configure: who shall receive the mail -mailaddr=root -# -from=`echo $* | awk '{print $6}'` -to=`echo $* | awk '{print $8}'` -test=`echo $* | awk '{print $9}'` -ctrl=`echo $* | awk '{print $10}'` -date=`date "+%b %d"` -time=`date "+%H:%M"` -mach=`hostname` - -# configure: list of destination numbers to ignore -case "$from" in - "NotAvailable" ) exit 0 ;; - "00401234567"* ) exit 0 ;; - "00407654321" ) exit 0 ;; -esac - -# configure: how to name the line on which this was received -if [ $test = "ctrl" ] -then - case "$ctrl" in - "1") - line="PBX 1" - ;; - "2") - line="PBX 2" - ;; - *) - line="controller is $ctrl" - ;; - esac -else - line="test is $test, controller is $ctrl" -fi - -cat << ENDOFDATA | mail -s "isdnd: unknown incoming telephone call" $mailaddr - -Unknown incoming telephone call recognized: - - Date: $date - Time: $time - Line: $line - From: $from - To: $to - - Sincerly yours, - the isdnd on $mach - -ENDOFDATA - -exit 0 diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index bfc598bb592a..dfc53b723785 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -189,8 +189,6 @@ .. gssapi .. - i4b - .. isofs cd9660 .. diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index 2fac37786c69..2bbd28c862fd 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -32,8 +32,6 @@ .. gss .. - isdn mode=0700 - .. mail .. mtree diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index f047d657af00..df3777bae8e0 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -221,14 +221,6 @@ .. iscsi .. - isdn - contrib - .. - i4brunppp - .. - v21 - .. - .. kld cdev module @@ -344,8 +336,6 @@ .. info .. - isdn - .. locale UTF-8 .. diff --git a/etc/netstart b/etc/netstart index 9dfd03912aff..b96466342a6b 100755 --- a/etc/netstart +++ b/etc/netstart @@ -52,7 +52,6 @@ _start=quietstart /etc/rc.d/netif ${_start} /etc/rc.d/ipsec ${_start} /etc/rc.d/dhclient ${_start} -/etc/rc.d/isdnd ${_start} /etc/rc.d/ppp ${_start} /etc/rc.d/ipfw ${_start} /etc/rc.d/ip6fw ${_start} diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile index bfb1bfcc20eb..7be483d2f871 100755 --- a/etc/rc.d/Makefile +++ b/etc/rc.d/Makefile @@ -16,7 +16,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \ hostapd hostid hostname \ idmapd inetd initrandom \ ip6addrctl ip6fw ipfilter ipfs ipfw ipmon \ - ipnat ipsec ipxrouted isdnd \ + ipnat ipsec ipxrouted \ jail \ kadmind kerberos kernel keyserv kldxref kpasswdd \ ldconfig local localpkg lockd lpd \ diff --git a/etc/rc.d/NETWORKING b/etc/rc.d/NETWORKING index 21b584b33240..f290d3bb05b6 100644 --- a/etc/rc.d/NETWORKING +++ b/etc/rc.d/NETWORKING @@ -4,7 +4,7 @@ # # PROVIDE: NETWORKING NETWORK -# REQUIRE: netif netoptions routing network_ipv6 isdnd ppp +# REQUIRE: netif netoptions routing network_ipv6 ppp # REQUIRE: routed mrouted route6d mroute6d resolv # This is a dummy dependency, for services which require networking diff --git a/etc/rc.d/isdnd b/etc/rc.d/isdnd deleted file mode 100644 index ab38764f2ed8..000000000000 --- a/etc/rc.d/isdnd +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# -# $FreeBSD$ -# -# Mostly based on original script (/etc/rc.isdn) written by Hellmuth Michaelis -# - -# PROVIDE: isdnd -# REQUIRE: netif FILESYSTEMS cleanvar -# KEYWORD: nojail - -. /etc/rc.subr - -name="isdnd" -rcvar=`set_rcvar isdn` -pidfile="/var/run/${name}.pid" -command="/usr/sbin/isdnd" -start_cmd="isdnd_start" - -isdnd_start() -{ - echo -n 'ISDN subsystem setup:' - - # Start isdnd - # - echo -n ' isdnd' - case ${isdn_fsdev} in - [Nn][Oo] | '') - /usr/sbin/isdnd ${isdn_flags} - ;; - *) - # Change vidmode of ${isdn_fsdev} - # - case ${isdn_screenflags} in - [Nn][Oo]) - ;; - *) - /usr/sbin/vidcontrol < ${isdn_fsdev} > ${isdn_fsdev} 2>&1 ${isdn_screenflags} - ;; - esac - - /usr/sbin/isdnd ${isdn_flags} -f -r ${isdn_fsdev} -t ${isdn_ttype} - ;; - esac - - # Start isdntrace - # - if checkyesno isdn_trace; then - echo -n ' isdntrace' - nohup /usr/sbin/isdntrace ${isdn_traceflags} >/dev/null 2>&1 & - fi - echo '.' -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/ppp b/etc/rc.d/ppp index 2ab169631972..b3991fe2270a 100644 --- a/etc/rc.d/ppp +++ b/etc/rc.d/ppp @@ -4,7 +4,7 @@ # # PROVIDE: ppp -# REQUIRE: netif isdnd +# REQUIRE: netif # KEYWORD: nojail . /etc/rc.subr diff --git a/include/Makefile b/include/Makefile index 2f28ec85527f..46381db157c5 100644 --- a/include/Makefile +++ b/include/Makefile @@ -26,9 +26,6 @@ INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \ wctype.h wordexp.h -I4BHDRS=i4b_cause.h i4b_debug.h i4b_ioctl.h i4b_rbch_ioctl.h \ - i4b_tel_ioctl.h i4b_trace.h - MHDRS= float.h floatingpoint.h stdarg.h PHDRS= sched.h semaphore.h _semaphore.h @@ -181,13 +178,6 @@ copies: cd ${.CURDIR}/../sys/crypto; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \ ${DESTDIR}${INCLUDEDIR}/crypto -.if ${MACHINE_ARCH} == "i386" -.if ${MK_I4B} != "no" - cd ${.CURDIR}/../sys/i4b/include; \ - ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${I4BHDRS} \ - ${DESTDIR}${INCLUDEDIR}/i4b -.endif -.endif cd ${.CURDIR}/../sys/opencrypto; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${DESTDIR}${INCLUDEDIR}/crypto @@ -269,11 +259,6 @@ symlinks: ln -fs ../../../sys/crypto/$$h \ ${DESTDIR}${INCLUDEDIR}/crypto; \ done - cd ${.CURDIR}/../sys/i4b/include; \ - for h in ${I4BHDRS}; do \ - ln -fs ../../../sys/i4b/include/$$h \ - ${DESTDIR}${INCLUDEDIR}/i4b; \ - done cd ${.CURDIR}/../sys/opencrypto; \ for h in *.h; do \ ln -fs ../../../sys/opencrypto/$$h \ diff --git a/share/Makefile b/share/Makefile index bd3f4396651c..5143ea8f9735 100644 --- a/share/Makefile +++ b/share/Makefile @@ -9,7 +9,6 @@ SUBDIR= ${_colldef} \ ${_dict} \ ${_doc} \ ${_examples} \ - ${_isdn} \ ${_man} \ ${_me} \ misc \ @@ -52,10 +51,6 @@ _me= me _examples= examples .endif -.if ${MK_I4B} != "no" -_isdn= isdn -.endif - .if ${MK_DICT} != "no" _dict= dict .endif diff --git a/share/examples/Makefile b/share/examples/Makefile index 6e1fb706b51b..b5e2ab3ac0a4 100644 --- a/share/examples/Makefile +++ b/share/examples/Makefile @@ -15,7 +15,6 @@ LDIRS= BSD_daemon \ find_interface \ ibcs2 \ ipfw \ - isdn \ kld \ libvgl \ mdoc \ @@ -77,35 +76,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \ ibcs2/README \ ibcs2/hello.uu \ ipfw/change_rules.sh \ - isdn/FAQ \ - isdn/KERNEL \ - isdn/Overview \ - isdn/README \ - isdn/ROADMAP \ - isdn/ReleaseNotes \ - isdn/Resources \ - isdn/SupportedCards \ - isdn/ThankYou \ - isdn/contrib/README \ - isdn/contrib/anleitung.ppp \ - isdn/contrib/answer.c \ - isdn/contrib/answer.sh \ - isdn/contrib/convert.sh \ - isdn/contrib/hplay.c \ - isdn/contrib/i4b-ppp-newbie.txt \ - isdn/contrib/isdnctl \ - isdn/contrib/isdnd_acct \ - isdn/contrib/isdnd_acct.pl \ - isdn/contrib/isdntelmux.c \ - isdn/contrib/mrtg-isp0.sh \ - isdn/i4brunppp/Makefile \ - isdn/i4brunppp/README \ - isdn/i4brunppp/i4brunppp-isdnd.rc \ - isdn/i4brunppp/i4brunppp.8 \ - isdn/i4brunppp/i4brunppp.c \ - isdn/v21/Makefile \ - isdn/v21/README \ - isdn/v21/v21modem.c \ kld/Makefile \ kld/cdev/Makefile \ kld/cdev/README \ @@ -146,9 +116,7 @@ XFILES= BSD_daemon/FreeBSD.pfa \ ppi/Makefile \ ppi/ppilcd.c \ ppp/chap-auth \ - ppp/isdnd.rc \ ppp/login-auth \ - ppp/ppp.conf.isdn \ ppp/ppp.conf.sample \ ppp/ppp.conf.span-isp \ ppp/ppp.conf.span-isp.working \ diff --git a/share/examples/isdn/FAQ b/share/examples/isdn/FAQ deleted file mode 100644 index f3a4fda52d6f..000000000000 --- a/share/examples/isdn/FAQ +++ /dev/null @@ -1,1079 +0,0 @@ -------------------------------------------------------------------------------- - - ISDN4BSD Frequently Asked Questions - =================================== - - last edit-date: [Wed Nov 1 15:08:03 2000] - - $FreeBSD$ - --------------------------------------------------------------------------------- - -Contents: -========= - - 1. How do I get started with synchronous PPP (sPPP) ? - 2. does anyone know a software that can receive/send fax over ISDN ? - 3. does i4b callback only work with setups where the remote end - returns a busy ? - 4. trouble with kernel options IPFIREWALL and IPDIVERT and natd - 5. I want to use -r with isdnd but it does not work - 6. How do I configure and run the answering machine ? - 7. Teles S0/16.3 ... unknown ? - 8. How do i integrate a new lowlevel driver into i4b ? - 9. Why it always says "no Space in TX FIFO - State F4 awaiting" ? - 10. Incoming alert - what does it mean ? - 11. How do i change irq's on my teles 16.3 card ? - 12. NL: i'm getting CAUSE 100 or CAUSE 101 when dialling out - 14. I'm using sPPP. I can connect to my ISP but no TCP/IP services work. HELP! - 15. i4b 0.80.00: problems with AVM Fritz PCI - 16. How do i setup logfile rotation for isdnd ? - 17. How do i setup dialin from Windows NT RAS to i4b ? - 18. How can I convert my old .g711a files to the new format? - 19. I have lots of old .g711a files to convert what can I do? - 20. How can I convert the .al files to Sun/NeXT .au/.snd/.vox files? - 21. Help, isdn4bsd 0.82 fails to probe my Elsa PCC-16! - 22. How do i enable and configure userland PPP with i4b ? - 23. What is the procedure to install a new i4b on FreeBSD 3.x ? - 24. Why do i get "ifconfig: ioctl (SIOCAIFADDR): file exists" ? - 25. How to properly operate isdnd's fullscreen output in a 132x60 vty - 26. NetBSD: i see isic0 while booting but I cannot access my Fritz!Card - 27. i4b_pci_attach: pci_map_port 1 failed! What does this mean ? - 28. What is: i4b-L2 i4b_rxd_ack: ((N(R)-1)=35) != (UA=36) !!! - 29. Why does isdnd take up 95% CPU time ? - - -1. How do I get started with synchronous PPP (sPPP) ? -================================================================================ - - Of course you first have to have sPPP interfaces in your kernel. If - you installed everything using FreeBSD/install.sh then the correct - entries should have been automatically made in /sys/conf/files for you. - For NetBSD it isn't quite as simple since NetBSD/install-netbsd.sh does - not do it for you. - - Then all you need to do is put an entry like this: - - device "i4bisppp" 4 - - into your kernel configuration file (if it's not already there) and - generate and boot the new kernel. The above line will give you 4 - sPPP interfaces - isp0 to isp3. - - Then just modify /etc/isdn/isdnd.rc (see the example in etc-isdn/isdnd.rc) - to suit your needs (telephone numbers, etc). - - The next step is to read the ispppcontrol man page and then to look at - etc/rc.isdn-PPP. ispppcontrol is a very important component in getting - sPPP working correctly and the ispppcontrol lines in your /etc/rc.isdn - must be correct. - - In my experience there are two things which can cause problems: - - 1) the authproto line has to agree with what your ISP desires. In - general I've found that it's best to have something like this - - - ispppcontrol myauthproto={pap,chap} myauthname= - myauthsecret= hisauthproto=none callin - - The "hisauthproto=none" is usually needed because the ISP does not want - to authorise himself to you; he expects you to authorize yourself to him ! - I once forgot to set hisauthproto and it took me quite a while to figure - out why I couldn't connect. - - 2) the IP address at your ISP's end must be correct. - - How can I find out (1) whether my ISP wants pap or chap and (2) what his - IP address is ? you might ask. Generally, your ISP should have provide - this information to you. But, if he didn't, or you've mislayed the - documentation (as I did), there's still hope. - - Fortunately, J"org Wunsch implemented the sPPP kernel code so that it - provides all the information required if the interface is configured - with the debug flag set (e.g. ``ifconfig isp0 debug''). It's just a - little cryptic. - - By the way, I suggest turning the debug flag on until you have things - working and then turning it off. The debug output is rather voluminous - and could fill up your /var partition, otherwise. - - The debug output will appear on the console and also be logged to - /var/log/messages (under FreeBSD) unless you changed /etc/syslog.conf. - - A. How to figure out the authproto - ---------------------------------- - - Here is an example where I configured isp0 with myauthproto=pap, my - ISP wanted chap, but was willing to accept pap: - - /kernel: isp0: lcp up(starting) - /kernel: isp0: lcp output - /kernel: isp0: lcp input(req-sent): - ^^^^^ - |___ c223 is chap, it's what the ISP wants to use - - /kernel: isp0: lcp parse opts: 0x0 [rej] mru auth-proto 0x11 [rej] - x13 [rej] send conf-rej (I didn't agree) - /kernel: isp0: lcp output - /kernel: isp0: lcp input(req-sent): - /kernel: isp0: lcp input(ack-rcvd): - /kernel: isp0: lcp parse opts: mru auth-proto - /kernel: isp0: lcp parse opt values: mru 1524 auth-proto [mine 0x0 != - his chap] send conf-nak (we want to use pap, not chap) - /kernel: isp0: lcp output - ^^^^^ - |___ c023 is pap - - /kernel: isp0: lcp input(ack-rcvd): (he agrees to use pap) - /kernel: isp0: lcp parse opts: mru auth-proto - /kernel: isp0: lcp parse opt values: mru 1524 auth-proto send conf-ack - /kernel: isp0: lcp output - he agrees to use pap ___|^^^^^ - - so, if you have problems in the lcp phase, check which authentication method - your ISP wants to use. Usually chap is prefered, but pap will be accepted. - - B. How to figure out the ISP's IP address - ----------------------------------------- - - ====================================================================== - - UPDATE NOTE (February 8, 1999): - - Jan Riedinger writes: - --------------------- - >I further think Gary should mention - >in the FAQ in the section "B. How to figure out the ISP's IP address - >that it isn't normaly necessary to do it because of the auto - >address negotiation. - - Gary answers: - ------------- - I think you're right. I wrote that stuff before the support for - negotiation of the IPS's address was added to if_spppsubr.c. - - ====================================================================== - - - I also intentionally configured the interface with the wrong address for - my ISP, like this: - - ifconfig isp0 0.0.0.0 10.0.0.1 debug link1 - - this means that I want the ISP to assign me an address (the 0.0.0.0) and - that I expect him to use 10.0.0.1 (which is wrong). Here's the result: - (note that these addresses have been changed by me) - - /kernel: isp0: phase network - /kernel: isp0: ipcp open(initial) - /kernel: isp0: ipcp up(starting) - /kernel: isp0: ipcp output - /kernel: isp0: ipcp input(req-sent): - /kernel: isp0: ipcp parse opts: compression [rej] address send conf-rej - /kernel: isp0: ipcp output - /kernel: isp0: ipcp input(req-sent): - /kernel: isp0: ipcp nak opts: address [wantaddr 12.34.56.78] [agree] - ^^^^^ - |___ he assigns me this - - /kernel: isp0: ipcp output - /kernel: isp0: ipcp input(req-sent): - /kernel: isp0: ipcp parse opts: address - /kernel: isp0: ipcp parse opt values: address 98.76.54.32 [not agreed] - ^^^^^ - |_this is *his* address - send conf-nak - /kernel: isp0: ipcp output - I expect a different address and (incorrectly) reject what he wants. - I tell him that I expect 10.0.0.1. After this the connection fails. - - Anyway, I now know that his address is really 98.76.54.32 and can use - it to correctly configure the interface. - - With the correct IP address I shoulkd now be able to connect with no - problems. As stated above, the authorization protocol is normally not - so important since most ISPs are willing to use pap, although chap is - more secure. Generally, I'd try chap first and only switch to pap if - the ISP doesn't accept it. - - (by Gary Jennejohn, Home - garyj@muc.de, Work - garyj@fkr.dec.com) - - - -2. does anyone know a software that can receive/send fax over ISDN ? -================================================================================ - - > Hi, - > - > does anyone know a software that can receive/send fax over ISDN? I am - > using a Fritz!Card, which can handle group 3 (analogous) fax, but I - > can't find any hint in the i4b software that this is supported in any - > way. - -This is probably not implemented. - -Implementing G3 fax in ISDN would mean simulating an analog modem -on the digital link. This means having to generate the right waveforms -for the modulated data, and receive analog data from the other end -which you had to run FFT analysis on and then interpret. - -In addition you have to do this in realtime, to be able to deal with -the timing involved in the fax protocol, something neither -FreeBSD or Linux is good at in their native form.. - -A third point is that a software simulated faxmodem usually does not -work well. I tested Teles software faxmodem in Win-95 towards an Ericsson V34 -HE modem, and was able to send faxes from the ISDN card at 4800 baud -only, and receive faxes ad 9600 baud only(!) (And it is not the -Ericsson modems fault, it works flawlessly towards other fax machines.) - -My point is that the best thing to do is to use an ordinary faxmodem -to handle faxes with Hylafax of mgetty+sendfax or efax, or you may use -a combined ISDN card with an analog part. - -Of course, if you are crazy enough, you may try to implement a -software simulated modem in e.g. RT-linux, or a similar realtime -extension for FreeBSD. - -Best regards, -Nils Ulltveit-Moe (etonumo@eto.ericsson.se) - - - -3. does i4b callback only work with setups where the remote end returns a busy ? -================================================================================ - -> Is my assumption correct, does i4b callback only work with setups where -> the remote end returns a busy on the dialin? - -Yes - otherwise you'll pay for the connection, at least here in Germany. - -Most routers support two kind of callbacks - the one that i4b supports -means: the called system rejects (so no charge for this connection), waits -a configurable time and the calls back. Information on who has called and -who is to be called back relies on the ISDN calling party number information -and stuff statically configured in the routers (or isnd's) configuration. - -The other type of callback (not supported by i4b right now) means: the -called system accepts the connection and starts ppp negotiation. During this -the ppp's aggree to do a callback. Information on who called in and who is -going to be called back is subject to the authentication/negotiation already -done by the two ppp's. Then ppp closes down, the connection is disconnected -and the called system calls back. - -I've never seen someone actually use the second type due to its obvious -disadvantages. It may be usefull if you travel, call in from an unknown -number and want to be called back at that number. - -Martin Husemann - - -4. trouble with kernel options IPFIREWALL and IPDIVERT and natd -================================================================================ - - NOTICE: section obsolete since IP address changes are handled properly now! - =========================================================================== - -This section -> Trying to build a router/gateway between my privat Ethernet and -> the Internet (via my ISP), I have problems with I4B or NAT (I think:). -> -> The 2.2.5-R kernel with options IPFIREWALL and IPDIVERT works fine -> with ISDN4BSD 0.50-alpha and firewall rule 'pass all from any to any'. -> However, when I add 'divert natd all from any to any via isp0' -> and start natd, name server lookups to the ISP's NS don't work. -> -> Also, ping and nslookup fails from any other internal host. - -I had exactly the same problems. natd doesn't seem to get a message if -the IP address of the interface changes (after successful dialout). -I have to manually send a HUP signal to natd. I do this via the following -(ugly?!) hack: - -I added the following two lines to the system section of isdnd.rc: -regexpr = "call active" # look for matches in log messages -regprog = hup_natd # execute program whan match is found - -The small script "hup_natd", located in /etc/isdn, looks like: -#!/bin/sh -pid=`cat /var/run/natd.pid` -kill -HUP $pid -sleep 3 -kill -HUP $pid -sleep 5 -kill -HUP $pid - -It looks ugly, but at least for me it works. The two sleeps are necessary -since I have to wait for ppp negotiation to complete (I don't get a message -from isdnd for that). If I'm lucky I have my connection after 3 seconds, -but 8 seconds should suffice for worst case (the first HUP without a sleep -sometimes even succeeded on a slow 486/33 with 8MB RAM, more HUPs don't hurt). - -I'm really interested in some more elegant method. - -Daniel (rock@cs.uni-sb.de) - - -Arve Ronning replied: -===================== - -> I had exactly the same problems. natd doesn't seem to get a message if -> the IP address of the interface changes (after successful dialout). - -Well, it (natd) _does_ pick up the dynamic address supplied for isp0. -Try 'natd -verbose ...' and you'll see it. Otherwise I agree, there is -certainly something missing in natd's functionality, or maybe sppp -does'nt -supply what it's supposed to ?? - -> I have to manually send a HUP signal to natd. I do this via the following -> (ugly?!) hack: - -YES...super; strange but correct. It works when I send natd a -HUP after -sppp is up. Thanx for the tip. However, natd must be -HUPed _every_ time -sppp has been down (idle timeout) and comes back up! - -> I'm really interested in some more elegant method. - -So am I, let's see what may come out of the discussion on the list. - - - -5. I want to use -r with isdnd but it does not work -================================================================================ - -> > Use isdnd in fullscreen mode. -> -> I tried that already, but got an error when I start isdnd that way: -> -> /usr/local/bin/isdnd -d 0xf9 -f -r /dev/ttyv1 -t cons25 -> -> root is logged in on device /dev/ttyv1, the message in /var/log/messages looks like: -> -> "May 22 11:52:28 asterix isdnd[4160]: ERR ERROR, cannot setup tty as controlling terminal: Operation not permitted" -> -> How can I give this device permission ? - - -In case you want to use switch "-r" noone else _must_ use the tty you redirect -to, you have to remove the getty from the virtual terminal in /etc/ttys and -restart the init process. - - -6. How do I configure and run the answering machine (under FreeBSD 2.2.x) ? -================================================================================ - -The answering machine will be activated, when isdnd executes the program -that has been named in "/etc/isdn/isdnd.rc" in the section "telephone -answering" at entry "answerprog = ". If the program is executed -without a pathname, the answer program is expected in "/etc/isdn". -Examples of such programs can be found in "/etc/isdn/samples". They -are named: - - "answer" answers only, no recording - "record" answers, and records messages - "tell" the number of the calling person is told, - no recording. - "tell-record" calling number as answer, message is recorded - "isdntel.sh" answers and records messages; by using the - program "isdntel", one has the control over - the recorded messages in the directory - "/var/isdn". Look at "man isdntel" and - "man isdntelctl". - -These programs have to be altered to suit your needs. Unfortunately there -is no program with which you can record your answer message. This is not -really bad, because you only have to alter the above mentioned program -"record" a bit (comment out the "if ... fi" statements for the beep -and msg messages). You have to create the directory "/var/isdn" first in -order to record messages. They will be stored in this location then. - -Stefan Herrmann - - -7. Teles S0/16.3 ... unknown ? -================================================================================ -Hi, - -I have just purchased a Teles S0/16.3 card. -But it's not what i4b is looking for .... I mean, it's a different card. - -The docs (and sources)of i4b talks about a Telws S0/16.3 card with 3 -address: d80 etc. - -This one (is not PnP) has jumpers for 0x180 0x280 0x380. - -It has the SIemens Chips numbered PSB 21525 N (HSCX TE V2.1) and PSB -2186N V1.1 (ISAC-S TE). - -I undestand that the 16.3c is not supported, but over this board is -written "TELES.S0/16.3 Revision 1.3" - -Can anybody tell me what is this card ??? - -answer: -------- - -It's not a different card. The jumpers are documented to select -IO-address 0x180, 0x280 or 0x380 in some TELES manuals. -But in fact they select the addresses 0xd80, 0xe80 or 0xf80. - -Wolfgang - - -And an additional note from Poul-Henning Kamp: ----------------------------------------------- -There is an intricate story behind this, in short some ISA cards -only decode the first 10 address bits (0x3ff), which over the years -has resulted in a mutation the "de-facto-spec" such that addressbits -10-15 can be used by the card for selecting various stuff. This -is extensively used on obscure cards with massive IO needs, sound, -IEEE488 and ISDN cards often belong in this category. - - - -8. How do i integrate a new lowlevel driver into i4b ? -================================================================================ - -1) Request a flag value from me -2) add an entry for the card into FreeBSD/CONFIG -3) add driver filename to FreeBSD/files.i386.cat -4) add entry for the card to FreeBSD/options.i386.cat -5) add support to print type of card to diehl/diehlctl/main.c -6) add support to print type of card to isdnd/support.c, name_of_controller() -7) place your file as named in 3) into directory layer1 -8) add the flag value and function prototypes to layer1/i4b_l1.h -9) add support for NetBSD to layer1/isa_isic.c -10) add support for attach/probe to layer1/i4b_isic.c -11) add card type to i4b/i4b_ioctl.h and update CARD_TYPEP_MAX -12) add an entry to the man page man/isic.4 - -Produce diffs (please use context diffs, flag "-c" for diff) and send them in. - - -9. Why it always says "no Space in TX FIFO - State F4 awaiting" ? -================================================================================ - -as I wrote about two weeks ago I had massive problems concerning this -"no space in TX FIFO"-thing, - -/kernel: i4b-L1-ph_data_req: No Space in TX FIFO, state = F4 Awaiting Signal - -Even though I used a correctly recognized Teles S0/16.3 nonpnp isdncard, -nothing worked, errormsgs were flooding the console until I rebooted the box. - -I decided to play around in the BIOS-settings, I first just set them all -to default, which didn't work, and then changed lots of things - unfortunately -I can't remember them. After about hundreds of trial 'n errors I gave up. - -A few days ago I just made another attempt, booted the box and to my surprise -it all worked without the smallest problem, great data rates :) - -I tried hard to found what the something special was I changed in the BIOS -settings, but I just couldnt get isdnd back to its stupid behaviour it -showed all the time before, but I would recommend everybody who has this -kind of problem to look into his BIOS. - - (from Meike Aulbach, strange@stoned.rhein-main.de) - - -i4b now works for me, I had a USB-device interfering on IRQ 9, -which was supposed to be only for my Creatix Card. -(NetBSD 1.3, Creatix) - -Strange enough, my DOS s0-test worked, are they just polling the card? - -Even when the testsoftware under DOS is working, don't be shure, that -your hw-setup is correct for xxx(x)BSD. Triplecheck all your IRQ and -enable and disable PNP to triple-verify. Even unconfigured devices can -block your card. ..... - -And that took me more than 2 months to discover :-(((( - - (from Andreas Lohrum, andreas.lohrum@consol.de) - - -when i changed the mainboard of a box that ran i4b alright, i forgot to -set 'used by isa' in the pnp-bios-settings for the irq of my teles -isdn-card. because of that some pci-card got the interrupt that the -isdn-card should have gotten. -i then also got this error: 'No space in TX FIFO'. - -The reason occurred to my rather quick, but i would think, that this would -be a nice hint in a FAQ :) - - (from Heiko Schaefer, hschaefer@fto.de) - - -after my huge amount of problems, Meike's hint (changing the -ISA/PNP-settings in the BIOS) finally fixed things. -I have only tried out this stuff with my Creatix-card, I'll check -out the PNP-stuff with my Sedlbauer-card soon too though. - - (from Harold Gutch, logix@foobar.franken.de) - - -10. Incoming alert - what does it mean ? -================================================================================ - -In the log on vty6 (isdnd full screen log) I'm seeing - -16.07.98 11:42:35 CHD 00001 rwth rate 90 sec/unit (rate) -16.07.98 11:42:35 CHD 00001 rwth dialing from 4191236 to 441291234 -16.07.98 11:42:35 CHD 00001 rwth outgoing call proceeding (ctl 0, ch 0) -16.07.98 11:42:35 CHD 00001 rwth incoming alert <<<<<<<<<<<<<<< -16.07.98 11:42:35 CHD 00001 rwth outgoing call active (ctl 0, ch 0) - -What does this 'incoming alert' mean? - - -It means that it is "ringing" at the remote end. - - -11. How do i change irq's on my teles 16.3 card ? -================================================================================ - -Question: - -So how do you change irq's on your teles 16.3 card (under FBSD or DOS, -I don't have and don't want to have Windows running on that computer) ? - -Answer: - -The irq is configured into the card each time the driver under whatever -OS you currently boot initializes the card. Thus, change the irq for the -isic driver in your kernel config file to one of the supported (!) irqs -for this card (hint: read "man isic") which is currently unused in your -machine and generate a new kernel. - - -12. NL: i'm getting CAUSE 100 or CAUSE 101 when dialling out -================================================================================ - -This one seems to be specific for the Netherlands. (-hm) - -Question: - -I'm trying to get i4b running on my new FreeBSD 2.2.8 system. The kernel -compiles smootly and everything is looking fine until it's time to dial. -I get the following error: - -Feb 10 20:31:00 goofy isdnd[498]: CHD 00018 I4BPPP outgoing call disconnected (remote) -Feb 10 20:31:00 goofy isdnd[498]: CHD 00018 I4BPPP cause 101: Message not compatible with call state (Q.850) -Feb 10 20:31:00 goofy isdnd[498]: ERR set_channel_idle: controller [0], invalid channel [-1]! -Feb 10 20:31:00 goofy isdnd[498]: ERR msg_disconnect_ind: set_channel_idle failed! - -The remote site is a Cisco 4000 type router. I used debug to take a view at -the ISDN events on the router but according to that the call doesn't arrive -over there. - -Same hardware has worked fine with FreeBSD 2.2.6/i4b 0.63. - -Who knows what's wrong? - - -Answer: - -This sounds very much like your local phone number or remote phone number -is configured wrongly... in the Netherlands you need to specify the number -EXCLUDING the city code... so if you live in Utrecht and your number is -0301234567 you specify 1234567. - -I have seen this in several locations in the Netherlands for years, not -just with i4b, but also with differentt isdn equipment.. why? guess it -simply depends on which operator defines your line or what exchange it -is connected to... :P -What I found is that what solved this with other isdn hardware/software, -also solves it for i4b.. ie.. make sure the local phone number is -specified, and is specified without the city code. -The numbering plan should be 'unknown' - -Anyway, it would be nice if the Dutch ptt (they are called KPN btw) -would tell us why this happens... they havent been able to tell me in the -past so I guess I give up on that, but if everyone finds out whats exactly -happening here I'd be interested to know... :) - -List of number configurations that I have found to almost always work in -the Netherlands: - -1. Local phone number: - usually your prefered msn without city code works here. - (ie, 1234567 if you would like to use 0201234567 for outgoing calls) - on some locations leaving it blank or defining it with the city code, - but without the leading 0 works as well here. - -2. remote phone number: - When this is a 'local' call, don't specify city code. - For calling parties in other cities you of cource have to use the city - code... in general you can say that KPN only accepts the shortest - possible notation where it would still be clear who you want to call. - -3. numbers for incomming call recognition: - KPN always specifies incoming caller ids with city code, but without - leading 0. so 0201234567 will be displayed as 201234567 - - -Hope this helps. -Bart - - (from Bart van Leeuwen bart@ixori.demon.nl) - - -14. I'm using sPPP. I can connect to my ISP but no TCP/IP services work. HELP! -============================================================================== - -This is probably because you have the RFC1323 - TCP Extensions for High -Performance - support turned on and your ISP (or some router in the loop) -is discarding the extensions. - -This can easily be checked by doing ``sysctl net.inet.tcp.rfc1323''. If the -result is 1, then the RFC1323 support is turned on. - -Turn this off by doing ``sysctl net.inet.tcp.rfc1323=0'' (This is -called "net.inet.tcp.do_rfc1323" under BSD/OS). - -For FreeBSD make sure that tcp_extension="NO" is in your /etc/rc.conf -(/etc/defaults/rc.conf with more recent versions of FreeBSD) and -/etc/rc.conf.local (in -STABLE and upcoming 3.2) - -This may be different for NetBSD, OpenBSD and BSD/OS. - -Martin Husemann writes: ------------------------ -This does apply for NetBSD too (and probably OpenBSD, since it's been -in NetBSD for a long time). The sysctl name is even compatible ;-) We don't -have a coresponding rc.conf entry, I do it in /etc/netstart.local. - -I would suggest to set this to 0 on all machines routed over ISDN (not only -the router), as this "high speed options" in fact do slow down an ISDN link -by making VJ "compression" impossible - as far as I understood it. So there -should be a more general advice in the FAQ, not only "turn it off if it -doesn't work for you". - -I've only seen the problems against old linux kernels (about two years ago), -are there still machines out there that have such a broken TCP/IP stack? We -should start to blame the vendors... - - (by Gary Jennejohn, garyj@muc.de, with additions from - Harold Gutch and - Martin Husemann ). - - -15. i4b 0.80.00: problems with AVM Fritz PCI -============================================================================== - -Question: -========= - -The system is FreeBSD 3.1-RELEASE with i4b-00.80.00-beta-070599 [...] - -I'm trying to compile a Kernel with support for my AVM Fritz!PCI card, -however, when compiling, it fails with the following error - -sh ../../conf/newvers.sh GENERIC -DAVM_A1_PCI -cc -c -O -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit -Wnested- -externs --Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline - -Wuninitializ -ed -Wformat -Wunused -fformat-extensions -ansi -nostdinc -I- -I. -I../.. --I/us -r/include -DAVM_A1_PCI -DKERNEL -DVM_STACK -include opt_global.h -elf -vers.c -loading kernel -i4b_isic_pci.o: In function `i4b_pci_attach': -i4b_isic_pci.o(.text+0x141): undefined reference to `avma1pp_map_int' -i4b_isic_pci.o: In function `isic_pciattach': -i4b_isic_pci.o(.text+0x196): undefined reference to `isic_attach_avma1pp' -*** Error code 1 - - -Solution: -========= - -> I have added -> -> i4b/layer1/i4b_avm_fritz_pci.c optional isic device-driver -> -> and am recomiling at the moment, but given that it's a 486, it could take -> some time :-) - -The problem appears to be that overinstall.sh does not update files.i386 -and options.i386, and that AVM_A1_PCI was added after 3.1-RELEASE and -hence is not defined. - -Manually editing these files (using install.sh as a guide) allows the -kernel to compile cleanly. - - -(from Rich Wood, rich@dynamite.org) - - -16. How do i setup logfile rotation for isdnd ? -============================================================================== - -For syslog-based logging: -------------------------- - -man newsyslog (on FreeBSD) - -You just add a line to /etc/newsyslog.conf: -/var/log/isdnd.log 664 7 100 * Z -and you are all done... - -(From: Andreas Haakh ) - - -For logfile-based logging: --------------------------- - -I suggest using newsyslog(8). Adding a line like: - -/var/log/isdn.log 664 100 * 168 Z /var/run/isdnd.pid - -to /etc/newsyslog.conf will do the job (here: once a week, for the next -100 weeks) with compression of the old log. - -This is the standard method for other daemons (apache, etc.). - -(From: Udo Schweigert ) - - -17. How do i setup dialin from Windows NT RAS to i4b ? -============================================================================== - -> > I need to be able to dial in from a WNT box, equipped with TELES h/w and -> > s/w, to a FreeBSD machine. I don't have a clue what RAS is using. -> > I've tried -> > ipr and isp. The latter seems to work but is hanging on authentication. Is -> > there somebody who has done this before and is able to give me some hints? -> -> RAS is using PPP, so you should be able to get the isp interface working. I -> haven't done it so I can't give you concrete hints, but setting the isp -> interface to debug mode and posting the log (with passwords cut out or with -> test passwords) could help us to debug your setup. - -I have several customers using sPPP do dial in from their W95/W98/WNT. - -If You use FreeBSD_3.2-BETA with i4b-071 or older then you have to apply -the attached patch to /sys/net/if_spppsubr.c (patch -p0 > 24; -- p[3] = hisaddr >> 16; -- p[4] = hisaddr >> 8; -- p[5] = hisaddr; - } - break; - } - /* Add the option to nak'ed list. */ ---- 2668,2678 ---- - addlog("%s [not agreed] ", - sppp_dotted_quad(desiredaddr)); - - } -+ p[2] = hisaddr >> 24; -+ p[3] = hisaddr >> 16; -+ p[4] = hisaddr >> 8; -+ p[5] = hisaddr; - break; - } - /* Add the option to nak'ed list. */ - -(From: Andreas Haakh ) - - -18. How can I convert my old .g711a files to the new format? -================================================================================ -I got the best results with: -cat /some/path/dwhello.g711a | alaw2ulaw | g711conv -u > /tmp/newhello.al - -(From: David Wetzel ) - - -19. I have lots of old .g711a files to convert what can I do? -================================================================================ - -Create a shell script (/tmp/csnd.sh) with this contents: -#!/bin/sh - -OLDFILES=`ls *.g711a` -#echo $OLDFILES - -for THEFILE in $OLDFILES -do -( - echo -n "converting $THEFILE..." - BASENAME=`basename $THEFILE .g711a` - - /bin/cat $THEFILE | alaw2ulaw | g711conv -u > $BASENAME.al - echo "done" -) - -done -###### END - -then type "chmod a+x /tmp/csnd.sh" in you shell. -cd /usr/local/lib/isdn (or where your old sounds live) -/tmp/csnd.sh -Optional: -rm *.g711a (you should know what you do here :-) - -(From: David Wetzel ) - - -20. How can I convert the .al files to Sun/NeXT .au/.snd/.vox files? -================================================================================ - -/bin/cat /some/path/old.al | sox -t raw -A -b -r 8000 - -t .au /some/path/new.snd - - -(From: David Wetzel ) - - -21. Help, isdn4bsd 0.82 fails to probe my Elsa PCC-16! -================================================================================ - ->Isdn4bsd 0.82 fails to probe my Elsa PCC-16. It just can't find isic0. - -flags have changed from 19 to 20. - - -(From: "Frank J. Beckmann" ) - - -22. How do i enable and configure userland PPP with i4b ? -================================================================================ - -NOTE: this is the procedure used as of end of July 1999, it may change in - the near future! - -Get the current ppp sources from - - http://www.freebsd.org/~brian - -unpack them and apply the patch - - ftp://ftp6.uk.freebsd.org/pub/PPPoISDN/pppcommit.patch - -to the ppp directory (where you just unpacked the above mentioned ppp source). -Make and install the result. - -Have a look at the user-ppp directory and the end of etc-isdn/isdnd.rc.sample -for ppp and i4b sample configurations to get things up and running. - -More information to ppp setup can be found at - - http://www.Awfulhak.org/ppp.html - http://www.freebsd.org/doc/handbook/ppp-and-slip.html - http://www.freebsd.org/doc/faq/ppp.html - -and in the directory "user-ppp" of the isdn4bsd distribution. - - -23. What is the procedure to install a new i4b on FreeBSD 3.x ? -================================================================================ - -cd /usr/src -mkdir i4b -cd i4b -tar xvzf i4b-00.82.00-beta-140799.tar.gz -cd FreeBSD -sh overuninstall.sh -sh overinstall.sh -cd .. -make cleandir -make depend -make -make install -cd /sys/i386/conf -config -cd ../../compile/ -make clean -make depend -make -make install -shutdown -r now - - -(From: Luke Roberts ) - - -24. Why do i get "ifconfig: ioctl (SIOCAIFADDR): file exists" ? -================================================================================ - -Ich ?berlege gerade, aber ich glaube, ich bekomme sie auch. Das -Problem existiert schon seit geraumer Zeit immer beim Konfigurieren -eines point-to-point Interfaces (SLIP, PPP). - -Das `file exists' ist ein Misnomer, es r?hrt daher, da? der -Routingcode die errno's in einer leicht ver?nderten Weise benutzt, so -da? nicht neue errno's daf?r erfunden werden mu?ten. Lies es als -`route exists'. (Und falls Du im Zusammenhang mit Routing mal ein `no -such process' siehst, lies es als `no such route'.) - -Die Meldung ist harmlos. Sonst h?tte ich mir schon l?ngst mal die -M?he gemacht, mich durch den ganzen Routing-Code zu hangeln und zu -sehen, warum das passiert. - -(From Joerg Wunsch ) - - -25. How to properly operate isdnd's fullscreen output in a 132x60 vty -================================================================================ - -Q: I'm using allscreens_flags="132x60" in /etc/rc.conf but the vty gets - switched after isdnd is started, so isdnd didn't know about the new - dimensions of the screen. - -A: This one's easy: - In /etc/rc.isdn change - isdn_ttype=cons25 - to - isdn_ttype=cons60l1wide - /usr/sbin/vidcontrol VESA_132x60 < ${isdn_fsdev} - - The new VESA modes don't have termcap entries yet, so you'll - have to add one yourself to define 132x60: - - cons60l1wide|cons60-iso8859-1:\ - :co#132:tc=cons60l1: - - -(From: "H. Eckert" ) - - -26. NetBSD: i see isic0 while booting but I cannot access my Fritz!Card -================================================================================ - -I got his: -isic0 at pci0 dev 8 function 0: Fritz!Card -isic0: ISAC 2085 Version A1/A2 or 2086/2186 Version 1.1 (IOM-2) -isic0: interrupting at irq 11 -(...) -i4b: ISDN call control device attached -i4btrc: 2 ISDN trace device(s) attached -i4bctl: ISDN system control port attached -i4brbch: 4 raw B channel access device(s) attached -i4btel: 2 ISDN telephony interface device(s) attached -i4bipr: 2 IP over raw HDLC ISDN device(s) attached (VJ header compression) -i4bisppp: 2 ISDN SyncPPP device(s) attached - -But I could not use the card, because I forgot -"options __I4B_IS_INTEGRATED" in the kernal config file. -[Jan Sparud helped me to find that] - -(From: David Wetzel ) - - -27. i4b_pci_attach: pci_map_port 1 failed! What does this mean ? -================================================================================ - -Q: Hi, - - I am trying to set up an ELSA QuickStep 1000pro PCI ISDN adaptor in a FreeBSD - 3.3 box. I configured the kernel according to the i4b.ps documentation. At - boottime, these messages are displayed: - - isic0: rev 0x01 int a irq 11 on - pci0.1 7.0 - i4b_pci_attach: pci_map_port 1 failed! - - What does this mean ?, should I be worried ?, will the device function - properly ? - -A: Problem is solved. - - In the BIOS, the PCI slot containing the ISDN card was set to IRQ 14 (having - no IDE devices). The isic driver finds the card using irq 11 and then says - "pci_port_map_port failed". The slot is set to IRQ 11 (which was free also) - and everything works fine here .. - -From: Joost Mulders - - -28. What is: i4b-L2 i4b_rxd_ack: ((N(R)-1)=35) != (UA=36) !!! -================================================================================ - -> Some time I get follow message at console: -> -> i4b-L2 i4b_rxd_ack: ((N(R)-1)=35) != (UA=36) !!! - -A layer 2 error occured. These types of errors are automatically -corrected by the layer 2 protocol. - - -29. Why does isdnd take up 95% CPU time ? -================================================================================ - -Q: i just set up my isdn w/ user ppp, it works nice, but my isdn daemon takes - up 95% of my CPU time. - - output of "top": - --snip-- - Mem: 42M Active, 4616K Inact, 11M Wired, 2896K Cache, 14M Buf, 408K Free - Swap: 132M Total, 5128K Used, 127M Free, 3% Inuse - - PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND - 63 root 58 0 1372K 752K RUN 38:05 93.75% 93.75% isdnd - 207 gboehm 2 0 25196K 22044K select 1:15 2.20% 2.20% XF86_Mach64 - --/snip-- - -A: i just found out what i did wrong ... - i forgot to set these both lines in my /etc/rc.conf: - - isdn_fsdev="NO" - isdn_flags="" - - had to do that if i want to run isdnd as a daemon service, 'cause the - defaults in /etc/defaults/rc.conf are: - - isdn_fsdev="/dev/ttyv4" # Output device for fullscreen mode (or NO for daemon mode). - isdn_flags="-dn -d0x1f9" # Flags for isdnd - -From: Guido Boehm diff --git a/share/examples/isdn/KERNEL b/share/examples/isdn/KERNEL deleted file mode 100644 index a80dcce47f5d..000000000000 --- a/share/examples/isdn/KERNEL +++ /dev/null @@ -1,82 +0,0 @@ -#--------------------------------------------------------------------------- -# -# example fragment of a kernel config file to include all -# parts of isdn4bsd. This file should be appended to your -# kernel config file and then edited (stripped down) to -# match your hardware configuration. -# -# last edit-date: [Sun Oct 21 11:03:37 2001] -# -# $FreeBSD$ -# -#--------------------------------------------------------------------------- - -# Siemens/Infineon chipsets -device isic 4 - -# Winbond chipset -device iwic 4 - -# AVM Fritz PCI -device ifpi 4 - -# AVM Fritz PCI version 2 -device "ifpi2" 4 - -# Teles 16.3c -device ihfc 4 - -# NETjet-S / Teles PCI-TJ -device itjc 4 - -# AVM Fritz PnP -device ifpnp 4 - -# AVM B1/T1 -device "i4bcapi" -device iavc 4 - -# enable some ISA cards within the "isic" driver -options TEL_S0_8 -options TEL_S0_16 -options TEL_S0_16_3 -options AVM_A1 -options USR_STI -options ELSA_PCC16 - -# enable some ISA PnP cards within the "isic" driver -options TEL_S0_16_3_P -options CRTX_S0_P -options DRN_NGO -options SEDLBAUER -options ELSA_QS1ISA -options SIEMENS_ISURF2 -options ASUSCOM_IPAC -options EICON_DIVA -options COMPAQ_M610 - -# enable ELSA Microlink PCI card within the "isic" driver -options ELSA_QS1PCI - -# protocol stack -device "i4bq921" -device "i4bq931" -device "i4b" - -# control devices -device "i4btrc" 4 -device "i4bctl" -device "i4brbch" 4 -device "i4btel" 2 - -# IP over raw HDLC -options IPR_VJ -device "i4bipr" 4 - -# kernel sppp/isppp -device "i4bisppp" 4 - -# Netgraph interface -#options NETGRAPH -#device "i4bing" 4 - diff --git a/share/examples/isdn/Overview b/share/examples/isdn/Overview deleted file mode 100644 index 76043954c3ca..000000000000 --- a/share/examples/isdn/Overview +++ /dev/null @@ -1,307 +0,0 @@ - - Short technical overview of isdn4bsd - ==================================== - - Copyright (c) 1998 Hellmuth Michaelis. All rights reserved. - - $FreeBSD$ - - Last edit-date: [Tue Oct 27 11:26:03 1998] - - -hm starting an overview ... - - -Contents: ---------- - Functional block diagram - Layer 1 - Layer 2 - Layer 3 - Debugging control - Layer 4 - ISDN protocol trace - - -Functional block diagram -======================== - - isdndebug isdnd isdntrace - +-------+ +----------------------------------------------------+ +--------+ - | | | | | | - | | | | | | - +-------+ +----------------------------------------------------+ +--------+ - | | | - | | | - | /dev/i4bctl Userland | /dev/i4b /dev/i4btrc | -=============================================================================== - | Kernel | | - | | | - +-------+ +----------------------------------------------------+ +--------+ - | | | | | | - |i4bctl | | i4b | | i4btrc | - | (6) | | (7) | | (8) | - | debug | | Layer 4 - common call control interface | | ISDN | - |control| | | | trace | - +:-:-:--+ +----------------------------------------------------+ +--------+ - : : : ^ ^ ^ - : : : Call | various ptr arrays | Call % - . . . Control | in i4b_l3l4.h | Control % - V V % - +----------------------+ +----------------------+ % - | | | | % - | i4bq931 | ISDN | active card | % - | (5) | ##### | % - | Layer 3 (Q.931) | # | driver | % - | | # | | % - +----------------------+ # +----------------------+ % - ^ # B + % - | i4b_l2l3_func function # | + +------------+ % - | ptr array in i4b_l2l3.h # C +++++ isp |----> % - V # h + +------------+ IP % - +----------------------+ # a + Subsys % - | | # n + +------------+ % - | i4bq921 | # n +++++ ipr |----> % - | (4) | # e + +------------+ IP % - | Layer 2 (Q.921) | # l + Subsys % - | | # + +------------+ % - +----------------------+ # D +++++ tel/rbch |----> % - ^ # a + +------------+ to % - | i4b_l1l2_func function # t + /dev/i4btel % - | ptr array in i4b_l1l2.h # a + or /dev/i4brbch% - V # + % - +----------------------+ # +---------------------+ % - | | # | | % - | isic (ISAC part) | D-ch trace # | isic (HSCX part) |B-ch% - | (2) |%%%%%%%%%%%% # | (3) |%%%%% - | Layer 1 (I.430) | % # | non-HDLC / HDLC |trc % - | | % # | | % - +----------------------+ % # +---------------------+ % - ^ % # ^ % - D-channel | % # B-channels | % - +-----------------------------------------------+ % - | function ptr in % # % - | in isic_softc in %%%%%%%%#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - V i4b_l1.h # - +----------------------+ # - | | # - | isic | # - | (1) | # - | Card hardware driver | # - | for Teles, AVM, USR | # - | | # - +----------#-----------+ # - # # - # # - # # - # # - |=========#===============================#============================| - ISDN S0 bus - - -Layer 1 -======= - -(1) A driver for a special card hardware consists of a - - probe routine - - attach routine - - FIFO read - - FIFO write - - register read - - register write - routines. These routines handle the card/manufacturer specific stuff - required to talk to a particular card. - - The addresses of the read/write routines are put into an array found - in struct isic_softc and they are later called by the macros: - - ISAC_READ(r), ISAC_WRITE(r,v), ISAC_RDFIFO(b,s), ISAC_WRFIFO(b,s), - HSCX_READ(n,r), HSCX_WRITE(n,r,v), HSCX_RDFIFO(n,b,s), HSCX_WRFIFO(n,b,s) - - (see file layer1/i4b_l1.h) - - Files currently used for this purpose are - - i4b_avm_a1.c AVM A1 and AVM Fritz!Card drivers - - i4b_ctx_s0P.c Creatix S0 PnP (experimental!) - - i4b_tel_s016.c Teles S0/16 and clones - - i4b_tel_s0163.c Teles S0/16.3 - - i4b_tel_s08.c Teles S0/8 and clones - - i4b_tel_s0P.c Teles S0/16 PnP (experimental!) - - i4b_usr_sti.c 3Com USRobotics Sportster - - -(2) The files i4b_isac.c and i4b_isac.h contain the code to control the - ISAC chip by using the above mentioned macros. - - Files i4b_l1.c and i4b_l1.h handle stuff used to access layer 1 - functions from layer 2. - - Layer 1 and layer 2 access functionality of each other by using - a well known function pointer array, which contains addresses of - "primitives" functions which are defined in I.430 and Q.921. The - function pointer array for layer 1/2 communication is defined in - file include/i4b_l1l2.h and is initialized i4b_l1.c at the very - beginning. - - File i4b_isic.c contains the main code for the "isic" device driver. - - i4b_l1fsm.c is the heart of layer 1 containing the state machine which - implements the protocol described in I.430 and the ISAC data book. - - -(3) All above code is used for handling of the D channel, the files - i4b_bchan.c, i4b_hscx.c and i4b_hscx.h contain the code for handling - the B-channel, the HSCX is used to interface the userland drivers - isp, ipr, tel and rbch to one of the B-channels and i4b_hscx.c and - i4b_hscx.h contain the code to handle it (also by using the above - mentioned macros). i4b_bchan.c contains various maintenance code for - interfacing to the upper layers. - - -Layer 2 -======= - -(4) Layer 2 implements the LAPD protocol described in Q.920/Q.921. Layer 2 - interfaces to layer 1 by the above described function pointer array, - where layer 1 calls layer 2 functions to provide input to layer 2 and - layer 2 calls layer 1 functions to feed data to layer 1. - - The same mechanism is used for layer 2 / layer 3 communication, the - pointer array interface is defined in include/i4b_l2l3.h ad the array - is initialized at the very beginning of i4b_l2.c which also contains - some layer 1 and some layer 3 interface routines. As with l1/l2, the - l2/l3 array also contains addresses for "primitives" functions which - are specified in Q.920/Q.921 and Q.931. - - i4b_l2.h contains the definition of l2_softc_t, which describes the - complete state of a layer 2 link between the exchange and the local - terminal equipment. - - i4b_l2.c contains the entrance of data from layer 1 into the system, - which is split up in i4b_ph_data_ind() into the 3 classes of layer 2 - frames called S-frame, I-frame and U-frame. They are handled in files - i4b_sframe.c, i4b_iframe.c and i4b_uframe.c together with the respective - routines to send data with each ones frame type. - - i4b_l2timer.c implements the timers required by Q.921. - - i4b_tei.c contains the TEI handling routines. - - i4b_lme.c implements a rudimentary layer management entity. - - i4b_util.c implements the many utility functions specified - in Q.921 together wit some misc routines required for overall - functionality. - - i4b_mbuf.c handles all (!) requests for mbufs and frees all mbufs used - by the whole isdn4bsd kernel part. It should probably be moved else- - where. - - i4b_l2fsm.c and i4b_l2fsm.h contain the heart of layer 2, the state- - machine implementing the protocol as specified in Q.921. - -Layer 3 -======= - -(5) i4b_l2if.c and i4b_l4if.c contain the interface routines to communicate - to layer 2 and layer 4 respectively. - - i4b_l3timer.c implements the timers required by layer 3. - - i4b_q931.c and i4b_q931.h implement the message and information element - decoding of the Q.931 protocol. - - i4b_q932fac.c and i4b_q932fac.h implement a partial decoding of facility - messages and/or information elements; the only decoding done here is - the decoding of AOCD and AOCE, advice of charge during and at end of - call. - - As usual, i4b_l3fsm.c and i4b_l3fsm.h contain the state machine required - to handle the protocol as specified in Q.931. - - Layer 3 uses a structure defined in include/i4b_l3l4.h to store and - request information about one particular isdncontroller, it is called - ctrl_desc_t (controller descriptor). It contains information on the - state of a controller (controller ready/down and which B channels are - used or idle) as well as a pointer array used for communication of - layer 4 with layer 3: layer 3 "knows" the routines to call within - layer 4 by name, but in case layer 4 has to call layer 3, several - possibilities exist (i.e. active / passive cards) so it has to call - the routines which the ISDN controller had put into the the function - pointer array (N_CONNECT_REQUEST, N_CONNECT_RESPONSE etc) at init time. - - Layer 3 shares a structure called call_desc_t (call descriptor) with - layer 4. This structure is used to describe the state of one call. The - reference to layer 3 is the Q.931 call reference value, the reference to - layer 4 (and the isdn daemon, isdnd) is the cdid, an unique integer - value uniquely describing one call, the call descriptor id. - This structure is used to build an array of this structures - (call_desc[N_CALL_DESC]), which must be large enough to hold as many - calls as there are B channels in the system PLUS a reserve to be able - to handle incoming SETUP messages although all channels are in use. - - More, this structure contains the so called "link table pointers" - (isdn_link_t *ilt and drvr_link_t *dlt) which contain function pointers - to "link" a B-channel (better the addresses of functions each participant - needs to access each others functionality) after a successful call setup - to a userland driver (such as isp, ipr, rbch or tel) to exchange user - data in the desired protocol and format. - -Debugging control -================= - -(6) the device driver for /dev/i4bctl in conjunction with the userland - program isdndebug(8) is used to set the debug level for each of the - layers and several other parts of the system, information how to use - this is contained in i4b/i4b_debug.h and all parts of the kernel - sources. It is only usable for passive cards. - - -Layer 4 -======= - -(7) Layer 4 is "just" an abstraction layer used to shield the differences - of the various possible Layer 3 interfaces (passive cards based on - Siemens chip-sets, passive cards based on other chip-sets, active cards - from different manufacturers using manufacturer-specific interfaces) - and to provide a uniform interface to the isdnd userland daemon, which - is used to handle all the required actions to setup and close calls - and to the necessary retry handling and management functionality. - - Layer 4 communicates with the userland by using a well defined protocol - consisting of "messages" sent to userland and which are read(2) by the - isdnd. The isdnd in turn sends "messages" to the kernel by using the - ioctl(2) call. This protocol and the required messages for both - directions are documented in the i4b/i4b_ioctl.h file and are - implemented in files i4b_i4bdrv.c and i4b_l4.c, the latter also - containing much of the Layer 4 interface to the lower layers. - - i4b_l4mgmt.c contains all the required routines to manage the above - mentioned call descriptor id (cdid) in conjunction with the call - descriptor (array) and the call reference seen from layer 3. - - i4b_l4timer.c implements a timeout timer for Layer 4. - - -ISDN protocol trace -=================== - -(8) ISDN D-channel protocol trace for layers 2 and 3 is possible by using - hooks in the ISAC handling routines. - - In case D-channel trace is enabled, every frame is prepended with a - header containing further data such as a time stamp and sent via the - i4btrc driver found in driver/i4b_trace.c to one of the /dev/i4btrc - devices, where corresponds to a passive controller unit number. - - If desired, B-channel data can be made available using the same - mechanism - hooks in the HSCX handler send data up to the i4btrc - device. - - The raw data is then read by the isdntrace userland program which - decodes the layer 2 and/or layer 3 protocol and formats it to be - easily readable by the user. - - B-channel data is not interpreted but dumped as a hex-dump. - - -/* EOF */ diff --git a/share/examples/isdn/README b/share/examples/isdn/README deleted file mode 100644 index 0a817f123582..000000000000 --- a/share/examples/isdn/README +++ /dev/null @@ -1,342 +0,0 @@ - -$FreeBSD$ - --------------------------------------------------------------------------------- - - isdn4bsd - ======== - - Version 1.04.00 / August 2002 - - written by: - - Hellmuth Michaelis - Hallstrasse 20 - D-25462 Rellingen - - voice: +49 4101 473574 - fax: +49 4101 473575 - email: hm@freebsd.org - - ----- - - The isdn4bsd package is: - - Copyright (c) 1997, 2002 by Hellmuth Michaelis. All rights reserved. - - The standard FreeBSD license applies, for details see the file - /usr/share/examples/etc/bsd-style-copyright - - ----- - - isdn4bsd would not be what it is without - the help and support of many people, - see file ThankYou ! - - ----- - - Vote with your wallet: in case you want to buy new ISDN hardware, - buy it from manufacturers who support the development of i4b, - for a list of supporters have a look at file ThankYou! - - ----- - - This package is postcard-ware: - ============================== - - The (for laywer infected places: optional) license fee for using - isdn4bsd is sending a picture postcard of your home town. - My address can be found at the top of this file. - - --------------------------------------------------------------------------------- - -Contents: ---------- - 1. Disclaimer - 2. What is isdn4bsd ? - 3. Which BSD's are supported ? - 4. Which ISDN cards are supported ? - 5. Where do i find documentation for isdn4bsd ? - 6. How do i install isdn4bsd ? - 7. Where do i get support for isdn4bsd ? - 8. Where do i get commercial support for isdn4bsd ? - 9. How can i help and/or support isdn4bsd ? - 10. How do i report bugs ? - 11. Is there a mailing-list available for isdn4bsd ? - 12. Where can i get isdn4bsd ? - 13. What is the reward for reading everything in this file ? - - -1. Disclaimer: --------------- - - It may be illegal in your country to connect an isdn4bsd based machine - using a passive ISDN card to the ISDN at your site because the protocol - stack of isdn4bsd, which is necessary to run passive cards, has not been - approved by the telecommunication certification authority of your country. - If in doubt, please contact your local ISDN provider ! - - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. - - -2. What is isdn4bsd ? ---------------------- - -Isdn4bsd (or in short i4b) is a package for interfacing a computer running -FreeBSD, NetBSD, OpenBSD or BSD/OS to the ISDN. - -The only ISDN protocol currently supported by the drivers for passive cards -is the BRI protocol specified in I.430, Q.921 and Q.931; better known as -DSS1 or Euro-ISDN. - -Other ISDN Protocols may be / are supported by the microcode of the supported -active ISDN cards. - -Isdn4bsd allows you to make IP network connections by using either IP packets -sent in raw HDLC frames on the B channel or by using built-in synchronous PPP -(or using userland ppp, this is experimental and only available for FreeBSD). - -For telephony, isdn4bsd can answer incoming phone calls like an answering -machine and now has preliminary dialout capabilities for voice and data calls. - - -3. Which BSD's are supported ? ------------------------------- - -FreeBSD: --------- - - FreeBSD-STABLE and FreeBSD-CURRENT is supported - by this version of isdn4bsd. - - I4b was integrated into FreeBSD in January 1999, so it is part - of the base FreeBSD system since FreeBSD 3.x. - - Please take the time to read the available documentation carefully. - - -NetBSD/i386: ------------- - The NetBSD specific support and the Diehl driver was written by - Martin Husemann, (martin@netbsd.org). Isdn4bsd was integrated - into the NetBSD tree in January 2001, please have a look at - http://www.de.netbsd.org/Documentation/network/isdn/ for more - information. - -NetBSD/Amiga: -------------- - The NetBSD/Amiga specific support was done by Ignatios Souvatzis, - (is@netbsd.org). - -NetBSD/Atari: -------------- - The NetBSD/Atari specific support was done by Leo Weppelman, - (leo@netbsd.org). - -NetBSD/Alpha: -------------- - This port is still experimental! - - The NetBSD/Alpha specific support was done by Jan-Hinrich Fessel, - (oskar@zippo.unna.ping.de) - -OpenBSD/i386: -------------- - Nikolay Sturm (sturm@physik.rwth-aachen.de) sent in patches to - support OpenBSD/i386 2.6, they are still experimental and since - i don't run OpenBSD i have no idea on the state of affairs. - -BSD/OS: -------- - The BSD/OS 4.0 specific support was done by Bert Driehuis. The - support is not yet complete. Please contact Bert directly in case - of questions regarding this at driehuis@playbeing.org. - - -4. Which ISDN cards are supported ? ------------------------------------ - - For a list of supported ISDN cards, please have a look at - the file "SupportedCards". - - Please have a look at the ReleaseNotes file ! - - -5. Where do i find documentation for isdn4bsd ? ------------------------------------------------ - -- in case you are upgrading from previous versions of isdn4bsd, have a - look at the ReleaseNotes file in the top level directory for major - changes and improvements. - -- For installation instructions have a look at the isdn4bsd handbook - available online at http://people.freebsd.org/~hm/i4b-home/ - -- isdn4bsd has a homepage at http://www.freebsd-support.de/i4b/ where i - will try to maintain links to docs, updates and errata. - -- Every program and every driver has a man page. - Hint: try "apropos isdn4bsd", it displays all available manual pages. - -- The file Overview contains a short technical overview of the inner - workings of isdn4bsd. - -- The file Resources contains URL's and ISBN's to more interesting ISDN - related stuff. - - -6. How do i install isdn4bsd ? ------------------------------- - -Read the installation instructions in the isdn4bsd handbook which is -available online at http://people.freebsd.org/~hm/i4b-home/ - -In case they are incomplete, unclear, wrong or outdated, please send me an -update for inclusion into a future distribution! - - -7. Where do i get support for isdn4bsd ? ----------------------------------------- - -Please send all questions regarding the installation, configuration -and setup of isdn4bsd to the isdn4bsd mailing list (see below). - -Please do not send me private mail asking for help with the installation, -configuration and setup of isdn4bsd: due to the amount of mail of this -type i'm no longer able to reply to those mails. - -Before sending mail asking for help, PLEASE (!) read the supplied -documentation, the examples, the handbook, the manual pages and the FAQ ! - -I will support and help with isdn4bsd as my time permits it. Please -keep in mind that in this case support is given on a voluntary basis -and your questions might not be answered immediately. - -Also, i strongly recommend subscribing to the mailing list mentioned below. - -Due to the experience gained supporting the predecessor of isdn4bsd, let -me please clearly state that there is no guarantee that your bug will be -fixed within some specific amount of time, in fact there is no guarantee -that your bug will be fixed at all; i'll do my best but there might be -more important things going on in my life than giving free support for -isdn4bsd. - -Some bugs seem to occur only in certain environments and are not -reproduceable here without access to the equipment you are connected -to or other equipment like ISDN simulators (which i don't get access to -for free): in this case you are the only person being able to trace down -the bug and fix it. - -There is a web page for i4b at http://www.freebsd-support.de/i4b/ available -where i will put bugfixes, updates and contributions. In particular it has -an "errata" page, where you should look in case you have problems with i4b. - - -8. Where do i get commercial support for isdn4bsd ? ----------------------------------------------------- - -In case you want to pay for support, maintenance, enhancements, extensions -to isdn4bsd or whatever else you may need, it is possible to hire me for -reasonable rates through my employer HCS GmbH; in this case please contact -me for details at hm@hcs.de and/or look at http://www.freebsd-support.de - - -9. How can i help and/or support isdn4bsd ? -------------------------------------------- - -Send a postcard! :-) - -I'm open for constructive suggestions, bugreports, fixes, patches, -enhancements and comments to improve isdn4bsd. - -Please send all questions regarding the installation, configuration -and setup of isdn4bsd to the isdn4bsd mailing list. - -Please send flames to /dev/null and/or start writing your own ISDN package. - -Isdn4bsd is a project on a voluntary basis and writing and supporting -communication systems like isdn4bsd costs much money and much time. - -Any contribution in terms of equipment, cards, documentation, cash -and/or daytime payed work on isdn4bsd will be highly appreciated! - -You can help by not only reporting bugs, but by sending in a patch for -the problem together with a bugreport. - -In case you cannot fix something yourself, please describe your problem -as detailed as possible, include information which version of an operating -system you are running, which ISDN board you are using, to which kind -of ISDN equipment (like the brand of PBX) you are connected etc. etc. - -In case you want to get a currently unsupported card supported, write a -low level driver for it yourself and submit it. In case you can't write -it yourself there is a good chance to get it supported if you can donate -one of those cards and - if at all possible - docs for it. - - -10. How do i report bugs ? --------------------------- - -Please submit patches ONLY as context diffs (diff -c)! - -I vastly prefer receiving bug fixes and enhancements that are clearly -differentiated. I don't always know what to do with large patches that -contain many bugs and enhances folded into the same context diffs. - -Please keep it to one fix or enhancement per patch! - -If your change modifies the external interface of an isdn4bsd program, -i.e. more config options, command-line switches, new programs, etc., -then please also include patches for the manual pages and documentation. - -Thank you! - - -11. Is there a mailing-list available for isdn4bsd ? ---------------------------------------------------- - -There is a mailing list available at - - freebsd-isdn@freebsd.org - -The list is maintained by majordomo, so i.e. to subscribe, -send a mail with the text - - subscribe freebsd-isdn - -in the message body sent to - - majordomo@freebsd.org - -This mailing list is NOT (!) FreeBSD specific, everyone is welcome there! - - -12. Where can i get isdn4bsd ? ------------------------------- - -The isdn4bsd package is part of FreeBSD since FreeBSD 3.0-RELEASE so you -get isdn4bsd where you can get FreeBSD: http://www.freebsd.org - -Isdn4bsd has its own homepage at - - http://www.freebsd-support.de/i4b/ - - - -13. What is the reward for reading everything in this file ? ------------------------------------------------------------- - -Have fun! -hellmuth diff --git a/share/examples/isdn/ROADMAP b/share/examples/isdn/ROADMAP deleted file mode 100644 index 33cc055b5125..000000000000 --- a/share/examples/isdn/ROADMAP +++ /dev/null @@ -1,86 +0,0 @@ - - Roadmap of isdn4bsd as integrated into FreeBSD - ============================================== - - $FreeBSD$ - - last edit-date: [Mon Aug 12 09:42:53 2002] - - -1. Documentation ---------------------- - - The i4b handbook which describes the setup and configuration of - isdn4bsd under FreeBSD in detail can be found at - http://people.freebsd.org/~hm/i4b-home/ - - The i4b homepage is http://www.freebsd-support.de/i4b/ - - The command "apropos isdn" will list all manpages available for - isdn4bsd. Two more manual pages of interest to syncronous PPP - over ISDN users are the pages for sppp and ispppcontrol. - - Under directory /usr/share/examples/isdn, you will find: - - FAQ - isdn4bsd Frequently Asked Questions - KERNEL - kernel config(8) file fragment to add ISDN support - Overview - short technical overview (outdated) - README - the original isdn4bsd README file - ROADMAP - this file - ReleaseNotes - list of major changes - Resources - where to get more information about ISDN - SupportedCards - list of supported ISDN cards - ThankYou - contributors to isdn4bsd - - contrib - contributed examples and code - v21 - V.21 (300Bd) soft modem emulator - - -2. Configuration ---------------------- - - Configuration of the isdn4bsd package consists of: - - - configuring a kernel suitable for running isdn4bsd. All - kernel configuration statements for isdn4bsd can be found - in the file /usr/src/sys/i386/conf/NOTES - another way to - get started is taking the GENERIC configuration file and - appending the KERNEL file mentioned above. - - - configuring the network interfaces iprX and/or ispX; the - former are used for "IP over raw HDLC" and the latter are - used for "sync PPP over ISDN". To configure the ipr- - interfaces, read the output of "man i4bipr", to configure - the isp-interfaces, read the output of "man i4bisppp", - "man sppp" and "man ispppcontrol" carefully. - - - writing a configuration file /etc/isdn/isdnd.rc for the - isdn daemon isdnd(8) which is responsible for the ISDN - call control mechanisms such as: dial on demand, dial - retry, dial recovery, timeout and short hold operation. - A sample (!) file can be found in /etc/isdn. Please read - the output of "man isdnd" and "man isdnd.rc" carefully. - - -2. Userland programs -------------------------- - - The userland programs can be found in the sourcetree under - /usr/src/usr.sbin/i4b and get installed under /usr/sbin. - - Isdntest will not be installed by default. - Isdnphone is experimental and may not run with your soundcard. - - -3. Kernel part -------------------- - - The kernel part of isdn4bsd can be found at /usr/src/sys/i4b. - - -4. Answering machine messages ----------------------------------- - - Messages to be used by the answering machine can be found in - /usr/share/isdn, you'll find the numbers 0 to 9, a beep and - a short announcement message here. diff --git a/share/examples/isdn/ReleaseNotes b/share/examples/isdn/ReleaseNotes deleted file mode 100644 index cf93e6559113..000000000000 --- a/share/examples/isdn/ReleaseNotes +++ /dev/null @@ -1,196 +0,0 @@ -$FreeBSD$ - -ReleaseNotes for isdn4bsd last edit-date: [Mon Aug 12 09:47:59 2002] -================================================================================ - -release 1.04 --------------------------------------------------------------------------------- - -- add support properly displaying and logging incoming telephone numbers (MSNs) - by looking at the "type of number" field and providing configurable hooks - to correct the numbers accordingly. See keywords add-prefix, prefix-national - and prefix-international in isdnd.rc(5). - This feature was implemented by Christian Ullrich - -release 1.03 --------------------------------------------------------------------------------- - -- add support for Data over Voice (DoV) outgoing calls, see entry keywork - bcap in isdnd.rc(5). - based on patches received from Guy Ellis (guy@traverse.com.au), - Chris Collins (xfire@xware.cx) and Phillip Musumeci (phillip@cs.jcu.edu.au). - -release 1.02 --------------------------------------------------------------------------------- - -- add support for ISDN subaddressing written by Steve Looman - -- made ELSA PCC16 attach correctly (again ?) - -- fixed bug in CAPI support (patch from Juha-Matti Liukkonen ) - -- add support written by Steve Looman for the Compaq Microcom 610 ISDN card - (also known as Compaq series PSB2222I). - -release 1.01 --------------------------------------------------------------------------------- - - - add experimental support to send messages via the keypad facility to the - PBX or exchange office. The messages - if supported - may be used to - configure and maintain optional services offered by the PBX or exchange - office such as call deflection mailbox services. Please consult the - nice documentation for the exchange you are connected to. - - Currently keypad messages can be send by using the isdnphone utilities - "-k" switch on the command line. Don't forget to properly quote the - message in case it contains shell meta characters! - - - add keyword "maxconnecttime" to isdnd to prevent a potential telco bill - desaster. Caution: use only in conjunction with budgets to limit the number - of dials per timeunit otherwise you will get endless redials and reconnects! - -release 1.00 --------------------------------------------------------------------------------- - - - CAPI interface driver and AVM B1/T1 driver added. Both were written and - contributed by Juha-Matti Liukkonen of Cubical Solutions - Ltd, Finnland. To support this, two new keywords were added to isdnd.rc: - "firmware" to be used in the controller section and "clone" to be used - in the entry section. - - -beta release 0.96 --------------------------------------------------------------------------------- - - - it is now possible to mark an entry as valid for a specified day of week - and a specific time range only to take advantage of some new tariff models. - Please see the new keywords "valid" and "holidayfile" in isdnd.rc(5). - This feature is considered experimental, use at your own risk! - - - keywords budget-callbacksfile and budget-calloutsfile added to isdnd's - entry section to write statistics information to a file - - - a driver for the Dynalink IS64PH is now available for FreeBSD 4.x and up - - -beta release 0.95 --------------------------------------------------------------------------------- - - - ITK ix1 micro ISA non-PnP card should now work for FreeBSD >= 4.0 - - - setting "dialretries = -1" in isdnd.rc gives an unlimited number - of dial retries for that entry. - - - the ELSA PCFpro ISDN card should now work for FreeBSD >= 4.0 - - - added new keywords (patch from Stefan Esser) to configure isppp - from within isdnd.rc. Documented in isdnd.rc(5), grep for "ppp-" - - - isppp VJ compression negotiation now run-time configurable using - keywords "enable-vj" / "disable-vj" with ispppcontrol - - - added new keywords to specify "budgets" for outbound calls in isdnd - to limit the number of possible calls within a given time period. - Runtime budget information and statistics are available in the isdnd - fullscreen menu display. - - - added new "ifpnp" AVM Fritz!Card PnP driver for FreeBSD >= 4.0 - contributed by Udo Schweigert. - - - added experimental hardware driver from Hans Petter Selasky for the - Teles 16.3c card based on the Cologne Chip Designs HFC-S 2BDS0 chip - called "ihfc". - notes for Teles 16.3c PnP and AcerISDN P10: For optimal performance: - -> please connect the card to the S0-bus before booting the computer. - -> do not change the cable you're using when first booted. - Other notes if the card does not work at all: - -> disconnect other isdn equipment on your S0-bus and - reboot your computer. - -> try changing the CLKDEL/stdel value for your card: - ../i4b/layer1-nb/ihfc/i4b_ihfc_pnp.c or - ../i4b/layer1/ihfc/i4b_ihfc_pnp.c - around line 100. The value can be in the range 0x0-0xf. - - - the FreeBSD >= 4.0 AVM Fritz PCI driver was moved to a separate layer 1 - driver called "ifpi". - - - the sppp subsystem was integrated into the i4bisppp/isp driver. There - is no need to include something like "option sppp" into your kernel - config file anymore. The spppcontrol utility is no longer usable to - configure the i4bisppp/isp driver, instead use the new ispppcontrol - utility! - - - FreeBSD >= 4.0: "iwic" driver for Winbond PCI ISDN chipset (W6692) - added, used i.e. in ASUSCOM P-IN100-ST-D and Dynalink IS64PPH. - - - added more protocol decoding to isdntrace - - - isntrace now adds a time/datestamp to the trace filename, signal USR1 - behaviour has changed, see manpage. - - - ispppcontrol now has a new option of setting the LCP timeout value - - - add directory mpd which contains docs and files on howto interface - i4b by using the netgraph subsystem to the multilink ppp daemon, mpd. - - - add i4bing, a raw HDLC B-channel interface to the NetGraph subsystem - - - add a V.21 modem emulator written by Poul-Henning Kamp - - - a new system configuration keyword "extcallattr" was added to isdnd - which allows to configure the display of the extended caller - attributes "screening indicator" and "presentation indicator" in - isdnd's log file. - - -beta release 0.90 --------------------------------------------------------------------------------- - - - the following cards are no longer supported for FreeBSD 4.0 and up: - - AVM Fritz!Card PnP - AVM Fritz!Card PCMCIA - Dynalink IS64PH - ITK ix1 Micro - USRobotics Sportster ISDN TA intern - - The AVM cards, the USR card and perhaps one of the ITK cards are likely - to be resurrected in the future, we just ran out of time, docs and/or - into programming problems for this release. - - - the rbch driver was enhanced to support the generation of accounting - information in HDLC mode. The bytecount and bps fields in isdnd - fullscreen mode now show meaningful information. - - - most of the layer1 drivers have been rewritten to support the new bus - and driver architecture for FreeBSD 4.0. - - - the ipr interfaces now support logging of some of the first ip packets - of a new connection and displaying them in the isdnd logs. To enable - this, add a line like: "options IPR_LOG=32" to your kernel config - file. The parameter to IPR_LOG specifies the number of packets to be - logged. - - - support for FreeBSD 2.x and FreeBSD 3.0-RELEASE has been removed. - The last beta release which supports this OS versions is i4b-0.83. - - - isdnd now recognizes two new keywords in the system section, mailto - and mailer. mailer is used to configure a mail program and is typically - set to /usr/bin/mail and mailto is set to the address of the isdnd - administrator. If both are set and a fatal error inside isdnd - happenes, mail is sent to the address in mailto with the error - message before isdnd terminates. - - - isdnd.rc now has an optional new "controller" section. This will be - used to specify different D-channel protocols in the future. It looks - like this: - - controller - protocol = dss1 # dss1 (default) or d64s (leased line) - - Please note that leased line support (d64s) is NOT yet functional! - - - isdnmonitor is now able to be used like isdnd in fullscreen mode from - a remote machine. - -EOF diff --git a/share/examples/isdn/Resources b/share/examples/isdn/Resources deleted file mode 100644 index c26aec0927fc..000000000000 --- a/share/examples/isdn/Resources +++ /dev/null @@ -1,82 +0,0 @@ -$FreeBSD$ - - -Bugfixes, improvements and patches for i4b -========================================== - - http://www.freebsd-support.de/i4b/ (in the "errata" section) - - -Standards: -========== - - ETSI - ---- - http://www.etsi.org/ - - ITU - --- - http://www.itu.ch/ - - ftp://ftp.leo.org/pub/comp/doc/standards/itu/ - - CAPI - ---- - http://www.capi.org/ - - -ISDN Chips -========== - - Infineon (formerly Siemens) - --------------------------- - http://www.infineon.com/ - - Cologne Chip Design - ------------------- - http://www.colognechip.de/ - - Winbond - ------- - http://www.winbond.com/ - - -SunShine Project - Implementation of the ISDN recommendations Q.921 & Q.931 -=========================================================================== - - http://www.tcm.hut.fi/~bos/ISDN/sunshine/SunShine.html - -Books: -====== - - "ISDN: concepts, facilities and services", - Gary C. Kessler, McGraw-Hill 1993, - ISBN 0-07-034247-4 - - "Integrated services digital networks: architectures, protocols, standards", - Herman J. Helgert, Addison-Wesley 1991, - ISBN 0-201-52501-1 - - "ISDN and Broadband ISDN with Frame Relay and ATM", - William Stallings, Prentice Hall 1995, - ISBN 0-02-415513-6 - - "Technik der Netze", - Gerd Siegmund, R. v. Decker's Verlag 1996, - ISBN 3-7685-2495-7 - - "Euro-ISDN fuer Anwender und Techniker" - Reinhard Heermeyer und Maria Spath, Festo DIDACTIC 1996, - ISBN 3-8127-4334-5 - - "ISDN implementors guide: standards, protocols & services", - Charles K. Summers, McGraw-Hill 1995, - ISBN 0-07-069416-8 - - "PPP Design and Debugging", - James Carlson, Addison-Wesley 1998, - ISBN 0-0201-18539-3 - - "ISDN - Die Technik", - Andreas Kanbach, Andreas Koerber, Huethig Verlag 1999, - ISBN 3-7785-2288-4 diff --git a/share/examples/isdn/SupportedCards b/share/examples/isdn/SupportedCards deleted file mode 100644 index 1c470021c027..000000000000 --- a/share/examples/isdn/SupportedCards +++ /dev/null @@ -1,196 +0,0 @@ --------------------------------------------------------------------------------- - - ISDN cards supported by isdn4bsd in FreeBSD - =========================================== - - last edit-date: [Sun Oct 21 11:09:24 2001] - - $FreeBSD$ - --------------------------------------------------------------------------------- - - YES - card is generally supported for this OS - NO - card is NOT supported for this OS - EXP - card is in an experimental status for this OS - DEV - card driver is under development - ??? - card status is unknown for this OS - - -1. Passive non-PnP ISA bus ISDN cards -===================================== - - Type FreeBSD Notes - --------------------- ------- ----------------------- - AVM A1 YES - AVM Fritz!CardClassic YES - Creatix ISDN-S0/8 YES (= Teles S0/8 ) - Creatix ISDN-S0/16 YES ( = Teles S0/16 ) - Dr.Neuhaus Niccy 1008 YES ( = Teles S0/8 ) - Dr.Neuhaus Niccy 1016 YES ( = Teles S0/16 ) - ELSA PCC-16 YES - ELSA PCFpro YES - ITK ix1 micro YES (Note 13) - Stollmann Tina-pp YES - Teles S0/8 YES - Teles S0/16 YES - Teles S0/16.3 YES - 3Com/USR SportsterInt YES ( = Stollmann Tina-pp ) - TELEINT ISDN SPEED EXP (Note 4) - - -2. Passive PnP ISA bus ISDN cards -================================= - - Type FreeBSD Notes - --------------------- ------- ----------------------- - AVM Fritz!Card PnP YES (Note 1) - Asuscom I-IN100-ST-DV ??? ( = Dynalink IS64PH ) - Asuscom ISDNlink 128K YES (Note 16) - Creatix ISDN-S0 PnP YES (Note 2) - Dr.Neuhaus Niccy GO@ YES (Note 2) - Dynalink IS64PH YES (Note 11) - ELSA 1000pro ISA YES (Note 3) - ITK ix1 micro V.3 YES (Note 13) - Sagem Cybermod YES (= Niccy GO@ ) - Sedlbauer Win Speed YES (Note 9) - Siemens I-Surf 2.0 YES (Note 15) - Teles S0 PnP YES (Note 5) - Teles 16.3c EXP (Note 4) - AcerISDN P10 EXP (Note 4) - Compaq Microcom 610 YES ( = Compaq series PSB2222I ?) - - -3. Passive PCI bus ISDN cards -============================= - - Type FreeBSD Notes - --------------------- ------- ----------------------- - ASUSCOM P-IN100-ST-D YES - AVM Fritz!Card PCI YES (Note 14) - AVM Fritz!Card PCI V2 YES (Note 14) - Dynalink IS64PPH YES - Dynalink IS64PPH+ YES - ELSA 1000pro PCI YES ( = ELSA Microlink PCI ) - Teles PCI-TJ YES - NETJet-S YES - Winbond W6692-based YES - - -4. Passive PCMCIA bus ISDN cards -================================ - - Type FreeBSD Notes - --------------------- ------- ----------------------- - AVM Fritz!Card PCMCIA NO (Note 10) - ELSA ISDN/MC NO - ELSA MC/ALL NO - - -5. Passive Zorro2 ISDN cards for the Amiga -========================================== - - Type FreeBSD Notes - --------------------- ------- ----------------------- - ISDN Blaster NO (Note 12, Amiga/NetBSD) - ISDN Master NO (Note 12, Amiga/NetBSD) - ISDN Master II NO (Note 12, Amiga/NetBSD) - - -6. Active ISDN cards -==================== - - Type (active, ISA) FreeBSD Notes - --------------------- ------- ----------------------- - AVM B1 YES (Note 17) - AVM T1 YES (Note 18) - DiehlS,SX,SCOM,QUATRO NO (Note 7) - Miro P1 DEV ( = Tina-dd ) - Stollmann Tina-dd DEV (Note 8) - - -7. Notes -======== - - -Note 1: The driver for the Fritz!Card PnP was developed by Udo Schweigert - (ust@cert.siemens.de) who develops under FreeBSD only. - Please contact Udo in case of trouble. - -Note 2: The NetBSD version has not been verified to work yet. - -Note 3: Due to its design, this card produces 128 IRQs/sec. This can be - reportedly stopped by disconnecting pin 12 of the 7474 and wiring - it to pin 15 of the 74175. Be careful! This procedure has not been - verified and doing this will immediately terminate your warranty !! - The card will not function anymore with drivers for other OSes and - you may not get any further support from the manufacturer! YMMV! - -Note 4: This driver was developed by Hans Petter Selasky, hselasky@c2i.net - The code is still somewhat experimental. - -Note 5: The card has only been verified to work under FreeBSD 4.0 and up. - -Note 6: This driver is currently under development by Gary Jennejohn who - develops under FreeBSD only. - -Note 7: This driver is currently under construction by Martin Husemann who - develops under NetBSD only. - -Note 8: This driver is currently under development by Hellmuth Michaelis who - develops under FreeBSD only. - -Note 9: This driver was developed by German Tischler, tanis@gaspode.franken.de. - Please contact him in case of trouble. The "Teledat 100" sold by the - german Telekom is identical with this card. - -Note 10: This driver is developed by Matthias Apitz, matthias.apitz@sisis.de. - Please contact him in case of trouble. Please read the file - misc/README.PCCARD in the i4b distribution for additional installation - instructions. - -Note 11: This driver was developed by Martijn Plak (martijn@be3.com) - This driver might also work for Asuscom cards. (Andrew Gordon - wrote: Just to let you know that I've now tried the i4b "dynalink" - driver with the ASUSCOM I-IN100-ST-DV card, and it appears to work - fine.) - - Note: This driver is now unsupported as Martijn is no longer able - to maintain this driver. - - The BSD/OS support for this card was written by Bert Driehuis. - - Ported to FreeBSD newbus by Kazunori Fujiwara - -Note 12: This driver was developed by Ignatios Souvatzis (is@netbsd.org) - Please contact him in case of trouble. - This driver is supposed to work on the ISDN Master versions and - lookalikes, like the ISDN Blaster, and on the ISDN Master II. - Note that the ISDN Master II does not AutoConfig(tm)ure in the - DraCo Zorro bus and thus only works in real Amigas. This is no - i4b problem, but general. - -Note 13: This driver was developed by Martin Husemann, please contact him - in case of trouble. The FreeBSD PnP support for version 3 of the - card was done by Philippe Guezou . - -Note 14: This driver was developed by Gary Jennejohn who develops under - FreeBSD only. In case of problems with this driver, please contact - him directly at garyj@jennejohn.org. - -Note 15: The driver for the Siemens I-Surf 2.0 was developed by Udo Schweigert - (ust@cert.siemens.de) who develops under FreeBSD only. - Please contact Udo in case of trouble. - -Note 16: The driver for the Asuscom ISDNlink 128K PnP was developed by - Ari Suutari (ari@suutari.iki.fi). Please contact Ari directly - in case of trouble with this driver. - -Note 17: The driver was written by Juha-Matti Liukkonen , - Cubical Solutions Ltd. I have tested it with an AVM B1 PCI card - V.4.0 and an AVM B1 ISA card V.2.0. - -Note 18: The driver was written by Juha-Matti Liukkonen , - Cubical Solutions Ltd. I have no access to any PRI equipment at - all so i have not tested the driver, feedback welcome! - -EOF diff --git a/share/examples/isdn/ThankYou b/share/examples/isdn/ThankYou deleted file mode 100644 index 3ad4cb06c55d..000000000000 --- a/share/examples/isdn/ThankYou +++ /dev/null @@ -1,289 +0,0 @@ -$FreeBSD$ - -Thanks a lot for postcards from: --------------------------------- - - Aachen - Arnhem - Arolsen - Bad Rothenfelde - Berlin - Birenbach - Bochum - Bohnsdorf - Bonn - Bornheim - Braunschweig - Darmstadt - Delft - Dresden - Eggstaett am Hartsee - Flekkefjord - Freiburg - Habichtswald - Hamburg (2) - Ihlow - Jena - Kassel - Koengen - Kymgbuk, Korea - Landsberg - Leiden - Magdeburg - Mauerbach - Mersch - Middelburg - Mosi-Oa-Tunya - Muenchen (4) - Netherlands (Leo) - Netherlands (Peter) - Rio de Janeiro - Saint-Gilles-Croix-de-Vie - Scheessel - Siena, Italy - St. Jacob - Stuttgart - Travemuende - Vedskoelle, Danmark - Windach - Wuerzburg - Zuberec - - -I would like to thank the following people and organisations: -------------------------------------------------------------- - -Gary Jennejohn for his constant kind support while writing isdn4bsd - during that year. Gary always runs the latest and - greatest FreeBSD-current and makes isdn4bsd run - there, if his root fs is intact, of course! :-). - In February 1999, Gary contributed the AVM Fritz! - Card PCI driver to isdn4bsd. - -Martin Husemann is a major contributor to isdn4bsd. He wrote almost - all of the NetBSD support for isdn4bsd, the monitor - network code and the Diehl driver. He constantly - tries put strange macros into i4b ... ;-) - -Serge Vakulenko for writing the sppp driver and making it freely - available. - -Joerg Wunsch for adapting the synchronous PPP stuff to i4b. - Gary finished this and integrated the PPP stuff into - current isdn4bsd. - -Wolfgang Helbig for many patches, polishing isdn4bsd and layer 1 - debugging. - -Thomas Halenbeck and -Stephan Forth of FORTH EDV in Mainz donated two AVM A1 card and - one AVM B1 card to support the development and - maintenance of drivers for this cards. Thomas donated - three more AVM A1 cards in the meantime - Thank you! - -Arne Helme for the initial work on how to support IOM-2 based - boards. - -Andrew Gordon for disassembling an old AVM A1 and documenting it. - Andrew added VJ header compression to the ipr interface - and is a constant source of various hints and - suggestions :-) - Andrew sent in a Teles S0/16 PnP for FreeBSD newbus - conversion, thanks a lot! - -Juergen Krause and someone who does not want to be mentioned anymore - for the work on the first ISDN package for FreeBSD. - -Michael Elbel for supporting the development with ftp/www/mail - resources. - -Leo Weppelman for the port to the NetBSD/Atari platform. - -Bas Oude Nijeweme for the port to OpenBSD/i386 2.2. - -German Tischler for the driver for the Sedlbauer WinSpeed card, - for the PnP support for FreeBSD and for constant - testing and contributions. German did the initial - mostly complete conversion of the layer1 code - to the FreeBSD 4.0 new-bus driver architecture! - -Matthias Apitz for the driver for the AVM PCMCIA Fritz!Card. - -Martijn Plak for the Dynalink driver. - -Ignatios Souvatzis for the NetBSD/Amiga port and associated driver(s). - -Christoph Weber-Fahr donated an AVM B1 card to support development of a - driver. Thanks a lot, Christoph! - -Eivind Eklund for the PnP support for FreeBSD, for __FreeBSD_version - and more. - -Karsten Keil author of the hisax isdn4linux driver for some details - about the one or the other piece of hardware. - -Bert Driehuis for the support of the BSDI BSD/OS 4.0 operating system - -Barry Scott for fixed charging units shorthold mode support (as - used in the UK by British Telecom). - -Poul-Henning Kamp for the work on DTMF decoding and many hints, fixes - and suggestions. - -Stefan Bethke for the work on the audio format conversion stuff in - the telephony paths. - -Udo Schweigert for PCMCIA support and work on FreeBSD 2.2x - compatibility. Udo contributed the AVM Fritz PnP - and the Siemens I-Surf V2.0 driver. - -Ernst Winter donated a Fritz!Card PCI which was used to develop - and test the driver. - -Harald Frank long-term loan of an ISDN Blaster board. - -Klaus Burkert for a loan of an ISDN Master II. - -Ari Suutari for a driver for the Asuscom ISDNlink ISA PnP card - -Brian Somers for working on making userland ppp work with i4b - -Rune Knapstad for good help with the port to OpenBSD/i386 2.5 - -Uwe Laverenz for the donation of an ELSA PCC-16 card - -Luke Roberts for the long time loan a Dynalink ISDN intern PCI card - -Marc van Kempen for the donation of a Dynalink ISDN intern PCI card - -Christoph Kukulies for the donation of an ITK ix1 card - -Nikolay Sturm sent in patches to get OpenBSD 2.6 supported. - -Dave Boyce wrote a driver for the Winbond W6692 PCI ISDN - chip which eventually lead to a layer 1 reorg. - -Hans Petter Selasky for his contribution of a driver for the - Teles 16.3c card (and the complete ihfc driver). - -Sergio de Souza Prallon for the contribution of the itjc driver which - supports the NETJet-S and the Teles PCI-TJ cards - -Steve Looman for the driver for a Compaq Microcom 610 ISDN card - and for the subaddressing implementation - -Christian Ullrich for the "type of number" patchset - - - ------------------------------------------ - - -Liebscher & Partner Martin Welk and Holm Tiffe sent in a motivating - BSD daemon plushie :-) - -Abaid Andreas Mutschlechner of Abaid, Alte Strasse 2, in - I-39017 Schenna (BZ) donated money to support i4b - development, which was used to upgrade my main test - machine for isdn4bsd from an 486 to a Pentium II. - Thank you very, very much, Andreas ! - -3Com USRobotics Christian Weissgerber of 3Com USRobotics in Munich - donated a passive "Sportster ISDN TA intern" ISDN - card and complete hardware documentation for the card. - - Florian Uhl of 3Com in Munich donated two MC68SC302 - "3Com U.S.Robotics ISDN Card PnP internal" cards and - documentation to support writing a driver for this - card. - -Dr. Neuhaus Klaus Muehle of Dr. Neuhaus Telekommunikation in - Hamburg sent documentation for the NICCY GO@ and - NICCY EASY@ ISDN cards to support development of - a driver for this cards. - -Stollmann Many thanks to Christian Luehrs and Manfred Jung - for giving out docs and sources to support the - driver development for the tina-dd active card. - -ELSA Axel Riemer of ELSA AG in Aachen donated several - ISA, PCI and PC-Card ISDN boards to three developers - and provided support and documentation to help with - adding support to i4b for this hardware. Werner Fehr - of ELSA answered our technical questions and gave - valuable hints. Thanks also to Andreas Klemm for - making the contact ;-) - -Cologne Chip Design Harald Schaefer of Cologne Chip Design send in a - HFC-S-PCI developer card, complete docs and - layer 1 example code to support the development - of a driver for that chipset! Thanks a lot! - -ASUSCOM Network Inc. Mr. Ben Chen of Asuscom sent a Winbond based PCI - card and a Cologne Chip Design based PCI card to - support the development of device drivers. - -Cubical Solutions Ltd. Juha-Matti Liukkonen of Cubical - contributed the CAPI layer and the AVM B1/T1 device - driver to isdn4bsd. - -AVM GmbH Mr. A. Ziessnitz of AVM donated an AVM B1 PCI cards - to support development and maintenance of a driver - for this card. - -Intelligent Network Technology Ltd. - David Hedley provided an AVM Fritz!Card PCI Version 2 - controller to support development of a driver. - - - -The following people contributed in one or the other way to isdn4bsd: ---------------------------------------------------------------------- - - Alexander Langer - Andreas Haakh - Andreas Lohrum - Arve Ronning - Aurelien Bargy - Bart van Leeuwen - Caspar Schlegel - Chris Collins - Christian Wolf - Christoph Kukulies - Daniel Rock - David Wetzel - Dirk Meyer - Doobee R. Tzeck - Dominik Brettnacher - Gabor Dolla - Guy Ellis - H. Eckert - Hans Huebner - Harald Hanche-Olsen - Harold Gutch - Heiko Schaefer - Jan Sparud - Joachim Kuebart - Joakim Hernberg - Juha-Matti Liukkonen - Julian H. Stacey - Kazunori Fujiwara - Lars Koeller - Malte Lance - Marcel Moolenaar - Martin Recktenwald - Meike Aulbach - Michael Hohmuth - Michael Ranner - Michael Reifenberg - Nils Ulltveit-Moe - Paul Herman - Paul Sijben - Phillip Musumeci - Philippe Guezou - Rob Pickering - Stefan Esser - Stefan Herrmann - Steven Looman - Wolfgang Solfrank - -(In case i forgot someone, please tell me!) diff --git a/share/examples/isdn/contrib/README b/share/examples/isdn/contrib/README deleted file mode 100644 index ae5969f09e84..000000000000 --- a/share/examples/isdn/contrib/README +++ /dev/null @@ -1,42 +0,0 @@ -$FreeBSD$ - -This directory contains various unsupported contributions to isdn4bsd ---------------------------------------------------------------------- - -anleitung.ppp Anleitung für syncPPP Internet-Zugang und - Anrufbeantworter / FreeBSD 2.2.x / Teles.S0/16.3-Karte - (stefan@asterix.webaffairs.net) - -answer.c answering machine in C by David Wetzel - (dave@turbocat.de) - -answer.sh a much better replacement for answer, tell and record - from Stefan Esser (se@freebsd.org) - -convert.sh convert recorded message to WAV format, optionally - send it via mail. from Stefan Herrmann - (stefan@asterix.webaffairs.net) - -hplay.c isdn4bsd telephony output driver for the "rsynth" - package to play synthetic speech to a telephone - connection - -i4b-ppp-newbie.txt setup PPP for isdn4bsd for newbies text from - Dominik Brettnacher (german) - -isdnctl This script can control the state of your ISDN line. - It counts how many scripts/users currently use the - ISDN line and uses "ifconfig down" if noone uses it - any more. Alexander Langer - -isdnd_acct the barebones isdnd accounting script - -isdnd_acct.pl enhanced accounting from Joachim Kuebart - (joki@kuebart.stuttgart.netsurf.de) - -isdntelmux.c a "record while play" program contributed by - Michael Reifenberger (Michael@Reifenberger.com) - -mrtg-isp0.sh shell script and mrtg config entry to display - callout and callback statistics with mrtg - (www.mrtg.org) using the budget file statistics diff --git a/share/examples/isdn/contrib/anleitung.ppp b/share/examples/isdn/contrib/anleitung.ppp deleted file mode 100644 index 01466e2f4880..000000000000 --- a/share/examples/isdn/contrib/anleitung.ppp +++ /dev/null @@ -1,142 +0,0 @@ -$FreeBSD$ - -i4b Anleitung für syncPPP Internet-Zugang und Anrufbeantworter -unter FreeBSD 2.2.x mit Teles.S0/16.3-Karte -=============================================================== - -by Stefan Herrmann - - -Installation ------------- -1) Neues Verzeichnis "/usr/src/i4b" anlegen. - -2) Ins Verzeichnis "/usr/src/i4b" wechseln und Sourcen entpacken. - -3) Ins Verzeichnis "FreeBSD" wechseln und den Befehl "sh install.sh ausführen: - z.B. "root@asterix[0]/usr/src/i4b/FreeBSD # sh install.sh" - - Wenn auf eine neuere Version von i4b gewechselt wird, zuerst - "sh uninstall.sh" ausführen, dann erst "sh install.sh" - -4) Dann ins Verzeichnis "/usr/src/i4b" (zurück-)wechseln und die Befehle - "make depend", "make" und "make install" ausführen. - -5) Nun muß der kernel mit neuen Optionen versehen werden. Dazu wird an die - Kernel-Konfigurationsdatei im Verzeichnis "/sys/i386/conf" folgendes ans - Ende hinzugefügt: - -# i4b passive ISDN cards support (isic - I4b Siemens Isdn Chipset driver) -# note that the ``options'' and ``device'' lines must BOTH be defined ! - -# Teles S0/16.3 -options "TEL_S0_16_3" -device isic0 at isa? port 0xd80 net irq 5 flags 0x04 vector isicintr - -# i4b passive cards D channel handling -# Q.921 -pseudo-device "i4bq921" -# Q.931 -pseudo-device "i4bq931" - -# common passive and active layer 4 -# layer 4 -pseudo-device "i4b" - -# userland driver to do ISDN tracing (for passive cards oly) -pseudo-device "i4btrc" 4 -# userland driver to control the whole thing -pseudo-device "i4bctl" -# userland driver for access to raw B channel -pseudo-device "i4brbch" 4 -# userland driver for telephony -pseudo-device "i4btel" 2 -# network driver for IP over raw HDLC ISDN -pseudo-device "i4bipr" 4 -# enable VJ header compression detection for ipr i/f -options IPR_VJ -# network driver for sync PPP over ISDN -pseudo-device "i4bisppp" 4 -pseudo-device sppp 4 - -6) Danach wird der kernel durch Eingabe der Befehle "make depend", "make" und - "make install" im Verzeichniss "/usr/src/sys/compile/" neu - übersetzt und installiert. - -7) Nach dem Booten kann man dann mit dem Befehl "dmesg" überprüfen, ob die - Karte korrekt erkannt wurde und alle erforderlichen Treiber installiert - sind. - - -Konfiguration -------------- -8) Die Konfiguration von i4b wird hauptsächlich im Verzeichnis "/etc/isdn" - druchgeführt, dort sucht der isdnd beim Start auch seine Konfigurations- - datei "isdnd.rc". Da vorgenanntes Verzeichnis nach der Installation aber - noch leer ist, kopiert man zuerst die Beispieldateien aus dem Verzeichnis - "/etc/isdn/samples" nach "/etc/isdn". - -9) Die Datei "isdnd.rc" enthält schon recht aussagekräftige Kommentare zu den - einzelnen Optionen, weitere Informationen erhält man mit "man isdnd.rc" und - "man isdnd". - -10) Für syncPPP und Anrufbeantworter sind nur die Sektionen "SYSTEM", - "telephone answering" und "example for sPPP" notwendig, die Sektion - "IP over ISDN example" kann dafür also entfernt werden. - -11) Für den automatisierten Start des isp0 Interfaces und des isdnd erstellt - man nun ein Start-Skript. Dazu kopiert man die Datei - "/usr/src/i4b/etc/rc.isdn-PPP" nach "/etc/rc.isdn" und paßt sie - entsprechend an. Man beachte hierbei auch die FAQ "/usr/src/i4b/FAQ", die - Tips für die richtige Eintragung der IP-Adressen bereithält. - -12) Der Anrufbeantworter wird dadurch aktiviert, daß das entsprechende - Programm, das in "/etc/isdn/isdnd.rc" hinter dem Eintrag "answerprog = " - steht, aufgerufen wird. Wird dort kein Pfad angegeben, wird das Programm - im Verzeichniss "/etc/isdn" erwartet. Beispiele solcher Programme findet - man wiederum im Verzeichnis "/etc/isdn/samples". Sie nennen sich - - "answer" Nur Ansagetext abspielen, keine Aufzeichnungsmöglichkeit. - "record" Ansage wird abgespielt, nach Piep-Ton kann gesprochen - werden. - "tell" Als Ansagetext wird die anrufende Nummer gesprochen, keine - Aufzeichnung. - "tell-record" Anrufende Nummer als Ansagetext, nach Piep-Ton kann ge- - sprochen werden. - "isdntel.sh" Ansagetext und Aufzeichnung; mittels dem Programm "isdntel" - hat man die Kontrolle übe die Aufzeichnungen im Ver- - zeichniss "/var/isdn". Siehe auch "man isdntel" und - "man isdntelctl". - - Diese Programme müssen an die eigenen Wünsche angepaßt werden. Leider gibt es - kein mitgeliefertes Programm, mit dem man so auch den Ansagetext aufsprechen - kann. Das ist aber nicht allzuschlimm, da man nur das Programm "record" dafür - etwas anpassen muß (Ansagetexte beep und msg auskommentieren). Damit die Anrufe - aufgezeichnet werden können, muß zuerst noch das Verzeichnis "/var/isdn" - angelegt werden. Dort werden dann alle Aufzeichnungen obiger Programme gespeichert. - -13) Man sollte sich auch noch die man-Pages der Programme "isdnd", "isdnctl", - "isdnd_acct", "isdndebug" und "isdntrace" zu Gemüte führen. - - -Betrieb -------- -14) Der syncPPP Zugang zum Provider wird einfach mit dem Aufruf von - "/etc/rc.isdn" initialisiert. Jegliche Aktivitäten ins Internet (also z.B. - ein "ping 141.1.1.1") starten die Verbindung. Wenn in "/etc/isdn/isdnd.rc" - beim Eintrag "unitlengthsrc = " "rate" angegeben wurde, wird die Verbindung - kurz bevor die nächste Einheit begonnen wird, beendet. Informationen über - die Einheiten werden aus der Datei "/etc/isdn/isdnd.rates" ausgelesen - (Beispiele sind in "/etc/isdn/samples"). - - Mit "/etc/rc.isdn [restart|stop]" kann i4b entweder neu gestartet (z.B. zum - Einlesen der geänderten Konfiguration aus "isdnd.rc") oder beendet werden. - -15) Für den Anrufbeantworter muß nur der "isdnd" gestartet sein. Ein - ankommender Anruf wird dann automatisch angenommen (je nach den Einträgen - in "/etc/isdn/isdnd.rc"). - -16) Informationen über die Verbindung erhält man sowohl in "/var/log/messages", - also auch in "/var/log/isdnd.log" (so der isdnd mit der Option "-l" - gestartet wird) bzw. auf dem aktuellen tty (wenn der isdnd mit der Option - "-f" gestartet wird). diff --git a/share/examples/isdn/contrib/answer.c b/share/examples/isdn/contrib/answer.c deleted file mode 100644 index aac431f17e01..000000000000 --- a/share/examples/isdn/contrib/answer.c +++ /dev/null @@ -1,178 +0,0 @@ -// $FreeBSD$ -// changed ".g711a" to ".al" (-hm) -// Tue Mar 3 02:42:14 MET 1998 dave@turbocat.de -// started - -#define BLK_SIZE 2048 -#define SOX "/usr/local/bin/sox" -#define ALAWULAW "/usr/local/bin/alaw2ulaw" - -#include -#include - - FILE *device; - FILE *logfile; - char srcNum[30]; - char destNum[30]; - char argbuf[255]; - char tmpBuf[1024] = ""; - - -void writeToPhone (char *path) -{ - char buf[BLK_SIZE]; - FILE *srcfile; - int i = 0; - int readcount = 0; - - srcfile = fopen(path,"r"); - if (srcfile) { - for (i=0;i 2) { - argbuf[strlen(argbuf)-1] = '\0'; - } - - - device = fopen(argWithName("-D"),"r+"); - strcpy(destNum, argWithName("-d")); - strcpy(srcNum, argWithName("-s")); - - fprintf(logfile,"device '%s'\n", argWithName("-D")); - fprintf(logfile,"srcNum '%s'\n", srcNum); - fprintf(logfile,"destNum '%s'\n", destNum); - - - if (device) { - - strftime(timeStr,40,I4B_TIME_FORMAT,localtime(&now)); - - sprintf(outfileName,"/var/isdn/%s_%s_%s", timeStr, srcNum, destNum); - - writeToPhone ("/usr/local/lib/isdn/msg.al"); - readFromPhone (outfileName); - - sprintf(cmdStr,"/bin/cat %s | %s | %s -t raw -U -b -r 8000 - -t .au %s.snd", outfileName, ALAWULAW, SOX, outfileName); - fprintf(logfile,"%s\n",cmdStr); - system(cmdStr); - unlink(outfileName); - - fclose(device); - } else { - fprintf(logfile,"Can't open file '%s'\n",argWithName("-D")); - } - - now=time(NULL); - - strftime(timeStr,40,I4B_TIME_FORMAT,localtime(&now)); - - fprintf(logfile,"%s Done\n",timeStr); - fclose(logfile); - exit(0); // insure the process exit status is 0 - return 0; // ...and make main fit the ANSI spec. -} diff --git a/share/examples/isdn/contrib/answer.sh b/share/examples/isdn/contrib/answer.sh deleted file mode 100644 index 34073d359923..000000000000 --- a/share/examples/isdn/contrib/answer.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------------------- -# -# answer script for i4b isdnd -# --------------------------- -# -# last edit-date: [Fri May 25 15:21:05 2001] -# -# $FreeBSD$ -# -#--------------------------------------------------------------------------- -VARDIR=/var/isdn -LIBDIR=/usr/local/lib/isdn -LOGFILE=/tmp/answer.log - -NCALLFILE=$VARDIR/ncall -DATE=`date +%d%H` - -progname=${0##*/} -set -- $@ # have to split argument string !!! - -# ---------------------------------------------------------------------- - -usage () -{ - echo "usage: $progname -D device -d dest -s src" - exit 1 -} - -ncall () -{ - nfile=$1 - [ -f $nfile ] && read n < $nfile || n=0 - echo $(($n + 1)) > $nfile - printf "%.4d" $n -} - -# ---------------------------------------------------------------------- - -while getopts "D:d:s:" opt -do - case $opt - in -D) DEVICE=$OPTARG ;; -d) DEST=$OPTARG ;; -s) SRC=$OPTARG ;; - esac -done - -[ -c "$DEVICE" -a -n "$DEST" -a -n "$SRC" ] || usage; - -shift $(($OPTIND - 1)) - -# ---------------------------------------------------------------------- - -NCALL=`ncall $NCALLFILE` - -echo "$progname: device $DEVICE destination $DEST source $SRC " >>$LOGFILE - -{ - echo "Date: "`date` - echo "From: \"$SRC\"" - echo "To: \"$DEST\"" - echo -} >> $VARDIR/I.$NCALL.$DATE - -# ---------------------------------------------------------------------- - -tellnumber () -{ - number=$1 - digits=`echo $number | sed -e 's/\(.\)/\1 /g'` - - files="" - for digit in $digits - do - files="$files $LIBDIR/$digit.al" - done - cat $files -} - -# ---------------------------------------------------------------------- - -do_answer () -{ - [ -f $LIBDIR/beep.al ] && cat $LIBDIR/beep.al - [ -f $LIBDIR/msg.al ] && cat $LIBDIR/msg.al - [ -f $LIBDIR/beep.al ] && cat $LIBDIR/beep.al -} > $DEVICE - -do_record () -{ - cat $DEVICE > $VARDIR/R.$NCALL.$DATE -} - -do_tell () -{ - [ -f $LIBDIR/beep.al ] && cat $LIBDIR/beep.al - [ -f $LIBDIR/msg.al ] && cat $LIBDIR/msg.al - tellnumber $SRC - [ -f $LIBDIR/beep.al ] && cat $LIBDIR/beep.al -} > $DEVICE - -# ---------------------------------------------------------------------- - -case $progname -in -answer) do_answer ;; -record) do_answer; do_record ;; -tell) do_tell ;; -esac diff --git a/share/examples/isdn/contrib/convert.sh b/share/examples/isdn/contrib/convert.sh deleted file mode 100644 index b4a6e7d8d852..000000000000 --- a/share/examples/isdn/contrib/convert.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh -# -# convert recorded message to WAV format, optionally send it via mail -# -# by: Stefan Herrmann -# Date: Fr 22 Mai 1998 14:18:40 CEST -# -# $FreeBSD$ - -CAT=/bin/cat -RM=/bin/rm -SOX=/usr/local/bin/sox -ALAW2ULAW=/usr/local/bin/alaw2ulaw -MAIL=/usr/bin/mail -GZIP=/usr/bin/gzip -ZIP=/usr/local/bin/zip -UUENCODE=/usr/bin/uuencode - -inputfile="" -outfilename="" -mailto="" -iF=0 -oF=0 -mF=0 - -set -- `getopt i:o:m: $*` - -if test $? != 0 -then - echo 'Usage: r2w -i -o .wav -m ' - exit 1 -fi - -for i -do - case "$i" - in - -i) - inputfile=$2 - iF=1 - shift - shift - ;; - -o) - outfilename=$2 - oF=1 - shift - shift - ;; - -m) - mailto=$2 - mF=1 - shift - shift - ;; - --) - shift - break - ;; - esac -done - -if [ $iF -eq 0 -o $oF -eq 0 ] -then - echo 'Usage: r2w -i -o .wav -m ' - exit 1 -fi - -if [ $iF -eq 1 -a $oF -eq 1 ] -then - echo - echo "converting $inputfile to $outfilename.wav ..." - - $CAT $inputfile | $ALAW2ULAW | $SOX -t raw -U -b -r 8000 - -t .wav $outfilename.wav -fi - -if [ $iF -eq 1 -a $oF -eq 1 -a $mF -eq 1 ] -then - echo "... and sending it via email to $mailto ..." - $UUENCODE $outfilename.wav message.wav | $MAIL -s"new message $outfilename" $mailto && $RM $outfilename.wav - # only usefull when sending over the internet - #$GZIP -c $outfilename.wav | $UUENCODE message.zip | $MAIL -s"Nachricht vom ISDN Anrufbeantworter" $mailto && $RM $outfilename.wav -fi - -echo "done." -echo diff --git a/share/examples/isdn/contrib/hplay.c b/share/examples/isdn/contrib/hplay.c deleted file mode 100644 index 763e5a865dfa..000000000000 --- a/share/examples/isdn/contrib/hplay.c +++ /dev/null @@ -1,241 +0,0 @@ -/*---------------------------------------------------------------------------* - * - * rsynth driver to output to - * - an open isdn4bsd telephone connection or - * - an output file or - * - the /dev/audio device - * ---------------------------------------------------------------- - * - * tested with rsynth-2.0 - * - * written by Hellmuth Michaelis (hm@kts.org) - * - * last edit-date: [Fri May 25 15:21:33 2001] - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "proto.h" -#include "getargs.h" -#include "hplay.h" -#include "l2u.h" - -#define SAMP_RATE 8000 -long samp_rate = SAMP_RATE; - -char *prog = "hplay"; - -static int use_audio = 1; -static int use_isdn = 0; -static int unit_no = 0; - -static int audio_fd = -1; -static int isdn_fd = -1; -static int file_fd = -1; - -char *audio_dev = "/dev/dsp"; -char *isdn_dev = "/dev/i4btel"; -static char *ulaw_file = NULL; - -int -audio_init(int argc, char *argv[]) -{ - char dev[64]; - int format = CVT_ALAW2ULAW; - - prog = argv[0]; - - argc = getargs("FreeBSD audio/i4b/file output driver",argc, argv, - "a", NULL, &use_audio, "use /dev/audio (default)", - "i", NULL, &use_isdn, "use /dev/i4btel", - "u", "%d", &unit_no, "/dev/i4btel unit number (def = 0)", - "f", "", &ulaw_file, "u-law output to file", - NULL); - - if(help_only) - return argc; - - if(ulaw_file) - { - if(strcmp(ulaw_file, "-") == 0) - { - file_fd = 1; /* stdout */ - } - else - { - file_fd = open(ulaw_file, O_WRONLY | O_CREAT | O_TRUNC, 0666); - if(file_fd < 0) - fprintf(stderr, "ERROR: cannot open %s, error = %s\n", ulaw_file, strerror(errno)); - } - } - - if(use_isdn) - { - sprintf(dev, "%s%d", isdn_dev, unit_no); - - if((isdn_fd = open(dev, O_WRONLY)) < 0) - { - fprintf(stderr, "ERROR: cannot open %s, error = %s\n", dev, strerror(errno)); - } - - if((ioctl(isdn_fd, I4B_TEL_SETAUDIOFMT, &format)) < 0) - { - fprintf(stderr, "ioctl I4B_TEL_SETAUDIOFMT failed: %s", strerror(errno)); - } - } - - if(use_audio) - { - audio_fd = open(audio_dev, O_WRONLY | O_NDELAY); - if(audio_fd < 0) - { - fprintf(stderr, "ERROR: cannot open %s, error = %s\n", audio_dev, strerror(errno)); - } - } - - return argc; -} - -void -audio_term() -{ - int format = CVT_NONE; - - if(isdn_fd >= 0) - { - if((ioctl(isdn_fd, I4B_TEL_SETAUDIOFMT, &format)) < 0) - { - fprintf(stderr, "ioctl I4B_TEL_SETAUDIOFMT failed: %s", strerror(errno)); - } - close(isdn_fd); - isdn_fd = -1; - } - - if(audio_fd >= 0) - { -#if 0 - ioctl(audio_fd, SNDCTL_DSP_SYNC, &dummy); -#endif - close(audio_fd); - audio_fd = -1; - } - - if(file_fd >= 0) - { - close(file_fd); - file_fd = -1; - } -} - -void -audio_play(int n, short *data) -{ - int ret; - unsigned char *p; - - if (n > 0) - { - unsigned char *converted = (unsigned char *) malloc(n); - int i; - - if(converted == NULL) - { - fprintf(stderr, "Could not allocate memory for conversion\n"); - exit(3); - } - - for (i = 0; i < n; i++) - { - converted[i] = short2ulaw(data[i]); - } - - if (isdn_fd >= 0) - { - p = converted; - errno = 0; - - while((ret = write(isdn_fd, p, n)) != n) - { - if(!errno) - { - p += ret; - if(p > (converted + n)) - break; - } - else - { - fprintf(stderr, "write /dev/i4btel ERROR: ret (%d) != n (%d), error = %s\n", ret, n, strerror(errno)); - break; - } - } - } - - for (i = 0; i < n; i++) - converted[i] = (data[i] - 32768) / 256; - - if(audio_fd >= 0) - { - p = converted; - - errno = 0; - - while((ret = write(audio_fd, p, n)) != n) - { - if(!errno) - { - p += ret; - if(p > (converted + n)) - break; - } - else - { - fprintf(stderr, "write /dev/dsp ERROR: ret (%d) != n (%d), error = %s\n", ret, n, strerror(errno)); - break; - } - } - } - - if(file_fd >= 0) - { - int ret; - p = converted; - - errno = 0; - - while((ret = write(file_fd, p, n)) != n) - { - if(!errno) - { - p += ret; - if(p > (converted + n)) - break; - } - else - { - fprintf(stderr, "write file ERROR: ret (%d) != n (%d), error = %s\n", ret, n, strerror(errno)); - break; - } - } - } - - free(converted); - } -} - -/* EOF */ diff --git a/share/examples/isdn/contrib/i4b-ppp-newbie.txt b/share/examples/isdn/contrib/i4b-ppp-newbie.txt deleted file mode 100644 index 7d6c4b0870ae..000000000000 --- a/share/examples/isdn/contrib/i4b-ppp-newbie.txt +++ /dev/null @@ -1,237 +0,0 @@ -$FreeBSD$ - - PPP mit isdn4bsd - _________________________________________________________________ - - Version 1.01 - Datum: 22.02.1999 - Autor: [1]Dominik Brettnacher - - - Anmerkungen und Verbesserungsvorschläge sind willkommen - - - 1. vorab - Dieser Text soll Neulingen helfen, sich mittels isdn4bsd und BSD - per PPP z.B. bei ihrem Provider einwählen zu können. - isdn4bsd bringt einiges an Dokumentation und - Konfigurationsbeispielen mit, jedoch ist es nicht immer leicht, - die entsprechenden Hinweise gut miteinander zu kombinieren, so daß - am Schluß das dabei herauskommt, was man haben möchte. - 2. Wo bekomme ich isdn4bsd? - hier solle es keine allzu großen Probleme geben: isdn4bsd ist auf - dem FTP-Server [2]ftp.consol.de erhältlich. Man beachte dabei, daß - man sich nicht, wie üblich, als anonymous, sondern als isdn4bsd - einloggen muß. Benutzer von Browsern geben als Adresse - [3]ftp://isdn4bsd@ftp.consol.de und als Passwort ihre - eMail-Adresse an. - Wertvolle Informationen findet man in der Datei README. - 3. Welche ISDN-Karten werden unterstützt? - Informationen darüber findet man in der README-Datei. - 4. Ich benutze einen externen ISDN-Adapter - was nun? - Externe Adapter benötigen keine direkte Unterstützung, weil sie - über die serielle Schnittstelle angesteuert werden. Man kann also - das normale PPP benutzen. man ppp hilft hier sicher weiter. - 5. isdn4bsd installieren - Wie man isdn4bsd installiert, steht in der Datei - FreeBSD/INSTALLATION (für NetBSD und OpenBSD analog). Eine - Beispielkonfiguration des Kernel sieht so aus: -[...] -# -# i4b passive ISDN cards support (isic - I4b Siemens Isdn Chipset driver) -# note that the ``options'' and ``device'' lines must BOTH be defined ! -# -# Non-PnP Cards: -# -------------- -# -# AVM A1 or AVM Fritz!Card -options "AVM_A1" -device isic0 at isa? port 0x300 net irq 15 flags 4 vector isicintr -# -# ISDN Protocol Stack -# ------------------- -# -# Q.921 / layer 2 - i4b passive cards D channel handling -pseudo-device "i4bq921" -# -# Q.931 / layer 3 - i4b passive cards D channel handling -pseudo-device "i4bq931" -# -# layer 4 - i4b common passive and active card handling -pseudo-device "i4b" -# -# ISDN devices -# ------------ -# -# userland driver to do ISDN tracing (for passive cards only) -pseudo-device "i4btrc" 4 -# -# userland driver to control the whole thing -pseudo-device "i4bctl" -# -# userland driver for access to raw B channel -#pseudo-device "i4brbch" 4 -# -# userland driver for telephony -#pseudo-device "i4btel" 2 -# -# network driver for IP over raw HDLC ISDN -#pseudo-device "i4bipr" 4 -# enable VJ header compression detection for ipr i/f -#options IPR_VJ -# -# network driver for sync PPP over ISDN -pseudo-device "i4bisppp" 1 -pseudo-device sppp 1 -# -#--------------------------------------------------------------------------- -[...] - Nachdem ein neuer Kernel kompiliert und das System neugestartet - wurde, kann es weiter gehen. - 6. Konfiguration isdnd.rc - Die für ISDN wichtigste Konfigurationsdatei ist - /etc/isdn/isdnd.rc. Mit man isdnd.rc erhält man Informationen über - die Einstellungen, die man dort vornehmen kann. Im Folgenden ein - Beispiel: - - -#============================================================================== -# SYSTEM section: isdnd global configuration parameters -#============================================================================== -system - -# accounting -# ---------- - -acctall = on # generate info for everything -acctfile = /var/log/isdnd.acct # name & location of accounting file -useacctfile = yes # generate accouting info to file - -# monitor -# ------- - -monitor-allowed = no # global switch: monitor on/off -monitor-port = 451 # default monitor TCP port - -# Monitor rights are granted due to the most specific host/net spec, i.e. in -# the example below host 192.168.1.2 will have the rights specified on that -# line, even so it belongs to net 192.168.1.0/24 as well. -# -# A monitor specification may either be: -# -# - the name of a local (UNIX-domain) socket; this MUST start with a "/" -monitor = "/var/run/isdn-monitor" -monitor-access = fullcmd -monitor-access = channelstate, logevents -monitor-access = callin, callout - -# ratesfile -# --------- - -ratesfile = /etc/isdn/isdnd.rates # name & location of rates file - -# regular expression pattern matching -# ----------------------------------- - -#regexpr = "connected.*KTS" # look for matches in log messages -#regprog = connectKTS # execute program when match is found - -# realtime priority section -# ------------------------- - -rtprio = 25 # modify isdnd's process priority - -############################################################################### -entry -name = lf -usrdevicename = isp -usrdeviceunit = 0 -isdncontroller = 0 -isdnchannel = -1 -local-phone-incoming = 012345678 -remote-phone-incoming = 876543210 -local-phone-dialout = 012345678 -remote-phone-dialout = 876543210 -remdial-handling = first -dialin-reaction = accept -dialout-type = normal -b1protocol = hdlc -idletime-incoming = 240 -idletime-outgoing = 30 -earlyhangup = 5 -ratetype = 0 -unitlength = 90 -unitlengthsrc = rate -dialretries = 3 -dialrandincr = on -recoverytime = 25 - -connectprog = is-up -disconnectprog = is-down - - Wichtig sind hier für den Neuling die vier *-phone-* Einträge, die - jeweils die lokale Rufnummer und die der Gegenstelle für ein- und - ausgehende Verbindungen angeben. - - 7. ISDN-Verbindungen aufbauen - um ISDN-Verbindungen aufzubauen, bedarf es einiger Befehle, die - beim Systemstart aufgerufen werden. Man kann sie zum Beispiel am - Ende von /etc/rc.local unterbringen. Hier gibt es aber durchaus - noch andere Lösungen: - [...] - # start ISDN - echo -n 'ppp / ISDN...' - echo -n 'isdnd...' - /usr/local/bin/isdnd - echo -n 'ifconfig...' - ifconfig isp0 link1 0.0.0.0 1.1.1.1 netmask 0xffffff00 - ifconfig isp0 down - echo -n 'sppp...' - spppcontrol isp0 myauthproto=pap myauthname="xxx" - myauthsecret="xxx" hisauthproto=none - echo -n 'ifconfig...' - ifconfig isp0 up - echo -n 'setting routes...' - route add default -interface isp0 - echo '.' - Ändern muß man hier eventuell die Zieladresse des Providers (im - Beispiel 1.1.1.1). Man bekommt diese entweder vom Provider, oder - aber man muß einen Versuch daransetzen, sie selbst herauszufinden. - Wie das funktioniert, steht in der Datei FAQ des isdn4bsd-Paketes. - Auch am Aufruf von spppcontrol (Vorsicht: spppcontrol bis - hisauthproto=none ist eine Zeile!) muß noch etwas umgestellt - werden: - + myauthproto steht für das Authentifizierungsprotokoll. - Möglich sind pap oder chap. - + myauthname ist der PPP-Benutzername. - + myauthsecret ist das PPP-Kennwort. - Wenn man nun die Befehle in /etc/rc.local ausführt, kann man mit - einem ping auf eine beliebige Adresse außerhalb des lokalen Netzes - eine Verbindung öffnen. Sie wird automatisch nach einiger - Inaktivität (siehe isdnd.rc) wieder geschlossen. - - 8. Es funktioniert nicht - was kann ich tun? - Es gibt einige Möglichkeiten zur Fehlerdiagnose: - + dmesg gibt Aufschluß darüber, ob die Karte richtig erkannt - wurde. - + ifconfig (siehe rc.local) kann mit dem Parameter debug - aufgerufen werden und gibt dann einiges an Informationen aus. - + die Nachrichten in /var/log/messages können außerdem - hilfreich sein - - 9. wer kann mir helfen? - + die erste Adresse für ISDN-Probleme ist die Mailingliste - [4]freebsd-isdn@freebsd.org - man bestellt sie, indem man - eine Mail mit dem Text subscribe freebsd-isdn an - [5]majordomo@freebsd.org schickt. - + auch die deutschsprachige Mailingliste kann hilfreich sein. - Mit einer Mail an [6]majordomo@de.freebsd.org, die im Text - subscribe de-bsd-questions enthält bestellt man sie. - _________________________________________________________________ - -References - - 1. mailto:domi@saargate.de - 2. ftp://isdn4bsd@ftp.consol.de/ - 3. ftp://isdn4bsd@ftp.consol.de/ - 4. mailto:freebsd-isdn@freebsd.org - 5. mailto:majordomo@freebsd.org - 6. mailto:majordomo@de.freebsd.org diff --git a/share/examples/isdn/contrib/isdnctl b/share/examples/isdn/contrib/isdnctl deleted file mode 100644 index 57fab4561cc6..000000000000 --- a/share/examples/isdn/contrib/isdnctl +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh - -# isdnctl -# Control the ISDN line based on usage -# -# This script can control the state of your ISDN line. It counts -# how many scripts/users currently use the ISDN line and uses -# "ifconfig down" if noone uses it any more. -# I use this script for cronjobs that fetch mail and news and run cvsup. -# If I'm still using the line, the script won't close the connection, -# but if not, it saves a lot of phone costs. -# -# ---------------------------------------------------------------------------- -# "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp): -# Alexander Langer wrote this file. As long as you retain -# this notice you can do whatever you want with this stuff. If we meet some -# day, and you think this stuff is worth it, you can buy me a beer in return. -# -# Alexander Langer -# ---------------------------------------------------------------------------- -# -# $FreeBSD$ -# - - -usage () { - echo "usage: $0 [-i interface] [-f /path/to/users.file] [up|down|show]" -} - -# Defaults -INTERFACE=isp0 -USERSFILE= - -# Getopt stuff -args=`getopt i:f: $*` -if [ $? != 0 ]; then - usage - exit 2 - fi -set -- $args -for i; do - case "$i" in - -i) - INTERFACE="$2" - shift; shift - ;; - -f) - USERSFILE="$2" - shift; shift - ;; - --) - shift - break - ;; - esac -done - -if [ -z $USERSFILE ]; then - USERSFILE=/var/run/isdn.users.$INTERFACE -fi - -if [ -z $1 ]; then - usage - exit 2 -fi - -# Does Usersfile exist? -if [ ! -f $USERSFILE ]; then - # Try to create it - if ! /sbin/ifconfig $INTERFACE | grep "^$INTERFACE.* /dev/null; then - echo "0" > $USERSFILE || exit 1 - else - echo "1" > $USERSFILE || exit 1 - fi -elif [ ! -w $USERSFILE ]; then - echo "Error: $USERSFILE not writeable!" - exit 1 -fi - -if ! /sbin/ifconfig $INTERFACE | grep "^$INTERFACE.* /dev/null; then - if ! cat $USERSFILE | grep '^0$' > /dev/null ; then - echo "Interface down, removing number from file"; - echo "0" > $USERSFILE - fi; -fi; - -case "$1" in - show) - echo "`cat $USERSFILE` users online" - ;; - up) - expr `cat $USERSFILE` + 1 > $USERSFILE - /sbin/ifconfig $INTERFACE up - echo "`cat $USERSFILE` users online" - ;; - down) - if cat $USERSFILE | grep '^0$' > /dev/null ; then - echo "Already down" - exit 0 - fi - expr `cat $USERSFILE` - 1 > $USERSFILE - if cat $USERSFILE | grep '^0$' > /dev/null ; then - echo "`cat $USERSFILE` users online, interface down" - /sbin/ifconfig $INTERFACE down - exit 0 - fi - echo "`cat $USERSFILE` users online" - ;; -esac - -exit 0 diff --git a/share/examples/isdn/contrib/isdnd_acct b/share/examples/isdn/contrib/isdnd_acct deleted file mode 100644 index 21223b7cd0f4..000000000000 --- a/share/examples/isdn/contrib/isdnd_acct +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/perl -#--------------------------------------------------------------------------- -# -# Copyright (c) 1996, 1998 Hellmuth Michaelis. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -#--------------------------------------------------------------------------- -# -# accounting report script for the isdnd daemon accounting info -# ------------------------------------------------------------- -# -# last edit-date: [Fri May 25 15:28:20 2001] -# -# $FreeBSD$ -# -#--------------------------------------------------------------------------- - -# where the isdnd accounting file resides -$ACCT_FILE = "/var/log/isdnd.acct"; - -# the charge for a unit, currently 0,12 DM -$UNIT_PRICE = 0.12; - -# open accounting file -open(IN, $ACCT_FILE) || - die "ERROR, cannot open $ACCT_FILE !\n"; - -# set first thru flag -$first = 1; - -# process file line by line -while () -{ - # remove ( and ) from length and bytecounts - tr/()//d; - - # split line into pieces - ($from_d, $from_h, $dash, $to_d, $to_h, $name, $units, $secs, $byte) - = split(/ /, $_); - - # get starting date - if($first) - { - $from = "$from_d $from_h"; - $first = 0; - } - - # split bytecount - ($inb, $outb) = split(/\//, $byte); - - # process fields - $a_secs{$name} += $secs; - $a_calls{$name}++; - $a_units{$name} += $units; - $a_charge{$name} += $units * $UNIT_PRICE; - $a_inbytes{$name} += $inb; - $a_outbytes{$name} += $outb; - $a_bytes{$name} = $a_bytes{$name} + $inb + $outb; -} - -# close accouting file -close(IN); - -# write header -print "\n"; -print " ISDN Accounting Report ($from -> $to_d $to_h)\n"; -print " =====================================================================\n"; - -#write the sum for each interface/name -foreach $name (sort(keys %a_secs)) -{ - $o_secs = $a_secs{$name}; - $gt_secs += $o_secs; - $o_calls = $a_calls{$name}; - $gt_calls += $o_calls; - $o_units = $a_units{$name}; - $gt_units += $o_units; - $o_charge = $a_charge{$name}; - $gt_charge += $o_charge; - $o_inbytes = $a_inbytes{$name}; - $gt_inbytes += $o_inbytes; - $o_outbytes = $a_outbytes{$name}; - $gt_outbytes += $o_outbytes; - $o_bytes = $a_bytes{$name}; - $gt_bytes += $o_bytes; - write; -} - -$o_secs = $gt_secs; -$o_calls = $gt_calls; -$o_units = $gt_units; -$o_charge = $gt_charge; -$o_inbytes = $gt_inbytes; -$o_outbytes = $gt_outbytes; -$o_bytes = $gt_bytes; -$name = "Total"; - -print "======= ====== ===== ===== ======== ============ ============ ============\n"; -write; - -print "\n\n"; -exit; - -# top of page header -format top = - -Name charge units calls secs inbytes outbytes bytes -------- ------ ----- ----- -------- ------------ ------------ ------------ -. - -# record template -format STDOUT = -@<<<<<< @##.## @#### @#### @####### @########### @########### @########### -$name, $o_charge, $o_units, $o_calls, $o_secs, $o_inbytes, $o_outbytes, $o_bytes -. - -# EOF diff --git a/share/examples/isdn/contrib/isdnd_acct.pl b/share/examples/isdn/contrib/isdnd_acct.pl deleted file mode 100644 index 03062160104d..000000000000 --- a/share/examples/isdn/contrib/isdnd_acct.pl +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/perl -# -#ich habe zwei vielleicht n?tzliche Erweiterungen an isdn_pacct -#gemacht: -# -# 1) Man kann den Namen der Accounting-Datei angeben. Ich -# habe Accounting-Files nach Telekom-Rechnung aufgeteilt -# und kann diese so sehr sch?n nachvollziehen. -# -# 2) Die Abrechnung wird nach Einheitenl?ngen aufgelistet. -# Leider wird zur Zeit immer Nahzone verwendet (isdnd.rates -# wird ausgelesen), und Feiertage stehen als erstes auf -# der TODO-Liste. Wenn man dieses Feature durch einen -# Switch anschaltet, kann man es sogar unauff?llig in die -# Distribution aufnehmen. -# -# Mir hilft diese Abrechnung, an mir zu arbeite und mehr -# Tests und Zug?nge nachts durchzuf?hren... Aber die meisten -# Einheiten werden immer noch im 90s-Takt verbraucht :-( -# -# $FreeBSD$ -# -#--------------------------------------------------------------------------- -# -# Copyright (c) 1994, 1996 Hellmuth Michaelis. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by Hellmuth Michaelis -# 4. Neither the name of the author nor the names of any co-contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -#--------------------------------------------------------------------------- -# -# accounting script for the isdn daemon accounting info -# ----------------------------------------------------- -# -# last edit-date: [Fri May 25 15:22:26 2001] -# -# -hm my first perl program :-) -# -hm sorting the output -# -hm adding grand total -# -#--------------------------------------------------------------------------- - -sub wday { - local ($y, $m, $d) = @_; - local ($nday, @mon); - - @mon = (0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 337); -# M A M J J A S O N D J F - - if ($m > 2) { - $m -= 3; - } else { - $m += 9; - $y--; - } - if ($y < 1600) { - return -1; - } - $y -= 1600; - $nday = $y * 365 + $mon[$m] + $d + - int($y / 4) - int($y / 100) + int($y / 400); - ($nday + 2) % 7; -} - -# where the isdnd accounting file resides -if ($#ARGV == 0) { - $ACCT_FILE = $ARGV[0]; -} else { - $ACCT_FILE = "/var/log/isdnd.acct"; -} - -# $PERIOD_FILE = "/usr/local/etc/isdnd.periods"; -# # read periods that need to be separately listed -# if (open(IN, $PERIOD_FILE)) { -# while () { -# chop; -# ($start, $end) = split(/ /); -# push(@p_start, $start); -# push(@p_end, $end); -# } -# close(IN); -# } - -$RATES_FILE = "/etc/isdn/isdnd.rates"; -if (open(IN, $RATES_FILE)) { - while() { - chop; - if (! /^ra0/) { - next; - } - ($ra0, $day, $rest) = split(/[ \t]+/, $_, 3); - @periods = split(/[ \t]+/, $rest); - foreach $period (@periods) { - ($h_start, $m_start, $h_end, $m_end, $secs) = - $period =~ /(.+)\.(.+)-(.+)\.(.+):(.+)/; - for ($h = int($h_start); $h < $h_end; $h++) { - $secs{$day, $h} = $secs; - } - } - } - close(IN); -} - -# the charge for a unit, currently 0,12 DM -$UNIT_PRICE = 0.12; - -# open accounting file -open(IN, $ACCT_FILE) || - die "ERROR, cannot open $ACCT_FILE !\n"; - -# set first thru flag -$first = 1; - -# process file line by line -while () -{ - # remove ( and ) from length and bytecounts - tr/()//d; - - # split line into pieces - ($from_d, $from_h, $dash, $to_d, $to_h, $name, $units, $secs, $byte) - = split(/ /, $_); - - # get starting date - if($first) - { - $from = "$from_d $from_h"; - $first = 0; - } - - # split bytecount - ($inb, $outb) = split(/\//, $byte); - - # if user wants to account time periods, put this to the right - # slot(s) - ($hour, $minute, $second) = split(/:/, $from_h); - ($day, $mon, $year) = split(/\./, $from_d); - $day = &wday('19' . $year, $mon, $day); - if ($secs{$day, int($hour)}) { - $secs = $secs{$day, int($hour)}; - # process fields - $p_secs{$name, $secs} += $secs; - $p_calls{$name, $secs}++; - $p_units{$name, $secs} += $units; - $p_charge{$name, $secs} += $units * $UNIT_PRICE; - $p_inbytes{$name, $secs} += $inb; - $p_outbytes{$name, $secs} += $outb; - $p_bytes{$name, $secs} = $p_bytes{$name, $secs} + $inb + $outb; - } - - # process fields - $a_secs{$name} += $secs; - $a_calls{$name}++; - $a_units{$name} += $units; - $a_charge{$name} += $units * $UNIT_PRICE; - $a_inbytes{$name} += $inb; - $a_outbytes{$name} += $outb; - $a_bytes{$name} = $a_bytes{$name} + $inb + $outb; -} - -# close accouting file -close(IN); - -# write header -print "\n"; -print " ISDN Accounting Report ($from -> $to_d $to_h)\n"; -print " =================================================================\n"; - -#write the sum for each interface/name -foreach $n (sort(keys %a_secs)) -{ - $o_secs = $a_secs{$n}; - $gt_secs += $o_secs; - $o_calls = $a_calls{$n}; - $gt_calls += $o_calls; - $o_units = $a_units{$n}; - $gt_units += $o_units; - $o_charge = $a_charge{$n}; - $gt_charge += $o_charge; - $o_inbytes = $a_inbytes{$n}; - $gt_inbytes += $o_inbytes; - $o_outbytes = $a_outbytes{$n}; - $gt_outbytes += $o_outbytes; - $o_bytes = $a_bytes{$n}; - $gt_bytes = $o_bytes; - $name = $n; - write; - - foreach $i (keys %p_secs) { - ($nam, $secs) = split(/$;/, $i); - if ($nam ne $n) { - next; - } - $o_secs = $p_secs{$i}; - $o_calls = $p_calls{$i}; - $o_units = $p_units{$i}; - $o_charge = $p_charge{$i}; - $o_inbytes = $p_inbytes{$i}; - $o_outbytes = $p_outbytes{$i}; - $o_bytes = $p_bytes{$i}; - $name = sprintf(' %5.1fs', $secs / 10); - write; - } -} - -$o_secs = $gt_secs; -$o_calls = $gt_calls; -$o_units = $gt_units; -$o_charge = $gt_charge; -$o_inbytes = $gt_inbytes; -$o_outbytes = $gt_outbytes; -$o_bytes = $gt_bytes; -$name = "Total"; - -print "======= ====== ===== ===== ======== ============ ============ ============\n"; -write; - -print "\n\n"; -exit; - -# top of page header -format top = - -Name charge units calls secs inbytes outbytes bytes -------- ------ ----- ----- -------- ------------ ------------ ------------ -. - -# record template -format STDOUT = -@<<<<<< @##.## @#### @#### @####### @########### @########### @########### -$name, $o_charge, $o_units, $o_calls, $o_secs, $o_inbytes, $o_outbytes, $o_bytes -. - -# EOF diff --git a/share/examples/isdn/contrib/isdntelmux.c b/share/examples/isdn/contrib/isdntelmux.c deleted file mode 100644 index 1d517a7106a0..000000000000 --- a/share/examples/isdn/contrib/isdntelmux.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 1999 Michael Reifenberger (Michael@Reifenberger.com). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4btemux - record while playing - * =============================== - * - * $FreeBSD$ - * - *----------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// DECL DEFS -#define BUFLEN 2048 -#define MAXBLOCKS_DEFAULT 23 - -// DECL VARS -int ibytes = 0; -int obytes = 0; -int maxbytes = (BUFLEN * MAXBLOCKS_DEFAULT); - -int xfd = -1, xact = 0; -int ifd = -1, iact = 0; -int ofd = -1; -FILE *dfp = NULL; -int opt_dbg = 0; -int maxfd = 0; -fd_set set; -struct timeval timeout; -char nambuf[PATH_MAX]; -int ch; - -// DECL FUNC -void ifd_hdlr( void); -void xfd_hdlr( void); -void usage( void); -void dbg( char *fmt, ... ); - -// DEF FUNC -int main (int argc, char **argv) { - int dummy; - int x = -1; - - dfp = stderr; - while( ( ch = getopt( argc, argv, "x:i:o:b:D:")) != -1 ){ - switch(ch){ - case 'b': - x = atoi(optarg); - maxbytes = x * BUFLEN; - break; - case 'i': - ifd = open( optarg, O_RDONLY ); - iact = 1; - break; - case 'o': - ofd = open( optarg, O_WRONLY|O_TRUNC|O_CREAT ); - break; - case 'x': - xfd = open( optarg, O_RDWR ); - xact = 1; - break; - case 'D': - opt_dbg = 1; - if( (dfp = fopen( optarg, "w" )) < 0) { - dfp = stderr; - dbg("Err for opening %s\n", optarg); - exit(1); - } - break; - case '?': - default: - usage(); - break; - } - } - if( ( xfd < 0 ) || ( ifd < 0 ) || ( ofd < 0 ) ) { - dbg("Err opening one ore more Files.\n"); - dbg("xfd: %d, ifd: %d, ofd: %d\n", xfd, ifd, ofd ); - usage(); - } - - if((x = ioctl(xfd, I4B_TEL_EMPTYINPUTQUEUE, &dummy)) < 0){ - dbg("Err I4B_TEL_EMPTYINPUTQUEUE\n"); - } - - while( (iact == 1) || ( (obytes < maxbytes) && (xact == 1) ) ){ - FD_ZERO( &set); - if( iact == 1){ - FD_SET( ifd, &set); - if( ifd > maxfd) - maxfd = ifd; - dbg("FSET ifd\n"); - } - if( xact == 1){ - FD_SET( xfd, &set); - if( xfd > maxfd) - maxfd = xfd; - dbg("FSET xfd\n"); - } - x=select( maxfd+1, &set, NULL, NULL, NULL); - if( x > 0){ - if( (iact == 1) && FD_ISSET( ifd, &set) ){ - ifd_hdlr(); - } - if( (xact == 1) && FD_ISSET( xfd, &set) ){ - xfd_hdlr(); - } - } - } - dbg("exit0\n"); - return(0); -} - -void ifd_hdlr( void) { - int x; - unsigned char buf[BUFLEN]; - - x = read( ifd, buf, BUFLEN); - dbg("ifd read %d bytes\n", x); - if( x > 0 ){ - write( xfd, buf, x); - ibytes += x; - dbg("xfd %d bytes written to %d\n", x, ibytes); - } else { - iact = 0; - } -} - -void xfd_hdlr( void) { - int x; - unsigned char buf[BUFLEN]; - - x = read( xfd, buf, BUFLEN); - dbg("xfd read %d bytes\n", x); - if( x > 0){ - write( ofd, buf, x); - obytes += x; - dbg("ofd %d bytes written to %d\n", x, obytes); - } else { - xact = 0; - } -} - -void usage( void) { - fprintf(dfp, "isdntelmux V.1\n"); - fprintf(dfp, "usage: isdntelmux -x device -i ifile -o ofile [-b blocks]\n"); - exit(1); -} - -void dbg( char *fmt, ... ) { - va_list ap; - - if( opt_dbg == 0 ) - return; - va_start( ap, fmt ); - vfprintf( dfp, fmt, ap); - va_end(ap); -} diff --git a/share/examples/isdn/contrib/mrtg-isp0.sh b/share/examples/isdn/contrib/mrtg-isp0.sh deleted file mode 100644 index bdc9671883ac..000000000000 --- a/share/examples/isdn/contrib/mrtg-isp0.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------------------- -# -# collect callout and callback statistics for the isp0 i/f -# -# enable budget callout and callback restrictions and file -# rotation in the isdnd.rc file. -# -# last edit-date: [Fri May 25 15:22:45 2001] -# -# $FreeBSD$ -# -#--------------------------------------------------------------------------- -# -#--------------------------------------------------------------------------- -# this is the entry for mrtg in mrtg.cfg -#--------------------------------------------------------------------------- -# Target[ernie.cstat.isp0]: `/usr/local/etc/mrtg/util/mrtg-isp0.sh` -# MaxBytes[ernie.cstat.isp0]: 10 -# AbsMax[ernie.cstat.isp0]: 200 -# Title[ernie.cstat.isp0]: isp0: callouts / callbacks -# PageTop[ernie.cstat.isp0]:

isp0: callouts /callbacks

-# Options[ernie.cstat.isp0]: gauge, nopercent, integer -# YLegend[ernie.cstat.isp0]: co / cb -# ShortLegend[ernie.cstat.isp0]: n -# Legend1[ernie.cstat.isp0]: callouts -# Legend2[ernie.cstat.isp0]: callbacks -# LegendI[ernie.cstat.isp0]: callouts: -# LegendO[ernie.cstat.isp0]: callbacks: -# WithPeak[ernie.cstat.isp0]: ymwd -# -#--------------------------------------------------------------------------- -# this is the shell script run by mrtg -#--------------------------------------------------------------------------- -if [ -r /var/log/isdn/callouts.isp0 ] -then - cat /var/log/isdn/callouts.isp0 | awk '{print $3}' -else - echo 0 -fi - -if [ -r /var/log/isdn/callbacks.isp0 ] -then - cat /var/log/isdn/callbacks.isp0 | awk '{print $3}' -else - echo 0 -fi - -uptime | cut -c 12-18 -uname -nsr - -exit 0 - diff --git a/share/examples/isdn/i4brunppp/Makefile b/share/examples/isdn/i4brunppp/Makefile deleted file mode 100644 index e1eeceaa18c5..000000000000 --- a/share/examples/isdn/i4brunppp/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ - -PROG = i4brunppp -SRCS = i4brunppp.c -MAN = i4brunppp.8 - -RUNPPPDEST= /etc/isdn - -INSTALL ?= install - -install: - @echo i4brunppp is not installed automatically. In case you want to run - @echo user-ppp in dial-in server under i4b, please copy it into /etc/isdn. - -installetc: i4brunppp - ${INSTALL} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} \ - ${.CURDIR}/i4brunppp ${RUNPPPDEST} - -.include diff --git a/share/examples/isdn/i4brunppp/README b/share/examples/isdn/i4brunppp/README deleted file mode 100644 index 81ebe75cf30d..000000000000 --- a/share/examples/isdn/i4brunppp/README +++ /dev/null @@ -1,18 +0,0 @@ -$FreeBSD$ - -BEWARE: HIGHLY EXPERIMENTAL! ---------------------------- - -This program is used in conjunction with an isdnd.rc entry similar to - - regexpr = "ULPPP.*call active" # look for matches in log messages - regprog = i4brunppp # execute program when match is found - -this one (see also i4brunppp-isdnd.rc). - -i4brunppp _must_ be put into /etc/isdn! - -When an active call is detected, isdnd fires off i4brunppp, which attaches -the rbch device used to stdin/stdout and then runs ppp which is given the -"-direct" command and the string "inc_rbchX" (where X is the i4brbch unit -number) as arguments. diff --git a/share/examples/isdn/i4brunppp/i4brunppp-isdnd.rc b/share/examples/isdn/i4brunppp/i4brunppp-isdnd.rc deleted file mode 100644 index 962022045cae..000000000000 --- a/share/examples/isdn/i4brunppp/i4brunppp-isdnd.rc +++ /dev/null @@ -1,65 +0,0 @@ -#------------------------------------------------------------------------------ -# -# sample isdnd.rc for taking incoming calls with userland ppp -# ----------------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Sat Jul 21 13:40:50 2001] -# -#------------------------------------------------------------------------------ -#============================================================================== -# SYSTEM section: global configuration parameters -#============================================================================== -system - -ratesfile = /etc/isdn/isdnd.rates # name & location of rates file - -useacctfile = yes # generate accouting info to file -acctall = on # generate info for everything -acctfile = /var/log/isdnd.acct # name & location of accounting file - -rtprio = 25 # modify isdnd's priority - -regexpr = "ULPPP.*call active" # look for matches in log messages -regprog = i4brunppp # execute program when match is found - -#============================================================================== -# ENTRY: Userland PPP over ISDN -#============================================================================== -entry - -name = ULPPP # name for reference - -usrdevicename = rbch # ipr, tel, rbch -usrdeviceunit = 0 # unit number - -isdncontroller = 0 # contoller to use or -1 to use any -isdnchannel = -1 # channel (1/2) to use or 0 or -1 for any - - # numbers used to verify at DIAL IN -local-phone-incoming = 567 # this is my number -remote-phone-incoming = 123 # this one can call in - - # numbers used to DIAL OUT -local-phone-dialout = 567 # this is my number -remote-phone-dialout = 123 # i call this number - -remdial-handling = first # first, last or next - -dialin-reaction = accept # accept, reject, ignore, answer - -dialout-type = normal # normal / calledback - -b1protocol = hdlc # hdlc, raw - -idletime-incoming = 30 # 3 seconds idle timeout -idletime-outgoing = 30 # 3 seconds idle timeout - -ratetype = 0 # ratesfile entry to use -unitlength = 60 # unitlength to assume - -dialretries = 2 # # of dial retries -recoverytime = 5 # time to wait between 2 dial tries - -# EOF ######################################################################### diff --git a/share/examples/isdn/i4brunppp/i4brunppp.8 b/share/examples/isdn/i4brunppp/i4brunppp.8 deleted file mode 100644 index bc4799032ea2..000000000000 --- a/share/examples/isdn/i4brunppp/i4brunppp.8 +++ /dev/null @@ -1,51 +0,0 @@ -.\" -.\" Copyright (c) 1999, 2001 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sat Jul 21 13:37:00 2001] -.\" -.Dd July 28, 1999 -.Dt I4BRUNPPP 8 -.Os -.Sh NAME -.Nm i4brunppp -.Nd interface i4b to userland ppp in server mode -.Sh DESCRIPTION -The -.Nm -utility -is part of the isdn4bsd package and is used to interface i4b to the so-called -userland -.Xr ppp 8 -when dialling into an i4b machine. -.Sh FILES -.Bl -tag -width ".Pa /dev/i4brbchX" -.It Pa /dev/i4brbchX -.El -.Sh AUTHORS -The -.Nm -utility and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/share/examples/isdn/i4brunppp/i4brunppp.c b/share/examples/isdn/i4brunppp/i4brunppp.c deleted file mode 100644 index 3c8b6e76e243..000000000000 --- a/share/examples/isdn/i4brunppp/i4brunppp.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 1999, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4brunppp - run userland ppp for incoming call from rbch i/f - * ------------------------------------------------------------ - * - * $FreeBSD$ - * - * last edit-date: [Sat Jul 21 13:38:10 2001] - * - *--------------------------------------------------------------------------- - * - * BEWARE: HIGHLY EXPERIMENTAL! - * --------------------------- - * - * This program is used in conjunction with an isdnd.rc entry similar to - * - * regexpr = "ULPPP.*call active" # look for matches in log messages - * regprog = i4brunppp # execute program when match is found - * - * this one. It _must_ be put into /etc/isdn! - * When an active call is detected, isdnd fires off i4brunppp, which attaches - * the rbch device used to stdin/stdout and then runs ppp which is given the - * "-direct" command and the string "inc_rbchX" (where X is the i4brbch unit - * number) as arguments. - * - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define I4BDEVICE "/dev/i4b" - -#define PPPPROG "/usr/sbin/ppp" -#define PPPNAME "ppp" -#define PPPARG1 "-direct" -#define PPPLABEL "inc_" - -#define VERIFYSTRING "call active" -#define DEVSTRING "rbch" - -#define PPPDEBUG - -/*---------------------------------------------------------------------------* - * program entry - *---------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - char buffer[256]; - int rbch_fd; - char *p = "DeadPointer"; - int found; - int i; - -#ifdef PPPDEBUG - FILE *dfp; - time_t tim; - register struct tm *tp; -#endif - - /* open syslog */ - - (void)openlog("i4brunppp", LOG_PID|LOG_CONS|LOG_NDELAY, LOG_USER); - -#ifdef PPPDEBUG - - /* open debug log */ - - if((dfp = fopen("/tmp/i4brunppp-debug.log", "a")) == NULL) - { - syslog(LOG_INFO, "cannot open logfile: %s", strerror(errno)); - exit(1); - } - - tim = time(NULL); - tp = localtime(&tim); - strftime(buffer, 40, I4B_TIME_FORMAT, tp); - fprintf(dfp, "\n=================== %s ===================\n", buffer); - - for(i=0; i < argc; i++) - fprintf(dfp, "\t%s\n", argv[i]); -#endif - - /* check if this is the right message */ - - found = 0; - - for(i=0; i < argc; i++) - { - if((strstr(argv[i], VERIFYSTRING)) != NULL) - { - found = 1; - break; - } - } - - if(found == 0) - { -#ifdef PPPDEBUG - fprintf(dfp, "did not found [%s], exit\n", VERIFYSTRING); -#endif - exit(0); - } - - found = 0; - - /* check if we got a good device name */ - - for(; i < argc; i++) - { - if((p = strstr(argv[i], DEVSTRING)) != NULL) - { - found = 1; - break; - } - } - - if(found == 0) - { -#ifdef PPPDEBUG - fprintf(dfp, "did not found [%s], exit\n", DEVSTRING); -#endif - exit(0); - } - - /* everything ok, now prepare for running ppp */ - - /* close all file descriptors */ - - i = getdtablesize(); - - for(;i >= 0; i--) - if (i != 2) - close(i); - - /* fiddle a terminating zero after the rbch unit number */ - - p += strlen(DEVSTRING); - - if(isdigit(*p) && isdigit(*(p+1))) - *(p+2) = '\0'; - else - *(p+1) = '\0'; - - /* construct /dev/i4brbchX device name */ - - sprintf(buffer, "%s%s%s", I4BDEVICE, DEVSTRING, p); - - /* open the rbch device as fd 0 = stdin */ - - rbch_fd = open(buffer, O_RDWR); - - if(rbch_fd != 0) - { - if(rbch_fd < 0) - syslog(LOG_INFO, "cannot open %s: %s", buffer, strerror(errno)); - else - syslog(LOG_INFO, "cannot open %s as fd 0 (is %d): %s", buffer, rbch_fd, strerror(errno)); - exit(1); - } - - /* dup rbch device fd as fd 1 = stdout */ - - if((i = dup(rbch_fd)) != 1) - { - if(i < 0) - syslog(LOG_INFO, "cannot dup rbch_fd: %s", strerror(errno)); - else - syslog(LOG_INFO, "cannot dup rbch as fd 1 (is %d): %s", i, strerror(errno)); - exit(1); - } - - /* construct the label for ppp's ppp.conf file */ - - sprintf(buffer, "%s%s%s", PPPLABEL, DEVSTRING, p); - - syslog(LOG_INFO, "executing: %s %s %s %s", PPPPROG, PPPNAME, PPPARG1, buffer); - - /* execute ppp */ - - if((execl(PPPPROG, PPPNAME, PPPARG1, buffer, NULL)) == -1) - { - syslog(LOG_INFO, "cannot exec: %s", strerror(errno)); - exit(1); - } - syslog(LOG_INFO, "finished: %s %s %s %s", PPPPROG, PPPNAME, PPPARG1, buffer); - return(0); -} - -/* EOF */ diff --git a/share/examples/isdn/v21/Makefile b/share/examples/isdn/v21/Makefile deleted file mode 100644 index 261cec10441f..000000000000 --- a/share/examples/isdn/v21/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ - -PROG= v21modem -NO_MAN= -DPADD= ${LIBUTIL} ${LIBM} -LDADD= -lutil -lm -CFLAGS+= -g -Wall - -.if !defined(BSDTYPE) -BSDTYPE!=uname -.endif - -.include diff --git a/share/examples/isdn/v21/README b/share/examples/isdn/v21/README deleted file mode 100644 index 52f553c31307..000000000000 --- a/share/examples/isdn/v21/README +++ /dev/null @@ -1,50 +0,0 @@ - - V.21 Modem for ISDN4BSD. - -INTRODUCTION: - -The modem is implemented in software and is rather simple minded. - -It works with my Telebit TB2500 and Zyxel 2864I modems. - -There are plenty of knobs and handles which can be adjusted and I have -no real idea what to set them to for best all-round performance. - -The carrier detect timer may be a bit short tempered, and this is -probably why the dialing modem needs to be told to talk V.21 up -front. If this code were mode tolerant of loss of carrier auto -negotiation might work. - -When you get carrier ("CONNECT 300"), you must press a key before the -login banner gets printed. See the comments in "input_byte" why this -is. - -THE KERNEL PART: - -Implementes a crude "send these tones" facility, but it is enough to -take most of the real-time worries out of doing FSK modulation in -software. If suitably extended, the code could also be used to -send DTMF tones and other similar signals. - -INSTALLATION: - -The program is started from /etc/isdn/isdnd.rc: - -entry - name = I4BTEL - usrdevicename = tel - usrdeviceunit = 0 - isdncontroller = 0 - isdnchannel = -1 - local-phone-incoming = 2934812934 - remote-phone-incoming = * - dialin-reaction = answer - answerprog = v21modem - b1protocol = raw - idletime-incoming = 5 - - -Poul-Henning (phk@freebsd.org) -19991212 - -$FreeBSD$ diff --git a/share/examples/isdn/v21/v21modem.c b/share/examples/isdn/v21/v21modem.c deleted file mode 100644 index 2707cdb392b5..000000000000 --- a/share/examples/isdn/v21/v21modem.c +++ /dev/null @@ -1,394 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - * - * This is a V.21 modem for ISDN4BSD. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -static void create_session(void); -static void input_byte(int byte, int stopbit); -static void sample(int vol, int* tones); -static void tonedetect(unsigned char *ptr, int count); -static void uart(int bit); - -static int dcd; /* Carrier on ? */ -static int ptyfd = -1; /* PTY filedescriptor */ -static int telfd = -1; /* I4BTEL filedescriptor */ - -/* - * Alaw to Linear [-32767..32767] conversion - */ - -static int a2l[256] = { -5504, -5248, -6016, -5760, -4480, -4224, --4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, -7040, --6784, -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, --3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, -22016, --20992, -24064, -23040, -17920, -16896, -19968, -18944, -30208, --29184, -32256, -31232, -26112, -25088, -28160, -27136, -11008, --10496, -12032, -11520, -8960, -8448, -9984, -9472, -15104, -14592, --16128, -15616, -13056, -12544, -14080, -13568, -344, -328, -376, --360, -280, -264, -312, -296, -472, -456, -504, -488, -408, -392, --440, -424, -88, -72, -120, -104, -24, -8, -56, -40, -216, -200, --248, -232, -152, -136, -184, -168, -1376, -1312, -1504, -1440, --1120, -1056, -1248, -1184, -1888, -1824, -2016, -1952, -1632, --1568, -1760, -1696, -688, -656, -752, -720, -560, -528, -624, --592, -944, -912, -1008, -976, -816, -784, -880, -848, 5504, 5248, -6016, 5760, 4480, 4224, 4992, 4736, 7552, 7296, 8064, 7808, 6528, -6272, 7040, 6784, 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368, -3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392, 22016, 20992, 24064, -23040, 17920, 16896, 19968, 18944, 30208, 29184, 32256, 31232, -26112, 25088, 28160, 27136, 11008, 10496, 12032, 11520, 8960, 8448, -9984, 9472, 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568, -344, 328, 376, 360, 280, 264, 312, 296, 472, 456, 504, 488, 408, -392, 440, 424, 88, 72, 120, 104, 24, 8, 56, 40, 216, 200, 248, 232, -152, 136, 184, 168, 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184, -1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696, 688, 656, 752, 720, -560, 528, 624, 592, 944, 912, 1008, 976, 816, 784, 880, 848 }; - -/* - * A High Q Tone detector - */ - -#define NTONES 2 /* Number of tones to detect */ -#define SCALE 4096 /* Scaling factor */ -#define EXPAVG 14 /* Exponential Average factor */ -#define POLERAD 3885 /* pole_radius ^ 2 * SCALE */ - -/* Table of "-cos(2 * PI * frequency / sample_rate) * SCALE" */ -static int p[NTONES] = { - -2941, /* 980 Hz */ - -2460 /* 1180 Hz */ -}; - -static void -tonedetect(unsigned char *ptr, int count) -{ - int i, j; - int y; - int c, d, f, n; - static int k[NTONES], h[NTONES]; - static int tones[NTONES]; - static int amplitude; - - - for (i = 0; i < count; i++) { - y = a2l[*ptr++]; - if (y > 0) - amplitude += (y - amplitude) / EXPAVG; - else - amplitude += (-y - amplitude) / EXPAVG; - - for(j = 0; j < NTONES; j++) { - c = (POLERAD * (y - k[j])) / SCALE; - d = y + c; - f = (p[j] * (d - h[j])) / SCALE; - n = y - k[j] - c; - if (n < 0) - n = -n; - k[j] = h[j] + f; - h[j] = f + d; - tones[j] += (n - tones[j]) / EXPAVG; - } - sample(amplitude, tones); - } -} - -/* - * Taste each sample, detect (loss off) carrier, and feed uart - */ - -#define NCARRIER 1000 /* Samples of carrier for detection */ - -static void -sample(int vol, int* tones) -{ - static int carrier; - - if ((tones[0] + tones[1]) > vol * 3/2) { /* XXX */ - if (carrier < NCARRIER) - carrier ++; - } else { - if (carrier > 0) - carrier --; - } - - if (!dcd && carrier > NCARRIER / 2) { - syslog(LOG_ERR, "CARRIER ON"); - dcd = 1; - } else if (dcd && carrier < NCARRIER / 2) { - syslog(LOG_ERR, "CARRIER OFF"); - dcd = 0; - } - - if (!dcd) - return; - - if (tones[0] > tones[1]) { - uart(1); - } else { - uart(0); - } -} - -/* - * A UART in software - */ - -#define BITCENTER 13 /* Middle of a bit: 8000/300/2 */ -static int bitsample[] = { /* table of sampling points */ - BITCENTER, - BITCENTER + 27, - BITCENTER + 54, - BITCENTER + 80, - BITCENTER + 107, - BITCENTER + 134, - BITCENTER + 160, - BITCENTER + 187, - BITCENTER + 214, - BITCENTER + 240 -}; - -static void -uart(int bit) -{ - static int n, v, j; - - if (n == 0 && bit == 1) - return; /* Waiting for start bit */ - if (n == 0) { - j = 0; /* Begin start bit */ - v = 0; - n++; - } else if (j == 0 && bit && n > bitsample[j]) { - n = 0; /* Gone by middle of start bit */ - } else if (n > bitsample[j]) { - j++; /* Sample point */ - if (j == 10) { - n = 0; - input_byte(v, bit); - } else { - v = v / 2 + 128 * bit; - n++; - } - } else { - n++; - } -} - -/* - * Send a byte using kenrnel tone generation support - */ - -static void -output_byte(int val) -{ - struct i4b_tel_tones tt; - int i; - - i = 0; - tt.frequency[i] = 1850; tt.duration[i++] = 27; - - tt.frequency[i] = val & 1 ? 1650 : 1850; tt.duration[i++] = 27; - tt.frequency[i] = val & 2 ? 1650 : 1850; tt.duration[i++] = 26; - tt.frequency[i] = val & 4 ? 1650 : 1850; tt.duration[i++] = 27; - tt.frequency[i] = val & 8 ? 1650 : 1850; tt.duration[i++] = 27; - tt.frequency[i] = val & 16 ? 1650 : 1850; tt.duration[i++] = 26; - tt.frequency[i] = val & 32 ? 1650 : 1850; tt.duration[i++] = 27; - tt.frequency[i] = val & 64 ? 1650 : 1850; tt.duration[i++] = 27; - tt.frequency[i] = val & 128 ? 1650 : 1850; tt.duration[i++] = 26; - - tt.frequency[i] = 1650; tt.duration[i++] = 27; - tt.frequency[i] = 1650; tt.duration[i++] = 0; - - i = ioctl(telfd, I4B_TEL_TONES, &tt); - if (i != 0 && errno != EAGAIN) { - syslog(LOG_ERR, "%d: *** %d/%d ***", __LINE__, i, errno); - exit(0); - } -} - -/* - * Create Session - */ - -static void -create_session(void) -{ - int i; - char buf[100]; - - i = forkpty(&ptyfd, buf, 0, 0); - if (i == 0) { - execl("/usr/libexec/getty", "getty", "std.300", "-", - (char *)NULL); - syslog(LOG_ERR, "exec getty %d", errno); - exit(2); - } else if (i < 0) { - syslog(LOG_ERR, "forkpty failed %d", errno); - exit(2); - } - syslog(LOG_ERR, "pty %s", buf); -} - -static void -input_byte(int byte, int stopbit) -{ - u_char c; - int i; - static int first; - static u_char buf[80]; - - if (!stopbit) - return; - c = byte; - /* - * I have no idea why, but my TB2500 modem sends a sequence of - * 28 bytes after carrier is established at the link level, but - * before it is acceptted at the logical level. - * - * [16100214010201060100000000ff0201020301080402400010034510] - * - * Unfortunately this contains a ^D which kills getty. - * The following code swallows this sequence, assuming that it - * is always the same length and always start with 0x16. - * - */ - if (first == 0 && c == 0x16) { - sprintf(buf, "%02x", c); - first = 27; - return; - } else if (first == 0) { - first = -1; - dcd = 2; - return; - } - if (first > 0) { - sprintf(buf + strlen(buf), "%02x", c); - first--; - if (!first) { - syslog(LOG_NOTICE, "Got magic [%s]", buf); - *buf = 0; - } - return; - } - if (ptyfd != -1 && dcd) { - i = write(ptyfd, &c, 1); - if (i != 1 && errno != EAGAIN) { - syslog(LOG_ERR, "%d: *** %d/%d ***", __LINE__, i, errno); - exit(0); - } - } -} - -int -main(int argc, char **argv) -{ - char *device = "/dev/tel0"; - u_char ibuf[2048]; - int ii, io; - int i, maxfd; - struct i4b_tel_tones tt; - fd_set rfd, wfd, efd; - - openlog("v21modem", LOG_PID, LOG_DAEMON); - /* Find our device name */ - for (i = 0; i < argc; i++) - if (!strcmp(argv[i], "-D")) - device = argv[i + 1]; - telfd = open(device, O_RDWR, 0); - if (telfd < 0) { - syslog(LOG_ERR, "open %s: %m", device); - exit (0); - } - syslog(LOG_NOTICE, "Running on %s", device); - - /* Output V.25 tone and carrier */ - i = 0; - tt.frequency[i] = 0; tt.duration[i++] = 1000; - tt.frequency[i] = 2100; tt.duration[i++] = 2*8000; - tt.frequency[i] = 0; tt.duration[i++] = 400; - tt.frequency[i] = 1650; tt.duration[i++] = 1; - tt.frequency[i] = 1650; tt.duration[i++] = 0; - tt.frequency[i] = 0; tt.duration[i++] = 0; - i = ioctl(telfd, I4B_TEL_TONES, &tt); - if (i < 0) { - syslog(LOG_ERR, "hangup"); - exit(0); - } - - create_session(); - - /* Wait for carrier */ - do { - ii = read(telfd, ibuf, sizeof ibuf); - tonedetect(ibuf, ii); - } while (ii > 0 && dcd != 2); - if (ii < 0) { - syslog(LOG_ERR, "hangup"); - exit(0); - } - - maxfd = ptyfd; - if (telfd > maxfd) - maxfd = telfd; - maxfd += 1; - do { - FD_ZERO(&rfd); - FD_SET(telfd, &rfd); - FD_SET(ptyfd, &rfd); - FD_ZERO(&wfd); - FD_ZERO(&efd); - FD_SET(telfd, &efd); - FD_SET(ptyfd, &efd); - i = select(maxfd, &rfd, &wfd, &efd, NULL); - if (FD_ISSET(telfd, &rfd)) { - ii = read(telfd, ibuf, sizeof ibuf); - if (ii > 0) - tonedetect(ibuf, ii); - else - syslog(LOG_ERR, "hangup"); - } - if (FD_ISSET(ptyfd, &rfd)) { - io = read(ptyfd, ibuf, 1); - if (io == 1) - output_byte(*ibuf); - else if (io == 0) { - syslog(LOG_ERR, "Session EOF"); - exit(0); - } - - } - if (FD_ISSET(telfd, &efd)) { - syslog(LOG_ERR, "Exception TELFD"); - exit (0); - } - if (FD_ISSET(ptyfd, &efd)) { - syslog(LOG_ERR, "Exception PTYFD"); - exit (0); - } - } while (dcd); - syslog(LOG_ERR, "Carrier Lost"); - exit(0); -} diff --git a/share/examples/ppp/isdnd.rc b/share/examples/ppp/isdnd.rc deleted file mode 100644 index 0ceef6d2f836..000000000000 --- a/share/examples/ppp/isdnd.rc +++ /dev/null @@ -1,69 +0,0 @@ -# example of a configuration file for the isdn daemon & user-ppp -# -# $FreeBSD$ - - -# SYSTEM section: isdnd global configuration parameters - -system - -# accounting - -acctall = on # generate info for everything -acctfile = /var/log/isdnd.acct # name & location of accounting file -useacctfile = yes # generate accouting info to file -isdntime = on -monitor-allowed = no # global switch: monitor on/off - - -# User-ppp example - -entry -name = userppp0 -usrdevicename = rbch -usrdeviceunit = 0 -isdncontroller = 0 -isdnchannel = -1 -local-phone-incoming = 1234567 -remote-phone-incoming = * -local-phone-dialout = 1234567 # This *MUST* be your local number -remote-phone-dialout = 1234567 # ppp(8) will override this -remdial-handling = first -dialin-reaction = ignore -dialout-type = normal -b1protocol = hdlc -idletime-incoming = 900 # Should be larger than ppp's timeout -idletime-outgoing = 900 # Should be larger than ppp's timeout -unitlength = 0 -unitlengthsrc = conf -dialretries = 1 -dialrandincr = on -recoverytime = 1 # Should be smaller than ppp's redial -usedown = off -downtries = 2 -downtime = 30 - -entry -name = userppp1 -usrdevicename = rbch -usrdeviceunit = 1 -isdncontroller = 0 -isdnchannel = -1 -local-phone-incoming = 1234567 -remote-phone-incoming = * -local-phone-dialout = 1234567 # This *MUST* be your local number -remote-phone-dialout = 1234567 # ppp(8) will override this -remdial-handling = first -dialin-reaction = accept -dialout-type = normal -b1protocol = hdlc -idletime-incoming = 900 # Should be larger than ppp's timeout -idletime-outgoing = 900 # Should be larger than ppp's timeout -unitlength = 0 -unitlengthsrc = conf -dialretries = 1 -dialrandincr = on -recoverytime = 1 # Should be smaller than ppp's redial -usedown = off -downtries = 2 -downtime = 30 diff --git a/share/examples/ppp/ppp.conf.isdn b/share/examples/ppp/ppp.conf.isdn deleted file mode 100644 index 8946b4bb3010..000000000000 --- a/share/examples/ppp/ppp.conf.isdn +++ /dev/null @@ -1,98 +0,0 @@ -# -# Copyright (c) 1997 Brian Somers -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ - -# This is an example ppp profile for bringing up a multilink ppp connection -# over ISDN. It needs at least version 0.83.0 of the i4b code. An example -# isdnd configuration file is also supplied in this directory (isdnd.rc) -# -# NOTE: This is for use with i4b-supported ISDN cards. If you have an -# external Terminal Adapter (TA) plugged into a serial port on your -# machine, you should use the TA example in ppp.conf.sample. -# -isdn: - set phone 12345678 # Replace this with your ISPs phone number - - set authname "somename" # Replace these with your login name & password. - set authkey "somepasswd" # This profile assumes you're using PAP or CHAP. - - set enddisc mac # Assuming you have a LAN - - enable lqr echo - set reconnect 3 5 - set redial 3 10 - set lqrperiod 45 - disable pred1 deflate mppe - deny pred1 deflate mppe - - set timeout 60 300 # The minimum charge period is 5 minutes, so don't - # hangup before then - - # We have no chat scripts in the ISDN world (yet) - set dial - set login - set logout - set hangup - - set device /dev/i4brbch0 /dev/i4brbch1 # Raw B-channel devices - set speed sync # ISDN is synchronous - - enable dns # Ask the peer what to put in resolv.conf - - # Take a wild guess at an IP number and let the other side decide - set ifaddr 172.16.0.1/0 212.0.0.0/0 0 0 - add! default hisaddr - - set mrru 1500 # Multilink mode please - set mru 1504 # Room for the MP header - - clone 1,2 # Two new links - link deflink rm # And get rid of the original one - - link * set mode auto # Automatically manage the second link - set autoload 10 80 30 # Down @10% usage, up at 80%, 30s sample - - set server /var/run/ppp/ppp-isdn "" 0177 # The diagnostic port (-rw-------) - -# -# When phone calls become free (say 0:00 Saturday morning), we may want -# this in crontab (``crontab -l'', not /etc/crontab): -# -# 1 0 0 0 6 /usr/sbin/pppctl /var/run/ppp/ppp-isdn link \* set mode ddial -# -# and when we have to pay again (say 23:59 Sunday night), we may want -# this: -# -# 54 23 0 0 0 /usr/sbin/pppctl /var/run/ppp/ppp-isdn link \* set mode auto -# -# And of course just in case of a weekend reboot, add -# /usr/local/etc/rc.d/ppp.sh: -# -# #! /bin/sh -# [ ."$1" != .start ] && exit 0 -# case `date +%w` in -# 6|0) /usr/sbin/pppctl /var/run/ppp/ppp-isdn link \* set mode ddial;; -# esac diff --git a/share/examples/ppp/ppp.conf.sample b/share/examples/ppp/ppp.conf.sample index f59d18dde874..7863eaaebf2e 100644 --- a/share/examples/ppp/ppp.conf.sample +++ b/share/examples/ppp/ppp.conf.sample @@ -672,8 +672,6 @@ callback-server-client-decides: # It's worth increasing your MTU and MRU slightly in multi-link mode to # prevent full packets from being fragmented. # -# See ppp.conf.isdn for an example of how to do multi-link isdn. -# # You can now ``dial'' specific links, or even dial all links at the # same time. The `dial' command may also be prefixed with a specific # link that should do the dialing. diff --git a/share/isdn/0.al.uu b/share/isdn/0.al.uu deleted file mode 100644 index 84ed15f65e0f..000000000000 --- a/share/isdn/0.al.uu +++ /dev/null @@ -1,323 +0,0 @@ -# $FreeBSD$ -begin 644 0.al -M5=75U=?7UM?4U=;3U-37U55555545%15U=7555175U965U15U=34U-?7U];6 -MT=?555175%555575U=75U=55U=37U]?7U]37U]34U5555=55555455145516 -M4U)75%77U];0T-#1T=#1UM155%=75U=55555U=37U]?7U5555U=65E=75E?5 -MU];1UM?6UM?4U5545E975U74U]?4U]?4U%555%15U=75U534T=75UU55U-35 -MU=74U555U=37U-?4U%575E965E=75-75U-34U=74U]?7U]34U5545=34U-75 -MU-75U=75U=74U5545U175575U-37UM;0T-5655915U175=34U-34U];7U]?4 -MU-3555575E%15E965%75U];1UM?7U-35U-74557555145%15U=75U575U-34 -MU=75U=34U555U5545%16U-=5U=55U=75U-75U-35U-37U]?6UM?7U]34U=54 -M5U9145965E=75U145575U-?7U-34U-37UM;6U]?4U-35U-?7U-5555175E96 -M5U965E164=35U-'0T-;6UM?7U575U-?6U];6U]545%965U14557555145=75 -MU555U=75U-34U=55U=35U=75U-?4U=555575557555755555U=35U=;0U-?7 -M55545U175U975U=55=74UM'6U-755=75U-;1T=;1UM?4U-75551745%15E15 -MU=37U]37U-5555545%75U-37U];7U]34555555574U-75U=45=76T='0T-'1 -MU]555%155575U=75555555545%145=34U]34U5555%145%15U-37UM;7U-55 -M5%74U]'0T]/0UM?55%1745!04%;7UM74U]36UM?4U5175%145575U-555515 -M5%=45U=75%145%74U-37UM'1T-#0T='1UM?455=645975%1455175%75U=75 -MU=36UM?7UM;6UU%05%=75514U=75U555U=555%145-74U-34U]'1T='1T='6 -MU-555U%04%!15E=4U=34U-34U-?7U]35U-37U]?4U=75U];1UM?455=645%6 -MU=175555U555U=74U5545U975U15U=37UM;7U];6U]3555555U=5U=55U=35 -MU=35U5755535U-?7U-75U-74U=55U=75U=35U-37U];7U]565]155=?4U=35 -MU=75U555U57555175%545U145U=45=75U-37T=#0T=;7U%545%145U15U=37 -MU]37U]155%=75U965U35U=37UM'1T=#7U]+0U=34U=75U5545U9145%65U=4 -M55=65U145=75U=;1T=;1T=#3TM/1U]545U965U=65E145U145%=45=37U]?1 -MT='1UM?4U-34U-555%=675-64%945=?3T]#0T]/1U]35555555555%15U=54 -M5U=75U975U=45%75U-?6UM;6U]555%35U-?6UM;4U-755%=75%155%55U515 -M55145-70T-?0T=?4U]?555175%555%755=74U-37U]?5U55555175U=55=74 -MU-?6U]?4U5175U1455555=74U-75U-34U-5555555=75U-?4U]?6UU=5UU55 -M551555545%555=55U=35U=75U5555-75U=?7U];7U]35U5145U=455175U14 -M5=34U]?4U-74U55555755=75U=37U]355%145%17U]565%14U-35U=75U=35 -MU=77UM;7U=74U]34U=74U]?7U=7555175E965U=4U=?7UM;6UM34U-355=75 -MU-34U-3555=45U9145975-7555=15=;4U]?7U-?7U]?7U]?7U]?4U5545514 -M5%145%965U35U=555=77U];6UM'6U]?4U-?7U-5555=645%65%545%145554 -M5=74T=#2TM/1T=+65%5645%04%965U=55575U]?7U]35U=77U];6UM;6UM;7 -MU51645!045%65U15U=555574UM;1T-#1T='6U];7U-555=555%=65U145516 -M4U955E155%75U-?6T='0T='6U]7555555575U]?4U=545E=75U145%145%15 -MU=36UM34U-34U-37U-34U]35U55555145%145U175U155-33UM74U-31UM?7 -MU-34U-34U-35U-34U5=65E965U15U=55U=74U-34U-34U-555555U=555=75 -MU=77U];6U]155%15U=34U575U-?6UM;3T574U%1555175E=45%965%34U-37 -MU-5555175E975-77T=/2T];4U=575U=5U-?7U=55U=7555545%175E74U-?6 -MUM;7U]34U]575E965U35T=15U%555555U=75U-34U]?6UM?4U-755575U=35 -MU-555%=65U=45%15U=37U]'7U-755%1555545%175U=45=77U]?4U=555=77 -MU]?7UM57U-?5U-75U=77U]?7U-?7U]355=545%555%965U145%74U-;7UM;7 -MU-34U-34UM;7U5165E%145975%155=75555555545%15U=36T=#6T-W1U];7 -MU-555%=45%1555=75%555%175U14U-?1T]+2T-'7U-?45%914%975%545555 -MU=75U-745%175U75U-?7UM;1T='6UM?555175E=14E=55U145%74U];1T=#1 -MU]34U-35U5545%755575U]35U51645!15U75U-;6U];7U]34U5555%75U=75 -MU-34U=555%155%54551455555]7155555U35U=34U];6T='7U]37U-755%=4 -M5U=5U535U-?5U=55U=36U-74UM14U%51U%115%=7U-;4U%=75%=5U=77U=75 -MU=?7UM#3T]/0U5%45U!04597UU?55576U-'5U=75U]34U-555E=15E=5U-?6 -MU]'1UM;5555555=55%!7TU'05%335-Y6T%%5U5;445565U17U5=5U=31U]'1 -MW=34U%575%=75U15U-34U-37U]?7U=35U-?6T=;7U5545E%145965U34U]34 -MU-34U%555U=45=77UM'0T-;7U-555%965U=75-75U-35U%=1U-34T=#1T=;6 -MU]555U145%=65E=75U35U5545555U=55U=74U];1T=#0T=?4U-35U=555517 -M5E965U175575U-?45=75U=34U];6T=;6TMS0T-955E904%!045975=75U=75 -M55555%55U=77T='1UM'6U]?5U5145U=75%1455145%15U=?6U]34U=75U=34 -MU];1T=;6U]?7U5575E9275%04515U-;1T='0T=?7U-555575U-755575U=75 -MU5575E=65U=45U=45=37T=#0T='6UM;7U]555%=65U=75U15U=345=75U=77 -MU]?7U-'05=755-74U-1555145U965U155=34U]?7UM355=74U-75U=74U-?6 -MU]?455545U=45515U=75U=555U145%75U=34U];1T='1UM;7U]?445-745%7 -M5%7555555=75U-35U=7555555%15U=37U]37U];6T-'6U]355%9645!04%!6 -M5-36T=;7U]155575U=?6UM'6UM?4U5145U145U34UE145%975555U=37UM'6 -MU];1T=?455965U=75U=5U=55U=75U555U=?7UM;6UM=55U=75U15U=34U]35 -MU=74U]35U575U-34U5575U=45%!0U575UM'0T-;6UM;4U=555=75U=37U-55 -M5U=65E965U=65U145=36T-/0T]#6UM545U145%155=74U=35U=5555145%75 -MU-74U=37U]75UM95U=5455175U=75U35U]'1T-#6U]35U=74U-34U5545U=6 -M5U965E945=74U];6UM;6UM?7UM;6U]?4U]?7U]5555145%175%175%545%10 -M4%55U=?4U]?7U]?7U]?7U]?4U-34U-34U=755=7555155%965%145%145574 -MU-;6UM;1UM?4U555U=555555U-34U5545U915E=4U=?7UM+3U]'7U-34U=55 -M5%=645%15E975%15U=34U]?7U]?4U-?1T=#0T-?4U=55U5545%=65E965U=4 -M5%74U-?6T=;7U]?7U-5555175U74U-;1U=76U5145U965U74U]?7U]?55517 -M5U=75E145=34UM;1T-'0UM?4U5145%55U5555%915U35U]?7UM35U=75U=37 -MU]?7UM;7U]34U-545E;455955%155%145%15U-?7U]?4U5555%75U=75U=55 -M5=75U=555575U=74U-37U-?7U];6U]15555455555=74U=37U-545E=75%75 -MU-37UE35UM35U575U=755575U=7555145%15U-?7U]155%175%555=55U=37 -MU-35U=77U]?5U-75U5575U155=34U5555%75U=74U-36UM'1UM;6W=!5U%57 -M5E9645975E155=75U5555=55U=74U]?4U-745=75U=37U-555U9645%65%74 -MU]'1T='1U]35U=75U=555=75U=35U5545%14U=575=145-55U-?7U]?4U]34 -MU-34U5555%175U15U=34U-55557555555%145=74U5155%155574U-?6U]34 -MU575U=36U]?4U-555U=75U=65='1U]'6U]34U=37U-555%145%=5U=755555 -M555555555555U=36T='1T=;4U55555545%145%145%145%555=75U5555=74 -MU-37U]'1T=;75]37U=7555545%175U74U-37U]?4U=75U=545U965U35U-?5 -MU=74U-34U-35U=75U-?6U]74U=75U=75U=5455545%15U=?6U]37U%545E36 -M55=55U=555555=75U-37U];6U]?6U]'1UM;4U5545%915U=4U=34U-345515 -MU-?4U-35U575U575U=74U5545U%045975U15U575U-37U537T=;3T]+2T]#6 -MU]1555=75E975%145%545U914%-045=5U-?6T=#0T-;7U5545%74UM'6T='7 -MU]34U575553555175E145%55U=3555?5UU5755175%75U]?4U=35U-34U]?4 -MU=74U-?6T=;1UM?6U]35U-755%=65E=75E!04%!65]77UM'1UM?7U-?55=74 -MUM;1T='1U]155%=65U!?4%=15%75UM'1T=;7U-?7U]?7U]?4U5545%155%14 -M5U914%!05E14U-;0T=;7UM?6U]?6U]?7U]?7UM'7U-145E%045145554U=75 -MU517U-'45=34U=145U=15E=65575U-?6U];4U-;4U-555=77U];6U];7U-75 -MU=3455575E904%%05E965E34U=;7U-75U=745=75U=;6T=#0UM'45-355=34 -MU=34U=35U=75U-35U-35U-35U=755%=65U=65E945U1555175%75U5555%74 -MU]?6T-#1T]'7UM'1T=#1T='6U]3555145%965E775%=55U145U145U165E14 -MU=555%145-74U-?1UM;6U]35U=?6U];6U]#3T='6U-;3T=;1U]7555=65E96 -M5E965E975U=14U)24U-75%745576T=;6T='1UM'4U-/1UM'1U-?7U]'1T-#1 -MUM?1UU5555575=34U=?6UM35U5=14UU=7%U275Q>7UQ24%;5U=74U576UM?2 -MW=W -M5E17551645%075)=7%E86UM86%A97%!15E71T]S>WL7$QL''QL3$Q,3%V=_2 -MW=W155=14%Q?7U]<4E!65E95U-7455=14UQ>7EE:1$1:7U)97U-35U=4U];0 -MW=G:QL3&QL'&P<':V][7UQ34%=5U]/Q<3%Q\3% -MQL?%V-[>V=[?W-/7U]'645)>6UI'1$1;4%34T=/=W-O8V=_=UE127EA;6D1' -M1%I:6%A97EQ24%37T-+=WMG8V\?;VMK9WM_?W-G9V-G?W-W0UU514UQ?65E> -M65Y<7%)5U]'7UQ24E)05E95UM'1TMS>V=C; -MVL7:V=G>WMC?W=S?W-/2T-'45U!04UE;6UM;65Q05-77T][;V][;V-%44%A% -M1$%"34%:6%]<7U97U=?6T-/6%Y?75)1U];7TMC:Q,39W]W15E];1$!"0T!%6%A?7%-4U574U]/< -MW-_>V=G9WM_=W]_=W=[?W-+3T]#7U-=55U%24%-34%-<75)145)05=;4TMC; -MQ<38W]+74%E$04%#0D!%6UE<45165=77UM+=W]_?V=O9W-_0TM+7U155M'?WMC:V=_W='7U=32T]/2W-G>W='1UM=55%%04%U?6%A94E)7 -MU]76W-[;Q-K?W]W54U]%1D9`0$186EA>7E]?4E!5T=#8V<3&PT]#6 -MT-S7%U=4-'75=S9V\3%W-S?55Q91D-#3$Q" -M6EE;6%M24535T-S?W]G%P,;:V-S4-305=7U=W6T]#2WM+W]K%WMK8V=+!W\7%U=90 -M4%M>0D5:1D-:5=%55M['R\["P<3:4UI-2W9R?GQU2'5"75?3UM[8S<3;SW-+7%Z86!O:V-Y87A?VLKYY>;LX_KEY//` -MTD1$6W9\0D)U6D17R\[7S_3+SL'1U--'25I-<5OLYTGF[?;HXEKWX4YC8&L7 -M%Q$=%V)N;731]>7F[):1ZI67Z./[P59?>F]B8FYL8V=)U=3QX>#GYN;EYE]`68&,1'1,9$&$4%$/PS.7LZI.=E>J2E?KSWD9V -M81=L8!5J8']-WE7VZ^[C[^O@Y?%=4$!A:.&0%$V8R.613GKJ5A@7;A\;$AX< -M<&%H].C@[IV3G)F5[Y?A=W%R:6\5$VID;F+7SO#@X.*5E>7DX_?537Y%EI-O -MRH7G_.9(9O=M`!D0!`8;'19$<'.4G)&0FYN8G>+FXM=O:F\7%Q8694-YODV,3P5GID8&==GH=FD(GOD)-_9<43"P`$#@\!&AQ9\,6;@(>'@X&8 -MF.%?WV\9&AT9'A042.3_^)2=E>OHY_K9=GIS>FAM8F?KC9QVCXSJF_D59F8" -M-P(""PP''&>5ZI>"CH.&@(21XGH6%Q\!!AT1:G'9[IV2EY":_B&AIB/M8V%F97$7@PV<5%A!K9VQEP?_\EHBUEY^)EN#E!@T%`S;AYJ>F9#T9VD7$AP8'&)UW?/ZA+.QXX:UZ^AW -M-0@!"3`R#@494_GIC+>(AH&"G%5M&`<:``P$;]?P[IB&@8>2E.K1%!X8'1(2 -M$V[W[/[OCKV*YH*#]N(=-@L#"38P#!1PXI&*AIV=ZVT:`0(!!00?<928 -MGIN!AIN7]'%B$1@'&VIA9DW[[).UO(W/@HSZ;0`U"P@(-#`/0^SLD(:+M8B! -MD/KU809C4V"0X.#@L-%Y2#@YZ;B+>,YQ$69A8!"0\91O+RYY&!C8>7 -MY?O^=Q(%&!=M;&QU\.J"L[&:_>Z%FA,Q,`D##S0U!WV7@8V&AXR*B980&Q<5 -M!0D)&DK[X>R0A(&'F.C5<']@$1L>:'YP3]^5C+&WA_K'D9YL-3`W#08/"P!O -ME8:"@X"`@H*931P:'QP'`@84]Y21DIB%FIZ6_'X5%VH4$Q(5<<7EFK6VCY#- -MXIOL!# -M[_K,9AD``P478'U6,5$!(1;W[3D(^TBH3\T9225`$V,0L! -M!P``'?&8@8*,C("?XLI28AD#`@07>$'9X9.%A9B3[/1,9V\5$!T2%'_M@;6T -MC)/)Y9'O%P@P-@X'!`8$:.N&C8R,@H:3^M5_%P0-`AIN0]/WZ)Z'A)Z4Y-EQ -M8A41'1\2:U:=B;>U@>_QE)#%!ST@^Q6X9?&!#,[VQGR74$-S(V`A\2'6[LAHR,@H*`F/MM$!T; -M`0(!$5S@Z)>8EN5%8!<3$!$6%&U(_N_IDX*TMX+]$!50?0N0GYB9D^C(9147 -M%!44%&U/]N;BXN'FD(VUCI85'F'`:`(T-`(<%VY;XI"9A8&#FN9]8V!I'P0: -M%GO:Y.J3G9R=D>)18VAO;A06:''-\_'XX>'SVI6-BH#R$!;&_!8-"@D!'Q1R -M]/CBG8:"A^A61D)F$1L8$VI\\NF4EY&?Z^/S:<'66C(R24V9#]F<;``P/`1!TPU3VG8:!FI?R1&5C -M8A<>'VI2Y^/OEY"0ENGW?BZ>+^Q4=R8Q5/A8Z&E?38^L45 -M&`,(#P5KZ4 -MZ>?]P75A;&]J%?R-M8"3YO3W?1`%"30(!6YU6>25XO%/969C;FAJ;>V/M8*>YE%<9A(&"C<) -M!6+2_96>A(&#FN%E%!5I%180%W_FD9.7[NWA_=9D%Q`78'16]^;OE93JX=I\ -M;!07:VUC8'B4B+>/A>)]9A4>`#4W"01@^Y2&L6%Q5N9G5:59>)MX^9^V(7$AD&"S0/ -M&7#ODIB;F(2'DO1I'QL=;W%^?L7OD)V1[=YSWDSTYA -M%1`0%&][7,KY_OZ=B+6`D4<2'Q\9!PD+`!#2EYR>G9*9F971:AX8$'O8V\SZ -M[Y:0E/AP8F!@86=D?D;RZI:4Z>3.UT1];180%FE^5/;ZYN;\]Y"/B83I?Q(< -M'1T%#`\&$D#KG9Z2D9R=E?]X$1\09\7TRO7WY._NY5AE9'AU5]5>7<_AZ>[F -MPTYS<'1]86]O8'#6\?KDY.7Q45R4@(&3^V$=$A`1&0$!&Q3>EYR?D)>6E>WP -M>Q$<%G_0QL[>TOSOE>+,6G%]0U=92'=?].7AY=M&0U]70WA@8F="SOKG^_3= -M0WM!D(&%E_UM$11H:AX&!!YKR)23D)25E.CC]606$VM(Q??TUM/Y[^OASTUE -M94I80'5W7LS[X^3`4UA4VMU'>&-G<5/$QM_7745T>EB3@(:>ZW$4%Q07&0<' -M!1-!Z9V?DY&7[N/V>100%&=#PO'$P?[CZ._X4&=B9').6T5?Q?CL[^;SWEQ$ -M2W]@;FQG=M3+\_+WQE=T4Y&!A)+B9Q`0%Q43&@4;$$;HG)F2E^[D^O=U;A$6 -M8D#RYOW`QO;GX?[79&QA=MSWR\7V5]4/'GX?_3:\65DI*6[N'DYG)?A]LS&5GQO%!5EP^+JZ.?VP\W,UG=@:&ED6/?Z^//T]O[[\M]W9V-G -M<5W>V=W$]_[E_=YW9'')XY65X,)T>7AE86@1$A!KCMYN7Z_<%$>V%D -M<5+!S,+&QL_T]6Z^?QPM]==F9H%&EE -M7_/GYN7__?WP]=5P86U@>4+2S<_+]O+]]]K&_.#N[N;"=F!N:&AH:A5J;'_= -MY.B5Z^+XR-Q01W5S?W%'T/7^^/[SS-!?0DIV<')R=T34P_'\_//WS]Y7171\ -M?GUU1%?=TEU!\YV%FIN5=Q4<'AT=$Q,>$FA,[I^%A9WO]T)P?83'!Z8&X4%&AEU/CB[NWG_O;"T$!\86)@>DS;\/GX_/;/R_KOE97M -M]W1C:Q45:VAJ%6EA0O#LE)?KYO3714).=7!_'EP3EOUEYN;FYSF36X3'1X>'1\<$6]?XI"8F)V4 -MY=-/?'YE86-M877,XI>0EN[P7GYA8&-B8FUA?EKWX>[K[.3W54UT7QV -M1M+*^^+NZNKLY<-(9&\5%15J;F-Z2-+]X>SN[>;\P51&=W9Q<'9*0%':]?+] -M\,C?4D9-34!$6UE3T<7.]_'WS=U20W5S>'#/[923D^O^1F,5%A87%Q87%6UV -M].F1DI.4X;FY?/- -MTE!>7UQ=7UE;6UQ7W,GP_?+WP55&=7%R'Y]<71)1U+2S?#_^/C\]LS9U%U8 -M1T-,3DQ!6U#7WL;-SL["Q=U5745!0T)`1UE1T=O#SLK*R,+%WM1<75%4TMC: -MV==?3'=Q<'%W2TU&15E3U]C,]/'P\7UQ1U5515U!<75!05M?0T]S?TM+=TM+=TM#0T==555145-75 -MU=37U]154U-64U)04U!04U)24U!05E=5U=31T]W?V=O;V-G>W=/6U]1555=6 -M5%145U=64%-34%!05E77UM;7U]1445-<7UQ=4E)15-77T-+1UI645?3TM3=W-;1 -MW-/0W=/4U-115E=75]?4U];1T=/2W-/7U5914%U=4E-15U15U-34U5545=75 -MU-?7U];6U]35U=5445!045945=76T-/2TMW2TM/1UM?4U-7555145%965E=7 -M5E905E=75U=75%1345145%74U]'3W=SW-+1U]555U914%-34E)24E)34U-34%%1 -M5E=45%75U=34U-?7U]?7UM?7U]?7U]?4U-34U-75U=75U=75U=5555555=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -:____________________________________ -` -end diff --git a/share/isdn/1.al.uu b/share/isdn/1.al.uu deleted file mode 100644 index 60e59ca0cdce..000000000000 --- a/share/isdn/1.al.uu +++ /dev/null @@ -1,323 +0,0 @@ -# $FreeBSD$ -begin 644 1.al -M55=75%755=545U1455145575U-37UM'6U];6UM155%175U975U74U-35U-77 -MU]75U=75U=565=;5U-'1U]345%=75U15U=75U]?7U]545E975%75U]?55555 -M55555=74U]355%74U-74U-37U-34U]'6U]355=34U=35U5555574U]355=55 -M5]?6U=555%=75U975-74U]?4U%575U=75%755575U=?6T='6UM;6U]555516 -M5E965U15U-?7UM;5U5555=7555555=55U=34U];6U]?45%745U355=75U=74 -MU-355=7555165U=4U=?6UM?55=75U-55U-?6T=?55%914594U=?6T='1UM?7 -MU5145U145=34U-?7U-74U=555E=4U=755E-65%74UM'1UM;4U=355=55U=55 -MU=35U-155U%65U155=55U-?7T=#1T=;7U-74UM?7U55645%05E=55515U555 -M55555=34U-?6UM?6U]31T=75U5145=555555U=34U-355=77UM?4551645%1 -M45=45=77T=WW-5645U35M76T-/0U%9275)24%95U=355U=45=?1T]/0 -MUM?4U-37UM;1T=?45%=65E965U74U5575E975-77T=;4U=555%15U=?7U]?6 -MT=?4UM515E%15E74U]'3TM/0UM;7U-155U=65U=55%145575551745%15E96 -M5U35U-37UM?5U=34U-34U-?6T='3T]/0T-#0T='7U-34U575U-575E=65E90 -M4UU?7%Q<7U]?4U95U]'0T]/3T]+2TMW=W=/3T]+=W]G;Q<3$Q<3%V-W65E]& -M27=PW=WF1G9'I\=T%=U][:Q<'-PL_.R6=@8V-A9']W1E??P,CW\?/S\_#VRL+$W-;55EU1 -M5=?2V<7!P,;'QL;#S,_.PL766'5_9&!C8V!G>79&5=K.]_#R\O/S]O3(P]K= -MU%%?65]35=/>V\?#PLW`Q]O=UU1075Y96UI'04),24M)0T)"1UI94E;5UM+9 -MV]K:V]G?W][9V=_?WM[9V=[>WMS'-+6]3:S_3Q\/'WRLS`Q=_0UU104596U-//O[N[LX^?[_//V]&1G9'I_=T95Q_?R -M__[_\_3-V-1214!,3TQ-0$5;7U)04534UM/=W]C:Q<78W-/45E967%]34534 -MUM'3TM+0UM?55%904%%65E=45=555%%145!05E37T-+2W=W2T]#1UM;7UM35 -M55=75U965E=65U=645%045%75=74UM#3T]/3UM7755=45U975U15U]'0W=S= -MTM/3T-/1U]755%=145-34%945%75U-?7U-34U]?6T-W?W]W1U5!>1$U*='%Q -M<7=/15;>PO7P_?W]\O'*P]C=UUU:04](0E+?]?O@[._LX?+0<6,5$1(=$A$5 -M8W#4\>?MZ>CHZ>_MX^;D^?+UVU%)?F%O:A04%6]G=-+]X.F5E>OLYO/?0G]F -M;6-D=-_EZ):3DY;N_T1C%A\8&A@<$6Y^5_'G[>_N[.+@X>#@X^WBX.3QUW%@ -M:Q80$Q$58W'9^^R5EY>4Z./[R-1"<'AD9V9G9V1E?W=;Q/_CZI:0D);KY]YY -M:!`?&!@>$A=M<=CZ[)66D9:7E>[@_LQ2=F1B;FAK;F-Z3M_]X>[JE97H[>7* -M479D;&L4%Q<58';&[)&?FYJ>D.+:9Q8?&@0%&!T484G:_N/NZI27EI&1EI3I -MY\%W8A<2'Q\=$6]]VN?KEI"0D93OY_35=65B:!06%6!PPNF0GH6;G)3_=A0> -M!08&!!@3;W#<_^#NZ.N5EY:0DI.0E^SP2FP0'AH:&!)J>]SDZ9>6EI>5Z>/E -M]MU#?V!I%!81:'G0Z9^%AH&$G>%Q$00``@T`!!QH=\_G[.N5E9>1DYR9F9^3 -MZ/=\%!X$!P<:$FYWRN.5EY:6E.KNXN3]P5I_8VH6$!,3:$;XD(:#C8R&G/QN -M&`,.#@X"!!UI2L+DXNB7D9V8A82$A9^4\WX6&P9N!0T*-0L)`!D5=O3BE)&?FH6'@8>$ -MF)?Y?!<;!@`!!QX4?/?OEY.2DI"7ZN+X]5-P9&UK%104%6YA>GS%E)F&B8N. -MC)GQ%@(+-S$U"``1>?Z4DYF8FH>'AX:%G.K'8QP$`0,&&!%^_>F0G9V3E^OA -M]]M:?'IF8V!F>')+7UM&6DUP9$SKG82*BXR-E&8'-#'AY#X91P'`P`$'F#(X):2D)"5Z>'UP$E@;144;'I6_>#HXOC(<6!L:FYN -M:5R3A8*WM8R!W1\),3$P-P88?^CJG)R8AH>#C8>>XFP8`PT#!A9T\):2DY*1 -ME^K@^4AO%Q\>%FW2[)"?DY3Z<6(4$!$6$Q7I@8*QLHN,_P8T/CPR,`1@VYN8 -MA(>%C8*!@IU+'0\U-0P7P9B,@H&8X]ID9'AH:18;'Q-CY9V&@(>?_&(0&Q@< -M$!45:6@7[;2SOJ>]AV,])"`A/35@B8FUBH.-A("/D\T<-ST_,`?AM+Z\LH[X -M'`P/#087%A9F9?J>@(Z"A>`1!`$&$V;$_%1=?F36S.6&L[.WLY``-R4[.S-2 -MY8.QC8V%Z)-P6&<,#`@*&-F-L+"RB>46"S0)`V/;E9F5D)3GZ<%U;!P6%W_B -M[Y;H5'$5%6!DQ4!O0(^\L[FS%0LD(20Z3H^+N+>>[A-C$19'`P\-"16>M+^R -MMIL$"#`W!'J9AX2;Y/G`<=UF%1$<8D+NGI;KV&EH%&Q[?T5G%6N8N+N^OG0S -M)RTE/5:\MK*U?FD;:$P7>@,T#03ZB["RM(1;`P(#!V)_\>?MGIV;D'45!`<= -M8^R1DI'$07!Y4G-@%AX0;D;IBJ6ELXD#.R8F,0:&LHN/EA47%?5D'!H+#Q[_ -M@K6TC9748'G0<6D8!AEXGXR)@_T;#`X;1).:D?MZ;WS8Y_));Q`3:'7$5Y>S -MI+^QE#,E(3D"4K.W@IP0'1+=X140#`L$9X6)BHR1_T)1,+`A_[@XV/G.#N\N9T'``,'OZ#M(F?:PT)`7&=A)S6%1-M_I21Y7@7$FEY -MU_/68TNTI;FV;CDY"58`8)#62; -MM;6'=P$,!V66GI1U$1-DXY.0YG\4%FY]1-G-UTEM2+6EOK5K,CHZ`."$C*0@)<2`C4!9)"$DY#@EH>$ -MEFH!#1OMAH^']1(&$DWJD?I\$QUM])24XM-D86=P?'I[<,3]P7&1LKNRA@P] -M.S!O^YOE%!D9XY"'D1$!"`%B[ISHE^B=@(&=;`8-!/R%@H7V%Q@5U^N4RF40 -M$&S=ZY?HRWQM;65^?F5QPOKS=_^UN+Z('#,X/!GEG>\7&!KWDH6?:`8.`VG@ -MG>[OE)^-@Y`6#0P:YX>#F\44$F/P[N)=86II?=OGX>3RV4]A:!5M4^3FTF)? -MM;JYBP4].3)OEYS'!P$$ZH>`GQ(""`9^ZISYY)2:CX.5'PP#$9:'A.MG:VWQ -ME>[%%1`1878`4:%.:3D.=[87/[ZN+<:!$78=/[X/K]P-95=WYD9']T -M1G%PFKV[LY8(,CT-5N;5&P8%U(6$GGL$`P$47>'Q]Y:$C(V=8@$&$>&9G>1@ -M:'O\E)7S8104;'=4S?+EY/K+?6\4:4ORY,^1M[^SA`8V,`]TPDD:``5\F(6? -M0P4``!-SY>;XEIF&AY#":6AES^+XUV=F0/SOX/9W9F9@9F9^1?;CY_97=GI[ -M1]S2"3,Q!/]<'`X-$.N&G^85&1\=%A%O?.>$@X.9Y4Q]W\;` -MU7%&7<;W]?;-SE-S9VEH;77VXN;<=WAS3]W(7V=J7XZXN[44-C8)9,\1``X9 -MT9Z8YT@1$182'1QLQYV`@(26^5YV3$A15][+V<73V/?P]$YE;!5I>,CC[OI< -M?F1]4MY`8Q3'M;JXCALV-P-&3!L."1+EA)_S919J%1(8'F+^A8*!F.S]R?3! -M=71S7,W9TU_8\N3^3F,4%V]P]>7G\59$1]771'1F:_6UN+^"&S0*!UES!`\, -M$/J?DV5UQ-A21]7RYN519V@4;'/0]/'W -MPMU00'1*2V5L^;2XO($8-0@%<&,!#@(4XYR6S'5G9F@?!!EO^9N`AY#^5?*7 -MG>A::A5E5,'74,SDX/1]:!5C<5/3UD5-1UM86=?&4GI[G[.XL>X`"PT38!X" -M#`1#ZI'@0WUD914?&QQFX)N&A9;D\>.7E_IP;FY_UL'2WO;EY,!_:15L>4%6 -M4%]5Q\'>W-9%='%)E[2]MI\1```9%AD#`@=J_NWL\]1W?6$0'!)IW9:8FYV7 -MZ>_OY_=>?V1Y25W7Z>3,3GQE>WQT0E?/]/SU765B -M8V5$5%],=4Y=WMK8QLG;]Y^)M8'L6&D1%AT$!P4%$V!RQ,+24\7<4M%(?$C< -MS?WGX.B5Z.WCY/+(5$1%4%U=7US3U49Q?7U+6T)U<7]_=TY#5M_`R,GTZ9J8 -MY/GNY/;+2F!E8VIO;A5N:Q848&1TT516P_'W\?+\Y?O^Y?OX^_CQ\OO[_O/` -M55])?'MY?7!]965^<79W3%A0T-W5])":[_Z7E^GB_'1W<6QN;A<7%Q,2:V-F -M2$=!WOS]]_'V_.?GY.'@Y^?Z__[X^?[TU%A#'Y\96=Y;E\L=54T9Q>7IZ>'ME>GYRWGT79;?FUM -M:A84$1,78F%]1413R/;-R_?PY>?EY>3EY.3Y_N7E_O?9UU5`4E72T-/0W>"=E?V4D^KB^UE"5'EM;!44:!01:F-C&1D>GA^<$I#65!4T=W8QMKB2 -MX?V6D>C@]D)0UWIB;Q05:Q<6;F-C?$Y"T?3'T\'U\N7Z_N7FYN?D^^7GY/[V -MQ==707-^?GEY>&5E>']\<'1/6E;4U=#:S\S>UOB1EO?CD)?LY-Q.UT-F8F@4 -M:VH6%&QM9G9(1=K.WMO/]_OGY>7FX.'A^O[EY/ORP-/07'1PGIE -M>')T0UE<4-/#R<_*]_;U]N*1[?+JEN_Z]$9`7'EB;VH5:Q01%6QM>TY;T,O, -MP?7R^N;GY^'AY^3[_OG[_O+TV%=?2')^>'IZ961D>F5^=DE%5=#2Q<'-]_'* -MS\[SZ93]_I24X/S925]"9FUO:VAH%Q1O8V9Q0EC?R<#,]_SDYN3EY^;GY?WP -M__[P],;15UAU7)W3UA6T-S9P_3W]_'WR_CJZ_7EZN[D\5=* -M6W=F8V]H;&X4:F)@94M%4<;+S<[W_>3GY>3AX>?X\/;S\_3!T59<07=\?WY_ -M?WMX?'U\<4Q%4E37V<_.S7E[>GE]<'9*1E/6T-+8 -MP<_+R;BX.7VTE-8='AF8FUM;VEL8&=_=497WMO%S_7P_OOEY?KZ -MY/K]\?'WR\/245]'271S?GAY>WA^?'-T3D=3U-W;P<[UR\K^XNWZY^SMY//: -M45-!?65A8V-B;VUA9WEW0US7WMG:P\KP\_/\^N7Y^?CY_OSVSL/=4%M,=W!] -M?GA[>WYS<'9.1UY7UM[`S\OW\?#\^_KX_O[\\'IE9&5[>7UW -M2$!>4%70W]K#S,GT]O;Q\//P\?;TSL;>UE1=65M$04%!04!"0$9&1E/:R,3> -M]O/TQMW5U=9?04U(2TIV<4I#0%E245345U;4T]G%V]O%QL'`P,'"S,W,P\'& -MQL7>W==44%A'04-,3DE.3D]`0$=%6EE<4%36TMW>QL?$P\##PLW"P\#`QMO? -MW]+655%27%A%1D-"0T)"0T=$65)05E37T]_8VL3'QL?8W]#75U%34E)24E!6 -M5-;3W=S>W]S2U]75U=75U%75T]!7U]S3T-/6U]9445-<6%M$041:1$5;65]2 -M5]71W-G;V]O8V-O9WM[?W=+2T-#2TMW?W-W=T%545%%=7UM%6UM:6%]<7UU3 -M4534UM#3T]/3T=#6U=755515U];1T]#0T];4U%55U-355%545=34UM'7U]?6 -MT=;4U=35U557459745965E%04%%145;5U]?7U]?1UM?1T-#0T-;6UM?4U]=5 -M5M77U-345=77UU575U145%555U965E%65U1555555=37U]?7U]?7U]75U=36 -MT=;7U]?7T-+3UM355%=65E965U15U5145E914%%15U545=71U]77U-?6U-34 -MU=75U]?1T-/2T-;7U5555%1555=65E=45=77U]'0T=?4551445!34E)35E=6 -M5=37T=;7U];6U]?4U-34U-34U=36T='1U594U5=75%15U=755=545U75U-?4 -MU=7555155%=55=74U-?6U]555575U-75U-34U-145%175%1555555U=4U-?6 -MUM;1T-#7U-555%=75E94UU54U5165U=75%=75-77U]?6T=#0UM;6U]755554 -M5%175U14555555175U=45=37T=;1T=;7U]?5U575U=?7U]34U=555%=45%91 -M45=5U-35U];7UM;7U%575E%15U75U=77UM?7U-555%1745975=75U=36UM;1 -MT-;6UM?7U%545%=75U=45575U-355U%65=35U-37UM;6UM'6U]?5U-=45%54 -M5%145%545U=75E=75U975]77UM'1T-'1T=;1UM34U-3455145U975E%65U54 -MU=37U-74U575U=36T-/3T=?5U5555%=75=545%104E=55=75U=74U-;6T='6 -MU-35U=74U]555%=75%145%5555555%155555U-?6T='1UM;7U-5555555%=4 -M55545=74U%545U=5555555145=;3UM'3UM?7U]?4U-75U-3555145E%75U%1 -M5U155%=7U=34U575U-?6U]?4U]?1T-'1UM?4U555U=75U5575E965E=75%55 -MU=?1T]+2T]'15%!45U945%1455=65U35U=34U=?7U-74U=34U-75U-?6U]75 -MU5145%55555555165%155575U-?6UM;7U%555%75U]34U]34U=75U=555515 -MU5=5U5=75U?5U-34U]37UM;6UM;7U=55U=34U-555%175E=65E965U35U-37 -MU]?6UM;6UM?4U5145U155=?7U5545E%04%%65%15U-;0TM'6T]#6UM?5U515 -M5575U=545%155574U5545U=75%155=75U=37U];1UM;1UM?4U5175E=75=54 -M5%14U=3555175E965U=5U-'0T-#3T]#1T]%455545%=65U=75U=75%145%35 -M5=74U=37UM;7U]37T=;6UM35U-355=34U=555%=75U965U35U-;7U5145554 -M5=75U-?7UM?7U-3555134E=65U14U-;6UM;4U=745575U]?7U]?4UM;4U=75 -M55=14%!15E=45=74UM;6UM;7U57555175%75U-?7UM'6U]555%145E%15E=7 -M5=77U-'0U]'6U%555%55U=55U=555%155%145%74U-36U]34U]35U]34U-34 -MU=575U15U=74U]34U55455575%145=75U=34U=75U=75U];6UM?45E%45E94 -M5%145=34UM'1U]155%1555=45-75U]?7U]'7U-55551755145=75U-?4U555 -M5U965U35U]'0T=;7U-34U-555%175U=45-555%37U%74U5=4U=74U-34U]34 -MU-37U%5455145=75U]34555555155%=65E=5U-?1T=;6U]34U=75U=75U-35 -MU-37U]?75%965E15U=555%15U5=5UU145515U-?4U-34U-?7U-34U-555514 -M5=555%545%55U=75551555755=75U-?7UM?7U]?4U-34U%175E=455555%17 -M5%74U]?6UM?6T];5U]155%175E975=55U=55U=37U];6U];4U-?6T=;7UU54 -M5U%145%65E904594U=?6T=;7U-34U-?6UM?7UM?4U]?4U=7555145U14U551 -M5E=05E75U-;6U]34U-34U-34U-?6UM?4U]35U55745=455145%=75U=5U=74 -MU-34U];6T=?455555575U-1555575E965E9645;5U];6T]S3T=#6U]355554 -M5U=45=55U=34U-545U=75E975%=5U=36UM;6U];7U]?7U-155%74U5545%55 -M5%=65U=45=77U];6UM=555555%155%544%355=74U]'1T-'1T='7U575U=75 -M5%=75E155=555%54U5555=7555545%75UM;1UM?4U=75U=35U=944E175=75 -M5=77U=155-555%555]71U-37U-?55-54U=37U-;1UM;7U-34U-355%145%17 -M5U1745%15E35U-36UM#2T-;7U]?7U]35U=545U145%=45%=75%75U=545=74 -MUM?6U%?5U]37U]75U555U=34U-?4U=35U-155%175E!65]76T='7U-35U=75 -MU=75U=35U=74U-?4U=7555145%965E965-77UM;55575U-?6UM?1T]1455=6 -M45!65E=75555U=75U=74U=34U-;6U]?6U];1T-'1UM;7U%164%-24U!65-74 -MU];7U-34U-?7U=34U]?7U-5455575E=75U94U-14U]?4U];6UM;7U-555%=7 -M5U15U=75U=5555545U=75575U=34U-?4U-?7U];6UM?7U]?7U%545%575U=6 -M5U5555555-75U=545%=45515T=+3T]+6U]?55%=75U=75%74UM;7U-755%=6 -M45975U=75%74T='1T='1T='1U]=55U155=75U-745%145%145%145575U-37 -MUM'6U]?55=1445555%555555U=37U]7555=75%55U=355=74U]3455145=74 -MU];7U%575E965U=45%74UM#0T-;7U5=75E?5U];1T=;4U=55555745%04577 -MU=?0UM;6U-555%1455755555U=74U-?7U-7555545E9645965E355%35U-'0 -MT='1UM?4U%55U=?7U];7U-545E=755555%%15U35U-?65%%55574U]?7U]?4 -M55555-74U-35U-34U5145%145%155555U=37T-'6U-55555455555%55U=37 -MU]?7U%545%145U=5U=75U-?7U]355571T-75U5175%145%=45=74U=755%=7 -M5%75UM#1UM;6U]37U5145E=4U=75U5145U945=37U]545U555=35U=75U=37 -MUM?7U]755-74555455%05%=7U=37UM;7U]?4U=37U]?45575U=75U-34U516 -M5E145575U-34U-75U-?7U%555555555555155%555%145%555=34U%55U=74 -MU577TMW1T=;5U55455=555555=75U-?4U5545U965U=75%145575U];1T]/3 -MTM/1U%545%145U9145975U75U-75U=555555U=37UM#0T='6T=9745934%%7 -M5U55U-;6UM?4U]34U-75U=35U-?7UM?5557555145%9145!15E155=34U]?6 -MT=;6T-#0T-'1UM?7U-7555175E965E=75%175]355]555%55U=75U-?7U]15 -M5=37T=;6UM;6T=3455145U965E=65E975=74U]34U-37U-34U]?7U-75U=?6 -MT-'1U]555%145U145%145-755E;55%=45=34U-?4U-37U]?7U-75U=755554 -M5555U=75U-74U]?4U-37U-35U%545%1455545%35U=5555555=55U-35U=75 -MU=?6U];7U=?0T=?7U5=645%75U=75%=75U145555U=74U];1T-/3T]#6U-55 -M5%=75U945=7555=45%75U]15U555U=74U-?7U]?7U-75U555U=75U5545%%4 -MU-77U]75U=75U];1T='6U-545E%15E975%145555U=5555545U=4U=;1T-#0 -MT-;6U]?7U-?4U=545%545U=65E965E=65E35U]'0T=;6T]'4U]75U=74U=75 -MU=3555175U155%145%555555U=15U=?7UM;1U]545E=75U15U=75U=74U575 -M55555U975-74U-?6UM'0T-'6UM?7U]515U115E=755145=77T=;4U%545=74 -MU=545555U=?7U-155=75U=75555555145%14U-?4U]34U-155%75U-?7U]?6 -MU]355%145U175554UM/0UM;4U5545U175%555515U=37U-?7U]755515U=75 -MU=555=545%155=37U]34U5555555U=355514U=?4UM;7UM?4U-755%=75U54 -M5-355-?6U]37U]545U=75=74U=35U-1555545U545U155=75U-;6T='7U-55 -M5515U=?4U55455145%15U=7555=75%=75%74U-34U-34U-34U=?3U-74U-75 -M5%575U915E97U=;1T='6T='7U-?4U];6T=;755=65E=75E%04594U=?6UM?7 -MU%55U=34U-?7U-37U]35U=74U5=75U915E=445)7U=36T=;6T='1U]34U-55 -M5555U=74U]3555545-555=5455145U35U]?4U-75U-?7U]34U%545%=5U-34 -MU%5555145%145%55U-?7UU74T=;6T=?5U5145U975U75U=?7U];1UM155%=7 -M5U%15E=45E95U-?1T-#0TM/1T-?4U%75U=77UM;7UU555%=45E!75%=14U;4 -MUM'6T=?5UE56U=?6T=;45-74UM'755=655965E914-?`VDU.UX,'/ -M_,C-_G-L2.*6\&L4T=GS57G:?47$^_Q"9&="V?OOX$9[0WAM6-CZY\WT\E=V -MW_?WRU]T0TQQ?&5D6M#>P_/PSU52R4-K/U5I:7M955MG?U%-#T=#4 -MWM'"R%Q!7EE?W-?1VU-=0=;%W])'05_UUE5WU705T=&T-U04$595\':WMK2QUY.7E-74]'0W-%6Q]G%VUY>5MC4 -M4EU&4M#34=717EY5QMY645_7U=16W-A5U5E3W=I76-53W=E56D/=Q<740%I8 -MU][>TE765-_0T=+?V]9445%25U-2T]934%Q775Y3U=;9W=70TMM54E!?4]?; -MT];2TM=45E]=4-=74=31U]144US4U-'77UU4TM#?U-+8WME14EE4UU-26%?5 -MTM36T==47-;9`8,E]?\AQ4LA%U\[6VL'0QL15WME=W=)#Q%%9 -MW-'TV'KBVAW[6VOA<'7CMM_ -M;?!R?/=U\=#$]DGG_7[[PU?=6]9:0=]U2,5>/%N_5)Y[W?,YW#Z]]+;1%+=9,-T7U=<5%S%7U??W<1'0?5]\-O?U=;*4U[4=]O>?_ET]O__?/1!YV=Q -MXA3/_67PQ\E?=^).9^IE=<7T;/?. -M9>941_91QU5+Y7W1U4Y04UEPS%#%1]'<2_=81=/*2E'Q=/-=6E33U]YV\-UV -MX'+"_TY;TU==%?>5QPL)\]_%8VU;6Q'!22''P<'OPT5W0W]U?UL96 -MVO+57\S$WG/(4W'.6]]'5O=3TE-1RW1'WTW10T;]6MG:4-Y>5%%TTM-QS=1? -MT-O*W\7R0=[-0U93V$YQ5==64M/;W-)2WT-9:T5-+0%!05]K+]4[!]O_O[NGHZ^OGX>7*SU79]L11R\[%W=95]Y"?S?2;D=)P -M7]<7'A@'!0<#`1@0$!=6X>.4G(6&AX2:FYN5],!481(=%A(<$VIE=5S/XY3L -MYNKKY\OT]UQ\9'MS2UOJF?KEA)[M\/WG;1`2!`4'`P$'$A,07^7LDYZ$A(2; -MD)?I5F5@;A<2%FIO9'+8X^GHEY"0E>SLY=%R?,27G5U(A9W49W+_%04;!@4' -M`P$%%&L60.^6DIR'@X:%G9V1TV-M;1<:&!=K:FIQY.+GX)&F: -MA=?.@IC%9'#B%@$&`@8""0T!$!8?;;>4[GF(1U](^%]GO1EA$&!0,'`@@,`Q(1&GCJDI*=@X^` -MAH6:G_!\;!46!`<<%A<08_+EYNZ4DI#JZNWG]D?#DX"18YJ"Z'X4YD``!@(# -M`0X-`AIE%A7_G9J3A8^"@829G^Y:;Q84'`<%$VH6%DSXYN#MD).5[./H_W96 -MX)B`^E&"AN)G8I5I`P8-`0((#0T?8!-@YY^%DX>.C8&:F9_F<140%!D'!1-M -M%Q=1XNCCZIZ2E>[AX=MR=5N6@^UBAHV0X%]M$A<=!00>8VT7<>24Z.V0DI&7Y/+XWG%G_(::8^.-FO,7S^L> -M!P8#!@\"`PT68&IE^82%DH:"@X&8GY7R4A<2$!P9!1)@:6);^^CNE9?KE.O_ -MS\577N2&AD?MC8?A%U_K'P$``@`.#0,/'&9@>L^%@9N!C(V`FI_JW4@5&1@8 -M&04>;F%[5>>7EY:0EY;I_<;04'W2A8'"]8&!EV]^ZFL$`0(!#PT`#P1I97E- -MDH&$AX.-@H29E/'181P8&1P;&A9C>T_,[)26D925ZNW]5G-RTYV&Y5.$@)]] -M8I58&08"!@(,``\!%F9\9>.'AX6'@(*&F)'[PD@7'AH<$A@=:GA?U/[IEY"4 -MZ)7JX-!U1EC_FYO9XH>'E6E-X&@:```&#`,`#005=$M`EH:&AX:#@X2?[M-! -M9Q$;!1T3'!-H2\+QX)66D93J[N/DP49R7I*&X%.=AYM%:\A]$`0"``(`!P(# -M'WC'2O.8@8"!@8.!A9+T=7-L$@<%'1(2$6U0\>/IE9&0ENOGY/C'=&5`E(24 -MTY>:A>1L1'(5'P`#`@,%``,$:,W=Q):%@(.!@8>$F^-`9&-J&`49'!84:'M3 -MX97HZ)20EN+[\<+'1WW7DIKG_I>>G5A]=FL7&`<##`<;!P$;>?/WXI"%@(.! -MA)F8DOMQ;V@7'!D8'!5M9'/:[Y24E>N4E>#_Q,S`=GGYFYW+X9:>ZG9)8A81 -M&`<,#`48!`<=3OSFE)V%@8.`FIR=E/-[%183'1\9'11F2E+S[967E)7K[>WG -M]MY-<'/DF);UYY2>[DMU;!46&00-#048&@0<26DO9'>VII$1P'#088'A@8 -M%4/RE9.`@9B0Z.;*/IEY"0E>WBX?G8=7]F>>.0 -MYL/RZI'YT'9K%181&``!!1\2$A5ZT^N=GIZ8AX::D^_RWDIG%QP?$A$7%6!T -MSN/HE924EY25[_K,UUAU9V#5Z^WW]OGNX?/-9VH7%Q$%!@0;'1,58'/QEY^8 -MF9N%FIZ1X\E$OC_=!/<7UE8'GZZN#GY>WO -M^OM38A06%QT%!`49$A=B94;GD9^9F9N;F9R4Y-1W>V\7$AP2%V]E=E7SX^J7 -MD9?KZ.GC\%UP9&9F8WC\Z>+AYN_OY/K79A41%AP%!`48'!9@?5?FEYV>FX6; -MGI*4YL5*9VL6$!`1%FAD3<+ZX^F4D9:5Z>/\V$5S9V)M;6USX93I[^V5ZN+C -MQF<4$18[W3V%J%!83$Q`584C"^>'NE)&1 -ME^CF\\+63&1B;6)C84W@ZNGI[I7NX.;49A01$!\;&@4;'Q1F<]3[ZY*9A868 -MGY*7[/!%9FH7%A$1%FIB?=GXX^[KE)>4ZN+XQUQ)?F9C8FUB84CAE)7J[NCN -MXNWU?6L0$Q\8&P4%&Q!C=M[EZ9"9A(>%F)V7[/U29!40$A(1%&AB?-GDZ)>6 -MEY25ZN+R47-F8F]N;F]L8GKTEY.3D924Z>CMTF$1'QD%!04$!!L69E#Z[I:< -MA8:&AYN3ZN7$=6T6'1X<$Q1O9G?%Y^J6D)"6E>SD]%-_;147%VMB9WAR6>"= -MF)B?D)7CX_A!;AP%!P8$!`4%&19ER>F0GYN$AH:&A9+N]$EF:Q8='AD<%F)S -MU_3D[Y>0DY"5Y,992WYC:!07%6-]7M[-^9>>F)J?D>++Q$%F%QD$`0$'&A\3 -M%V!"Y9:>A86%A9J;GY?G7V%J%Q81$!`6:F9$\>;OZ.J4E.KC_=)T9&UN:6AO -M8F=R7O7EX)6=GIZ'3=Y>N1G9^2G]D8&-F>W98T,#T__KD[)>1D9?NY=-#4G< -M^>R4D)*=DY"7Z^WZQT]E8VYI;FQC9GAT7\7QY>'AYN3Y]-)%=')Y9F)B9G-; -MV_3\^N7DYNF7D9:5X,].?F9M:100'!D>'1=L>TE1SN7LE).GM^?'%/7<3Q^N?GY_K\^NR5E.OC\$%E -M8&QI:A00'1(0%6%UTLKR^.7A[.N5Z^SG\,;64%M:6D=$6UW0Q7<='IB;FAK%!86%Q5C3AX^/AY?/.V-95T-[?W=/0T-S8V-[=U%E-2W=Q<7!R?7)W0E+0Q\CT]O;Q -M\?#^Y.'AYN3RQ5UU?V5G8&QO;F]B9WQ+7M#%PLKS^>7DY?[SR,38V]O8V]_6 -MU%55U-#1UU=>0$Y+2'5T2TM)0D92T\')]/7WY>[JZ^ON_U9(>F-C8&QH:&IJ -M;65*T?3R],K)R_3W\??)Q]!5UL'S^.7Z_O++QL7<55A.?65D9&5]=4!:65M% -M4M;8S/7+SLW$V\?-R7E^?W)V25M7TMK#S,+" -MPL+/RWMW445]%1D9>V?3W]/3&7D).=W1( -M2G!\?GA\=$34QLC)PL'&P\W-PL3=55-?4M'%PLG*R\_-SV,;,R?7(Q]_1U5914E]:04)"1UE= -M5E=075Y;6UE>7UQ=75!7U-/>VL7$Q=O9W=+0UE507%E97%'4W=O&QL;'Q,3' -MQ-G=UU!96UE3U]+>V])6645'04196$=-2$M,0%E6UM'1UM?0W\3-R\K/QMG2 -MW=[9V=C9TM=45E15U=555E)?65M;6%E97E]?7%Q<4E?4T=/2TMS%/NE>;^4USP]W-S4E=`2D=90&!XW_7Q\OO;=GM:SMU3 -M=\#FX?S"]][<=F%I9-1>2$+`_^16=,A:Q?G+T'!4UM)97L7!WWQXP_+)UF=\ -M4]/\P\E51-A`QEA0]L+'25_2=%752UI,WM;?RL;]Q])64MA=07-P25#;75?> -MP,'9V];5TM57<'#4\\W!4%'SP-Y.5=!"14Q-3U%=TO#V]L1<<$'26T1?T%?< -M54[5]?;-UG15VE-#=L[8UE-&S=+'T-#.7ME>='=-S]?0V%+>U]/4T5&V<;3U=U77UY0Q=9:05;3T]?5PL?: -M5$'4TM5:0%C5R-I;0%',S-!=2UG15]W74-;4V-!5T]S`UUY94-5<65#7Q=%0 -M55!245?77-C<4M#2Q]Q44EM45%#65=?6TE117=74U-Y7T]'5T==66%_4T=C7 -M7%574%'1U-;0Q-)<6U+;UEU'7=_&P==45]904M%4U%Y64];24-;2W-;7W-11 -M7T%:4-G:W-+5T-_755986%U14-/4E935-W8V]'1WM1= -M15M7T-W1U][V=?2W-O4 -MW5)25T=70U950<=;V%+3TM3=U][#W=9?TEA"4$/"3U117,K,P-)5TD/65%55 -MUM1!U5)34]G67=]77]/2U-_2W]=>7M57555'6-S9V%E?VU]6P=_U7U!35,;4 -M6GU%7\#:6O%9\?9>]73=7E'/5K85<99W?W. -M\-37S-K=W'5Y6'_=4W#&0-?_W-7(34+.=E3>>=G?6?#!T?/=T]78?-C2>,Y> -M>10W.;?1=5/<%-%8U3;3_#-0L;\2MKR2=_/0T'"VT_*QGSTUWO.WGC> -M]'52\TQ5_71<]T!3PD92RDA=^T]+\-!TP%YWSDI=U5G&V]=$Q]M:P%=55]/= -MV\%`U,Q+1MM0T])7]E=4590WW;5W%#6W5-=S591 -MQ]!;W\185U#54%G5V437QM135-%P%3'V-A765]1T]5&TEQ-5%M0T\?> -MQMA$4E]74U7+UM7&W5A6U980-/.4UY!P,I%7];"05GRWT5VP/!>TUIW6==,U?=55=K4P-I;6L7; -M=$E%5]Y0P,W;U]?05E%0TL791'70Q-AV4=;125+!V=9'4E=2]OW$U%+=5==?=5I/UU+=R%9(0]C,4%K:SM_;V-S' -M74U.1D%:0M777=W)\??26-?!W5]/1%E;55-51$/2]UU7&P]=U-Q%0=3%V5-?7-WUQ%);T--27EM85M34 -M5]3)P%-'6][$T-9?7=?17T]2V]50T=[%VM!45EA3T5W01$O7QM]04)9 -M5]?1T]O%WU==5]#7\+Q4VX>!`<$&AD?$Q=N?,SN -MDIB;GI^>F9^1X--[;VH4%A`3$!=B=7Z^#T1WEG9V=G9F%D>';! -ME(6&A9?RS^7@RF,>!P8'!`48'A(68]?OG9F9GIB$AH2=XL9,?F,5$!P>'Q,5 -M9478]?KOEI.3E^[D]-9-?61C;FMI;6=%[)B&A)/BY^F5Y'\2!`8&!P<$!1@< -M%''GD)^$G>GLEI/H1!8:!`<'!@8'!`429OV4D)&3F8:#@X>=[//'5G)H'1H% -M&1,5;V-D1_Z5DIV3E.COXOK??VQJ%6EB9D/LF(29E^R5D.K1:AX%!`8!`0<$ -M!1QLS.N6D9*;@8*#AYSH^\A5>10>!1H?$!<5;WO1YI20DY:5Z^CL^%QG;&QC -M8&%DQ)"$A9/NZ9"0Y6$2&P0'`0`!!@8;%5_AZY23A8&"@X:8D.OGR7`4&048 -M'!(=$A1EV>?IE):1D9&7[/98<'AG;6AK;'#@FH:;E.B2FI+4$1@;!08"#`T" -M!Q-ZW?;FD(>"@H"&A)J=Z/5X%Q\>'AX;&A\5?=;UY.N0G9R2E.+Y]==S;145 -M;F55ZIJ%D)62FIG[:Q,0'`<-#PP"`1L79D+YDX>#@(&`@H"8[LE-9A1D9"3D>KA]EU^86!B:&AZ_IZ!FY21A8>3 -M$6W`DX>!AX&,B8*;E>?V=A<8!`0%&1\<$63WXNWND)F9D>_@Y,-V86]I:6Y@ -M6Y6'AY"0A(&>4Q1L;1L,"PX-`@(''&G>EYB%AX*(B8"9G9#D8!T9&`4'!QL2 -M:WW>_^^0GI^3EI;J_4]]>6-K%&]9E86>XY&`@)9[8,-\!PD/`0`.#@83;4'D -MEIN!C8R`AH&$E%%E9A0:!@4>'Q\19-CYXY61G9^3E>+G\D9F8V9A9UOHFY+A -MG(&8Y7A&P48$&EF3//M -ME9:1D):4Z?O>5T1[8'C+EY^5^YB!D55T\-<:`@<%``D/!!T=%TOMDIB%@8V- -MAIN>D^9S:140&P4;'QP3;DC:\>"7DI"4E)7M\55&379S5Y6;Z/>%ANG;WN=V -M!`<%!@(.#008'Q%^[)"0FH.,@X6'AY;R4G%N'AL>'AD8'6US2<3@EY?JEI"4 -MX_;V\%IRUY6>[M&8@>#?\^=8&`49!`$/#`0;!1A@X>/CF8"`@8>!AIWL\L5\ -M$!X='QH%'&IH8U[[[.^5D)&4[^/L]E[5SN*7E/"7A^+$X_)0%AP=!`<"#0<$ -M!QAI5]GRDX2'AX&`@9N3E.%<;!46'@4;'AP=%'A$V?_NEY>7EY>5X?C]PO/B -MEY7VD9CT^>=60Q<2'`4$`@,:!P0<;G75YY&9AX>$@8>9DY7C4&5C%A(?&!P< -M$Q5C=5?Q[>B4E)>6ZN_LY>"7G.['F))-X=YU=!P>&1L'#`<;!AH28D79X9": -MA)N'@9N?G93AU'-F:!$>'1`<$Q5@>W?.Y>#IZ)26[N/LX?_@DY+\[(3G]^UR -MVV<9'1X%`P,;!P0>$WY3W.*=FIZ:@828GY"7YU9U>6@3$A`='!%J8F9VPOGG -MXNJ6Z^N4[.^1G9WOEYKEY>5YU!0;'`4&`@`$`009%GQ-QI69FYF'@(2:F9*7 -M^E9#9!<2$Q(>'Q`5;V-*]?WE[)66ZNF4[^Z7GYSFDH7WZ?AX\189$@4'#0`' -M`04:%G)]Q)2?GIN&@82%F9R7_]Y<9Q<0$!(?'!$5:VQ)VO7\X)>5[I>4Z)6= -MFI3LAY?[EG_-7AH3&00`#08`!@0;8F5]^I&9F9J`@82:F)[J\,=-8!$2$Q\9 -M'Q`5%6%%V_#DZ93HE9?J[^B2F)?GFIS.E=56QQD2$@0!`@<&`00;;V=D\Y:< -MG9J&AH2:FY[K^/949A07$1T>'!$7%&)T5\7YXNKKZ9>4[NJ1F9+GF)G.E]A- -M\1\2$`0'`@8&`00%:F9GR.N2G)F&AH2:FYZ4YO/>>!47%AT>'1`6%VQS6-SR -MXNOHZI>4ZNN0FY+EFYC"E]A"^1X2$`0'`@8&`00%:F)@R.F3G)Z&@86%A9F7 -MX.79?FL4%QP>'1,1$6E_2M7RX.CHZ):4Z.Z4GY[BZX?@_I5XY68:;AD'`0`$ -M`08$'6UK0N:5G)R%@82%A9N=Z^#_1&%J%!`9'QT2$!=C?T[$Y.#NE.B6E.^5 -MZ)V9YI6$^^659^=F&&,8!`8`!0$'!1UN%4WE[)*=FH:$A(2;G)3L_EEE:143 -M'QP<'1,78F1USN7BZ)64EY7HZ>R4G93\GI+7EME:Y1\5%`0%``<'`00;%!1B -M].?JDIZ$AX6%A)Z0E^/Q0&9L%QT<'1\=$!5M9$GUY.;HEY64E.KOX.*6DO[G -MA?+_ZF'C9!EZ'AL$!A@'!!H0:!1,_.:7DYB%A9N%FY.6Z.7>?&!K$!T='1T3 -M%&QG=\;^X>WJEY64E>WLY^*3E=Z0DEN5Q7?C'15M!1D&!1H'&AD5%6W&_NZ4 -MG9N;A9B%F9:6[_#4?&<5$!`2$AT0:VYF3GE^^:5D=#EA5G] -MZ6+N;QU`'A\:!1P$&AX7:!5%]>7OE)Z9GIB;F)"6ZN7-=7]C%A86$!,1:VQ@ -M<=#U_^'LZ^CME>[E^O[F[I70[IEYZ.%@ZA85=1H2&QL?!!D<%!1H7=/^[Y>< -MG)F8F)Z3D>OD]UI\8Q07$1,0%A5N8711SN7@[^KKZ.GNY?_]S^[K4.6<4/_I -M9NYD$=`=$AT:$P4;'!85%'91PN;IG9*3FIF'100:4I.S_GK -MDI&=FYB#@Z>+MX_[[RU56U>?B?>&? -M?^GL?)!B8?,2%1,<$`4>'!$1%GUS4O_CD)"3FYJ#CX^_MY^7^]E9:4'?PZ7/]F$WOD7R306SZ%A06&1,%&QD2$!!E -M?EO\YI&2DIN%FY^>D^OB]M]];FX4$Q,0%Q1H975?S/CFX>/MX.3D\\;$6TI$ -M/T3:AT>$@4;&1`2%G]RV?[LDI"?FYB:G)V0[.?-7GYN -M:1<1$1$5%6Q_=%+`_>3DX>'FY?WQS%127$AVS93-1(7F\YYWEN46^FX0%AL3 -M&`49$Q839'5<_^>6DY"8F9Z>DI.5Y_S8=F%L:!<6%A05:&9P2]3+_?CEX>3Z -M^O/WS=/3UTE8S.[D<9Z569_5X.\7]WH0%!X1&1L<$Q0084]T]/CKD9>T/0]_S_X.'DY.7EP\_S5U=:=5A$&H=%AD>$Q$4$7Q"=/[EZI:5G)^0D).7[>;^VW5D9VP4%6MH;V)] -M3DS>]O'P___Q]<#)Q5??5%Y=6$+>Z^!$F9#7F?+GE17'?Q(7'A(8&QP=%Q%F -M1DGXX)63D9R?GY.1D>/Y]D9W8&]L%!5K;F-G=%#1RO_E^/CX]<'71D%P=G=_ -M0D]SRI3LVYN9]9KI[99OP74<$1D>!009'A$38%EU_NV4DI"?GIR0D9?E_:Y9&3^Y5?=E`7 -M$!,<&1L<'184;%A'RNGME9*6D9.5E.CZ_?1>=W9D9F=@>'A^1T=7V]C,S,#' -MTE)!3'%P<'9.35O6WO3A[..4ENN5[^/[T4!Y;Q<1$QP=$Q$5;F1.44ZNGB_O3<1$A\>7AE>7QV25K7W,'-PLS8T-5%3$MW=G!T3T[4^^+TZIWX -MEY?XZ5984V@5%Q82$A<1:VQF7D?`Y.?L[^CJ[^WLYO/QR=)$0T%V;BY.3X]LG40'=Y9F)B;VQC8&5^ -M=EA0W\S.\//S_?'V]V=W:VM_>T%1=6%Q2UT%5265E%1UM: -M1UA?7E)14%165]565U==75Y96T1'1D587EQ15=;2WMK'Q,'`QL?$Q<78VL3$ -MQ7U%814%#3$E(=4IU2T%&6U'5T]O`S -MW=S0T];4T-;6UM;75=;45%575E-24U]?65Y<7U%5U='3W-S=WM_2T=754%-2 -M7%)=4E%7U-;3T]/7E)3 -M4577U=37UM?5UU514%Q?65A?65Y<4U94UM+W]W2TM/3TM+3TM/2TM/1 -MU]3555=645=14U-375]?7%]<4U%7U=?0T]+2TM/3T]'6U]755575T=/7U]14 -M55575E904%!05E=5U=37U-555%15U-;6T-/3W=W3T]#1UM3555=65E904%%7 -M5U=45575U5555515U-34UM?4U=74U-36UM1455514%175E145%54U=37UM;1 -MT=#3T-'6T='1T=;7U-37555745%34E)34EU345=45=77UM?7U]?7U]?7U]75 -MUM;6T=#=W]_V=_=T=?4U55455545%175E%14%!05E%04%!24E)3 -M4595U-;6T-+W?OD1VQ2Y?/?T'1G\/%)?F!4^>/`95/<=F1) -M\>/^?61.UE?5W\'YX^[E0GIP44UY?T'.QEQP3452R=]7RO+,44AQ5]C4V?'] -M\<1,=T?5=WYP7O3*]%)0]??<<4%#4/7%5E+-W-+435=;24A:5_7TU45>Q,?" -MUEE7UME0T%92P]]46UM435]?1M'4Q5'1R\CQUU]114%$14Q0Q,S/T575U]5% -M15+45=/85U)5T]O4U5-2W=-545!25%114][>VL'9TT%)0-':UU9:5]S6TU?1 -MUM117D9=Q=W2WLW>V59>5%#%5%U?3=1%5E90R,W!74515--95%Y1P=C=4]95 -M45=7U=#0T=-55EE=TU164593T=A545+3V]916M'1U=5355O6V]+1T=)0U5Q< -M5U-5U-[2W=-7TM154%/55=G2U5Q5Q=%26%#54-#7U-11U-'05=W05%-65$5< -M4U'75MW'Q=-25=;2T%526U)6T-S45U;1T-)46%31W-5?4-'24=;1T]51UE%3 -M5-_65]#3TU=14%%14%!1TMS4U-W65==66U+0T-?6T=_?U5!55%?1UE=<4U75 -M5537UE75T51?7U)4T]!65]#3TM175E?0T][05=32W-;5U-1545)65E-<7E!0 -MT=G6U5'755%27]74T=?2V]G;W=W75==65EY25E%74]575='0U5/5UU175-;7 -MTM+0TU7455!<7%5645=5T=;6U]375%57U-56UM/1U=;1U-+3U571UE504U?4 -MU5U35-'745U3U-'7U5=5U]=5U=;1T-%45=#75=3655355U-15E36T=;3T=;4 -M5E30U%!45U77UUIP=$!95]#?VL3&QL;&Q,78V=S=T-'4U51745%04U)24E)2 -M4E-34U!145975U145=75U=34U]?7U]?7U]?7U]?4U-34U-34U-34U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -:____________________________________ -` -end diff --git a/share/isdn/4.al.uu b/share/isdn/4.al.uu deleted file mode 100644 index c08e17e1288a..000000000000 --- a/share/isdn/4.al.uu +++ /dev/null @@ -1,323 +0,0 @@ -# $FreeBSD$ -begin 644 4.al -M5-77UM'0T]/0U]31UE975U=45U=45%165E=75%155575U-?7U-34U=?6UM35 -MU=37U55555175E=75%75U-?4U-;1T-;1T=34U=555%545555U]?4U]?45514 -M5%!05U965U34UM;6UM;1UU545U=75-74U];1T=#0T=;55%%045%15E155=54 -MU=75U]?4U=35U-;6UM#4U-'545755%145E975U555=75U574T-/6T-#1T=;1 -MU]34555745%04%%65U145%=45%74U]?6U];6UM'1T=/0T]'4U5545E%04%%1 -M5E=15=34U=34U=?7U]34U%555515U-37UM=65E165U545575U]?7U]37U-55 -M5575U];7U]?7U%755U965U155575U-;6U]575E965U14U=34U];1UM?4U-?4 -MU5145U155=75U-355U9045555-37UM'0T-'1T='1U%175U145%545%555555 -MU=?7U]545E%15E97U=?1T-/3T-#0T=35U-545U%65U145U=45U=75-74U-37 -MUM;6UM;75U345=74U-355555555555545U?5U-;6U]?4U%55551455575%55 -MU-?7U]?6U]34U]37UM?5U555U=555U1555145%=755155=34U-?7U-31UU75 -MU%545E!04%945=75U];7UM?4U=?1T-#6U]?4U-555=74U]345515U=5445%1 -M5E=5U=37U]?4U=34U-75U-7555=45E=5U=34U=755%-15U94U=?7T-/2T]#0 -MT='6U%5745!04U-05M77T='6U]34U=755%=45-74U-?6UM35U5555=555%35 -M5555U5545%55U5145=74U-37U]34T-'4UM?5U=3455145%14557555555517 -M5U1555545574U-34U];6T='1T=?45514551645%15U35U];1T='0T]/0UM34 -MU=34U=7555175%=05E1645=75E975%15U=36T='6T=#1T=#1U]35U5145U=7 -M5U=75%555%75U%55U=555=75U=37UM;6UM34U-7555555575U=75U5555U91 -M5-;4U=?4U=75U-755574U]?7U-555U915E975=36T-'6U]3555545U145=34 -MU-?7U-37U]5555555%545=55U575U=77U]?45%=65%145=345-36U-;6UM'1 -MUM;7U]?455=14%!04%%15U15U=37UM?6UM;6UM?6T=?4U5755%1455545U91 -M5E%15U545=75U-?6T=#3T]/3T-#0UM155%7455945U%145!04%!15%75U-;6 -MT-/0UM?5U=74U];1T=;6U]555U%045!0459455145555U=34U]'0T=#6U]34 -MU57555155-74U-35U=755U-65%=45%75U-?6T-#1T=;6UM'7U5175U=75E=7 -M55575%755%=45U74U-?6T-#0T-'7U%5645975U145%965%155=55U=34U]37 -MUM'6UM;0W='4U]545%=75U9645!15U155-77U-77U];6T='1UM?7U555U555 -M5%15U=75U-?7U-3555165U=4U=35U-34U-75U575U5545%545=37UM=5U];5 -M551455=75%15U=545%74U];6T='7U-?6U]35U-5555555=345%%34%965U=7 -M5=36T='3T-#0T=;4U-75U%575E9145975U=45%915-?5U='6UM;1T-'0T='1 -MT=;455=145975U=75U145575555455145555U-;6T=#0T=;6UM35U=755515 -M55=75U=45=?7U-74U5575E=75U164%76UM#3T-/2T-=55U=75E965E=45%75 -M5574U-?6UM;6UM;7UM;7U=75U-5555175U=45U=65E975%555555U=34UM'0 -MT]#1U];7U]155-775U964%!145%15E15U=30T]W2T]/1U]545%555575U554 -M5U=45%15U5175U=4U=37T='6UM;7U-75U=35U5545U975%75U-37UM?7U]?4 -M5%!75%35U-37U-7555545%35U=755555U=74U51645975%55U-34U-34U=74 -MU]?7U]?6UM#0T=?5U55445!04U!15%755574U]?6UM#1U-76T];1T]'6UU57 -M5E%34U%65U=65E965U35U-36UM;6U]?6UM;6U]?5555555545575U-3555=6 -M5E975%55U=?7UM?6U]75U=75U=?4U-75U%5755545515U=74U575U=75U-?7 -MU]?4U%545%5555555-55U=75U=74U-?555145%=65U74UM'0T='6UM355%=6 -M5E=45%175E975%15U555UM#7U];7U]34U-?7U];6U-?7U]145E%04%%65U35 -MU-34U]?6U%5555545U14U=74U-?4U-34U=545=75U-74U=755=34U-?7UM15 -MU=555%104E975U55U-75U-?7U]?455155=34U-?7U5555-75U-?6UU545%14 -M5=77UM;55%=145=455=75U94U-37UM;6T='1U]3555155-75U5145-?1U-15 -M5E934U!15U76UM'1UM?7U-74U]35U]'1UM?55%=75E964597U=75U];6UU57 -M5U35U]'1UM;4U];1UU165E%65%14U=55U=74U]554%)145?4U]?7U]36U]?6 -MU];7U-35U-75U=775=?7U=15U5=55U174%915U35U='1UM;7U]?4U554U=;4 -MU=555]174517U=34U53555745-36T];7U%955]75U=5555755%155U165E34 -MUM'3T-#0U-?7U-?55%165%?5U=31U]?455=65U=755?4U-=555=4U534T=/0 -MT=;7T='4U5564%U>45!7U574U=;6U-?7UM34UM'3T=375%545='4UE175U95 -M5514U555U='6U5575U155%945-74T]#=W=/155915E934E-7U='1T]W=W='5 -MU=1045=34E!04='?T]955%=5UM145%57U]'455%05]76T=;45=;3T]%55E95 -MU]'4U5565-74U53755914%%4U5=15U=5T-_2UU55U='=W='7UM36UM-54E]> -M5-?65UU?7%745E=4UM?7T='0W=/0UM77UE515E77UM'455155555U=1545!2 -M4E%45514UM;2WM/7U-=45-97U=945U145]#25=36T=565%134=55T-!45E36 -MUM355E37U]=15M37W==05]'4-#65597 -MT5535E15U%545U-6TMS3UM11T-G2T=76U%?=T-'07%U>7EU3TU9<5%#1V=S1 -M4U+4W=CV-?65%-0U]14 -M4E5<05%5VL??5EA24-/0U-14T=96TM?65%G7WMS75-164U!'4]/;TEU?7U_5 -MT-!45-?1WM+75-'>U5?6T-[6UM;?TE9=7=%77%Q97U/=V]1355%87=76UM%6 -M4];`QM%14]?6T-'5559<45'6W=?.VD1&3EA=V=!84-W>W]#6W-K%W55375A4 -MT=%14=;:5UI95MW0T-==T=%:7E??V-W=TU16T]37U%Q$4E5=U%76WMC=WU37 -MWUA055Y$6-;4TL=57M;0W<'64%I.0='`V='7UMW4U-/64$-9T\;875A7Q\_9 -M4%Y14T%)4][%P=1=75?%PMA=15A=V=9=4]W?UM#1UEY'1%E1Q,;9Q5=0U570 -MUME67E'6T-U01UA:5L?%75Y=T,?15U'4T]344=?5%M165_?P,1925%5T<;V\-=05_2V==015O$RL9575-?U=C57E30WU-;6EW&TE717];75M/2 -MT5=?U-_$W4))7E5;5\OT]<)%2%C0T$-'6E#3]/%634Q-5MW;VM766=?7UL_) -MQUA&7M+.Q4QV6-G/VEQ`0-/:UE=5U%U25,7%WU-0T5U55U+17UI"6MG,R,30 -M4]%57T9"4-/T\-E;4%U'5-)55L'3UU5045M97,'#V$QT7%E=1%7:P?/-T==; -M1TE;QO7:T4595-C-Q%!S0\39Q-]>55U=TL;$54%$4]S8T5!(=D#8P,'674I2 -MP<;"U,'/TE-W=]_/Q-901EE%5]S=Q-/?7]764=]75EI#T,/24=145\3=7T=> -M50%Q0V\W4W=#UR4US>,3/3T%TU]O"]5'`P_?" -M35U;0D57559#6Q-?345!<24U$T\?=TE??]?;# -MQ5!V0T92QO7,TT-]=TOW^]!/='70\?)1=$!9^_Y?=G5&7U[=U,?&V-_(R\E> -M2$!(W<333DI&7=C37L/<6]Q5P??P_T-:5$A:?'Q!6M13WO3VPM[8SU)$7=C) -MQ])T=D1#4\+-UW1U7<3`_?#31U]?2=3T]E!3=7Q2PO%76'-)3=#_P5-Y=]?1 -MPL#QX?;'TU!96U#-T75%4DQ:S$90U7-524Q/7/A8T_'.P=C-1'=!4,#(]\!T -M0\1`=EG;[>;%=VQY>$#P],+71=#W\L].3T7?T-/R]%]#+EVDA_>'=-U\G[Q5AW9'Y8S\+TU4M)=MK\ -M\_364%I?QL[V4$M91M_-SUYQ2LWPWW1'UTQ&2MKVWLY63W),P,G\]<37Q=-, -M171^2]?/R_//7DM+1$GUQ=7>4M]61US2Q=O,^O#<=F5S?75?P?'.SM#&R,W0 -M7U-/145!7U'25-U6U?'35<564U+6W$%W1-=0V?'%QL+137]T=U/QS]-?157? -MR<7`V$5-0T!34M3S\\+TQG)(1G%;UU3!\/C^TF5_7ES<=71'4\?Q^?+:7TYR -M?W)34-+;]^3Y\D5T=7YW3U+2QO[]P/720T]`U-#2Q=Y9=7)A9$M7\.?F_/;+ -MP5=%1%A>1U#`R=]3TL38S-Y&1$%8UE%&3UU54%90 -MU,??7][*V%)>UU5%7,O_]<1?='9+2D_>R/3/QLO+SEQW?GE#4<7$45?$],)2 -M='13R?7(Q]!`'15YTOGFX.SKE>O@]7-K -M$1%J>MCD[.SA^\C64EA'=5R6C;6TM8;-`#8]/#`('E'OD9&7E):%GY"6DI/HPVD;`08>>.R9A)J6^%UP?'9+<6=L;V!T]>R4E.[ZV75[ -M9'K5GK6PL+>&9PH\.#@S#VN5FH>$F9*0DY#B1Q$'`@,>09*`C8"?^'H5%Q5B -M9'AE>4C9Y>Z5Z>?#<6T4%Q5PG[>\OKV)QP@^)24_-1:6AH.`A)Z2DI#@S->6H3'1!K_XRROKZPAQTP.B0E -M,@/?A(V.@H2>DI#N41<&"0L,'?B&B+6/A>-Y%AT2$1=J;'M6Y960D.O]=&L3 -M'QT618&SOKB\C&,V.R0D/`]+A(^(C(>>D93C11<&"0H/'_*'B+6.A>9G$1T0 -M%&YC9W#5^^J1D>CP<6H3'Q\028:POKB]C6`V.R0D/0Q2AX^(C(>3D.OV>1UO+FYMI``/"4G -M.C89EHV*BHV$DNKG6&@:#0L)!F2=C[6*@Y%U$!@9$VIA?W11\.^6D);BV6$1 -M'!X<%O2/L[ZYL(0>,SHD)3`'[(.+BHR$D._D46(<``X.`6F4@K6UC9S4$1H% -M'Q1D353'\N/JE.KFW&45$!(=$&[LB;._OK&9!3(Z)#HQ&Y&/M;6-FY7\V'-N -M'`$-#05ED8*+B8&7=!`8&1!O?4=6V_/BE9>5YM=A%AP>'!90@;&\OK*#;C5T7AN%AT$`0$;992`B(B#D$H< -M!P<9:DOVYN#AX>+MX?9%9A41$Q`4896+L[^_MY8`/"4D.S04A+6VM(*=\7EL -M%Q,;!@`&$?*$B+6(A_P0!@(!'7C\[^COX>'@YO[6>&L1$Q`48%FH&TM[6`EM5B%!(<&@8&&V+I@8NUCYE9'@`"!Q99[9>7Z>;E^?/% -M3F$5$1`1:V3%A;>RO+*/4@L^)24\#&`0&!!UTDX*UM8*0 -M9@0-#005RY>2DY7F\LS>4G%C%186%&U\VIV*L[*RB^4-/#HE/@EW@[>VM("5 -M<18<&!@:!`40=9:`B(N"D'D%`@T$%<.4DI.5Y_'`W%=(9V@4%Q5MS -MLK:$%SKY -MW4-W"$M;&PMX=C-3\Z.S`$ZXBVMHN9TQ,%!`4?$A%K?>6> -M@XF/A^,7``\-&F?NF(6?ZO9#?GM[9&-L;&!Z3L3R^92#M+:VB)4%,3D[/PM@ -MAK2VM(#@%00&!!\7:&Q[TNB:@H^#DD\:#0\`$?6'%' -MT\C)PNJ#M+>VCN`&,S@[/`S1C;:QM853'`8&&Q=@869_T>^%C8Z#D60&"0X! -M:>V%@821]'AO:6-D>GE_<$/6]?+WW/:9B;2WM9X6-S\X/C5LA[2VM(;)$P<' -M&11Y@8:?Y'QK%VIF<41&F>-Q -M:Q1I>D31W=W>VL;$T49]97[MC;>QMH-/"#\[.#$=G8JWBH'Y%!D>%V9+H2*BHR<61$9$A1C>V%N:F7E -MGH*)CX7%&`\+#QA6G8:!F^A?8A45;7]%WO;^^?'86G!^?4I`3W-4GHBTMXF4 -M&S8_/S`!_X.*B('I81P9$&ED>6!I;T;JA(R)@I-E!PX)`Q;^GH:'GNU98&MK -M;65+UO?X^/;02F5G>4+0P-9"XX"*M+6'?PXR/STU:IZ(BHR?1Q,%&1=F1%AU -M<%OGDX2`@9U='``-`1#`DX6$G.-'8&YL9W%:U]O"R$S8^/C,`[8ZWM8'X'0$` -M&F[7Y.7,7-#FD9B%G^YW$!H%$F'PEYR!59VL4:F%+V?'__/397W1\?GUU -M4\WP\=)T\82(BHZ88P@S,C$`^X*UB(?Q'P``&FWUZ.C[54W=G>K+91<3 -M%V!5YI67E>;>?VUK:6!QUO'[^_/!7'=^?G!)4,WR_F9'E2&)O9G%2POWYY>3^ST=G:Q5L=?#LZ>;39&L4;G/`Y.+@^=YT -M9FL57(>UMXN%9`DS,#0:E(V)@Y=O!@,'%/>7D.)+%19MWY2;A9_M2&YH9%W_ -MX.;_PM1914]Y8V]B?]W[X?O796EJ8T#^[^KL]DEG8V!G9=2;M;>*@5FX>:E=%B%&]W].'MX_G?0WUA;&]B>ES\ -MY^3*3F!H:6=7Y.[IX_-<>6%G4N*`M8N#EQ<(,3<($).#@IKY$08'''_M -MD)?Q;1(09OF>YGH7%F]-^.B5Z?A$86L5:&=!]>?F\$5F:A5M=/#IE^KE -M47MB8GY4\/C*5N:'CXR$XQ((-S4"9IZ`AI-8'`08%-#IE.!+%!-NW)>%AIJ4 -M4FH0%7C#X^OIY-]Y;&EN8''<\OK_V7%@;6!WS>;OX_)78AY[D;QD9$7+AE)7]9!87>OV0FIN3YG5N:F-U].#MX/-: -M9&YK;'M>]/KYP$)D8F!]T?GBXOO$1'%P1]OS^__8?6YMY8>,@YC+&`X+#QGS -MF862\6L9'Q1$[)?J\&<7%'SXD)B8D^=R%1=NG>9X$!T5<.7J -MZ/MW:A9M5>R2GI+HV&`4:F32X)65X]EF%!9K?L/FXN3%<6!L9DC"Y>+A]UI_ -M>'78_^;F\E%X;&AL69&!@(7H9`4``1EE[9&5]&07%V->Y^_ASGYH:F7-Z)V? -MD>=(;A1IG\=6T5:F9>_^/@\EEE8F-]T/GAY/;5=W]W5,KXY/+==F%O -M8,>0AX>J7Z^?7>&!E0.53Y[>[C_=5W?W)9].3F^O35=7][?W53QO7*P55) -M?7QW7\7UR\774UY4VLKVRM!/T]'65533V=C%V-W74UM' -M7-/&P=O2U5-<4E'1V\79TM'1UM177D%,1UU4TL?/R,W9UU915U%<6T5;7UU9 -M6D5`3TE(3%A4UM'1UM;1UM31TMS>V\#U\?;UR,S`Q=_3T-#3T];45U]'049& -M1$=`04187U-15%54U=_!PLC,W%)$1%I>5]/=UU-81T!!0$U`6U+5T-+655=7 -MT<7U\/?)P=K9V\#/RLO!W-=75E37U%Q-='%Q=G5`7]71UU54U-;6UM/9Q,?: -MV-+6U5=75]74559=6D9&1D-"1EA=5-?6T-S9VMK8VL;`PL/'V]O%Q\78V-G0 -M55%<7U!<1T5>7UQ>1T!:7EY<4U?45U-1U=/>WM#6T-WS$U\5<588&SDZEU4^]KN< -M=1)N]I7B>A][__-?T^!#;VY6Z.'DVV50_L1E8&3>[^#\V5[7Y<-]64QP4-): -MT45%5MC?U]97T]5>1T511%3?T\?8Q,3:V5-'4]O06E997=;9V%U2 -M5U%T5]:TL311D%=W,+<7D55Q-]<1$!0T]#=U%56U-O6 -M4%/?VM%17E'0W%-7W-G=5U104%U -MTU3=U514UM/45D53W=W;5EY24UU2UM77U]_275]5WM596E?;WM/7T]?54%72 -M55Q=U%75UM#4V=-4T=/?45Q87=71TU764-7?UE9=7U%4U]3>WM+=4%-4UU98 -M7%=75M;45E71T=?4U]?44%74T][2T=?2T%565E-?7%975-=54-70T%5=4M'0 -MU%?=VME8<75`6%;1W-O%Q\?'Q,7:V=[=TM#6U-545U914%-34U)24E-34%!1 -M45965U=45575U-34U]?7U]?6U]?7U]?7U]34U-34U=75U=75U=75U5555555 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M__________________________________________________________\` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -:```````````````````````````````````` -` -end diff --git a/share/isdn/5.al.uu b/share/isdn/5.al.uu deleted file mode 100644 index b818efdd94a0..000000000000 --- a/share/isdn/5.al.uu +++ /dev/null @@ -1,369 +0,0 @@ -# $FreeBSD$ -begin 644 5.al -MU];7U-35U=75U=75U=?4U];6UM355%=555=5U5145%145=37UM?7U-34U=55 -M55175%15U]?6T='6UM35U5145U=64594U=55U-?6U]34U5545%755=75U-?6 -MT=;6U]545%145%7555%35E97U=?6UM'6T='6UM'6U]?7U5555%=75U=64591 -M5E=5U=74U]?7U]?1T=;6UM;4U=3555=75%15555555175%555555U=555=77 -MUM?7TMW6UM=55%=75U145%=7U=34U-35U5165E=45=75U-355=74U-?7U]75 -MU=74U-?7U%555=75U=34U=35U]?4U-34U=75U=34U-75U-1555565E575U15 -M5=7555155U15U-?4U]'1UM;1T=?55555U=37U-755%175E%04%-05E15U=36 -MT='1UM?6UM?7U];7U]?7U-34U5145U%145965-755U74U-;1T='7U]55U555 -M55145%55U=?4U-74U]34U=555%145515U-?6UM?55514U=75U5545%=45%75 -MU=36U]34U5555%15U=35U-375%77U=74U-?7U];4U5555%75U=75U=34U-35 -M555555545%15U=34U=74U-145U=455555=74U-55U=545=75U555U];7UM;6 -MU-74U=755577U%145%965U355=34U-75U=?7UM?4U-34U-75U=55U=74U-55 -M5%=45=7555175E975-74U]?6T='7U]=55%5555555=74UM?4U-555%=645-6 -MU534T='1T=?4U-34U=37U-155=545=7555175U=5555555545U=5U=37UM;6 -MUM?7UM3555555=555%=65U=75%=75-75U=37U];7U]37T]'7UM;7U]75U557 -M5E904%%65U=45575U=34U]?4U-?7U];1T=/0UM?4U51645!045%75U=45%74 -MU-?7U]?7U]37U-?5U555U=75U]35U%5145%05E=75=?7U];7U];7U]?6T='1 -MUM;7U5545U914594U=36U]?4U-75U5145575U=35U-355534U-7555=65U15 -MU=37U]?7U]575E975=;6U]#1UM;7U5545U=455545%1555165U145=74UM?7 -MU]35U=77UM;7U]?6T-#0UM?7U51145%14%!65%55U=34U]34U-37U]?7U]35 -MU=555E77U-34U-555%=75U=75U155=74UM;7UM'1UM;7U-545%75U-755%14 -M5U175575U=75U-37UM;7U-355=55U=75U=55U-?6U]37U-555=76U-755517 -M45%145965U15U-?7U]37U]?1UM'6UM;5U5555%=65E=65E975U=55=36U]?6 -MT=;1T]#1T=;6U]355%=65E%15E=75U=75U=55%94U534U];0T=#2TMW2T=14 -M5U965E=65E945%145%145%55U=55U=74U-31UM;6U]34U-34U%545=355%57 -M5U975%74U]74U]?4U-34U]37T-;6T==55U975E=45U965U965U35U]?7UM?4 -MU]34U=755=77UM'1UM?55%145%=75U=45%74U-75U=36T-#1T=;7U5155=55 -M5%=65U=5U%575=545=55U]37U]75U-36T=#1T=?5557555=645!34%%7U555 -M55555=75U]34U-?7U-?7U]?4U]?5U575555445975%145=37UM;6U]15U==5 -M5U55U=?6UM?7U]34U-35551455175%=65U=45U1455755575U-36T='6UM#3 -MTM#6U]545U=45U=75U9045-15%35U-74U-34U-34UM'7U=;6U-?7U=755554 -M5%=65E965U55U-?7UM'0T='1UM?55=545%145%175%145%=65U945U975-75 -MU-;1TM/2T]/0U]155%175U975%555%7755155%155%55U=35U=34U]34U-;6 -MUM;7U-545%145%15U-3455545%55U-5555545=75U];7U-?7U-35U5555%14 -MU=36U5#4U%_4TE-7UE#5T-74T=15UM95U]+1T]/455165E=45U755=74U%54 -MU5555=75U-37U-555=74U-575U=45%175%545%155575UM#3T]#1T=34U-75 -MU574T=34U-555%965E%145965E=45U15U-77T=#0T='1T=;6T=35U5545=55 -M5%74U5555U145%9645%65=37U];6U]?5U=74UM;4U-?4U-34U%115U175E%1 -M45%65U74UM#3T-#0T=#0UM?7U]545U975-5555175E915U=65%75U=76T='6 -MU]?7UM?4U]15U=555U=75E945515U-?7U-75UM#4U-;4U=3455175%75U=75 -M5U=75E145%555=75UM;1UM;6T=;7T=;5U=74U-?4U]155U%15E=455=75U54 -M5%14U-37U]55U=?6U]?7U]=55-?7U-;6U]?55%=65U145U=45%145%35U]?6 -MU]?4U-35U-?7U-75551455555%145%975U=55=74U];6T=;1TM/3T='7U=54 -M5E%75%555-3155175U=75U355=34U]34U];6UM;7U-155%175E975U=75U35 -MU-?7UM;7U%55U=37UM?6UM345=555U=75U=75%145%5555155=34U]?75=76 -MUM;1T=;1UM?7U]?7U]155E%04U!045965%15U=37U];6UM?55=75U-37U]?7 -MUM?6T=;1UM355U%34E-045975=37U]?7U];7U-35U=70T-;0T=?6UM345517 -M5U905E%65E965U=45-74U]?7U]?6UM;1T=;6UM?4U=545U975E%15E=75U=6 -M5=36UM'1UM?5U=75U=34U-35U575U%=15U975%35U-?6U]?7U-?7U];6U]?7 -MU]?4U5175%145U=75U145%175U=75U=75U74T=+=W=W3T]#0T=?55%915E%1 -M5E=45U904%!05E35T-#7T=#3TM+3T-'1UM;7U]355%%045%04E-15U=5U=36 -MUM?1T=;6T-#1U]3555165E=75%175=355%=75E=45-37U-31T=36T=;7U556 -M5U=24-555=?4U-?4UM?4U]755-745=37UM;7U];7U%=745915U155=37U-?6 -MUM;4U-555-75U-55U5165U!6U574U=;6T=#7UM55U5145U=45-?6U55445-0 -M4E-75E965=36W=W=W=+2T]/1UM;6U-35559645%15E=745-34%%45-37T=/1 -MT-'6T-#0T-;455175E%65E965U=75%75U-;75U36U];6U-?4U=35U-?6U-37 -MU-54U=555U%145%75-55U=;7UM;7U]?7U-37U-34U]?4U]35U-555U=75E96 -M5U145574U]'1UM'0T=?55=71U]74U55555145E!34UU24U%65-37UM#3T]W< -MW-+3T-;7UM35551645975U175U=64%!15E155555U=;0T]/2W=W2T]#1U]14 -M5U%14U-145-6551455145%74UM?4U];6U-?6U]34UM;6U]15U55645!15-75 -M5=75U=55U=35U]35U=?4U576UM?5U=545%15U5145U=45575U];7U555UM15 -MU-34U-75U-15U];6U]34U-555U=74%!15E965%74U=37UM'1T=;6U]74U]'1 -MU=77U]555=75U5=645!15U=64574U]?5U-'0UM?7T=%45=145%175]76UM37 -MU-575E965E=5U-?4U];0T]'7U]355%94U=555U=5551145965E=55=?4U=34 -MU]37UM?6U]?7U]?7U-545-?05515U==74E!7U5175-77U]155=37UM'6T=/0 -MT-#655144U-34%%6U=145=36UM75U=?45574U]=45-?6U]37UM'455907%#5 -M5E;55E75U-'3T-W15-;7U=;4U==55%14U]95U517U-174%57459655=65=?0 -MT--75M#3T];6UM=4U]=15E?4U5975555W=)%7%9455+4U=?7U531T=;4U];1 -MT='0T=?55U355-95U%545%36UU=575!5UM505%?1U]33UM?2T]=15%75U%;7 -MU=745=74U%104=155U-05576W-S0T-;3TM?55E%275%1U5-4U%;4UU=755?6 -MU%945M#1U]/2W-W64%33UM;5U#55=374-37UU375-)34EU04%I6UM_1UM_7 -MQ=U0UMC35E-5TE=96=3=TUU=W-Y77ES7T=%54M15U-W1U%)1W-_15E!0TM]= -M65974%-5U]955E?>WU=17-31WM575=C$S]!/45E:4%75UM79W,/R765W2EM! -M3U_%],?;R?':T]?9Q=!$3E[=PM[<5D)2U-U52$#4U%975-?6UE=6V]G>T5+6 -MV=%/3=70UE[4P-U45E/?UMU94%U8Q=745U=7Q-U575C24];94U774E_:QU?4 -M7=/0UU71UW76W=575]]55-#'WU%7153745E(VLK(UT501-34UMK*U4%%1-=> -M44U=S,'$0UA=TL32QE]85M+T]--615W?TE%'6-;!UD9.1]W5VM-24]/?5D5' -MT]#675/2V])3V=ST55'`T=165T-025C0W%)7]]!W6=%03$#1S_W$4U[)4-]4 -MU-E.6$O!S$5.2=[+T]?$T,U<35%&WE-0W5?5V\1#U=U2V%[UTEI>T-A`2U+$ -MT%E*Q>37=W+,\=]90=-5SEA65$347?U46U?;W=[-0]AV=5_3PEE#V-W>45)1 -MV=;8WM744-';1UG,3-Y-3<51QMY>U\KPUE%U6<9+1'%9]6]32WM;&WDC5UL[#=$]35_;"74C2\E172UC<7\G66E)144?25DQ>V?79 -M45I4T=G05U?7T]]0W<9>44C84$905MSU6%++5UY54]C"6=O(7$9S0_1!3=?\ -MV%G94M_5U]17P-5:<7U;V5]Y$5\5"1ES$P%U7UEI0PLW;6M-44-%:0]?PVU%0<$155,#?1];45\Q< -M7T3#]MU<=%+?<%+;4?3/V754P%%65M#?6-CR5UG04%I'149715/>S_;3T'Q5 -M75W%U<%3UEIUV/3;ULC!3-3:2G5Q6O?UQMQ'=5'TS\37UUQS<]796717XO!% -M471\W_71Q,-:4\;8S---1$7#T4Q-3%G?TE#<1$]0VL')P5U%5,;WUD!U<5;2W55W=W.W5I(4]S4VM[WM[635M$R\1!4M!5WL_3WU5&5L[) -MUT)=U==#6=+%WU+6]-K614;65=)5P_79=GIR=%74UL;+\7-#=Q/7)WE1:2DY`7E/3Q]_6T-/7U]107T56V=K24$%/4]["P-/>VL?% -M5%I#4U!95=+765_ -M7%U24U7WU9:1UA35]'?VMG?W5!`2TQ:5=C>UM;3V\'&VM%34UU< -M5]?3V=G=4D1'045=5%564%%6U]W2TM#445E2UMC%W-#3W=C;TE9?7EY34%?4 -MT,3,R\#16T]"7-+>TU1>1T=$15/4W=K"S-I437%W6-S`S=I57%-17D5975;< -MP]M47UM8U<#(P-C:Q\;,S=C35UE#0EO=]/#QR\;?TM/774=.=G][>GEV0$1& -M1DQT=TA`7-/$PL[+S\3>U%U5S/W[^//U]/'V\/[\RM1/?V1_UI2'@)GV%P<# -M!Q-B=$)[8V5`S/[]4GEE?G12Q,K]X>F5Z^5:9V-^Q./KZ>?;=WYP6MOT]=A? -M35K?R=UV8&'DAXR`EV('#0$12?W/9!84?_SKZ^"BX+J%``/!A15^=IM$6A8YNOC1FH1:TKPY/[S_^'NX-QF:FY(X9:1XM%Z -M9W7!_/#1=79%P_/WW45$5M_12V9]EHR+@?L<#`X$8_S@W14=%43@E.-*%!-J -M0/KAY/O_Y>+@V&=K;%CLD)?E0F-C=_7D_MMU?4[;\/#"UUY:1$E]9G>3CHJ` -M_!D."05DY>/5%Q]J5^Z6[786'!=TY>+@Y^7GX^329&MH=>.1EN%>86-RV?[X -MS4U_<=?V\O7<7D1?6W1Z8,R!M(J;9P`*#QU4[.%^'1UG^):7S6H<'6S%X^W@ -MYN#IZ_MW:!=OV962E?9]8V50\_[)1'EZ3\OE^=M"=TQ5W$5E8?^`M8B?:0(* -M#1'/[N5G'!-_YY:5V!4<$V+'B -MZ.[Q>A04>>26D>)086-WR>7YWW9Z?%[U__142'9-U<3;67MDX(*UCY00#0@! -M8N?K_&(<$'+GE.Y%%QP08GO]WAJ:GSDEY;C561F==KP]M]-<718 -MVLO"54!)1-W#W4MG?I6,M8+G'PP)!'_CZ,MK'Q9TYY7@=A<2%'#VY.?FX>WH -M[<-D%6AUX9:7Y$!A84[UY?['3']]1,;WR-Q1U-/474]\8&3OC8J-Z1`"#@1F -M^^/%:!P1<.25[%!K$!1ZWO/XX>SIZN_U>FMI=N65Z_I2?GY;S/#*UTYQ=5S> -MQME165Y4W-!<='MF59N+BX1(!`X-'5#BX487'6[1XNC_9181:7?`_>?MZ>KK -MYT9L:F;$[Y3LRDM^=-?+]<=02'!W6-G!V='4UM)33G)E>>>`BXR1:P$/!FC) -MX_)E$!9YR^/A4&\7:WI6PO3[XNJ4Z?5G%&IVYY24YM=]>$S;]F6Z?%(>W'5SLO:74Q`4M#9T%A:7U)4441R9TV?B+6!V@4.#AATX.+4 -M:1%CUOCGWF`7:GI3S,3!^>^7ENQ8:Q9IW>J1Z/%#?G%2T5==75'6W5986UI' -M5,SUV45R863KC[6,Z!T,"09B\.#,9A=L5_+XW&<4:GI3PMG4R^"4D93R9Q<7 -M>_J7E^#$3W5%7%A#0%+=V]1;3$Y;U\;-V5]U>694A+6UA'`&"0P=3OG_2VYH -M3_;QPWUI:V=;T5!,4.65D);F3F@48]_LE>WSWU354TM_?$'&]LO40'5,4-G, -MS]Q'<&5G]X&UB9UH``X#%%+]S')B9MSTVEAD;69,T%)*=]SCEY"5]6$7%7S] -MZ>_XR<_.Q5Y\9GW9_OG.679Q1M;'PL#<3V=C_HVTCI83#0D!:5_.6F5G3OC\ -M765H;GG2PT=_?6-I84['W7YF<_Z6DI;G761@>TC8\O_[ -MX>/P26%B>=S_\]="1-W/TDE\L9#PD'9DMW>F5%\N_*8&IJ -M9=?*5&9C3N.2DNOP6'![97M(QOOB[N';?V%D3L3TQ5-?UL_VW75V7,7?6WMM -M^XFQCN<%#`T;9&%K;'#SXNU>%!5D5,C5>&A@V^J3E.;VPM-W8&QYRNWJ[OM4 -M<'UW0E)17E'']\K01DA-5]_70WY@18&QM9`3`P`$%&L3:D/@Z>5"%Q1WV-IQ -M8V)^\^B7Z^?GX/M':11AQN#@_,G#S]E`?GM(T\#'W-!75-#3T-7?WEMQ8$:! -MMHKJ'08'&A$3&!?$E.O#9!1BW\M!8FY^UN7BX.#ME>["9&AB3,+TSO?FX/]9 -M96=QU]A77=+V]M9+V7#@[:,\!P9$Q\<&@5OX9;D?V-F1O588FIE -MPO7"]/KOE)3@661GT[3]>3CY/^&-)71\"`@5GRM9D=.F4]&9O?UA)8&Q8[97@_N*5X]%_>GUP]`<`&1`?!1)RX>+? -MS.F5Q6-Z4D-E?]#^X./DY.+AVG!U4T!S2<7P],_)]O?4=G=7TTQQ6-Q61457 -MVM%U>'=`\X>#E.&3DF<'&1T?!1L4??;`T."7[41,RL9_84_$R^4X_;A[,Y,<'5-='9) -MP_S*\>3G\,KQS=K51T%:1W9*5-W6T\SWQ534U%Q-3$%(24MQ<4K!GX?KZ9^< -MPA5L%!T%!QX7;6MYXNKCYI67Y<[575M_97Q6TT7%^.?__>7^\-I21$ETU]1`2DE.=DI) -M?77:D9GME9^3^7].;Q80Z^[CYOE0=G)W96-\1=73\>#C -MX^?[^'9_<.F?X>R9G.'4SGL5%AL8 -M'1(9$G%-3?;KE^J7E>GN^<136W]C97E_=U'T\^7FYN;]RL763WY\&=YQ>[N[Y64E^CG -M_O35 -M[\/ND)7&VO=Q9A<0$1$2&11F8F36XN#BE)>6ZN_F_O1U?')[8&%U2TS=]/G^ -MY>7Z^<'3UU-*>'-P1L!,9Q44%!07 -M$A1D961&Y.;G[Y67Z^SD^?)9>7EP>V%_1=7=S?SEY/[]^?#94%-$<7%W<'UW -M6EE?W,W$VL#:UU]!=797Y^;TY^OI]]W`77UM:6L5%Q$58&5Y2//AYN/HE.[F -MY?S`1G=S?'U^<5O>PLKYY^?Z__S*W%A/=7!R?')V=$A:5M?8P,3%Q=]075!! -M=53GYLG_[>W)5MA1<6-L;&YH%&]X#OX?[PS]M!<'!.14]?VO3P -M]_W^_/'*R<7414]/=W%P=DE-1UG3V]?1WMS775U34D5"7U7(^_SQ_^;ZTU#6 -M4GUF9V9A8V-E?4A#4L[R_?;_Y/GWP\S'5UU6U]30V=C.]551?6-3=U%]&5]521EC74EM8UL#W_/'S___WT-171W!X?'E[>WYV -M2D9>U\/,PLW(]V-[?V=_1S=]34=_67EE05%-&0=51TU)5V=%5U-_=5E!57499 -M5%76557=T-#1U=[<75+0T-#0T-GP='37='2TU]#5E_=75S=U]I4T]7?W5S0T-U1 -M4-)1WMW15E+40EI15M'&UEE54]?=W=C:WD%%5E357-G!Q-W0TD=>W5=7UE9> -M5==?T=+3U=1>1UU`U<#>U=_)TU]5W-E>4%=044Y&4=+1UMC)Q]C.T45U3EI9 -M0%Y3TL7$UM?#V%Q7ULGWP]-;65E$2E%5WL/5U=[84D!91U15<$'#]_?!U578 -M0G5?R=Q,4U/64%7=W=_9Q]O4P=5W==Q62%+%QM7'W%M8T51`7,[,1%S9T%!7 -M4EU4M3;7D720UE2TEG5VU3P=-5W%=> -MW59:6U#3W%]5T5)7Q-1:U<3%443TU%-U=I85,725L3<6]%15=!4 -M5EU<5E1$U5]'0TU?15MC9T-G7T=)3 -M4D],64=-6\7=U,+U45#UP];?UUU0Q -M45)37%39T -MT=E43%Y24]];6-S64U7?4M-86==8U%?7U[0 -MW-145M#24U)<6-'6WMS0V=K95]514%125E!2W\345=[77M=17EW45EM5WU%9 -MTMQ05<3>U]'75756%W67E;T%165U!7TU)>WL_17=S3U%'0TEY7U-12 -MUE10W='47E3>45E=U]O?U%#6W-W15=U45]72TUE?4=77U%->UM=5U]?76U#1 -M7E)05M+=UM/9VU70V]955U?2W-52U59%0%Q74=77W57VM[:R7U]24%35U][9Q=G8WM/>V=G2U%14 -M5U-6U5)97%!44%-24557U5=15M79W]75U-+45]34U-/9T=31UU36TU73W553 -M4=575E%34U-=7UU75U!4U=;;Q-]6U-/7W=S>T=#25U=555]87EE<7%)34M74 -MTMS2WM_>W=W0U]574%!15E;5UM36T=115=;455)?5E345%U24U71W=C4U%5UM?7T=+0T=35U]'65%?4T-_8W];5 -MUM=55%!=7%)=4E=04%;4T=/2U%74UM;0T]?7W-S445-24%%14%74U=155M76 -MU%74UU75U5%3T-_3W=%5U=945]?5U=;=T]545=#055Q>4EU=4U;5UM/2W='7 -MUM=55%75U5114=30UM?6UU565E!1U=55U-;7U=?45]73T5575=33T-=55]?5 -M5U!05-515E=75]755=?2W]S15%955%-2U=/3W=W2UM=74E-05U175E=55%17 -M5]?3T=;55-70T]#0UM?75595U5%655=5U5%25E915-575M75U-#6U]#2T]W= -MT-#655%04U?55E;4T-=55%=55E!4U-?6U]76TU16U=575=35UM'6T=#75E17 -M4%945U=75U37U]75U%105M35U=34U-#W]#=W]/6UM7555%04UQ34U!05E74U=34U5574U-55577 -MT]/2W=/0T-#1UM95U==75]355%=04E-145!145'5T==4U-;6UM+3U];7UM;4 -MU]'6U%575U=15M755%34UM?4U5=6U517U=;455145595U]?4U]'0U]34U=77 -MU-555%164U#4UM70W=;5T5515%575=?1T-/65M7655745%355U'7U]74U535 -MUU575%%75-7455%7U]55UM?1T]=45]5455175%175U145M745-?7U]?1U]36 -MU];6UM;6U]145U%75E955=76UM3655?55%945514U]#1UM145-7455955%16 -M45%5U=76U]?6T];7UU55U-14U-%55=?4U%505M574U!05E155=?6UMW_G<&3`Y=/24G==1E],8&ET]U_7+1G;5W5'61E3&WE-:T5#8Q-7<55=14D=$QM[=W5!<5<724%A$T,W9 -M55I07U+?V5!44=?%Q\1?6-=45E=;6-/26E#=T=C?64!U=)7TU?>Q-/25%]3VL'54%]=4-'07%U145'9Q%1=75+7W=%5T]S3 -M5%A6TM9<7-30VMA06E_9P]=:0UE5T=-14-=5Q=A17=+!T]=26=3=5U%4U=96 -M5EQ'7U/>5=?$5M/?VM-25-564='?5-'0T]=74E514]964E?1TU154%_0TMQ5 -M7%964U;7U='5%)75=;95]+1T51=5]74 -MU]?0W=S4T=%4W=15UUU745=54E)=UU]1T5'6T%'0U-W4U=?1UM'9T-77W]=< -M4%=64]765=-645-6557255)64=)44E32UM76T]525MS=U]/?UE=25U=55U77 -M5--65];1U5)35%=4UU=5TUS1U-?6UMG44U)6UMW44]W55E1UM-3U%11U=U7U=S16%35V-95T5#57U'=W]U6U][9UT?6W%1> -M4-Y47%U=U%7555=4UE!04]G55M;6Q-%5T];=T%344]=%6%%6QE-4P]#04T?7 -MU%-76=?5T-+7U='75]_?U5/5UU_<6E[4T51?U-7UM31UM73U%/<4U36V=-= -M45537555T]/6U-5>4-=74]305=S5U,''W5U64%Q<4M-4T=95T55:5-/1W5Y! -MW=->55355-K?5%)4WUY1MA40-W37=C-U=[& -MW5W"UT)655M?3UC25UL=!6-5=7M;?7UM1457/R\#-W'11T4YUWLW/ -MR%M,7EA66D]3QV%3$U5C=TU180%9=1E#5 -M5U=1U-W:V5]?P\165]=54533UU]1T=W3T5+1VD1+OZ>_L[NS@^O'62F5L%!81$Q`7%&AC9'YP=43>Q-#!P8'&A\0>.?K -ME9.>G)3@^NR!B)'F@X/@>F,1'1@+"@4>!@5;DY^6D9J:X69M=F@%!!(7$A\4 -MV^/TV^F$B+2UB[6U@.=M'08(-C$T#@(&:>F;A(&)BH'H]T40``\"!@<'$MSO -MX>V$F?QB>6$$`!D3&!@1 -M9_#XUN.^%M+:,@HF-D&49!`8(-C0"!@8=])V:FH>,@I;6UGP>```%&1L> -M8/_YP.*3D>+R_92#BX"$CHZ?PF44&`(U-0T!`P=_Z)26A8*-F^#@X&L&!AH' -M``<1B"C9^$C(:5T681&@(*"0$``QW>XNB2A("`FNOH -MYA0'!`0"`@009-?SEX6;DYV?[5STA(Z6^(."E69C>1`!"0\;&@T%VNKYYIJ# -M@9/CZN46!P49!@,;;$/>Y9V%G):1Z5]R[YB;FYB!@Y+(1'<3`@\#`PT"&&?? -M\^B:@8::DI7X8QX;&@8`&VIZ4>"3F9Z=DY7P<&)4FH;EEHB"[L?MR1T&`@,& -M#`X%>WUCX82&A9B8G^QD%A4<``$2%!9G_^B5E):0E_C8\I68AYN8@H'E5_=B -M!P,!`@P"`1EB3]N5A8>$A)Z7Y$L5$AX%!!X1%7K%Y>^7D9&7Z.;ZY):&AY2> -M@YU`=M,7!@8&``,!!1!A<-R4FYN?GYF7PG%D:AX;'1`0%7/&^>V4D9"6E>[@ -MY)6$F_J0A^IE?_05!!H>!0$$'A%I8'7AD9"7G9Z5^_;89!05%181:7EU4_#M -MZ^N5E>OLX>"0F.CAG)?=<,9)$A(7$@4:$A(3%6=#PN'KE924ZN#^]U-_9F%M -M;F%P0U;]XNSIE97NX^'PV5;8]-9,V_157D5:4E914=?2T-#=W]/4U];755;5T]96U=9775)145!4T-S7U)6 -MU=36T]#55%574U%5U]?1TMS=W-_=W-W6U-155E)34%)=4E965U755=745%=4 -M5U%65=31TMS?W]_=T];55%%27%U05U15UM/1U]'1UM?455575E?5UU14U=?4 -M5U%14UQ=5]?45=/=T]'1T=9545%645-15%75U=?3W=WW]W=T];4U=555%=65U=5U-34U]'7U=7545%5 -M5E94U=55U=75U];555145E%14%%75%55U-74UM'0T='6UM'1U]77UM55U=15 -M5U145U175U34U51555=75U=75U74U]37U-?4U]355=30T];1UM;65%=75U=4 -M5U9755=65-75U-;6U%35U5545554U=34U]#3T]'6U]?45%=45%=65%545U14 -M5E975515U=37U]?7UM;7U]'0T-'0T%175%965E965E904%955-77UM;1UM;0 -MT]/1UM174%!14594U575U=755=5555555575U574U];0T]#6U]?55U145U=6 -M5U55U=77U]?5U555UM?5U5145555U=36T=#6U=555U145U35U]75U-555%17 -M5U155=75U=74U];6T=/1U]34U-545U945%=455545%175U175%555=36T=;0 -MT-=4U-'7UM'6UM3555145%904%-15U=4U=34U=3455155555U-37U]?6T=;4 -MU=75U57555145%15U=34U-34U=75U5555%35U-75U-35U=545=;45=155=34 -MU=75U=36UM;7U-75U5175E=75575U]?6U-7555145=35U=34U5155U155=76 -MT=34U-34U];3P?')67Q[<$=4U5=4T\3"QMG0UMW?UU=755565-/=T-77T-#1 -MUU545%9145!145-?653SXN1:8VQ]W=M`?'-3\?S,T]SU\O3;U]767D5&6UU9 -M45165]+9W=W1W]!645?655A?U-1865?4UU-045/2T-S2T\?$5U_T=+14%'1T%]1TE36UM;0T554T5!;45'5U-'=U];54]/14=34UU365%;5 -M4M?44=!5TE=1U5W4U='15]+3U]954E?54M/45M%55U155]375%;5U]!55-70 -MU]'6U=73T5U0U%935%30T-/44==7T%=?U5-3UU?6U=;0U=?6W==75]=25M95 -MT=76WU374=;4U-11U]55UM=14%715=Y55M=5T%)355=075#655?5U]U=W=_3 -MW-55T]_44%745UY5W555U]'4U%9445547U91UM%6UE70U5104=#=T-31UE/6 -MTU145E305U3=UE105=_175G4UUY=4]70UMC>TMQ6T%!?5%%65=?05U35U=;5 -MTU]7T%354M?65=95TE%4U%%24=_0W-#4T]%47UW7UE-24-71TM16T=%44]/7 -MU%;7TM;7UM%4U===5M1?U%!4UU344-?0TE]0V-U45]S55%355-%44=#155/5 -M5-765U?5U]36U594U5=45E'0T%50UM%6UE71T=105=;=UU/1UUW2TE56UM35 -M5E!44%74U=#04]365=73U%/1UU%77=Y35%77W5934=W2U595U=315U#2UM%6 -M4U77T]/75=#74%;65%_55ES0UU=1TU?4W=55T-S55%?7WM514%'45-37T=71 -MUE!04=;655?6UU9=U]-6T=974%705U'44=;14595T-7655?0U]31U5135%-5 -MU--44E34U%%6T=;7UM;?U-55U-15U%75U5175-!?5=915=;44U/6UM31W=/5 -MUM985U124]/35=/65M;5]?2T-/1T=135%#7 -MUU50T<;365[7T5]<4U;74%30U]56WM=4T=75T51?5=+1U%36W=+=5]945E92 -M4EQ3U-/4U=70U]'44]364=?75-;1UU915-/245+1U]=25M30TU/65E14U5!2 -MT=?35=31T]!4T-;35-?54-5455)65]-74-S1UE76U]?57=164E755%'7T-W3 -M5%?6U5-=4514UU77UM364=?4T-W755;5UU165=?4TM[=4]307E547UU0UE57 -M4='35-94W-/54-79T5=5U];54%/5UU10U='45-507U?0T-36T=;74E-6U%14 -M5U555%16TU30TM15T=[5U=?6T%3155;4U5)6U5]675!65M95U='1U]'?T=?3 -MUU12TU9=5E705=?6UM/15]31TE96U]574U-5U=535]/0T]?45-K245U445]2 -M5=?0T-W0UE!;65A91D525U15W-O&PL'&Q5M5045I>7U)2 -M65Q?5E%6U531T=+9WMO;VMG>WM+6U5=14U!27%-65U=55U975E%14%-45537 -MT-/TM%5U,_*<'[^TQ<3\9#:TO[I[-5L%DC@D95D!1.2F',2 -M>.';0$;T^VX4;>R9D.P5%7A<3Q053I6=D>=W=\+'7$!WWV55P/;)SM5W1E[>U5C#RMS7S\5!0=9,='%9Q,3$T_#V5-C'SU1' -M?&5T35%3V\W=RL+&Q%'555)^<-;*V-?7U/7PP%C5T%-?2TQ`14'0__;PU79" -M7,991U#7QUM56E[)VL#20-;=0'1'\,M47E?"T<7;UL]%T5]P2$'"U=?34MK2 -MW=)11$'0P-Y3459:7MG"S-9+4]/.W%Q17=-<6D/>S%!15MG8QM%,0E_>W]5? -M1U['VL7:T\??64Q:6EE25MG$T,7$Q=A?0EA4U5=115[2V]C>VM9=75/>Q4=V -M4]S=WU/;R]A?3%;35UE:1-7!QUM'U-GTWEY&7E95QM!?5%7$Q=?7V,#16$-2 -M55A-7-_`T5]75E74U5;4P=S1W=?:V%990EC44%36W-71TUY=4=73UEU?U]+< -MT-9<5-G;WE924E9?4]#3UM''T%]%4-_=7DQ9W\//T%;6U-==U=1=65C45='2 -MV<31T]+>545'0D96QU-;55%35E954=;0UU%3U%!<4-77 -M4%'4T510U5?5UE;0T=/=UM?7UUW5UE32T%575M;6U5!7U]554U%545165M'7 -MT%15W]#3U-33TM54UE915%?54=37U=?44%#04UU7UM%24=74UU;0TMG1U]=0 -MUE175U%45M72U%U2U-%=5M14W-[4UM#555;=V=+54M/05-11UUQ355!15M92 -M4]%24U34T=#2U-W1V=G1T=354='74E16T-%<5M;2U%-05=196U7WMW44%I0 -MUM)05]/>V=%=7U/5U-W54=_>5E%15-125U?0U5S6UE;?U5==5=)7U5Y7TE]6 -MT--6T]-1VMC2T])46-35UU575E71T5S15U)6TE1%UM]61%5=55+5V%37P-## -MTM%67]17W%325EA64-C25-%7V4E*55765M71T=%6U5965L78W]-9VU36W%Q> -M7U-77-;'T]W64=927===5=177=+3UL#55-+27='3T%E>Q-1!0EC05%S15MK% -MU\'`7U-24493W-+8TM/4TM+1WM'7TE;70UE76M5<4U;26$;2V%U7VE_>W5[7 -MQM5!55/?W%72W<[64=952U7=U554UE-0T]_85MK15]944%/44-?6557<65=2 -MW%)655%555%855=<5-U2Q-C;T5%3T]5>TE'2P\;6UM==U=%;UL)47]900%A3 -M7E#55U'6UE?7];9TU53UMI57%?&WU%35M955%%55=9155=15EU; -M65%74=;5]5065-365A25%%0 -M4E-14%)4T-5=U<7&QLKQ]/?P],S#VM_3UE=4U-W6741"3G1]?GY]<'%W2D)! -M3G=W3UM<4='8]?WR]O+Y^?CX_/;EG(*!ZOGE5!`'`@`%'1P0=^'KZNKI[^#" -M?V9[9VEO?=#T\O+[X>?.1G9R?WYY?4?.^N;N@;&WF.CHT@4)-#4`'AX6_IF% -MF)^7YO1\%AT3$11C0_#C[^+D\]Y)9&-@?DQ'1=GE[Y69M+V)E^WY$P@W-@D9 -M%Q3>FH:%G.C8>&D?&A)O9'3V[.KO^=!837MC87Q"U,#W\/WEX92-L[:?Y^9D -M`C0W-05K;G:3@8><[M!A:QT$'&1'1LKNE>SU=GAP>6U@2M#$]?WR\OWX[(:P -MLX3DX4P&-#8T!FQG=):!AIS@=&L1'`0;9OSGY^Z4Z/QX%&AD9V-PS^7F^]CN+ZW1@U-C<":'='[H:`F>UW%QP>&AAL_>[KE)7C]'\4%&!D9W3- -M_?O^R,##V'F_#XNGI[^3T=V@5 -M8')U4,7*^O_16U;6[HF]MIWAX&(/-C$*'4)0YX6"AY1($1X>'AD4T.^4E>GF -MR7(5$6IE=%[(Y^#EQ79QU^F-LK&:Z>]_`C%%7L -ME.OOY\)]%1=O>$A9QOSD^-A/1?>5@K.PA^WG90,T-C4$?L+GG("&D%06&QH= -M$!5VY97K[?G?=V!H;F5`UM57S/'&T]GEA;:]B^K_UA((-C8,:,3XE82`FN-B -M&04>$!=@7^?H[N7:7'!A;V-S7UU&4,O^_??QE(ZRL(?]TV(!-#$T!4[PYY"' -MAY/1$1L>%VH5;]3NZ.7'VL-0>FUG2DQ^>5+]Y^'GXH2VO8C@37H<"3V>AYCC8AX>:F,4$63XXOG3U$_S[^_FX9NWO+641GD0##0V -M"1?+Y>20A9N438U/_@V&UK>DMR>$_R[^CMX9"*O;:?WG=J -M`#4V-1IU\/+JGIN2\VD2%7]K&1Q[\?/!P?KNYW=N8W!\9'W:YNGNXI**O+:8 -MPW,5`0LV-`1ZR?;HGYBSIZY&/ -ML[:'YT-O!`\T-`(6=5+ZEYV>EO9E>W(6!1H184_&]."4ZO=V<'%^?'5>P^3C -MXI6`L;&"ELU]'``+-`X%:'G1XI>?GY?\WE5M'P4;$FM^4_N5E^SQVUQU24!= -MV_+DYN*=B;>.F^S+9A\!"`@"&!=L3/;ID)*6Z>#7:1T8'A(59U?AZNC@Y?GW -MRKL]7!M:A45:619\?GX -M_OGX^?G^__OY\,S&PL/SE)B?QQ=%<6D!R9&9F9V=G -M9V5Y7RP-#055Y" -M<'AZ>W]Y>7E]=4]#3T]$7%)?4='9Q]O$PL+-]/7W]_?P]/3(PL3?TM5265?V -M^_W/W=-64E]*?'YP=7=S>7E]7-W2TI.0$9:4M?0'%_?G!VGM\<79)0%/6W-G3T]K&VL7`R__Y_/#R_?7(S,S&W]?3_^#G_<';U5M*>69C -M9F5Z>GE\S5%!?4-C/]_#S\/S[ -M__;USLWVZYN;D>_A^E5Y%!X8'A(2$!1B2,OEYNF4[_1!?V=B8F-E0-G'Q/3P -M\?;P\O?TRL[*]?7XG8:%D^GM_TUC'04$&QX>$Q1FW>?LX^R5E>=89V)L;VEL -M>E3Q_/[DX>?^]#AY?_U -M1V=M8V!A9')9RN?@X.'F^O717D]Q;YS]U&?F=F9F=^=EO!^^#CXN;E_,U==W)R75W0-+$QLOW\_[_]L#07%A;7-#`RO;Q -M]/7)S<32UE980$EU=G9U=$G%XN+YZIV7[^SX74!V;&ML:15K:Q5H8&1_1]+. -M\?'W\/#*R_7,SO;UP,++R\KTR\CTRL7774=+=G-\>7I[3/OGR.^=D>_NYM-= -M3F)I8F]J:6EJ;F9D?$/7S?#QRO?Q]_7U]??Q],[/RO7*]/'P\'Y\>2G>OLXL]=4'EL8&=L;FX5:F)F979>V/3TQ<#W]_?Q\/SY -M\LK/SGY]?7QR=W5UW>_JY)6>D>/A_%Q83F-L86)I -M;V@5;65\3E7:]_+-UM[`S?7P]O_E\,;#S,;!S/\\M!%7']M869B -M8F-L8'YQ3%-4W,O"5U38V\3,R_;^_/;W]_3*S,;&Q]U57$1&1DQU3T%#04U) -M0D=$05I17D;>X>/TX9:4X?KVUE="969D9F!C;&]A97Q)1%/'S-%0T-_9P/7S -M_OO\\_/P\??U]?3.WE=80DAT<'!*2'5W<79*3TQ"65577MOB[O#AD)?CY//= -MUT!D86=@8V!O;F!D?DM$7MG`5$56T]W%S_3YY_OR_OKY_?#W]O7;4$=,2G9\ -M?G-V=G!P=DY&1T=95=!45_WIYOWHENGD_-M45G%G9V%C8&)O8F1Y=5I:4-C< -M7UG7V,//]/S[^_O[^^7E^/+VR,540'9P<'Q[>WY]F5X/_U55!??61D9F!@;6]@97]U15C4VM%?4=S"]??P^^;G_O_EY?GS -MR\#'UD9W_E\-Y54W9E9&%@ -M8&)L8&1X=T=;5]K85%3

/HXOCTTE=2=WME9V9F8&UA>'UU15S4V=U45=S' -MSO?Q\_[[_O/Q\//QRUUQ`2W5T='9S=G5(2$Y-05E15U31V\;;WM[/^^?_ -M_^#BY//"T59$<'YX9&=G86%D>7)+1D12W=-4T,7-R/7T\?S_\O/R\O#WS\'% -MTU-'3$AU=W%Q=W5+2$A-1EA25E72WMS>WMS:\.3X_^;BYOGUWM9<='QX9&=F -M86!G97YW0%A4TM!5W7-T0EE0U]W=W-['R??T]/#]\_'Q]/7UPMK9 -MTU!;0$Y)24IU2TA(3$U-1EM=5-'=VL'&P<'!P,'$Q\_W]\K*]5]S:Q,')]/7T]_3*SL#$WM+V=G;V=[;Q]K?W-+0U%924E!=6D9&15A86%Q0U=;1T=;2 -MW-S=UM+9WM/7U]36UU=5W-G>W-+2TM=64U-=7%Y:04=%6D1$6EE<7U]05%55 -MU]#=V=O%Q,7'PL;8Q,'%V-S0T-/44U-75E%07%E97UQ96EE=4E)05M71T=?1 -MT]W?W-/2W=+=W-#6T]+65EU?7%E$1T5;65A;6%Q=4E?4UM+?WMC%Q,7$P<'% -MQ=G=W][2T=#755517%Y<7UE96UA96%A<4E)6U=?0W=W1T-W0U-76U]36T-'0 -MTM'7T]W0T=;1T==45E%24E-=75)=7U]>7U)34%?5UM+=TMS9VMK;VMO:V]S2 -MW=%45=507%U24E)=4E%04E)34EQ>7EU75%37W=[?W]C;Q=C2T]W355174%%6 -M4%-35E555U%6U=564%37UM145=;75=36UM+05%%455914536UM;1T-'0TM#7 -MT=;6T=5555=04%-=4E=45E34U]34U-77UM15U5175U34U-31T-#7U-54U555 -MU];6T=#65%145U%37E]65E%75=37U-37T='1UM;7U]'3T-34U];55%555514 -M5-555U=55%345%!045!15U75T-#7T-W3T-/3T-34U]145E=75E975%174534 -M5U'4UM555U77U]34UM/6U-77U]?4U57555=75U77UM175=555596U=164U%4 -MU=34U-'3T]'7U]37UM36T=;4U-37U%1145145U=75%555%145%975=77UM?1 -MT=?7U]545%75U574U515U]545U355%=55=74U];0T-?4U]145U=75U94U557 -M5E175=75U=37U575U]'6UMW;A=6)-[95D%';GE=9H%WWBY4%%SL1Q>TCW_N7= -M9='T0WEZ?T%-> -M55324EO?P,1=1MK'V]!=T-)07%Q%6==?TLG84U976%/85D92U=-64U%4P,W7 -M65W$V--21,?!T4!&W=]57U?;45Y=1%I0W]70U5?1TM]7U%%5Q\';4UU4U='1 -M4%-44-+'PU5:T5507UY95-Q?7]_2T-Q57%;2TM9;6E32V571T%34=#7T]/4U-944516U])7T][UM#65];3TU57U=537D535]'7 -MU]#5WM-04E)=5='5U=S2U515T=36U%!5UM%655505=?6U%=4U]575570WM/7 -MT=+7U5-65E-7U=;4T554UU905U%7U-964];3T5=4U-'25U?0W-115M32UU!0 -MU-904%)0U='=UM37T%75UM74U5155555U%575=3755%75=;55E'4UM?7U=#1 -MUU54UUIV2T=?5=/>VL3'QL?'Q=O9W]W3T=;5551645!34U)24E)24U-04%%1 -M5E975%155=74U-37U]?7U]?7U]?7U]?4U-34U-34U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -9U=75U=75U=75U=75U=75U=75U=75U=75U=75 -` -end diff --git a/share/isdn/8.al.uu b/share/isdn/8.al.uu deleted file mode 100644 index d7c69bab185a..000000000000 --- a/share/isdn/8.al.uu +++ /dev/null @@ -1,323 +0,0 @@ -# $FreeBSD$ -begin 644 8.al -MT]945E=14%975%145%145%15U=75U=555=74U];7U]'1T=?4U-545%=65E97 -M5U=45%155-75U-?6UM34U]34U-?7U]?1UM?7U-355%=145%375!14574U];0 -MT-#1UM'1T=;7U-3555%25E175U?4U5755=555574U575U=36UM'6UM;7U-15 -M5%965E=755155577U]355=?455915-77U=745M76T='7U-77U%165-?4U-?4 -MUM?4U514U5=45U945E755%16U-#7UM;7U]7555=55U=45=35U-?1UM?1UU13 -M4517U574U-37U]?6UM'1U-77U%545U15U5165E145514U=3555175-37U-;1 -MUM;1T-35U5575E975U175E15U=35U-34U-555%74U];6U];4U=34T=;45577 -M55175%545%%6U515U-;6U%145=355=37UM575-71T-?45=5445=45=575%14 -M5U=5U-36U-77U]?4UM/1T=1555555%35U5555%175U=65U=75%55U]?6W=+6 -MT=?4U];7U]?555545-545%145%%05E145=74U]?7U-'2W=/7UM'75%35U554 -M5U155%145U=75E!15U75U=?1T='1T-#7U-34U51755504%=645!15]74U];3 -MTM#1UM;6U-35U=575%35UM;1UM?6U5355%145%175U=65E945%35U]?4U-34 -MU-75U-?7U-74U]?5U-36U]545%175M345=3555545%35U-35U=555=75U=?7 -MU-77UM;4U-34U515U5175E=45555U-?6T=;6UM'1U]35U-545%=75U175]55 -M5%145%=45%75U=345=31T=/2T=?455545%145575U-?4551555175U175E97 -MU=?7UM#3T-'6T='1U%5555175U75U5145%1745%65%55U=35U=37T=#0T-/3 -MT=;1UU355%914%!145=45%=45=74UM'1UM?5U=755=77UM;7U=37U]75U557 -M5E%65%15U-34U=77UM;6U];7U=75U=75U=77U534U]755%1445)05%=65%77 -MT='0T=#1U]345514U=34U-36T=?55%=75E%045=45=34U-34U-37U]37UM'6 -MU%75U-3555755=75555745975%75U=345515T-#6T]'7U]155%=65E%65U=5 -MU=74U=555%=75%55U=37U];0T]#1T=;4U=75U5575U174%945%15U-?4U=37 -MUM?4U-?6UM'3T]/6U5=75%%=4E%05E75U]34U5755555U5545E=5U=77UM;6 -MUM?4U-?6U]55U514U=7555545U=75U=555555=75U=74U=74U-?6U]?4U-75 -M5=55U=?5U=955M555%15U-74U];755175E1555555=555514U-W%W5-65=%0 -M7U!65U)0U='6U576T]#5U=?6U5=4U-?4U=;1UE575E964%!65U=75]?6U=31 -MT]/6U=?1UM;7UM;45534UM?4U]?45%965U914U!15E34T]+3T=;45U%15E55 -M5574U]?6T=#6U%545U965U35U-34U]'1U-31T-?55-775%%45%965U164595 -MU]?1T='6UM355=74U=755=55U=?6U]34U-74U%575U=14%94U=;0T='6T=;7 -MU-34U%1145=55=555=555=34UU545U!15%945=36T='0T=/0T-'7U-545%15 -M55145=74U5145%114%945%14U=75U-;3TM#0U]34U5175-555%=7U=?7U];4 -M55175E=45E975U95T-/3W-+1UM575E=45U=75%15U=?6UM'4U-555%34U514 -M5]75U-?6T='4U5545517U=755%=5U-34U-?7U%575E915E=45575U]'0T]/2 -MTM=65]545%55U=545%15555555145%55U=?7U]?4U=75U]'1T=1555545U97 -M45%15E14U=37UM37UM;0T-#0UM;6U];7U51745%04%!045945='6U-'6U]?7 -MU]?7U-?455165U975U=45=77UM'1T='6U%145%5555545%14U=76T-'6U]15 -M5%145%75U=75U]?6U]345%965E=55%75U-355-31UM;1U]745575U=555%16 -M5U75U5555U!04U!7U=?7U]?7UM#0T-/1UM75U-7555175U=75E965E%15-74 -MUM'6U]?6T='1UM;6U]?4U-?1U5=75E-34%975%35U-755=75U-34U-355575 -M5574U]?6UM355%=75-55U=34UM?7U]7555175E=75%74U-35U=34U=74U-74 -MU]?6UM?7U%94U5145=75U=74U-37UM;1U]155=75U5175%75U5545%145E!1 -M5E=75%75U=36T=;6UM;7U]?7U-74U=75U-34U-155U!045%65U35U-76TM/3 -MTM#1UM145U=15E965555U575U5145%555-74U-?7UM#6UM?4U]34U]355%17 -M5U145U=75U=4U=35U=?7U-75U5555=77UM'1T-#0T-9455575E%145%75U=7 -M5-77U]35U=?7U]?7UM?6UM;1UM1555755%=75E=75U=65U145%=45=74U-?7 -MUM;7U-37T=#0T=?55%175U=65E%15E545-15U=37UM?6UM?6UM?7U5555=55 -M55545%54555555145U75U=?7UM#0T-'1UM;6U-555U%04%!15E=45%555=74 -MU]?7U-555=74U-?45=?6U-;7U-5555145=37UM?4U-355%5555555%=75U15 -MU=34U]34U-37U-34U-?4U]?7U]155U=75%575E975U945%=45=75U-?7U];6 -MU]?0U534U5555U=65E975E15U=37UM?6UM?4U=77U]?6U];7U-7555545U91 -M4%-05E?5U];6UM'1UM;6UM;7U]34U-555%=75U145=5555755%975U%45=74 -MUM'0T-#75575U-37U5545U=45=5555=75%1555145U155=34U]'0T-#1T='0 -MT=;4U5914%945-7555175E975%175U155=31W]W=W=#1U]75U5165E%04%%1 -M5E145%14U=34U-?6U]34T=#3T-'6U]?4U5555%114%!045945555U=77UM;6 -MUM;7U-34U=34U]?7UM;7UU5045904%975%175U=4U=?6T-'6U-75U=755555 -M5=34U]35U-?555145=74U5145%=5U=37U]?7U-34U-74U=545E975=?6U]35 -M55=75U=75==55-555=34U]?7U=75U=75U=74UM;6UM35U5175E%65U155%14 -M5%75U-37UM;7U]'1UM?7U]3555175E=45=75U-545U=455755=75U-;45=;0 -MT-/0U]555%=75E%65%555%75U-355%=75E94U=34U]?7U]?6U]34U-?4U-54 -M55175U975U=5U-;7U]?555155=74U-34U];6UM'6U=745U%45%545U=45575 -MU]35U=7555545-34U-34U]?4U-?7U5145%555%145%=145975%74U];6T-/0 -MT-;4U-74U5555=755%175U965%155%!75535U-?1T=/2T]+0UM145U165E=5 -M5575U=74U=555%975U=75-77UM;6UM'1T=?5U=34U=5555=75%15U=74U554 -M5%=75%75U=36U]?6T]?4UM35U5545%545%545%145=75U=74U-?7U]34U-?4 -MU=34U-34U]?7U-755%=75E=45=5555145U75U5545%14U=?6UM;7U];6T=;1 -MT=145=545%=15E9045915E=45=77U];6UM;6UM?7UM;6T='6UM;7U-545U%6 -M45%145965U15U-;1T='6U]37U%555%145-55U=34U-7555165]555-75U-?7 -MUM'0T=;4U-35U5545U975E=45%555%175U155=77U]?4U]'0T]'6U]34U-55 -MU=555%=75U14U=55551555155%545%75U]'6U-;1U]34U=75U-34U5575E96 -M5U15U=75U-34U575U5555U=4U=37UM'0T=;4U-555%145U965U15U=74UM'1 -MUM74U-555%35U]?7U-355=3655755%=645%15E?5U=3455555=75U];6T=?4 -MU];6T=#0U%545E965E=45=55555555555=75U-34U]?6T=#6U]5455545=74 -MU575U5555E-145!75%75U=37UM?7U];6UM?4U]355=75U=555=5555175U=7 -M5U=4U=?0T]+2T]/6U]545%=45%145%145U=75U145-75U-355=37U]36T]?7 -MT-#0T=?6U]75U51145!34%%75U145%34U-?6UM;7U-35U=75U];1T=;45514 -M5U175U=645965U55U-;6UM34U-355555U=?1T]+2TM165%934U!65E9145?5 -MU=37U]?4U-75U-37UM?1T-'6U%5445%04U%645945555U-355575U-?0T-/3 -MT-'6UM;6UU575U9145%15E155=37UM#4U5575%965=36T-/0T='6U]155%=7 -M5U=65%1455555U=75E35U=77UM?5U=37U]?6T-?5U=75U5575U355%74U%54 -MU-;7U5%7U5915=?45M?1UM?4U]'45=31T=3555145E%5U]15U]!44%174595 -M5576U5?4UM?4T-#4U-155%165U14U574U%35U]14U554U]15U-'55-;1UM#0 -MT]W1U-?445-745U<4E945E74T=/3TM#0T-545%35U=34U]%45-?55U'45%E? -M55=34=#15-73W=34T--55]30UU97U-904]'155345U=45E95UU%35]54U='2 -MW=W?TM'6T=105]'65U76U]15U=754%]25E987U1065'44%;3T]30T]S"P]%1 -MW=%#1U%74=_#RO?UQLW+U$=;74U/6EI!1T=:7U]$1%M`=75,0D74WM54S/#% -M5\KQW-;;Q\G]R?UP4`'A,$&!3:E/[!ZY'Q:6U)>&AD -MSOGY\_KC]TE*5T][=U3>QO;DY/GXYOM$U,1^G\T4;&(2'WJ5YMN1G.!W0U!@:F-4PEI4Y>S_T??Y]%I.4T5$24]3F[RT -M!9NU&C5. -M=UMA:F]S1T'SX>?ME9F.B\1ZF6(."`4:`Q!T[I+O[)?K81QN:1,4]Y7LE9:4 -M^G1E969H9M[`7<[F^MY7VLE?=U911]3*_\C@BK+N9H[L#S0!!@H`'/.?[.F: -MA,,38V\8!Q;EZ.:0AIGV565_4<+PYYNSMVV2 -MCQ$T"QL."P1MEY?MG(&<;!5X$P<:=/C3XX6%[?SG4&X7;&1@9-?@XOCG[?[6 -MUT%\2'5S3>RUL^WXM>,-"P0"-`(8W>GED(&&\WI4;!H'%DQ-TI:%D/KHX605 -M87IK;$G!_O[^X^'PR]G37'-,6?"-LY)5M9,!#QL`-PT%8?#UE82'XESP>1(9 -M%'IG1.V0Z>'IYTQG<'!M9D34W,O]_/+W\O950U#1]8&PA=2(F@4,!0$T#@84 -M4%[IA(?K_^-)$QUJ;!5_^N[CX.KIWGE!4F)L6=5"Q//(\^7R]/+T5$#JM;3? -MG(K8```>"30-!&)\4)&'F.?M[F40%&(4%$OR_OGBE>=1U<%^:7)2=$S)\\CR -M^>+@4O?_XXNV_I>U_``&'PDT#08787+JA)COE95U:FAN$1=ET_7][93M]_/S -M=6-R=V1V5E[6^?OG[>GHR)JQ@&>`@QP"&04U"0$?8F/&GX7KX)'R;&QG:!%K -M<=[9R.R5^:,A!`!!0$W"@T'$&GSGX6= -MDI_@6G,5'Q\3%V!$\^B7E93ORT=U9&EL9WY,Q.7OE):0C+&"ZXZ$$@8%`C<* -M#P8<%\2=FYR9F^OSVF@?'!X?%V1&^.J7D9;L^\!V8V]B;&)!S.64DH.QM)B/ -MCW0:!0$W-PL,!AAZE9F?FH&>[NU:'1\?!!L68TGEZY&2ENCM\'!A9FX58'[5 -MX):`L;>&M8CV%!(!-S"7GI^=DN_1 -M7WX6%6UK?OJ1CK&/C[&`PF<4##FYF7[>1U;FUJ%&3"A+2-@K&)D./'&`@+-#0T"@$0?."%@8&-CYKR\GD' -M``DI+BU45G%6EFTH&.DHZVA967Q`0"#S4U-`@&'&CFF(6! -MCHR8D>MF&`4&`P$;$6;-Z9.?GIB=Z.'_W@^*7E6@&!`\)"@H# -M!!AM[I>=@(R&GY_H81`=!`$'&1-O5N&4D)^8DI25Y$1215N$@/2!BNK@E_09 -M&`<,#`@,!@4?0.+BGH.`A9Z?YF%K$`0&&AD<;U_^[Y&?G)"1E>7UQUR6C93N -MBIKQZ.]K!1\``@X/`00%%?7QZH2!A)F8D\%Z8A(%&AD8$V!)SN*6DIV=DY?C -MY_?X@(1$@XW,Y.]$&AT'``(.`0<$'%[&^9Z'AX69F.ET;]EX6:QX:`T.'B4QD0&`$`#0<&!!UX0EI>6Z/KI@871@X95[^%V'18:!``- -M!P8''6-MTI6=F)Z:A)?MXEH5:A89'Q`1%'M6R^"5EI&1D9?BE8&$R("&TNGF -M=A,6!0<`#`8!!A]I:UWLEIF:F82>ZY7]8&UK'Q\3$A9B>='XXY61EI&6Z>#K -MA)O9AH17Z.9U%A49&@8#!`8''VD52.?HG9F=A9B5E>-+9V86$A`1$15F2M7P -MXNGJEI;I[Y:'A?^!A_+NY=L1%QP%`0,$`089%!=\\N^0F9R:A)&6ZLU_>Q40 -M$!(0%&Y[6]WE[>B4EY3KE9*&E.V`Z_;O\&%K:A@>!@<$!@00%A18\N&0F9*; -MF)&7[L=.>&L7%A`6%&MZ2ES_X.^5EI65ZI.&ZNB`Z/OH^V1B:Q\7IE>CJZ^Z?FN62A>3G[?X\%%W<&=@86=\ -M=4W0]_/XY^?ZY_O^\_#^^-O!\]E'6E!S>'AE8&!C8F%A97YU3%+=Q<_W\?#R -M]_7URL/`Q]C8W-/W=-54EU? -M6D5$14584E-05=?7T]S2T]S2T=/1U%164EU<7UY97EY?75-0U='6T]#0TMW= -MW-S5M;4T]#2UMW1TE77U5%65%%44E565M16 -MT=;9UM#=U]%75=345E%74U%345=555345=35U=#0U=17U%54U]365='4U%55 -M5-545%97U5!15537T=?8U=S5TM;6TE#14]!155'75%16UM1=W<'EVWYE?G=! -M6L'#V<',\578T]_;WLQ=YL)F6W%!1TO&=-I)T,Q&Q]S$TMC5VE7`653#7\1+ -MU=9(Q4S065#56<9&WU[&7-M;\'?_<R$W(T=U0U%3" -M4]E1Q=A'45=>V5C1U5[%7UO;6\=5IE24'>4?7"]?;%]=CV-#64T'R5K0VMU>4$'25]),TLUUUDS9W%[26?-#6--7 -M]$-1V=S:=5'+T6\E1=_'8T47Q05A4Q-!$4L7& -MVW79T=U,<\1`]$E65,=:3]+!\%+25\U1==K8V%I>W=?1U%7?2-)`7454R55, -MV]M57$'84?%>T,;WUD/'QT)'5-C;07%9S55P6<_8V$;:TMM$?O'7V7+6WMK* -M1L+.P]5>T%O5\%[>1TM57-!;W-S27=+4VM/905??7]'05L715D=3T%G'6]I6]%=9TT7% -M=EUR7%-#S=7_7-S&S<%07];-14W;PMW455C9549?U]-/5]+&W-Q=5-9<14K> -M4U%-P,M0UM7:5-]45-+3U%K-7E;67D!?W5E15=C2S%+;S-=;1M5%5-+2Q5=; -M7]3!U=O>4-G6W$)96$305U11P-57Q\365U1!U=!.0]327=K;V,W%UE?'05]7 -MUM965W504%_0T]Y1WEG0Q-G46%1;TE115L?94%=5TE354]#45$=2T%964%/6 -MW];5T\36U5-75U35UW-S56UY#14);7-?2U5?3P=W8TMS25%-&-SS_721-CAX^3]S]C>3V`5;5U<7#?&9UEES=DY%S__X^=Q. -M=%_;1TA>TM=1T$Y?]/#+U4M6TT-/=3<)94U'%TMK73$)65?%WU)-6=G!QM934U;04-%37$53U]31 -M4=;;V-O9W]906$A-7M/15571V=_V-E15=+3U%-065A'6%E? -MT=[:W-30Q=#57T535=/4UMW%V-'74%9175!15-505M73UU77TMK55U!05E?3 -MUM'645+6TU574UU6T=76W-K;55A=5=+>5%#5T5135U974UE74534U=#6T]_> -MW=_54%;45UQ=4EQ35-;65515U]'1T='0T]#7U]W?T%105D=Q=4%>5]'W]W3T=;455175E%04%-34U-34U!04%%15E=75%15U=74U-34U]?7 -MU]?7U]?7U]?4U-34U-34U-75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U?______________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -:____________________________________ -` -end diff --git a/share/isdn/9.al.uu b/share/isdn/9.al.uu deleted file mode 100644 index fd206143eeb2..000000000000 --- a/share/isdn/9.al.uu +++ /dev/null @@ -1,232 +0,0 @@ -# $FreeBSD$ -begin 644 9.al -M5U145-75U=75U574U-145E=5U-?1T-35UU55U5=5U-;6U5165E75U]355U%6 -M5U15U5555U;6W]1<4U545=31W=[?W=#4T=#1U]545U=04U-15U1455545U14 -M5=74U]=55%55U-;6T]+0T-'7U]35U5=14EU=4E!15U155-75U]'1T='1T='1 -MU];1UM;7U-555%145U965U=455555%74U];1T='6UM?4U-555U975U=75=74 -MUM=75M7555545%74U%555%74U-?6T=;6UM?4U5545E=75%=4555555555=35 -MU5175-75U=74U]37UM?7U];4U555U=75U]?6U-75U55555145='6U=?7U]?4 -MU555U5555%175U=75U=75%5555545%75U];7UM3555155=37U]'1UM?6U]75 -M5%145U=45U=75U=45=?0T-/3T]#6U]155%144U-75E35U=74U-3555=15E=4 -M5=37T=#1T-#6U-555%145%145%145514555555155-74U-?1T-'6UM'7U-55 -M55145%555U945%555555U=30T=37U5155U15U-35U-?6T=;1U-15U=355%15 -M55175E965-75U-3455145%=4U-;7U]?7UM'0T=;45%=75E=65%=55=75U=75 -MU=34U%75U5=5U]37T=;7UM?6UM?7U-555=545U=75U945575U-34U-?4U554 -M5-74U=34U-?7U-75U=555=75U555U5145U155%555=75U]34U]37U];6T-95 -M55145575U=34U5175%1455555=35U=55U=36UM?7UM;1UM?4U]3555145%=7 -M5U=145975%145=37T=#3T]/0T=?4U=75U=555U15U5124%9045915E34U]'0 -MT-#0T=;6U]75U=75U55555=65U=75555U-34U]?7U-34U=75U555U575U]34 -MU5545U=75U=75-37U]?6UM;1UM?55=1445145%5555145%355=74U-74U];7 -MU]37U]34U]34U-35U5175E965%75T=#0UM?4U5575U%15E=45%=4U=?6T-#6 -MU-355=75U=75U-?45]775=755=755=55557555545%15U=?6U]?7U-555%=4 -M5%555=74U=7555555=75U=75U=755=74U]?7U]34U-74U-?7U]37U]?6U-75 -M5%3455%65E965E965E=4U=;1T]/1U-75U-35U=74U-?6UM;455575U965E=5 -M5%75U-?6UM;6T=#3T-'7U-555%175U965E=75U14U554U=745%!4U=36UM'1 -MT]/3T-;755175E%045=75%555555U=74U]15U5175-75U-?1UM;6T=;7U=55 -M5%=14%%65%35U]?4U-34U=75U=75U]'1T];1TM#4U5145U965U145U=75=55 -MU=75U=75U-?7U-355515U=37U]?7UM?555155U=45%175%545=755=77U];6 -MUM;4U5145%155=75U=37UM=5U=145%175%14U555U=?7U];7U]?7U-75U515 -M5=74U]355555U=75U5175U145=34U=75U-34U=555=75555555545%555=75 -MU575U]15U]W0T='55575U=755514557555155%145=75U555U555U-755575 -M5=75U-;6U]?4U-35U=7555145U=45E?5U-?7UM;7U]355=75U=34U-?55U75 -M5%155%=455545U35U-55U-?7UM?6UM'1UM?455545%55551745!145?5U=34 -MU-155515U=37UM;7U]37U]37U-?4U-75U5545U965E?55%?55=77U]35U=74 -MU];1UM?6UM;55%=75U15U574U]?6U]?455545U965U=45=36T=#0T==55%17 -M5U=455155514U=34UM;7U-15U-37U5%555=4U=34U=555555U=75U-?7U575 -MU-?6UM?4U-35U=7555145U175%145%75U];6UM;6U-7555175U145%555515 -MU5555=74U-?6U]?1TM;7UU545U=75E%145%15U=4U-;0T]#1UM?4U5545=74 -MU];0T-'6UU5645975U35U=55U=34U-37U-555%1455555=75U555U=34U-55 -MU5=15=54U=34U-75U555U-37U-74U-155%=45%=755555=74U-?7U]555515 -M5575U=35U=36T=#3T]#7U5545E945%74U-3455175E9145%15=;7UM#0T]/6 -MU5145%145%545555U555U=75U=74U-355=55U=74U-34U-;7U]?4U-355%17 -M5E145%155575U=34UM;6U]37U]3555145=174%=75U155=77UM?7U%74U-37 -MU]?7U]5455175%1555555=35U=?4U=75U=74U=75U575U-?4U-34U%545%75 -MU=34U-75U=?4U-3555175E775%145%555U14U=74U]?4U=37U]36UM?55554 -M5%14U=34U-5555145%=75E14U=34UM'1UM34U=555%145%=45=75U-35U555 -M5555U=37U537U]?6UM'1UM3555=145%65E15U-74U]?7U-75U-;7U514U517 -M5%35U=75U555U=755575U-74U-75U=755=75U-?5U5545=77UM;1UM36T=74 -MU=7555175E975E%15U1455545=?1T-#1UM?4U-74U];1T='55%=14U-345%7 -M5U145=74U=34U-37UM;6T-'1T=;4U5555U145U15U5!245=5U=?6U];6UM?7 -MUM;0T]'6U-755%965E=75U15U=35U5545%165U555-55U-?7UM'1U]34U=75 -MU-75U5145%965U75U=?6T=?4U516U=14U=75U]?4U=755=545%175%=45%14 -M55555=37UM'0T-/0T=;6U]?7U]34U555U=555U=75E=65U=65E%65E755=37 -MU]?7UM?1T='6U]175]=55%155%=75554U=37T='1T]+3T=;4U554U=155U15 -M5%965E975U965E%145!15U15U];1T=;7U]?4U-34U]'1T=/3T-/0T-#3T]#6 -MT=+1U=555=555U175E914EU<7%]>6$5:6EI;6%]24%95U-?6TMS'AY?W!U3D=0UM[&PL[+ -M]/;Q\/#Q]O?T]?DYN'E__/`445*?'ME86!@8V!G>'UW1%)4T=/0W=_9Q<;`P\[+]?;P -M\OS]\O#V]Y_K'X^C[_OO>0%=W8V9A:6EO:&YF>'57WLOR\/;R -MRMK"R,#-S\7!R,+9VL?&P,'$V-!764%"049'7\/BX'MU153,]/+GX^/@Y?#.QU9.?5>149!1P0$!1I9MS@[.?[^>;GWWMC87EV#@X.7:=7MG9F1^ -M<4#7PO#ZY^>4AH*:Y7MD;QW`?F1T6']I:7'PX^?UPOGA -MY/*5E?]"3,_[\51'W/+Q4'UX2]S,V]#!]_WDDXR*@>46'!T='@<'$G3T -MP5EVT^;CU6@0:EW\5'MUY9:7]GID4?CES5S0\?#2<65QTO#]SU74R.^'M8J9 -M91L;'AT9!!MKPN7)3WM2^OYP%A)B\^36<=7CE.Y3;&)'^.;_P\3.S]5Q?T#U -M^O+`P*EA,`!A@6$QH8;/+M^DY@$4[CZ_YA:F=% -M6V=I;7E2\.WK[?Y096%Y7_;GX^3+17Q]1 -M:\_JE=1H%6!U=V1@9GQ1Y>KJYMUZ8WI=]N3@Y/11<7)/W?+GYO[UYH:WMX<5 -M#@@#:\A)%AX60>B6]V(7%69T7D1[;6?UE);C6FYH?/3AXN3/5D1(2EK;_>'L -MX>&8M;:,T`(*#AG3]&03'6_+E^E1;Q$7;4'?2FUK2.Z2DR0E_A-7CD(VWBI\3#P@#:M9:;Q`4?N>5YUAB%15@1DUC%&SV -MD9WH=!$28_"7D>WOY9%1P6=>J1YW=K%&E] -M4'X5$6;@G)S@8Q\=9.21E_A(>G?8Y./FY?CMA;6VC,\#"@D:7O-S$1P5WI:6 -M^7P5%V):3V@=$%J1A9S/%A@15I2=ZU%C8DG_[^SZ_>&9BK&+X`$U"P1>YD81 -M&1;7D)SC?1<1;%-0:1X9>Y:$F_D6!1U-EYZ6V6)N?SY9ZUL(KO`34* -M!%_F0A(%$U"2GNYV%A-I7M!M'QYEE(6;_A$$'$V4GY?&86QQ_.J5X?3XFK2Q -MCMX--`@<_.9E&001]Y^^#MK>$$0D*`&;GQ1<%&6;IGY36:11C6444&AMAEX>%YQ0:''7ID.O:>7I2 -M^NCHYOGMA+2V@G,,-0T7^_)N!05J^IR0]F$58%U7:P4$%>Z$A.EI&QQ\[Y#J -MQF5G6N7KE>#\Y9Z*L8GQ`C4/$_SE8QH$%_.2D/1A%6;1S&(%`1/FA(:78!@? -M>^.7[MAY?U?X[>[CY^R:M;&.V`TU#!'^]Q4$!6_GDI5<;&]U]MT6`0$5E(:$ -MXFH9$$#BZ?K43ESUY>?FYN#KFHJVC-L#"`,6R=<1!!MGX)#I36-D4/!9$@,! -M:)>'A>5J'6I3Y^'SW%79R/?]YNF7DX:TMX9L#`X&;<]Z'@<26>F7_7]Z7/+/ -M;00#&EF^0DIR#M+6<$@\-&V53%04%:_'H[%!X -M6__A11P#`!7LF9+^>&)_7U15V/[F\E9U7^67G9*;B+:,TP`.!FI49!D''5_B -MXMIZ2?S@]14'`QG4D9/M5WQR2$M/T_OMY]QSM#IDIV0F(JV@G@"#!AC -M=1<$&FS_Y%9Y??CJX'$9`01H]^#F^?WS5V1I9/+KZ,QX>-'BEY:4DX^PM><& -M#!ML9!8'!6W\^7]B<^:1X'(3!1@19=W\XN_FUF=L9?^6ZEIJ'!X=%WK=X>OL\'1F9$[TY.3T74)1_^B6 -MD9*-L;7F&@82:!$8!A]Q]%-N8_64E\!B%1,?'!1.^NCIY<1(?G]&].3EQEI? -MQN?JE):;M;&!;`0>;18:!P5BP51B:E?KEN1E8&$1&QAI].SOY?+V47YD1OG@ -M\4IWWOKLZ>J6A[>WDQ,8:&8>!@8=2U9G%6?AE^S4?U]Z'@<>?/W__>3MY75C -M?O?C^U)TV?OEY>.4DH&WM>T1%F1J!@`%%W-E:6U6[N[_U]?W9@4$$4[05OSK -ME?9G8%/X_-%'W_WVVOZ5D).'M(KM%6A[%@$!&!1D8FEGQN+G]T_CD97?9$[R_M%$V_+*7]3FE)>4A;6UEVYA014``Q@7;Q05?O;B^_?\Y_ML -M!1L5;!5EXI/HW4K.Y3/_F:P(#'!(9&!1- -MV\S.XY7FR5%N'!\3%F+/X^?[YN/_5U+VY -M!`46V7XO7Q5A$;'!<59MSDX>#@YOS*]OGW6G52P\GUY.F>CHB0Y)/M -M$``8'0%3EEY3X_>!/'QX4%Q!MS.7YY.WLY/#^Y<%/1=?6W+ -M@.Z2GM,8!1`%`P82:6MGQNZ6[?[MZ'@?%V\3'&'PS=_DZNG\\^'FVG56Q]5$ -MQ^"4AXF$E)J22QP=$`$#!!P6%F?WZY7DX97L9Q!O%1\29--.5>*4[_S@ZN/2 -M6<[?=73UY_V3CX"5F87^%!`5!`,&&A,3%4?AZ_OGE)?%%6%E$!]K0'MY^>CM -M^NR7[O;2]MIU3%7-W^6&C):0@9!W:V82``8$&1P=8]_C^/'HE.E$84-O'!!E -M>VM"YN;G[93KXOK]_-!(1-+67N"&@.F>@.A\94H<``0%&!D?;5OPW_"5Z.[X -M7%ED%!=C8!5R_?SYXI7K[^/Z^=U.4EU)2MWIAX7IAX?D4E!R!0<8!!L%'6UW -MU%#@[N;HXL]:?V\5;6AJ<]_*Y.GJZY7MY?O&0U]=<750S)*'E9^`E/7+V!`$ -M'@4:&P469D-VRN_Z[)3C45)):VAB:6),]?SB[NF5Z>?\]M-"14EV=774EH>4 -MDX*0_?_*%00K"5M%F;&)B8W_2S^3@[>KIX.7_SE]& -M27%R=D#>EX27G(.6Y.7V%!H=!1H%!1-K9&'1Y/#FZY?QV?=T9F)F8&18P/KG -MX^GIX^7X]]E23TMP?GY*1_N8G.J&FNWDYEH?$!P;&P09$V]O8&4E?+P -M\D5A87)D94'+__[F[.[BX>;\WEQ`=GIG>W-U5^Z8D9"$G>_XYW$0$1(?!1L< -M$!5H>UWW\N7JZ/OV\]U]97-U<4+,^_KGXN[BY_KRR--=1TEW4U'#Y>'G -M__+G^L+>5$IY7P_^WM^/#W54IV96QI:6H4%6MN87].4\;W\_+S]\CU -M],_#R??W]/3V\O+P]_?US,335D!(27=S<'5*3]SZY_[CZ^+[^?==0TMZ8&)O -M:Q5J:FYA?G50Q/7V]O?V\?3T]O#V]_?U]??V]O'P]_7"W5=>0G1V=G%P=G1U -M1F9@:6IK:A5N9GY*7-W/]O;U]OS\\O#S\_'W]'IA;&UM;&)D<$=4WLGQ],OT],KT],G/S,38Q<7&R/3U -M]/?UPL?>T-=76DU/279S=DI)0D5?4EU6=B8FUL -M8V1]3U'9PL["P,/!P,CUSLS/PL##ST%=7T,;#Q7E^?WQV1EQ35-'?V-[9Q,W.SL_,SLO(SLKW]O;TR7UU0U=#3WL?` -MS\G.R_3W]??WR4E-<4-?1U]?1TMW6U=?45U?555975=70 -MWM_>V=[?T];45EQ?75U>6%U<7U]?7U#6T='=W]W15%975E34UM;0T]'6T]W= -MW][4%?7U-71U5;7 -MTM;6UM#3T=%5U=74U]=54E)<4E=75E-7U-;3TMW2T=15U5504U/4S]1^6,3: -MQGINVNO'V-USY>I;%F?^D.UG%7'C^&040?G]T=7WTWUA3M/YY_Y285U^>41T -MR^'OZ>_;8&1:U]!'>E_QVG]L8$'GX_#34-C;0G75S\O9WMY6U]M41E%<96-? -MS,']\D35_%=TW49&R/)9?<+/V-M?0D=>2D7-],U52TA`U_3WVUO=V5)$7M;% -M\]I"5D1#=D/45L/!W5U4RTU134]Q43U+55%+4P\?2U4E%W]Q>7M+9TU=&7$%6]\Y=15165-?> -MQL[?7%127]+15UI%5E9`6U]5S,3345W3T=G27=?;Q5=!T]-<5MW44M76WM'6 -M55A265G645'7V==9U-+=W=537-#?U]16T]W=WU-=UM+57UM;1%S7WU5'7UU105];6T5-1UM%07=C:55-?4E94U=/?U-;57EW15E_W5%<5=1445=5TM[VL3&QL;'Q=K8V=S=T-'4 -MU5175E%04%-34E-34U-04%%15E975U155=75U=34U]?7U]?7U]?7U-?4U-34 -MU-34U-34U=35U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=7_ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -M____________________________________________________________ -9____________________________________ -` -end diff --git a/share/isdn/Makefile b/share/isdn/Makefile deleted file mode 100644 index 0999d7792807..000000000000 --- a/share/isdn/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 6/8/93 -# $FreeBSD$ - -FILES= 0.al 1.al 2.al 3.al 4.al 5.al 6.al 7.al 8.al 9.al beep.al msg.al - -CLEANFILES+= ${FILES} - -.SUFFIXES: .uu - -.uu: - uudecode < ${.IMPSRC} - -FILESDIR= ${BINDIR}/isdn - -.include diff --git a/share/isdn/beep.al.uu b/share/isdn/beep.al.uu deleted file mode 100644 index 57324004dbfd..000000000000 --- a/share/isdn/beep.al.uu +++ /dev/null @@ -1,107 +0,0 @@ -# $FreeBSD$ -begin 644 beep.al -MO)PU,P+EEA$*#)^YI;%F."(XFZ5M+"!#"Q -MI[N-`CPT>I_$`P[`LJ6]ZC(F/FFUMH5E48RQCATZ(3SCN;JTU@`3EY(9/3L+ -MCZ2EM!T\,AB=D!,,%;6ZOH8T)R4`CK..]V"9M(I=/"$[%KVELY$``=&_GS8[-DF!DA$%E+*XMVLZ)CWXLK*`?6>%BX4")27 -M$C$R&+:GNXT..CP?AH#<&5*TOK#F/"$[$+&_M?@7XHV`$#XG/>Z[I+#V-0II -MET,(,PV,I:6T&3L[#YZ.DA5O@[VRFC\F0DV -M!^/L!#8+DKBDLT0_)#;DBX/4%).QLHT#)R8QA+F\@FP=[(&4""4E`[:GNXP& -M,PA"D&`(-5BRI+R2,"<_:XBUD6[UB[**%CHA/_&_N+79!628G@4^)32"I*6W -M%S,Q$Y#A!PH3M*6Y@PLG.@""MH!`98:QM/0](3H=-"8G#K6EOX$>`WJ<^P@Y/&*\ -MI[Z:-#XT1(7G!`&4O;JQ>#@F/ZC@(X,A*%F&X&0+>XLI0R)CL;*DOI@V)#UKC(SE$?ZTO+1L.R$^5+V^BM\<\8&%!#@D-H&DI;=L,31K -MEE$/-QFTI+N/#R0[`8&UFV!^@K*VX#(A)1NQN[&6&6JRXSWG&/SB;&#`20F,)N[N(MG`!62E@8_.`.TI[J( -M!C\P%IZ5&0USMKJ\G3`F.Q^UL()=>H2WB6@Y(3Y3OJ6QYP('_IT5,#DU@*6D -MMFD\/P"0A7(!$(ZXOH,()R0.@KVTZV[IB(OY,R8E&K.DO)L!#FZ1PP@_,>RX -MI[WC,SLT_X"4'!F8O+F*&B0F,)*]L(1@=(:+G0LD)`N*I+B/'C4$YN@%,S-N -MLJ>YAS0E,FF`AW`9Y;:^MG,Y(3YVL[R)UQ27CX<$.RYMI0308>`8#TG/]JYI++H-3<9Z^4` -M-@^&NJ6V%S@E-9&*AG!KFK.RAPHF)S6/N+V'%Q&6@>4T)3L>LJ>^A@PS#,J6 -M%S4+[+^DLOL\)S)9M8CN:^.TLX\$)"$SDKFYB'D%1860`S@Z#K6GNHL%,C=N -MDO4`"V&QI;^:-BB;NXCPPD)`F!L(GZ8IVTM.TP)B4'L:6]FP0!79]4-#@S\KFGO94Q -M/@O_A<8&!YN_N[0=)28PE[.VGF#WC[28""=%@?ZL+BPVCXA/F2QLHU$89J*@`4Z)C*:@<$;9XNYLIPQ)B4&M;^T[Q3FC(UG/"8Y'O;R#"2P@W -M:K&DN88T)#D>C(J2:5V)LK=)/B$X;[*[M^8;9IB%$SPD,)FEI+%,,3$9E^,' -M-02)I;N(`"0E#H>W@U!@A;&VES$A)`"WNK*8&1GBA5@V)3Q8N:>\D#0]#_N= -M8@\#F+FEMA4[)S'HMK64;>RUMH<.)R8WC:6^C!<`9Y_N##D^&+"GN(,//S9F -MF^$$`OVSNK+F/"8^8[>PAG))@+>-&#HF/92[NK1;#1OMD!PR.0^(I*6U&SX] -M&IZ9;`!MM;N\A38F)0&+O8OE;)"*B7`\)CAOO*2SE@T,?Y!W-#\TFZ6DL'0\ -M.`GJ@>`8$H&_OH\-)RV]O8)]:9R/F`TE)S2,I+J*$3<,5Y<7-S`3L:2X -M@PLE/Q^`C.83U;6_L<\_(3L4L+FTY!+(@882/BU4#PA.A:]I;.6!@?PGV0V.#&2NJ2SV#,_#.F: -M=P`;@+FXB`$D)S2%LK26;>.(M98W)B0-MZ2_@1H/:I'Z#S\R<;^GOY\W.#=$ -MAI0'=1I6M[FPX#TA.Q"VOXOS%96/@Q`Y)CSONZ2Q]PH(899]-3(,C*6EM!XX -M.`V>C)<1;XV\LH4W)B0,B[FQDA9UAXW5,"#E`LE)0.VI[B,!C`.49%K-31%O:2_ -MG3`D/&Z)B)45\K6RM1&` -MN[NU!24D-)FQB^!MD;2VG30F)PZUI;^!'P%`F?\+.#QLO*>^FC4_-5:;R`8` -ME[RZL7PX)CW*L;::9]B,MX$#)"8QA[J[BVT,'927!SP^!K:GNHX#.3,0FIT6 -M`$&VN[*7,B8[';2RC]A@F;6,%SDF/_.YI;'Y#P-5D&\V/PB"I*2W$3X^`Y*& -MRP44C[Z\AC4F)`^/O+>7:_N,CLPS)CH]OHC6$^&#A00X)#:&I:6W;38U;99W"#88M*2[CP\E -M.`:!BYQI?(R]L>(R(24;L;BQE!]@FX9M,B0]Y+NDLN,W,07H[`4T`X"ZI;<< -M.B0UG;2"W&^9L;":-28G"XBZO880&>"'_S0E.1&]I[Z$"#T)Q9)A#@^5OZ6S -MW#XG,MRTM9%MY8JP@@$D)C.8N[B(9P9@GY8`/CL"M*>ZB08\,16?X@0/?;&E -MO)PP)C@0#&N.<%S,X-(&DI+9N/3P&D9EC`Q.) -MN+Z"""ULEXJU^S,F)1JSI+V8!@UDD](*/C#MN*>]XC`X-?B&XAL; -MFKRYM1LE)C&2LK":8%.#BIP+)R<+BJ2XC!\*&^SN!S(R:+*GN8QN;9W.2$^=K.\CUQIDHF&!#HG,)JEI;=Z-0]/EFDW,@>UI+J(`SH^!X2- -MXA)YB+^SES,A)02WOK?K$<6`@V,])S_PMY)BY8FWFP@G)S6.I;F,$PP4D>\"/SP3LZ>X@0LY,6"$EQP!Y;.[ -ML,,^)CYEL;.#2'B'M8,%.B8RG;JEMW<)!O*1$S`_`K6DI8H'.3P%FX=,!&>U -MN;V?,28E![6\M>!JZ8Z,9#PF.7^^I+*5#PAOEE@+/0J$I:2Q83\[")2-EA`6 -MAKR\@@XG)S6#OK"8:W.'C^`W)R4'L*>^A@`W!.#L!#`W^+ZDO>HS)3!8CX%- -M$Y2QO(H>)2$RE+^\C'\1E8*<#24D"HFDNHL<,0AWEFTU-A6PI+F&-"0^'XV( -MEQ75B[VW0#XA.&^RN+3D'G>$A!T_)#">I:2Q0S8V')?[`30$B:6ZBP`E)0^$ -MM(%U8(>PL98Q(20`M[JSF1X=E81`,24\0+ZGO)`T,@WDD!0(`INYI;9K.R*[F_JM+&'#BYGP`0S]LJ6RX#PF -M/V"TL81X7(VVC!@E(3V4N+JT10(3<^-YBEI+!(/3D/ZH;V!!R`OKZ/ -M#2<"/3#\D#$Z-EN#GQ48EK.Y -MM!$E)C+BO;*#?V.;B9L-)2\G0LQ!N/I&C<)GKBEL'LY)#;MM8W" -M%9.QLH,,)R8V@;B_@F@>YH;H"#H[!K&GN(T#,@M/DWH."\:]I+V7,B<\;8JT -MDFW*B+.($CHA/."^N+51!VV?G`4_.@J/I*6T$S(Q$I/L!0@4M*6^@34G.@:, -ML8-298>VM50\(3H1LJ6PEP<%YIE@,3LQDKJDL\4S/`+HF6$"&H.XN(L!)"-SDT4H3L&P>1O;NV;SLF -M,ONPL(=E0X"UA`(D)S:`I;N+:@@%XY0:,CP:L:>[C`\X,A.$A68$5;>XL^(] -M(3L0MKR)RFF0B8(3.28\[;NEL?<(#WR19S0]#XRDI;0?.#D"GX+L'&F,O[V% -M-R8D#(B^MI`4UH",U3,G.!>\I+R>#S0>Z.4#,#62NZ2S5#PE-^:.A&01GK.\ -MC`,G)C:$OKV!;!62@I0*)24"MZ>XC0V(>8!SDD-X*DI;05,#<5D=D--!VTI;B"""0[!H.TA61\ -M@K.W\CTA.A^PNK&7&Q>3A&PS)3+JNZ2S^38S!NB7'`L&@[NZM04E)#69MH[Y -M;9*WMI\T)B<.M:6\AAP$QYOS-3L_;KRGOIHU/PK2F5D#`I:\I;%P.28R];:W -MGF'WCK:``R0F,8>ZN(MB`A:1E`8_.0:WI[J.`SXP%YN6'0-!L;J]EC,F.!*T -MLXU79(6TCQ[I++\,CLTY(.1$!R;O;Z(!R0F -M,9F\LX1C?H>)D`HD)`ZTI+B,&C0&Y>L:,#!DO:>^FC^A`DR#\J0:PL)E;^EL\<_)S/9M(J5;N.U -2L(T&)"8PF;BYB6<' -MW=/6U-34U5175E=45%175E975=755%15U-;6U%145=;1UM?55%145%755=31 -MT]#6U-74U-?45%965U545E!04535U=75U-33TU=75=71T]'55U35U-?55514 -MU-?7U]37UM'0T]'45U175U!24E!6U=?55U=45=37UM;6T-#1U%175U74U555 -MU=37U%175-36T]+3U]34U%=245905-34U5=645=55575U-;2TM'45=76T='6 -MU575U=1555=75-34U5555=74U5145U74UM=44597U=37U575U];1UM?4U];6 -MUM=55515UM105E14551645%65-755555U]#0T=35U]'0U]555-77U-545%74 -MU]145U77T=;45U%15E75U5545-74U5175-77T=?5U=36UM355=74U]954=75 -M5=?7U-75U]'1U5=6459455165E=555545%35UM'0T-#0T-+3U]575U=65E!2 -M4U!75-755577UM#1U-74UM#0T=35U-;755904%?5U-'65E34U5545U34U]?5 -M5%915]74U-35U-?7U-75U-;3T]?55=74U]545U34T=;455=65%145%75U];6 -MU5=65]77T==5557555=14%%5UM#15%;6T=;6U]?7UM#3T=175E=5U-5745=5 -MU55645%5U-?45U%65E155%75U]#3T=35U-'3T=;6U];0T=1445%4U=355U96 -M5%555U975%77U-71T-37U5965E?5U-;7U-34U]?4U=37T=/0UM?5555555=1 -M45=75U914%;5T=#1U]74U]?55U=75=37U]74U-3455164534U]34U]?0T]/0 -MT5=6U%5645%4U=;1T=55U=3555=15E77UM575%55U=55U575U=34U575UM#0 -MT-;7U];1UM574%!145975%75U]35U-?7UM#1U%564%945U!=5=35UM?55=76 -MUM?6U]37UM'6U-74UM'1U5175%545%=14534U]?4U=77UM155U95U]=55U%7 -M5=74U%575=37U]145-37T='4U=77T='6UM%55='45E=75-37UM575E=45%90 -M4%%755565E?5UM#6UM'3W=_=UM75U-?7U5=75E1555165U=45%145U94U];7 -MU575U-;1UU75U-=55E%05]/2UM;45=77UM?55574UM955E%6U=?7U5=75=37 -MU%575-30T-#7U555U5545E!05%545E=5U-;6U]35U-'0T=?4U=34U5555=74 -MU-5745945%375%34U];6U-55U-;1UM575U155E-24E'5T=;4U=37T='6UM37 -MUM'0T=?5U=75U5175U=75U965U34U-145E%65U55U575UM'1UM155-?W-]4T=75U%37 -MU=155%75U]=555=75U35U=75U=75U=?7U5545E=5U574UM'0T-'6U%?6T];1 -MU-555%175U=45%175U965E%145%5U-?7T=;6UM'1U]34U-?7U]5455175U35 -MU-37U-5555145%545-34U-37UM?4U-?7U5545U97U%=4U57555=4U=34U]?4 -M5515U=?0T]/0UM;7UM;4U=555U145U=45U%145945%1555555=37T=;6T=;4 -MU-545U75U-?4U-34UM155=34U5135-14U];7UM?7U]1555915E%65E=4U=35 -MU];7U-34U=35U=755575U]36UM;4U574U%545%=75%=4U=?7U]35U=75U]?4 -MU5114%%65-54U-'5U-;4U-37U]34U]?7U]37U]555517U=37U-34U-345514 -M5%975U55U55455555575U-37UM;6T='7U];7U-155=75U5175U175U155=14 -M5M755-74U];6T=;6U]74U5545%175E94U=?4U5555=36UM?6T=;6U%555%91 -M45975%75U];1T='1U]755%=65E=5U-?455=5U-?6UM?55-;15=31U]545557 -M5E=75U155%74U]?7U]?7U-5555=45%Q>U]931UC;W]O:SLG`PMS;U%='349' -M6DY84U344]75TU34T%7=W-C2T]+=T-?55E)45%%<5-335=/4U]-55%76U=34 -M5%?65M56U%?74556U5?5UM)5UMU15=347E33T5U1T556U-/55=+45M3>U%'3 -MWU-2T534U-574M?45571TU;5T='45-355U574U=75%!15%544]575U?4U=;1 -MT-S?TM+?W]'1TM?74==65%;545%145935E#44%91U]=2UM?05-36U]!4T-36 -MUM;65-!25];1UM?0U=;7U%)3U%507E;1U%17W]-54%;0U-90U-W1U%W6UU53 -MU-!74U_04%5:W=Q45%;8U=)3U=;64E_4U-)5T=S?T%71T]1$<5'$U5G<]L/0 -MT<7$U%M>U55$0U_4U5]=UM_15E32W%9<5-%57U#0T-16UM/=UU#7T]964573 -MU%'5T]+6U]?55%=05-174-745U;4T='4T='4U-175U545]?75E=5UE=1U-'7 -M5=34U=565=#1U%76T-94U-'55E;5U-114-1545-05=15U=31UE34T-!55-?7 -M5U36T=;7U-;75=5745%65%=45-775]155U55U-74T-#6U-;1UM5455545]77 -M5=37UU74T=35U-545U9455=45534U-155E175E75U-?6U]#7U]=45%=6U=74 -MU]34UM;1U]70U%?455555E955U965]74U-34UM#75=74U51755175%94UU55 -M55155%77U];6U];1T=?7U]355=155%94U%75U=555%=75%=645!45594U='< -MTM?1UM34U=555=77UM?55=74U=75U5545-34U]15U5555%555%15U=35U=55 -MU%555%=45%74U]?4U-34U]?4U-?45%965U75U-?7U]74UU=05%155577UM'7 -MU=77UU565U=745=5U-74U-?4U=77T=;7U];6U57555165E=45=75U-555%?5 -MU555U-?7U-?7U]355=545U!15%15U=77TM/4U-54555555=75-75U-?6T=;6 -MU]155%75U55455545U=45=74U-34U%17U=37U]34U-34U-55U=75U-?4U554 -M55545U1555545U=75=175]?5U=?4U-37T='6UM?7U-?6UM;7U-34U%165E96 -M5U=455545U975%74UM;7U]?7U-37UM?55%=75U=75=37U-37U]?7UM#7U]55 -MU5145-#3U-;45U=14%%7U=36UM;6U-155%145=74U5545=7555145575U-75 -MU-?6T-#1UM?4U%555=75U-34U5114%!75=74U5555555U-37UM;65%;45534 -MU]?7U]?4U=75U=545E%75%555=75U=75U=35U=?1T-'6T=?7U-155%=14596 -M45%65U15U=36UM'6UM;6T=;7U%545%1555555%71UU34U%555%75U=755554 -M5%145U155=74U];7UM'1UM'1UM3555=14%!145=45%155%55U=?7T='7T=/3 -MTM;7U]375U!04U9145%15=74U%94UM74T='1T=;7U-355%=45=74U%575E=4 -M5%55U=34U];1UM?7U=545U=4U=34U]?7U]?7U]15555745!04%%65U145575 -MU-'0T-/3T-'0W-/5U]34U5165E945%175U35U-75U=34U]?555555%155515 -MU-37U]?7U-?7U5545575U575U-?4U51755755=74U575U=75U5555=36UM=6 -M5M35U-15U=545%35U=74U-55U554U=?6T-#1T=?4U575U5555U965U=75%55 -M5=77U]35U-7555555=155U34U]34U]36UM?45575U554U]+45U555=75U=35 -MU=555%15U=34U%555%175-77U-555574U]34U-?7U-?6UM?55-155U11U515 -M5%-75E555=;7UM?4U]34U-37U]?7U]?45E345=34U=355%=45U975U=45%14 -M5%35U=37U]?0T-#0T-'1UM;4U-75U51555145E965E=145=45%15U=37U-34 -MU]?6UM;4U-34U=555=70U%77U%545=355U=75%965%36T=?55]55U=37T-34 -M5=555=555%145=74U];1UM34U5555%14U=37U]355=7455145=34U%55U-34 -MU-36UU94UM34U5145%545E!15=;1UU14U=?4U-35U]=45E'5T=;4U-355%17 -MU=?4U537T];4U=36U5=65]34U=34U%=15U355514U-/155%35M?3TE55T]#5 -M5U76UE17U]W=UE%25M155U!7UM504U?6UM565M'7%)3T=_2WMG67T50TL#> -M74)`4-7T]755-5?6%Q7VMK704?1Q,#065M5U=44%%0U535TM#>V]%=15Y0T\;?4EU05-[=T=W> -MTT9&75;8W=W0U-!'6%94Q5=07UW>4M/ -MU=901%7.]]Y&3414Q%=:0=;TQ-=%6,?;P]5T=5G$V-[$W-]73$-7V][VV]5"6]39PU9&0M7V]=A6 -M4]!6UE5%T]S75%]665?<4E)255=7T=?>P-A83T7;]/791T!65===15S=S\!5 -M649:4]C.P=Q?=79)TO3WPEU"6]#%S-O46W1,6E+5T<#1U-G`R-M?=W96UK6V<=22W9W6M#/V%Y.0\?Q -M_O?37433Q\GTWEYP2]/U_<9?2$!65E9-=DM6Q<3+S%)!0%-<75-*2T%34UI2 -M57A^O536\WF[^;EZ9R$FNIF&`4<;4A&9A06%&)E=DAU -M='1T>VQK;4'@EI;@57]RP.#IXO[WPLSUB'P89>O?M -M5V$3%G91VF=O>^6>GY1(%A%LR^/JX\G;Q.7BX_K51-V1B;>+Z!H/#A+8[%$3 -M&P86V^J44V`?$V)X2&Q@>_64E>)$>G'?[>GN^,#_Z9V>D^S47\+_Y=I+;&EE -M0\-2?A43%V#3UV46$FA#Y?E7>'W;Y>S@Y?#]Y^WI[.?+T]_SX^GHYL-.?WYF -M;&H5:6!Z96%C8V1S0D!W?F5PW.3O[.'\^.^?@(Z/A=H>``823_SU<6H4:73^ -MZ^]W$@<''VY?VL/'P\;%RL#/R,OV^.B>C;2W@OX;#`(<=L5U:!$4=OOCX.#^ -M9QH-#P`6_Y*(D1``!A3R[]06&!)S[Y'@<6EH9F04&@88 -M;DL06'&CWDYF=ZI69@(V$\1(''F?S_W<7$F_$Z>O*8!$3$!86%A1GQ.#M -M^5QE?][OG9B:A82$G.5@$Q)N6L]5>FAH>M?WR%=G%A\9'1=@=EW']_SVQM71 -MYY"$@(.'D\AB%Q5XT,E3>V)@<5??7TM[;Q$?&!\4>]'(S\':P,OX[I">A8>$ -MG^UU%19M0\[U7F5C>DA:0W9[9F\6'1P0;$[.]\!214S'[I^$AX>%DNS6815I -M>D;66WQE?4]-=GAD8&-K$!P3:4CRY/_'7T-1YY&8A(2$GI?W9A<78T#!VDID -M97%.=WMA8V-K$!P3:4OT_OSWP];7^Y>9A82$F9;\>Q448T_2U7!D>W5`<6=C -M8&-I$!X>%WS*Y?GQS\S.Y92?FH6%A9SL1&L6:GS7W$QE>DI!<6%N;V!B%QP> -M$&!5\?'Q\?[]\N>4GX6'AX61\&<7%VUV149P<$]+>6)N8WYR;!,9'!5VQ,W` -M]_CG_,CRZY^$@8:$D?1@$1`594Y91UI50V5N:FQX=F`6'A\4?=C(\/[DYO/; -MP^*2A8:&AIGB?Q$?$V]S0$-!T]9];!5K9TQ]:Q(=%V12W<3SX>SZT$+)Z9R$ -MAH&!FN%O&1H2;7!*=5?USGT5$11D075O$1`5>EK5W/COZ^%4>4+DEYR%@8V- -MGD,9!QH68F9[4^7DT&@3%&=9U7L1$A5G=$15]^SKYU5R=,/LE>N5FXR(@/X0 -M&AP6%AT62.+NVF(7;W=T9V-M:FIH;GG+XNSBYGAP?6-E17P4'19Z]>?R\N#B\T)F>]SZY.3BE(6*M(99%AT> -M!08&%N>7^DER6EYR9G%?9143$6-9V_'BZN#79FU(V,_/_^R7D9V,MX_E:A,9 -M!P`#'O.0[--3Q])E%&E8Q603$FES0ESYE93X?&UPWE9+U>&7ENB4@K&(_6II -M%@<,#!GZD/Q!\>#<:1-JQ?-Z$Q)I9V%R^)"1Y%AE9V%G=_/JEY64EY"#MH[# -M87P0`@X#'\;OVL#I[603%&!#6'!*:8W+>$@\/&FY4=F'YD?\7%G%/9&E[_/YP;W_#W4U=X)7Y>6125'MEQNN7 -MXOGB[/73_3O\65\__]S9DSU -MQG-XV>'ESO+AY\Q4UME6?%B$MXU9X9I=#`\9&P4?:O"4XW?/E]X7:D%U:FEW -M^N//R)6=XGET]UQH:$W<1T3P[^WPQ__GTWAUTE)*7\?9XX*UDD:3EQX)!!(! -M!Q!Y\>'YS)7N9&E)UVD7?M+,VO[JEI;K[.39=&9O;F9"W/'[Y.3_S%=26'5* -M1UI%7U70WL#=6D;5D(R99@`2>0<&%GQD93FY?3\^,5P?]PMC/6'!7S,3?_>?\\?'QSL?<15I&7D]? -MW\31TLS)U4!4WU!%V/'-TM[84TYV?W;RD9?[ZI#]9'YS$!\7%18494G4]?7Y -MX.'X_OO`U,'(TM3)R]C9P\%47=?:UEA65DUP=$YW=$115M#`Q\'`S,_`P-W4 -MT=#05-+9V=;4V]!:2DAT?GAU]^OM_Y26RW'31Q$1;FH6:GM]6MKVYN/@Y^+F -MPMS`W$M/559<5\#/P=K'R<744EQ;2G%W2G-R15!;7,7,Q,#(R,;:QL+:UMG8 -MU5+6WM;7T]U41T-#=WA\7LSEX^?LZ?U6559B:&!L%6ID>F%?\\;A[_7M\?C9 -M\/=!_%E9371-T778\\+`S,76WM-#T'1^=')]==77PO?`PL;&QMS;P-Y0U5=; -M65=4T]C5T-C67%]26D)(275T4O3E_O[CY\K=QE]D965A;69\?$I65A$ -M0%Y=4E36U]34U-=44%!45EE355-:6%]>5MS.\/?S_O+#T-)%<7!V6D5:15A=4E;7W]G>V=S8V=O"P,3$QL?:VMO>T557 -M75A>75U?75-27UU375)65%905]574%!04%945536TM#3W]_2T=;45535U=36 -MUM'0T]'4U5=75U1555755534UE=4U%165U=75%75U-75U]145U=75%75U-34 -MU]'6U%575U?4T-#1T-+=T]'7U-155-77U]35U=3555=75U9645-=7U)145%7 -M5=77T='1T]/4UM/0T=?4UM?4U]'0UM;7U%114U-15%545=3555155%15U555 -MU554U-;7U-;1T]#655!?65E>7%!4U-'3TMW?W][?TM#6U515U-34U-54UM!7 -M45=65U=645%15U%34%%65=34U];1UM;1T='6U]34U-;755?5U]75U-?4U=55 -M5%75U575U-355%165U55U=75U-;1UM?7U5%34%!15U574=?1T=/1T=#6U]15 -M5%15U5545%=75%74T=/0U]34U5574U)05U545U35U]'6U]?7U]#0UE515E97 -M5%14U=74U-74U-34U-145U=4U5555=;=UM3555545=?755155%76T=34U]?4 -M559275U34535U=70T-#0T=?4UM/3T=;7U5145U9145!15U755575U=755596 -M5-77T]/1U-;1UM#25%U755;5U];45=555%555-77U]155514U=;7UM'75%75 -MU-155%9755145%=5U-?6T='1UM155U1455165E15U=/045?7U515U5155-71 -MT=;1UU?5T='65%94U=345%%65E35U-15U555T-_=T]'5U=37U5175E975%14 -M5U%05U15U-55U-'1T-#1U%55U];7U5935M?3T-575M74U]?4UU17UM565U75 -MU515U]5455965%=04%74U]#2UM?0TM#0U]35U-;45%=55U5545955U;55%34 -MUU175=?3T-175]31T=;7U5=45%1445%65%=5T]-5U=;6T-'6U]75UM?45514 -M5-74U]75U=5455555U%65%14U-35U=34UM?7U%=65U75U];4U-'1T]S=T-=5 -M5E%34E-65]77U-555=;0T=9675=45E155=?0T-;6U5145%545=755U155555 -M5U?4T-/=T]34UM#3T];55%155E%045!65-37U5905E?5U]155-76T-#65574 -MUM?7U5575=#15-155%75U-;6U-755U%045175U975=?1T=?6T='1T]#55U97 -M5%555%77U];6U%514E-755175%555=36UM;6UM?0TM+0UM;7U];1U%=64%#5 -M5%=74%%65=155U?5UM'0UM35U%7555=45%=75=36T=?5U=31T-'7U%555U74 -MU577U%755=555%=455164575UM/1UM;75%94U-=55=70UE!15E%65U%7U=37 -MU]34T=W=T]'6UM'0T=34U5545U575E9755545%1555545U=65E=75=155U=7 -MU-;0T=;1T]#1T=;6U]74T='7U%54U%55UU905E?4T5565E%7U5565E!15-36 -MT=?7U]?6U-555-755=74U-34U-34U=34U]=55=;0T-#755=7U]#655=5U-'7 -M5E)24%=5U%1375)7T]/55%=75=?6U]34U]/=TMW2UM34U-;75U;5UM'55%55 -M5U=45-755E)05=;1U%=65=3555=35E7555=75-74U=36T=?6T-'1UM74U];1 -MTM-54U74U-'45%155575U=555E=45%164%975%155-76T=?5U=54U554U=15 -MU=75T=;7T=/2T];7T-+3T-;45=74U5=14%96459645907%]<5M#65-76T=/6 -MU-?4U-;6U];75574UM'0TM955=77U]574577T-;5U=74U%555U%0459645%7 -M5%175E175U74U-55U-;0T=?6T]W=T-145=?65=775555U];6T-;7UM+3UE=2 -M4E%75U937UU24%934U%75-77U]?7UM'6T=#3T]/3T]#2T=75U];1U]?6U]34 -M55545U=645!35E555E)24E'4U5;5U5%05-76UU75T=/0U]75U]30W=#55=36 -MT]W2TM#0TMS=UU9=75-145-24E-15E=55517U-#1UM114E-15=;5U555U-34 -MUM#2T='3T]?7T-;1TM#0T-;4553555555%555%975E%27%U345965E=55U97 -M5=355%74T-+3T-'1T=;0T-;5U]#2W-+0U]??T-W2UE524EU14%)?65E255%2 -M45)15U945-76UM#3T]/1UM;1UM?5U-;1T=?7UM;0T-#1UM;7U]155%=4U5=0 -M4U-6U=3555%15E555U975%=65E%65=7555555=77T-!5U=+3W=G>W]_>W]W3 -MUM;1T-=44%-24E)?6%M97%)34U)<75;5T=;4UM/=W-+2TM#1UM'6UM;7U]'3 -MUM75U=55U=?455=4U];755904%-05-955]155E%045=75U555%=45-76UM?4 -MU]#3TM#6U-74UM'1UM?7U-;0T=35U-?7U%175E965E!04%%14%!14U!65E91 -M5E145-31T-#3W=_?T-+W]/7U];1T='45535U-145-77U=75 -M5U7155914U-04U)34U!65%545U?5U-'0T=;7UM'0T-/0UM'0T-#6U5=65-31 -MT=?55575U-155=545=755U%27U]=5E164%95U]/0U%55U]#2T%=4U]31T];4 -M5534T-/2T-?4U];6T=?55%75U5165E=65E-=4E)05U75U=75U-75U=37U];6 -MU%74U-?7U];6T=+2T-;45515U=?6U]?7U535T5=24U)15E%145975U=45516 -M5E?5UM'3T-#2T]#6U-?4U-;1T-'6U-74UM355%934%=75U14U=37U]34U517 -M5E975U=75E!15E35U]?7UM=4U-'5U-?1T]+3T='0W=W3U]575U155U975E96 -M5E=75U=65E95U=75U-34U]34U];7U-3555545%55U575U=74U=75U-37U];6 -MUM34U-15UM+6U-?755!14U%15E=14%!65E34U-35U-'0T-?4U=74U-?7UM?4 -MU]?6T-'1UM;75%1455175%?5U=545U%145914%-65]74U];6T=/0T-#75M70 -MU]'1U%5645-65%=75%355-'35-76UE55UE745=%45]90U-55U]715]76U-75 -MUE515U=745%74U!7U-16U];7T]W?T-#1T='4U-355-;?U%974%-=45=64%97 -M5U77UM?7T='7U=745%345=145%75U]?6UU55U]'7U];6UM?7U5145U=55%=7 -M5%15U-74U=?7U]55U-35T=155%154%U05U!65%74U]?6UM?6UM?4U]'0T-#2 -MUU7755=15]75U=5555=15%114%945=36UM?555545%=4U=37U]?5U=?6UM?5 -MU=755=74U-34U=?1T514U5=75%155=37U-545U15U-?4U55555545U=65U35 -MU=75U=?1T]?1T-?45-?7U];5U]34U515U%=55U155%17U=35U-555%175-77 -MU]56U-'4U]?4U]15U=75U=34U5145%75U5175U14U=36U-34U]?6UM;4U-?6 -MUM155E%145%14%94U=34U-34U]?7U-?6T-#3T]/1UM555%=65=115U165U17 -M5U=75E%15E=4U-37UM;6U];6T=/3T]#6U]3555=65%15U=5455555%175-74 -MU-155%14U=37U]?6T='1U%575E965E=45=544=745-75U-;4U-?6T=;1U]55 -MU55555145%55U=34U]34U-75U=34U-3555175E=645%15U75U-?6U]37U];6 -MU]37UM;6U]?4U=575U=45]30U-37U=34U]G:U%%44%IW?7%'Q_?VR=G?TM5; -M3D92P_WPPM5'1EM15%#5VF1[=%#"]_+\\<-71TY,4M#%QMO245U> -M7=?>P<;>44-"0DU%7=?9P,_#V-134\+E^]AR8F]F0MG#S-O>Q4-544U+9]_//77U_\IB`FN!@&!H6?$YS2ES'Y.#5;Q5NV!G6?[@X_K/W\G_]%=*?WY*QI6`B(;S$P,, -M!6?724;#P_'D1!83;E'NDI?5;A<53X4ED>TM<6$M2Y)21ZOU&==+\_\U9=')^696#B8'A$P`,`1X7;W7XZ.[Q -M9Q1K0>^1ZTP3&AUD^>N5[^#\UWMM85;BE.KF\,C!W,[@[,UD%6AVE8*(AO`3 -M!P?B -MY/"5@K6!104`!1=L'0005^+\9Q$66>CK]'IO:6EI:V?VEY/IV&9B<]SP^.'H -ME.O\6U'_XN3?RIJTM98=``06:!T!&EGJY6D=%%"5[5]E<$!M'QH1])"3X5Q8 -MV=)Q9TWAD9'BP]#YE93F[HVQCT\:!!P3'P8`8)7B91)N6/'V>G[,RF8:!193 -MX_O,\N#@6V]M4^#A__WFEY"5XI&(L(-[%V]I&@,#!$GG<6USY/!R9V7WY6<< -M'A5@;61F4GHRQBN[$YD\'"0,%$&T48_F1YF5?^OQ` -M:A,0%A,39?7S]O_D_%MD)X%!(%!QX6:GS>]_[[\O[F^/#AE)*&BHV8@X'+$141#PD&!`42?O?LE)6< -MGN5C:6\%`!\4%A52Y/WXX.CO_N25EIR"C9J'@9=\9V<%`P0:!1D7>]+G[Y.2 -MXL!R;1X$'A(2%F?54=O^X^SAZ9:0G(",A(2!G=Q]?QX`!P4%&A-F4?_CD)WL -MYMYK$!\%!1(6%G[36?7LZ>#HD9&>@H^'AX.?SG)D'@`!!P<%'6)8]."3GI;B -M0GAO&@42$!X74G=YRN;_\NN7EYF-B(.!@H7_9&8?#0T!!P<9;5+V[9R;D?O. -M1!`$'Q,9'&!)?T;]Y_'SZ)3KDHV(@8&,A_Q_=1T-#0$&`1IK3,GBG9J2\LW` -M%@G._F]F(2 -M$AP9$A5O94E2].;AXY67EY^/M8:'CH1T;4$9"PP$`0,89,OCE).1[=%Z;Q`8 -M'A84%&-;6$7^Z.WAE)"0@;2/F(Z,^!58:0@)!P8-!V_2YNB7D)7?9F,4&P41 -M%11I3=]=]^B7[>Z3GX>UB(6"C^EK=V0,"P$͗^'L[I&43&MF:QL;:FD4 -M;D[06L/BE^GHDYB"M(^%CHWW%D85"`@&!P($8/GOX.J0X6!J;!`:'VYL;&!% -MT5["X^OMZY":B+>!AHJ!?!33&0H)!@8#&W_KE?WHDLP1%&P2!1!F9&!FV/3> -MS.SKX.V7A;6TA8"UA6MJTP0U#P<'!AY+E^KU[9!1$A%N$1@09$9E8]#YR]KF -MZNSDXIJTMYB`M(=K$=0%"@@!!00:9)"3T^>=\!`2%10>'VO216Q-Y^3:^.GK -MX/[C@;:.D8FUEQ]H>@,*#@88&A]5F9''X9?#%QX7:1(9:,M);77EYOSE[93O -M\_N;M[60@+6$%QYC!`X(#1L=$F*6F^'#Y^%Q$AP5:!$0?E!`?$K\[./^XY7L -M__^;M[2UGIF'GVX$!@(!``P`%,;([)25Z.S88FH5$Q,4;F%VU-W`_>3@XN#C -MX^'DY9:.M("0DY_P$P0-`AH;`09B_^N4Y\KFE<47'1(58FX48L#D_<3:Y)20 -MZ?KG[>_F_9:"CYC@Y^=`81$!`1\7'AL69O7L\')+_?HXT9X9EK&5-[UQLG[_A00%6L4;&,5:W!/?$/> -MV?'YR537VE!'1T-%W\WW_N'AYN7Z__;!P?N4E>7OD)7ZX/)E9W@4'1$4'1,5 -M:VMA>'ETU=_"]_7+]_/V]O7)PL'V5__?E -M1F%P>A<1:A$2%Q47:'Q]?=/X^/CY\O3\]M)=W,3;V,+"]?_E_OW__/WSR][? -MW%QT==/AYL_EE>__^O1Q?7%B%Q45$!85%!5A>W]&Q,K]YN'EY>3^\?'VS,W/ -MQ=75U]32R?7)R?3.P<316UE92G9#Q.7[]>3J[N?D\%)97'MN;FX5%!06%FIO -M;65$QO/ZX>+L[^SF^N7XR-_=U5?255M7V]_?PLW$PL[%W--475A,=W9'R_+= -MQ^'M^__R5T%7=VUO;6@5:&H5;F=[?47;]OCAXNWMZ>GCX>#E]_7'64983'1! -M6D!945A>5%A,0D]V<71W=G5,05#WX>?YXI7IX>'_TM+2<&!A9F]I;FL5;V%G -M?D/1SOSEY.3@[>'XY>?^] -MU_#CX^3ME)7LX^7!W=1R;6]O:A05%!1I8&=E<5G2P+G^/SW -MQ-Q565Y64EM%1DAU2G9S<4I)3T!%6%)455=4QOOAY_GFZ.GBX?S=U%%\;VH5 -M%!5K:FMB?DM8W<[Q^.?D^/_EYN3RS,7&P-O54M##P][1T=#35TQS?7!R?WE^ -M<4975E+1QLS.\.V0DI?IZ.[DVWUO%6L4$AT0%6QF>W;=^.3\\_GE^_#85][+ -MSM[3S/+_\<_)\/+UT%Y86TQS>'AS2TMW=5K5T%10W\_#Q=O$P\/%VN27ENGC -MX^;W4&<5%146'1(7:6=]=%_VX>'X_?GE^_#$WLGP]-[0PO?TQ]S;S,S11T]! -M079X>W-.04!&4-G-P,3-]/?*S<7;Q-A76MSFZ._@YN;ZPW5M:A44$!T3%V]G -M>'7%Y.WBX^+O[^#Y]O'(U5I!0%I75U/8]/7$V=_44D%Q?'%U<7-+6=3=VL#+ -M\_#/V,;+P]/7T-/14$!8]^?[\O+\]L5:9&-@8FL4:F]@>'-"W?'ZY>3FX>?Y -M\,K#WE5<7]72W=W;S,KURL_'W59'2G9V=W=U24!2U]S:PPV-G9WM=7T='44EQ75]70 -M5E%5U=345E9545)14=71TU155E':W%U65-;1U5)=5530W-[1U-W9U%#4UUU6 -MT-!74E-65E!55E-3U=?4T=W1UM'25-?3T=-5U-35U%155U%34=?5U%-3U=;3 -MUE77U-/55=-45U]1UE-25=W4T=_4M'6 -MT=9'7-_8U]=04M+=T%%3U=W!U%W35%955U10U5E8UM#04]345=[7T]G5T%+7 -MWM?7559:6-_`7$Q=T]91U-=61-7'T-;45=35VT53?T]175M[:5%#0551165[7UU%65-32 -MTUM$T<566]/2T\/94E;465_:WE1;4]!0WM98T-!0U-75T=72WU?7U]?115Y7 -M7M345]=3T=W2T%-=4M#?T-_445-7T=+8TU?145M75=S16=11153?5%/6U,3# -MUU_4T-76U==;6=)0TQ=K2T]K+\/_EY.3FX./@Y??30W)E86QK%!<4 -M:&!^=4=0TL_]Y>3X]L166%A80$I*3D;1\^#NZY>2F9F2E>#P4'AL%!(8!`0; -M'!`4;7?)XY20D)>5Z>SDP'-B:Q05;V!D>W'1YY23GX6'AX6A0=&P4DI^?G)V0ZO]`86L6$Q(2$Q1GT.3ID9B`C8*'F)V7^W`7&P$` -M``$``000>]O@D)B:A86;D^SP6F(1'QD;&QX68%C[E)Z&C8^"AH2:EL%O$AH& -M`PT,`@8>%&-6ZIB%A86%F)/OQF5J$1P%!!D18G+2XI^!C8.&@(.$ZM1Y:1X! -M#0P-`P$$'F_TZ9>=A(:%GY*6Y4QC%Q(<'QP1;7;%[9B&A(6`@X64X^5\$A@% -M`0,#``89%6=UY).=D)V;G^OG_4=A;&AH;V-X6>&0E92%A)^5EY'Q86)I'1H% -M!1H9$A9M0=+)X)24[N_KYM)>7$QW=TE6RNSKX):>D>CKE^1*<'(5$A,2'Q\3 -M%A5D?'3TY/CG[^W\R//&0E#905SPY.WB[Y"1E.OJZ_-90'QJ$1`3'1\=$6II -M84S=Q?#FYN7ZY__(_/[/R/GEXN/FE97OXNSLS5)1=6]K:A<1$Q`6%!5O97!T -M5??USOCF^?KCYOOA[^F5[>^6Z.?GX_)-7D5E:VEK%A86%Q05:V)[>7!3WU#% -M_?#UY.#DX.[KE);HEY/NXNSLPD'7?&QJ:!<0$1$4%!5N9F1[3E)<4\OWS_'F -MYN3C[.B4E.F6D>WNZ>/:W]EX8VEN%Q$6%A<6%6]C8WM#1UC<]LOU^^'DYNSO -MZ)24[I>7X._BY=G5T65F;6P5%Q44%11H;&U@>W9T0U?8Q<[PY>7G[._HE):5 -ME9'IX^+F\%]7<&%M:VH6%Q45%6YF9F5R34]'5M30TL3U\_+[YN/LZI3HE9#J -M[.[B_U?=26!L:&H1$107%&EA9F5T4E+7QL_'Q,/.],OT_/CEX>GIXI66[.WN -MXO;7S$YA;6QK$!85%!=I9V%F3M985/3PPGFX^+D -MW=_&;YY>#G_/'X -M\-!36$)^9V9C;V]M;&UC869[<$A'4]G-]?']_OO[^/CY_/'TRL[)]?3+R_7T -MRLG.Q])57$%T<'Q[961E>GY]<'=(0UA05=74T=+7IE965Z>'Y\7ER=DA`7E30WMK$QL'& -MQ\3%V][>V=C8VL;`P,'!QL7:V]G8VL;'Q,'"S14-(='=V=G%P<79T=$I,15Q6T-[:P,_+]?7T]/3UR\_#P<78WMW2T]'7 -M55%04EQ>7%Q<5E935-37UM'2W-G9W-!545U>6$=#3TE+2G5*2$]"1%]05-'< -MVL#.R\K*R\O(R<_#P<3;WMW0U%175E=14%)<7U]=4E)=7%)04U%64%-65=35 -MU-+0U];45%9375]97EE86UM86%]35]?2W]O'P\S.R<[,S<+!VM[055)?645& -M049%6UE<75)24E)24U%7U=#2W=S?W]_9V\7'P<#!Q\38W=_14%U:0$)-3DM+ -M2$E/0T=:7EU35-?3W]G%QL'-SLG/S,+#QL3:V-[=T-155U!<6$5'04--0D9: -M7E)245=5UM/=V,7%Q,3%Q=C8Q,[97=S+W'!TUG]:14I3Q,7"S/'^_//^Y?3"]L!0U,-1=%92<79% -M37Q)67584EU44551P=)5PMG;Q<_?R]41%261A;6$5:V-H;V!X?'/4T\#T_N?YX>#GY?[E]<;` -MWU1&4$]"\/%R^^E^Y/K8Q$/*97!C86038VT7;VU^8G;45/WT[^[CEY24Z)65 -MX>WD]L#03WYE8FUN:FYI;FUA9WY/1]+(\/KDX.#CX.;D__/(V55?1TU`3'9V -M05W`W]+FR<7ZSL!5WEM]?6=E;VQ@:&Q@>W]Q5-_U\^3CX._IZ>_L[.'G__3, -M7TQU>F9A8FYL;6U@9W]T0=+.]__DY^;AYN3[__?'W-1>24U,=TM+=7=)0%C/ -MPM/_^LWR^/;-Q-M32W)]9VQ@8VQB9WAY=%W=PO/DY^'M[>+@X^/F^OCST-19 -M?'IF8VQL8F-@9WQW0M/#]_[DYN;FY_OR]LC8TU!#271T='5U0D%/7T5$P??( -M]^3X]OC\]<;6575\>&1B;&)L;&!D?W%9V\K]Y./C[.[L[>/AYOGT]])!2WYE -M8V!C8F-@965P1E+=POW\^^3E^OC\]/3"T]=<7$))2'5`24%'7U!=U5/5W\?V -MS/;D\_SEP\S,1W5W9&)@;VAO;F-E?T+1P_/FX.+N[^[O[>#AY/3+T$9T>&5@ -M8V-C8&%X?W9!4=S'\?WY^_KZ\O'TS=95T4='045;1%Y2T-;2V=#6U%!=T-C' -MP\OU]\O,R=9307=Y9&%B8F)C9GIQ0=?`\N7FX^WL[.W@Y^3\R,!73W1Y9&9A -M8V%E>G-(1%#2QLCV\?#P\?'+P-K<5=374E'1UU32Q=;6T-107U]!3T]GOX^;Z]LW60W5R>F=F9F%D -M>W)U6M/:S&!M:!07%6EL9TK0]^7MZY65ZNOLY//#4$IR?G]Q=G)"5U-9T,75U=9164-T -M=4UW=D114=?%]?+R\?[[]\GVQU974TQ)3$M,1TU.6%7WY^3EX>#RQ59T9&QJ -M%144%6UEOK[N#E\\561DA.2G5/6U]:4%=645%37UE`34U,3D): -M4M;?QLG*]/;P],G,P=C155%?6D!&1D9%65Q?6UA2ULK\_?_X^?794DES9&!B -M8V)C9WYU6-_VY>;FX>#A^_#+QM-=1UM:0DU!6UA?7E/75U]=5UY;6UA97E]< -MU=S8P<[+]?3+P\7>TU=745]>4E)%15U17%E96$5!05'"]_3R^_GWPM]30'!E -M9&5F861_=D)6Q/;Y^_ODY/C_\L[25UMU=W1V=$9:6%?0T-+:V]O'VM_?TE%9 -M7%!6U='2V,3$V-K>T=14745`3DU#04=5E?7UE=;7M=65UY<5-'1 -MW=O>W-#6%=?4U514-5>U%W75]?<5-Q1 -MTU)=45-44%77W-S1T-CW=955M%75==5 -M4]105E)14E-64=31U-71T%35U%36U-'5U-75U5=4U515UM97U5=2U%575=%5 -M5='55-#4U]56U-91UMQ1T]M5T=Q?5=%=U]U<5]]35--25==35]9=5M=;4E1? -M7%=:7]9?5=!0U-/6T]O3V-[3Q]+;A^_CE]\S;.TMO!4';7T'1V15M_7U. -M<7MT1DIT1=)64<+WR\C^^O/P^?_.Q\[]Y<3"[O]V=D>7QS3%?4W']V6-57V/;_^?[X^/S^__'T]_3.PL/>U]=714U"0DY/3G1T -M2DAU=4E"1EM94M33V=4Q*>F9Z -M?V5E?GY\25Q>4\?W\_+]__S]_/#T]/;TS,+`W%507D=-275W=W=Q<'%V=$]% -M7%3=QV-C9&9C9F1E?4)?4]CW -M\OW_^/C^^/GS]O/S],G"Q-+74UI!0TU(=4AU=W=W=W9T2TE`6%/4W,?.R,KT -M]O;W]_7.PLC_^,+&__C-U=]:<'1R86Q@9V!A9&1[=UA96<;S_?GZY?KZY?CR -M\_#TR,#;T59<1T))='=W=W=V=G%Q=W5/1%]7T-O"R/7W]O#P\??U]OCG_&1B:6YM -M;6UA9V5R0UQ6W/3]_.7AX>;FYN7Z^/#T],?74UM-=G!R>'EY>WAY?7!U041< -MU]S`R?3V]OWS]/?W_^B0Z/[F[.1:>V$5:6@0'19@9F-]1]K_^O+/_.?QW];2 -MQ\W*Q79%5-/>P_?W]?7U]RWYV6]7=PO;P\/WR]_3*Q=[8W-??QMK;PL/;V=W1 -M4U]464I'7TI`7%M55]3?T-]7T<#3U]C&W5/15G4UE%5PLU4T/7/T-W-RE7"_UY0^-MRR?%R=_Q79\7/=D[UP';7 -MR-35UUG2W$U,7G0WC;YG1D -M\/U.=,+R>G3CU&G0E6=IY_%S?OC*8,'G7&'RX'])\_YY=N]!;^'Y;%GB0&;' -M_$AVS\!*3?;6=UO\TW/#SEO_G=(W=5364!=) -M>/C<2-#']/ -M>?M_\'WWSV?]_6#V]$G!2/_;9?3]>5?T0\U)7?=*UL1VU?!\05>5?*T?%BZ-T7Z/-HP_E!3$KE -M1&>78'CI56=\[E%H_N!@4N9*>^;:9E_B=F#C7$M8Y%IDX=U^_-A;3?O38^;6 -M?<3,3$;"P'94]'G`P7WU47S\WW17V\EVT>1Y1>1#0LC?=M#]3G/*R4I#^G=5 -M\'/V05?;55E2S'3347E;T35S%Q$-?]%]:V]== -MQ-%`Q==/PE!$UU790M'V?]'_3W[P]W)0\M!]P_5*7-;*0$3&U5%TM-?W\=%QU=?W]5#TL=)4,5"6<]50-M6W=A#W,-& -M5\975]Q3V,%.4_=`3<-57E_;5T/6QUE%]U=.\-)/P-E.WM]#W5)'QU-:V-%? -MU-Y5]#775-555?3T]'6 -MV-+6U]_77-#3UE95TE;555154E914E-75596UM56UU575%97U]565=55U=/7 -M5M'8TM#=UM#6U-/5UM;1T%73UM'1U]#6UU145%Q<4EE96UA?7UU<4E)245%6 -M5U57U]#4T-;5TMW1W]GSDX>7YP-W8371W=G9P6EM=WGD\E-P411J:A`6'6IJ%69^4D;"X?KA[.CCY.'Q -MWEU%=V1]?7EP0U75PO#V\/+\]/7P_N+D^I?A_>_[]TM!=!1I%!80$VX5:61Q -M7D;QY?C@[>GG^^?)UUI`<&5V<7!,5=C?]/+V\/W]R/YTD5- -M9&IK%!$1%VAH;7EW1M7P^?OCXN+F^_C$T%)(=GUT=G1>5M[!]/;U\_;US<'W -M_^3GX^[AY.W^W5UW96MK%1$6%VMK;7YQ1-#Q__KCX^+G^_W:U$1U<'-T=$)< -MU\3"]O'V\?7*P,+S^^3C[>W@Y^/(T$%[811K%A`7%VEH87)TU,'\_N?BX^/E -M^_33T4)T3C[^#HY^?G551E -M96X6:Q,7%FIL;W9Q5-GWY/[FX>#R]/Q03T%(>WU9=$+$S,'W^?;T_/'P^N3B -MZ>'H[O_GR]E^9F<6%187%A=B:65^1=+?Y>7GYN/[SO+93$E"?'A`3DO6S,#U -M^?_P__OEY.*5XNV5Y/CQWG5B9147%Q85%F)B9').Q-S]^.7Z_N7/WM!9<'U* -M?WQ)7U+8\/?SY?KZX>/CZ)7MZ^C\_\->9V-B%A06%!1K9F%P2M#!S/____/\ -MR-_0175R=G-Q2T94W\_U\/+YY>;B[>J4[^CH^/+`7&=M8Q<4%VL5:&1D=TO< -MRGY]V=B;VQL;&)A9WIW15;8S\_U],/?W==24E): -M6UU?7=3=Q/7R^.;M[N[L[.#Z]-Q!?65F8FQL;6)@9'IR35+2P_L[>+F_\G00WUE86UL;&QM861Y=%C5V,W+RLO" -MV]-77%A:6EE=4U33V\SV_?KFX^+CX>;E\,#40G-[9V)M8V-@9'M]3U[5WL;- -MS,'?T]=07EA'1UE25-+!R_#^Y>;B[>/FY_KPQE1-WQT1E+3 -MQ,W)SL?9W-=175A'65-3U=K+\/_EX.+M[>'GY?;94TE\96=C8F-@86=X?758 -M5=/>P#CX>3E_<%71W9Y9&9C8V!@9F5^ -M<$Y=T=_:P,#%V=+45U!24%77TL?(]OS[Y^'@X.;E^/'%5D9V?F5F86%F9V1E -M?G1`7E37W-K8W-W755574571T]K)]_/XY.?GYN?[__#-T5U-<']X9&=D965X -M?'!U1EU34-;2T='155=745'7T]K(]O+YY.;FY^?E_/#)T5A-F1D>GE] -M=G1)05]4U=33W-'1UU-=4U-1U]_"]_+YY>7DY/C_\7M[?GUS -M=W5)34186%E>7EQ15]?8S/;R_OKEY.7X__SS],#24$5.<7U_>7EY?GUS<71* -M24)`0$52U=#:R?;]^.7EY/KX^/SP]<#?5%Y&27=S?7Q^?G]] -M5M#:SO;]^.7DY^3E^/SQ]<'?55]'375Q7GX>;GY_K\\,[?44=+=G)_?G]\?7UR<'=U=4E"1EE=5-_#]?']^?KZ^OOY -M_?;.VM%314)+=W%P -MP<[W\/#Q]_7+S,??UE=37D1#0T-#0T-&6%;0T-W%QL?'V-/1U5)96D1%1$1; -M6UE05-32Q,_+]??V],O#V-!47$=/='1U=W=T2T):4]'$PL[T]_?USL39TE52 -M641`0D)`04=>5M;9P<+.] -MT%=<6$9#0DU-0D9<5M?9QTM/9P\S%TM'6UU%%0T987UQ?4]72V-_1U-#8V-+45=;0 -MU5U:6EQ375U3U=/=T]'1T]#7U=31T-#0T='0T=175E=45E-1U]77T=75U517 -M5U=5U-155U%04E)34515U-36T]W=W=/7U577T=/W-WV=[WMK,S-C2UEU?5M37U5)96UY15EQ9 -M7538SO7U]V-S25D!U=$I/34]-6];"\?+S]O3U]<[`WE1>4-166DU*='1U3$%- -M2$!>4%34UM=5U=+;V-S?V\;!Q=S745U24EQ;1D%$65Q5W\?/]??Q\?3.SL;9 -MQ?7_^7IE9V-M8'A(4]#$SLOU -M\/SR],;=T]95U-W9TM31V-O04%]>6D=$7U)?6UY6T]G%PLC(S,+"S&1F86)O;V-Z2E+?S/?V\_G[^?WUQMO4=31W=C$QL/,SL#8T]+;P,OPY.+C^LE51G=X86)O:Q45:69P1]?,\?S[ -MY.;FY?/)Q=/4T=_255-?4E71WM[64%I-3T)"0D-'7]73$U>UMG:PL[&T534V+KZ.#P57=D8&-C -M;&H7%A1L>UK-_?OEY>3@XN+@Y?;<64-$4U355EQ;7E7;S\S$U41`0D9865A% -M1D%:4=S$P,#%V=G-\__TU4MS<4Y'5,WP\&=C;6!E=U[?AX.;E\\/04%-4U%-!=79T0U]7T=!7 -M7EA<5-1=6T1'4]KU\/#TS,;;V=_14%M#24E,1EE3AX^+M[.+D\-M<34M)1%Q<6UM3TL38UE9?1DMW=4]#34-$U,+U -M\/[Y\\C&VMG=545+=W9+15)17=;RZ9:7[&!L;VD5%A$48T'+^>3GX>/M -M[.+ES%)"0EA04UU6UM_&S\S84DIQ=G1(24MT=4?7P_;QRL[,SCHXOQ4=W54QME36=7( -M^>?F_M)UF%B;61% -MVME55]''P\3<4DQ?P_3,V=S:PO7WP%-&7D9RTYR#A^),8103$!`9!!YG]?/\ -MY_[:]^#AV7AF97)4Y.#R\^R4ZNWG]4IE?')A;&1P3M/PREU/15A(=$!97]O] -M_O?TS]'5PR"B9G=;1\%$A0>!QYE\>'NX49ZWN7#175F;73_X^3X -MX>_JD9?E4$E\86%D9V1.S/WVV4YD9GYV=T7>]?_Z\MU;65'4V][4VL;=EXFU -MF4$6!P82%1D$$5[Y[NO?;F/;\\77<&ABT^7GY^?AZ9"3[-9Q965Q0DI*4,/" -MT$YG;&!P6%31WL#U],177=#$W-=11T11V9&*MH1U'0`!$FD=!!?!YNGC>Q!I -MW.7\P7!J;U?\^>?F[923EOY"2T5%3W!_0\C]QDYZ9F=^<'%/5MG!P,?%Q=Y3 -M1UM05T5?G+:PFV@&#@=B218%:>7N[]\2&FWBE^%>;!9O4]K>_.R1GYWB2F!Y -M05-44-KEX_%W8V-X05)'2D)?75Y%1U/6557407U_1Y.VO8$4``X'>U<4!!3O -MD.E.&01AEI+G9180;%/52\R5F86=\V(584)7TT5E,U,_.V4-Z9'A"F+"QE1D#`A#5>Q\; -M0I&75188%>Z%ZGX6$VY/07?0ZYN$G\41'Q1WP]G2\>'A]'%E0?WF\D%E>TI> -M5<7Q\L9Q8&)QA;.VYA@&!A9R$0<9R9#L>Q(=39*:YF-I87Y_;FI5G(&%Y6%K -M8$U*8&'&Z>GW?6!:Y^#U14Y1U$AF9D7ZYLUW?_Z,L8-A&!X29VP'`!/\Z_!E -M%&#AD>Y-8'I`?&QH=NN8G>#<6$1`>6]M0?CG]E%;P>?G]%U:5=Y9=GE]6\+% -M1%>=BXGK;147;WT=`01O4-!U8VW,E93D6'E#U'=[?DO+XNWER]A75D5)3M?) -M\/;,V,OP\?7+Q=S=7W5T2$Y,1\:5G^Y%P_G0V-5O$6YF:&]A;6!T65W:]?'S -M]O#_\V1=>A84:VMC9VYH87Q%Q,K]^N7AX/OW]LC>W]!91D9&15;>Q,CW\?3,S\C> -M4E];2W90YN%:RI;K_^?U?T[<8!=I:&MC8&EM>79`5-?8]_KFY//V\<[&Q%=$ -M4E34QL_9WL_.S?\],;(]ME;4M#=V-Q0U,/U]/;*P\S*P-[2T,/B -MZ\?9E)7#Q=IX94%M$Q1B;V]M:6]]7U1>6\CGY?3"W,7\\5)9WL7:QM+4SO/Q -M\?;+]1$0;VX5:6AH95A=4];TYN?WPE?S4=7YY8AD;%&@4 -M%VQXUOG`1<;A_$!Q7D1S9&5Q7D5.V>?MYN?M[N'WPWQ,2WEF>]+:2G#?],33]^;C^_#_Y?30V_#YZH:& -MX^NV'@.CIF95Z%&,5'@4;%A83%5CRU-#FZ^-8?M]?:VIV=69X4]I60L3G -MY//EXN?\\?#\]_.3@Y[\GY[5:F1D'!H8$10?$W+UU57_Z>C%<,96%6I"=FQD -M5-A'=-GE]L'DXOC]^OC__O[KA(3EEIKR;'IU$1H>$14=$F7>0''YZ>?UT_31 -M;V]#=FIGV%MS3L_UUL+FX?3]X>3Q\.:6A)GGGYE09E!Q'QD1%A`>%W!Q>]SG -M^?OZS-]89F9T9V]P67UPT,?9POOFY?GFX?SRY.^=FNOKF.=Z0ED4'A$7%A,1 -M97=Z0?S]\^7QVM-Y9G=E;V5#3B^O_@[9&%D.V>E79+4FX? -M$1<6$!!C2W]U]OO\\,+U76!E269N?DU_=%73T,#XY_/]X.'\Y>/LDYF5E)S[ -M2M)T%AT7$1`0%V9^>%'Z]L+AYU)&47-D9&5Y>7U#45G0\?/P_/KE^/OZX.J< -MG.Z3D]M2W&43$!03$!%I9&5US/OQ_N;/UTQY?V=M9W-Y?U76U,K\^?C[Y^;Z -M^^#ID)V5EI/]7L1Q%A,4$!(1%6!G<]CR\?/A_U+70V5[>&9F?'-(757)_?SE -MY^3DY^?F[I.3ZI&1]M+,7AF87I^2EI? -MSO[YY>'AYN'FX)63E^Z0ZU7%W6$6%!03$!9I8&=/P?7)Y/O;VE]T<']Z>WQZ -M<$9-U_?P_^;FX.+AX^J0D.J4E_=2V7(5%VH6$Q9J;6!QT\#U__/)QTQW27QD -M>7-X?F[>WAX^N6D924E_A0WW,4$141$A85;F!Q5=K)^>;)V\-U -M?71\9WEQ?$I%7\?V__KFX>;B[>Z7DY?JEN%4V4)N%Q46$Q$4;F-X1<#T]N3R -MP-U-=7QE9WMX971&6MOP_^7@X^#B[>^4D):5ENG$Q=5C%Q47$A`7%6EF3E3; -M]_OVQ\U8=$YP9'EQ>7-;6-3(_/ODX.SCXNF4D)&5D>C8P]EC%FH7'1`4%6AF -M=U[7Y^>'!.0=7*\_GGX./B[._KEI"5E93ST\)V:Q5H$!,7 -M%!5M?4_5P\KQ]=A14D-SWYV>GE,343$\_SEX^+M[^B7D):7D>[*_=MA -M:F\7'187%A5G?''?\,+V_-9;UD%Z$IU2M++]_GFX.WO[^N6D927E.3T -M\4)B;&\1$107%VQZ?TG>]\/)\MM$5%)X>'1Z9W1,=E7W]OW@XN/NZ^J6EI24 -MZ?_VS7UC8VD6%&H4:V%D6 -MD93KX?[.261M;A07%!058F=Z3EO0V<+9U=911G5(<7-W2G5:W<;T^>?A[>[K -ME9>7E.OC_/5<>&-O%1<5%6IM9'E+1=#%P=+6U%M#375P='5W25A1V?7R^^;B -M[.B5E)>4Z^WE\51P9FUK%145:F]G97!84]3!V%+1TD).6G1R0T%V0-=5V?/_ -M^>#O[^N4EY25Z>?_Q$ME8VD5%145;F%G>4U94,'!7U3>1'5<1G--7'5/T-#6 -M]/SRY>WL[I67E)7HX?[)7']F;6@5%15K8F=[=D%1T=S5U=9014=&0DY!0411 -MW-C,]OWXY^'B[NJ5ZNGBYOS:0WYA;VAJ%6MO8V=_=450W]C3UM-76UI$3T)% -M6EA4W-C"]O+XY^#B[^N5Z._CY/'72GM@;&YH:&YM9GM]2D54V-G0W=)01$1" -M2TU!0T54W=G`]/+XY^'B[^OJZ.SCY_#=37YA;6YK:VYM865]=5I5T]#2TM11 -M7T5`0D)#1UE6TL3.\?_[Y.;A[.CH[^+@Y/'=0'QG8V]I:6]M8&1\=$-3T-'0 -MW--55U-%1T=#0%M3U=S'R_/YY>;@[>GH[^WCY_/;6'!E8&UN;F]M8&1^<$]3 -MU-3?V-=75EA`0D-,0UI95-G&RO+YY.'C[.CKZ>SBY_/81'UG8V]H:&YL8V=Y -M<$U4W-/;P=_7U5]`1D!/0T585M_'ROWYY>'C[.GH[NWCY/;=0'UG8&QI:6]B -M8V1\=$=4W]G8V-)775M"3DY)3T1=5=G/]_SEYN/OZ.OK[N+F_\9;=F5C;&YH -M:6]M87MQ0U?8Q<;#V]%66$!"3$A/1EI0W,'U_.7FXN[HZ^CNX^?_Q%AW>F!M -M;FMI;V)A97)`UMS%]GUU6=;;PLS#PL'34EQ91T9$6E/0V\G_Y.;C[^GN[>/D\L=? -M=GIF8F]O;&)@9WAQ3UK5V,3"R,/&Q=%755-975!35=#2R?[X^N/O[>+@^O', -M5W5]>V9A86-@9WI^<4E!4-S7)T0%A7V<7;QL3>WMQ545=37%%75M3=P?;S\^7AY^7E -M_V5E?GUP=4-:5]G?T]O>U]154E)455=75%71T-W8P/']\O[E -M^O_]]\;<5$%U=W)_?WYY?'%T3EI=4]?V<3` -MP<#"SL_"S,_&V]Q465I!3DY,3D]`0$U`1%I<4577T-'6UM;7UM;45=545U15 -MUMG-R,KW\?;TRL'2U%%9149#24M/2$E"0$1>4U945%77W-_6T-_1U-/14=36 -M5-73U]32W]S:P\/"R,[!Q-[745)80$--3$)"0D!%6UY24U31TMS9V]W1TM96 -M5=!55M'44U73U-3;VL7,S\W/S,?8TM507D1"3TE)3DY,0$194]76T]W6UM$04%&1D=> -M7%U7UM'3W-W3T=575E914594U-?7U-?1T=/=WMO$QL'&Q=S75U)81$9'145; -M75;5U]'1T-/0UM=45E%04EU24%!6U-95U-W2W=G;Q<3$Q-K9W=164EE$1%A9 -M7U-14534U=?3T]#1UE5745U>7UU24%%7U-?6TM[9V,7'Q\3%V]S15%U>65E9 -M65]24%!15-76T=?4U]/44%=75E=75U15U=?0T-;7U]?6TMW7%!65=?7U];1T-/=W=+3UM1445)=4E-05E97U=?6T='0T=?1T-/3T-/1 -MUM;44%-445!145955574U]75U-155%=645%145=5U-;0TMW3T]/1UU545-74 -MU]?1T=?7U5175E%04U-05-?3V=G05EU96EQ5UM#=W=/0T=34UM;0T=355U%3 -M4U!65E15U=35U=755517U=37U];1T]/2W=W0T='755904E)24EU24%965E94 -MU=31W=S=W=W=T]/0T=?55U9145%65E?5U];6UE=15%%05E975%=45=34U]?5 -MU=37UM#3T]/3T-'755175E%645%4U=75U-'7U]7555555%=45%145U=75U35 -MU=35U-;0T]/3TM#1UM7555=655935E%65=;6UM;6UM'755=14%!65U%65U35 -MU-35U=75UM+2TM#6UM'0T=3555175U=15E35U-?4U-?45%9145%65E965E97 -M5%55U=37T]S1T][?W=S3T=?55U%375U=4E%45U34UM'3T]'6U]545U=14U!0 -M4U%14%95U=?0W=_>V=C9W-W3UU564%-65%915U=75%545-355=355%=14556 -M4U!04%%05U74T-+7U)15]77 -MUM?6T=;7U]'1U-'=T]'1UU=655165E!<75-24-70T]S9VL;"PL/!Q-G2UE=? -M6$1!0T-`04197%-4U-;7U]?7U-155-71U-?=W]G8WM_:V]_?W]975U%?7E]: -M1%I$049%6U]7T=S:PLOW]O?U]45=4U]#2TMS< -MT-'3T-'3TM#3V=O;VMG?W-#65%914E]>65A86UE<5M36T-+V-W4U55=6T1,='=U='=U3DQ`7E%5T]O$Q\;`P,?:V=_= -MTM!545)=7%Q=4E!7U=#2TMS%P,W"PL#!Q\78WM[:Q]C2WM_44%A*<'%R?WY\ -MWMW>P<#%WM==14=)<'Q] -MT]#1UU545U!045%15E164%!27%]96EI87EY=5-;=WMG> -MV<3'Q,78W]+4741`0DY+2$],0T9:7%;5T][:Q\##PLS/S\+`Q]O>TM;75U)0 -M4EE?4U?7U-;8V%;7TU)$6U-?141=75E%7U!>7=GTRL[P^?/)]/7>7D5/V5E>7!+35+>P\[Q__S\_/_QR\S;5UM$3$A(3DU&6%/=V]K`S\S"P,;8W-S7 -M5%136U)?3$581D!87E;(R]GP^,+#\,%;4%YS?GMD9V9D?GU]1M37Q_+]_>7G -MY.3D^_SWP,510$-(3E^/[PS\#17D=+ -M<')\>7]]F1E>'=)6M'`]/;XY.3GX>'GY/ORR,?06DMP?V1G9V=G97QP2U_7 -MV,_W\?S^__G\\O#US<725U=>0$!"1E]74]?!V]W'Q--44EA*<7!_>GI^>7QQ -M24!;T<7"]/WY^N3GY^3EY?_Q]][47$IT?WMD9F=G9'I]<4Y?5,#+]_W^^_KZ -M_O_S],G$WU9<6DQ,2DA874+5Q%S$VMG>7-]>34QU<7ER?GQR=DU+7=;7M^?WUQ=4-;U-G#]?'R__G^__WP]7QV=TU9T=K,\?/]_/G_\OWVR\W'W=126D%/6T9,45!2 -MU='355347$%'375W=W1V=TU#05Y7U-/:S7D1?5T5245-06519 -M3$%(2G%V2G9(0T=%7]36W\;)]?7Q\_#P\/'U]?7+S=G?U%Y=1TMV<'!^>7Q^ -M?W!*3D77V\'+\O/S^?_R\/#*QL3?TU;7T5-0WU5=WE]56T=6<$EV?7)[<']] -M=$Y:6]W>V\GU\_;R_OW\_?WQRLO'V=[2U%]81$AV=G!]?'UR?'!U2D)>5=/% -MR/?V_?[S_?WV]\[/Q\7$Q]M6SM9W9^>WEG?7I]<'5%0=[:P_;Q -M^?W^^O_^_/WVR\G:T5=04D5`14Y*3W5W='5U=$I/3D]$6%_5W]K-R??Q]/+V -M]?3/SGQE9F9G961_=$A'U<#-]_[[^N7DY?GY__?# -MVM!31$Q+='=U2W5-7D5?5-77U-954%-<6D9$1D9?4E31W<;,RO?V]_?V_OGU -M_/[!PL3<04A*?&5G96!B9F1E>4M;7M[W\O+ZY^3EY.7]]_3`5T5&2'-Q='%V -M35M;4=[%VL++RQEG43$-T?7%Y<']V3'5=4-;9P?7-RLK/PMG;W5=44%-?7U-= -M4%37T-W%Q\'#P,3?W=!545)<6T5%1$9$6%Y=5U74U-'=W=_>W-/3T];55%11 -M4U555-/=U]S?U%116T19049"0EI95E/0Q-O(]_WY_?G^\U-G%WE17 -MU=354%U1UMC9UUU:6U/7TM!54U)04%!1U-W9V-W0U5%65=;3T]+1T='7U%=3 -M5]33W-;54UU24-55U=75U]755%!4U=;45U%<75'5UU91T=[>W=%75E77T='3 -MTM#755555-34U-37U%915-77T-!55E=45U975E=5U=555%=4U-545U914U'5 -MUM/1U515U]555=37T=S -MV-S65U!34U];7U7T5%=4E36UE134U;7V4E7?Q\;9W=W7E]>7%!5U]/'R/7UR\#25%95W\_+VE!$15W55UA'0D-?W,W+ -MRO?*UD]\>7Q+4=;7U-77W<7:WM[%P<716W5T0U3%P]Y30W1Q2E_3P?7Q]\C` -MWU=%0UK7S_3(VMS8Q\766T);U-)2=7-P=TY3S."6E_]_%1=O2WQ'V_7/Q=-76W5\?$;+Y.'ER%%!1EA?7%?:R,O:4D9=PO'- -M5DQ#1%+5U\+&2V-J;$&4A9_Z81878-S-6W59PO7/36%DT>.5Z?-S;&YG2-GU -M\/SPQ4MG8'G1^N+A\51)2EC0W]C)\/;$74A(5O3[^,5P86=+Q_;)U$UP?WUQ -M2478[)V?ETT?!1!5X.36>7'?_,-\943FE.OV8Q84>\+[Y/GWS%U_;6-,^>GO -M\EIR=5[9PLGR^O[6>V!\S>3ERU)/=75U25S$\?35=V5D?%O14EK"Z)*5W6!I -M84?!77YQW_/(6'-VVN3D]%]S9V%D?DS'__GTTT-W0M3&S,OW\/?$U=#*^?_( -MT5-05E)#0M3&W$1U=75*<4WMF)_F81X<;7-@%'#AZ^%,8F3&X/96Q?CGVF=H -M9\'Z\]O0P=QP8V-"\N?D^_KYS4!WU?'VQ-O%V-G35]'9W%!87-3EE.-+8&5[ -M;A1H9DW36'-+V<=24\+^Y?-02=?"4DE7P\C`U$99T%5`7O7X_<[`\?W/Q-Q9 -M5<'425WWSU/5R>R2Z'9A3'47'!1@9WMR0-_)U$G0\,-VL7;UMS/_>'IX%ER=6(3$FAO%6!!UM3=S<[W -M]L?$P]1+<4)$3UK?]OWVS,/%5%'$P-S#\=F>KA[M%I%Q0?!1D2$15@1_'V^^/GR51#AYN/IEY24GISD[I56861C'1P0$!87;4C6U?C@Q,[,<&5Z8&YG9&=W -M1%S;\/WEYN7DY.&5D9:8FNN0EMA]>6\9'!P>$A!O=L?8XI?S]>;6;6=E%15C -M9F9_1][.]^;BY>;IZ)20DH2=[9SJ'H7 -M%V!A8GA?VL3PX^WGXY>0D)Z!G.F%E71A<1`''AL9&Q!M0L;:EY'A\>S);V!Z -M:Q!L9&-A0L;9RN;IYN.4D)"=@87CFYU:8DEI!AL8&`4?;W;'69>2Y?;J\15F -M?A43;6=M9T/.S//@Z./CEIR?GX2;DY/OP7IL'1L:!`49$!5,\?WKEN+\YE!M -M;6(7%F]L8'Q=QO_A[>OKE)"?G(6$D)R1_7-D:P4;&@4%'&IDPLOKE^WYY-MO -M8FP7$&AM8GU'S?SA[964E9">F9J$DY*6\GUG:`4%&P4%'6Y^PO65EN;\YE`5 -M;6\1$VAN;7Q:].3M[I:6EY*8F9J:D)+KWF9@%@0:&!@;%F19]^24[^7WPF1K -M;A06%V]L>W17\^'LZ):6D9^:A82OOY_[4>&]I -M%Q<5:&QZ2%[VY^SNE):1G9B%AYF3G>!V;VX>!P4:&!YJ=_?GZ>GMY]=S86\6 -M%VII;V5/4L[[[.F5E):0GIJ$F)"=[E%M:!T'!`08'Q1ZPN&5Z>'CR'AO8A00 -M%&QB9W51\>7BZ)>7EY"9A829DYSO1F]H'`<'!!@<%'K*X.GLX.?>>FQM%185 -M8F=X2=W_Y.+KEI27DYN$A)R2G>=^:!48!P<%'A-K2OCOZ^#D\D=L:VX4%FMF -M?DY2]>#O[I66EY20F(2%EI"1_6!J%Q@$!QH=%&YUX97E].7T9!5H;Q47:WE` -M3E?EZ>KJEY"0EI*%AYR5EN];%18<&P0'&15B;=?I[.4EY67D)"0F(>:D9;HR&`6'!@%!P43:&-#YNS_]/73?VQI;6UH;GY$4=GX -M[I24E):0D9R$A)*6E^5V:Q(8&P0$'A=N?<_\\/S+UT)^8&!@;6-E<4#?]N;N -ME927EY>3A(>]-5?WL1'?7]P=7QY2,S+\?ONZY7I -MZ)2>AYN1D)#M0VP7$!X$!!X1%A=C0<'51-OVVTQT3EMU?G7.\_/_XNCK[N_H -MD)J:D9>6ZLUY:!83&04;'1`1:F=&55K5]_#94T=24DUQ5/3\_^?MZI7J[.*4 -MGY+NXN[@V7AK%103'AP0%Q<58G=-3E/,\?7;U\'/V];-\/O^^N;LX^;DY>3O -ME.GAX>#_TWU@;6@1$A`6%A=J8'-U1M_P_?;-]?[PV-KQ\_+V\OKD_OW[Y?CX -MY^+CY?GSSUUP9VQH:A07%&ML865P0%/4TL+#]?/TSLSQ\_/S_/W_^/KZ__WR -M]=O;T,'/PM]545A-<'YY>F9A8&%A86=Y<4]>U\?,R??V\_+\_?C_^?WR_/W( -MS<_%TM=41$1`0%Q67%%35E%>34E(27%\?7YR=79*6576Q6$1:1U#76E32W-[5V-+8T]%07EM?5U+4V=K?VMO#Q-O2VU125M%045U& -M1U]>4E)8TU=07%?0U]3=V-S?T]1=5E%17]S3VE16W]?2T]O=UE?5U]%74]U2 -M7E1#453475C4T]!3U]_555!145Y4=5%4]-4TU75T=_7T=Q4W=C?T]?7U5;75ME5TU36W=117-974E=27%9< -M6U!0U%+5U-;1UE;1D5>4-?1WL'9U=C%TMW'UU95U=7745#54E-=5U96 -MU5'7U594U=34U]]54]975M/55-S75]95U5;1UE'15U70UU;6UU;6T554T554 -M5%944-305]365=35U-'5U-S45]945]564U%645=5U-375%?4U-?15M7=T='6 -MT-?=W=[?T]/1U=745-5775Q>7%Q87EU=4E915==555-25E-7U=#0T-/U%!804IV7E_?7-T24%97-7?V,+UR??R\__ZY^7E -MX>3Z^_GSP=A637UY9V)B;6UO8F%G>W='6=_.]_'XY^7ZY?CV],+34T5`='=T -M=TI>6=SV]O#GYN7AY^']\_#767=P9F!B;6YN8VUA979T1-+#]_WDY>3FYN7X -M_LK:U%]T<7)Y>'YW=$/1]_WS[>WF[NWNY.3DWU=(<6-M;F@4%6X5;F-Z>$C1 -MQO7YX>;C[>S@X.;_]L?=3W=P>F5E>WYQ0U/'__WAZ>#H[>SB\N794W=_86YI -M%147:6MN8&1R==;%]_[AX^WO[N_BXN3]R,5?='UD86-A8&=]=%G6]>3CY^N4 -MXI3B[N7T^4U(96=J%!06%A%H%6]GV5Z960Z97OX.%1S7%F;FH6$A,=$1(5:6U^1;ZS5MR9&(5%144%6Q@9754G^[H[_C[?45@%1$1'1@2 -M'Q$3:61^4OS@XY>1D)"2DI25Z?K%5'%A;VL4%A1K:VQ[=D;!\_CDX^SNZY>3 -M[>J2\.'^TD%O>A<1'Q8?&!<0:FA(4,/XZY3HDY*1EY&5Y.7)1F5F8A04:FH5 -M8WA^0,3W]OOFY?CEY?_E[)3GXY+P_^30<6AD$1`>$1$>;&%]4E?OSS%!\>')F>W]"753"\OW,_O574UAU?G!SF0GI>0A?G9_7T1&18%&AL3;!1#_^[ZE)+LX>3X2']]?V5G7-/:\>?G -M\O_VV4-(='ID>W%\=E7;VLC[^/OG[9">[N"8_F!'^?B> -M]6E_2!`$%Q86%FG>TU+:E.%6Y>36>$5<24A8^?CU\^#_6E%5<69X3W5S6\K/ -MV?3[]-/U\LW%]^:3G?_BDE058'PK@U=KV5V1Q341:7/[M -MY?;@Y%MV1W=@9G1:0%_+_,K.^?G-Q/?+Q_V7G^/VEN5O%V9J&Q(48F)B1?+E -MU_/M]EA`U71XF9EU;K -ME603;GX?'A1F?V]RQ>;&0.7EV7]/4'5R3N3@R/SOYD5"4W9G87]'6D_=^?_+ -M\.3[R\#T\/3AGI_`\NA?$!-C$!P6;W1S=D;ZYUC5R#] -M3WYV=WAE<=3>7M/\^/CYOCWV=5W?'1,=752WMK!ROW]]\L_LT!$>:A43 -M$&A,6W=*\>+T5]?(U6=M>-/?T?/L[???V]],>7!;44]#W,O`V_?X_\/&]/7. -MY)V%Z\WA_V$<$!46%A9F04A\3/G^WD95R4-F9]3W]_WXYN7%3T)12W]W4=W5 -MU<#]_O;W_/+#V\WPXY*?X=[\TVD=%VL5%6E\65IW6O/PWT!>U$M[<<_SRO?_ -M^_'62T-?2GUUU=S7ULG\_??W\OWW]/'GEIF7P\++>A,=%VIK%6)/U$%VT_SW -M77596GQZ7_7U]??_^/930E750G1$U=;4ULG]\O;S__SQ]?WHG)WZ5<)9:A\3 -M%6AH:7M3T$-!R?_)149207))WL7"]?7)]=I'1M366416WL?8V,SQ]LG.]OWQ -M\>RS7V=9@$A(7:&YK8G324TW1\_W52T):3G1$P/_R]S_S`1$A;U5M*6/;[ -M]MK"]\-?2T-04T!$V?3+V<;S_O;,]_S_\_N5DNC;1EQW:A`1:F)B;&%"V-=> -MT/?TTD5$1$%95,?+\?;+PL?<5EE>6%A3UMW%PL_.]/+R\?;S\_+MD93V7E%? -M8!<1%VYC;6]E7--65,'W]\/50'5:W]K1Q_?]]=K2W-O>4D12W=%7U=O/],K/ -MR_#R]\C][Y?MQUC57V=H%!5O9F)N9DS4W=+9R?_QUD)$T\336%_$]L/75-G/ -M]=K4WSO?(QL7!SV9X=TY!1T-;U-/< -MQ<'.]_3(S,?>WMS1U]515U514];?V,W)PLWU]55755E?4U-'>V\'+R\C+RL[#V]W3 -MT\3WSE;9]L5?6$A\<'%D865^>7UR?'9:5=33P_;Q\//(P7]S -MVL#,SL+&Q=O;WM+1T=/?V\3'P,S/S\W`P<''Q]C1U-74W<7= -MU=G'UUE'=7!V7UV<7%U0U_5T]C#SL_)R,+:VMKGE^?'%W2D%2U='?VL'"S,S&V]O% -MV-_9V=W:QMK&S<[+]?3*S\/'V-!67UM>5=-45-S<55-:2G9V -M379PWE\<71T2$9=5=+>VLWU]'E_5U11U]S8P<#!P<'#SW-#55576TM'6T-=07D%U=G!]?GY\?7!W=TY;4E?7T]S; -MP<#!P -M6EI86UI$1D-.=71V<7=T=4A.0D1>4-3T%77UMW5U5;75='05-105U915U945M70 -MU%35UM35UL#YQF1Y7=%<6=94U=C%V='5U-?2T-;>V=504%!5W=125='7UU75 -M5];245A0U=34UM506UU445?4UE77W]975M+;U]'55-75T5945U-75]?2U5?7 -MT-W05U/7WM=5W=/45=%76E)275504E'3TE=6U-#=U='24-;75]?35U)65U/4 -MV=S34E;2T--45=964%Y65U7=U%96U-;6U%-1U]+75-#7TM!14]?9U5Y875;> -MW%!<4577W]/55-?>T%=24M7255)6UU16T='15M;=WU584U'%VE%45]944%57 -MTM%24%154E315-565,3;UEY2UM'>5%U15E!5W-)65-?1T];<5%?4W=#3WU5' -M3U_1W%5<1%S8Q]13T-Q1W/10=TY?5=W17E[1QMO2UM+55];7T-/1T531TMG; -MU%=17E1=1E+7W-%555-55%7;T]?5U5=;6M;;U4%`65??V=?3T=39WM#1W-#6 -MUMK,TE%&0T5;75K6S,#26%;4U]U?65A6TE=>4M/#P=]67=?15-S35E715%E= -M5%'555Q45=745]>1$%$7U=7TMW0V\?`P$VM\TO+[^?'#V=C`R_3US-A77E]6T=O'Q=+54%U05=54 -M45Q;6%;=S_'R\O#,T%E/=75)0D-%WN65DY^=E/5@'`<&!!UMT.;OXOO827-T -M7,#P\O?%4T==P?KLZ>SEQ'=A;6-E3=GT\??'U%!<75955%%24E3[Y6V1@94C!^?OPVT1T2U3QXY67E>+T -M36=O:6)Z3=[+]_7%4TQW<7="4MS-]_?*P]Q475Y?5M/>5$=/UN&6GYB>E=<5 -M!0,#!!%TX)>7[O1];&YF0_#AX.7+679W4O'ME)&6Z?]'8147%&]^5/?X^O/8 -M0']D>G%?P/WY_/?:4D-"1=7#]_'TQE!U=<[HDYZ>ELYN&P`"!A)YY)>6Z/QU -M;6AB=/?B[N+XWDYV3-[E[I64Z.3:=&!H:FEC?UW,_/CSW$]Y9F=]6L/YY^3_ -MS%='1US?]/S\\=I#96UDSI2?FIJ1QQ4$#0T'$$WNDI.5\GYK%6),_^[H[?]4 -M<'Q(Q.;KE)3O_E-[;!45;F9VT_/Z^_=1?6%M87/=^.WN[?G93G)Q6<+XYN3R -MT7-A;FQ#[)R:A9WX;!L##0$2?."0D^K_=FD58DS^ZY3IY=)S97U3_.R5E>CG -MT'AL%11H873$^.?D\%=]9F-F<-/^XN_C_]A#<718VO/E^/515GYJ8 -MEMT4!0`#!11;[)&7X\9[;F][U^?IZ>'U17UR1L_FZ>ONX_S1<69L:6]C>$3/ -M_OORVTME8&%_5/SC[NWEP$1Q<$]4R?S_]-=T97G<[Y.>F9;':QH``P012N*1 -MEN[QW53V\KWS]=,?7IX<5C# -M_^3D_LK16450V\KV]\)4=7%5YY:[GV'%XW55]?[Z^_[PRL+$V-W4 -M4EM`7?+HD9*2Z\5C$@0&!1P5<,W_^N7PS,_U]/?+TD1*=T_1\.'OZ^CLYOCT -MT4YX8FL5:VQX7\[]_/3214MT3%'%RO;VRL_`QLS)R#HE>K@W&05 -M'1X<$!5A3VUT1(25S$\^7AX.'G^?387W=[9F!@9W]+7-/? -MW==44EU35-/8Q<#,R_3V\?;USL??UU9=7U?9S,KUR-E22'AF8&%F9'ER<75` -M7M7$R_?Q]O3+R_7T\/S__//TP]Q01$Q.3$!'6EA>65M'0TQ.3DQ"041>5-#: -MS/3Q\/#W]V=_2T=155E%375]>7E-37U-14=76 -MT=/3UE545%145U=75E=4U=?1W=[9V=[7EU5U5=55%965U=45=37UM'1T]WVL3%VMG5%#2U=356]S37-39Q5/?PE56 -MT\744%=GYG9'MD>']T=T/7WU5]&0'5T2$-$1557U]C=Q\#$ -MQ\7%P,O"W/3T5_?3W-QUWG-S=V5^9F5E9WA_=G9%5=/-ROS\^.?ZY?C__4EM-3'1U3TY%6]?1TL#:SLOQ_?SE]/KRQ?O5 -MS%=V46=X9F)@;F-M8&9E'GYN7[\O3(W5590$AT='5(3%A3 -M5MO%S_;W^>7SY>'T^_3&S790?&9D;&UH:6QO;69Y?D)6WO3VYN;GXN#AY^7Y -M]\S944=`2G=U2TU!6-35WL#!]//]YO_^[,KE\MOW<5]S86=O;Q5K:VAI;'IE -M2]7;\/_@X./LXN+FYOCQR]Y71DYT<7%W=4E86E3;Q/'R^>#A^N_F_>;&]45Q -M3V)B:6L4%Q04:FAF>'W6Q/'DX._NZ>CI[>/D\O727TUS3AZ>;AZ?[E_=W??G)F:&H4%A,6%A1H;')V5_SEXNZ5E965Z^SGY?367W=] -M969D9V1]=494P_3R^N/M[9?LXY?YY_]4T6=D:1<0$Q,>$!,6:&QT6\SF[I67 -MD)&6E)7L^_?>3'YE86QO8V9G<5W2S/[DYNSKZI20[^J4R_G=<61J%1(=&1\? -M&1$1:&9.SN7IEY*2DIR0E>GGPEAR86X5%145;V1]0<#XY^WKE964D9:0EN>7 -M^T_%9&\0$1\:&`4<&!)H8G#%X^R1G)^9G)V0Z?G*3V)O%181%A1I8'W6SN7O -ME927D9>5E964Z_OZX7)]>6@1'1`9'AD=%A!M=ES:XY7KD)V2D);KYFT4 -M%Q<4%6)E=]/TY._KE9:4ZNCLX>;NZ_#-Z-)E0'MH$Q<2'!X?%!`79E98S.J5 -ME9&=D)7KYLI-96-K%Q1K:&)\6MO\X>B5ZY27[N+CY>7OZ^7*XOQ]>WQN$A(2 -M'1@9$1448]SQ_>Z1D9:0D.KF_=Q_;6H5%Q=K8'Y(P/K@[^N4E>OOX^3QR/+N -ME?WWE^9[2D=L'1,2'Q@:$6H4;,7[_^Z0DI:6ENO^7$UE:A84:Q5L?=+`_.WJ -MZ^Z5ZN#Y__?05/N6E?#BD/I]=W45'A@>'@0%$&UO9?GKZI2=GI.5[^#=9FYI -M%A(6;V9[U.7M[^N7E^[@X?C95%)$T^R=ZN62DO5P2&8=&@0%&@8%%&=GUNB0 -MDIV?GI/@\_5Z$1$6$A`595+)_^B1EY64E>/RQM!:?'Q>X9Z7\9F8Y4%1?!T9 -M`0<%!@83?F?F9R2D9V>';S -MG)KMEH23VGMZ$1@``@<$!@5@6?7MDIJ$F9.=E,-Z;!<2'AX68V1-Y^N5E)"0 -ME./\_=IQ?'=V2\&0AY"4FI[D>6,0'@8,`P0$!!=T\>R6GH2$DI&7Y'-I%A$2 -M'A-C=$7RZ)>6EY>7Z?[#VT%[>')W7>V;G.J!43&P`#!P0$'&Q%^^B1 -MF86>DI;OR'!H%A$='1=F=]KE[Y21EI>4[^7QW4]W=W1TW^N?E>^0D>1.9A41 -M&08&&AH;$&-9_.*5G)F=EI3N_4]C;VX7%FEE3U?/Y.B5Z.N5Z^#\R#^]U%A81$%!U\C*P\C(Q5=.?7AD8VQO;6)@ -M9GQ)7]7!]_/P\?/__7EA87EY645)97$5!0T),3TIW=W=P=G9V24)5-/`R\OT]_/P\,OUR<['Q=O=T%36U-=6U%945U)27UE81DQ"041& -M7EW5T=#2V]G2U5106$%`0T)`0%]=UM78V\'"Q,S:Q-[?Q-[=UMWVMG? -MT=?05%);65I!04=;6%)WMG4%97 -M5=?1W=W$W][=W=W1UE745E=045905U33T=%5T]%5U55755-24E%5U-'1T=;3 -MUM96U5Q545-<4%;55=;1T]/0W]WUM77U=/4UM/4U5?6U=#6 -MT=1<74=65EE15T13WUC1UL3.Q<3;]57=W]#04=5>7TY07UI'7U=;45+45E;! -MV-;7E^?/UR_OZ -M4_/F5-O(WT-P<7QC:&9O%&EL;VUDKKZ>WFY_3474IE9V%B -M8V!D?G-`UL3T_^7GY.3E_O+(P-+)\5[&_%%5V]5?2DQ*96%E8VEM;6UM9W)S -M=-;#S_[FX^SIZN[M[^'\]MM>2G)^9V%D9&1\=$Y?TL#+]O_Y__SR]WMXN/AY/SRP]U> -M0G1]?'E^?G-W3%Y1W=G,R,GURL_/Q]W?5U=07<_;0_+/5O+9\=S7S$)W<7Q@ -M9V%F86-^9'Y*0UG3R/'[Y./CX./GY>7_]^\W*\/3PT\S02'1Q>6%F8&!M861F?W5!6=[T\O_E -MX.'BXN/@Y.7RR\?00$AQ>WYZ>'E]=4Q%5M+?P/7W]_;TR#FY.7__<[!W%Q`04EW -M=G!.3$986%]74E/2U=+;P7]967,_;Q?;"\-_`S%A90W5[>V5D -M9F!E9GES=$56Q\CS^>;GY.#GYN3[_\K`TE]`3W1P<'%T=$Q'15Q0U]#3W]+> -MTM/0V]W1WU?4W,/$T_;*VLK-S-'7T4%)=7-D961G9&5S<'59457?S,KP_N3E -M^N3D^_SQPMU56T]W=W%Q2DU;15)45M?5T];5V-[8Q]G9QM-0U%-0VL#0P_S$ -MP_7%V%;564IR?7A@9&=A97ES<$Y0W,/W^?OEYN#AYN#D_OW*VU!%=WY[>GAE -M>'UV3D=7W<3#R?7)R<#%SL'6W=G=U%35UL#`UO?STL#VP411TG9^?7A@;69A -M8&9Y=4M>Q_?S^>#BX>/LXN7EY??9UU-T?'QY961[?7-V3%/7MX?W-W2D=2T=C#]?;S\O/S -M\/;T]4E?6W=G%P,W,S,/!P<#9UM=5 -M5%5555%=7%]<75Q<7%Q>7UQ?75%75=36U]/3T-+3T]'4U-?1T-;0T-9445-2 -M4%!04U!15-37UM#3TMW=W=S?W]W0UM35U-74U-?445944%)04%9645%14%-1 -M5E914%975=37T='0T]#3T-#45%55U-37UM?4U];6T==445!34E)25M76T='3 -MT]+=TM+=W=#1UM545U1745%14%!44UQ275Q35]36T=/2T]/3T=?4U]35U];1 -MUM55U=34U=35U5555%=645914%!345945%75U];6UM'0T]/0UM?4U-?4U]35 -MU55645965%=65E-7UM75U-?6UM;6UM;6U]?6U]155%%145=45%75U];7U]?4 -MU%575%575U=45=74U]35U=36UM?5U-34U-34U];6U];7U%165E975E965%77 -MT];5UM?7U]34U%545%175U15551555545%75U5545%=645%65-77T=#3T]/2 -MTM+0T=;1UM155U=65E965U9645=55=74U];7U-545U965E935-;5U];6T-'0 -MTM/0T=;4U5545U%15E!24E!15%74U]37UM;6T=#0T-;7U-34U]?7U-755516 -M5E=4551755555U915E15U-?7T='1UM;7UM/55]545%175U975%=45=55U=?7 -MUM?7UM'1UM?7U=555=75U5545%975U15U5555=37U]?4U=74UM;6U]?7U]?7 -MU-75U5175U145U15U=544%%55E=5U-;1T-#3T-#1U-545%545E%15E=45=37 -MU]?45575U=555%175%77T-/0T-?7U-355575U=3555145%975U945=75U=75 -MU5145-305576T='0UM?7U]1555555%7555145%145%555%=4U=74U];6T='6 -MUM'6T=?4U555U=74U5545=755%904U!04%%75%75U];6U]?6T-+Q,[`75M07%%2 -M75Q86D1:7U'5T-W0TMK']/3$Q,/>5%!;=71T=4U'15S6Q\W*R\_,VM=$1%M$ -M34E$65)>7E'=PLW+R<_*R\K&T%135%]+25[65%#6TMC46UY?5UA`6E+:V-#% -MVMI17U-25%E>6%W35U)2U=)05E?2S,/$V\W"5%Y$7U]%6%+?Q\_`U-'174!# -M1U[55US4W=?5W-K3T--=7E346UW&P][?VM!04%]?5512T\#>5E506%E$0UG2 -MW%??]<[17%754UY'7%55UM+;V=505--36%?0UE%4TMO%W-=5UM5:15964U79 -MWM;745-75U-6V=Q?7%365%7=V=G=5E-674U-4<3!V,3U]=--=TE"3D!5S_;T -MP=+3W%=.0U107U;6T=S>75S=TEYW]'1T-;7UUU95E514E=55U14 -MU5=:0T597E]7WMK?T]'7UU17T=_8VL+/Q-W4T-!>=4A25EM#RWM)>>6=\<7=9T,'W\\C.\LA0 -MU=O51D=815)<=75?]9>%D\7^[WX;&Q$2$FEW_NOKX>+OQ6!B9&)J8%WY[>_H -ME)3G5TYW9&UF2,;[Z9'J^_5/:1,2$!%M=,?FZ>[AY_A0=DE`=G?3S\W.P--% -M<_^`@'):A>@%`&P4!Q]LW>#MY.&2XF-C0F4=$'#3RO[LD)V7^_#R2VYI9'M[ -M4?KLZ)26[M5@:!$9&1%BCK[.3__,)!=D!21E_8'`3 -M&613;V?^[/'XEY7E^.'^1$Q'<65D<75+6-SQ\??\^OK__<75TTQY?G9Z8'), -MV-O9TM#1U5!=7UE$ -M15E965-5U-?0TM+0U5==7%!34=75UM_8V]C9WM+1U5=65%15555745)35E!= -M4U=75E76T=;0TM+0T-;7U5145%!34515U-/=W-G8V][15%);1T9'6EE?5]#2 -MW\7'WM_355-?7%!04%76T]#0T=#0T='55U?4UM#1U]=54%)34EQ=45!35M?1 -MU]#=W-W2T=54U51745%15M74T-+0W]S0U-?45U!34E-04597U=554%#5U=31 -MUM;7U]?6T=;55%74UM#1UM'6U%=645!375)04597U=74U]755=37T=+2TM+= -MTM;45%%04UU<4E?7U]77T=;6UM'1U]37U5555U345%944%)24U;5UM/=W]_> -MTM955E)275]<4%34T]S?W-W2T-=55U=75E=45U15U-'3T=?555175E975E%6 -M5U74U%545554U555U=34U=77U%=7T=;0W=/2T]#1T=;6UM?7U5=5551645-= -M4U%15E?4T-/2T-'7U=77U59555145U915U965%155=76UM?3W=/0TM+75557 -M45175E!65U!1T=54U];45-77U-36U=76UU55U%=05=#4V_%><%9$=UW01=3" -MWMC#VMW;V=;=W5555UY;4UU<5E97T=;7U==5U]!15=9575Q57%Y7TM75W=18 -M6TAUXY-\>>9S9/3L>7;#Q4'W_TMTQ7%YT%)PRN!06N713??2<51' -M==17WU#WY,7VR-A+7%UZ2DQT<%M64MKWP?3QR<75L3,75O>W$)$Q]9/7=E13-7;4U;1U]35 -M447=P%3?]4D10T%EW=5+44E3.__'/],O=4EY,=G%R -M?W="0D7?SMK$R\G:TMO8UU%6U5!<5=/>W-[&P,3'Q]Q545Y$6UU:=75;14E! -MW-]`6,3,T]?!R,[<7-[WTW77^=YR6\]8>TK`QMW*__K[R=;3TW%F?'=E9G%% -M35K7Q/7*P,[VS]77V55&6];0W=C;S,W9WLS(T]?>T5]/=G!V<7UT04!'U=[8 -MR/#U]?+SVMW'TEQ<5UY;4U%;3T7!],SV_?'`UU-.='-[>'QQ<4A4UM/:PL_` -MP\7;V-'6T=%54=S9W]O%Q]G0U514U=/QLGT_?+\]]-`=W!D9F1E?W!"4-OU]/;P\1$98U]%55=/04EQ<7%I(='=*0DQ`6-?9P_?P_/SS]_7U -MQE1?1$-U=4?6VMO'SO3/WU=>6G5]?WUQ<'!)7M72Q\_T]\C)S,'9T-165E-< -M4-70UM36T]_?W=/0T-;55514U5145EY%049&1D%$7U;7TMG:Q\;$VL7$V=S2 -MT%=?7%E87U-4U]'1UM75W-G9Q<79T59<7EY>6%]<7UU7U-1445-?7UQ?75!4 -M5=70W-C%QLW,Q=G>W]W3TE175E)04EQ?4E!04U!75U74U];7U]355U=74%-= -M7%U0U-;4T-W2T='6T=15U=77UM;7UM34U]#=W-W=W=+7U5755E%74%Q<4E-0 -M5U545%145U545E=64U%15%=5U=?6U-?0W][>W-W%;D8?S7?_QW7\]WQ-ES\%=S^G97_67^4W_@<4#[=E_P>_?$?/Q"4_9P -M5OU^UO)QUMA3W4/U5'7WTW'V57/D<=3P?<;11\=$QEO4V$S>T43;U%O#T%O< -MUT+U44KWTDK*44#=6,A#2N=EVLY\_DC3RD%7SUU)Q-U.UO9T6,M>6L'8=,C> -M]$!U],]^]D'(TGW^QV3RP'GP14'P1W'@?G?M>$/D=T'X=47V=U#^ -M9,?]9=[T2E_/5T;U7U_`2D+@2W[\ -MQG#6T5+X9O+U8?3[8]KZ9O#10<'9<_'0?>5.5&1/!/7OAD -MT/IGQO!VT?EE7N%BS_]OY]9GY=U[]_]@YO[;>N59=N!Q5^1E]/)G_U)Q^G9%]'/= -MTW;!0M;56=[16]W94,Y9W\U;S]9U^WU>^6;$W7SQ7G7*1U/:5U/$4]S6VM)' -MRM18PD=0R4%3PUO?P%C96=#10=Y:0\M31MQ%55%?TTUU5?`5T94VU9#V]5,S=%/T5!`S%M&S-59UMI/T=I=5555QM9= -MW]+1T<306-C95$52W5U0U5%2TE#344O;V5K:4%C/5-W91]W<5=127=+05U!0 -MU--2UU%5VE7=4E+;7-%21--3TE9=V%?$W%'=7=C?7U775-#3U%13U55?75'3 -M45345M715%?4U]?05%325=#15]S44=)35]=0T510T515T-'55]7755945=;3 -MT-'65=555M305U164U%=4U'5T-?4U574UMW3TM_3UU75U5?55%9445914E%5 -M45745=+=UM;5T=!75=55T=;55%!05U9145?4U]#1U-?45=145-54U='155=5 -MU5165%75T=#6TM+1T=;6U%964U)045-=4%-1U-37T=30T]?6UM?0T-'45%=7 -MU-;3T-'755904534U%55U%=65E%65U=45%77T=355U'7TM'1T==545;5U]+2 -MUM55551445!55=37U=71T]%44%965-37UM#0U%%24U34U-?7UM#6U577UM/2 -MUM144%-04=77U]=555=14%%75-;1T==15=?4UM'2T];55E945=;0UM345U%6 -M5U77UM145U965U7555175-35UM'1T-;45E?4UM/0U%114E%4U-/2TM%75E15 -MU=545E965E94U-1455505-/0T-/6U]54U-;6U%1145?5U]'6U%545U55U-17 -M45%15-36T-'7U-75U];0T]#4U555U-34UU545E!045=4U=545%=75-77U]?7 -MU]#75-;0U-?4U=36UM;45U%05E55U=?6U]555-74U=;6UM;7U]3555145E=4 -M5%=45%145=75U-?6UM?7UM?6UM?45=745=74U=35U=?6UU575]765U=55514 -M55=75%555555U554U=77U]?6UM?4U-555=77UM'1UM;6UM?4U-3555145%14 -M5%175U=65U175=37U]755555U=555-77U];0U%36UM74U-75U=34U=77U];7 -MU]?4U55745965U145%145%74U-;1UM?7U5545555U=34U=355575UM#1UM?4 -M55575E!04577U-?1T=;7U536T51555145%=75E74U=7555155U34UM'1U]?7 -MUU75U-34U%555%975=74U-?4U=?4U=74U5575U355575U=36U]75U-555%=7 -M5554U574UE1155565-75U-34UM?6T=;6T='6UM?4559145%65U=75%55U575 -MU]?7UM?4U]?7U5555%=75%175]31UM?6UM?7T=?7T=;555145%165E91U]=7 -M5=35U=555%74U]?6U-555%15U=?7U]?7U]35U=74U575U=5555175U144595 -MU=34U=36T='1UM34U-35U-?7U-755%=45U=45%55U==74-555=34U576UM;7 -MU];7U-34559645%65%175-77T=#3T=;6U]155-77U]7555=75%15U%545%35 -MU515U51555165U74U]?7U];1T=?55='65=;6U=755%15U=75U5175U=75-34 -MU]'7U%575U=145975=?7U]?6UM;7U];7U]?4U=545E945%15U-?4U]?6U]54 -M5%545E914534U-#3U]71U]75U-555%555%1555145=34UM555=36U]34U-75 -MU];7U=755%35U555U=555575U5555E975%75U=355=77U-74U=74U-34U-74 -MU-30UE955555U-37U]?4U-?4U=75U-355%975U1555155%145U155%1455=7 -M5=37U]34UM#0T]#1U]35U%5745=45%1455145=555%75UM'0T517U]575%=7 -M5E145=74U];1T-'6U];7U%145E!35E77UM35U515U=31T]/7U-155U=75=55 -M5U975%15U=37U%545%=7U=75U=74U]'0T=37T]17U5575%=645945%15U-?6 -MT=;7U=37UM;7U%575U=75%75U5545%55U=34U-?7U]?7U=75U-34U%545E%1 -M45%4U=34U=74U];4U];6T-!5U-'6U];45%175U915E%14594U=37U]35U-34 -MUM'6U]?7U5565E15U=?6U]?6U]?7U]37UM;45U%65E%15U=75U=4U=37UM'0 -MT-/0T='4U-#75U164%%645!045=5U=34U-75U=36UM;6T]+3T='1U]545U17 -M5E=75E945535U575U5545574UM;7U%55U-?7UM'6U-755%=75%175U144U;7 -MU]?1T=#3T-;4U%545U=65E=75=75U-155-74U=74U-74U]34U-35U-55U514 -M5%975%55U]?7T=#1UM?555555=555=70TM9114%;4]#>T597U=?1W=+3T-'4 -MUM#1UU165E975E=65E77T='3T='1T=145U1555965U75U-3555575E=75E96 -M5-36U]?7T=#3T-;45%34U-;6T=;455!7UU145514U=?5U-35U=34U%545%74 -MU%545U%145;5T='7U=75UM;0T-#1U5545U74U]?4U5175E965U165E?5UM'1 -MUM155514U]?7U5%5T];7T-#7U]5645945-755%=45=75U575U]34U-35U517 -M5E=4U=555575U];1T-/2T]/6U-?4U5564%%65U1555=645%4U=35U];7UM;0 -MTM+4U-945-3555164%-24E!755555%965]31W=_>W]+6U]37U-?7U-?7UM'6 -MU%164EU24U%14U-24E)05U=75U=5T=/?V-[?W=+2T-#1UM35U]%545545E96 -M45%75%=45U=5U=77U]75U5555=74U-155%35UM;6U]755%=75-77UU565U75 -MU-37U]?6T-/2TM#6U5=34E!65%=4U574U]'65-154U?5U]75U]'6U-34U];5 -M55165U74U-?55%555%34U-=55U915U75U-;0T=;6U]?6UM=555175%145U91 -M5E145=755-77U-?7U-355]73U];3UU555575U-?7U5545U15U-34U=75U=?6 -MT='755914%!145=75U=5U-77UM;6U];0T]+2TM/0UM355U!04E)=4%=55%=5 -MU=37UM'6UU34T=74U]34U-555-74U]?4U-555%=55%77U]34U]555U965U15 -MU=?7U-35U-35U=7555145-75U575U-5555145=74U-34UM?4U]75U534T=55 -MUU54U-75U-?7U]?4U%545=34U=755%=75U=45515U=74U-;0T-+=T]'7U-?4 -M55114%914%%75%35U=?7UM;7U5555%555U%05-74UU51U-/1T-/1T='1T=;6 -MU%5555145%=75U9745!65U155575U-34U]37UM;1UM35U=34U];7U-555%17 -M5%145U35U-37U]?4U=355514U=35T=#4U-?45%=75U=75%975%75U-?6UM?6 -MT=;7U]?4U=55U=545%75U5155=74U5545U=5U-74U-?1UM55U=55U=75U=55 -M55545U15U=?1T='45E144515U=35U555U-?1UM?7U]555-77UM;555545%15 -M55555%=75%1555545=?4U-35U=74U];1T=;7U%545=77U]155U155%175U15 -M5-?05%=55U155%74U]?7UM37U]'0T=?55%=5U-3555=45E!34U-15U35UM#= -MW][>W]W1U]545U=455545%145U=645=45=74U55455=755755%%5U534UM;0 -MTMW=W-S3T-?4U=755E-=7%)=4E%75U145%15U-?6TM+=W=+3T=34U-545U=6 -M5E145%145%145U945=34U];0T=?7UU755=73TM34U%=75U175%175E=75U54 -M5%74U]?1UM;7U]'1T]#3T];7U5175E=645%65E965]74U=34U-?4U575U-37 -MU];6UM;4U5145U965U15U5925=37T]/2W=/1U]?4U5145%=645%455145%16 -M5U74U]?4U%545=77U]?4U-?455175=55U=74U]34U-55U-36T='6U]155%17 -M5%1645%6U-=4U=155=37T='7U%545577T=;555555=55U-155%=15M74U]35 -M5%15U]'1UM'6UM#1UM'6U]3755=75U=455=145%65%175%555=77UM=74-77 -MUM+MU$Q<5Y7-X0NON<%C4ENST0U!F?WMC -M96AZ5/_KE>GRWE;`_F%O;VQTVW3:^USW[.SB<&5;RO3"7G#U?T-'=%])R=U0 -M9VS%E9+HT6=E<]?4=&D68=3Q[.KGR\[9QU5"96YV4MO`X>%;S]I24%WPWTY+ -M>G'04$AS\>/G]EE]9V1-U=;YQ\;:]^7==F%Z4/38=DI0S__@QD=>1-%=T$!) -M=%S"S??`UW=!]/#!>7'4V%1%7];;565!S''.X?7<3-Q5=55+6%70S]C=7E'?V59"0$):V?'; -M6]/;4=S"V]]<1W5UW?7+7D+%Q<[.6$Y7M934=U61$78 -MV%M%5]'?U5)95=%35T=0Q,/=UMO;V]M5US7T]S=W556U=;15E!3 -M4T9P=$!95-#>VL?&P<'&Q\7;V=_=T]'7U5175E%04%-34E)24U-34U!045%6 -M5U145575U=34U]?7U]?7UM?6U]?4U]34U-34U-74U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -GU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -` -end diff --git a/share/man/man4/netgraph.4 b/share/man/man4/netgraph.4 index 9f457d917c46..8c2d77b32d9f 100644 --- a/share/man/man4/netgraph.4 +++ b/share/man/man4/netgraph.4 @@ -36,7 +36,7 @@ .\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $ .\" $FreeBSD$ .\" -.Dd July 1, 2004 +.Dd May 25, 2008 .Dt NETGRAPH 4 .Os .Sh NAME @@ -689,19 +689,6 @@ The message may have travelled from .Dq Li Frame1: to B as a synchronous reply, saving time and cycles. -.Pp -A similar graph might be used to represent multi-link PPP running -over an ISDN line: -.Bd -literal -[ type BRI ](B1)<--->(link1)[ type MPP ] -[ "ISDN1" ](B2)<--->(link2)[ (no name) ] -[ ](D) <-+ - | - +----------------+ - | - +->(switch)[ type Q.921 ](term1)<---->(datalink)[ type Q.931 ] - [ (no name) ] [ (no name) ] -.Ed .Ss Netgraph Structures Structures are defined in .In netgraph/netgraph.h diff --git a/share/man/man4/sppp.4 b/share/man/man4/sppp.4 index 22b238aeff7f..519120f4fdaf 100644 --- a/share/man/man4/sppp.4 +++ b/share/man/man4/sppp.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2001 +.Dd May 25, 2008 .Dt SPPP 4 .Os .Sh NAME @@ -91,7 +91,7 @@ will cause the interface to operate in .Em dial-on-demand mode. This is also only useful if the lower layer supports the notion -of a carrier (like with an ISDN line). +of a carrier. Upon configuring the respective interface, it will delay the administrative .Em Open diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 49f030e78956..09dfc0876050 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 9, 2008 +.Dd May 25, 2008 .Dt RC.CONF 5 .Os .Sh NAME @@ -3530,75 +3530,6 @@ to be used within a jail. If set to .Dq Li YES , allow applications within a jail to use System V IPC. -.\" ----- ISDN settings --------------------------------- -.It Va isdn_enable -.Pq Vt bool -Set to -.Dq Li NO -by default. -When set to -.Dq Li YES , -starts the -.Xr isdnd 8 -daemon -at system boot time. -.It Va isdn_flags -.Pq Vt str -Set to -.Dq Fl d Ns Cm n Fl d Ns Li 0x1f9 -by default. -Additional flags to pass to -.Xr isdnd 8 -(but see -.Va isdn_fsdev -and -.Va isdn_ttype -for certain tunable parameters). -.It Va isdn_ttype -.Pq Vt str -Set to -.Dq Li cons25 -by default. -The terminal type of the output device when -.Xr isdnd 8 -operates in full-screen mode. -.It Va isdn_screenflags -.Pq Vt str -Set to -.Dq Li NO -by default. -The video mode for full-screen mode (only for -.Xr syscons 4 -console driver, see -.Xr vidcontrol 1 -for valid modes). -.It Va isdn_fsdev -.Pq Vt str -Set to -.Dq Li NO -by default. -The output device for -.Xr isdnd 8 -in full-screen mode (or -.Dq Li NO -for daemon mode). -.It Va isdn_trace -.Pq Vt bool -Set to -.Dq Li NO -by default. -When set to -.Dq Li YES , -enables the ISDN protocol trace utility -.Xr isdntrace 8 -at system boot time. -.It Va isdn_traceflags -.Pq Vt str -Set to -.Dq Fl f Pa /var/tmp/isdntrace0 -by default. -Flags for -.Xr isdntrace 8 . .\" ----------------------------------------------------- .It Va harvest_interrupt .Pq Vt bool @@ -4061,8 +3992,6 @@ Default .Xr ipf 8 , .Xr ipfw 8 , .Xr ipnat 8 , -.Xr isdnd 8 , -.Xr isdntrace 8 , .Xr jail 8 , .Xr kldxref 8 , .Xr lpd 8 , diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index b471ba473566..45571163e51c 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: src/tools/build/options/makeman,v 1.8 2007/12/12 16:39:31 ru Exp .\" $FreeBSD$ -.Dd March 29, 2008 +.Dd May 25, 2008 .Dt SRC.CONF 5 .Os .Sh NAME @@ -300,9 +300,6 @@ Set to build Hesiod support. .It Va WITHOUT_HTML .\" from FreeBSD: src/tools/build/options/WITHOUT_HTML,v 1.1 2006/03/21 07:50:49 ru Exp Set to not build HTML docs. -.It Va WITHOUT_I4B -.\" from FreeBSD: src/tools/build/options/WITHOUT_I4B,v 1.1 2006/03/21 07:50:50 ru Exp -Set to not build isdn4bsd package. .It Va WITH_IDEA .\" from FreeBSD: src/tools/build/options/WITH_IDEA,v 1.1 2006/03/21 07:50:50 ru Exp Set to build the IDEA encryption code. diff --git a/share/man/man7/hier.7 b/share/man/man7/hier.7 index bf9aba4f7be7..40c2d0c378ab 100644 --- a/share/man/man7/hier.7 +++ b/share/man/man7/hier.7 @@ -32,7 +32,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 28, 2007 +.Dd May 25, 2008 .Dt HIER 7 .Os .Sh NAME @@ -101,10 +101,6 @@ bluetooth configuration files gnats configuration files; see .Xr send-pr 1 -.It Pa isdn/ -isdn4bsd configuration files; -see -.Xr isdnd 8 .It Pa localtime local timezone information; see @@ -548,8 +544,6 @@ ASCII text files used by various games device description file for device name .It Pa info/ GNU Info hypertext system -.It Pa isdn/ -ISDN .It Pa locale/ localization files; see diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 0c944b183c8d..04d59e5a2829 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -229,7 +229,6 @@ WITHOUT_${var}= GPIB \ GROFF \ HTML \ - I4B \ INET6 \ INFO \ IPFILTER \ @@ -316,7 +315,6 @@ WITH_IDEA= GPIB \ GROFF \ HTML \ - I4B \ INET6 \ INFO \ INSTALLLIB \ diff --git a/sys/Makefile b/sys/Makefile index baf5cac4246e..04557563905b 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -9,7 +9,7 @@ SUBDIR= boot # Directories to include in cscope name file and TAGS. CSCOPEDIRS= boot bsm cam compat conf contrib crypto ddb dev fs gdb geom \ - gnu i4b isa kern libkern modules net net80211 netatalk \ + gnu isa kern libkern modules net net80211 netatalk \ netgraph netinet netinet6 netipsec netipx netnatm netncp \ netsmb nfs nfs4client nfsclient nfsserver opencrypto pccard \ pci rpc security sys ufs vm ${ARCHDIR} diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index e675b7301415..3ace852afd62 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -451,120 +451,6 @@ device ichwd device coretemp device k8temp -#--------------------------------------------------------------------------- -# ISDN4BSD -# -# See /usr/share/examples/isdn/ROADMAP for an introduction to isdn4bsd. -# -# i4b passive ISDN cards support contains the following hardware drivers: -# -# isic - Siemens/Infineon ISDN ISAC/HSCX/IPAC chipset driver -# iwic - Winbond W6692 PCI bus ISDN S/T interface controller -# ifpi - AVM Fritz!Card PCI driver -# ifpi2 - AVM Fritz!Card PCI version 2 driver -# itjc - Siemens ISAC / TJNet Tiger300/320 chipset -# -# i4b active ISDN cards support contains the following hardware drivers: -# -# iavc - AVM B1 PCI, AVM B1 ISA, AVM T1 -# -# Note that the ``options'' (if given) and ``device'' lines must BOTH -# be uncommented to enable support for a given card ! -# -# In addition to a hardware driver (and probably an option) the mandatory -# ISDN protocol stack devices and the mandatory support device must be -# enabled as well as one or more devices from the optional devices section. -# -#--------------------------------------------------------------------------- -# isic driver (Siemens/Infineon chipsets) -# -#XXX#device isic -# -# PCI bus Cards: -# -------------- -# -# ELSA MicroLink ISDN/PCI (same as ELSA QuickStep 1000pro PCI) -options ELSA_QS1PCI -# -#--------------------------------------------------------------------------- -# ifpi2 driver for AVM Fritz!Card PCI version 2 -# -# AVM Fritz!Card PCI version 2 -#XXX#device ifpi2 -# -#--------------------------------------------------------------------------- -# iwic driver for Winbond W6692 chipset -# -# ASUSCOM P-IN100-ST-D (and other Winbond W6692 based cards) -#XXX#device iwic -# -#--------------------------------------------------------------------------- -# itjc driver for Siemens ISAC / TJNet Tiger300/320 chipset -# -# Traverse Technologies NETjet-S -# Teles PCI-TJ -#XXX#device itjc -# -#--------------------------------------------------------------------------- -# iavc driver (AVM active cards, needs i4bcapi driver!) -# -#XXX#device iavc -# -#--------------------------------------------------------------------------- -# ISDN Protocol Stack - mandatory for all hardware drivers -# -# Q.921 / layer 2 - i4b passive cards D channel handling -#XXX#device i4bq921 -# -# Q.931 / layer 3 - i4b passive cards D channel handling -#XXX#device i4bq931 -# -# layer 4 - i4b common passive and active card handling -#XXX#device i4b -# -#--------------------------------------------------------------------------- -# ISDN devices - mandatory for all hardware drivers -# -# userland driver to do ISDN tracing (for passive cards only) -#XXX#device i4btrc -#XXX#options NI4BTRC=4 -# -# userland driver to control the whole thing -#XXX#device i4bctl -# -#--------------------------------------------------------------------------- -# ISDN devices - optional -# -# userland driver for access to raw B channel -#XXX#device i4brbch -#XXX#options NI4BRBCH=4 -# -# userland driver for telephony -#XXX#device i4btel -#XXX#options NI4BTEL=2 -# -# network driver for IP over raw HDLC ISDN -#XXX#device i4bipr -#XXX#options NI4BIPR=4 -# enable VJ header compression detection for ipr i/f -#XXX#options IPR_VJ -# enable logging of the first n IP packets to isdnd (n=32 here) -#XXX#options IPR_LOG=32 -# -# network driver for sync PPP over ISDN; requires an equivalent -# number of sppp device to be configured -#XXX#device i4bisppp -#XXX#options NI4BISPPP=4 -# -# B-channel interface to the netgraph subsystem -#XXX#device i4bing -#XXX#options NI4BING=2 -# -# CAPI driver needed for active ISDN cards (see iavc driver above) -#XXX#device i4bcapi -# -#--------------------------------------------------------------------------- - # # System Management Bus (SMB) # diff --git a/sys/conf/files b/sys/conf/files index 4b9afc722894..4e1dbc58d31a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1511,62 +1511,6 @@ gnu/fs/reiserfs/reiserfs_stree.c optional reiserfs gnu/fs/reiserfs/reiserfs_vfsops.c optional reiserfs gnu/fs/reiserfs/reiserfs_vnops.c optional reiserfs # -# isdn4bsd device drivers -# -i4b/driver/i4b_trace.c optional i4btrc -i4b/driver/i4b_rbch.c optional i4brbch -i4b/driver/i4b_tel.c optional i4btel -#XXXBZ#i4b/driver/i4b_ipr.c optional i4bipr -net/slcompress.c optional i4bipr | i4bisppp -i4b/driver/i4b_ctl.c optional i4bctl -#XXXBZ#i4b/driver/i4b_ing.c optional i4bing -#XXXBZ#i4b/driver/i4b_isppp.c optional i4bisppp -# -# isdn4bsd CAPI driver -# -i4b/capi/capi_l4if.c optional i4bcapi -i4b/capi/capi_llif.c optional i4bcapi -i4b/capi/capi_msgs.c optional i4bcapi -# -# isdn4bsd AVM B1/T1 CAPI driver -# -i4b/capi/iavc/iavc_pci.c optional iavc i4bcapi pci -i4b/capi/iavc/iavc_isa.c optional iavc i4bcapi isa -i4b/capi/iavc/iavc_lli.c optional iavc i4bcapi -i4b/capi/iavc/iavc_card.c optional iavc i4bcapi -# -# isdn4bsd support -# -i4b/layer2/i4b_mbuf.c optional i4btrc -# -# isdn4bsd Q.921 handler -# -i4b/layer2/i4b_l2.c optional i4bq921 -i4b/layer2/i4b_l2fsm.c optional i4bq921 -i4b/layer2/i4b_uframe.c optional i4bq921 -i4b/layer2/i4b_tei.c optional i4bq921 -i4b/layer2/i4b_sframe.c optional i4bq921 -i4b/layer2/i4b_iframe.c optional i4bq921 -i4b/layer2/i4b_l2timer.c optional i4bq921 -i4b/layer2/i4b_util.c optional i4bq921 -i4b/layer2/i4b_lme.c optional i4bq921 -# -# isdn4bsd Q.931 handler -# -i4b/layer3/i4b_q931.c optional i4bq931 -i4b/layer3/i4b_l3fsm.c optional i4bq931 -i4b/layer3/i4b_l3timer.c optional i4bq931 -i4b/layer3/i4b_l2if.c optional i4bq931 -i4b/layer3/i4b_l4if.c optional i4bq931 -i4b/layer3/i4b_q932fac.c optional i4bq931 -# -# isdn4bsd control device driver, interface to isdnd -# -i4b/layer4/i4b_i4bdrv.c optional i4b -i4b/layer4/i4b_l4.c optional i4b -i4b/layer4/i4b_l4mgmt.c optional i4b -i4b/layer4/i4b_l4timer.c optional i4b -# isa/isa_if.m standard isa/isa_common.c optional isa isa/isahint.c optional isa @@ -1814,8 +1758,8 @@ net/if_media.c standard net/if_mib.c standard net/if_ppp.c optional ppp net/if_sl.c optional sl -net/if_spppfr.c optional i4bisppp | sppp | netgraph_sppp -net/if_spppsubr.c optional i4bisppp | sppp | netgraph_sppp +net/if_spppfr.c optional sppp | netgraph_sppp +net/if_spppsubr.c optional sppp | netgraph_sppp net/if_stf.c optional stf net/if_tun.c optional tun net/if_tap.c optional tap diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index afc7a914e774..292d273d802d 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -366,83 +366,6 @@ i386/svr4/svr4_locore.s optional compat_svr4 \ warning "COMPAT_SVR4 is broken and should be avoided" i386/svr4/svr4_machdep.c optional compat_svr4 # -# isdn4bsd, needed for isic | iwic | ifpi | ifpi2 | ihfc | ifpnp | itjc -# -i4b/layer1/i4b_hdlc.c optional ihfc | itjc -i4b/layer1/i4b_l1dmux.c optional ifpi | ifpi2 | ifpnp | \ - ihfc | isic | itjc | iwic -i4b/layer1/i4b_l1lib.c optional ifpi | ifpi2 | ifpnp | \ - ihfc | isic | itjc | iwic -# -# isdn4bsd, isic -# -i4b/layer1/isic/i4b_asuscom_ipac.c optional isic -i4b/layer1/isic/i4b_avm_a1.c optional isic -i4b/layer1/isic/i4b_bchan.c optional isic -i4b/layer1/isic/i4b_ctx_s0P.c optional isic -i4b/layer1/isic/i4b_drn_ngo.c optional isic -i4b/layer1/isic/i4b_dynalink.c optional isic -i4b/layer1/isic/i4b_elsa_qs1i.c optional isic -i4b/layer1/isic/i4b_elsa_qs1p.c optional isic pci -i4b/layer1/isic/i4b_elsa_pcc16.c optional isic -i4b/layer1/isic/i4b_hscx.c optional isic -i4b/layer1/isic/i4b_isac.c optional isic -i4b/layer1/isic/i4b_isic.c optional isic -i4b/layer1/isic/i4b_isic_isa.c optional isic -i4b/layer1/isic/i4b_isic_pnp.c optional isic -i4b/layer1/isic/i4b_itk_ix1.c optional isic -i4b/layer1/isic/i4b_l1.c optional isic -i4b/layer1/isic/i4b_l1fsm.c optional isic -i4b/layer1/isic/i4b_siemens_isurf.c optional isic -i4b/layer1/isic/i4b_sws.c optional isic -i4b/layer1/isic/i4b_tel_s016.c optional isic -i4b/layer1/isic/i4b_tel_s0163.c optional isic -i4b/layer1/isic/i4b_tel_s08.c optional isic -i4b/layer1/isic/i4b_usr_sti.c optional isic -i4b/layer1/isic/i4b_diva.c optional isic -# -# isdn4bsd, iwic -# -i4b/layer1/iwic/i4b_iwic_pci.c optional iwic pci -i4b/layer1/iwic/i4b_iwic_dchan.c optional iwic pci -i4b/layer1/iwic/i4b_iwic_bchan.c optional iwic pci -i4b/layer1/iwic/i4b_iwic_fsm.c optional iwic pci -i4b/layer1/iwic/i4b_iwic_l1if.c optional iwic pci -# -# isdn4bsd, ifpi -# -i4b/layer1/ifpi/i4b_ifpi_pci.c optional ifpi pci -i4b/layer1/ifpi/i4b_ifpi_isac.c optional ifpi pci -i4b/layer1/ifpi/i4b_ifpi_l1.c optional ifpi pci -i4b/layer1/ifpi/i4b_ifpi_l1fsm.c optional ifpi pci -# -# isdn4bsd, ifpi2 -# -i4b/layer1/ifpi2/i4b_ifpi2_pci.c optional ifpi2 pci -i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c optional ifpi2 pci -i4b/layer1/ifpi2/i4b_ifpi2_l1.c optional ifpi2 pci -i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c optional ifpi2 pci -# -# isdn4bsd, ifpnp -# -i4b/layer1/ifpnp/i4b_ifpnp_avm.c optional ifpnp -i4b/layer1/ifpnp/i4b_ifpnp_isac.c optional ifpnp -i4b/layer1/ifpnp/i4b_ifpnp_l1.c optional ifpnp -i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c optional ifpnp -# -# isdn4bsd, ihfc -# -i4b/layer1/ihfc/i4b_ihfc_l1if.c optional ihfc -i4b/layer1/ihfc/i4b_ihfc_pnp.c optional ihfc -i4b/layer1/ihfc/i4b_ihfc_drv.c optional ihfc -# -# isdn4bsd, itjc -# -i4b/layer1/itjc/i4b_itjc_pci.c optional itjc -i4b/layer1/itjc/i4b_itjc_isac.c optional itjc -i4b/layer1/itjc/i4b_itjc_l1.c optional itjc -i4b/layer1/itjc/i4b_itjc_l1fsm.c optional itjc -# isa/atrtc.c standard isa/syscons_isa.c optional sc isa/vga_isa.c optional vga diff --git a/sys/conf/files.pc98 b/sys/conf/files.pc98 index 97d85f6d1a12..68638c84ae30 100644 --- a/sys/conf/files.pc98 +++ b/sys/conf/files.pc98 @@ -237,83 +237,6 @@ i386/svr4/svr4_locore.s optional compat_svr4 \ warning "COMPAT_SVR4 is broken and should be avoided" i386/svr4/svr4_machdep.c optional compat_svr4 # -# isdn4bsd, needed for isic | iwic | ifpi | ifpi2 | ihfc | ifpnp | itjc -# -i4b/layer1/i4b_hdlc.c optional ihfc | itjc -i4b/layer1/i4b_l1dmux.c optional ifpi | ifpi2 | ifpnp | \ - ihfc | isic | itjc | iwic -i4b/layer1/i4b_l1lib.c optional ifpi | ifpi2 | ifpnp | \ - ihfc | isic | itjc | iwic -# -# isdn4bsd, isic -# -i4b/layer1/isic/i4b_asuscom_ipac.c optional isic -i4b/layer1/isic/i4b_avm_a1.c optional isic -i4b/layer1/isic/i4b_bchan.c optional isic -i4b/layer1/isic/i4b_ctx_s0P.c optional isic -i4b/layer1/isic/i4b_drn_ngo.c optional isic -i4b/layer1/isic/i4b_dynalink.c optional isic -i4b/layer1/isic/i4b_elsa_qs1i.c optional isic -i4b/layer1/isic/i4b_elsa_qs1p.c optional isic pci -i4b/layer1/isic/i4b_elsa_pcc16.c optional isic -i4b/layer1/isic/i4b_hscx.c optional isic -i4b/layer1/isic/i4b_isac.c optional isic -i4b/layer1/isic/i4b_isic.c optional isic -i4b/layer1/isic/i4b_isic_isa.c optional isic -i4b/layer1/isic/i4b_isic_pnp.c optional isic -i4b/layer1/isic/i4b_itk_ix1.c optional isic -i4b/layer1/isic/i4b_l1.c optional isic -i4b/layer1/isic/i4b_l1fsm.c optional isic -i4b/layer1/isic/i4b_siemens_isurf.c optional isic -i4b/layer1/isic/i4b_sws.c optional isic -i4b/layer1/isic/i4b_tel_s016.c optional isic -i4b/layer1/isic/i4b_tel_s0163.c optional isic -i4b/layer1/isic/i4b_tel_s08.c optional isic -i4b/layer1/isic/i4b_usr_sti.c optional isic -i4b/layer1/isic/i4b_diva.c optional isic -# -# isdn4bsd, iwic -# -i4b/layer1/iwic/i4b_iwic_pci.c optional iwic pci -i4b/layer1/iwic/i4b_iwic_dchan.c optional iwic pci -i4b/layer1/iwic/i4b_iwic_bchan.c optional iwic pci -i4b/layer1/iwic/i4b_iwic_fsm.c optional iwic pci -i4b/layer1/iwic/i4b_iwic_l1if.c optional iwic pci -# -# isdn4bsd, ifpi -# -i4b/layer1/ifpi/i4b_ifpi_pci.c optional ifpi pci -i4b/layer1/ifpi/i4b_ifpi_isac.c optional ifpi pci -i4b/layer1/ifpi/i4b_ifpi_l1.c optional ifpi pci -i4b/layer1/ifpi/i4b_ifpi_l1fsm.c optional ifpi pci -# -# isdn4bsd, ifpi2 -# -i4b/layer1/ifpi2/i4b_ifpi2_pci.c optional ifpi2 pci -i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c optional ifpi2 pci -i4b/layer1/ifpi2/i4b_ifpi2_l1.c optional ifpi2 pci -i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c optional ifpi2 pci -# -# isdn4bsd, ifpnp -# -i4b/layer1/ifpnp/i4b_ifpnp_avm.c optional ifpnp -i4b/layer1/ifpnp/i4b_ifpnp_isac.c optional ifpnp -i4b/layer1/ifpnp/i4b_ifpnp_l1.c optional ifpnp -i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c optional ifpnp -# -# isdn4bsd, ihfc -# -i4b/layer1/ihfc/i4b_ihfc_l1if.c optional ihfc -i4b/layer1/ihfc/i4b_ihfc_pnp.c optional ihfc -i4b/layer1/ihfc/i4b_ihfc_drv.c optional ihfc -# -# isdn4bsd, itjc -# -i4b/layer1/itjc/i4b_itjc_pci.c optional itjc -i4b/layer1/itjc/i4b_itjc_isac.c optional itjc -i4b/layer1/itjc/i4b_itjc_l1.c optional itjc -i4b/layer1/itjc/i4b_itjc_l1fsm.c optional itjc -# kern/imgact_aout.c optional compat_aout kern/imgact_gzip.c optional gzip libkern/divdi3.c standard diff --git a/sys/conf/options b/sys/conf/options index 8be2ed79a675..7e5c9c5c5916 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -743,14 +743,6 @@ DCONS_POLL_HZ opt_dcons.h DCONS_FORCE_CONSOLE opt_dcons.h DCONS_FORCE_GDB opt_dcons.h -# Static unit counts -NI4BTRC opt_i4b.h -NI4BRBCH opt_i4b.h -NI4BTEL opt_i4b.h -#XXXBZ#NI4BIPR opt_i4b.h -#XXXBZ#NI4BING opt_i4b.h -#XXXBZ#NI4BISPPP opt_i4b.h - # VFS options LOOKUP_SHARED opt_vfs.h diff --git a/sys/conf/options.amd64 b/sys/conf/options.amd64 index 00faf9596cff..9a5e7ddf66e0 100644 --- a/sys/conf/options.amd64 +++ b/sys/conf/options.amd64 @@ -39,19 +39,6 @@ VGA_WIDTH90 opt_vga.h ATKBD_DFLT_KEYMAP opt_atkbd.h -# ------------------------------- -# isdn4bsd: passive PCI cards -# ------------------------------- -ELSA_QS1PCI opt_i4b.h -# ------------------------------- -# isdn4bsd: misc options -# ------------------------------- -# temporary workaround for SMP machines -I4B_SMP_WORKAROUND opt_i4b.h -# enable VJ compression code for ipr i/f -#XXXBZ#IPR_VJ opt_i4b.h -#XXXBZ#IPR_LOG opt_i4b.h - # ------------------------------- # EOF # ------------------------------- diff --git a/sys/conf/options.i386 b/sys/conf/options.i386 index 8cdaa5efc52a..5d8e0b77f520 100644 --- a/sys/conf/options.i386 +++ b/sys/conf/options.i386 @@ -102,42 +102,6 @@ SPIGOT_UNSECURE opt_spigot.h # Enables NETGRAPH support for Cronyx adapters NETGRAPH_CRONYX opt_ng_cronyx.h -# ------------------------------- -# isdn4bsd: passive ISA cards -# ------------------------------- -TEL_S0_8 opt_i4b.h -TEL_S0_16 opt_i4b.h -TEL_S0_16_3 opt_i4b.h -AVM_A1 opt_i4b.h -USR_STI opt_i4b.h -ITKIX1 opt_i4b.h -ELSA_PCC16 opt_i4b.h -# ------------------------------- -# isdn4bsd: passive ISA PnP cards -# ------------------------------- -CRTX_S0_P opt_i4b.h -DRN_NGO opt_i4b.h -TEL_S0_16_3_P opt_i4b.h -SEDLBAUER opt_i4b.h -DYNALINK opt_i4b.h -ASUSCOM_IPAC opt_i4b.h -ELSA_QS1ISA opt_i4b.h -SIEMENS_ISURF2 opt_i4b.h -EICON_DIVA opt_i4b.h -COMPAQ_M610 opt_i4b.h -# ------------------------------- -# isdn4bsd: passive PCI cards -# ------------------------------- -ELSA_QS1PCI opt_i4b.h -# ------------------------------- -# isdn4bsd: misc options -# ------------------------------- -# temporary workaround for SMP machines -I4B_SMP_WORKAROUND opt_i4b.h -# enable VJ compression code for ipr i/f -#XXXBZ#IPR_VJ opt_i4b.h -#XXXBZ#IPR_LOG opt_i4b.h - # Device options DEV_APIC opt_apic.h DEV_NPX opt_npx.h diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98 index d910ff264e2d..d0c8bbba4633 100644 --- a/sys/conf/options.pc98 +++ b/sys/conf/options.pc98 @@ -77,19 +77,6 @@ SPIGOT_UNSECURE opt_spigot.h # Enables NETGRAPH support for Cronyx adapters NETGRAPH_CRONYX opt_ng_cronyx.h -# ------------------------------- -# isdn4bsd: passive PCI cards -# ------------------------------- -ELSA_QS1PCI opt_i4b.h -# ------------------------------- -# isdn4bsd: misc options -# ------------------------------- -# temporary workaround for SMP machines -I4B_SMP_WORKAROUND opt_i4b.h -# enable VJ compression code for ipr i/f -#XXXBZ#IPR_VJ opt_i4b.h -#XXXBZ#IPR_LOG opt_i4b.h - # ct driver options CT_BUS_WEIGHT opt_ct.h CT_USE_RELOCATE_OFFSET opt_ct.h diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 889f21fe5624..2e877a6108b0 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -856,235 +856,6 @@ device ichwd # device coretemp -#--------------------------------------------------------------------------- -# ISDN4BSD -# -# See /usr/share/examples/isdn/ROADMAP for an introduction to isdn4bsd. -# -# i4b passive ISDN cards support contains the following hardware drivers: -# -# isic - Siemens/Infineon ISDN ISAC/HSCX/IPAC chipset driver -# iwic - Winbond W6692 PCI bus ISDN S/T interface controller -# ifpi - AVM Fritz!Card PCI driver -# ifpi2 - AVM Fritz!Card PCI version 2 driver -# ihfc - Cologne Chip HFC ISA/ISA-PnP chipset driver -# ifpnp - AVM Fritz!Card PnP driver -# itjc - Siemens ISAC / TJNet Tiger300/320 chipset -# -# i4b active ISDN cards support contains the following hardware drivers: -# -# iavc - AVM B1 PCI, AVM B1 ISA, AVM T1 -# -# Note that the ``options'' (if given) and ``device'' lines must BOTH -# be uncommented to enable support for a given card ! -# -# In addition to a hardware driver (and probably an option) the mandatory -# ISDN protocol stack devices and the mandatory support device must be -# enabled as well as one or more devices from the optional devices section. -# -#--------------------------------------------------------------------------- -# isic driver (Siemens/Infineon chipsets) -# -device isic -# -# ISA bus non-PnP Cards: -# ---------------------- -# -# Teles S0/8 or Niccy 1008 -options TEL_S0_8 -hint.isic.0.at="isa" -hint.isic.0.maddr="0xd0000" -hint.isic.0.irq="5" -hint.isic.0.flags="1" -# -# Teles S0/16 or Creatix ISDN-S0 or Niccy 1016 -options TEL_S0_16 -hint.isic.0.at="isa" -hint.isic.0.port="0xd80" -hint.isic.0.maddr="0xd0000" -hint.isic.0.irq="5" -hint.isic.0.flags="2" -# -# Teles S0/16.3 -options TEL_S0_16_3 -hint.isic.0.at="isa" -hint.isic.0.port="0xd80" -hint.isic.0.irq="5" -hint.isic.0.flags="3" -# -# AVM A1 or AVM Fritz!Card -options AVM_A1 -hint.isic.0.at="isa" -hint.isic.0.port="0x340" -hint.isic.0.irq="5" -hint.isic.0.flags="4" -# -# USRobotics Sportster ISDN TA intern -options USR_STI -hint.isic.0.at="isa" -hint.isic.0.port="0x268" -hint.isic.0.irq="5" -hint.isic.0.flags="7" -# -# ITK ix1 Micro ( < V.3, non-PnP version ) -options ITKIX1 -hint.isic.0.at="isa" -hint.isic.0.port="0x398" -hint.isic.0.irq="10" -hint.isic.0.flags="18" -# -# ELSA PCC-16 -options ELSA_PCC16 -hint.isic.0.at="isa" -hint.isic.0.port="0x360" -hint.isic.0.irq="10" -hint.isic.0.flags="20" -# -# ISA bus PnP Cards: -# ------------------ -# -# Teles S0/16.3 PnP -options TEL_S0_16_3_P -# -# Creatix ISDN-S0 P&P -options CRTX_S0_P -# -# Dr. Neuhaus Niccy Go@ -options DRN_NGO -# -# Sedlbauer Win Speed -options SEDLBAUER -# -# Dynalink IS64PH -options DYNALINK -# -# ELSA QuickStep 1000pro ISA -options ELSA_QS1ISA -# -# Siemens I-Surf 2.0 -options SIEMENS_ISURF2 -# -# Asuscom ISDNlink 128K ISA -options ASUSCOM_IPAC -# -# Eicon Diehl DIVA 2.0 and 2.02 -options EICON_DIVA -# -# Compaq Microcom 610 ISDN card (Compaq series PSB2222I) -options COMPAQ_M610 -# -# PCI bus Cards: -# -------------- -# -# ELSA MicroLink ISDN/PCI (same as ELSA QuickStep 1000pro PCI) -options ELSA_QS1PCI -# -#--------------------------------------------------------------------------- -# ifpnp driver for AVM Fritz!Card PnP -# -# AVM Fritz!Card PnP -device ifpnp -# -#--------------------------------------------------------------------------- -# ihfc driver for Cologne Chip ISA chipsets (experimental!) -# -# Teles 16.3c ISA PnP -# AcerISDN P10 ISA PnP -# TELEINT ISDN SPEED No.1 -device ihfc -# -#--------------------------------------------------------------------------- -# ifpi driver for AVM Fritz!Card PCI -# -# AVM Fritz!Card PCI -device ifpi -# -#--------------------------------------------------------------------------- -# ifpi2 driver for AVM Fritz!Card PCI version 2 -# -# AVM Fritz!Card PCI version 2 -device ifpi2 -# -#--------------------------------------------------------------------------- -# iwic driver for Winbond W6692 chipset -# -# ASUSCOM P-IN100-ST-D (and other Winbond W6692 based cards) -device iwic -# -#--------------------------------------------------------------------------- -# itjc driver for Siemens ISAC / TJNet Tiger300/320 chipset -# -# Traverse Technologies NETjet-S -# Teles PCI-TJ -device itjc -# -#--------------------------------------------------------------------------- -# iavc driver (AVM active cards, needs i4bcapi driver!) -# -device iavc -# -# AVM B1 ISA bus (PnP mode not supported!) -# ---------------------------------------- -hint.iavc.0.at="isa" -hint.iavc.0.port="0x150" -hint.iavc.0.irq="5" -# -#--------------------------------------------------------------------------- -# ISDN Protocol Stack - mandatory for all hardware drivers -# -# Q.921 / layer 2 - i4b passive cards D channel handling -device i4bq921 -# -# Q.931 / layer 3 - i4b passive cards D channel handling -device i4bq931 -# -# layer 4 - i4b common passive and active card handling -device i4b -# -#--------------------------------------------------------------------------- -# ISDN devices - mandatory for all hardware drivers -# -# userland driver to do ISDN tracing (for passive cards only) -device i4btrc -options NI4BTRC=4 -# -# userland driver to control the whole thing -device i4bctl -# -#--------------------------------------------------------------------------- -# ISDN devices - optional -# -# userland driver for access to raw B channel -device i4brbch -options NI4BRBCH=4 -# -# userland driver for telephony -device i4btel -options NI4BTEL=2 -# -#XXXBZ# IPR and ISPPP are not usable until I4B is locked. -# network driver for IP over raw HDLC ISDN -#XXXBZ#device i4bipr -#XXXBZ#options NI4BIPR=4 -# enable VJ header compression detection for ipr i/f -#XXXBZ#options IPR_VJ -# enable logging of the first n IP packets to isdnd (n=32 here) -#XXXBZ#options IPR_LOG=32 -# -# network driver for sync PPP over ISDN; requires an equivalent -# number of sppp device to be configured -#XXXBZ#device i4bisppp -#XXXBZ#options NI4BISPPP=4 -# -# B-channel interface to the netgraph subsystem -#XXXBZ#device i4bing -#XXXBZ#options NI4BING=2 -# -# CAPI driver needed for active ISDN cards (see iavc driver above) -device i4bcapi -# -#--------------------------------------------------------------------------- - # # System Management Bus (SMB) # @@ -1200,7 +971,6 @@ options FB_INSTALL_CDEV # install a CDEV entry in /dev options PECOFF_SUPPORT options PECOFF_DEBUG -options I4B_SMP_WORKAROUND options I586_PMC_GUPROF=0x70000 options KBDIO_DEBUG=2 options KBD_MAXRETRY=4 diff --git a/sys/i4b/capi/README b/sys/i4b/capi/README deleted file mode 100644 index 91685258e161..000000000000 --- a/sys/i4b/capi/README +++ /dev/null @@ -1,150 +0,0 @@ -$FreeBSD$ - -Message-ID: <3AF56886.7D92609A@cubical.fi> -Date: Sun, 06 May 2001 18:06:47 +0300 -From: Juha-Matti Liukkonen -Organization: Cubical Solutions Ltd - -Please find the attached diff and tarball for our support software for -CAPI 2.0 and AVM's active T1 and T1-B (primary rate) and B1 (basic rate) -ISDN adapters for isdn4bsd. The implementation has been made from -scratch by us, based on reverse engineering of the Linux driver provided -by AVM GmbH and available in ftp.avm.de. Cubical Solutions Ltd offers -this implementation for the BSD community free of charge and assuming -absolutely no liabilities whatsoever. Feel free to modify the -implementation any way you see fit, but please retain our one-liner -copyright statement somewhere in the comment headers in the capi and -iavc driver modules. - -That said, the attached tarball is i4b-00.96.00-beta with our -modifications integrated, and the diff contains all modifications we -have made to the original (including the new capi files). Our mods add -pseudo-device i4bcapi, which attaches to i4b layer 4, and device iavc0, -which implements a link layer driver for AVM's active B1 and T1 adapters -for i4bcapi. There are also a couple of related improvements to isdnd, -and a number of modifications to isdnd and layer 4 to implement support -for up to 30 channels per adapter (for primary rate use). - -We have developed the software explicitly for our telephony application, -to be used with AVM's T1 adapters, and the implementation has been -tested primarily with this functionality in mind. There may be -interesting side effects with eg. the ipr and isppp drivers; we do not -use them and therefore their testing has been cursory at best. The -i4btel driver works well with the T1 (our primary use), and the i4brbch -driver has been verified to work with T1, T1-B and B1 adapters (ftp'd -some files over a dialup PPP connection with each adapter). Only the PCI -versions of the adapters (equipped with the AMCC DMA controller) are -supported, although the basics (PIO mode communication) for the older -ISA model support is in place, so only the bus attachment modules should -be required to support the older hardware. - -All of the AVM active adapters use downloadable firmware, which is not -included in the attached package. The firmware files (t1.t4, t1b.t4, -b1.t4) can be found from ftp.avm.de in adapter specific subdirectories, -or from the CDs provided with the adapters (in directory -'cardware/firmware'). - -Our primary development platform is our own embedded build (we call it -'ebsd') based on FreeBSD 4.2-RELEASE. The implementation has also been -tested on standard FreeBSD 4.2-RELEASE system. The implementation should -not contain any FreeBSD (or even FreeBSD release) specific issues, but -it has not been tested or even compiled on any other platforms; -specifically, only the FreeBSD overinstall.sh script is modified to -install the capi/iavc support in the kernel source tree. - -This code is not under active development here since the functionality -we use (i4btel, T1) has been working since the beginning of March. We -are also not planning on any further development (no need seen at this -point), but I am naturally interested on whatever bugs and development -ideas pop up on the community and will keep a keen eye on the isdn -mailing list. I personally may be available for consultation, debugging -and possibly development projects, but with notable reservations on my -time (the current IT industry recession seems to be pushing even more -work for us, which tends to keep us pretty busy these days). - -Here are some specific technical notes: - -* isdnd supports new keyword 'firmware=' in section -'controller'. This keyword is supported for all controller types, and -causes I4B_CTRL_DOWNLOAD ioctl to be invoked with the specified file as -an argument. In systems equipped with both active and passive adapters, -and the passive cards being detected first, dummy 'controller' entries -are required for the passive cards to get the correct firmwares to -correct adapters. (I hope you did not have other uses for this ioctl in -mind?) - -* isdnd supports new keyword 'clone=' in section 'entry'. -This causes the entry to be copied from the existing named entry. At -least entry specific 'name' and 'usrdeviceunit' values should be -specified after a 'clone'. (Makes configuring 30 or 60 entries way much -easier.) - -* a bug in i4btel driver read routine corrected. The conditions in the -while() clause caused the receive queue to be referenced before checking -if a channel is connected, leading to kernel panic (do a 'dd -if=/dev/i4btel0 of=/dev/null' on an unconnected tel device, panic will -follow). Correction was to reorder the while clause conditions to check -for connectedness first. - -* isdnd and i4b layer 4 support up to CHANNELS_MAX (=30) channels per -adapter. The msg_ctrl_info_req_t message reports the number of channels -provided by the adapter, the number is stored in the nbchan field of the -controller state structure. The fixed stateb1 and stateb2 entries in -controller state stuctures are replaced with an array, and all fixed -references there are replaced with loops up to nbchan. Passive stack -layer 1 and 2 are not modified, layer 3 sets this field to fixed value 2 -for all adapters (but it could be delegated to the layer 1 driver's -attach request). - -* the i4bcapi driver maps i4b channels to logical channels identified -with PLCI/NCCI values in the CAPI protocol using the sc_bchan[] array. -The PLCI/NCCI handling is merged in the channel mapping and is greatly -simplified from the reference state machine model, because in practice -there can be only one PLCI/NCCI per channel active at any given time. - -* the i4bcapi driver does not provide any kind of user level interface -(such as the /dev/capi20 interface provided by the linux driver), but -could relatively easily be extended to do so (and if done, interface -compatibility with the linux implementation would probably be a good -goal). - -* there are some gritty details in the iavc driver, inherited from the -linux code. Despite us being a legitimate company in the telecom -business, AVM failed to produce any programming reference material for -us (at least in a reasonable time frame), so some guesswork remains due -to classic reverse engineering process (particularly there are a few -magic numbers in the card initialization sequence whose meaning I do not -know). - -* pseudo-devices i4bq931, i4bq921 and some passive stack layer 1 driver -(such as iwic) are required to compile, as the required ctrl_desc[] -array is in layer 3, which requires layer 2, which requires layer 1. -Some architectural cleanup would come in handy here, but we did not want -to start making any major changes (and we use iwic in test setups -anyway, so we simply always compile it in). - -To summarize: unpack, overinstall, add the following lines (with the -usual passive stack configuration including at least one L1 driver) to -your kernel configuration file: - -pseudo-device "i4bcapi" -device iavc0 - -...and the following to your isdnd.rc: - -controller -firmware = /usr/lib/isdn/b1.t4 - -...compile your new kernel, make sure the firmware file is in -/usr/lib/isdn, and your B1 adapter should boot up and Just Work (tm). If -you have multiple adapters, you need a 'controller' section for each to -have them loaded and booted on isdnd startup. - -Have fun -- and let me know if there are any complications, or if I can -be of further assistance, - - - Juha --- -Juha-Matti Liukkonen, Cubical Solutions Ltd -Phone: +358(0)405280142 -Email: jml@cubical.fi diff --git a/sys/i4b/capi/capi.h b/sys/i4b/capi/capi.h deleted file mode 100644 index c6dc9e87edd9..000000000000 --- a/sys/i4b/capi/capi.h +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/capi.h The CAPI device interface. - * - * $FreeBSD$ - */ - -#ifndef _I4B_CAPI_H_ -#define _I4B_CAPI_H_ - -/* -// CAPI driver context: B channels and controller softcs. -*/ - -#define INVALID -1 - -enum capi_b_state { - B_FREE, /* channel free, ncci invalid */ - B_CONNECT_CONF, /* wait for CONNECT_CONF */ - B_CONNECT_IND, /* IND got, wait for appl RESP */ - B_CONNECT_ACTIVE_IND, /* wait for CONNECT_ACTIVE_IND */ - B_CONNECT_B3_CONF, /* wait for CONNECT_B3_CONF */ - B_CONNECT_B3_IND, /* wait for CONNECT_B3_IND */ - B_CONNECT_B3_ACTIVE_IND, /* wait for CONNECT_B3_ACTIVE_IND */ - B_CONNECTED, /* channel connected & in use */ - B_DISCONNECT_CONF, /* wait for DISCONNECT_CONF */ - B_DISCONNECT_B3_CONF, /* wait for DISCONNECT_B3_CONF */ - B_DISCONNECT_IND, /* wait for DISCONNECT_IND */ -}; - -typedef struct capi_bchan -{ - /* Channel state */ - - int ncci; -#define CAPI_CTRL_MASK 0x000000ff -#define CAPI_PLCI_MASK 0x0000ffff -#define CAPI_NCCI_MASK 0xffff0000 - u_int16_t msgid; - int busy; - enum capi_b_state state; - - struct ifqueue tx_queue; - struct ifqueue rx_queue; - int rxcount; - int txcount; - - /* The rest is needed for i4b integration */ - - int bprot; - int cdid; - - struct mbuf *in_mbuf; - isdn_link_t capi_isdn_linktab; - drvr_link_t *capi_drvr_linktab; -} capi_bchan_t; - -enum capi_c_state { - C_DOWN, /* controller uninitialized */ - C_READY, /* controller initialized but not listening */ - C_UP, /* controller listening */ -}; - -typedef struct capi_softc { - int sc_unit; /* index in capi_sc[] */ - int ctrl_unit; /* index in isdn_ctrl_tab[] */ - int card_type; /* CARD_TYPEC_xxx, filled by ll driver */ - int sc_nbch; /* number of b channels on this controller */ - int sc_enabled; /* is daemon connected TRUE/FALSE */ - int sc_msgid; /* next CAPI message id */ - char sc_profile[64];/* CAPI profile data */ - enum capi_c_state sc_state; - - capi_bchan_t sc_bchan[MAX_BCHAN]; - - /* Link layer driver context holder and methods */ - - void *ctx; - - int (*load)(struct capi_softc *, int, u_int8_t *); - int (*reg_appl)(struct capi_softc *, int, int); - int (*rel_appl)(struct capi_softc *, int); - int (*send)(struct capi_softc *, struct mbuf *); -} capi_softc_t; - -extern capi_softc_t *capi_sc[]; -extern int ncapi; - -/* -// CAPI upcalls for the link layer. -*/ - -#define I4BCAPI_APPLID 1 - -extern int capi_ll_attach(capi_softc_t *); -extern int capi_ll_control(capi_softc_t *, int op, int arg); - -#define CAPI_CTRL_READY 0 /* ctrl ready, value=TRUE/FALSE */ -#define CAPI_CTRL_PROFILE 1 /* set CAPI profile */ -#define CAPI_CTRL_NEW_NCCI 2 /* new ncci value, assign bchan */ -#define CAPI_CTRL_FREE_NCCI 3 /* free ncci value, clear bchan */ - -extern int capi_ll_receive(capi_softc_t *, struct mbuf *); - -extern int capi_start_tx(capi_softc_t *, int bchan); - -#endif /* _I4B_CAPI_H_ */ diff --git a/sys/i4b/capi/capi_l4if.c b/sys/i4b/capi/capi_l4if.c deleted file mode 100644 index ef652640cfeb..000000000000 --- a/sys/i4b/capi/capi_l4if.c +++ /dev/null @@ -1,447 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/capi_l4if.c The CAPI i4b L4/device interface. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -static void n_connect_request(u_int cdid); -static void n_connect_response(u_int cdid, int response, int cause); -static void n_disconnect_request(u_int cdid, int cause); -static void n_alert_request(u_int cdid); -static void n_mgmt_command(int unit, int cmd, void *parm); -static int n_download(int unit, int, struct isdn_dr_prot *); - -capi_softc_t *capi_sc[MAX_CONTROLLERS] = { NULL, }; -int ncapi = 0; - -/* -// i4b_capi_{ret,set}_linktab -// i4b driver glue. -// -// i4b_capi_bch_config -// Called by i4b driver to flush + {en,dis}able a channel. -// -// i4b_capi_bch_start_tx -// Called by i4b driver to transmit a queued mbuf. -// -// i4b_capi_bch_stat -// Called by i4b driver to obtain statistics information. -*/ - -static isdn_link_t * -i4b_capi_ret_linktab(int unit, int channel) -{ - capi_softc_t *sc = capi_sc[unit]; - return &sc->sc_bchan[channel].capi_isdn_linktab; -} - -static void -i4b_capi_set_linktab(int unit, int channel, drvr_link_t *dlt) -{ - capi_softc_t *sc = capi_sc[unit]; - sc->sc_bchan[channel].capi_drvr_linktab = dlt; -} - -static void -i4b_capi_bch_config(int unit, int chan, int bprot, int activate) -{ - capi_softc_t *sc = capi_sc[unit]; - - i4b_Bcleanifq(&sc->sc_bchan[chan].tx_queue); - sc->sc_bchan[chan].tx_queue.ifq_maxlen = IFQ_MAXLEN; - sc->sc_bchan[chan].txcount = 0; - - /* The telephony drivers use rx_queue for receive. */ - - i4b_Bcleanifq(&sc->sc_bchan[chan].rx_queue); - sc->sc_bchan[chan].rx_queue.ifq_maxlen = IFQ_MAXLEN; - sc->sc_bchan[chan].rxcount = 0; - - /* HDLC frames are put to in_mbuf */ - - i4b_Bfreembuf(sc->sc_bchan[chan].in_mbuf); - sc->sc_bchan[chan].in_mbuf = NULL; - - /* Because of the difference, we need to remember the protocol. */ - - sc->sc_bchan[chan].bprot = bprot; - sc->sc_bchan[chan].busy = 0; -} - -static void -i4b_capi_bch_start_tx(int unit, int chan) -{ - capi_softc_t *sc = capi_sc[unit]; - int s; - - s = SPLI4B(); - - if (sc->sc_bchan[chan].state != B_CONNECTED) { - splx(s); - printf("capi%d: start_tx on unconnected channel\n", sc->sc_unit); - return; - } - - if (sc->sc_bchan[chan].busy) { - splx(s); - return; - } - - capi_start_tx(sc, chan); - - splx(s); -} - -static void -i4b_capi_bch_stat(int unit, int chan, bchan_statistics_t *bsp) -{ - capi_softc_t *sc = capi_sc[unit]; - int s = SPLI4B(); - - bsp->outbytes = sc->sc_bchan[chan].txcount; - bsp->inbytes = sc->sc_bchan[chan].rxcount; - - sc->sc_bchan[chan].txcount = 0; - sc->sc_bchan[chan].rxcount = 0; - - splx(s); -} - -int capi_start_tx(capi_softc_t *sc, int chan) -{ - struct mbuf *m_b3; - int sent = 0; - - _IF_DEQUEUE(&sc->sc_bchan[chan].tx_queue, m_b3); - while (m_b3) { - struct mbuf *m = m_b3->m_next; - - sc->sc_bchan[chan].txcount += m_b3->m_len; - capi_data_b3_req(sc, chan, m_b3); - sent++; - - m_b3 = m; - } - - if (sc->sc_bchan[chan].capi_drvr_linktab) { - /* Notify i4b driver of activity, and if the queue is drained. */ - - if (sent) - (*sc->sc_bchan[chan].capi_drvr_linktab->bch_activity)( - sc->sc_bchan[chan].capi_drvr_linktab->unit, ACT_TX); - - if (IF_QEMPTY(&sc->sc_bchan[chan].tx_queue)) - (*sc->sc_bchan[chan].capi_drvr_linktab->bch_tx_queue_empty)( - sc->sc_bchan[chan].capi_drvr_linktab->unit); - } - - return sent; -} - -/* -// capi_ll_attach -// Called by a link layer driver at boot time. -*/ - -int -capi_ll_attach(capi_softc_t *sc) -{ - int i; - - if (ncapi == (sizeof(capi_sc) / sizeof(capi_sc[0]))) { - printf("capi%d: too many units, increase MAX_CONTROLLERS\n", ncapi); - return (ENXIO); - } - - /* Unit type and subtype; sc is partly filled by ll driver */ - - ctrl_desc[nctrl].unit = ncapi; - ctrl_desc[nctrl].ctrl_type = CTRL_CAPI; - ctrl_desc[nctrl].card_type = sc->card_type; - - /* L4 callbacks */ - - ctrl_types[CTRL_CAPI].get_linktab = i4b_capi_ret_linktab; - ctrl_types[CTRL_CAPI].set_linktab = i4b_capi_set_linktab; - - ctrl_desc[nctrl].N_CONNECT_REQUEST = n_connect_request; - ctrl_desc[nctrl].N_CONNECT_RESPONSE = n_connect_response; - ctrl_desc[nctrl].N_DISCONNECT_REQUEST = n_disconnect_request; - ctrl_desc[nctrl].N_ALERT_REQUEST = n_alert_request; - ctrl_desc[nctrl].N_DOWNLOAD = n_download; - ctrl_desc[nctrl].N_DIAGNOSTICS = NULL; /* XXX todo */ - ctrl_desc[nctrl].N_MGMT_COMMAND = n_mgmt_command; - - /* Unit state */ - - sc->sc_enabled = FALSE; - sc->sc_state = C_DOWN; - sc->sc_msgid = 0; - - ctrl_desc[nctrl].dl_est = DL_DOWN; - ctrl_desc[nctrl].nbch = sc->sc_nbch; - - for (i = 0; i < sc->sc_nbch; i++) { - ctrl_desc[nctrl].bch_state[i] = BCH_ST_FREE; - sc->sc_bchan[i].ncci = INVALID; - sc->sc_bchan[i].msgid = 0; - sc->sc_bchan[i].busy = 0; - sc->sc_bchan[i].state = B_FREE; - - memset(&sc->sc_bchan[i].tx_queue, 0, sizeof(struct ifqueue)); - memset(&sc->sc_bchan[i].rx_queue, 0, sizeof(struct ifqueue)); - sc->sc_bchan[i].tx_queue.ifq_maxlen = IFQ_MAXLEN; - sc->sc_bchan[i].rx_queue.ifq_maxlen = IFQ_MAXLEN; - - if(!mtx_initialized(&sc->sc_bchan[i].tx_queue.ifq_mtx)) - mtx_init(&sc->sc_bchan[i].tx_queue.ifq_mtx, "i4b_capi_tx", NULL, MTX_DEF); - if(!mtx_initialized(&sc->sc_bchan[i].rx_queue.ifq_mtx)) - mtx_init(&sc->sc_bchan[i].rx_queue.ifq_mtx, "i4b_capi_rx", NULL, MTX_DEF); - - sc->sc_bchan[i].txcount = 0; - sc->sc_bchan[i].rxcount = 0; - - sc->sc_bchan[i].cdid = CDID_UNUSED; - sc->sc_bchan[i].bprot = BPROT_NONE; - sc->sc_bchan[i].in_mbuf = NULL; - - sc->sc_bchan[i].capi_drvr_linktab = NULL; - - sc->sc_bchan[i].capi_isdn_linktab.unit = ncapi; - sc->sc_bchan[i].capi_isdn_linktab.channel = i; - sc->sc_bchan[i].capi_isdn_linktab.bch_config = i4b_capi_bch_config; - sc->sc_bchan[i].capi_isdn_linktab.bch_tx_start = i4b_capi_bch_start_tx; - sc->sc_bchan[i].capi_isdn_linktab.bch_stat = i4b_capi_bch_stat; - sc->sc_bchan[i].capi_isdn_linktab.tx_queue = &sc->sc_bchan[i].tx_queue; - sc->sc_bchan[i].capi_isdn_linktab.rx_queue = &sc->sc_bchan[i].rx_queue; - sc->sc_bchan[i].capi_isdn_linktab.rx_mbuf = &sc->sc_bchan[i].in_mbuf; - } - - ctrl_desc[nctrl].tei = -1; - - /* Up the controller index and store the softc */ - - sc->sc_unit = ncapi; - capi_sc[ncapi++] = sc; - sc->ctrl_unit = nctrl++; - - printf("capi%d: card type %d attached\n", sc->sc_unit, sc->card_type); - - return(0); -} - -/* -// n_mgmt_command -// i4b L4 management command. -*/ - -static void -n_mgmt_command(int unit, int op, void *arg) -{ - capi_softc_t *sc = capi_sc[unit]; - - printf("capi%d: mgmt command %d\n", sc->sc_unit, op); - - switch(op) { - case CMR_DOPEN: - sc->sc_enabled = TRUE; - break; - - case CMR_DCLOSE: - sc->sc_enabled = FALSE; - break; - - case CMR_SETTRACE: - break; - - default: - break; - } -} - -/* -// n_connect_request -// i4b L4 wants to connect. We assign a B channel to the call, -// send a CAPI_CONNECT_REQ, and set the channel to B_CONNECT_CONF. -*/ - -static void -n_connect_request(u_int cdid) -{ - call_desc_t *cd = cd_by_cdid(cdid); - capi_softc_t *sc; - int bch, s; - - if (!cd) { - printf("capi?: invalid cdid %d\n", cdid); - return; - } - - sc = capi_sc[ctrl_desc[cd->controller].unit]; - bch = cd->channelid; - - s = SPLI4B(); - - if ((bch < 0) || (bch >= sc->sc_nbch)) - for (bch = 0; bch < sc->sc_nbch; bch++) - if (sc->sc_bchan[bch].state == B_FREE) - break; - - if (bch == sc->sc_nbch) { - splx(s); - printf("capi%d: no free B channel\n", sc->sc_unit); - return; - } - - cd->channelid = bch; - - capi_connect_req(sc, cd); - splx(s); -} - -/* -// n_connect_response -// i4b L4 answers a call. We send a CONNECT_RESP with the proper -// Reject code, and set the channel to B_CONNECT_B3_IND or B_FREE, -// depending whether we answer or not. -*/ - -static void -n_connect_response(u_int cdid, int response, int cause) -{ - call_desc_t *cd = cd_by_cdid(cdid); - capi_softc_t *sc; - int bch, s; - - if (!cd) { - printf("capi?: invalid cdid %d\n", cdid); - return; - } - - sc = capi_sc[ctrl_desc[cd->controller].unit]; - bch = cd->channelid; - - T400_stop(cd); - - cd->response = response; - cd->cause_out = cause; - - s = SPLI4B(); - capi_connect_resp(sc, cd); - splx(s); -} - -/* -// n_disconnect_request -// i4b L4 wants to disconnect. We send a DISCONNECT_REQ and -// set the channel to B_DISCONNECT_CONF. -*/ - -static void -n_disconnect_request(u_int cdid, int cause) -{ - call_desc_t *cd = cd_by_cdid(cdid); - capi_softc_t *sc; - int bch, s; - - if (!cd) { - printf("capi?: invalid cdid %d\n", cdid); - return; - } - - sc = capi_sc[ctrl_desc[cd->controller].unit]; - bch = cd->channelid; - - cd->cause_out = cause; - - s = SPLI4B(); - capi_disconnect_req(sc, cd); - splx(s); -} - -/* -// n_alert_request -// i4b L4 wants to alert an incoming call. We send ALERT_REQ. -*/ - -static void -n_alert_request(u_int cdid) -{ - call_desc_t *cd = cd_by_cdid(cdid); - capi_softc_t *sc; - int s; - - if (!cd) { - printf("capi?: invalid cdid %d\n", cdid); - return; - } - - sc = capi_sc[ctrl_desc[cd->controller].unit]; - - s = SPLI4B(); - capi_alert_req(sc, cd); - splx(s); -} - -/* -// n_download -// L4 -> firmware download -*/ - -static int -n_download(int unit, int numprotos, struct isdn_dr_prot *protocols) -{ - capi_softc_t *sc = capi_sc[unit]; - - if (sc->load) { - (*capi_sc[unit]->load)(sc, protocols[0].bytecount, - protocols[0].microcode); - } - - return(0); -} diff --git a/sys/i4b/capi/capi_llif.c b/sys/i4b/capi/capi_llif.c deleted file mode 100644 index 2eda986904a3..000000000000 --- a/sys/i4b/capi/capi_llif.c +++ /dev/null @@ -1,163 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/capi_llif.c The i4b CAPI link layer interface. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -/* -// capi_ll_control -// CAPI link layer control routine. Called by a link layer -// driver when its state changes. -*/ - -int -capi_ll_control(capi_softc_t *sc, int op, int arg) -{ - switch (op) { - case CAPI_CTRL_READY: - if (arg) { - sc->sc_state = C_READY; - - /* - * Register our CAPI ApplId and send CAPI_LISTEN_REQ - * with CIP Mask value 1 (match all). - */ - - sc->reg_appl(sc, I4BCAPI_APPLID, sc->sc_nbch); - capi_listen_req(sc, 0x10007); - - } else { - sc->sc_state = C_DOWN; - /* XXX go through cds and notify L4 of pdeact? XXX */ - } - break; - - case CAPI_CTRL_PROFILE: - bcopy((char*) arg, &sc->sc_profile, sizeof(sc->sc_profile)); - break; - - case CAPI_CTRL_NEW_NCCI: - case CAPI_CTRL_FREE_NCCI: - /* We ignore the controller's NCCI notifications. */ - break; - - default: - printf("capi%d: unknown control %d\n", sc->sc_unit, op); - } - - return 0; -} - -/* -// i4b_capi_handlers -// Array of message-handler pairs used to dispatch CAPI -// messages sent to I4BCAPI_APPLID. -*/ - -static struct capi_cmdtab { - u_int16_t cmd; - void (*handler)(capi_softc_t *, struct mbuf *); -} i4b_capi_handlers[] = { - { CAPI_LISTEN_CONF, capi_listen_conf }, - { CAPI_INFO_IND, capi_info_ind }, - { CAPI_ALERT_CONF, capi_alert_conf }, - { CAPI_CONNECT_CONF, capi_connect_conf }, - { CAPI_CONNECT_IND, capi_connect_ind }, - { CAPI_CONNECT_ACTIVE_IND, capi_connect_active_ind }, - { CAPI_CONNECT_B3_CONF, capi_connect_b3_conf }, - { CAPI_CONNECT_B3_IND, capi_connect_b3_ind }, - { CAPI_CONNECT_B3_ACTIVE_IND, capi_connect_b3_active_ind }, - { CAPI_DATA_B3_CONF, capi_data_b3_conf }, - { CAPI_DATA_B3_IND, capi_data_b3_ind }, - { CAPI_DISCONNECT_B3_IND, capi_disconnect_b3_ind }, - { CAPI_DISCONNECT_CONF, capi_disconnect_conf }, - { CAPI_DISCONNECT_IND, capi_disconnect_ind }, - { 0, 0 } -}; - -/* -// capi_ll_receive -// CAPI link layer receive upcall. Called by a link layer -// driver to dispatch incoming CAPI messages. -*/ - -int -capi_ll_receive(capi_softc_t *sc, struct mbuf *m) -{ - u_int8_t *p = mtod(m, u_int8_t*); - u_int16_t len, applid, msgid, cmd; - - capimsg_getu16(p + 0, &len); - capimsg_getu16(p + 2, &applid); - capimsg_getu16(p + 4, &cmd); - capimsg_getu16(p + 6, &msgid); - -#if 0 - printf("capi%d: ll_receive hdr %04x %04x %04x %04x\n", sc->sc_unit, - len, applid, cmd, msgid); -#endif - - if (applid == I4BCAPI_APPLID) { - struct capi_cmdtab *e; - for (e = i4b_capi_handlers; e->cmd && e->cmd != cmd; e++); - if (e->cmd) (*e->handler)(sc, m); - else printf("capi%d: unknown message %04x\n", sc->sc_unit, cmd); - - } else { - /* XXX we could handle arbitrary ApplIds here XXX */ - printf("capi%d: message %04x for unknown applid %d\n", sc->sc_unit, - cmd, applid); - } - - if (m->m_next) { - i4b_Bfreembuf(m->m_next); - m->m_next = NULL; - } - i4b_Dfreembuf(m); - return(0); -} diff --git a/sys/i4b/capi/capi_msgs.c b/sys/i4b/capi/capi_msgs.c deleted file mode 100644 index 78eae2944ce3..000000000000 --- a/sys/i4b/capi/capi_msgs.c +++ /dev/null @@ -1,950 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/capi_msgs.c The CAPI i4b message handlers. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -/* -// Administrative messages: -// ------------------------ -*/ - -void capi_listen_req(capi_softc_t *sc, u_int32_t CIP) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 18); - u_int8_t *msg; - u_int16_t msgid; - - if (!m) { - printf("capi%d: can't get mbuf for listen_req\n", sc->sc_unit); - return; - } - - msgid = sc->sc_msgid++; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_LISTEN_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, 1); /* Controller */ - msg = capimsg_setu32(msg, 0); /* Info mask */ - msg = capimsg_setu32(msg, CIP); - msg = capimsg_setu32(msg, 0); - msg = capimsg_setu8(msg, 0); - msg = capimsg_setu8(msg, 0); - - sc->send(sc, m); -} - -void capi_listen_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t Info; - - capimsg_getu16(msg + 12, &Info); - - if (Info == 0) { - /* We are now listening. */ - - sc->sc_state = C_UP; - ctrl_desc[sc->ctrl_unit].dl_est = DL_UP; - - i4b_l4_l12stat(sc->ctrl_unit, 1, 1); - i4b_l4_l12stat(sc->ctrl_unit, 2, 1); - - } else { - /* XXX sc->sc_state = C_DOWN ? XXX */ - printf("capi%d: can't listen, info=%04x\n", sc->sc_unit, Info); - } -} - -void capi_info_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t applid, msgid; - u_int32_t PLCI; - - if (!m) { - printf("capi%d: can't get mbuf for info_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &PLCI); - - /* i4b_l4_info_ind() */ - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_INFO_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - - sc->send(sc, m); -} - -void capi_alert_req(capi_softc_t *sc, call_desc_t *cd) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 5); - u_int8_t *msg; - u_int16_t msgid; - u_int32_t PLCI; - - if (!m) { - printf("capi%d: can't get mbuf for alert_req\n", sc->sc_unit); - return; - } - - msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; - PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_ALERT_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - msg = capimsg_setu8(msg, 0); - - sc->send(sc, m); -} - -void capi_alert_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t Info; - - msg = capimsg_getu16(msg + 12, &Info); - - if (Info) { - printf("capi%d: can't alert, info=%04x\n", sc->sc_unit, Info); - } -} - -/* -// Outgoing call setup: -// -------------------- -// -// CAPI_CONNECT_REQ --> -// <-- CAPI_CONNECT_CONF -// (notify Layer 4) -// <-- CAPI_CONNECT_ACTIVE_IND -// CAPI_CONNECT_ACTIVE_RESP --> -// CAPI_CONNECT_B3_REQ --> -// <-- CAPI_CONNECT_B3_CONF -// <-- CAPI_CONNECT_B3_ACTIVE_IND -// CAPI_CONNECT_B3_ACTIVE_RESP --> -// (notify Layer 4) -*/ - -void capi_connect_req(capi_softc_t *sc, call_desc_t *cd) -{ - struct mbuf *m; - u_int8_t *msg; - u_int16_t msgid; - int slen = strlen(cd->src_telno); - int dlen = strlen(cd->dst_telno); - - m = i4b_Dgetmbuf(8 + 27 + slen + dlen); - if (!m) { - printf("capi%d: can't get mbuf for connect_req\n", sc->sc_unit); - return; - } - - cd->crflag = CRF_ORIG; - - sc->sc_bchan[cd->channelid].cdid = cd->cdid; - sc->sc_bchan[cd->channelid].bprot = cd->bprot; - sc->sc_bchan[cd->channelid].state = B_CONNECT_CONF; - msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; - ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_RSVD; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_CONNECT_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, 1); /* Controller */ - - switch (cd->bprot) { - case BPROT_NONE: - msg = capimsg_setu16(msg, 0x0010); /* Telephony */ - break; - - case BPROT_RHDLC: - msg = capimsg_setu16(msg, 0x0002); /* Unrestricted digital */ - break; - - default: - msg = capimsg_setu16(msg, 0x0002); /* Unrestricted digital */ - } - - msg = capimsg_setu8(msg, 1 + dlen); - msg = capimsg_setu8(msg, 0x80); - strncpy(msg, cd->dst_telno, dlen); - - msg = capimsg_setu8(msg + dlen, 2 + slen); - msg = capimsg_setu8(msg, 0x00); - msg = capimsg_setu8(msg, 0x80); /* Presentation and screening indicator */ - strncpy(msg, cd->src_telno, slen); - - msg = capimsg_setu8(msg + slen, 0); /* Called & */ - msg = capimsg_setu8(msg, 0); /* Calling party subaddress */ - - msg = capimsg_setu8(msg, 15); /* B protocol */ - if (cd->bprot == BPROT_NONE) - msg = capimsg_setu16(msg, 1); /* B1 protocol = transparent */ - else - msg = capimsg_setu16(msg, 0); /* B1 protocol = HDLC */ - msg = capimsg_setu16(msg, 1); /* B2 protocol = transparent */ - msg = capimsg_setu16(msg, 0); /* B3 protocol = transparent */ - msg = capimsg_setu8(msg, 0); /* B1 parameters */ - msg = capimsg_setu8(msg, 0); /* B2 parameters */ - msg = capimsg_setu8(msg, 0); /* B3 parameters */ - - msg = capimsg_setu8(msg, 0); /* Bearer Capability */ - msg = capimsg_setu8(msg, 0); /* Low Layer Compatibility */ - msg = capimsg_setu8(msg, 0); /* High Layer Compatibility */ - msg = capimsg_setu8(msg, 0); /* Additional Info */ - - sc->send(sc, m); -} - -void capi_connect_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t msgid; - u_int32_t PLCI; - u_int16_t Info; - int bch; - - msg = capimsg_getu16(msg + 6, &msgid); - msg = capimsg_getu32(msg, &PLCI); - msg = capimsg_getu16(msg, &Info); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_CONF) && - (sc->sc_bchan[bch].msgid == msgid)) - break; - - if ((bch == sc->sc_nbch) || - (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { - printf("capi%d: can't find channel for connect_conf PLCI %x\n", - sc->sc_unit, PLCI); - return; - } - - if (Info == 0) { - sc->sc_bchan[bch].state = B_CONNECT_ACTIVE_IND; - sc->sc_bchan[bch].ncci = PLCI; - - i4b_l4_proceeding_ind(cd); - - } else { - SET_CAUSE_TV(cd->cause_out, CAUSET_I4B, CAUSE_I4B_L1ERROR); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - - sc->sc_bchan[bch].state = B_FREE; - ctrl_desc[sc->ctrl_unit].bch_state[bch] = BCH_ST_FREE; - - printf("capi%d: can't connect out, info=%04x\n", sc->sc_unit, Info); - } -} - -void capi_connect_active_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t applid, msgid; - u_int32_t PLCI; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for active_ind\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &PLCI); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_ACTIVE_IND) && - (sc->sc_bchan[bch].ncci == PLCI)) - break; - - if ((bch == sc->sc_nbch) || - (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { - printf("capi%d: can't find channel for active_resp, PLCI %x\n", - sc->sc_unit, PLCI); - return; - } - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_CONNECT_ACTIVE_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - - sc->send(sc, m); - - if (cd->crflag == CRF_ORIG) { - capi_connect_b3_req(sc, cd); - - } else { - sc->sc_bchan[bch].state = B_CONNECT_B3_IND; - } -} - -void capi_connect_b3_req(capi_softc_t *sc, call_desc_t *cd) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 5); - u_int8_t *msg; - u_int16_t msgid; - u_int32_t PLCI; - - if (!m) { - printf("capi%d: can't get mbuf for connect_b3_req\n", sc->sc_unit); - return; - } - - sc->sc_bchan[cd->channelid].state = B_CONNECT_B3_CONF; - msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; - PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_CONNECT_B3_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - msg = capimsg_setu8(msg, 0); /* NCPI */ - - sc->send(sc, m); -} - -void capi_connect_b3_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t msgid; - u_int32_t NCCI; - u_int16_t Info; - int bch; - - msg = capimsg_getu16(msg + 6, &msgid); - msg = capimsg_getu32(msg, &NCCI); - msg = capimsg_getu16(msg, &Info); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_B3_CONF) && - (sc->sc_bchan[bch].ncci == (NCCI & CAPI_PLCI_MASK))) - break; - - if ((bch == sc->sc_nbch) || - (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { - printf("capi%d: can't find channel for connect_b3_conf NCCI %x\n", - sc->sc_unit, NCCI); - return; - } - - if (Info == 0) { - sc->sc_bchan[bch].ncci = NCCI; - sc->sc_bchan[bch].state = B_CONNECT_B3_ACTIVE_IND; - - } else { - SET_CAUSE_TV(cd->cause_in, CAUSET_I4B, CAUSE_I4B_OOO); /* XXX */ - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - - ctrl_desc[sc->ctrl_unit].bch_state[bch] = BCH_ST_RSVD; - - printf("capi%d: can't connect_b3 out, info=%04x\n", sc->sc_unit, Info); - - capi_disconnect_req(sc, cd); - } -} - -void capi_connect_b3_active_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t applid, msgid; - u_int32_t NCCI; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for b3_active_ind\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &NCCI); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_B3_ACTIVE_IND) && - (sc->sc_bchan[bch].ncci == NCCI)) - break; - - if ((bch == sc->sc_nbch) || - (cd = cd_by_cdid(sc->sc_bchan[bch].cdid)) == NULL) { - printf("capi%d: can't find channel for b3_active_resp NCCI %x\n", - sc->sc_unit, NCCI); - return; - } - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_CONNECT_B3_ACTIVE_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, NCCI); - - sc->send(sc, m); - - sc->sc_bchan[bch].state = B_CONNECTED; - i4b_l4_connect_active_ind(cd); -} - -/* -// Incoming call setup: -// -------------------- -// -// <-- CAPI_CONNECT_IND -// (consult Layer 4) -// CAPI_CONNECT_RESP --> -// <-- CAPI_CONNECT_ACTIVE_IND -// CAPI_CONNECT_ACTIVE_RESP --> -// <-- CAPI_CONNECT_B3_IND -// CAPI_CONNECT_B3_RESP --> -// <-- CAPI_CONNECT_B3_ACTIVE_IND -// CAPI_CONNECT_B3_ACTIVE_RESP --> -// (notify Layer 4) -*/ - -void capi_connect_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t applid, msgid; - u_int32_t PLCI; - u_int16_t CIP; - u_int8_t x, y, z; - int bch; - - if ((cd = reserve_cd()) == NULL) { - printf("capi%d: can't get cd for connect_ind\n", sc->sc_unit); - return; - } - - cd->controller = sc->ctrl_unit; - cd->channelexcl = FALSE; - - for (bch = 0; bch < sc->sc_nbch; bch++) - if (sc->sc_bchan[bch].state == B_FREE) break; - sc->sc_bchan[bch].state = B_CONNECT_IND; - cd->channelid = bch; /* XXX CHAN_ANY XXX */ - - cd->crflag = CRF_DEST; - cd->cr = get_rand_cr(sc->sc_unit); - cd->scr_ind = SCR_NONE; - cd->prs_ind = PRS_NONE; - cd->bprot = BPROT_NONE; - cd->ilt = NULL; - cd->dlt = NULL; - cd->display[0] = '\0'; - cd->datetime[0] = '\0'; - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &PLCI); - msg = capimsg_getu16(msg, &CIP); - - cd->event = (int) msgid; /* XXX overload */ - cd->Q931state = (int) PLCI; /* XXX overload */ - - switch (CIP) { - case 0x0010: - case 0x0001: cd->bprot = BPROT_NONE; break; - case 0x0002: cd->bprot = BPROT_RHDLC; break; - default: - NDBGL4(L4_CAPIDBG, "capi%d: unknown CIP = %d", sc->sc_unit, CIP); - cd->bprot = BPROT_NONE; - } - - msg = capimsg_getu8(msg, &x); /* Called party struct len */ - if (x) { - msg = capimsg_getu8(msg, &y); /* Numbering plan */ - z = x - 1; - if (z >= TELNO_MAX) z = (TELNO_MAX-1); - strncpy(cd->dst_telno, msg, z); - msg += x; - x = z; - } - cd->dst_telno[x] = '\0'; - - msg = capimsg_getu8(msg, &x); /* Calling party struct len */ - if (x) { - msg = capimsg_getu8(msg, &y); /* Numbering plan */ - msg = capimsg_getu8(msg, &y); /* Screening/Presentation */ - if ((y & 0x80) == 0) { /* screening used */ - cd->scr_ind = (y & 3) + SCR_USR_NOSC; - cd->prs_ind = ((y >> 5) & 3) + PRS_ALLOWED; - } - z = x - 2; - if (z >= TELNO_MAX) z = (TELNO_MAX-1); - strncpy(cd->src_telno, msg, z); - msg += x; - x = z; - } - cd->src_telno[x] = '\0'; - - i4b_l4_connect_ind(cd); -} - -void capi_connect_resp(capi_softc_t *sc, call_desc_t *cd) -{ - struct mbuf *m; - u_int8_t *msg; - u_int16_t msgid; - u_int32_t PLCI; - int dlen = strlen(cd->dst_telno); - - m = i4b_Dgetmbuf(8 + 21 + dlen); - if (!m) { - printf("capi%d: can't get mbuf for connect_resp\n", sc->sc_unit); - return; - } - - msgid = (u_int16_t) cd->event; - PLCI = (u_int32_t) cd->Q931state; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_CONNECT_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - - switch (cd->response) { - case SETUP_RESP_ACCEPT: - sc->sc_bchan[cd->channelid].cdid = cd->cdid; - sc->sc_bchan[cd->channelid].ncci = PLCI; - sc->sc_bchan[cd->channelid].state = B_CONNECT_ACTIVE_IND; - ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_USED; - msg = capimsg_setu16(msg, 0); /* Accept the call */ - break; - - case SETUP_RESP_REJECT: - sc->sc_bchan[cd->channelid].state = B_FREE; - ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_FREE; - msg = capimsg_setu16(msg, 2); /* Reject, normal call clearing */ - break; - - case SETUP_RESP_DNTCRE: - sc->sc_bchan[cd->channelid].state = B_FREE; - ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_FREE; - if (sc->sc_nbch == 30) { - /* With PRI, we can't really ignore calls -- normal clearing */ - msg = capimsg_setu16(msg, (0x3480|CAUSE_Q850_NCCLR)); - } else { - msg = capimsg_setu16(msg, 1); /* Ignore */ - } - break; - - default: - sc->sc_bchan[cd->channelid].state = B_FREE; - ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_FREE; - msg = capimsg_setu16(msg, (0x3480|CAUSE_Q850_CALLREJ)); - } - - msg = capimsg_setu8(msg, 15); /* B protocol */ - if (cd->bprot == BPROT_NONE) - msg = capimsg_setu16(msg, 1); /* B1 protocol = transparent */ - else - msg = capimsg_setu16(msg, 0); /* B1 protocol = HDLC */ - msg = capimsg_setu16(msg, 1); /* B2 protocol = transparent */ - msg = capimsg_setu16(msg, 0); /* B3 protocol = transparent */ - msg = capimsg_setu8(msg, 0); /* B1 parameters */ - msg = capimsg_setu8(msg, 0); /* B2 parameters */ - msg = capimsg_setu8(msg, 0); /* B3 parameters */ - - msg = capimsg_setu8(msg, 1 + dlen); - msg = capimsg_setu8(msg, 0x80); /* Numbering plan */ - strncpy(msg, cd->dst_telno, dlen); - msg = capimsg_setu8(msg + dlen, 0); /* Connected subaddress */ - msg = capimsg_setu8(msg, 0); /* Low Layer Compatibility */ - msg = capimsg_setu8(msg, 0); /* Additional Info */ - - sc->send(sc, m); -} - -void capi_connect_b3_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 7); - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t applid, msgid; - u_int32_t NCCI; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for connect_b3_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &NCCI); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECT_B3_IND) && - (sc->sc_bchan[bch].ncci == (NCCI & CAPI_PLCI_MASK))) - break; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_CONNECT_B3_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, NCCI); - - if (bch == sc->sc_nbch) { - printf("capi%d: can't get cd for connect_b3_resp NCCI %x\n", - sc->sc_unit, NCCI); - msg = capimsg_setu16(msg, 8); /* Reject, destination OOO */ - - } else { - sc->sc_bchan[bch].ncci = NCCI; - sc->sc_bchan[bch].state = B_CONNECT_B3_ACTIVE_IND; - msg = capimsg_setu16(msg, 0); /* Accept */ - } - - msg = capimsg_setu8(msg, 0); /* NCPI */ - - sc->send(sc, m); -} - -/* -// Data transfer: -// -------------- -*/ - -void capi_data_b3_req(capi_softc_t *sc, int chan, struct mbuf *m_b3) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 14); - u_int8_t *msg; - u_int16_t msgid; - - if (!m) { - printf("capi%d: can't get mbuf for data_b3_req\n", sc->sc_unit); - return; - } - - msgid = sc->sc_bchan[chan].msgid = sc->sc_msgid++; - sc->sc_bchan[chan].busy = 1; - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_DATA_B3_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, sc->sc_bchan[chan].ncci); - msg = capimsg_setu32(msg, (u_int32_t) m_b3->m_data); /* Pointer */ - msg = capimsg_setu16(msg, m_b3->m_len); - msg = capimsg_setu16(msg, chan); - msg = capimsg_setu16(msg, 0); /* Flags */ - - m->m_next = m_b3; - - sc->send(sc, m); -} - -void capi_data_b3_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int32_t NCCI; - u_int16_t handle; - u_int16_t Info; - - msg = capimsg_getu32(msg + 8, &NCCI); - msg = capimsg_getu16(msg, &handle); - msg = capimsg_getu16(msg, &Info); - - if (Info == 0) { - sc->sc_bchan[handle].busy = 0; - capi_start_tx(sc, handle); - - } else { - printf("capi%d: data_b3_conf NCCI %x handle %x info=%04x\n", - sc->sc_unit, NCCI, handle, Info); - } -} - -void capi_data_b3_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 6); - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t applid, msgid; - u_int32_t NCCI; - u_int16_t handle; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for data_b3_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &NCCI); - msg = capimsg_getu16(msg + 6, &handle); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_CONNECTED) && - (sc->sc_bchan[bch].ncci == NCCI)) - break; - - if (bch == sc->sc_nbch) { - printf("capi%d: can't find channel for data_b3_ind NCCI %x\n", - sc->sc_unit, NCCI); - - } else { - if (sc->sc_bchan[bch].bprot == BPROT_RHDLC) { - /* HDLC drivers use rx_mbuf */ - - sc->sc_bchan[bch].in_mbuf = m_in->m_next; - sc->sc_bchan[bch].rxcount += m_in->m_next->m_len; - m_in->m_next = NULL; /* driver frees */ - - (*sc->sc_bchan[bch].capi_drvr_linktab->bch_rx_data_ready)( - sc->sc_bchan[bch].capi_drvr_linktab->unit); - - } else { - /* Telephony drivers use rx_queue */ - - if (!_IF_QFULL(&sc->sc_bchan[bch].rx_queue)) { - _IF_ENQUEUE(&sc->sc_bchan[bch].rx_queue, m_in->m_next); - sc->sc_bchan[bch].rxcount += m_in->m_next->m_len; - m_in->m_next = NULL; /* driver frees */ - } - - (*sc->sc_bchan[bch].capi_drvr_linktab->bch_rx_data_ready)( - sc->sc_bchan[bch].capi_drvr_linktab->unit); - } - } - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_DATA_B3_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, NCCI); - msg = capimsg_setu16(msg, handle); - - sc->send(sc, m); -} - -/* -// Connection teardown: -// -------------------- -*/ - -void capi_disconnect_req(capi_softc_t *sc, call_desc_t *cd) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 5); - u_int8_t *msg; - u_int16_t msgid; - u_int32_t PLCI; - - if (!m) { - printf("capi%d: can't get mbuf for disconnect_req\n", sc->sc_unit); - return; - } - - sc->sc_bchan[cd->channelid].state = B_DISCONNECT_CONF; - ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_RSVD; - msgid = sc->sc_bchan[cd->channelid].msgid = sc->sc_msgid++; - PLCI = (sc->sc_bchan[cd->channelid].ncci & CAPI_PLCI_MASK); - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, I4BCAPI_APPLID); - msg = capimsg_setu16(msg, CAPI_DISCONNECT_REQ); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - msg = capimsg_setu8(msg, 0); /* Additional Info */ - - sc->send(sc, m); -} - -void capi_disconnect_conf(capi_softc_t *sc, struct mbuf *m_in) -{ - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int32_t PLCI; - int bch; - - msg = capimsg_getu32(msg + 8, &PLCI); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state == B_DISCONNECT_CONF) && - ((sc->sc_bchan[bch].ncci & CAPI_PLCI_MASK) == PLCI)) - break; - - if (bch == sc->sc_nbch) { - printf("capi%d: can't find channel for disconnect_conf PLCI %x\n", - sc->sc_unit, PLCI); - return; - } - - cd = cd_by_cdid(sc->sc_bchan[bch].cdid); - if (!cd) { - printf("capi%d: can't find cd for disconnect_conf PLCI %x\n", - sc->sc_unit, PLCI); - } else { - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - } - - sc->sc_bchan[bch].state = B_FREE; - ctrl_desc[sc->ctrl_unit].bch_state[bch] = BCH_ST_FREE; -} - -void capi_disconnect_b3_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - u_int16_t applid, msgid; - u_int32_t NCCI; - - if (!m) { - printf("capi%d: can't get mbuf for disconnect_b3_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &NCCI); - - /* XXX update bchan state? XXX */ - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_DISCONNECT_B3_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, NCCI); - - sc->send(sc, m); -} - -void capi_disconnect_ind(capi_softc_t *sc, struct mbuf *m_in) -{ - struct mbuf *m = i4b_Dgetmbuf(8 + 4); - u_int8_t *msg = mtod(m_in, u_int8_t*); - call_desc_t *cd; - u_int16_t applid, msgid; - u_int32_t PLCI; - u_int16_t Reason; - int bch; - - if (!m) { - printf("capi%d: can't get mbuf for disconnect_resp\n", sc->sc_unit); - return; - } - - msg = capimsg_getu16(msg + 2, &applid); - msg = capimsg_getu16(msg + 2, &msgid); - msg = capimsg_getu32(msg, &PLCI); - msg = capimsg_getu16(msg, &Reason); - - for (bch = 0; bch < sc->sc_nbch; bch++) - if ((sc->sc_bchan[bch].state != B_FREE) && - ((sc->sc_bchan[bch].ncci & CAPI_PLCI_MASK) == PLCI)) - break; - - if (bch < sc->sc_nbch) { - /* We may not have a bchan assigned if call was ignored. */ - - cd = cd_by_cdid(sc->sc_bchan[bch].cdid); - sc->sc_bchan[bch].state = B_DISCONNECT_IND; - } else cd = NULL; - - if (cd) { - if ((Reason & 0xff00) == 0x3400) { - SET_CAUSE_TV(cd->cause_in, CAUSET_Q850, (Reason & 0x7f)); - } else { - SET_CAUSE_TV(cd->cause_in, CAUSET_I4B, CAUSE_I4B_NORMAL); - } - - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - - sc->sc_bchan[bch].state = B_FREE; - ctrl_desc[sc->ctrl_unit].bch_state[bch] = BCH_ST_FREE; - } - - msg = capimsg_setu16(mtod(m, u_int8_t*), m->m_len); - msg = capimsg_setu16(msg, applid); - msg = capimsg_setu16(msg, CAPI_DISCONNECT_RESP); - msg = capimsg_setu16(msg, msgid); - - msg = capimsg_setu32(msg, PLCI); - - sc->send(sc, m); -} diff --git a/sys/i4b/capi/capi_msgs.h b/sys/i4b/capi/capi_msgs.h deleted file mode 100644 index 5d8b3ab1527f..000000000000 --- a/sys/i4b/capi/capi_msgs.h +++ /dev/null @@ -1,381 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/capi_msgs.h The CAPI i4b message and handler declarations. - * - * $FreeBSD$ - */ - -#ifndef _I4B_CAPI_MSGS_H_ -#define _I4B_CAPI_MSGS_H_ - -/* CAPI commands */ - -#define CAPI_ALERT 0x01 -#define CAPI_CONNECT 0x02 -#define CAPI_CONNECT_ACTIVE 0x03 -#define CAPI_CONNECT_B3 0x82 -#define CAPI_CONNECT_B3_ACTIVE 0x83 -#define CAPI_CONNECT_B3_T90_ACTIVE 0x88 -#define CAPI_DATA_B3 0x86 -#define CAPI_DISCONNECT_B3 0x84 -#define CAPI_DISCONNECT 0x04 -#define CAPI_FACILITY 0x80 -#define CAPI_INFO 0x08 -#define CAPI_LISTEN 0x05 -#define CAPI_MANUFACTURER 0xff -#define CAPI_RESET_B3 0x87 -#define CAPI_SELECT_B_PROTOCOL 0x41 - -/* CAPI subcommands */ - -#define CAPI_REQ 0x80 -#define CAPI_CONF 0x81 -#define CAPI_IND 0x82 -#define CAPI_RESP 0x83 - -/* CAPI combined commands */ - -#define CAPICMD(cmd,subcmd) (((subcmd)<<8)|(cmd)) - -#define CAPI_DISCONNECT_REQ CAPICMD(CAPI_DISCONNECT,CAPI_REQ) -#define CAPI_DISCONNECT_CONF CAPICMD(CAPI_DISCONNECT,CAPI_CONF) -#define CAPI_DISCONNECT_IND CAPICMD(CAPI_DISCONNECT,CAPI_IND) -#define CAPI_DISCONNECT_RESP CAPICMD(CAPI_DISCONNECT,CAPI_RESP) - -#define CAPI_ALERT_REQ CAPICMD(CAPI_ALERT,CAPI_REQ) -#define CAPI_ALERT_CONF CAPICMD(CAPI_ALERT,CAPI_CONF) - -#define CAPI_CONNECT_REQ CAPICMD(CAPI_CONNECT,CAPI_REQ) -#define CAPI_CONNECT_CONF CAPICMD(CAPI_CONNECT,CAPI_CONF) -#define CAPI_CONNECT_IND CAPICMD(CAPI_CONNECT,CAPI_IND) -#define CAPI_CONNECT_RESP CAPICMD(CAPI_CONNECT,CAPI_RESP) - -#define CAPI_CONNECT_ACTIVE_REQ CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_REQ) -#define CAPI_CONNECT_ACTIVE_CONF CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_CONF) -#define CAPI_CONNECT_ACTIVE_IND CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_IND) -#define CAPI_CONNECT_ACTIVE_RESP CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_RESP) - -#define CAPI_SELECT_B_PROTOCOL_REQ CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_REQ) -#define CAPI_SELECT_B_PROTOCOL_CONF CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_CONF) - -#define CAPI_CONNECT_B3_REQ CAPICMD(CAPI_CONNECT_B3,CAPI_REQ) -#define CAPI_CONNECT_B3_CONF CAPICMD(CAPI_CONNECT_B3,CAPI_CONF) -#define CAPI_CONNECT_B3_IND CAPICMD(CAPI_CONNECT_B3,CAPI_IND) -#define CAPI_CONNECT_B3_RESP CAPICMD(CAPI_CONNECT_B3,CAPI_RESP) - -#define CAPI_CONNECT_B3_ACTIVE_REQ CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_REQ) -#define CAPI_CONNECT_B3_ACTIVE_CONF CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_CONF) -#define CAPI_CONNECT_B3_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_IND) -#define CAPI_CONNECT_B3_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_RESP) - -#define CAPI_CONNECT_B3_T90_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_IND) -#define CAPI_CONNECT_B3_T90_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_RESP) - -#define CAPI_DATA_B3_REQ CAPICMD(CAPI_DATA_B3,CAPI_REQ) -#define CAPI_DATA_B3_CONF CAPICMD(CAPI_DATA_B3,CAPI_CONF) -#define CAPI_DATA_B3_IND CAPICMD(CAPI_DATA_B3,CAPI_IND) -#define CAPI_DATA_B3_RESP CAPICMD(CAPI_DATA_B3,CAPI_RESP) - -#define CAPI_DISCONNECT_B3_REQ CAPICMD(CAPI_DISCONNECT_B3,CAPI_REQ) -#define CAPI_DISCONNECT_B3_CONF CAPICMD(CAPI_DISCONNECT_B3,CAPI_CONF) -#define CAPI_DISCONNECT_B3_IND CAPICMD(CAPI_DISCONNECT_B3,CAPI_IND) -#define CAPI_DISCONNECT_B3_RESP CAPICMD(CAPI_DISCONNECT_B3,CAPI_RESP) - -#define CAPI_RESET_B3_REQ CAPICMD(CAPI_RESET_B3,CAPI_REQ) -#define CAPI_RESET_B3_CONF CAPICMD(CAPI_RESET_B3,CAPI_CONF) -#define CAPI_RESET_B3_IND CAPICMD(CAPI_RESET_B3,CAPI_IND) -#define CAPI_RESET_B3_RESP CAPICMD(CAPI_RESET_B3,CAPI_RESP) - -#define CAPI_LISTEN_REQ CAPICMD(CAPI_LISTEN,CAPI_REQ) -#define CAPI_LISTEN_CONF CAPICMD(CAPI_LISTEN,CAPI_CONF) - -#define CAPI_MANUFACTURER_REQ CAPICMD(CAPI_MANUFACTURER,CAPI_REQ) -#define CAPI_MANUFACTURER_CONF CAPICMD(CAPI_MANUFACTURER,CAPI_CONF) -#define CAPI_MANUFACTURER_IND CAPICMD(CAPI_MANUFACTURER,CAPI_IND) -#define CAPI_MANUFACTURER_RESP CAPICMD(CAPI_MANUFACTURER,CAPI_RESP) - -#define CAPI_FACILITY_REQ CAPICMD(CAPI_FACILITY,CAPI_REQ) -#define CAPI_FACILITY_CONF CAPICMD(CAPI_FACILITY,CAPI_CONF) -#define CAPI_FACILITY_IND CAPICMD(CAPI_FACILITY,CAPI_IND) -#define CAPI_FACILITY_RESP CAPICMD(CAPI_FACILITY,CAPI_RESP) - -#define CAPI_INFO_REQ CAPICMD(CAPI_INFO,CAPI_REQ) -#define CAPI_INFO_CONF CAPICMD(CAPI_INFO,CAPI_CONF) -#define CAPI_INFO_IND CAPICMD(CAPI_INFO,CAPI_IND) -#define CAPI_INFO_RESP CAPICMD(CAPI_INFO,CAPI_RESP) - -/* CAPI message access helpers */ - -/* - * CAPI message header: - * word Length - * word ApplId - * byte Command - * byte Subcommand - * word MsgId - * - * Note that in the following, Controller/PLCI/NCCI is coded as follows: - * bits 0..6 = controller, bit 7 = ext/int, bits 8..15 = PLCI, and - * bits 16..31 = NCCI value. - * - * ALERT_REQ, 01 80: - * dword PLCI - * struct Additional Info - * - * ALERT_CONF, 01 81: - * dword PLCI - * word Info (0 = OK, other = cause) - * - * CONNECT_REQ, 02 80: - * dword controller - * word CIP - * struct Called party number - * struct Calling party number - * struct Called party subaddress - * struct Calling party subaddress - * struct Bearer Capability - * struct Low Layer Compatibility - * struct High Layer Compatibility - * struct Additional Info - * - * CONNECT_CONF, 02 81: - * dword PLCI - * word Info (0 = OK, other = cause) - * - * CONNECT_IND, 02 82: - * dword PLCI - * word CIP - * struct Called party number - * struct Calling party number - * struct Called party subaddress - * struct Calling party subaddress - * struct Bearer Capability - * struct Low Layer Compatibility - * struct High Layer Compatibility - * struct Additional Info - * struct Second Calling party number - * - * CONNECT_RESP, 02 83: - * dword PLCI - * word Reject (0 = accept, 1 = ignore, 2 = reject/normal clearing) - * struct B protocol - * struct Connected number - * struct Connected subaddress - * struct Low Layer Compatibility - * struct Additional Info - * - * CONNECT_ACTIVE_IND, 03 82: - * dword PLCI - * struct Connected number - * struct Connected subaddress - * struct Low Layer Compatibility - * - * CONNECT_ACTIVE_RESP, 03 83: - * dword PLCI - * - * CONNECT_B3_REQ, 82 80: - * dword PLCI - * struct NCPI - * - * CONNECT_B3_CONF, 82 81: - * dword NCCI - * word Info (0 = connected, other = cause) - * - * CONNECT_B3_IND, 82 82: - * dword NCCI - * struct NCPI - * - * CONNECT_B3_RESP, 82 83: - * dword NCCI - * word Reject (0 = accept, 2 = reject/normal clearing) - * struct NCPI - * - * CONNECT_B3_ACTIVE_IND, 83 82: - * dword NCCI - * struct NCPI - * - * CONNECT_B3_ACTIVE_RESP, 83 83: - * dword NCCI - * - * DATA_B3_REQ, 86 80: - * dword NCCI - * dword Data pointer - * word Data length - * word Data handle (packet id) - * word Flags (02 = more) - * - * DATA_B3_CONF, 86 81: - * dword NCCI - * word Data handle (packet id) - * word Info (0 = OK, other = cause) - * - * DATA_B3_IND, 86 82: - * dword NCCI - * dword Data pointer - * word Data length - * word Data handle (packet id) - * word Flags (02 = more) - * - * DATA_B3_RESP, 86 83: - * dword NCCI - * word Data handle (packet id) - * - * DISCONNECT_B3_REQ, 84 80: - * dword NCCI - * struct NCPI - * - * DISCONNECT_B3_CONF, 84 81: - * dword NCCI - * word Info (0 = OK, other = cause) - * - * DISCONNECT_B3_IND, 84 82: - * dword NCCI - * word Reason - * struct NCPI - * - * DISCONNECT_B3_RESP, 84 83: - * dword NCCI - * - * DISCONNECT_REQ, 04 80: - * dword PLCI - * struct Additional Info - * - * DISCONNECT_CONF, 04 81: - * dword PLCI - * word Info (0 = OK, other = cause) - * - * DISCONNECT_IND, 04 82: - * dword PLCI - * word Reason - * - * DISCONNECT_RESP, 04 83: - * dword PLCI - * - * LISTEN_REQ, 05 80: - * dword Controller - * dword Info mask (bits 0..9 used) - * dword CIP Mask (bit 0 = any match) - * dword CIP Mask 2 (bit 0 = any match) - * struct Calling party number - * struct Calling party subaddress - * - * LISTEN_CONF, 05 81: - * dword Controller - * word Info (0 = OK, other = cause) - * - * INFO_REQ, 08 80: - * dword Controller/PLCI - * struct Called party number - * struct Additional Info - * - * INFO_CONF, 08 81: - * dword Controller/PLCI - * word Info (0 = OK, other = cause) - * - * INFO_IND, 08 82: - * dword Controller/PLCI - * word Info number - * struct Info element - * - * INFO_RESP, 08 83: - * dword Controller/PLCI - */ - -#define CAPIMSG_LEN(msg) (msg[0]|(msg[1]<<8)) -#define CAPIMSG_DATALEN(msg) (msg[16]|(msg[17]<<8)) - -static __inline u_int8_t* capimsg_getu8(u_int8_t *msg, u_int8_t *val) -{ - *val = *msg; - return (msg + 1); -} - -static __inline u_int8_t* capimsg_getu16(u_int8_t *msg, u_int16_t *val) -{ - *val = (msg[0]|(msg[1]<<8)); - return (msg + 2); -} - -static __inline u_int8_t* capimsg_getu32(u_int8_t *msg, u_int32_t *val) -{ - *val = (msg[0]|(msg[1]<<8)|(msg[2]<<16)|(msg[3]<<24)); - return (msg + 4); -} - -static __inline u_int8_t* capimsg_setu8(u_int8_t *msg, u_int8_t val) -{ - msg[0] = val; - return (msg + 1); -} - -static __inline u_int8_t* capimsg_setu16(u_int8_t *msg, u_int16_t val) -{ - msg[0] = (val & 0xff); - msg[1] = (val >> 8) & 0xff; - return (msg + 2); -} - -static __inline u_int8_t* capimsg_setu32(u_int8_t *msg, u_int32_t val) -{ - msg[0] = (val & 0xff); - msg[1] = (val >> 8) & 0xff; - msg[2] = (val >> 16) & 0xff; - msg[3] = (val >> 24) & 0xff; - return (msg + 4); -} - -/* -// CAPI message handlers called by higher layers -*/ - -extern void capi_listen_req(capi_softc_t *sc, u_int32_t CIP); -extern void capi_alert_req(capi_softc_t *sc, call_desc_t *cd); -extern void capi_connect_req(capi_softc_t *sc, call_desc_t *cd); -extern void capi_connect_b3_req(capi_softc_t *sc, call_desc_t *cd); -extern void capi_connect_resp(capi_softc_t *sc, call_desc_t *cd); -extern void capi_data_b3_req(capi_softc_t *sc, int chan, struct mbuf *m); -extern void capi_disconnect_req(capi_softc_t *sc, call_desc_t *cd); - -/* -// CAPI message handlers called by the receive routine -*/ - -extern void capi_listen_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_info_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_alert_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_active_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_b3_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_b3_active_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_connect_b3_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_data_b3_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_data_b3_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_disconnect_conf(capi_softc_t *sc, struct mbuf *m); -extern void capi_disconnect_b3_ind(capi_softc_t *sc, struct mbuf *m); -extern void capi_disconnect_ind(capi_softc_t *sc, struct mbuf *m); - -#endif /* _I4B_CAPI_MSGS_H_ */ diff --git a/sys/i4b/capi/iavc/iavc.h b/sys/i4b/capi/iavc/iavc.h deleted file mode 100644 index cfe60a995003..000000000000 --- a/sys/i4b/capi/iavc/iavc.h +++ /dev/null @@ -1,446 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/iavc/iavc.h The AVM ISDN controllers' common declarations. - * - * $FreeBSD$ - */ - -#ifndef _CAPI_IAVC_H_ -#define _CAPI_IAVC_H_ - -/* max 4 units supported per machine */ - -#define IAVC_MAXUNIT 4 - -/* -// iavc_softc_t -// The software context of one AVM T1 controller. -*/ - -#define IAVC_IO_BASES 1 - -typedef struct i4b_info { - struct resource * io_base[IAVC_IO_BASES]; - int io_rid [IAVC_IO_BASES]; - struct resource * irq; - int irq_rid; - struct resource * mem; - int mem_rid; -} i4b_info_t; - -typedef struct iavc_softc { - capi_softc_t sc_capi; - int sc_unit; - int sc_cardtyp; - - u_int32_t sc_membase; - bus_space_handle_t sc_mem_bh; - bus_space_tag_t sc_mem_bt; - u_int32_t sc_iobase; - bus_space_handle_t sc_io_bh; - bus_space_tag_t sc_io_bt; - - int sc_state; -#define IAVC_DOWN 0 -#define IAVC_POLL 1 -#define IAVC_INIT 2 -#define IAVC_UP 3 - int sc_blocked; - int sc_dma; - int sc_t1; - int sc_intr; - - u_int32_t sc_csr; - - char sc_sendbuf[128+2048]; - char sc_recvbuf[128+2048]; - int sc_recvlen; - - struct ifqueue sc_txq; - - i4b_info_t sc_resources; -} iavc_softc_t; - -extern iavc_softc_t iavc_sc[]; - -#define iavc_find_sc(unit) (&iavc_sc[(unit)]) - -/* -// {b1,b1dma,t1}_{detect,reset} -// Routines to detect and manage the specific type of card. -*/ - -extern int b1_detect(iavc_softc_t *sc); -extern void b1_disable_irq(iavc_softc_t *sc); -extern void b1_reset(iavc_softc_t *sc); - -extern int b1dma_detect(iavc_softc_t *sc); -extern void b1dma_reset(iavc_softc_t *sc); - -extern int t1_detect(iavc_softc_t *sc); -extern void t1_disable_irq(iavc_softc_t *sc); -extern void t1_reset(iavc_softc_t *sc); - -/* -// AMCC_{READ,WRITE} -// Routines to access the memory mapped registers of the -// S5933 DMA controller. -*/ - -static __inline u_int32_t AMCC_READ(iavc_softc_t *sc, int off) -{ - return bus_space_read_4(sc->sc_mem_bt, sc->sc_mem_bh, off); -} - -static __inline void AMCC_WRITE(iavc_softc_t *sc, int off, u_int32_t value) -{ - bus_space_write_4(sc->sc_mem_bt, sc->sc_mem_bh, off, value); -} - -/* -// amcc_{put,get}_{byte,word} -// Routines to access the DMA buffers byte- or wordwise. -*/ - -static __inline u_int8_t* amcc_put_byte(u_int8_t *buf, u_int8_t value) -{ - *buf++ = value; - return buf; -} - -static __inline u_int8_t* amcc_get_byte(u_int8_t *buf, u_int8_t *value) -{ - *value = *buf++; - return buf; -} - -static __inline u_int8_t* amcc_put_word(u_int8_t *buf, u_int32_t value) -{ - *buf++ = (value & 0xff); - *buf++ = (value >> 8) & 0xff; - *buf++ = (value >> 16) & 0xff; - *buf++ = (value >> 24) & 0xff; - return buf; -} - -static __inline u_int8_t* amcc_get_word(u_int8_t *buf, u_int32_t *value) -{ - *value = *buf++; - *value |= (*buf++ << 8); - *value |= (*buf++ << 16); - *value |= (*buf++ << 24); - return buf; -} - -/* -// Controller LLI message numbers. -*/ - -#define SEND_POLL 0x72 -#define SEND_INIT 0x11 -#define SEND_REGISTER 0x12 -#define SEND_DATA_B3_REQ 0x13 -#define SEND_RELEASE 0x14 -#define SEND_MESSAGE 0x15 -#define SEND_CONFIG 0x71 -#define SEND_POLLACK 0x73 - -#define RECEIVE_POLL 0x32 -#define RECEIVE_INIT 0x27 -#define RECEIVE_MESSAGE 0x21 -#define RECEIVE_DATA_B3_IND 0x22 -#define RECEIVE_START 0x23 -#define RECEIVE_STOP 0x24 -#define RECEIVE_NEW_NCCI 0x25 -#define RECEIVE_FREE_NCCI 0x26 -#define RECEIVE_RELEASE 0x26 -#define RECEIVE_TASK_READY 0x31 -#define RECEIVE_DEBUGMSG 0x71 -#define RECEIVE_POLLDWORD 0x75 - -/* Operation constants */ - -#define WRITE_REGISTER 0x00 -#define READ_REGISTER 0x01 - -/* Port offsets in I/O space */ - -#define B1_READ 0x00 -#define B1_WRITE 0x01 -#define B1_INSTAT 0x02 -#define B1_OUTSTAT 0x03 -#define B1_ANALYSE 0x04 -#define B1_REVISION 0x05 -#define B1_RESET 0x10 - -#define T1_FASTLINK 0x00 -#define T1_SLOWLINK 0x08 - -#define T1_READ B1_READ -#define T1_WRITE B1_WRITE -#define T1_INSTAT B1_INSTAT -#define T1_OUTSTAT B1_OUTSTAT -#define T1_IRQENABLE 0x05 -#define T1_FIFOSTAT 0x06 -#define T1_RESETLINK 0x10 -#define T1_ANALYSE 0x11 -#define T1_IRQMASTER 0x12 -#define T1_IDENT 0x17 -#define T1_RESETBOARD 0x1f - -#define T1F_IREADY 0x01 -#define T1F_IHALF 0x02 -#define T1F_IFULL 0x04 -#define T1F_IEMPTY 0x08 -#define T1F_IFLAGS 0xf0 - -#define T1F_OREADY 0x10 -#define T1F_OHALF 0x20 -#define T1F_OEMPTY 0x40 -#define T1F_OFULL 0x80 -#define T1F_OFLAGS 0xf0 - -#define FIFO_OUTBSIZE 256 -#define FIFO_INPBSIZE 512 - -#define HEMA_VERSION_ID 0 -#define HEMA_PAL_ID 0 - -/* -// S5933 DMA controller register offsets in memory, and bitmasks. -*/ - -#define AMCC_RXPTR 0x24 -#define AMCC_RXLEN 0x28 -#define AMCC_TXPTR 0x2c -#define AMCC_TXLEN 0x30 - -#define AMCC_INTCSR 0x38 -#define EN_READ_TC_INT 0x00008000 -#define EN_WRITE_TC_INT 0x00004000 -#define EN_TX_TC_INT EN_READ_TC_INT -#define EN_RX_TC_INT EN_WRITE_TC_INT -#define AVM_FLAG 0x30000000 - -#define ANY_S5933_INT 0x00800000 -#define READ_TC_INT 0x00080000 -#define WRITE_TC_INT 0x00040000 -#define TX_TC_INT READ_TC_INT -#define RX_TC_INT WRITE_TC_INT -#define MASTER_ABORT_INT 0x00100000 -#define TARGET_ABORT_INT 0x00200000 -#define BUS_MASTER_INT 0x00200000 -#define ALL_INT 0x000c0000 - -#define AMCC_MCSR 0x3c -#define A2P_HI_PRIORITY 0x00000100 -#define EN_A2P_TRANSFERS 0x00000400 -#define P2A_HI_PRIORITY 0x00001000 -#define EN_P2A_TRANSFERS 0x00004000 -#define RESET_A2P_FLAGS 0x04000000 -#define RESET_P2A_FLAGS 0x02000000 - -/* -// (B1IO_WAIT_MAX * B1IO_WAIT_DLY) is the max wait in us for the card -// to become ready after an I/O operation. The default is 1 ms. -*/ - -#define B1IO_WAIT_MAX 1000 -#define B1IO_WAIT_DLY 1 - -/* -// b1io_outp -// Diagnostic output routine, returns the written value via -// the device's analysis register. -// -// b1io_rx_full -// Returns nonzero if data is readable from the card via the -// I/O ports. -// -// b1io_tx_empty -// Returns nonzero if data can be written to the card via the -// I/O ports. -*/ - -static __inline u_int8_t b1io_outp(iavc_softc_t *sc, int off, u_int8_t val) -{ - bus_space_write_1(sc->sc_io_bt, sc->sc_io_bh, off, val); - DELAY(1); - return bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, B1_ANALYSE); -} - -static __inline int b1io_rx_full(iavc_softc_t *sc) -{ - u_int8_t val = bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, B1_INSTAT); - return (val & 0x01); -} - -static __inline int b1io_tx_empty(iavc_softc_t *sc) -{ - u_int8_t val = bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, B1_OUTSTAT); - return (val & 0x01); -} - -/* -// b1io_{get,put}_{byte,word} -// Routines to read and write the device I/O registers byte- or -// wordwise. -// -// b1io_{get,put}_slice -// Routines to read and write sequential bytes to the device -// I/O registers. -*/ - -u_int8_t b1io_get_byte(iavc_softc_t *sc); -int b1io_put_byte(iavc_softc_t *sc, u_int8_t val); - -int b1io_save_put_byte(iavc_softc_t *sc, u_int8_t val); - -u_int32_t b1io_get_word(iavc_softc_t *sc); -void b1io_put_word(iavc_softc_t *sc, u_int32_t val); - -int b1io_get_slice(iavc_softc_t *sc, u_int8_t *dp); -void b1io_put_slice(iavc_softc_t *sc, u_int8_t *dp, int len); - -/* -// b1io_{read,write}_reg -// Routines to read and write the device registers via the I/O -// ports. -*/ - -u_int32_t b1io_read_reg(iavc_softc_t *sc, int reg); -u_int32_t b1io_write_reg(iavc_softc_t *sc, int reg, u_int32_t val); - -/* -// t1io_outp -// I/O port write operation for the T1, which does not seem -// to have the analysis port. -*/ - -static __inline void t1io_outp(iavc_softc_t *sc, int off, u_int8_t val) -{ - bus_space_write_1(sc->sc_io_bt, sc->sc_io_bh, off, val); -} - -static __inline u_int8_t t1io_inp(iavc_softc_t *sc, int off) -{ - return bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, off); -} - -static __inline int t1io_isfastlink(iavc_softc_t *sc) -{ - return ((bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, T1_IDENT) & ~0x82) == 1); -} - -static __inline u_int8_t t1io_fifostatus(iavc_softc_t *sc) -{ - return bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, T1_FIFOSTAT); -} - -int t1io_get_slice(iavc_softc_t *sc, u_int8_t *dp); -void t1io_put_slice(iavc_softc_t *sc, u_int8_t *dp, int len); - -/* -// An attempt to bring it all together: -// ------------------------------------ -// -// iavc_{read,write}_reg -// Routines to access the device registers via the I/O port. -// -// iavc_{read,write}_port -// Routines to access the device I/O ports. -// -// iavc_tx_empty, iavc_rx_full -// Routines to check when the device has drained the last written -// byte, or produced a full byte to read. -// -// iavc_{get,put}_byte -// Routines to read/write byte values to the device via the I/O port. -// -// iavc_{get,put}_word -// Routines to read/write 32-bit words to the device via the I/O port. -// -// iavc_{get,put}_slice -// Routines to read/write {length, data} pairs to the device via the -// ubiquituous I/O port. Uses the HEMA FIFO on a T1. -*/ - -#define iavc_read_reg(sc, reg) b1io_read_reg(sc, reg) -#define iavc_write_reg(sc, reg, val) b1io_write_reg(sc, reg, val) - -#define iavc_read_port(sc, port) \ - bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, (port)) -#define iavc_write_port(sc, port, val) \ - bus_space_write_1(sc->sc_io_bt, sc->sc_io_bh, (port), (val)) - -#define iavc_tx_empty(sc) b1io_tx_empty(sc) -#define iavc_rx_full(sc) b1io_rx_full(sc) - -#define iavc_get_byte(sc) b1io_get_byte(sc) -#define iavc_put_byte(sc, val) b1io_put_byte(sc, val) -#define iavc_get_word(sc) b1io_get_word(sc) -#define iavc_put_word(sc, val) b1io_put_word(sc, val) - -static __inline u_int32_t iavc_get_slice(iavc_softc_t *sc, u_int8_t *dp) -{ - if (sc->sc_t1) return t1io_get_slice(sc, dp); - else return b1io_get_slice(sc, dp); -} - -static __inline void iavc_put_slice(iavc_softc_t *sc, u_int8_t *dp, int len) -{ - if (sc->sc_t1) t1io_put_slice(sc, dp, len); - else b1io_put_slice(sc, dp, len); -} - -/* -// iavc_handle_intr -// Interrupt handler, called by the bus specific interrupt routine -// in iavc_.c module. -// -// iavc_load -// CAPI callback. Resets device and loads firmware. -// -// iavc_register -// CAPI callback. Registers an application id. -// -// iavc_release -// CAPI callback. Releases an application id. -// -// iavc_send -// CAPI callback. Sends a CAPI message. A B3_DATA_REQ message has -// m_next point to a data mbuf. -*/ - -extern void iavc_handle_intr(iavc_softc_t *); -extern int iavc_load(capi_softc_t *, int, u_int8_t *); -extern int iavc_register(capi_softc_t *, int, int); -extern int iavc_release(capi_softc_t *, int); -extern int iavc_send(capi_softc_t *, struct mbuf *); - -extern void b1isa_setup_irq(struct iavc_softc *sc); - -#endif /* _CAPI_IAVC_H_ */ diff --git a/sys/i4b/capi/iavc/iavc_card.c b/sys/i4b/capi/iavc/iavc_card.c deleted file mode 100644 index c0649504cd49..000000000000 --- a/sys/i4b/capi/iavc/iavc_card.c +++ /dev/null @@ -1,285 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/iavc/iavc_card.c - * The AVM ISDN controllers' card specific support routines. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include - -/* -// AVM B1 (active BRI, PIO mode) -*/ - -int b1_detect(iavc_softc_t *sc) -{ - if ((iavc_read_port(sc, B1_INSTAT) & 0xfc) || - (iavc_read_port(sc, B1_OUTSTAT) & 0xfc)) - return (1); - - b1io_outp(sc, B1_INSTAT, 0x02); - b1io_outp(sc, B1_OUTSTAT, 0x02); - if ((iavc_read_port(sc, B1_INSTAT) & 0xfe) != 2 || - (iavc_read_port(sc, B1_OUTSTAT) & 0xfe) != 2) - return (2); - - b1io_outp(sc, B1_INSTAT, 0x00); - b1io_outp(sc, B1_OUTSTAT, 0x00); - if ((iavc_read_port(sc, B1_INSTAT) & 0xfe) || - (iavc_read_port(sc, B1_OUTSTAT) & 0xfe)) - return (3); - - return (0); /* found */ -} - -void b1_disable_irq(iavc_softc_t *sc) -{ - b1io_outp(sc, B1_INSTAT, 0x00); -} - -void b1_reset(iavc_softc_t *sc) -{ - b1io_outp(sc, B1_RESET, 0); - DELAY(55*2*1000); - - b1io_outp(sc, B1_RESET, 1); - DELAY(55*2*1000); - - b1io_outp(sc, B1_RESET, 0); - DELAY(55*2*1000); -} - -/* -// Newer PCI-based B1's, and T1's, supports DMA -*/ - -int b1dma_detect(iavc_softc_t *sc) -{ - AMCC_WRITE(sc, AMCC_MCSR, 0); - DELAY(10*1000); - AMCC_WRITE(sc, AMCC_MCSR, 0x0f000000); - DELAY(10*1000); - AMCC_WRITE(sc, AMCC_MCSR, 0); - DELAY(42*1000); - - AMCC_WRITE(sc, AMCC_RXLEN, 0); - AMCC_WRITE(sc, AMCC_TXLEN, 0); - sc->sc_csr = 0; - AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); - - if (AMCC_READ(sc, AMCC_INTCSR) != 0) - return 1; - - AMCC_WRITE(sc, AMCC_RXPTR, 0xffffffff); - AMCC_WRITE(sc, AMCC_TXPTR, 0xffffffff); - if ((AMCC_READ(sc, AMCC_RXPTR) != 0xfffffffc) || - (AMCC_READ(sc, AMCC_TXPTR) != 0xfffffffc)) - return 2; - - AMCC_WRITE(sc, AMCC_RXPTR, 0); - AMCC_WRITE(sc, AMCC_TXPTR, 0); - if ((AMCC_READ(sc, AMCC_RXPTR) != 0) || - (AMCC_READ(sc, AMCC_TXPTR) != 0)) - return 3; - - iavc_write_port(sc, 0x10, 0x00); - iavc_write_port(sc, 0x07, 0x00); - - iavc_write_port(sc, 0x02, 0x02); - iavc_write_port(sc, 0x03, 0x02); - - if (((iavc_read_port(sc, 0x02) & 0xfe) != 0x02) || - (iavc_read_port(sc, 0x03) != 0x03)) - return 4; - - iavc_write_port(sc, 0x02, 0x00); - iavc_write_port(sc, 0x03, 0x00); - - if (((iavc_read_port(sc, 0x02) & 0xfe) != 0x00) || - (iavc_read_port(sc, 0x03) != 0x01)) - return 5; - - return (0); /* found */ -} - -void b1dma_reset(iavc_softc_t *sc) -{ - int s = SPLI4B(); - - sc->sc_csr = 0; - AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); - AMCC_WRITE(sc, AMCC_MCSR, 0); - AMCC_WRITE(sc, AMCC_RXLEN, 0); - AMCC_WRITE(sc, AMCC_TXLEN, 0); - - iavc_write_port(sc, 0x10, 0x00); /* XXX magic numbers from */ - iavc_write_port(sc, 0x07, 0x00); /* XXX the linux driver */ - - splx(s); - - AMCC_WRITE(sc, AMCC_MCSR, 0); - DELAY(10 * 1000); - AMCC_WRITE(sc, AMCC_MCSR, 0x0f000000); - DELAY(10 * 1000); - AMCC_WRITE(sc, AMCC_MCSR, 0); - DELAY(42 * 1000); -} - -/* -// AVM T1 (active PRI) -*/ - -/* XXX how do these differ from b1io_{read,write}_reg()? XXX */ - -static int b1dma_tx_empty(int iobase) -{ return inb(iobase + 3) & 1; } - -static int b1dma_rx_full(int iobase) -{ return inb(iobase + 2) & 1; } - -static int b1dma_tolink(iavc_softc_t *sc, void *buf, int len) -{ - volatile int spin; - char *s = (char*) buf; - while (len--) { - spin = 0; - while (!b1dma_tx_empty(sc->sc_iobase) && spin < 100000) - spin++; - if (!b1dma_tx_empty(sc->sc_iobase)) - return -1; - t1io_outp(sc, 1, *s++); - } - return 0; -} - -static int b1dma_fromlink(iavc_softc_t *sc, void *buf, int len) -{ - volatile int spin; - char *s = (char*) buf; - while (len--) { - spin = 0; - while (!b1dma_rx_full(sc->sc_iobase) && spin < 100000) - spin++; - if (!b1dma_rx_full(sc->sc_iobase)) - return -1; - *s++ = t1io_inp(sc, 0); - } - return 0; -} - -static int WriteReg(iavc_softc_t *sc, u_int32_t reg, u_int8_t val) -{ - u_int8_t cmd = 0; - if (b1dma_tolink(sc, &cmd, 1) == 0 && - b1dma_tolink(sc, ®, 4) == 0) { - u_int32_t tmp = val; - return b1dma_tolink(sc, &tmp, 4); - } - return -1; -} - -static u_int8_t ReadReg(iavc_softc_t *sc, u_int32_t reg) -{ - u_int8_t cmd = 1; - if (b1dma_tolink(sc, &cmd, 1) == 0 && - b1dma_tolink(sc, ®, 4) == 0) { - u_int32_t tmp; - if (b1dma_fromlink(sc, &tmp, 4) == 0) - return (u_int8_t) tmp; - } - return 0xff; -} - -int t1_detect(iavc_softc_t *sc) -{ - int ret = b1dma_detect(sc); - if (ret) return ret; - - if ((WriteReg(sc, 0x80001000, 0x11) != 0) || - (WriteReg(sc, 0x80101000, 0x22) != 0) || - (WriteReg(sc, 0x80201000, 0x33) != 0) || - (WriteReg(sc, 0x80301000, 0x44) != 0)) - return 6; - - if ((ReadReg(sc, 0x80001000) != 0x11) || - (ReadReg(sc, 0x80101000) != 0x22) || - (ReadReg(sc, 0x80201000) != 0x33) || - (ReadReg(sc, 0x80301000) != 0x44)) - return 7; - - if ((WriteReg(sc, 0x80001000, 0x55) != 0) || - (WriteReg(sc, 0x80101000, 0x66) != 0) || - (WriteReg(sc, 0x80201000, 0x77) != 0) || - (WriteReg(sc, 0x80301000, 0x88) != 0)) - return 8; - - if ((ReadReg(sc, 0x80001000) != 0x55) || - (ReadReg(sc, 0x80101000) != 0x66) || - (ReadReg(sc, 0x80201000) != 0x77) || - (ReadReg(sc, 0x80301000) != 0x88)) - return 9; - - return 0; /* found */ -} - -void t1_disable_irq(iavc_softc_t *sc) -{ - iavc_write_port(sc, T1_IRQMASTER, 0x00); -} - -void t1_reset(iavc_softc_t *sc) -{ - b1_reset(sc); - iavc_write_port(sc, B1_INSTAT, 0x00); - iavc_write_port(sc, B1_OUTSTAT, 0x00); - iavc_write_port(sc, T1_IRQMASTER, 0x00); - iavc_write_port(sc, T1_RESETBOARD, 0x0f); -} diff --git a/sys/i4b/capi/iavc/iavc_isa.c b/sys/i4b/capi/iavc/iavc_isa.c deleted file mode 100644 index e1f6142613ed..000000000000 --- a/sys/i4b/capi/iavc/iavc_isa.c +++ /dev/null @@ -1,289 +0,0 @@ -/*- - * Copyright (c) 2001, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include - -/* ISA driver linkage */ - -static void iavc_isa_intr(iavc_softc_t *sc); -static int iavc_isa_probe(device_t dev); -static int iavc_isa_attach(device_t dev); - -static device_method_t iavc_isa_methods[] = -{ - DEVMETHOD(device_probe, iavc_isa_probe), - DEVMETHOD(device_attach, iavc_isa_attach), - { 0, 0 } -}; - -static driver_t iavc_isa_driver = -{ - "iavc", - iavc_isa_methods, - 0 -}; - -static devclass_t iavc_isa_devclass; - -DRIVER_MODULE(iavc, isa, iavc_isa_driver, iavc_isa_devclass, 0, 0); - -#define B1_IOLENGTH 0x20 - -static int b1_irq_table[] = -{0, 0, 0, 192, 32, 160, 96, 224, 0, 64, 80, 208, 48, 0, 0, 112}; -/* 3 4 5 6 7 9 10 11 12 15 */ - -/*---------------------------------------------------------------------------* - * device probe - *---------------------------------------------------------------------------*/ - -static int -iavc_isa_probe(device_t dev) -{ - struct iavc_softc *sc; - int ret = ENXIO; - int unit = device_get_unit(dev); - - if(isa_get_vendorid(dev)) /* no PnP probes here */ - return ENXIO; - - /* check max unit range */ - - if (unit >= IAVC_MAXUNIT) - { - printf("iavc%d: too many units\n", unit); - return(ENXIO); - } - - sc = iavc_find_sc(unit); /* get softc */ - - sc->sc_unit = unit; - - if (!(sc->sc_resources.io_base[0] = - bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - 0UL, ~0UL, B1_IOLENGTH, RF_ACTIVE))) - { - printf("iavc%d: can't allocate io region\n", unit); - return(ENXIO); - } - - sc->sc_iobase = rman_get_start(sc->sc_resources.io_base[0]); - - switch(sc->sc_iobase) - { - case 0x150: - case 0x250: - case 0x300: - case 0x340: - break; - default: - printf("iavc%d: ERROR, invalid i/o base addr 0x%x configured!\n", sc->sc_unit, sc->sc_iobase); - bus_release_resource(dev, SYS_RES_IOPORT, - sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - return(ENXIO); - } - - sc->sc_io_bt = rman_get_bustag(sc->sc_resources.io_base[0]); - sc->sc_io_bh = rman_get_bushandle(sc->sc_resources.io_base[0]); - - /* setup characteristics */ - - sc->sc_t1 = FALSE; - sc->sc_dma = FALSE; - - sc->sc_capi.card_type = CARD_TYPEC_AVM_B1_ISA; - sc->sc_capi.sc_nbch = 2; - - b1_reset(sc); - DELAY(100); - - ret = b1_detect(sc); - - if(ret) - { - printf("iavc%d: no card ? b1_detect returns %0x02x\n", - sc->sc_unit, ret); - return(ENXIO); - } - - DELAY(100); - - b1_reset(sc); - - DELAY(100); - - if(bootverbose) - { - printf("iavc%d: class = 0x%02x, rev = 0x%02x\n", sc->sc_unit, - iavc_read_port(sc, B1_ANALYSE), - iavc_read_port(sc, B1_REVISION)); - } - - device_set_desc(dev, "AVM B1 ISA"); - return(0); -} - -/*---------------------------------------------------------------------------* - * attach - *---------------------------------------------------------------------------*/ -static int -iavc_isa_attach(device_t dev) -{ - struct iavc_softc *sc; - void *ih = 0; - int unit = device_get_unit(dev); - int irq; - - sc = iavc_find_sc(unit); /* get softc */ - - sc->sc_resources.irq_rid = 0; - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, RF_ACTIVE))) - { - printf("iavc%d: can't allocate irq\n",unit); - bus_release_resource(dev, SYS_RES_IOPORT, - sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - return(ENXIO); - } - - irq = rman_get_start(sc->sc_resources.irq); - - if(b1_irq_table[irq] == 0) - { - printf("iavc%d: ERROR, illegal irq %d configured!\n",unit, irq); - bus_release_resource(dev, SYS_RES_IOPORT, - sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - bus_release_resource(dev, SYS_RES_IRQ, - sc->sc_resources.irq_rid, - sc->sc_resources.irq); - return(ENXIO); - } - - memset(&sc->sc_txq, 0, sizeof(struct ifqueue)); - sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4; - - if(!mtx_initialized(&sc->sc_txq.ifq_mtx)) - mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_isa", NULL, MTX_DEF); - - sc->sc_intr = FALSE; - sc->sc_state = IAVC_DOWN; - sc->sc_blocked = FALSE; - - /* setup capi link */ - - sc->sc_capi.load = iavc_load; - sc->sc_capi.reg_appl = iavc_register; - sc->sc_capi.rel_appl = iavc_release; - sc->sc_capi.send = iavc_send; - sc->sc_capi.ctx = (void*) sc; - - if (capi_ll_attach(&sc->sc_capi)) - { - printf("iavc%d: capi attach failed\n", unit); - return(ENXIO); - } - - /* setup the interrupt */ - - if(bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, - NULL, (void(*)(void*))iavc_isa_intr, - sc, &ih)) - { - printf("iavc%d: irq setup failed\n", unit); - bus_release_resource(dev, SYS_RES_IOPORT, - sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - bus_release_resource(dev, SYS_RES_IRQ, - sc->sc_resources.irq_rid, - sc->sc_resources.irq); - return(ENXIO); - } - - /* the board is now ready to be loaded */ - - return(0); -} - -/*---------------------------------------------------------------------------* - * setup interrupt - *---------------------------------------------------------------------------*/ -void -b1isa_setup_irq(struct iavc_softc *sc) -{ - int irq = rman_get_start(sc->sc_resources.irq); - - if(bootverbose) - printf("iavc%d: using irq %d\n", sc->sc_unit, irq); - - /* enable the interrupt */ - - b1io_outp(sc, B1_INSTAT, 0x00); - b1io_outp(sc, B1_RESET, b1_irq_table[irq]); - b1io_outp(sc, B1_INSTAT, 0x02); -} - -/*---------------------------------------------------------------------------* - * IRQ handler - *---------------------------------------------------------------------------*/ -static void -iavc_isa_intr(struct iavc_softc *sc) -{ - iavc_handle_intr(sc); -} diff --git a/sys/i4b/capi/iavc/iavc_lli.c b/sys/i4b/capi/iavc/iavc_lli.c deleted file mode 100644 index 7fff48b0c22c..000000000000 --- a/sys/i4b/capi/iavc/iavc_lli.c +++ /dev/null @@ -1,986 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/iavc/iavc_lli.c - * The AVM ISDN controllers' Low Level Interface. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -/* Forward declarations of local subroutines... */ - -static int iavc_send_init(iavc_softc_t *); - -static void iavc_handle_rx(iavc_softc_t *); -static void iavc_start_tx(iavc_softc_t *); - -/* -// Callbacks from the upper (capi) layer: -// -------------------------------------- -// -// iavc_load -// Resets the board and loads the firmware, then initiates -// board startup. -// -// iavc_register -// Registers a CAPI application id. -// -// iavc_release -// Releases a CAPI application id. -// -// iavc_send -// Sends a capi message. -*/ - -int iavc_load(capi_softc_t *capi_sc, int len, u_int8_t *cp) -{ - iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; - u_int8_t val; - - if(bootverbose) - printf("iavc%d: reset card ....\n", sc->sc_unit); - - if (sc->sc_dma) - b1dma_reset(sc); /* PCI cards */ - else if (sc->sc_t1) - t1_reset(sc); /* ISA attachment T1 */ - else - b1_reset(sc); /* ISA attachment B1 */ - - DELAY(1000); - - if(bootverbose) - printf("iavc%d: start loading %d bytes firmware ....\n", sc->sc_unit, len); - - while (len && b1io_save_put_byte(sc, *cp++) == 0) - len--; - - if (len) { - printf("iavc%d: loading failed, can't write to card, len = %d\n", - sc->sc_unit, len); - return (EIO); - } - - if(bootverbose) - printf("iavc%d: firmware loaded, wait for ACK ....\n", sc->sc_unit); - - if(sc->sc_capi.card_type == CARD_TYPEC_AVM_B1_ISA) - iavc_put_byte(sc, SEND_POLL); - else - iavc_put_byte(sc, SEND_POLLACK); - - for (len = 0; len < 1000 && !iavc_rx_full(sc); len++) - DELAY(100); - - if (!iavc_rx_full(sc)) { - printf("iavc%d: loading failed, no ack\n", sc->sc_unit); - return (EIO); - } - - val = iavc_get_byte(sc); - - if ((sc->sc_dma && val != RECEIVE_POLLDWORD) || - (!sc->sc_dma && val != RECEIVE_POLL)) { - printf("iavc%d: loading failed, bad ack = %02x\n", sc->sc_unit, val); - return (EIO); - } - - if(bootverbose) - printf("iavc%d: got ACK = 0x%02x\n", sc->sc_unit, val); - - if (sc->sc_dma) { - /* Start the DMA engine */ - - int s = SPLI4B(); - - sc->sc_csr = AVM_FLAG; - AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); - AMCC_WRITE(sc, AMCC_MCSR, (EN_A2P_TRANSFERS|EN_P2A_TRANSFERS| - A2P_HI_PRIORITY|P2A_HI_PRIORITY| - RESET_A2P_FLAGS|RESET_P2A_FLAGS)); - - iavc_write_port(sc, 0x07, 0x30); /* XXX magic numbers from */ - iavc_write_port(sc, 0x10, 0xf0); /* XXX the linux driver */ - - sc->sc_recvlen = 0; - AMCC_WRITE(sc, AMCC_RXPTR, vtophys(&sc->sc_recvbuf[0])); - AMCC_WRITE(sc, AMCC_RXLEN, 4); - sc->sc_csr |= EN_RX_TC_INT|EN_TX_TC_INT; - AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); - - splx(s); - } - - if(sc->sc_capi.card_type == CARD_TYPEC_AVM_B1_ISA) - b1isa_setup_irq(sc); - - iavc_send_init(sc); - - return 0; -} - -int iavc_register(capi_softc_t *capi_sc, int applid, int nchan) -{ - iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; - struct mbuf *m = i4b_Dgetmbuf(23); - u_int8_t *p; - - if (!m) { - printf("iavc%d: can't get memory\n", sc->sc_unit); - return (ENOMEM); - } - - /* - * byte 0x12 = SEND_REGISTER - * dword ApplId - * dword NumMessages - * dword NumB3Connections 0..nbch - * dword NumB3Blocks - * dword B3Size - */ - - p = amcc_put_byte(mtod(m, u_int8_t*), 0); - p = amcc_put_byte(p, 0); - p = amcc_put_byte(p, SEND_REGISTER); - p = amcc_put_word(p, applid); -#if 0 - p = amcc_put_word(p, 1024 + (nchan + 1)); -#else - p = amcc_put_word(p, 1024 * (nchan + 1)); -#endif - p = amcc_put_word(p, nchan); - p = amcc_put_word(p, 8); - p = amcc_put_word(p, 2048); - - _IF_ENQUEUE(&sc->sc_txq, m); - - iavc_start_tx(sc); - - return 0; -} - -int iavc_release(capi_softc_t *capi_sc, int applid) -{ - iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; - struct mbuf *m = i4b_Dgetmbuf(7); - u_int8_t *p; - - if (!m) { - printf("iavc%d: can't get memory\n", sc->sc_unit); - return (ENOMEM); - } - - /* - * byte 0x14 = SEND_RELEASE - * dword ApplId - */ - - p = amcc_put_byte(mtod(m, u_int8_t*), 0); - p = amcc_put_byte(p, 0); - p = amcc_put_byte(p, SEND_RELEASE); - p = amcc_put_word(p, applid); - - _IF_ENQUEUE(&sc->sc_txq, m); - - iavc_start_tx(sc); - return 0; -} - -int iavc_send(capi_softc_t *capi_sc, struct mbuf *m) -{ - iavc_softc_t *sc = (iavc_softc_t*) capi_sc->ctx; - - if (sc->sc_state != IAVC_UP) { - printf("iavc%d: attempt to send before device up\n", sc->sc_unit); - - if (m->m_next) i4b_Bfreembuf(m->m_next); - i4b_Dfreembuf(m); - - return (ENXIO); - } - - if (_IF_QFULL(&sc->sc_txq)) { - - _IF_DROP(&sc->sc_txq); - - printf("iavc%d: tx overflow, message dropped\n", sc->sc_unit); - - if (m->m_next) i4b_Bfreembuf(m->m_next); - i4b_Dfreembuf(m); - - } else { - _IF_ENQUEUE(&sc->sc_txq, m); - - iavc_start_tx(sc); - } - - return 0; -} - -/* -// Functions called by ourself during the initialization sequence: -// --------------------------------------------------------------- -// -// iavc_send_init -// Sends the system initialization message to a newly loaded -// board, and sets state to INIT. -*/ - -static int iavc_send_init(iavc_softc_t *sc) -{ - struct mbuf *m = i4b_Dgetmbuf(15); - u_int8_t *p; - int s; - - if (!m) { - printf("iavc%d: can't get memory\n", sc->sc_unit); - return (ENOMEM); - } - - /* - * byte 0x11 = SEND_INIT - * dword NumApplications - * dword NumNCCIs - * dword BoardNumber - */ - - p = amcc_put_byte(mtod(m, u_int8_t*), 0); - p = amcc_put_byte(p, 0); - p = amcc_put_byte(p, SEND_INIT); - p = amcc_put_word(p, 1); /* XXX MaxAppl XXX */ - p = amcc_put_word(p, sc->sc_capi.sc_nbch); - p = amcc_put_word(p, sc->sc_unit); - - s = SPLI4B(); - _IF_ENQUEUE(&sc->sc_txq, m); - - iavc_start_tx(sc); - - sc->sc_state = IAVC_INIT; - splx(s); - return 0; -} - -/* -// Functions called during normal operation: -// ----------------------------------------- -// -// iavc_receive_init -// Reads the initialization reply and calls capi_ll_control(). -// -// iavc_receive_new_ncci -// Reads a new NCCI notification and calls capi_ll_control(). -// -// iavc_receive_free_ncci -// Reads a freed NCCI notification and calls capi_ll_control(). -// -// iavc_receive_task_ready -// Reads a task ready message -- which should not occur XXX. -// -// iavc_receive_debugmsg -// Reads a debug message -- which should not occur XXX. -// -// iavc_receive_start -// Reads a START TRANSMIT message and unblocks device. -// -// iavc_receive_stop -// Reads a STOP TRANSMIT message and blocks device. -// -// iavc_receive -// Reads an incoming message and calls capi_ll_receive(). -*/ - -static int iavc_receive_init(iavc_softc_t *sc, u_int8_t *dmabuf) -{ - u_int32_t Length; - u_int8_t *p; - u_int8_t *cardtype, *serial, *profile, *version, *caps, *prot; - - if (sc->sc_dma) { - p = amcc_get_word(dmabuf, &Length); - } else { - Length = iavc_get_slice(sc, sc->sc_recvbuf); - p = sc->sc_recvbuf; - } - -#if 0 - { - int len = 0; - printf("iavc%d: rx_init: ", sc->sc_unit); - while (len < Length) { - printf(" %02x", p[len]); - if (len && (len % 16) == 0) printf("\n"); - len++; - } - if (len % 16) printf("\n"); - } -#endif - - version = (p + 1); - p += (*p + 1); /* driver version */ - cardtype = (p + 1); - p += (*p + 1); /* card type */ - p += (*p + 1); /* hardware ID */ - serial = (p + 1); - p += (*p + 1); /* serial number */ - caps = (p + 1); - p += (*p + 1); /* supported options */ - prot = (p + 1); - p += (*p + 1); /* supported protocols */ - profile = (p + 1); - - if (cardtype && serial && profile) { - int nbch = ((profile[3]<<8) | profile[2]); - - printf("iavc%d: AVM %s, s/n %s, %d chans, f/w rev %s, prot %s\n", - sc->sc_unit, cardtype, serial, nbch, version, prot); - - if(bootverbose) - printf("iavc%d: %s\n", sc->sc_unit, caps); - - capi_ll_control(&sc->sc_capi, CAPI_CTRL_PROFILE, (int) profile); - - } else { - printf("iavc%d: no profile data in info response?\n", sc->sc_unit); - } - - sc->sc_blocked = TRUE; /* controller will send START when ready */ - return 0; -} - -static int iavc_receive_start(iavc_softc_t *sc, u_int8_t *dmabuf) -{ - struct mbuf *m = i4b_Dgetmbuf(3); - u_int8_t *p; - - if (sc->sc_blocked && sc->sc_state == IAVC_UP) - printf("iavc%d: receive_start\n", sc->sc_unit); - - if (!m) { - printf("iavc%d: can't get memory\n", sc->sc_unit); - return (ENOMEM); - } - - /* - * byte 0x73 = SEND_POLLACK - */ - - p = amcc_put_byte(mtod(m, u_int8_t*), 0); - p = amcc_put_byte(p, 0); - p = amcc_put_byte(p, SEND_POLLACK); - - _IF_PREPEND(&sc->sc_txq, m); - - NDBGL4(L4_IAVCDBG, "iavc%d: blocked = %d, state = %d", - sc->sc_unit, sc->sc_blocked, sc->sc_state); - - sc->sc_blocked = FALSE; - iavc_start_tx(sc); - - /* If this was our first START, register our readiness */ - - if (sc->sc_state != IAVC_UP) { - sc->sc_state = IAVC_UP; - capi_ll_control(&sc->sc_capi, CAPI_CTRL_READY, TRUE); - } - - return 0; -} - -static int iavc_receive_stop(iavc_softc_t *sc, u_int8_t *dmabuf) -{ - printf("iavc%d: receive_stop\n", sc->sc_unit); - sc->sc_blocked = TRUE; - return 0; -} - -static int iavc_receive_new_ncci(iavc_softc_t *sc, u_int8_t *dmabuf) -{ - u_int32_t ApplId, NCCI, WindowSize; - - if (sc->sc_dma) { - dmabuf = amcc_get_word(dmabuf, &ApplId); - dmabuf = amcc_get_word(dmabuf, &NCCI); - dmabuf = amcc_get_word(dmabuf, &WindowSize); - } else { - ApplId = iavc_get_word(sc); - NCCI = iavc_get_word(sc); - WindowSize = iavc_get_word(sc); - } - - capi_ll_control(&sc->sc_capi, CAPI_CTRL_NEW_NCCI, NCCI); - return 0; -} - -static int iavc_receive_free_ncci(iavc_softc_t *sc, u_int8_t *dmabuf) -{ - u_int32_t ApplId, NCCI; - - if (sc->sc_dma) { - dmabuf = amcc_get_word(dmabuf, &ApplId); - dmabuf = amcc_get_word(dmabuf, &NCCI); - } else { - ApplId = iavc_get_word(sc); - NCCI = iavc_get_word(sc); - } - - capi_ll_control(&sc->sc_capi, CAPI_CTRL_FREE_NCCI, NCCI); - return 0; -} - -static int iavc_receive_task_ready(iavc_softc_t *sc, u_int8_t *dmabuf) -{ - u_int32_t TaskId, Length; - u_int8_t *p; - printf("iavc%d: receive_task_ready\n", sc->sc_unit); - - if (sc->sc_dma) { - p = amcc_get_word(dmabuf, &TaskId); - p = amcc_get_word(p, &Length); - } else { - TaskId = iavc_get_word(sc); - Length = iavc_get_slice(sc, sc->sc_recvbuf); - p = sc->sc_recvbuf; - } - - /* XXX could show the message if trace enabled? XXX */ - return 0; -} - -static int iavc_receive_debugmsg(iavc_softc_t *sc, u_int8_t *dmabuf) -{ - u_int32_t Length; - u_int8_t *p; - printf("iavc%d: receive_debugmsg\n", sc->sc_unit); - - if (sc->sc_dma) { - p = amcc_get_word(dmabuf, &Length); - } else { - Length = iavc_get_slice(sc, sc->sc_recvbuf); - p = sc->sc_recvbuf; - } - - /* XXX could show the message if trace enabled? XXX */ - return 0; -} - -static int iavc_receive(iavc_softc_t *sc, u_int8_t *dmabuf, int b3data) -{ - struct mbuf *m; - u_int32_t ApplId, Length; - - /* - * byte 0x21 = RECEIVE_MESSAGE - * dword ApplId - * dword length - * ... CAPI msg - * - * --or-- - * - * byte 0x22 = RECEIVE_DATA_B3_IND - * dword ApplId - * dword length - * ... CAPI msg - * dword datalen - * ... B3 data - */ - - if (sc->sc_dma) { - dmabuf = amcc_get_word(dmabuf, &ApplId); - dmabuf = amcc_get_word(dmabuf, &Length); - } else { - ApplId = iavc_get_word(sc); - Length = iavc_get_slice(sc, sc->sc_recvbuf); - dmabuf = sc->sc_recvbuf; - } - - m = i4b_Dgetmbuf(Length); - if (!m) { - printf("iavc%d: can't get memory for receive\n", sc->sc_unit); - return (ENOMEM); - } - - bcopy(dmabuf, mtod(m, u_int8_t*), Length); - -#if 0 - { - u_int8_t *p = mtod(m, u_int8_t*); - int len = 0; - printf("iavc%d: applid=%d, len=%d\n", sc->sc_unit, ApplId, Length); - while (len < m->m_len) { - printf(" %02x", p[len]); - if (len && (len % 16) == 0) printf("\n"); - len++; - } - if (len % 16) printf("\n"); - } -#endif - - if (b3data) { - if (sc->sc_dma) { - dmabuf = amcc_get_word(dmabuf + Length, &Length); - } else { - Length = iavc_get_slice(sc, sc->sc_recvbuf); - dmabuf = sc->sc_recvbuf; - } - - m->m_next = i4b_Bgetmbuf(Length); - if (!m->m_next) { - printf("iavc%d: can't get memory for receive\n", sc->sc_unit); - i4b_Dfreembuf(m); - return (ENOMEM); - } - - bcopy(dmabuf, mtod(m->m_next, u_int8_t*), Length); - } - - capi_ll_receive(&sc->sc_capi, m); - return 0; -} - -/* -// iavc_handle_intr -// Checks device interrupt status and calls iavc_handle_{rx,tx}() -// as necessary. -// -// iavc_handle_rx -// Reads in the command byte and calls the subroutines above. -// -// iavc_start_tx -// Initiates DMA on the next queued message if possible. -*/ - -void iavc_handle_intr(iavc_softc_t *sc) -{ - u_int32_t status; - u_int32_t newcsr; - - if (!sc->sc_dma) { - while (iavc_rx_full(sc)) - iavc_handle_rx(sc); - return; - } - - status = AMCC_READ(sc, AMCC_INTCSR); - if ((status & ANY_S5933_INT) == 0) - return; - - newcsr = sc->sc_csr | (status & ALL_INT); - if (status & TX_TC_INT) newcsr &= ~EN_TX_TC_INT; - if (status & RX_TC_INT) newcsr &= ~EN_RX_TC_INT; - AMCC_WRITE(sc, AMCC_INTCSR, newcsr); - sc->sc_intr = TRUE; - - if (status & RX_TC_INT) { - u_int32_t rxlen; - - if (sc->sc_recvlen == 0) { - sc->sc_recvlen = *((u_int32_t*)(&sc->sc_recvbuf[0])); - rxlen = (sc->sc_recvlen + 3) & ~3; - AMCC_WRITE(sc, AMCC_RXPTR, vtophys(&sc->sc_recvbuf[4])); - AMCC_WRITE(sc, AMCC_RXLEN, rxlen); - } else { - iavc_handle_rx(sc); - sc->sc_recvlen = 0; - AMCC_WRITE(sc, AMCC_RXPTR, vtophys(&sc->sc_recvbuf[0])); - AMCC_WRITE(sc, AMCC_RXLEN, 4); - } - } - - if (status & TX_TC_INT) { - sc->sc_csr &= ~EN_TX_TC_INT; - iavc_start_tx(sc); - } - - AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); - sc->sc_intr = FALSE; -} - -static void iavc_handle_rx(iavc_softc_t *sc) -{ - u_int8_t *dmabuf = 0, cmd; - - if (sc->sc_dma) { - dmabuf = amcc_get_byte(&sc->sc_recvbuf[4], &cmd); - } else { - cmd = iavc_get_byte(sc); - } - - NDBGL4(L4_IAVCDBG, "iavc%d: command = 0x%02x", sc->sc_unit, cmd); - - switch (cmd) { - case RECEIVE_DATA_B3_IND: - iavc_receive(sc, dmabuf, TRUE); - break; - - case RECEIVE_MESSAGE: - iavc_receive(sc, dmabuf, FALSE); - break; - - case RECEIVE_NEW_NCCI: - iavc_receive_new_ncci(sc, dmabuf); - break; - - case RECEIVE_FREE_NCCI: - iavc_receive_free_ncci(sc, dmabuf); - break; - - case RECEIVE_START: - iavc_receive_start(sc, dmabuf); - break; - - case RECEIVE_STOP: - iavc_receive_stop(sc, dmabuf); - break; - - case RECEIVE_INIT: - iavc_receive_init(sc, dmabuf); - break; - - case RECEIVE_TASK_READY: - iavc_receive_task_ready(sc, dmabuf); - break; - - case RECEIVE_DEBUGMSG: - iavc_receive_debugmsg(sc, dmabuf); - break; - - default: - printf("iavc%d: unknown msg %02x\n", sc->sc_unit, cmd); - } -} - -static void iavc_start_tx(iavc_softc_t *sc) -{ - struct mbuf *m; - u_int8_t *dmabuf; - u_int32_t txlen = 0; - - /* If device has put us on hold, punt. */ - - if (sc->sc_blocked) { - return; - } - - /* If using DMA and transmitter busy, punt. */ - - if (sc->sc_dma && (sc->sc_csr & EN_TX_TC_INT)) { - return; - } - - /* Else, see if we have messages to send. */ - - _IF_DEQUEUE(&sc->sc_txq, m); - if (!m) { - return; - } - - /* Have message, will send. */ - - if (CAPIMSG_LEN(m->m_data)) { - /* A proper CAPI message, possibly with B3 data */ - - if (sc->sc_dma) { - /* Copy message to DMA buffer. */ - - if (m->m_next) { - dmabuf = amcc_put_byte(&sc->sc_sendbuf[0], SEND_DATA_B3_REQ); - } else { - dmabuf = amcc_put_byte(&sc->sc_sendbuf[0], SEND_MESSAGE); - } - - dmabuf = amcc_put_word(dmabuf, m->m_len); - bcopy(m->m_data, dmabuf, m->m_len); - dmabuf += m->m_len; - txlen = 5 + m->m_len; - - if (m->m_next) { - dmabuf = amcc_put_word(dmabuf, m->m_next->m_len); - bcopy(m->m_next->m_data, dmabuf, m->m_next->m_len); - txlen += 4 + m->m_next->m_len; - } - - } else { - /* Use PIO. */ - - if (m->m_next) { - iavc_put_byte(sc, SEND_DATA_B3_REQ); - NDBGL4(L4_IAVCDBG, "iavc%d: tx SDB3R msg, len = %d", sc->sc_unit, m->m_len); - } else { - iavc_put_byte(sc, SEND_MESSAGE); - NDBGL4(L4_IAVCDBG, "iavc%d: tx SM msg, len = %d", sc->sc_unit, m->m_len); - } -#if 0 - { - u_int8_t *p = mtod(m, u_int8_t*); - int len; - for (len = 0; len < m->m_len; len++) { - printf(" %02x", *p++); - if (len && (len % 16) == 0) printf("\n"); - } - if (len % 16) printf("\n"); - } -#endif - - iavc_put_slice(sc, m->m_data, m->m_len); - - if (m->m_next) { - iavc_put_slice(sc, m->m_next->m_data, m->m_next->m_len); - } - } - - } else { - /* A board control message to be sent as is */ - - if (sc->sc_dma) { - bcopy(m->m_data + 2, &sc->sc_sendbuf[0], m->m_len - 2); - txlen = m->m_len - 2; - - } else { -#if 0 - { - u_int8_t *p = mtod(m, u_int8_t*) + 2; - int len; - printf("iavc%d: tx BDC msg, len = %d, msg =", sc->sc_unit, m->m_len-2); - for (len = 0; len < m->m_len-2; len++) { - printf(" %02x", *p++); - if (len && (len % 16) == 0) printf("\n"); - } - if (len % 16) printf("\n"); - } -#endif - - txlen = m->m_len - 2; - dmabuf = mtod(m, char*) + 2; - while(txlen--) - b1io_put_byte(sc, *dmabuf++); - } - } - - if (m->m_next) { - i4b_Bfreembuf(m->m_next); - m->m_next = NULL; - } - i4b_Dfreembuf(m); - - if (sc->sc_dma) { - /* Start transmitter */ - - txlen = (txlen + 3) & ~3; - AMCC_WRITE(sc, AMCC_TXPTR, vtophys(&sc->sc_sendbuf[0])); - AMCC_WRITE(sc, AMCC_TXLEN, txlen); - sc->sc_csr |= EN_TX_TC_INT; - - if (!sc->sc_intr) - AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); - } -} - -int t1io_get_slice(iavc_softc_t *sc, u_int8_t *dp) -{ - int len, i; - len = i = b1io_get_word(sc); - if (t1io_isfastlink(sc)) { - int status; - while (i) { - status = t1io_fifostatus(sc) & (T1F_IREADY|T1F_IHALF); - if (i >= FIFO_INPBSIZE) status |= T1F_IFULL; - - switch (status) { - case T1F_IREADY|T1F_IHALF|T1F_IFULL: - bus_space_read_multi_1(sc->sc_io_bt, sc->sc_io_bh, - T1_READ, dp, FIFO_INPBSIZE); - dp += FIFO_INPBSIZE; - i -= FIFO_INPBSIZE; - break; - - case T1F_IREADY|T1F_IHALF: - bus_space_read_multi_1(sc->sc_io_bt, sc->sc_io_bh, - T1_READ, dp, i); - dp += i; - i = 0; - break; - - default: - *dp++ = b1io_get_byte(sc); - i--; - } - } - } else { /* not fastlink */ - if (i--) *dp++ = b1io_get_byte(sc); - } - return len; -} - -void t1io_put_slice(iavc_softc_t *sc, u_int8_t *dp, int len) -{ - int i = len; - b1io_put_word(sc, i); - if (t1io_isfastlink(sc)) { - int status; - while (i) { - status = t1io_fifostatus(sc) & (T1F_OREADY|T1F_OHALF); - if (i >= FIFO_OUTBSIZE) status |= T1F_OFULL; - - switch (status) { - case T1F_OREADY|T1F_OHALF|T1F_OFULL: - bus_space_write_multi_1(sc->sc_io_bt, sc->sc_io_bh, - T1_WRITE, dp, FIFO_OUTBSIZE); - dp += FIFO_OUTBSIZE; - i -= FIFO_OUTBSIZE; - break; - - case T1F_OREADY|T1F_OHALF: - bus_space_write_multi_1(sc->sc_io_bt, sc->sc_io_bh, - T1_WRITE, dp, i); - dp += i; - i = 0; - break; - - default: - b1io_put_byte(sc, *dp++); - i--; - } - } - } else { - while (i--) b1io_put_byte(sc, *dp++); - } -} - -u_int32_t b1io_get_word(iavc_softc_t *sc) -{ - u_int32_t val = 0; - val |= b1io_get_byte(sc); - val |= (b1io_get_byte(sc) << 8); - val |= (b1io_get_byte(sc) << 16); - val |= (b1io_get_byte(sc) << 24); - return val; -} - -void b1io_put_word(iavc_softc_t *sc, u_int32_t val) -{ - b1io_put_byte(sc, (val & 0xff)); - b1io_put_byte(sc, (val >> 8) & 0xff); - b1io_put_byte(sc, (val >> 16) & 0xff); - b1io_put_byte(sc, (val >> 24) & 0xff); -} - -int b1io_get_slice(iavc_softc_t *sc, u_int8_t *dp) -{ - int len, i; - len = i = b1io_get_word(sc); - while (i--) *dp++ = b1io_get_byte(sc); - return len; -} - -void b1io_put_slice(iavc_softc_t *sc, u_int8_t *dp, int len) -{ - b1io_put_word(sc, len); - while (len--) b1io_put_byte(sc, *dp++); -} - -u_int32_t b1io_read_reg(iavc_softc_t *sc, int reg) -{ - b1io_put_byte(sc, READ_REGISTER); - b1io_put_word(sc, reg); - return b1io_get_word(sc); -} - -u_int32_t b1io_write_reg(iavc_softc_t *sc, int reg, u_int32_t val) -{ - b1io_put_byte(sc, WRITE_REGISTER); - b1io_put_word(sc, reg); - b1io_put_word(sc, val); - return b1io_get_word(sc); -} - -u_int8_t b1io_get_byte(iavc_softc_t *sc) -{ - int spin = 0; - while (!b1io_rx_full(sc) && spin < B1IO_WAIT_MAX) { - spin++; DELAY(B1IO_WAIT_DLY); - } - if (b1io_rx_full(sc)) - return bus_space_read_1(sc->sc_io_bt, sc->sc_io_bh, B1_READ); - printf("iavc%d: rx not completed\n", sc->sc_unit); - return 0xff; -} - -int b1io_put_byte(iavc_softc_t *sc, u_int8_t val) -{ - int spin = 0; - while (!b1io_tx_empty(sc) && spin < B1IO_WAIT_MAX) { - spin++; DELAY(B1IO_WAIT_DLY); - } - if (b1io_tx_empty(sc)) { - bus_space_write_1(sc->sc_io_bt, sc->sc_io_bh, B1_WRITE, val); - return 0; - } - printf("iavc%d: tx not emptied\n", sc->sc_unit); - return -1; -} - -int b1io_save_put_byte(iavc_softc_t *sc, u_int8_t val) -{ - int spin = 0; - while (!b1io_tx_empty(sc) && spin < B1IO_WAIT_MAX) { - spin++; DELAY(B1IO_WAIT_DLY); - } - if (b1io_tx_empty(sc)) { - b1io_outp(sc, B1_WRITE, val); - return 0; - } - printf("iavc%d: tx not emptied\n", sc->sc_unit); - return -1; -} diff --git a/sys/i4b/capi/iavc/iavc_pci.c b/sys/i4b/capi/iavc/iavc_pci.c deleted file mode 100644 index 8f1053539909..000000000000 --- a/sys/i4b/capi/iavc/iavc_pci.c +++ /dev/null @@ -1,272 +0,0 @@ -/*- - * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* capi/iavc/iavc_pci.c - * The AVM ISDN controllers' PCI bus attachment handling. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include - -/* PCI device ids */ - -#define PCI_AVM_VID 0x1244 -#define PCI_AVMT1_DID 0x1200 -#define PCI_AVMB1_DID 0x0700 - -/* PCI driver linkage */ - -static void iavc_pci_intr(iavc_softc_t *sc); -static int iavc_pci_probe(device_t dev); -static int iavc_pci_attach(device_t dev); - -static device_method_t iavc_pci_methods[] = -{ - DEVMETHOD(device_probe, iavc_pci_probe), - DEVMETHOD(device_attach, iavc_pci_attach), - { 0, 0 } -}; - -static driver_t iavc_pci_driver = -{ - "iavc", - iavc_pci_methods, - 0 -}; - -static devclass_t iavc_pci_devclass; - -DRIVER_MODULE(iavc, pci, iavc_pci_driver, iavc_pci_devclass, 0, 0); - -/* Driver soft contexts */ - -iavc_softc_t iavc_sc[IAVC_MAXUNIT]; - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ - -static int -iavc_pci_probe(device_t dev) -{ - u_int16_t did = pci_get_device(dev); - u_int16_t vid = pci_get_vendor(dev); - - if ((vid == PCI_AVM_VID) && (did == PCI_AVMT1_DID)) { - device_set_desc(dev, "AVM T1 PCI"); - } else if ((vid == PCI_AVM_VID) && (did == PCI_AVMB1_DID)) { - device_set_desc(dev, "AVM B1 PCI"); - } else { - return(ENXIO); - } - - return(0); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ - -static int -iavc_pci_attach(device_t dev) -{ - struct iavc_softc *sc; - void *ih = 0; - u_int16_t did = pci_get_device(dev); - int unit = device_get_unit(dev), ret; - - /* check max unit range */ - - if (unit >= IAVC_MAXUNIT) { - printf("iavc%d: too many units\n", unit); - return(ENXIO); - } - - sc = iavc_find_sc(unit); /* get softc */ - - sc->sc_unit = unit; - - /* use the i/o mapped base address */ - - sc->sc_resources.io_rid[0] = 0x14; - - if (!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], RF_ACTIVE))) { - printf("iavc%d: can't allocate io region\n", unit); - return(ENXIO); - } - - sc->sc_iobase = rman_get_start(sc->sc_resources.io_base[0]); - sc->sc_io_bt = rman_get_bustag(sc->sc_resources.io_base[0]); - sc->sc_io_bh = rman_get_bushandle(sc->sc_resources.io_base[0]); - - /* use the memory mapped DMA controller */ - - sc->sc_resources.mem_rid = 0x10; - - if (!(sc->sc_resources.mem = - bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->sc_resources.mem_rid, RF_ACTIVE))) { - printf("iavc%d: can't allocate memory region\n", unit); - return(ENXIO); - } - - sc->sc_membase = rman_get_start(sc->sc_resources.mem); - sc->sc_mem_bt = rman_get_bustag(sc->sc_resources.mem); - sc->sc_mem_bh = rman_get_bushandle(sc->sc_resources.mem); - - /* do some detection */ - - sc->sc_t1 = FALSE; - sc->sc_dma = FALSE; - b1dma_reset(sc); - - if (did == PCI_AVMT1_DID) { - sc->sc_capi.card_type = CARD_TYPEC_AVM_T1_PCI; - sc->sc_capi.sc_nbch = 30; - ret = t1_detect(sc); - if (ret) { - if (ret < 6) { - printf("iavc%d: no card detected?\n", sc->sc_unit); - } else { - printf("iavc%d: black box not on\n", sc->sc_unit); - } - return(ENXIO); - } else { - sc->sc_dma = TRUE; - sc->sc_t1 = TRUE; - } - - } else if (did == PCI_AVMB1_DID) { - sc->sc_capi.card_type = CARD_TYPEC_AVM_B1_PCI; - sc->sc_capi.sc_nbch = 2; - ret = b1dma_detect(sc); - if (ret) { - ret = b1_detect(sc); - if (ret) { - printf("iavc%d: no card detected?\n", sc->sc_unit); - return(ENXIO); - } - } else { - sc->sc_dma = TRUE; - } - } - - if (sc->sc_dma) b1dma_reset(sc); -#if 0 - if (sc->sc_t1) t1_reset(sc); - else b1_reset(sc); -#endif - - /* of course we need an interrupt */ - - sc->sc_resources.irq_rid = 0x00; - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_resources.irq_rid, - RF_SHAREABLE|RF_ACTIVE))) { - printf("iavc%d: can't allocate irq\n",unit); - return(ENXIO); - } - - /* finalize our own context */ - - memset(&sc->sc_txq, 0, sizeof(struct ifqueue)); - sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4; - - if(!mtx_initialized(&sc->sc_txq.ifq_mtx)) - mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_pci", NULL, MTX_DEF); - - sc->sc_intr = FALSE; - sc->sc_state = IAVC_DOWN; - sc->sc_blocked = FALSE; - - /* setup capi link */ - - sc->sc_capi.load = iavc_load; - sc->sc_capi.reg_appl = iavc_register; - sc->sc_capi.rel_appl = iavc_release; - sc->sc_capi.send = iavc_send; - sc->sc_capi.ctx = (void*) sc; - - if (capi_ll_attach(&sc->sc_capi)) { - printf("iavc%d: capi attach failed\n", unit); - return(ENXIO); - } - - /* setup the interrupt */ - - if(bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, - NULL, (void(*)(void*))iavc_pci_intr, - sc, &ih)) { - printf("iavc%d: irq setup failed\n", unit); - return(ENXIO); - } - - /* the board is now ready to be loaded */ - - return(0); -} - -/*---------------------------------------------------------------------------* - * IRQ handler - *---------------------------------------------------------------------------*/ - -static void -iavc_pci_intr(struct iavc_softc *sc) -{ - iavc_handle_intr(sc); -} diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c deleted file mode 100644 index 4b391706b24c..000000000000 --- a/sys/i4b/driver/i4b_ctl.c +++ /dev/null @@ -1,213 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ctl.c - i4b system control port driver - * ------------------------------------------ - * last edit-date: [Sun Mar 17 09:49:24 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include - -static int openflag = 0; - -static d_open_t i4bctlopen; -static d_close_t i4bctlclose; -static d_ioctl_t i4bctlioctl; -static d_poll_t i4bctlpoll; - - -static struct cdevsw i4bctl_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = i4bctlopen, - .d_close = i4bctlclose, - .d_ioctl = i4bctlioctl, - .d_poll = i4bctlpoll, - .d_name = "i4bctl", -}; - -static void i4bctlattach(void *); -PSEUDO_SET(i4bctlattach, i4b_i4bctldrv); - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -static void -i4bctlattach(void *dummy) -{ - printf("i4bctl: ISDN system control port attached\n"); - make_dev(&i4bctl_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4bctl"); -} - -/*---------------------------------------------------------------------------* - * i4bctlopen - device driver open routine - *---------------------------------------------------------------------------*/ -static int -i4bctlopen(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - if(minor(dev)) - return (ENXIO); - - if(openflag) - return (EBUSY); - - openflag = 1; - - return (0); -} - -/*---------------------------------------------------------------------------* - * i4bctlclose - device driver close routine - *---------------------------------------------------------------------------*/ -static int -i4bctlclose(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - openflag = 0; - return (0); -} - -/*---------------------------------------------------------------------------* - * i4bctlioctl - device driver ioctl routine - *---------------------------------------------------------------------------*/ -static int -i4bctlioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) -{ -#if DO_I4B_DEBUG - ctl_debug_t *cdbg; - int error = 0; -#endif - -#if !DO_I4B_DEBUG - return(ENODEV); -#else - if(minor(dev)) - return(ENODEV); - - switch(cmd) - { - case I4B_CTL_GET_DEBUG: - cdbg = (ctl_debug_t *)data; - cdbg->l1 = i4b_l1_debug; - cdbg->l2 = i4b_l2_debug; - cdbg->l3 = i4b_l3_debug; - cdbg->l4 = i4b_l4_debug; - break; - - case I4B_CTL_SET_DEBUG: - cdbg = (ctl_debug_t *)data; - i4b_l1_debug = cdbg->l1; - i4b_l2_debug = cdbg->l2; - i4b_l3_debug = cdbg->l3; - i4b_l4_debug = cdbg->l4; - break; - - case I4B_CTL_GET_CHIPSTAT: - { - struct chipstat *cst; - cst = (struct chipstat *)data; - (*ctrl_desc[cst->driver_unit].N_MGMT_COMMAND)(cst->driver_unit, CMR_GCST, cst); - break; - } - - case I4B_CTL_CLR_CHIPSTAT: - { - struct chipstat *cst; - cst = (struct chipstat *)data; - (*ctrl_desc[cst->driver_unit].N_MGMT_COMMAND)(cst->driver_unit, CMR_CCST, cst); - break; - } - - case I4B_CTL_GET_LAPDSTAT: - { - l2stat_t *l2s; - l2_softc_t *sc; - l2s = (l2stat_t *)data; - - if( l2s->unit < 0 || l2s->unit > MAXL1UNITS) - { - error = EINVAL; - break; - } - - sc = &l2_softc[l2s->unit]; - - bcopy(&sc->stat, &l2s->lapdstat, sizeof(lapdstat_t)); - break; - } - - case I4B_CTL_CLR_LAPDSTAT: - { - int *up; - l2_softc_t *sc; - up = (int *)data; - - if( *up < 0 || *up > MAXL1UNITS) - { - error = EINVAL; - break; - } - - sc = &l2_softc[*up]; - - bzero(&sc->stat, sizeof(lapdstat_t)); - break; - } - - default: - error = ENOTTY; - break; - } - return(error); -#endif /* DO_I4B_DEBUG */ -} - -/*---------------------------------------------------------------------------* - * i4bctlpoll - device driver poll routine - *---------------------------------------------------------------------------*/ -static int -i4bctlpoll (struct cdev *dev, int events, struct thread *td) -{ - return (ENODEV); -} diff --git a/sys/i4b/driver/i4b_ing.c b/sys/i4b/driver/i4b_ing.c deleted file mode 100644 index 4c3aa6ace0c5..000000000000 --- a/sys/i4b/driver/i4b_ing.c +++ /dev/null @@ -1,856 +0,0 @@ -/*- - * Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ing.c - isdn4bsd B-channel to netgraph driver - * ------------------------------------------------- - * last edit-date: [Sat Mar 9 14:09:53 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include - -#error "Cannot be used until I4B is locked." - -#define I4BINGACCT 1 /* enable accounting messages */ -#define I4BINGACCTINTVL 2 /* accounting msg interval in secs */ - -#define I4BINGMAXQLEN 50 /* max queue length */ - -/* initialized by L4 */ - -static drvr_link_t ing_drvr_linktab[NI4BING]; -static isdn_link_t *isdn_linktab[NI4BING]; - -struct ing_softc { - int sc_unit; /* unit number */ - int sc_state; /* state of the interface */ - call_desc_t *sc_cdp; /* ptr to call descriptor */ - int sc_updown; /* soft state of interface */ - struct ifqueue sc_fastq; /* interactive traffic */ - int sc_dialresp; /* dialresponse */ - int sc_lastdialresp;/* last dialresponse */ - -#if I4BINGACCT - struct callout_handle sc_callout; - int sc_iinb; /* isdn driver # of inbytes */ - int sc_ioutb; /* isdn driver # of outbytes */ - int sc_inb; /* # of bytes rx'd */ - int sc_outb; /* # of bytes tx'd */ - int sc_linb; /* last # of bytes rx'd */ - int sc_loutb; /* last # of bytes tx'd */ - int sc_fn; /* flag, first null acct */ -#endif - - int sc_inpkt; /* incoming packets */ - int sc_outpkt; /* outgoing packets */ - - struct ifqueue xmitq_hipri; /* hi-priority transmit queue */ - struct ifqueue xmitq; /* transmit queue */ - - node_p node; /* back pointer to node */ - char nodename[NG_NODESIZ]; /* store our node name */ - hook_p debughook; - hook_p hook; - - u_int packets_in; /* packets in from downstream */ - u_int packets_out; /* packets out towards downstream */ - u_int32_t flags; - -} ing_softc[NI4BING]; - -enum ing_states { - ST_IDLE, /* initialized, ready, idle */ - ST_DIALING, /* dialling out to remote */ - ST_CONNECTED /* connected to remote */ -}; - -static void i4bingattach(void *); - -PSEUDO_SET(i4bingattach, i4b_ing); - -static void ing_init_linktab(int unit); -static void ing_tx_queue_empty(int unit); - -/* ========= NETGRAPH ============= */ - -#define NG_ING_NODE_TYPE "i4bing" /* node type name */ -#define NGM_ING_COOKIE 947513046 /* node type cookie */ - -/* Hook names */ -#define NG_ING_HOOK_DEBUG "debug" -#define NG_ING_HOOK_RAW "rawdata" - -/* Netgraph commands understood by this node type */ -enum { - NGM_ING_SET_FLAG = 1, - NGM_ING_GET_STATUS, -}; - -/* This structure is returned by the NGM_ING_GET_STATUS command */ -struct ngingstat { - u_int packets_in; /* packets in from downstream */ - u_int packets_out; /* packets out towards downstream */ -}; - -/* - * This is used to define the 'parse type' for a struct ngingstat, which - * is bascially a description of how to convert a binary struct ngingstat - * to an ASCII string and back. See ng_parse.h for more info. - * - * This needs to be kept in sync with the above structure definition - */ -#define NG_ING_STATS_TYPE_INFO { \ - { "packets_in", &ng_parse_int32_type }, \ - { "packets_out", &ng_parse_int32_type }, \ - { NULL }, \ -} - -/* - * This section contains the netgraph method declarations for the - * sample node. These methods define the netgraph 'type'. - */ - -static ng_constructor_t ng_ing_constructor; -static ng_rcvmsg_t ng_ing_rcvmsg; -static ng_shutdown_t ng_ing_shutdown; -static ng_newhook_t ng_ing_newhook; -static ng_connect_t ng_ing_connect; -static ng_rcvdata_t ng_ing_rcvdata; -static ng_disconnect_t ng_ing_disconnect; - -/* Parse type for struct ngingstat */ -static const struct - ng_parse_struct_field ng_ing_stat_type_fields[] = - NG_ING_STATS_TYPE_INFO; - -static const struct ng_parse_type ng_ing_stat_type = { - &ng_parse_struct_type, - &ng_ing_stat_type_fields -}; - -/* List of commands and how to convert arguments to/from ASCII */ - -static const struct ng_cmdlist ng_ing_cmdlist[] = { - { - NGM_ING_COOKIE, - NGM_ING_GET_STATUS, - "getstatus", - NULL, - &ng_ing_stat_type, - }, - { - NGM_ING_COOKIE, - NGM_ING_SET_FLAG, - "setflag", - &ng_parse_int32_type, - NULL - }, - { 0 } -}; - -/* Netgraph node type descriptor */ -static struct ng_type typestruct = { - .version = NG_ABI_VERSION, - .name = NG_ING_NODE_TYPE, - .constructor = ng_ing_constructor, - .rcvmsg = ng_ing_rcvmsg, - .shutdown = ng_ing_shutdown, - .newhook = ng_ing_newhook, - .connect = ng_ing_connect, - .rcvdata = ng_ing_rcvdata, - .disconnect = ng_ing_disconnect, - .cmdlist = ng_ing_cmdlist, -}; - -NETGRAPH_INIT_ORDERED(ing, &typestruct, SI_SUB_DRIVERS, SI_ORDER_ANY); - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * interface attach routine at kernel boot time - *---------------------------------------------------------------------------*/ -static void -i4bingattach(void *dummy) -{ - struct ing_softc *sc = ing_softc; - int i; - int ret; - - printf("i4bing: %d i4b NetGraph ISDN B-channel device(s) attached\n", NI4BING); - - for(i=0; i < NI4BING; sc++, i++) - { - sc->sc_unit = i; - - ing_init_linktab(i); - - NDBGL4(L4_DIALST, "setting dial state to ST_IDLE"); - - sc->sc_state = ST_IDLE; - - sc->sc_fastq.ifq_maxlen = I4BINGMAXQLEN; - if(!mtx_initialized(&sc->sc_fastq.ifq_mtx)) - mtx_init(&sc->sc_fastq.ifq_mtx, "i4b_ing_fastq", NULL, MTX_DEF); - -#if I4BINGACCT - callout_handle_init(&sc->sc_callout); - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_fn = 1; -#endif - - sc->sc_inpkt = 0; - sc->sc_outpkt = 0; - - sc->sc_updown = SOFT_ENA; /* soft enabled */ - - sc->sc_dialresp = DSTAT_NONE; /* no response */ - sc->sc_lastdialresp = DSTAT_NONE; - - /* setup a netgraph node */ - - if ((ret = ng_make_node_common(&typestruct, &sc->node))) - { - printf("ing: ng_make_node_common, ret = %d\n!", ret); - } - - /* name the netgraph node */ - - sprintf(sc->nodename, "%s%d", NG_ING_NODE_TYPE, sc->sc_unit); - if((ret = ng_name_node(sc->node, sc->nodename))) - { - printf("ing: ng_name node, ret = %d\n!", ret); - NG_NODE_UNREF(sc->node); - break; - } - - NG_NODE_SET_PRIVATE(sc->node, sc); - - sc->xmitq.ifq_maxlen = IFQ_MAXLEN; - sc->xmitq_hipri.ifq_maxlen = IFQ_MAXLEN; - if(!mtx_initialized(&sc->xmitq.ifq_mtx)) - mtx_init(&sc->xmitq.ifq_mtx, "i4b_ing_xmitq", NULL, MTX_DEF); - if(!mtx_initialized(&sc->xmitq_hipri.ifq_mtx)) - mtx_init(&sc->xmitq_hipri.ifq_mtx, "i4b_ing_hipri", NULL, MTX_DEF); - } -} - -#ifdef I4BINGACCT -/*---------------------------------------------------------------------------* - * accounting timeout routine - *---------------------------------------------------------------------------*/ -static void -ing_timeout(struct ing_softc *sc) -{ - bchan_statistics_t bs; - int unit = sc->sc_unit; - - /* get # of bytes in and out from the HSCX driver */ - - (*isdn_linktab[unit]->bch_stat) - (isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs); - - sc->sc_ioutb += bs.outbytes; - sc->sc_iinb += bs.inbytes; - - if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) - { - int ri = (sc->sc_iinb - sc->sc_linb)/I4BINGACCTINTVL; - int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BINGACCTINTVL; - - if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb)) - sc->sc_fn = 0; - else - sc->sc_fn = 1; - - sc->sc_linb = sc->sc_iinb; - sc->sc_loutb = sc->sc_ioutb; - - i4b_l4_accounting(BDRV_ING, unit, ACCT_DURING, - sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb); - } - - sc->sc_callout = timeout((TIMEOUT_FUNC_T)ing_timeout, - (void *)sc, I4BINGACCTINTVL*hz); -} -#endif /* I4BINGACCT */ - -#if 0 -/*---------------------------------------------------------------------------* - * clear the interface's send queues - *---------------------------------------------------------------------------*/ -static void -ingclearqueue(struct ifqueue *iq) -{ - int x; - - x = splimp(); - IF_DRAIN(iq); - splx(x); -} -#endif - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -ing_connect(int unit, void *cdp) -{ - struct ing_softc *sc = &ing_softc[unit]; - int s; - - sc->sc_cdp = (call_desc_t *)cdp; - - s = SPLI4B(); - - NDBGL4(L4_DIALST, "ing%d: setting dial state to ST_CONNECTED", unit); - - sc->sc_dialresp = DSTAT_NONE; - sc->sc_lastdialresp = DSTAT_NONE; - -#if I4BINGACCT - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_callout = timeout((TIMEOUT_FUNC_T)ing_timeout, - (void *)sc, I4BINGACCTINTVL*hz); -#endif - - sc->sc_state = ST_CONNECTED; - - splx(s); -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -ing_disconnect(int unit, void *cdp) -{ - call_desc_t *cd = (call_desc_t *)cdp; - struct ing_softc *sc = &ing_softc[unit]; - - /* new stuff to check that the active channel is being closed */ - - if (cd != sc->sc_cdp) - { - NDBGL4(L4_INGDBG, "ing%d: channel %d not active", - cd->driver_unit, cd->channelid); - return; - } - -#if I4BINGACCT - untimeout((TIMEOUT_FUNC_T)ing_timeout, - (void *)sc, sc->sc_callout); -#endif - - i4b_l4_accounting(BDRV_ING, cd->driver_unit, ACCT_FINAL, - sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb); - - sc->sc_cdp = (call_desc_t *)0; - - NDBGL4(L4_DIALST, "setting dial state to ST_IDLE"); - - sc->sc_dialresp = DSTAT_NONE; - sc->sc_lastdialresp = DSTAT_NONE; - - sc->sc_state = ST_IDLE; -} - -/*---------------------------------------------------------------------------* - * this routine is used to give a feedback from userland daemon - * in case of dial problems - *---------------------------------------------------------------------------*/ -static void -ing_dialresponse(int unit, int status, cause_t cause) -{ - struct ing_softc *sc = &ing_softc[unit]; - sc->sc_dialresp = status; - - NDBGL4(L4_INGDBG, "ing%d: last=%d, this=%d", - unit, sc->sc_lastdialresp, sc->sc_dialresp); - - if(status != DSTAT_NONE) - { - NDBGL4(L4_INGDBG, "ing%d: clearing queues", unit); -/* ingclearqueues(sc); */ - } -} - -/*---------------------------------------------------------------------------* - * interface soft up/down - *---------------------------------------------------------------------------*/ -static void -ing_updown(int unit, int updown) -{ - struct ing_softc *sc = &ing_softc[unit]; - sc->sc_updown = updown; -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and was put on - * the rx queue. It is assumed that this routines runs at - * pri level splimp() ! Keep it short ! - *---------------------------------------------------------------------------*/ -static void -ing_rx_data_rdy(int unit) -{ - register struct ing_softc *sc = &ing_softc[unit]; - register struct mbuf *m; - int error; - - if((m = *isdn_linktab[unit]->rx_mbuf) == NULL) - return; - -#if I4BINGACCT - sc->sc_inb += m->m_pkthdr.len; -#endif - - m->m_pkthdr.rcvif = NULL; - - sc->sc_inpkt++; - - NG_SEND_DATA_ONLY(error, sc->hook, m); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -ing_tx_queue_empty(int unit) -{ - register struct ing_softc *sc = &ing_softc[unit]; - register struct mbuf *m; - int x = 0; - - if(sc->sc_state != ST_CONNECTED) - return; - - for(;;) - { - IF_DEQUEUE(&sc->xmitq_hipri, m); - - if(m == NULL) - { - IF_DEQUEUE(&sc->xmitq, m); - if(m == NULL) - break; - } - -#if I4BINGACCT - sc->sc_outb += m->m_pkthdr.len; -#endif - - x = 1; - - if(! IF_HANDOFF(isdn_linktab[unit]->tx_queue, m, NULL)) - { - NDBGL4(L4_INGDBG, "ing%d: tx queue full!", unit); - } - } - - if(x) - (*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted. It should - * be used to implement an activity timeout mechanism. - *---------------------------------------------------------------------------*/ -static void -ing_activity(int unit, int rxtx) -{ - ing_softc[unit].sc_cdp->last_active_time = SECOND; -} - -/*---------------------------------------------------------------------------* - * return this drivers linktab address - *---------------------------------------------------------------------------*/ -drvr_link_t * -ing_ret_linktab(int unit) -{ - return(&ing_drvr_linktab[unit]); -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -void -ing_set_linktab(int unit, isdn_link_t *ilt) -{ - isdn_linktab[unit] = ilt; -} - -/*---------------------------------------------------------------------------* - * initialize this drivers linktab - *---------------------------------------------------------------------------*/ -static void -ing_init_linktab(int unit) -{ - ing_drvr_linktab[unit].unit = unit; - ing_drvr_linktab[unit].bch_rx_data_ready = ing_rx_data_rdy; - ing_drvr_linktab[unit].bch_tx_queue_empty = ing_tx_queue_empty; - ing_drvr_linktab[unit].bch_activity = ing_activity; - ing_drvr_linktab[unit].line_connected = ing_connect; - ing_drvr_linktab[unit].line_disconnected = ing_disconnect; - ing_drvr_linktab[unit].dial_response = ing_dialresponse; - ing_drvr_linktab[unit].updown_ind = ing_updown; -} - -/*===========================================================================* - * NETGRAPH INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * It is not possible or allowable to create a node of this type. - * If the hardware exists, it will already have created it. - *---------------------------------------------------------------------------*/ -static int -ng_ing_constructor(node_p node) -{ - return(EINVAL); -} - -/*---------------------------------------------------------------------------* - * Give our ok for a hook to be added... - * Add the hook's private info to the hook structure. - *---------------------------------------------------------------------------*/ -static int -ng_ing_newhook(node_p node, hook_p hook, const char *name) -{ - struct ing_softc *sc = NG_NODE_PRIVATE(node); - - /* - * check if it's our friend the debug hook - */ - if(strcmp(name, NG_ING_HOOK_DEBUG) == 0) - { - NG_HOOK_SET_PRIVATE(hook, NULL); /* paranoid */ - sc->debughook = hook; - return (0); - } - /* - * Check for raw mode hook. - */ - if(strcmp(name, NG_ING_HOOK_RAW) == 0) - { - NG_HOOK_SET_PRIVATE(hook, sc); - sc->hook = hook; - return (0); - } - - return (EINVAL); -} - -/*---------------------------------------------------------------------------* - * Get a netgraph control message. - * Check it is one we understand. If needed, send a response. - * We could save the address for an async action later, but don't here. - * Always free the message. - * The response should be in a malloc'd region that the caller can 'free'. - * A response is not required. - *---------------------------------------------------------------------------*/ -static int -ng_ing_rcvmsg(node_p node, item_p item, hook_p lasthook) -{ - struct ing_softc *sc = NG_NODE_PRIVATE(node); - - struct ng_mesg *resp = NULL; - int error = 0; - struct ng_mesg *msg; - - NGI_GET_MSG(item, msg); - - if(msg->header.typecookie == NGM_GENERIC_COOKIE) - { - switch(msg->header.cmd) - { - case NGM_TEXT_STATUS: - { - char *arg; - char *p; - int pos = 0; - - NG_MKRESPONSE(resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, M_NOWAIT); - - if (resp == NULL) - { - error = ENOMEM; - break; - } - arg = (char *) resp->data; - - switch(sc->sc_state) - { - case ST_IDLE: - p = "idle"; - break; - case ST_DIALING: - p = "dialing"; - break; - case ST_CONNECTED: - p = "connected"; - break; - default: - p = "???"; - break; - } - - pos = sprintf(arg, "state = %s (%d)\n", p, sc->sc_state); -#if I4BINGACCT - pos += sprintf(arg + pos, "%d bytes in, %d bytes out\n", sc->sc_inb, sc->sc_outb); -#endif - pos += sprintf(arg + pos, "%d pkts in, %d pkts out\n", sc->sc_inpkt, sc->sc_outpkt); - - resp->header.arglen = pos + 1; - break; - } - - default: - error = EINVAL; - break; - } - } - else if(msg->header.typecookie == NGM_ING_COOKIE) - { - switch (msg->header.cmd) - { - case NGM_ING_GET_STATUS: - { - struct ngingstat *stats; - - NG_MKRESPONSE(resp, msg, sizeof(*stats), M_NOWAIT); - - if (!resp) - { - error = ENOMEM; - break; - } - - stats = (struct ngingstat *) resp->data; - stats->packets_in = sc->packets_in; - stats->packets_out = sc->packets_out; - break; - } - - case NGM_ING_SET_FLAG: - if (msg->header.arglen != sizeof(u_int32_t)) - { - error = EINVAL; - break; - } - sc->flags = *((u_int32_t *) msg->data); - break; - - default: - error = EINVAL; /* unknown command */ - break; - } - } - else - { - error = EINVAL; /* unknown cookie type */ - } - - /* Take care of synchronous response, if any */ - NG_RESPOND_MSG(error, node, item, resp); - /* Free the message and return */ - NG_FREE_MSG(msg); - return(error); -} - -/*---------------------------------------------------------------------------* - * get data from another node and transmit it out on a B-channel - *---------------------------------------------------------------------------*/ -static int -ng_ing_rcvdata(hook_p hook, item_p item) -{ - struct ing_softc *sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - struct ifqueue *xmitq_p; - int s; - struct mbuf *m; - struct ng_tag_prio *ptag; - - NGI_GET_M(item, m); - NG_FREE_ITEM(item); - - if(NG_HOOK_PRIVATE(hook) == NULL) - { - NG_FREE_M(m); - return(ENETDOWN); - } - - if(sc->sc_state == ST_IDLE || sc->sc_state == ST_DIALING) - { - i4b_l4_dialout(BDRV_ING, sc->sc_unit); - sc->sc_state = ST_DIALING; - } - - sc->sc_outpkt++; - - /* - * Now queue the data for when it can be sent - */ - if ((ptag = (struct ng_tag_prio *)m_tag_locate(m, NGM_GENERIC_COOKIE, - NG_TAG_PRIO, NULL)) != NULL && (ptag->priority > NG_PRIO_CUTOFF) ) - xmitq_p = (&sc->xmitq_hipri); - else - xmitq_p = (&sc->xmitq); - - s = splimp(); - - IF_LOCK(xmitq_p); - if (_IF_QFULL(xmitq_p)) - { - _IF_DROP(xmitq_p); - IF_UNLOCK(xmitq_p); - splx(s); - NG_FREE_M(m); - return(ENOBUFS); - } - - _IF_ENQUEUE(xmitq_p, m); - IF_UNLOCK(xmitq_p); - - ing_tx_queue_empty(sc->sc_unit); - - splx(s); - return (0); -} - -/*---------------------------------------------------------------------------* - * Do local shutdown processing.. - * If we are a persistant device, we might refuse to go away, and - * we'd only remove our links and reset ourself. - *---------------------------------------------------------------------------*/ -static int -ng_ing_shutdown(node_p node) -{ - struct ing_softc *sc = NG_NODE_PRIVATE(node); - int ret; - - NG_NODE_UNREF(node); - - sc->packets_in = 0; /* reset stats */ - sc->packets_out = 0; - - if ((ret = ng_make_node_common(&typestruct, &sc->node))) - { - printf("ing: ng_make_node_common, ret = %d\n!", ret); - } - - /* name the netgraph node */ - sprintf(sc->nodename, "%s%d", NG_ING_NODE_TYPE, sc->sc_unit); - if((ret = ng_name_node(sc->node, sc->nodename))) - { - printf("ing: ng_name node, ret = %d\n!", ret); - NG_NODE_UNREF(sc->node); - return (0); - } - - NG_NODE_SET_PRIVATE(sc->node, sc); - - return (0); -} - -/*---------------------------------------------------------------------------* - * This is called once we've already connected a new hook to the other node. - *---------------------------------------------------------------------------*/ -static int -ng_ing_connect(hook_p hook) -{ - /* probably not at splnet, force outward queueing */ - NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); - return (0); -} - -/* - * Dook disconnection - * - * For this type, removal of the last link destroys the node - */ -static int -ng_ing_disconnect(hook_p hook) -{ - struct ing_softc *sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - int s; - - if(NG_HOOK_PRIVATE(hook)) - { - s = splimp(); - splx(s); - } - else - { - sc->debughook = NULL; - } - return (0); -} - -/*===========================================================================*/ diff --git a/sys/i4b/driver/i4b_ipr.c b/sys/i4b/driver/i4b_ipr.c deleted file mode 100644 index b42380f67677..000000000000 --- a/sys/i4b/driver/i4b_ipr.c +++ /dev/null @@ -1,1034 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ipr.c - isdn4bsd IP over raw HDLC ISDN network driver - * --------------------------------------------------------- - * last edit-date: [Sun Mar 17 09:32:58 2002] - * - *---------------------------------------------------------------------------* - * - * statistics counter usage (interface lifetime): - * ---------------------------------------------- - * sc->sc_ifp->if_ipackets # of received packets - * sc->sc_ifp->if_ierrors # of error packets not going to upper layers - * sc->sc_ifp->if_opackets # of transmitted packets - * sc->sc_ifp->if_oerrors # of error packets not being transmitted - * sc->sc_ifp->if_collisions # of invalid ip packets after VJ decompression - * sc->sc_ifp->if_ibytes # of bytes coming in from the line (before VJ) - * sc->sc_ifp->if_obytes # of bytes going out to the line (after VJ) - * sc->sc_ifp->if_imcasts (currently unused) - * sc->sc_ifp->if_omcasts # of frames sent out of the fastqueue - * sc->sc_ifp->if_iqdrops # of frames dropped on input because queue full - * sc->sc_ifp->if_noproto # of frames dropped on output because !AF_INET - * - * statistics counter usage (connection lifetime): - * ----------------------------------------------- - * sc->sc_iinb # of ISDN incoming bytes from HSCX - * sc->sc_ioutb # of ISDN outgoing bytes from HSCX - * sc->sc_inb # of incoming bytes after decompression - * sc->sc_outb # of outgoing bytes before compression - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef IPR_VJ -#include -#include -#define IPR_COMPRESS IFF_LINK0 /* compress TCP traffic */ -#define IPR_AUTOCOMP IFF_LINK1 /* auto-enable TCP compression */ - -/*--------------------------------------------------------------------------- - * NOTICE: using NO separate buffer relies on the assumption, that the HSCX - * IRQ handler _always_ allocates a single, continuous mbuf cluster large - * enough to hold the maximum MTU size if the ipr interface ! - * - * CAUTION: i have re-defined IPR_VJ_USEBUFFER because it makes problems - * with 2 i4b's back to back running cvs over ssh, cvs simply - * aborts because it gets bad data. Everything else (telnet/ftp?etc) - * functions fine. - *---------------------------------------------------------------------------*/ -#define IPR_VJ_USEBUFFER /* define to use an allocated separate buffer*/ - /* undef to uncompress in the mbuf itself */ -#endif /* IPR_VJ */ - -#include -#include - -#include -#include - -#include -#include - -#include - -#error "Cannot be used until I4B is locked." - -#define I4BIPRMTU 1500 /* regular MTU */ -#define I4BIPRMAXMTU 2000 /* max MTU */ -#define I4BIPRMINMTU 500 /* min MTU */ - -#define I4BIPRMAXQLEN 50 /* max queue length */ - -#define I4BIPRACCT 1 /* enable accounting messages */ -#define I4BIPRACCTINTVL 2 /* accounting msg interval in secs */ -#define I4BIPRADJFRXP 1 /* adjust 1st rxd packet */ - -/* initialized by L4 */ - -static drvr_link_t ipr_drvr_linktab[NI4BIPR]; -static isdn_link_t *isdn_linktab[NI4BIPR]; - -struct ipr_softc { - struct ifnet *sc_ifp; /* network-visible interface */ - int sc_state; /* state of the interface */ - call_desc_t *sc_cdp; /* ptr to call descriptor */ - int sc_updown; /* soft state of interface */ - struct ifqueue sc_fastq; /* interactive traffic */ - int sc_dialresp; /* dialresponse */ - int sc_lastdialresp;/* last dialresponse */ - struct callout_handle sc_callout; - -#if I4BIPRACCT - int sc_iinb; /* isdn driver # of inbytes */ - int sc_ioutb; /* isdn driver # of outbytes */ - int sc_inb; /* # of bytes rx'd */ - int sc_outb; /* # of bytes tx'd */ - int sc_linb; /* last # of bytes rx'd */ - int sc_loutb; /* last # of bytes tx'd */ - int sc_fn; /* flag, first null acct */ -#endif - -#ifdef I4BIPRADJFRXP - int sc_first_pkt; /* flag, first rxd packet */ -#endif - -#if IPR_LOG - int sc_log_first; /* log first n packets */ -#endif - -#ifdef IPR_VJ - struct slcompress sc_compr; /* tcp compression data */ -#ifdef IPR_VJ_USEBUFFER - u_char *sc_cbuf; /* tcp decompression buffer */ -#endif -#endif - -} ipr_softc[NI4BIPR]; - -enum ipr_states { - ST_IDLE, /* initialized, ready, idle */ - ST_DIALING, /* dialling out to remote */ - ST_CONNECTED_W, /* connected to remote */ - ST_CONNECTED_A, /* connected to remote */ -}; - -static void i4biprattach(void *); -PSEUDO_SET(i4biprattach, i4b_ipr); -static int i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data); - -static void iprwatchdog(struct ifnet *ifp); -static void ipr_init_linktab(int unit); -static void ipr_tx_queue_empty(int unit); -static int i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct rtentry *rtp); -static void iprclearqueues(struct ipr_softc *sc); - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * interface attach routine at kernel boot time - *---------------------------------------------------------------------------*/ -static void -i4biprattach(void *dummy) -{ - struct ipr_softc *sc = ipr_softc; - int i; - -#ifdef IPR_VJ - printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached (VJ header compression)\n", NI4BIPR); -#else - printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached\n", NI4BIPR); -#endif - - for(i=0; i < NI4BIPR; sc++, i++) - { - ipr_init_linktab(i); - - NDBGL4(L4_DIALST, "setting dial state to ST_IDLE"); - - sc->sc_ifp = if_alloc(IFT_ISDNBASIC); - if (sc->sc_ifp == NULL) - panic("i4b_ipr.c, i4biprattach: cannot if_alloc()"); - - sc->sc_ifp->if_softc = sc; - sc->sc_state = ST_IDLE; - if_initname(sc->sc_ifp, "ipr", i); - - -#ifdef IPR_VJ - sc->sc_ifp->if_flags = IFF_POINTOPOINT | IFF_SIMPLEX | IPR_AUTOCOMP; -#else - sc->sc_ifp->if_flags = IFF_POINTOPOINT | IFF_SIMPLEX; -#endif - - sc->sc_ifp->if_mtu = I4BIPRMTU; - sc->sc_ifp->if_ioctl = i4biprioctl; - sc->sc_ifp->if_output = i4biproutput; - - sc->sc_ifp->if_snd.ifq_maxlen = I4BIPRMAXQLEN; - sc->sc_fastq.ifq_maxlen = I4BIPRMAXQLEN; - - if(!mtx_initialized(&sc->sc_fastq.ifq_mtx)) - mtx_init(&sc->sc_fastq.ifq_mtx, "i4b_ipr_fastq", NULL, MTX_DEF); - - sc->sc_ifp->if_ipackets = 0; - sc->sc_ifp->if_ierrors = 0; - sc->sc_ifp->if_opackets = 0; - sc->sc_ifp->if_oerrors = 0; - sc->sc_ifp->if_collisions = 0; - sc->sc_ifp->if_ibytes = 0; - sc->sc_ifp->if_obytes = 0; - sc->sc_ifp->if_imcasts = 0; - sc->sc_ifp->if_omcasts = 0; - sc->sc_ifp->if_iqdrops = 0; - sc->sc_ifp->if_noproto = 0; - -#if I4BIPRACCT - sc->sc_ifp->if_timer = 0; - sc->sc_ifp->if_watchdog = iprwatchdog; - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_fn = 1; -#endif - -#if IPR_LOG - sc->sc_log_first = IPR_LOG; -#endif - -#ifdef IPR_VJ - sl_compress_init(&sc->sc_compr, -1); - -#ifdef IPR_VJ_USEBUFFER - if(!((sc->sc_cbuf = - (u_char *)malloc(I4BIPRMAXMTU+128, M_DEVBUF, M_WAITOK)))) - { - panic("i4b_ipr.c, i4biprattach: VJ malloc failed"); - } -#endif -#endif - sc->sc_updown = SOFT_ENA; /* soft enabled */ - sc->sc_dialresp = DSTAT_NONE; /* no response */ - sc->sc_lastdialresp = DSTAT_NONE; - - if_attach(sc->sc_ifp); - - bpfattach(sc->sc_ifp, DLT_NULL, sizeof(u_int32_t)); - } -} - -/*---------------------------------------------------------------------------* - * output a packet to the ISDN B-channel - *---------------------------------------------------------------------------*/ -static int -i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rtp) -{ - struct ipr_softc *sc; - int unit; - int s; - struct ifqueue *ifq; - struct ip *ip; - u_int32_t af; - - s = SPLI4B(); - - sc = ifp->if_softc; - unit = ifp->if_dunit; - - /* BPF writes need to be handled specially. */ - if(dst->sa_family == AF_UNSPEC) - { - bcopy(dst->sa_data, &af, sizeof(af)); - dst->sa_family = af; - } - - /* check for IP */ - - if(dst->sa_family != AF_INET) - { - if_printf(ifp, "af%d not supported\n", dst->sa_family); - m_freem(m); - splx(s); - sc->sc_ifp->if_noproto++; - sc->sc_ifp->if_oerrors++; - return(EAFNOSUPPORT); - } - - /* check interface state = UP */ - - if(!(ifp->if_flags & IFF_UP)) - { - NDBGL4(L4_IPRDBG, "ipr%d: interface is DOWN!", unit); - m_freem(m); - splx(s); - sc->sc_ifp->if_oerrors++; - return(ENETDOWN); - } - - /* dial if necessary */ - - if(sc->sc_state == ST_IDLE || sc->sc_state == ST_DIALING) - { - -#ifdef NOTDEF - switch(sc->sc_dialresp) - { - case DSTAT_TFAIL: /* transient failure */ - NDBGL4(L4_IPRDBG, "ipr%d: transient dial failure!", unit); - m_freem(m); - iprclearqueues(sc); - sc->sc_dialresp = DSTAT_NONE; - splx(s); - sc->sc_ifp->if_oerrors++; - return(ENETUNREACH); - break; - - case DSTAT_PFAIL: /* permanent failure */ - NDBGL4(L4_IPRDBG, "ipr%d: permanent dial failure!", unit); - m_freem(m); - iprclearqueues(sc); - sc->sc_dialresp = DSTAT_NONE; - splx(s); - sc->sc_ifp->if_oerrors++; - return(EHOSTUNREACH); - break; - - case DSTAT_INONLY: /* no dialout allowed*/ - NDBGL4(L4_IPRDBG, "ipr%d: dialout not allowed failure!", unit); - m_freem(m); - iprclearqueues(sc); - sc->sc_dialresp = DSTAT_NONE; - splx(s); - sc->sc_ifp->if_oerrors++; - return(EHOSTUNREACH); - break; - } -#endif - - NDBGL4(L4_IPRDBG, "ipr%d: send dial request message!", unit); - NDBGL4(L4_DIALST, "ipr%d: setting dial state to ST_DIALING", unit); - i4b_l4_dialout(BDRV_IPR, unit); - sc->sc_state = ST_DIALING; - } - -#if IPR_LOG - if(sc->sc_log_first > 0) - { - --(sc->sc_log_first); - i4b_l4_packet_ind(BDRV_IPR, unit, 1, m ); - } -#endif - - /* update access time */ - - microtime(&sc->sc_ifp->if_lastchange); - - /* - * check, if type of service indicates interactive, i.e. telnet, - * traffic. in case it is interactive, put it into the fast queue, - * else (i.e. ftp traffic) put it into the "normal" queue - */ - - ip = mtod(m, struct ip *); /* get ptr to ip header */ - - if(ip->ip_tos & IPTOS_LOWDELAY) - ifq = &sc->sc_fastq; - else - ifq = (struct ifqueue *)&sc->sc_ifp->if_snd; - - /* check for space in choosen send queue */ - - if(! IF_HANDOFF(ifq, m, NULL)) - { - NDBGL4(L4_IPRDBG, "ipr%d: send queue full!", unit); - splx(s); - sc->sc_ifp->if_oerrors++; - return(ENOBUFS); - } - - NDBGL4(L4_IPRDBG, "ipr%d: add packet to send queue!", unit); - - ipr_tx_queue_empty(unit); - - splx(s); - - return (0); -} - -/*---------------------------------------------------------------------------* - * process ioctl - *---------------------------------------------------------------------------*/ -static int -i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data) -{ - struct ipr_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - struct ifaddr *ifa = (struct ifaddr *)data; - int s; - int error = 0; - - s = SPLI4B(); - - switch (cmd) - { - case SIOCAIFADDR: /* add interface address */ - case SIOCSIFADDR: /* set interface address */ - case SIOCSIFDSTADDR: /* set interface destination address */ - if(ifa->ifa_addr->sa_family != AF_INET) - error = EAFNOSUPPORT; - else - sc->sc_ifp->if_flags |= IFF_UP; - microtime(&sc->sc_ifp->if_lastchange); - break; - - case SIOCSIFFLAGS: /* set interface flags */ - if(!(ifr->ifr_flags & IFF_UP)) - { - if(sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) - { - /* disconnect ISDN line */ - i4b_l4_drvrdisc(BDRV_IPR, - ifp->if_dunit); - sc->sc_ifp->if_drv_flags &= - ~IFF_DRV_RUNNING; - } - - sc->sc_state = ST_IDLE; - - /* empty queues */ - - iprclearqueues(sc); - } - - if(ifr->ifr_flags & IFF_DEBUG) - { - /* enable debug messages */ - } - - microtime(&sc->sc_ifp->if_lastchange); - break; - - case SIOCSIFMTU: /* set interface MTU */ - if(ifr->ifr_mtu > I4BIPRMAXMTU) - error = EINVAL; - else if(ifr->ifr_mtu < I4BIPRMINMTU) - error = EINVAL; - else - { - ifp->if_mtu = ifr->ifr_mtu; - microtime(&sc->sc_ifp->if_lastchange); - } - break; -#if 0 - /* not needed for FreeBSD, done in sl_compress_init() (-hm) */ - - /* need to add an ioctl: set VJ max slot ID - * #define IPRIOCSMAXCID _IOW('I', XXX, int) - */ -#ifdef IPR_VJ - case IPRIOCSMAXCID: - { - struct thread *td = curthread; /* XXX */ - - if((error = priv_check(td, PRIV_DRIVER))) - return (error); - sl_compress_setup(sc->sc_compr, *(int *)data); - } - break; -#endif -#endif /* #if 0 */ - - default: - error = EINVAL; - break; - } - splx(s); - return(error); -} - -/*---------------------------------------------------------------------------* - * clear the interface's send queues - *---------------------------------------------------------------------------*/ -static void -iprclearqueues(struct ipr_softc *sc) -{ - int x; - - x = splimp(); - IF_DRAIN(&sc->sc_fastq); - IF_DRAIN(&sc->sc_ifp->if_snd); - splx(x); -} - -#if I4BIPRACCT -/*---------------------------------------------------------------------------* - * watchdog routine - *---------------------------------------------------------------------------*/ -static void -iprwatchdog(struct ifnet *ifp) -{ - int unit = ifp->if_dunit; - struct ipr_softc *sc = ifp->if_softc; - bchan_statistics_t bs; - - /* get # of bytes in and out from the HSCX driver */ - - (*isdn_linktab[unit]->bch_stat) - (isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs); - - sc->sc_ioutb += bs.outbytes; - sc->sc_iinb += bs.inbytes; - - if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) - { - int ri = (sc->sc_iinb - sc->sc_linb)/I4BIPRACCTINTVL; - int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BIPRACCTINTVL; - - if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb)) - sc->sc_fn = 0; - else - sc->sc_fn = 1; - - sc->sc_linb = sc->sc_iinb; - sc->sc_loutb = sc->sc_ioutb; - - i4b_l4_accounting(BDRV_IPR, unit, ACCT_DURING, - sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb); - } - sc->sc_ifp->if_timer = I4BIPRACCTINTVL; -} -#endif /* I4BIPRACCT */ - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * start transmitting after connect - *---------------------------------------------------------------------------*/ -static void -i4bipr_connect_startio(struct ipr_softc *sc) -{ - int s = SPLI4B(); - - if(sc->sc_state == ST_CONNECTED_W) - { - sc->sc_state = ST_CONNECTED_A; - ipr_tx_queue_empty(sc->sc_ifp->if_dunit); - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -ipr_connect(int unit, void *cdp) -{ - struct ipr_softc *sc = &ipr_softc[unit]; - int s; - - sc->sc_cdp = (call_desc_t *)cdp; - - s = SPLI4B(); - - NDBGL4(L4_DIALST, "ipr%d: setting dial state to ST_CONNECTED", unit); - - sc->sc_ifp->if_drv_flags |= IFF_DRV_RUNNING; - sc->sc_state = ST_CONNECTED_W; - - sc->sc_dialresp = DSTAT_NONE; - sc->sc_lastdialresp = DSTAT_NONE; - -#if I4BIPRACCT - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_ifp->if_timer = I4BIPRACCTINTVL; -#endif - -#ifdef I4BIPRADJFRXP - sc->sc_first_pkt = 1; -#endif - - /* - * Sometimes ISDN B-channels are switched thru asymmetic. This - * means that under such circumstances B-channel data (the first - * three packets of a TCP connection in my case) may get lost, - * causing a large delay until the connection is started. - * When the sending of the very first packet of a TCP connection - * is delayed for a to be empirically determined delay (close - * to a second in my case) those packets go thru and the TCP - * connection comes up "almost" immediately (-hm). - */ - - if(sc->sc_cdp->isdntxdelay > 0) - { - int delay; - - if (hz == 100) { - delay = sc->sc_cdp->isdntxdelay; /* avoid any rounding */ - } else { - delay = sc->sc_cdp->isdntxdelay*hz; - delay /= 100; - } - - START_TIMER(sc->sc_callout, (TIMEOUT_FUNC_T)i4bipr_connect_startio, (void *)sc, delay); - } - else - { - sc->sc_state = ST_CONNECTED_A; - ipr_tx_queue_empty(unit); - } - - splx(s); - - /* we don't need any negotiation - pass event back right now */ - i4b_l4_negcomplete(sc->sc_cdp); -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -ipr_disconnect(int unit, void *cdp) -{ - call_desc_t *cd = (call_desc_t *)cdp; - struct ipr_softc *sc = &ipr_softc[unit]; - - /* new stuff to check that the active channel is being closed */ - - if (cd != sc->sc_cdp) - { - NDBGL4(L4_IPRDBG, "ipr%d: channel %d not active", - cd->driver_unit, cd->channelid); - return; - } - -#if I4BIPRACCT - sc->sc_ifp->if_timer = 0; -#endif - -#if IPR_LOG - /* show next IPR_LOG packets again */ - sc->sc_log_first = IPR_LOG; -#endif - - i4b_l4_accounting(BDRV_IPR, cd->driver_unit, ACCT_FINAL, - sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb); - - sc->sc_cdp = (call_desc_t *)0; - - NDBGL4(L4_DIALST, "setting dial state to ST_IDLE"); - - sc->sc_dialresp = DSTAT_NONE; - sc->sc_lastdialresp = DSTAT_NONE; - - sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - sc->sc_state = ST_IDLE; -} - -/*---------------------------------------------------------------------------* - * this routine is used to give a feedback from userland daemon - * in case of dial problems - *---------------------------------------------------------------------------*/ -static void -ipr_dialresponse(int unit, int status, cause_t cause) -{ - struct ipr_softc *sc = &ipr_softc[unit]; - sc->sc_dialresp = status; - - NDBGL4(L4_IPRDBG, "ipr%d: last=%d, this=%d", - unit, sc->sc_lastdialresp, sc->sc_dialresp); - - if(status != DSTAT_NONE) - { - NDBGL4(L4_IPRDBG, "ipr%d: clearing queues", unit); - iprclearqueues(sc); - } -} - -/*---------------------------------------------------------------------------* - * interface soft up/down - *---------------------------------------------------------------------------*/ -static void -ipr_updown(int unit, int updown) -{ - struct ipr_softc *sc = &ipr_softc[unit]; - sc->sc_updown = updown; -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and was put on - * the rx queue. It is assumed that this routines runs at - * pri level splimp() ! Keep it short ! - *---------------------------------------------------------------------------*/ -static void -ipr_rx_data_rdy(int unit) -{ - register struct ipr_softc *sc = &ipr_softc[unit]; - register struct mbuf *m; - -#ifdef IPR_VJ -#ifdef IPR_VJ_USEBUFFER - u_char *cp = sc->sc_cbuf; -#endif - int len, c; -#endif - - if((m = *isdn_linktab[unit]->rx_mbuf) == NULL) - return; - - m->m_pkthdr.rcvif = sc->sc_ifp; - - m->m_pkthdr.len = m->m_len; - - microtime(&sc->sc_ifp->if_lastchange); - -#ifdef I4BIPRADJFRXP - - /* - * The very first packet after the B channel is switched thru - * has very often several bytes of random data prepended. This - * routine looks where the IP header starts and removes the - * the bad data. - */ - - if(sc->sc_first_pkt) - { - unsigned char *mp = m->m_data; - int i; - - sc->sc_first_pkt = 0; - - for(i = 0; i < m->m_len; i++, mp++) - { - if( ((*mp & 0xf0) == 0x40) && - ((*mp & 0x0f) >= 0x05) ) - { - m->m_data = mp; - m->m_pkthdr.len -= i; - break; - } - } - } -#endif - - sc->sc_ifp->if_ipackets++; - sc->sc_ifp->if_ibytes += m->m_pkthdr.len; - -#ifdef IPR_VJ - if((c = (*(mtod(m, u_char *)) & 0xf0)) != (IPVERSION << 4)) - { - /* copy data to buffer */ - - len = m->m_len; - -#ifdef IPR_VJ_USEBUFFER -/* XXX */ m_copydata(m, 0, len, cp); -#endif - - if(c & 0x80) - { - c = TYPE_COMPRESSED_TCP; - } - else if(c == TYPE_UNCOMPRESSED_TCP) - { -#ifdef IPR_VJ_USEBUFFER - *cp &= 0x4f; /* XXX */ -#else - *(mtod(m, u_char *)) &= 0x4f; -#endif - } - - /* - * We've got something that's not an IP packet. - * If compression is enabled, try to decompress it. - * Otherwise, if `auto-enable' compression is on and - * it's a reasonable packet, decompress it and then - * enable compression. Otherwise, drop it. - */ - if(sc->sc_ifp->if_flags & IPR_COMPRESS) - { -#ifdef IPR_VJ_USEBUFFER - len = sl_uncompress_tcp(&cp,len,(u_int)c,&sc->sc_compr); -#else - len = sl_uncompress_tcp((u_char **)&m->m_data, len, - (u_int)c, &sc->sc_compr); -#endif - - if(len <= 0) - { -#ifdef DEBUG_IPR_VJ - printf("i4b_ipr, ipr_rx_data_rdy: len <= 0 IPR_COMPRESS!\n"); -#endif - goto error; - } - } - else if((sc->sc_ifp->if_flags & IPR_AUTOCOMP) && - (c == TYPE_UNCOMPRESSED_TCP) && (len >= 40)) - { -#ifdef IPR_VJ_USEBUFFER - len = sl_uncompress_tcp(&cp,len,(u_int)c,&sc->sc_compr); -#else - len = sl_uncompress_tcp((u_char **)&m->m_data, len, - (u_int)c, &sc->sc_compr); -#endif - - if(len <= 0) - { -#ifdef DEBUG_IPR_VJ - printf("i4b_ipr, ipr_rx_data_rdy: len <= 0 IPR_AUTOCOMP!\n"); -#endif - goto error; - } - - sc->sc_ifp->if_flags |= IPR_COMPRESS; - } - else - { -#ifdef DEBUG_IPR_VJ - printf("i4b_ipr, ipr_input: invalid ip packet!\n"); -#endif - -error: - sc->sc_ifp->if_ierrors++; - sc->sc_ifp->if_collisions++; - m_freem(m); - return; - } -#ifdef IPR_VJ_USEBUFFER -/* XXX */ m_copyback(m, 0, len, cp); -#else - m->m_len = m->m_pkthdr.len = len; -#endif - } -#endif - -#if I4BIPRACCT - /* NB. do the accounting after decompression! */ - sc->sc_inb += m->m_pkthdr.len; -#endif - -#if IPR_LOG - if(sc->sc_log_first > 0) - { - --(sc->sc_log_first); - i4b_l4_packet_ind(BDRV_IPR, unit, 0, m ); - } -#endif - - if(bpf_peers_present(sc->sc_ifp->if_bpf)) - { - /* prepend the address family as a four byte field */ - struct mbuf mm; - u_int af = AF_INET; - mm.m_next = m; - mm.m_len = 4; - mm.m_data = (char *)⁡ - bpf_mtap(sc->sc_ifp->if_bpf, &mm); - } - - if(netisr_queue(NETISR_IP, m)) /* (0) on success. */ - { - NDBGL4(L4_IPRDBG, "ipr%d: ipintrq full!", unit); - sc->sc_ifp->if_ierrors++; - sc->sc_ifp->if_iqdrops++; - } -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -ipr_tx_queue_empty(int unit) -{ - register struct ipr_softc *sc = &ipr_softc[unit]; - register struct mbuf *m; -#ifdef IPR_VJ - struct ip *ip; -#endif - int x = 0; - - if(sc->sc_state != ST_CONNECTED_A) - return; - - for(;;) - { - IF_DEQUEUE(&sc->sc_fastq, m); - if(m) - { - sc->sc_ifp->if_omcasts++; - } - else - { - IF_DEQUEUE(&sc->sc_ifp->if_snd, m); - if(m == NULL) - break; - } - - microtime(&sc->sc_ifp->if_lastchange); - - if(bpf_peers_present(sc->sc_ifp->if_bpf)) - { - /* prepend the address family as a four byte field */ - - struct mbuf mm; - u_int af = AF_INET; - mm.m_next = m; - mm.m_len = 4; - mm.m_data = (char *)⁡ - bpf_mtap(sc->sc_ifp->if_bpf, &mm); - } - -#if I4BIPRACCT - sc->sc_outb += m->m_pkthdr.len; /* size before compression */ -#endif - -#ifdef IPR_VJ - if((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP) - { - if(sc->sc_ifp->if_flags & IPR_COMPRESS) - { - *mtod(m, u_char *) |= sl_compress_tcp(m, ip, - &sc->sc_compr, 1); - } - } -#endif - x = 1; - - IF_LOCK(isdn_linktab[unit]->tx_queue); - if(_IF_QFULL(isdn_linktab[unit]->tx_queue)) - { - NDBGL4(L4_IPRDBG, "ipr%d: tx queue full!", unit); - m_freem(m); - } - else - { - sc->sc_ifp->if_obytes += m->m_pkthdr.len; - - sc->sc_ifp->if_opackets++; - - _IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m); - - } - IF_UNLOCK(isdn_linktab[unit]->tx_queue); - } - - if(x) - (*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted. It should - * be used to implement an activity timeout mechanism. - *---------------------------------------------------------------------------*/ -static void -ipr_activity(int unit, int rxtx) -{ - ipr_softc[unit].sc_cdp->last_active_time = SECOND; -} - -/*---------------------------------------------------------------------------* - * return this drivers linktab address - *---------------------------------------------------------------------------*/ -drvr_link_t * -ipr_ret_linktab(int unit) -{ - return(&ipr_drvr_linktab[unit]); -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -void -ipr_set_linktab(int unit, isdn_link_t *ilt) -{ - isdn_linktab[unit] = ilt; -} - -/*---------------------------------------------------------------------------* - * initialize this drivers linktab - *---------------------------------------------------------------------------*/ -static void -ipr_init_linktab(int unit) -{ - ipr_drvr_linktab[unit].unit = unit; - ipr_drvr_linktab[unit].bch_rx_data_ready = ipr_rx_data_rdy; - ipr_drvr_linktab[unit].bch_tx_queue_empty = ipr_tx_queue_empty; - ipr_drvr_linktab[unit].bch_activity = ipr_activity; - ipr_drvr_linktab[unit].line_connected = ipr_connect; - ipr_drvr_linktab[unit].line_disconnected = ipr_disconnect; - ipr_drvr_linktab[unit].dial_response = ipr_dialresponse; - ipr_drvr_linktab[unit].updown_ind = ipr_updown; -} - -/*===========================================================================*/ diff --git a/sys/i4b/driver/i4b_isppp.c b/sys/i4b/driver/i4b_isppp.c deleted file mode 100644 index e971f33b1027..000000000000 --- a/sys/i4b/driver/i4b_isppp.c +++ /dev/null @@ -1,677 +0,0 @@ -/*- - * Copyright (c) 1997 Joerg Wunsch. All rights reserved. - * - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_isppp.c - isdn4bsd kernel SyncPPP driver - * -------------------------------------------- - * - * Uses Serge Vakulenko's sppp backend (originally contributed with - * the "cx" driver for Cronyx's HDLC-in-hardware device). This driver - * is only the glue between sppp and i4b. - * - * last edit-date: [Sat Mar 9 14:09:27 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include - -#error "Cannot be used until I4B is locked." - -#define ISPPP_FMT "isp%d: " -#define ISPPP_ARG(sc) (sc->sc_ifp->if_dunit) -#define PDEVSTATIC static -#define IFP2UNIT(ifp) (ifp)->if_dunit - -# define CALLOUT_INIT(chan) callout_handle_init(chan) -# define TIMEOUT(fun, arg, chan, tick) chan = timeout(fun, arg, tick) -# define UNTIMEOUT(fun, arg, chan) untimeout(fun, arg, chan) -# define IOCTL_CMD_T u_long - -PDEVSTATIC void i4bispppattach(void *); -PSEUDO_SET(i4bispppattach, i4b_isppp); - -#define I4BISPPPACCT 1 /* enable accounting messages */ -#define I4BISPPPACCTINTVL 2 /* accounting msg interval in secs */ -#define I4BISPPPDISCDEBUG 1 - -#define PPP_HDRLEN 4 /* 4 octetts PPP header length */ - -struct i4bisppp_softc { - struct ifnet *sc_ifp; - - int sc_state; /* state of the interface */ - call_desc_t *sc_cdp; /* ptr to call descriptor */ - -#ifdef I4BISPPPACCT - int sc_iinb; /* isdn driver # of inbytes */ - int sc_ioutb; /* isdn driver # of outbytes */ - int sc_inb; /* # of bytes rx'd */ - int sc_outb; /* # of bytes tx'd */ - int sc_linb; /* last # of bytes rx'd */ - int sc_loutb; /* last # of bytes tx'd */ - int sc_fn; /* flag, first null acct */ -#endif - - struct callout_handle sc_ch; -} i4bisppp_softc[NI4BISPPP]; - -static void i4bisppp_init_linktab(int unit); -static int i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data); - -#if 0 -static void i4bisppp_send(struct ifnet *ifp); -#endif - -static void i4bisppp_start(struct ifnet *ifp); - -#if 0 /* never used ??? */ -static void i4bisppp_timeout(void *cookie); -#endif - -static void i4bisppp_tls(struct sppp *sp); -static void i4bisppp_tlf(struct sppp *sp); -static void i4bisppp_state_changed(struct sppp *sp, int new_state); -static void i4bisppp_negotiation_complete(struct sppp *sp); -static void i4bisppp_watchdog(struct ifnet *ifp); -time_t i4bisppp_idletime(int unit); - -/* initialized by L4 */ - -static drvr_link_t i4bisppp_drvr_linktab[NI4BISPPP]; -static isdn_link_t *isdn_linktab[NI4BISPPP]; - -enum i4bisppp_states { - ST_IDLE, /* initialized, ready, idle */ - ST_DIALING, /* dialling out to remote */ - ST_CONNECTED, /* connected to remote */ -}; - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * interface attach routine at kernel boot time - *---------------------------------------------------------------------------*/ -PDEVSTATIC void -i4bispppattach(void *dummy) -{ - struct i4bisppp_softc *sc = i4bisppp_softc; - struct ifnet *ifp; - int i; - -#ifdef SPPP_VJ - printf("i4bisppp: %d ISDN SyncPPP device(s) attached (VJ header compression)\n", NI4BISPPP); -#else - printf("i4bisppp: %d ISDN SyncPPP device(s) attached\n", NI4BISPPP); -#endif - - for(i = 0; i < NI4BISPPP; sc++, i++) { - i4bisppp_init_linktab(i); - ifp = sc->sc_ifp = if_alloc(IFT_PPP); - if (ifp == NULL) { - panic("isp%d: cannot if_alloc()", i); - } - - ifp->if_softc = sc; - if_initname(sc->sc_ifp, "isp", i); - ifp->if_mtu = PP_MTU; - ifp->if_flags = IFF_SIMPLEX | IFF_POINTOPOINT; - /* - * XXX: If there were a detach function this would - * require that it use if_free_type(). Not sure if this - * type makes sense. - */ - ifp->if_type = IFT_ISDNBASIC; - sc->sc_state = ST_IDLE; - - ifp->if_ioctl = i4bisppp_ioctl; - - /* actually initialized by sppp_attach() */ - /* ifp->if_output = sppp_output; */ - - ifp->if_start = i4bisppp_start; - - ifp->if_hdrlen = 0; - ifp->if_addrlen = 0; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; - - ifp->if_ipackets = 0; - ifp->if_ierrors = 0; - ifp->if_opackets = 0; - ifp->if_oerrors = 0; - ifp->if_collisions = 0; - ifp->if_ibytes = 0; - ifp->if_obytes = 0; - ifp->if_imcasts = 0; - ifp->if_omcasts = 0; - ifp->if_iqdrops = 0; - ifp->if_noproto = 0; - -#if I4BISPPPACCT - ifp->if_timer = 0; - ifp->if_watchdog = i4bisppp_watchdog; - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_fn = 1; -#endif - - IFP2SP(sc->sc_ifp)->pp_tls = i4bisppp_tls; - IFP2SP(sc->sc_ifp)->pp_tlf = i4bisppp_tlf; - IFP2SP(sc->sc_ifp)->pp_con = i4bisppp_negotiation_complete; - IFP2SP(sc->sc_ifp)->pp_chg = i4bisppp_state_changed; - - sppp_attach(sc->sc_ifp); - - if_attach(sc->sc_ifp); - - CALLOUT_INIT(&sc->sc_ch); - - bpfattach(sc->sc_ifp, DLT_PPP, PPP_HDRLEN); - } -} - -/*---------------------------------------------------------------------------* - * process ioctl - *---------------------------------------------------------------------------*/ -static int -i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data) -{ - struct i4bisppp_softc *sc = ifp->if_softc; -#if 0 - struct sppp *sp = IFP2SP(sc->sc_ifp); - struct ifaddr *ifa = (struct ifaddr *) data; - struct ifreq *ifr = (struct ifreq *) data; -#endif - - int error; - - error = sppp_ioctl(sc->sc_ifp, cmd, data); - if (error) - return error; - - switch(cmd) { - case SIOCSIFFLAGS: -#if 0 /* never used ??? */ - x = splimp(); - if ((ifp->if_flags & IFF_UP) == 0) - UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch); - splx(x); -#endif - break; - } - - return 0; -} - -/*---------------------------------------------------------------------------* - * start output to ISDN B-channel - *---------------------------------------------------------------------------*/ -static void -i4bisppp_start(struct ifnet *ifp) -{ - struct i4bisppp_softc *sc = ifp->if_softc; - struct mbuf *m; - /* int s; */ - int unit = IFP2UNIT(ifp); - - if (sppp_isempty(ifp)) - return; - - if(sc->sc_state != ST_CONNECTED) - return; - - /* - * s = splimp(); - * ifp->if_drv_flags |= IFF_DRV_OACTIVE; // - need to clear this somewhere - * splx(s); - */ - - while ((m = sppp_dequeue(sc->sc_ifp)) != NULL) - { - - BPF_MTAP(ifp, m); - - microtime(&ifp->if_lastchange); - - IF_LOCK(isdn_linktab[unit]->tx_queue); - if(_IF_QFULL(isdn_linktab[unit]->tx_queue)) - { - NDBGL4(L4_ISPDBG, "isp%d, tx queue full!", unit); - m_freem(m); - } - else - { -#if 0 - sc->sc_ifp->if_obytes += m->m_pkthdr.len; -#endif - sc->sc_outb += m->m_pkthdr.len; - sc->sc_ifp->if_opackets++; - - _IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m); - } - IF_UNLOCK(isdn_linktab[unit]->tx_queue); - } - isdn_linktab[unit]->bch_tx_start(isdn_linktab[unit]->unit, - isdn_linktab[unit]->channel); -} - -#ifdef I4BISPPPACCT -/*---------------------------------------------------------------------------* - * watchdog routine - *---------------------------------------------------------------------------*/ -static void -i4bisppp_watchdog(struct ifnet *ifp) -{ - struct i4bisppp_softc *sc = ifp->if_softc; - int unit = IFP2UNIT(ifp); - bchan_statistics_t bs; - - (*isdn_linktab[unit]->bch_stat) - (isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs); - - sc->sc_ioutb += bs.outbytes; - sc->sc_iinb += bs.inbytes; - - if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) - { - int ri = (sc->sc_iinb - sc->sc_linb)/I4BISPPPACCTINTVL; - int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BISPPPACCTINTVL; - - if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb)) - sc->sc_fn = 0; - else - sc->sc_fn = 1; - - sc->sc_linb = sc->sc_iinb; - sc->sc_loutb = sc->sc_ioutb; - - i4b_l4_accounting(BDRV_ISPPP, unit, ACCT_DURING, - sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb); - } - sc->sc_ifp->if_timer = I4BISPPPACCTINTVL; - -#if 0 /* old stuff, keep it around */ - printf(ISPPP_FMT "transmit timeout\n", ISPPP_ARG(sc)); - i4bisppp_start(ifp); -#endif -} -#endif /* I4BISPPPACCT */ - -/* - *===========================================================================* - * SyncPPP layer interface routines - *===========================================================================* - */ - -#if 0 /* never used ??? */ -/*---------------------------------------------------------------------------* - * just an alias for i4bisppp_tls, but of type timeout_t - *---------------------------------------------------------------------------*/ -static void -i4bisppp_timeout(void *cookie) -{ - i4bisppp_tls((struct sppp *)cookie); -} -#endif - -/*---------------------------------------------------------------------------* - * PPP this-layer-started action - *---------------------------------------------------------------------------* - */ -static void -i4bisppp_tls(struct sppp *sp) -{ - struct ifnet *ifp = SP2IFP(sp); - struct i4bisppp_softc *sc = ifp->if_softc; - - if(sc->sc_state == ST_CONNECTED) - return; - - i4b_l4_dialout(BDRV_ISPPP, IFP2UNIT(ifp)); -} - -/*---------------------------------------------------------------------------* - * PPP this-layer-finished action - *---------------------------------------------------------------------------* - */ -static void -i4bisppp_tlf(struct sppp *sp) -{ - struct ifnet *ifp = SP2IFP(sp); - struct i4bisppp_softc *sc = ifp->if_softc; -/* call_desc_t *cd = sc->sc_cdp; */ - - if(sc->sc_state != ST_CONNECTED) - return; - -#if 0 /* never used ??? */ - UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch); -#endif - - i4b_l4_drvrdisc(BDRV_ISPPP, IFP2UNIT(ifp)); -} -/*---------------------------------------------------------------------------* - * PPP interface phase change - *---------------------------------------------------------------------------* - */ -static void -i4bisppp_state_changed(struct sppp *sp, int new_state) -{ - struct i4bisppp_softc *sc = SP2IFP(sp)->if_softc; - - i4b_l4_ifstate_changed(sc->sc_cdp, new_state); -} - -/*---------------------------------------------------------------------------* - * PPP control protocol negotiation complete (run ip-up script now) - *---------------------------------------------------------------------------* - */ -static void -i4bisppp_negotiation_complete(struct sppp *sp) -{ - struct i4bisppp_softc *sc = SP2IFP(sp)->if_softc; - - i4b_l4_negcomplete(sc->sc_cdp); -} - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -i4bisppp_connect(int unit, void *cdp) -{ - struct i4bisppp_softc *sc = &i4bisppp_softc[unit]; - struct sppp *sp = IFP2SP(sc->sc_ifp); - int s = splimp(); - - sc->sc_cdp = (call_desc_t *)cdp; - sc->sc_state = ST_CONNECTED; - -#if I4BISPPPACCT - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_inb = 0; - sc->sc_outb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - sc->sc_ifp->if_timer = I4BISPPPACCTINTVL; -#endif - -#if 0 /* never used ??? */ - UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch); -#endif - - sp->pp_up(sp); /* tell PPP we are ready */ - - sp->pp_last_sent = sp->pp_last_recv = SECOND; - - splx(s); -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -i4bisppp_disconnect(int unit, void *cdp) -{ - call_desc_t *cd = (call_desc_t *)cdp; - struct i4bisppp_softc *sc = &i4bisppp_softc[unit]; - struct sppp *sp = IFP2SP(sc->sc_ifp); - - int s = splimp(); - - /* new stuff to check that the active channel is being closed */ - if (cd != sc->sc_cdp) - { - NDBGL4(L4_ISPDBG, "isp%d, channel%d not active!", unit, cd->channelid); - splx(s); - return; - } - -#if I4BISPPPACCT - sc->sc_ifp->if_timer = 0; -#endif - - i4b_l4_accounting(BDRV_ISPPP, unit, ACCT_FINAL, - sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb); - - if (sc->sc_state == ST_CONNECTED) - { -#if 0 /* never used ??? */ - UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch); -#endif - sc->sc_cdp = (call_desc_t *)0; - /* do this here because pp_down calls i4bisppp_tlf */ - sc->sc_state = ST_IDLE; - sp->pp_down(sp); /* tell PPP we have hung up */ - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * this routine is used to give a feedback from userland demon - * in case of dial problems - *---------------------------------------------------------------------------*/ -static void -i4bisppp_dialresponse(int unit, int status, cause_t cause) -{ - struct i4bisppp_softc *sc = &i4bisppp_softc[unit]; - struct sppp *sp = IFP2SP(sc->sc_ifp); - - NDBGL4(L4_ISPDBG, "isp%d: status=%d, cause=%d", unit, status, cause); - - if(status != DSTAT_NONE) - { - struct mbuf *m; - - NDBGL4(L4_ISPDBG, "isp%d: clearing queues", unit); - - if(!(sppp_isempty(sc->sc_ifp))) - { - while((m = sppp_dequeue(sc->sc_ifp)) != NULL) - m_freem(m); - } - - sc->sc_cdp = (call_desc_t *)0; - /* do this here because pp_down calls i4bisppp_tlf */ - sc->sc_state = ST_IDLE; - - /* - * Ahh, sppp doesn't like to get a down event when - * dialing fails. So first tell it that we are up - * (doesn't hurt us since sc_state != ST_CONNECTED) - * and then go down. - */ - sp->pp_up(sp); - sp->pp_down(sp); - } -} - -/*---------------------------------------------------------------------------* - * interface up/down - *---------------------------------------------------------------------------*/ -static void -i4bisppp_updown(int unit, int updown) -{ - /* could probably do something useful here */ -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and was put on - * the rx queue. - *---------------------------------------------------------------------------*/ -static void -i4bisppp_rx_data_rdy(int unit) -{ - struct i4bisppp_softc *sc = &i4bisppp_softc[unit]; - struct mbuf *m; - int s; - - if((m = *isdn_linktab[unit]->rx_mbuf) == NULL) - return; - - m->m_pkthdr.rcvif = sc->sc_ifp; - m->m_pkthdr.len = m->m_len; - - microtime(&sc->sc_ifp->if_lastchange); - - sc->sc_ifp->if_ipackets++; -#if 0 - sc->sc_ifp->if_ibytes += m->m_pkthdr.len; -#endif - -#if I4BISPPPACCT - sc->sc_inb += m->m_pkthdr.len; -#endif - -#ifdef I4BISPPPDEBUG - printf("i4bisppp_rx_data_ready: received packet!\n"); -#endif - - BPF_MTAP(sc->sc_ifp, m); - - s = splimp(); - - sppp_input(sc->sc_ifp, m); - - splx(s); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -i4bisppp_tx_queue_empty(int unit) -{ - i4bisppp_start((&i4bisppp_softc[unit])->sc_ifp); -} - -/*---------------------------------------------------------------------------* - * THIS should be used instead of last_active_time to implement - * an activity timeout mechanism. - * - * Sending back the time difference unneccessarily complicates the - * idletime checks in i4b_l4.c. Return the largest time instead. - * That way the code in i4b_l4.c needs only minimal changes. - *---------------------------------------------------------------------------*/ -time_t -i4bisppp_idletime(int unit) -{ - struct sppp *sp = IFP2SP((&i4bisppp_softc[unit])->sc_ifp); - - return((sp->pp_last_recv < sp->pp_last_sent) ? - sp->pp_last_sent : sp->pp_last_recv); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted. It should - * be used to implement an activity timeout mechanism. - *---------------------------------------------------------------------------*/ -static void -i4bisppp_activity(int unit, int rxtx) -{ - i4bisppp_softc[unit].sc_cdp->last_active_time = SECOND; -} - -/*---------------------------------------------------------------------------* - * return this drivers linktab address - *---------------------------------------------------------------------------*/ -drvr_link_t * -i4bisppp_ret_linktab(int unit) -{ - return(&i4bisppp_drvr_linktab[unit]); -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -void -i4bisppp_set_linktab(int unit, isdn_link_t *ilt) -{ - isdn_linktab[unit] = ilt; -} - -/*---------------------------------------------------------------------------* - * initialize this drivers linktab - *---------------------------------------------------------------------------*/ -static void -i4bisppp_init_linktab(int unit) -{ - i4bisppp_drvr_linktab[unit].unit = unit; - i4bisppp_drvr_linktab[unit].bch_rx_data_ready = i4bisppp_rx_data_rdy; - i4bisppp_drvr_linktab[unit].bch_tx_queue_empty = i4bisppp_tx_queue_empty; - i4bisppp_drvr_linktab[unit].bch_activity = i4bisppp_activity; - i4bisppp_drvr_linktab[unit].line_connected = i4bisppp_connect; - i4bisppp_drvr_linktab[unit].line_disconnected = i4bisppp_disconnect; - i4bisppp_drvr_linktab[unit].dial_response = i4bisppp_dialresponse; - i4bisppp_drvr_linktab[unit].updown_ind = i4bisppp_updown; -} - -/*===========================================================================*/ diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c deleted file mode 100644 index 7ccca77ad8f4..000000000000 --- a/sys/i4b/driver/i4b_rbch.c +++ /dev/null @@ -1,826 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_rbch.c - device driver for raw B channel data - * --------------------------------------------------- - * last edit-date: [Sun Mar 17 09:51:03 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -static drvr_link_t rbch_drvr_linktab[NI4BRBCH]; -static isdn_link_t *isdn_linktab[NI4BRBCH]; - -#define I4BRBCHACCT 1 /* enable accounting messages */ -#define I4BRBCHACCTINTVL 2 /* accounting msg interval in secs */ - -static struct rbch_softc { - int sc_unit; /* unit number */ - - int sc_devstate; /* state of driver */ -#define ST_IDLE 0x00 -#define ST_CONNECTED 0x01 -#define ST_ISOPEN 0x02 -#define ST_RDWAITDATA 0x04 -#define ST_WRWAITEMPTY 0x08 -#define ST_NOBLOCK 0x10 - - int sc_bprot; /* B-ch protocol used */ - call_desc_t *sc_cd; /* Call Descriptor */ - struct termios it_in; - - struct ifqueue sc_hdlcq; /* hdlc read queue */ -#define I4BRBCHMAXQLEN 10 - - struct selinfo selp; /* select / poll */ - -#if I4BRBCHACCT - struct callout_handle sc_callout; - int sc_iinb; /* isdn driver # of inbytes */ - int sc_ioutb; /* isdn driver # of outbytes */ - int sc_linb; /* last # of bytes rx'd */ - int sc_loutb; /* last # of bytes tx'd */ - int sc_fn; /* flag, first null acct */ -#endif -} rbch_softc[NI4BRBCH]; - -static void rbch_rx_data_rdy(int unit); -static void rbch_tx_queue_empty(int unit); -static void rbch_connect(int unit, void *cdp); -static void rbch_disconnect(int unit, void *cdp); -static void rbch_init_linktab(int unit); -static void rbch_clrq(int unit); - -static d_open_t i4brbchopen; -static d_close_t i4brbchclose; -static d_read_t i4brbchread; -static d_read_t i4brbchwrite; -static d_ioctl_t i4brbchioctl; -static d_poll_t i4brbchpoll; - - -static struct cdevsw i4brbch_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = i4brbchopen, - .d_close = i4brbchclose, - .d_read = i4brbchread, - .d_write = i4brbchwrite, - .d_ioctl = i4brbchioctl, - .d_poll = i4brbchpoll, - .d_name = "i4brbch", -}; - -static void i4brbchattach(void *); -PSEUDO_SET(i4brbchattach, i4b_rbch); - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -static void -i4brbchattach(void *dummy) -{ - int i; - - printf("i4brbch: %d raw B channel access device(s) attached\n", NI4BRBCH); - - for(i=0; i < NI4BRBCH; i++) - { - make_dev(&i4brbch_cdevsw, i, - UID_ROOT, GID_WHEEL, 0600, "i4brbch%d", i); - -#if I4BRBCHACCT - callout_handle_init(&rbch_softc[i].sc_callout); - rbch_softc[i].sc_fn = 1; -#endif - rbch_softc[i].sc_unit = i; - rbch_softc[i].sc_devstate = ST_IDLE; - rbch_softc[i].sc_hdlcq.ifq_maxlen = I4BRBCHMAXQLEN; - - if(!mtx_initialized(&rbch_softc[i].sc_hdlcq.ifq_mtx)) - mtx_init(&rbch_softc[i].sc_hdlcq.ifq_mtx, "i4b_rbch", NULL, MTX_DEF); - - rbch_softc[i].it_in.c_ispeed = rbch_softc[i].it_in.c_ospeed = 64000; - termioschars(&rbch_softc[i].it_in); - rbch_init_linktab(i); - } -} - -/*---------------------------------------------------------------------------* - * open rbch device - *---------------------------------------------------------------------------*/ -static int -i4brbchopen(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - int unit = minor(dev); - - if(unit >= NI4BRBCH) - return(ENXIO); - - if(rbch_softc[unit].sc_devstate & ST_ISOPEN) - return(EBUSY); - -#if 0 - rbch_clrq(unit); -#endif - - rbch_softc[unit].sc_devstate |= ST_ISOPEN; - - NDBGL4(L4_RBCHDBG, "unit %d, open", unit); - - return(0); -} - -/*---------------------------------------------------------------------------* - * close rbch device - *---------------------------------------------------------------------------*/ -static int -i4brbchclose(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - - if(sc->sc_devstate & ST_CONNECTED) - i4b_l4_drvrdisc(BDRV_RBCH, unit); - - sc->sc_devstate &= ~ST_ISOPEN; - - rbch_clrq(unit); - - NDBGL4(L4_RBCHDBG, "unit %d, closed", unit); - - return(0); -} - -/*---------------------------------------------------------------------------* - * read from rbch device - *---------------------------------------------------------------------------*/ -static int -i4brbchread(struct cdev *dev, struct uio *uio, int ioflag) -{ - struct mbuf *m; - int error = 0; - int unit = minor(dev); - struct ifqueue *iqp; - struct rbch_softc *sc = &rbch_softc[unit]; - - CRIT_VAR; - - NDBGL4(L4_RBCHDBG, "unit %d, enter read", unit); - - CRIT_BEG; - if(!(sc->sc_devstate & ST_ISOPEN)) - { - CRIT_END; - NDBGL4(L4_RBCHDBG, "unit %d, read while not open", unit); - return(EIO); - } - - if((sc->sc_devstate & ST_NOBLOCK)) - { - if(!(sc->sc_devstate & ST_CONNECTED)) { - CRIT_END; - return(EWOULDBLOCK); - } - - if(sc->sc_bprot == BPROT_RHDLC) - iqp = &sc->sc_hdlcq; - else - iqp = isdn_linktab[unit]->rx_queue; - - if(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) { - CRIT_END; - return(EWOULDBLOCK); - } - } - else - { - while(!(sc->sc_devstate & ST_CONNECTED)) - { - NDBGL4(L4_RBCHDBG, "unit %d, wait read init", unit); - - if((error = tsleep( &rbch_softc[unit], - I4BPRI | PCATCH, - "rrrbch", 0 )) != 0) - { - CRIT_END; - NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep", unit, error); - return(error); - } - } - - if(sc->sc_bprot == BPROT_RHDLC) - iqp = &sc->sc_hdlcq; - else - iqp = isdn_linktab[unit]->rx_queue; - - while(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) - { - sc->sc_devstate |= ST_RDWAITDATA; - - NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit); - - if((error = tsleep( &isdn_linktab[unit]->rx_queue, - I4BPRI | PCATCH, - "rrbch", 0 )) != 0) - { - CRIT_END; - NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep read", unit, error); - sc->sc_devstate &= ~ST_RDWAITDATA; - return(error); - } - } - } - - IF_DEQUEUE(iqp, m); - - NDBGL4(L4_RBCHDBG, "unit %d, read %d bytes", unit, m->m_len); - - if(m && m->m_len) - { - error = uiomove(m->m_data, m->m_len, uio); - } - else - { - NDBGL4(L4_RBCHDBG, "unit %d, error %d uiomove", unit, error); - error = EIO; - } - - if(m) - i4b_Bfreembuf(m); - - CRIT_END; - - return(error); -} - -/*---------------------------------------------------------------------------* - * write to rbch device - *---------------------------------------------------------------------------*/ -static int -i4brbchwrite(struct cdev *dev, struct uio * uio, int ioflag) -{ - struct mbuf *m; - int error = 0; - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - - CRIT_VAR; - - NDBGL4(L4_RBCHDBG, "unit %d, write", unit); - - CRIT_BEG; - if(!(sc->sc_devstate & ST_ISOPEN)) - { - NDBGL4(L4_RBCHDBG, "unit %d, write while not open", unit); - CRIT_END; - return(EIO); - } - - if((sc->sc_devstate & ST_NOBLOCK)) - { - if(!(sc->sc_devstate & ST_CONNECTED)) { - CRIT_END; - return(EWOULDBLOCK); - } - if(_IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) { - CRIT_END; - return(EWOULDBLOCK); - } - } - else - { - while(!(sc->sc_devstate & ST_CONNECTED)) - { - NDBGL4(L4_RBCHDBG, "unit %d, write wait init", unit); - - error = tsleep( &rbch_softc[unit], - I4BPRI | PCATCH, - "wrrbch", 0 ); - if(error == ERESTART) { - CRIT_END; - return (ERESTART); - } - else if(error == EINTR) - { - CRIT_END; - NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait init", unit); - return(EINTR); - } - else if(error) - { - CRIT_END; - NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep init", unit, error); - return(error); - } - tsleep( &rbch_softc[unit], I4BPRI | PCATCH, "xrbch", (hz*1)); - } - - while(_IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) - { - sc->sc_devstate |= ST_WRWAITEMPTY; - - NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit); - - if ((error = tsleep( &isdn_linktab[unit]->tx_queue, - I4BPRI | PCATCH, - "wrbch", 0)) != 0) { - sc->sc_devstate &= ~ST_WRWAITEMPTY; - if(error == ERESTART) - { - CRIT_END; - return(ERESTART); - } - else if(error == EINTR) - { - CRIT_END; - NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait write", unit); - return(error); - } - else if(error) - { - CRIT_END; - NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep write", unit, error); - return(error); - } - } - } - } - - if(!(sc->sc_devstate & ST_ISOPEN)) - { - NDBGL4(L4_RBCHDBG, "unit %d, not open anymore", unit); - CRIT_END; - return(EIO); - } - - if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL) - { - m->m_len = min(BCH_MAX_DATALEN, uio->uio_resid); - - NDBGL4(L4_RBCHDBG, "unit %d, write %d bytes", unit, m->m_len); - - error = uiomove(m->m_data, m->m_len, uio); - - (void) IF_HANDOFF(isdn_linktab[unit]->tx_queue, m, NULL); - - (*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel); - } - - CRIT_END; - - return(error); -} - -/*---------------------------------------------------------------------------* - * rbch device ioctl handlibg - *---------------------------------------------------------------------------*/ -static int -i4brbchioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) -{ - int error = 0; - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - - switch(cmd) - { - case FIOASYNC: /* Set async mode */ - if (*(int *)data) - { - NDBGL4(L4_RBCHDBG, "unit %d, setting async mode", unit); - } - else - { - NDBGL4(L4_RBCHDBG, "unit %d, clearing async mode", unit); - } - break; - - case FIONBIO: - if (*(int *)data) - { - NDBGL4(L4_RBCHDBG, "unit %d, setting non-blocking mode", unit); - sc->sc_devstate |= ST_NOBLOCK; - } - else - { - NDBGL4(L4_RBCHDBG, "unit %d, clearing non-blocking mode", unit); - sc->sc_devstate &= ~ST_NOBLOCK; - } - break; - - case TIOCCDTR: /* Clear DTR */ - if(sc->sc_devstate & ST_CONNECTED) - { - NDBGL4(L4_RBCHDBG, "unit %d, disconnecting for DTR down", unit); - i4b_l4_drvrdisc(BDRV_RBCH, unit); - } - break; - - case I4B_RBCH_DIALOUT: - { - size_t l; - - for (l = 0; l < TELNO_MAX && ((char *)data)[l]; l++) - ; - if (l) - { - NDBGL4(L4_RBCHDBG, "unit %d, attempting dialout to %s", unit, (char *)data); - i4b_l4_dialoutnumber(BDRV_RBCH, unit, l, (char *)data); - break; - } - /* FALLTHROUGH to SDTR */ - } - - case TIOCSDTR: /* Set DTR */ - NDBGL4(L4_RBCHDBG, "unit %d, attempting dialout (DTR)", unit); - i4b_l4_dialout(BDRV_RBCH, unit); - break; - - case TIOCSETA: /* Set termios struct */ - break; - - case TIOCGETA: /* Get termios struct */ - *(struct termios *)data = sc->it_in; - break; - - case TIOCMGET: - *(int *)data = TIOCM_LE|TIOCM_DTR|TIOCM_RTS|TIOCM_CTS|TIOCM_DSR; - if (sc->sc_devstate & ST_CONNECTED) - *(int *)data |= TIOCM_CD; - break; - - case I4B_RBCH_VR_REQ: - { - msg_vr_req_t *mvr; - - mvr = (msg_vr_req_t *)data; - - mvr->version = VERSION; - mvr->release = REL; - mvr->step = STEP; - break; - } - - default: /* Unknown stuff */ - NDBGL4(L4_RBCHDBG, "unit %d, ioctl, unknown cmd %lx", unit, (u_long)cmd); - error = EINVAL; - break; - } - return(error); -} - -/*---------------------------------------------------------------------------* - * device driver poll - *---------------------------------------------------------------------------*/ -static int -i4brbchpoll(struct cdev *dev, int events, struct thread *td) -{ - int revents = 0; /* Events we found */ - int s; - int unit = minor(dev); - struct rbch_softc *sc = &rbch_softc[unit]; - - /* We can't check for anything but IN or OUT */ - - s = splhigh(); - - if(!(sc->sc_devstate & ST_ISOPEN)) - { - splx(s); - return(POLLNVAL); - } - - /* - * Writes are OK if we are connected and the - * transmit queue can take them - */ - - if((events & (POLLOUT|POLLWRNORM)) && - (sc->sc_devstate & ST_CONNECTED) && - !_IF_QFULL(isdn_linktab[unit]->tx_queue)) - { - revents |= (events & (POLLOUT|POLLWRNORM)); - } - - /* ... while reads are OK if we have any data */ - - if((events & (POLLIN|POLLRDNORM)) && - (sc->sc_devstate & ST_CONNECTED)) - { - struct ifqueue *iqp; - - if(sc->sc_bprot == BPROT_RHDLC) - iqp = &sc->sc_hdlcq; - else - iqp = isdn_linktab[unit]->rx_queue; - - if(!IF_QEMPTY(iqp)) - revents |= (events & (POLLIN|POLLRDNORM)); - } - - if(revents == 0) - selrecord(td, &sc->selp); - - splx(s); - return(revents); -} - -#if I4BRBCHACCT -/*---------------------------------------------------------------------------* - * watchdog routine - *---------------------------------------------------------------------------*/ -static void -rbch_timeout(struct rbch_softc *sc) -{ - bchan_statistics_t bs; - int unit = sc->sc_unit; - - /* get # of bytes in and out from the HSCX driver */ - - (*isdn_linktab[unit]->bch_stat) - (isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs); - - sc->sc_ioutb += bs.outbytes; - sc->sc_iinb += bs.inbytes; - - if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) - { - int ri = (sc->sc_iinb - sc->sc_linb)/I4BRBCHACCTINTVL; - int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BRBCHACCTINTVL; - - if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb)) - sc->sc_fn = 0; - else - sc->sc_fn = 1; - - sc->sc_linb = sc->sc_iinb; - sc->sc_loutb = sc->sc_ioutb; - - i4b_l4_accounting(BDRV_RBCH, unit, ACCT_DURING, - sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb); - } - START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz); -} -#endif /* I4BRBCHACCT */ - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -rbch_connect(int unit, void *cdp) -{ - call_desc_t *cd = (call_desc_t *)cdp; - struct rbch_softc *sc = &rbch_softc[unit]; - - sc->sc_bprot = cd->bprot; - -#if I4BRBCHACCT - if(sc->sc_bprot == BPROT_RHDLC) - { - sc->sc_iinb = 0; - sc->sc_ioutb = 0; - sc->sc_linb = 0; - sc->sc_loutb = 0; - - START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz); - } -#endif - if(!(sc->sc_devstate & ST_CONNECTED)) - { - NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit); - sc->sc_devstate |= ST_CONNECTED; - sc->sc_cd = cdp; - wakeup(sc); - } -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -rbch_disconnect(int unit, void *cdp) -{ - call_desc_t *cd = (call_desc_t *)cdp; - struct rbch_softc *sc = &rbch_softc[unit]; - - CRIT_VAR; - - if(cd != sc->sc_cd) - { - NDBGL4(L4_RBCHDBG, "rbch%d: channel %d not active", - cd->driver_unit, cd->channelid); - return; - } - - CRIT_BEG; - - NDBGL4(L4_RBCHDBG, "unit %d, disconnect", unit); - - sc->sc_devstate &= ~ST_CONNECTED; - - sc->sc_cd = NULL; - -#if I4BRBCHACCT - i4b_l4_accounting(BDRV_RBCH, unit, ACCT_FINAL, - sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_ioutb, sc->sc_iinb); - - STOP_TIMER(sc->sc_callout, rbch_timeout, sc); -#endif - CRIT_END; -} - -/*---------------------------------------------------------------------------* - * feedback from daemon in case of dial problems - *---------------------------------------------------------------------------*/ -static void -rbch_dialresponse(int unit, int status, cause_t cause) -{ -} - -/*---------------------------------------------------------------------------* - * interface up/down - *---------------------------------------------------------------------------*/ -static void -rbch_updown(int unit, int updown) -{ -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and is to be put on - * the rx queue. - *---------------------------------------------------------------------------*/ -static void -rbch_rx_data_rdy(int unit) -{ - if(rbch_softc[unit].sc_bprot == BPROT_RHDLC) - { - register struct mbuf *m; - - if((m = *isdn_linktab[unit]->rx_mbuf) == NULL) - return; - - m->m_pkthdr.len = m->m_len; - - if (! IF_HANDOFF(&(rbch_softc[unit].sc_hdlcq), m, NULL)) - { - NDBGL4(L4_RBCHDBG, "unit %d: hdlc rx queue full!", unit); - } - } - - if(rbch_softc[unit].sc_devstate & ST_RDWAITDATA) - { - NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit); - rbch_softc[unit].sc_devstate &= ~ST_RDWAITDATA; - wakeup( &isdn_linktab[unit]->rx_queue); - } - else - { - NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit); - } - selwakeuppri(&rbch_softc[unit].selp, I4BPRI); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -rbch_tx_queue_empty(int unit) -{ - if(rbch_softc[unit].sc_devstate & ST_WRWAITEMPTY) - { - NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit); - rbch_softc[unit].sc_devstate &= ~ST_WRWAITEMPTY; - wakeup( &isdn_linktab[unit]->tx_queue); - } - else - { - NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit); - } - selwakeuppri(&rbch_softc[unit].selp, TTOPRI); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted - *---------------------------------------------------------------------------*/ -static void -rbch_activity(int unit, int rxtx) -{ - if (rbch_softc[unit].sc_cd) - rbch_softc[unit].sc_cd->last_active_time = SECOND; - selwakeuppri(&rbch_softc[unit].selp, I4BPRI); -} - -/*---------------------------------------------------------------------------* - * clear an hdlc rx queue for a rbch unit - *---------------------------------------------------------------------------*/ -static void -rbch_clrq(int unit) -{ - CRIT_VAR; - - CRIT_BEG; - IF_DRAIN(&rbch_softc[unit].sc_hdlcq); - CRIT_END; -} - -/*---------------------------------------------------------------------------* - * return this drivers linktab address - *---------------------------------------------------------------------------*/ -drvr_link_t * -rbch_ret_linktab(int unit) -{ - rbch_init_linktab(unit); - return(&rbch_drvr_linktab[unit]); -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -void -rbch_set_linktab(int unit, isdn_link_t *ilt) -{ - isdn_linktab[unit] = ilt; -} - -/*---------------------------------------------------------------------------* - * initialize this drivers linktab - *---------------------------------------------------------------------------*/ -static void -rbch_init_linktab(int unit) -{ - rbch_drvr_linktab[unit].unit = unit; - rbch_drvr_linktab[unit].bch_rx_data_ready = rbch_rx_data_rdy; - rbch_drvr_linktab[unit].bch_tx_queue_empty = rbch_tx_queue_empty; - rbch_drvr_linktab[unit].bch_activity = rbch_activity; - rbch_drvr_linktab[unit].line_connected = rbch_connect; - rbch_drvr_linktab[unit].line_disconnected = rbch_disconnect; - rbch_drvr_linktab[unit].dial_response = rbch_dialresponse; - rbch_drvr_linktab[unit].updown_ind = rbch_updown; -} - -/*===========================================================================*/ diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c deleted file mode 100644 index 6692fe36ef1e..000000000000 --- a/sys/i4b/driver/i4b_tel.c +++ /dev/null @@ -1,1664 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_tel.c - device driver for ISDN telephony - * -------------------------------------------- - * last edit-date: [Tue Aug 27 13:54:08 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#undef I4BTELDEBUG - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -/* minor number: lower 6 bits = unit number */ -#define UNITBITS 6 -#define UNITMASK 0x3f -#define UNIT(n) (minor(n) & UNITMASK) - -/* minor number: upper 2 bits = function number */ - -#define FUNCMASK 0x03 -#define FUNC(n) (((minor(n)) >> UNITBITS) & FUNCMASK) - -#define FUNCTEL 0 /* 0 = normal i4btel device */ -#define FUNCDIAL 1 /* 1 = i4bteld dialout device */ - -#define NOFUNCS 2 /* number of device classes */ - -typedef struct { - - /* used only in func = FUNCTEL */ - - drvr_link_t drvr_linktab; /* driver linktab */ - isdn_link_t *isdn_linktab; /* isdn linktab */ - int audiofmt; /* audio format conversion */ - u_char *rcvttab; /* conversion table on read */ - u_char *wcvttab; /* conversion table on write */ - call_desc_t *cdp; /* call descriptor pointer */ - - /* used only in func = FUNCDIAL */ - - char result; /* result code for dial dev */ - - /* used in func = FUNCDIAL and func = FUNCTEL*/ - - int devstate; /* state of this unit */ -#define ST_IDLE 0x00 /* idle */ -#define ST_CONNECTED 0x01 /* isdn connected state */ -#define ST_ISOPEN 0x02 /* userland opened */ -#define ST_RDWAITDATA 0x04 /* userland read waiting */ -#define ST_WRWAITEMPTY 0x08 /* userland write waiting */ -#define ST_TONE 0x10 /* tone generator */ - - struct selinfo selp; /* select / poll */ - - struct i4b_tel_tones tones; - int toneidx; - int toneomega; - int tonefreq; - -} tel_sc_t; - -static tel_sc_t tel_sc[NI4BTEL][NOFUNCS]; - -/* forward decl */ - -static void tel_rx_data_rdy(int unit); -static void tel_tx_queue_empty(int unit); -static void tel_init_linktab(int unit); -static void tel_connect(int unit, void *cdp); -static void tel_disconnect(int unit, void *cdp); -static void tel_tone(tel_sc_t *sc); - -/* audio format conversion tables */ -static unsigned char a2u_tab[]; -static unsigned char u2a_tab[]; -static unsigned char bitreverse[]; -static u_char sinetab[]; - -static d_open_t i4btelopen; -static d_close_t i4btelclose; -static d_read_t i4btelread; -static d_read_t i4btelwrite; -static d_ioctl_t i4btelioctl; -static d_poll_t i4btelpoll; - - -static struct cdevsw i4btel_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = i4btelopen, - .d_close = i4btelclose, - .d_read = i4btelread, - .d_write = i4btelwrite, - .d_ioctl = i4btelioctl, - .d_poll = i4btelpoll, - .d_name = "i4btel", -}; - -static void i4btelattach(void *); - -PSEUDO_SET(i4btelattach, i4b_tel); - -/*===========================================================================* - * DEVICE DRIVER ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -static void -i4btelattach(void *dummy) -{ - int i, j; - - printf("i4btel: %d ISDN telephony interface device(s) attached\n", NI4BTEL); - - for(i=0; i < NI4BTEL; i++) - { - for(j=0; j < NOFUNCS; j++) - { - tel_sc[i][j].devstate = ST_IDLE; - tel_sc[i][j].audiofmt = CVT_NONE; - tel_sc[i][j].rcvttab = 0; - tel_sc[i][j].wcvttab = 0; - tel_sc[i][j].result = 0; - - switch(j) - { - case FUNCTEL: /* normal i4btel device */ - make_dev(&i4btel_cdevsw, i, - UID_ROOT, GID_WHEEL, - 0600, "i4btel%d", i); - break; - - case FUNCDIAL: /* i4bteld dialout device */ - make_dev(&i4btel_cdevsw, i+(1<= NI4BTEL) - return(ENXIO); - - sc = &tel_sc[unit][func]; - - if(sc->devstate & ST_ISOPEN) - return(EBUSY); - - sc->devstate |= ST_ISOPEN; - - if(func == FUNCDIAL) - { - sc->result = 0; - } - - return(0); -} - -/*---------------------------------------------------------------------------* - * close tel device - *---------------------------------------------------------------------------*/ -static int -i4btelclose(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - int unit = UNIT(dev); - int func = FUNC(dev); - tel_sc_t *sc; - int error = 0; - int x; - - if(unit > NI4BTEL) - return(ENXIO); - - sc = &tel_sc[unit][func]; - - x = splimp(); - sc->devstate &= ~ST_TONE; - - if((func == FUNCTEL) && - (sc->isdn_linktab != NULL && sc->isdn_linktab->tx_queue != NULL)) - { - while(!(IF_QEMPTY(sc->isdn_linktab->tx_queue))) - { - sc->devstate |= ST_WRWAITEMPTY; - - if((error = tsleep( &sc->isdn_linktab->tx_queue, - I4BPRI | PCATCH, "wtcl", 0)) != 0) - { - break; - } - } - sc->devstate &= ~ST_WRWAITEMPTY; - } - - sc->devstate &= ~ST_ISOPEN; - splx(x); - wakeup( &sc->tones); - - return(error); -} - -/*---------------------------------------------------------------------------* - * i4btelioctl - device driver ioctl routine - *---------------------------------------------------------------------------*/ -static int -i4btelioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) -{ - int unit = UNIT(dev); - int func = FUNC(dev); - int error = 0; - struct mbuf *m; - int s; - - tel_sc_t *sc = &tel_sc[unit][func]; - - if(func == FUNCTEL) - { - switch(cmd) - { - case I4B_TEL_GETAUDIOFMT: - *(int *)data = sc->audiofmt; - break; - - case I4B_TEL_SETAUDIOFMT: - switch (*(int *)data) - { - case CVT_NONE: - sc->rcvttab = 0; - sc->wcvttab = 0; - break; - case CVT_ALAW2ULAW: - /* ISDN: a-law */ - /* user: u-law */ - sc->rcvttab = a2u_tab; - sc->wcvttab = u2a_tab; - break; - case CVT_ULAW2ALAW: - /* ISDN: u-law */ - /* user: a-law */ - sc->rcvttab = u2a_tab; - sc->wcvttab = a2u_tab; - break; - default: - error = ENODEV; - break; - } - if(error == 0) - sc->audiofmt = *(int *)data; - break; - - case I4B_TEL_EMPTYINPUTQUEUE: - s = splimp(); - while((sc->devstate & ST_CONNECTED) && - (sc->devstate & ST_ISOPEN) && - !IF_QEMPTY(sc->isdn_linktab->rx_queue)) - { - IF_DEQUEUE(sc->isdn_linktab->rx_queue, m); - if(m) - i4b_Bfreembuf(m); - } - splx(s); - break; - - case I4B_TEL_VR_REQ: - { - msg_vr_req_t *mvr; - - mvr = (msg_vr_req_t *)data; - - mvr->version = VERSION; - mvr->release = REL; - mvr->step = STEP; - break; - } - case I4B_TEL_TONES: - { - struct i4b_tel_tones *tt; - - tt = (struct i4b_tel_tones *)data; - s = splimp(); - while ((sc->devstate & ST_TONE) && - sc->tones.duration[sc->toneidx] != 0) { - if((error = tsleep( &sc->tones, - I4BPRI | PCATCH, "rtone", 0 )) != 0) { - splx(s); - return(error); - } - } - if(!(sc->devstate & ST_ISOPEN)) { - splx(s); - return (EIO); - } - if(!(sc->devstate & ST_CONNECTED)) { - splx(s); - return (EIO); - } - - sc->tones = *tt; - sc->toneidx = 0; - sc->tonefreq = tt->frequency[0]; - sc->devstate |= ST_TONE; - splx(s); - tel_tone(sc); - break; - } - - default: - error = ENOTTY; - break; - } - } - else if(func == FUNCDIAL) - { - switch(cmd) - { - default: - error = ENOTTY; - break; - } - } - return(error); -} - -/*---------------------------------------------------------------------------* - * read from tel device - *---------------------------------------------------------------------------*/ -static int -i4btelread(struct cdev *dev, struct uio *uio, int ioflag) -{ - int unit = UNIT(dev); - int func = FUNC(dev); - - struct mbuf *m; - int s; - int error = 0; - - tel_sc_t *sc = &tel_sc[unit][func]; - - if(!(sc->devstate & ST_ISOPEN)) - return(EIO); - - if(func == FUNCTEL) - { - s = splimp(); - IF_LOCK(sc->isdn_linktab->rx_queue); - - while((sc->devstate & ST_ISOPEN) && - (sc->devstate & ST_CONNECTED) && - IF_QEMPTY(sc->isdn_linktab->rx_queue)) - { - sc->devstate |= ST_RDWAITDATA; - - NDBGL4(L4_TELDBG, "i4btel%d, queue empty!", unit); - - if((error = msleep( &sc->isdn_linktab->rx_queue, - &sc->isdn_linktab->rx_queue->ifq_mtx, - I4BPRI | PCATCH, - "rtel", 0 )) != 0) - { - sc->devstate &= ~ST_RDWAITDATA; - IF_UNLOCK(sc->isdn_linktab->rx_queue); - splx(s); - return(error); - } - } - - if(!(sc->devstate & ST_ISOPEN)) - { - IF_UNLOCK(sc->isdn_linktab->rx_queue); - splx(s); - return(EIO); - } - - if(!(sc->devstate & ST_CONNECTED)) - { - IF_UNLOCK(sc->isdn_linktab->rx_queue); - splx(s); - return(EIO); - } - - - _IF_DEQUEUE(sc->isdn_linktab->rx_queue, m); - IF_UNLOCK(sc->isdn_linktab->rx_queue); - - if(m && m->m_len > 0) - { - register int i; - - for(i = 0; i < m->m_len; i++) - { - /* always reverse bit order from line */ - mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]]; - - /* convert if necessary */ - if(sc->rcvttab) - mtod(m,u_char *)[i] = sc->rcvttab[mtod(m,u_char *)[i]]; - } - error = uiomove(m->m_data, m->m_len, uio); - - NDBGL4(L4_TELDBG, "i4btel%d, mbuf (%d bytes), uiomove %d!", unit, m->m_len, error); - } - else - { - NDBGL4(L4_TELDBG, "i4btel%d, empty mbuf from queue!", unit); - error = EIO; - } - - if(m) - i4b_Bfreembuf(m); - - splx(s); - } - else if(func == FUNCDIAL) - { - s = splimp(); - while((sc->result == 0) && (sc->devstate & ST_ISOPEN)) - { - sc->devstate |= ST_RDWAITDATA; - - NDBGL4(L4_TELDBG, "i4btel%d, wait for result!", unit); - - if((error = tsleep( &sc->result, - I4BPRI | PCATCH, - "rtel1", 0 )) != 0) - { - sc->devstate &= ~ST_RDWAITDATA; - splx(s); - NDBGL4(L4_TELDBG, "i4btel%d, wait for result: sleep error!", unit); - return(error); - } - } - - if(!(sc->devstate & ST_ISOPEN)) - { - splx(s); - NDBGL4(L4_TELDBG, "i4btel%d, wait for result: device closed!", unit); - return(EIO); - } - - if(sc->result != 0) - { - NDBGL4(L4_TELDBG, "i4btel%d, wait for result: 0x%02x!", unit, sc->result); - error = uiomove(&sc->result, 1, uio); - sc->result = 0; - } - else - { - NDBGL4(L4_TELDBG, "i4btel%d, wait for result: result=0!", unit); - error = EIO; - } - - splx(s); - } - return(error); -} - -/*---------------------------------------------------------------------------* - * write to tel device - *---------------------------------------------------------------------------*/ -static int -i4btelwrite(struct cdev *dev, struct uio * uio, int ioflag) -{ - int unit = UNIT(dev); - int func = FUNC(dev); - struct mbuf *m; - int s; - int error = 0; - tel_sc_t *sc = &tel_sc[unit][func]; - - if(!(sc->devstate & ST_ISOPEN)) - { - return(EIO); - } - - if(func == FUNCTEL) - { - s = splimp(); - - if(!(sc->devstate & ST_CONNECTED)) { - splx(s); - return(EIO); - } - - sc->devstate &= ~ST_TONE; - IF_LOCK(sc->isdn_linktab->tx_queue); - while((_IF_QFULL(sc->isdn_linktab->tx_queue)) && - (sc->devstate & ST_ISOPEN)) - { - sc->devstate |= ST_WRWAITEMPTY; - - if((error = msleep( &sc->isdn_linktab->tx_queue, - &sc->isdn_linktab->tx_queue->ifq_mtx, - I4BPRI | PCATCH, "wtel", 0)) != 0) - { - sc->devstate &= ~ST_WRWAITEMPTY; - IF_UNLOCK(sc->isdn_linktab->tx_queue); - splx(s); - return(error); - } - } - IF_UNLOCK(sc->isdn_linktab->tx_queue); - - if(!(sc->devstate & ST_ISOPEN)) - { - splx(s); - return(EIO); - } - - if(!(sc->devstate & ST_CONNECTED)) - { - splx(s); - return(EIO); - } - - if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL) - { - register int i; - - m->m_len = min(BCH_MAX_DATALEN, uio->uio_resid); - - error = uiomove(m->m_data, m->m_len, uio); - - for(i = 0; i < m->m_len; i++) - { - /* convert if necessary */ - if(sc->wcvttab) - mtod(m,u_char *)[i] = sc->wcvttab[mtod(m,u_char *)[i]]; - - /* always reverse bitorder to line */ - mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]]; - } - (void) IF_HANDOFF(sc->isdn_linktab->tx_queue, m, NULL); - (*sc->isdn_linktab->bch_tx_start)(sc->isdn_linktab->unit, sc->isdn_linktab->channel); - } - - splx(s); - } - else if(func == FUNCDIAL) - { -#define CMDBUFSIZ 80 - char cmdbuf[CMDBUFSIZ]; - int len = min(CMDBUFSIZ-1, uio->uio_resid); - - error = uiomove(cmdbuf, len, uio); - - if(cmdbuf[0] == CMD_DIAL) - { - i4b_l4_dialoutnumber(BDRV_TEL, unit, len-1, &cmdbuf[1]); - } - else if(cmdbuf[0] == CMD_HUP) - { - i4b_l4_drvrdisc(BDRV_TEL, unit); - } - else if(cmdbuf[0] == CMD_KEYP) - { - i4b_l4_keypad(BDRV_TEL, unit, len-1, &cmdbuf[1]); - } - } - else - { - error = EIO; - } - - return(error); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -#define NTONESAMP 32 -static void -tel_tone(tel_sc_t *sc) -{ - struct mbuf *m; - u_char *p; - int i; - - if((m = i4b_Bgetmbuf(NTONESAMP)) == NULL) { - printf("no mbuf in tel_tone\n"); - return; - } - p = m->m_data; - m->m_len = 0; - for (i = 0; i < NTONESAMP && (sc->devstate & ST_TONE); i++) { - - if (sc->tones.duration[sc->toneidx] > 0) { - if (--sc->tones.duration[sc->toneidx] == 0) { - sc->toneidx++; - if (sc->toneidx == I4B_TEL_MAXTONES) { - sc->devstate &= ~ST_TONE; - sc->toneomega = 0; - sc->tonefreq = 0; - } else if (sc->tones.frequency[sc->toneidx] == 0 && - sc->tones.duration[sc->toneidx] == 0) { - sc->devstate &= ~ST_TONE; - sc->toneomega = 0; - sc->tonefreq = 0; - } else { - sc->tonefreq = sc->tones.frequency[sc->toneidx]; - } - if (sc->tones.duration[sc->toneidx] == 0) { - wakeup( &sc->tones); - } - } - } - - sc->toneomega += sc->tonefreq; - if (sc->toneomega >= 8000) - sc->toneomega -= 8000; - *p++ = bitreverse[sinetab[sc->toneomega]]; - m->m_len++; - } - IF_ENQUEUE(sc->isdn_linktab->tx_queue, m); - (*sc->isdn_linktab->bch_tx_start)(sc->isdn_linktab->unit, sc->isdn_linktab->channel); -} - -/*---------------------------------------------------------------------------* - * device driver poll - *---------------------------------------------------------------------------*/ -static int -i4btelpoll(struct cdev *dev, int events, struct thread *td) -{ - int revents = 0; /* Events we found */ - int s; - int unit = UNIT(dev); - int func = FUNC(dev); - - tel_sc_t *sc = &tel_sc[unit][func]; - - s = splhigh(); - - if(!(sc->devstate & ST_ISOPEN)) - { - NDBGL4(L4_TELDBG, "i4btel%d, !ST_ISOPEN", unit); - splx(s); - return(0); - } - - if(func == FUNCTEL) - { - /* - * Writes are OK if we are connected and the - * transmit queue can take them - */ - - if((events & (POLLOUT|POLLWRNORM)) && - (sc->devstate & ST_CONNECTED) && - (sc->isdn_linktab != NULL) && - (!_IF_QFULL(sc->isdn_linktab->tx_queue))) - { - NDBGL4(L4_TELDBG, "i4btel%d, POLLOUT", unit); - revents |= (events & (POLLOUT|POLLWRNORM)); - } - - /* ... while reads are OK if we have any data */ - - if((events & (POLLIN|POLLRDNORM)) && - (sc->devstate & ST_CONNECTED) && - (sc->isdn_linktab != NULL) && - (!IF_QEMPTY(sc->isdn_linktab->rx_queue))) - { - NDBGL4(L4_TELDBG, "i4btel%d, POLLIN", unit); - revents |= (events & (POLLIN|POLLRDNORM)); - } - - if(revents == 0) - { - NDBGL4(L4_TELDBG, "i4btel%d, selrecord", unit); - selrecord(td, &sc->selp); - } - } - else if(func == FUNCDIAL) - { - if(events & (POLLOUT|POLLWRNORM)) - { - NDBGL4(L4_TELDBG, "i4bteld%d, POLLOUT", unit); - revents |= (events & (POLLOUT|POLLWRNORM)); - } - - if(events & (POLLIN|POLLRDNORM)) - { - NDBGL4(L4_TELDBG, "i4bteld%d, POLLIN, result = %d", unit, sc->result); - if(sc->result != 0) - revents |= (events & (POLLIN|POLLRDNORM)); - } - - if(revents == 0) - { - NDBGL4(L4_TELDBG, "i4bteld%d, selrecord", unit); - selrecord(td, &sc->selp); - } - } - splx(s); - return(revents); -} - -/*===========================================================================* - * ISDN INTERFACE ROUTINES - *===========================================================================*/ - -/*---------------------------------------------------------------------------* -* this routine is called from L4 handler at connect time - *---------------------------------------------------------------------------*/ -static void -tel_connect(int unit, void *cdp) -{ - tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; - - /* audio device */ - - sc->cdp = (call_desc_t *)cdp; - - sc->devstate |= ST_CONNECTED; - - /* dialer device */ - - sc = &tel_sc[unit][FUNCDIAL]; - - if(sc->devstate & ST_ISOPEN) - { - NDBGL4(L4_TELDBG, "i4btel%d, tel_connect!", unit); - sc->result = RSP_CONN; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup( &sc->result); - } - selwakeuppri(&sc->selp, I4BPRI); - } -} - -/*---------------------------------------------------------------------------* - * this routine is called from L4 handler at disconnect time - *---------------------------------------------------------------------------*/ -static void -tel_disconnect(int unit, void *cdp) -{ -/* call_desc_t *cd = (call_desc_t *)cdp; */ - - tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; - - /* audio device */ - - sc->devstate &= ~ST_CONNECTED; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup( &sc->isdn_linktab->rx_queue); - } - - if(sc->devstate & ST_WRWAITEMPTY) - { - sc->devstate &= ~ST_WRWAITEMPTY; - wakeup( &sc->isdn_linktab->tx_queue); - } - - /* dialer device */ - - sc = &tel_sc[unit][FUNCDIAL]; - - if(sc->devstate & ST_ISOPEN) - { - NDBGL4(L4_TELDBG, "i4btel%d, tel_disconnect!", unit); - sc->result = RSP_HUP; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup( &sc->result); - } - selwakeuppri(&sc->selp, I4BPRI); - - if (sc->devstate & ST_TONE) { - sc->devstate &= ~ST_TONE; - wakeup( &sc->tones); - } - } -} - -/*---------------------------------------------------------------------------* - * feedback from daemon in case of dial problems - *---------------------------------------------------------------------------*/ -static void -tel_dialresponse(int unit, int status, cause_t cause) -{ - tel_sc_t *sc = &tel_sc[unit][FUNCDIAL]; - - NDBGL4(L4_TELDBG, "i4btel%d, status=%d, cause=0x%4x", unit, status, cause); - - if((sc->devstate == ST_ISOPEN) && status) - { - NDBGL4(L4_TELDBG, "i4btel%d, tel_dialresponse!", unit); - sc->result = RSP_NOA; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup( &sc->result); - } - selwakeuppri(&sc->selp, I4BPRI); - } -} - -/*---------------------------------------------------------------------------* - * interface up/down - *---------------------------------------------------------------------------*/ -static void -tel_updown(int unit, int updown) -{ -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when a new frame (mbuf) has been received and was put on - * the rx queue. - *---------------------------------------------------------------------------*/ -static void -tel_rx_data_rdy(int unit) -{ - tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; - - if(sc->devstate & ST_RDWAITDATA) - { - sc->devstate &= ~ST_RDWAITDATA; - wakeup( &sc->isdn_linktab->rx_queue); - } - selwakeuppri(&sc->selp, TTOPRI); -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * when the last frame has been sent out and there is no - * further frame (mbuf) in the tx queue. - *---------------------------------------------------------------------------*/ -static void -tel_tx_queue_empty(int unit) -{ - tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; - - if(sc->devstate & ST_WRWAITEMPTY) - { - sc->devstate &= ~ST_WRWAITEMPTY; - wakeup( &sc->isdn_linktab->tx_queue); - } - if(sc->devstate & ST_TONE) { - tel_tone(sc); - } else { - selwakeuppri(&sc->selp, I4BPRI); - } -} - -/*---------------------------------------------------------------------------* - * this routine is called from the HSCX interrupt handler - * each time a packet is received or transmitted. - *---------------------------------------------------------------------------*/ -static void -tel_activity(int unit, int rxtx) -{ - if(tel_sc[unit][FUNCTEL].cdp) - tel_sc[unit][FUNCTEL].cdp->last_active_time = SECOND; -} - -/*---------------------------------------------------------------------------* - * return this drivers linktab address - *---------------------------------------------------------------------------*/ -drvr_link_t * -tel_ret_linktab(int unit) -{ - tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; - - tel_init_linktab(unit); - return(&sc->drvr_linktab); -} - -/*---------------------------------------------------------------------------* - * setup the isdn_linktab for this driver - *---------------------------------------------------------------------------*/ -void -tel_set_linktab(int unit, isdn_link_t *ilt) -{ - tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; - sc->isdn_linktab = ilt; -} - -/*---------------------------------------------------------------------------* - * initialize this drivers linktab - *---------------------------------------------------------------------------*/ -static void -tel_init_linktab(int unit) -{ - tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; - - sc->drvr_linktab.unit = unit; - sc->drvr_linktab.bch_rx_data_ready = tel_rx_data_rdy; - sc->drvr_linktab.bch_tx_queue_empty = tel_tx_queue_empty; - sc->drvr_linktab.bch_activity = tel_activity; - sc->drvr_linktab.line_connected = tel_connect; - sc->drvr_linktab.line_disconnected = tel_disconnect; - sc->drvr_linktab.dial_response = tel_dialresponse; - sc->drvr_linktab.updown_ind = tel_updown; -} - -/*===========================================================================* - * AUDIO FORMAT CONVERSION (produced by running g711conv) - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * A-law to u-law conversion - *---------------------------------------------------------------------------*/ -static unsigned char a2u_tab[256] = { -/* 00 */ 0x2a, 0x2b, 0x28, 0x29, 0x2e, 0x2f, 0x2c, 0x2d, -/* 08 */ 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25, -/* 10 */ 0x39, 0x3a, 0x37, 0x38, 0x3d, 0x3e, 0x3b, 0x3c, -/* 18 */ 0x31, 0x32, 0x30, 0x30, 0x35, 0x36, 0x33, 0x34, -/* 20 */ 0x0a, 0x0b, 0x08, 0x09, 0x0e, 0x0f, 0x0c, 0x0d, -/* 28 */ 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, -/* 30 */ 0x1a, 0x1b, 0x18, 0x19, 0x1e, 0x1f, 0x1c, 0x1d, -/* 38 */ 0x12, 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, -/* 40 */ 0x62, 0x63, 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, -/* 48 */ 0x5d, 0x5d, 0x5c, 0x5c, 0x5f, 0x5f, 0x5e, 0x5e, -/* 50 */ 0x74, 0x76, 0x70, 0x72, 0x7c, 0x7e, 0x78, 0x7a, -/* 58 */ 0x6a, 0x6b, 0x68, 0x69, 0x6e, 0x6f, 0x6c, 0x6d, -/* 60 */ 0x48, 0x49, 0x46, 0x47, 0x4c, 0x4d, 0x4a, 0x4b, -/* 68 */ 0x40, 0x41, 0x3f, 0x3f, 0x44, 0x45, 0x42, 0x43, -/* 70 */ 0x56, 0x57, 0x54, 0x55, 0x5a, 0x5b, 0x58, 0x59, -/* 78 */ 0x4f, 0x4f, 0x4e, 0x4e, 0x52, 0x53, 0x50, 0x51, -/* 80 */ 0xaa, 0xab, 0xa8, 0xa9, 0xae, 0xaf, 0xac, 0xad, -/* 88 */ 0xa2, 0xa3, 0xa0, 0xa1, 0xa6, 0xa7, 0xa4, 0xa5, -/* 90 */ 0xb9, 0xba, 0xb7, 0xb8, 0xbd, 0xbe, 0xbb, 0xbc, -/* 98 */ 0xb1, 0xb2, 0xb0, 0xb0, 0xb5, 0xb6, 0xb3, 0xb4, -/* a0 */ 0x8a, 0x8b, 0x88, 0x89, 0x8e, 0x8f, 0x8c, 0x8d, -/* a8 */ 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, -/* b0 */ 0x9a, 0x9b, 0x98, 0x99, 0x9e, 0x9f, 0x9c, 0x9d, -/* b8 */ 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, -/* c0 */ 0xe2, 0xe3, 0xe0, 0xe1, 0xe6, 0xe7, 0xe4, 0xe5, -/* c8 */ 0xdd, 0xdd, 0xdc, 0xdc, 0xdf, 0xdf, 0xde, 0xde, -/* d0 */ 0xf4, 0xf6, 0xf0, 0xf2, 0xfc, 0xfe, 0xf8, 0xfa, -/* d8 */ 0xea, 0xeb, 0xe8, 0xe9, 0xee, 0xef, 0xec, 0xed, -/* e0 */ 0xc8, 0xc9, 0xc6, 0xc7, 0xcc, 0xcd, 0xca, 0xcb, -/* e8 */ 0xc0, 0xc1, 0xbf, 0xbf, 0xc4, 0xc5, 0xc2, 0xc3, -/* f0 */ 0xd6, 0xd7, 0xd4, 0xd5, 0xda, 0xdb, 0xd8, 0xd9, -/* f8 */ 0xcf, 0xcf, 0xce, 0xce, 0xd2, 0xd3, 0xd0, 0xd1 -}; - -/*---------------------------------------------------------------------------* - * u-law to A-law conversion - *---------------------------------------------------------------------------*/ -static unsigned char u2a_tab[256] = { -/* 00 */ 0x2a, 0x2b, 0x28, 0x29, 0x2e, 0x2f, 0x2c, 0x2d, -/* 08 */ 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25, -/* 10 */ 0x3a, 0x3b, 0x38, 0x39, 0x3e, 0x3f, 0x3c, 0x3d, -/* 18 */ 0x32, 0x33, 0x30, 0x31, 0x36, 0x37, 0x34, 0x35, -/* 20 */ 0x0a, 0x0b, 0x08, 0x09, 0x0e, 0x0f, 0x0c, 0x0d, -/* 28 */ 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, -/* 30 */ 0x1b, 0x18, 0x19, 0x1e, 0x1f, 0x1c, 0x1d, 0x12, -/* 38 */ 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x6a, -/* 40 */ 0x68, 0x69, 0x6e, 0x6f, 0x6c, 0x6d, 0x62, 0x63, -/* 48 */ 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, 0x7a, 0x78, -/* 50 */ 0x7e, 0x7f, 0x7c, 0x7d, 0x72, 0x73, 0x70, 0x71, -/* 58 */ 0x76, 0x77, 0x74, 0x75, 0x4b, 0x49, 0x4f, 0x4d, -/* 60 */ 0x42, 0x43, 0x40, 0x41, 0x46, 0x47, 0x44, 0x45, -/* 68 */ 0x5a, 0x5b, 0x58, 0x59, 0x5e, 0x5f, 0x5c, 0x5d, -/* 70 */ 0x52, 0x52, 0x53, 0x53, 0x50, 0x50, 0x51, 0x51, -/* 78 */ 0x56, 0x56, 0x57, 0x57, 0x54, 0x54, 0x55, 0x55, -/* 80 */ 0xaa, 0xab, 0xa8, 0xa9, 0xae, 0xaf, 0xac, 0xad, -/* 88 */ 0xa2, 0xa3, 0xa0, 0xa1, 0xa6, 0xa7, 0xa4, 0xa5, -/* 90 */ 0xba, 0xbb, 0xb8, 0xb9, 0xbe, 0xbf, 0xbc, 0xbd, -/* 98 */ 0xb2, 0xb3, 0xb0, 0xb1, 0xb6, 0xb7, 0xb4, 0xb5, -/* a0 */ 0x8a, 0x8b, 0x88, 0x89, 0x8e, 0x8f, 0x8c, 0x8d, -/* a8 */ 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, -/* b0 */ 0x9b, 0x98, 0x99, 0x9e, 0x9f, 0x9c, 0x9d, 0x92, -/* b8 */ 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0xea, -/* c0 */ 0xe8, 0xe9, 0xee, 0xef, 0xec, 0xed, 0xe2, 0xe3, -/* c8 */ 0xe0, 0xe1, 0xe6, 0xe7, 0xe4, 0xe5, 0xfa, 0xf8, -/* d0 */ 0xfe, 0xff, 0xfc, 0xfd, 0xf2, 0xf3, 0xf0, 0xf1, -/* d8 */ 0xf6, 0xf7, 0xf4, 0xf5, 0xcb, 0xc9, 0xcf, 0xcd, -/* e0 */ 0xc2, 0xc3, 0xc0, 0xc1, 0xc6, 0xc7, 0xc4, 0xc5, -/* e8 */ 0xda, 0xdb, 0xd8, 0xd9, 0xde, 0xdf, 0xdc, 0xdd, -/* f0 */ 0xd2, 0xd2, 0xd3, 0xd3, 0xd0, 0xd0, 0xd1, 0xd1, -/* f8 */ 0xd6, 0xd6, 0xd7, 0xd7, 0xd4, 0xd4, 0xd5, 0xd5 -}; - -/*---------------------------------------------------------------------------* - * reverse bits in a byte - *---------------------------------------------------------------------------*/ -static unsigned char bitreverse[256] = { -/* 00 */ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, -/* 08 */ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, -/* 10 */ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, -/* 18 */ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, -/* 20 */ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, -/* 28 */ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, -/* 30 */ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, -/* 38 */ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, -/* 40 */ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, -/* 48 */ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, -/* 50 */ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, -/* 58 */ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, -/* 60 */ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, -/* 68 */ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, -/* 70 */ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, -/* 78 */ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, -/* 80 */ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, -/* 88 */ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, -/* 90 */ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, -/* 98 */ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, -/* a0 */ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, -/* a8 */ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, -/* b0 */ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, -/* b8 */ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, -/* c0 */ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, -/* c8 */ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, -/* d0 */ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, -/* d8 */ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, -/* e0 */ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, -/* e8 */ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, -/* f0 */ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, -/* f8 */ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -static u_char sinetab[8000] = { 213, 213, 213, 213, 213, 213, 213, 212, -212, 212, 212, 212, 212, 215, 215, 215, 215, 215, 215, 214, 214, -214, 214, 214, 214, 209, 209, 209, 209, 209, 209, 209, 208, 208, -208, 208, 208, 208, 211, 211, 211, 211, 211, 211, 210, 210, 210, -210, 210, 210, 221, 221, 221, 221, 221, 221, 220, 220, 220, 220, -220, 220, 220, 223, 223, 223, 223, 223, 223, 222, 222, 222, 222, -222, 222, 217, 217, 217, 217, 217, 217, 216, 216, 216, 216, 216, -216, 216, 219, 219, 219, 219, 219, 219, 218, 218, 218, 218, 218, -218, 197, 197, 197, 197, 197, 197, 196, 196, 196, 196, 196, 196, -196, 199, 199, 199, 199, 199, 199, 198, 198, 198, 198, 198, 198, -193, 193, 193, 193, 193, 193, 192, 192, 192, 192, 192, 192, 192, -195, 195, 195, 195, 195, 195, 194, 194, 194, 194, 194, 194, 205, -205, 205, 205, 205, 205, 204, 204, 204, 204, 204, 204, 204, 207, -207, 207, 207, 207, 207, 206, 206, 206, 206, 206, 206, 201, 201, -201, 201, 201, 201, 200, 200, 200, 200, 200, 200, 200, 203, 203, -203, 203, 203, 203, 202, 202, 202, 202, 202, 202, 245, 245, 245, -245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 244, 244, 244, -244, 244, 244, 244, 244, 244, 244, 244, 244, 247, 247, 247, 247, -247, 247, 247, 247, 247, 247, 247, 247, 247, 246, 246, 246, 246, -246, 246, 246, 246, 246, 246, 246, 246, 246, 241, 241, 241, 241, -241, 241, 241, 241, 241, 241, 241, 241, 240, 240, 240, 240, 240, -240, 240, 240, 240, 240, 240, 240, 240, 243, 243, 243, 243, 243, -243, 243, 243, 243, 243, 243, 243, 243, 242, 242, 242, 242, 242, -242, 242, 242, 242, 242, 242, 242, 242, 253, 253, 253, 253, 253, -253, 253, 253, 253, 253, 253, 253, 253, 252, 252, 252, 252, 252, -252, 252, 252, 252, 252, 252, 252, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, -254, 254, 254, 254, 254, 254, 254, 249, 249, 249, 249, 249, 249, -249, 249, 249, 249, 249, 249, 249, 248, 248, 248, 248, 248, 248, -248, 248, 248, 248, 248, 248, 248, 251, 251, 251, 251, 251, 251, -251, 251, 251, 251, 251, 251, 251, 250, 250, 250, 250, 250, 250, -250, 250, 250, 250, 250, 250, 250, 229, 229, 229, 229, 229, 229, -229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, -229, 229, 229, 229, 229, 229, 229, 228, 228, 228, 228, 228, 228, -228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, -228, 228, 228, 228, 228, 228, 228, 228, 231, 231, 231, 231, 231, -231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, -231, 231, 231, 231, 231, 231, 231, 231, 231, 230, 230, 230, 230, -230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, -230, 230, 230, 230, 230, 230, 230, 230, 230, 225, 225, 225, 225, -225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, -225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 224, 224, -224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, -224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 227, -227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, -227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, -227, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, -226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, -226, 226, 226, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -237, 237, 237, 237, 237, 236, 236, 236, 236, 236, 236, 236, 236, -236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, -236, 236, 236, 236, 236, 236, 236, 236, 239, 239, 239, 239, 239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 238, 238, -238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, -238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, -238, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -233, 233, 233, 233, 233, 232, 232, 232, 232, 232, 232, 232, 232, -232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, -232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 235, 235, 235, -235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, -235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, -235, 235, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -234, 234, 234, 234, 234, 234, 234, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, -156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, -157, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, -144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, -145, 145, 145, 145, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, -150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, -151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -234, 234, 234, 234, 234, 235, 235, 235, 235, 235, 235, 235, 235, -235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, -235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 232, 232, 232, -232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, -232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, -232, 232, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -233, 233, 233, 233, 233, 233, 238, 238, 238, 238, 238, 238, 238, -238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, -238, 238, 238, 238, 238, 238, 238, 238, 238, 239, 239, 239, 239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 236, -236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, -236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, -236, 236, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -237, 237, 237, 237, 226, 226, 226, 226, 226, 226, 226, 226, 226, -226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, -226, 226, 226, 226, 226, 226, 227, 227, 227, 227, 227, 227, 227, -227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, -227, 227, 227, 227, 227, 227, 227, 227, 224, 224, 224, 224, 224, -224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, -224, 224, 224, 224, 224, 224, 224, 224, 224, 225, 225, 225, 225, -225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, -225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 230, 230, -230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, -230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 231, 231, -231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, -231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 228, -228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, -228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, -229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, -229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, -250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, -248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, -249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, -254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 253, -253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 242, -242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 243, -243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 240, -240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 241, -241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 246, 246, -246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 247, 247, -247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 244, 244, -244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 245, 245, 245, -245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 202, 202, 202, -202, 202, 202, 203, 203, 203, 203, 203, 203, 200, 200, 200, 200, -200, 200, 200, 201, 201, 201, 201, 201, 201, 206, 206, 206, 206, -206, 206, 207, 207, 207, 207, 207, 207, 204, 204, 204, 204, 204, -204, 204, 205, 205, 205, 205, 205, 205, 194, 194, 194, 194, 194, -194, 195, 195, 195, 195, 195, 195, 192, 192, 192, 192, 192, 192, -192, 193, 193, 193, 193, 193, 193, 198, 198, 198, 198, 198, 198, -199, 199, 199, 199, 199, 199, 196, 196, 196, 196, 196, 196, 196, -197, 197, 197, 197, 197, 197, 218, 218, 218, 218, 218, 218, 219, -219, 219, 219, 219, 219, 216, 216, 216, 216, 216, 216, 216, 217, -217, 217, 217, 217, 217, 222, 222, 222, 222, 222, 222, 223, 223, -223, 223, 223, 223, 220, 220, 220, 220, 220, 220, 220, 221, 221, -221, 221, 221, 221, 210, 210, 210, 210, 210, 210, 211, 211, 211, -211, 211, 211, 208, 208, 208, 208, 208, 208, 209, 209, 209, 209, -209, 209, 209, 214, 214, 214, 214, 214, 214, 215, 215, 215, 215, -215, 215, 212, 212, 212, 212, 212, 212, 213, 213, 213, 213, 213, -213, 213, 90, 90, 90, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, -84, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 81, 81, 81, -81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 83, 83, 83, 83, 83, 83, -82, 82, 82, 82, 82, 82, 93, 93, 93, 93, 93, 93, 93, 92, 92, 92, -92, 92, 92, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 89, -89, 89, 89, 89, 89, 88, 88, 88, 88, 88, 88, 88, 91, 91, 91, 91, -91, 91, 90, 90, 90, 90, 90, 90, 69, 69, 69, 69, 69, 69, 68, 68, -68, 68, 68, 68, 68, 71, 71, 71, 71, 71, 71, 70, 70, 70, 70, 70, -70, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 67, 67, -67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 77, 77, 77, 77, 77, 77, -76, 76, 76, 76, 76, 76, 76, 79, 79, 79, 79, 79, 79, 78, 78, 78, -78, 78, 78, 73, 73, 73, 73, 73, 73, 73, 72, 72, 72, 72, 72, 72, -75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 117, 117, 117, 117, -117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, -116, 116, 116, 116, 116, 116, 116, 116, 116, 119, 119, 119, 119, -119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, -118, 118, 118, 118, 118, 118, 118, 118, 113, 113, 113, 113, 113, -113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, -112, 112, 112, 112, 112, 112, 112, 115, 115, 115, 115, 115, 115, -115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, -114, 114, 114, 114, 114, 114, 114, 125, 125, 125, 125, 125, 125, -125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, -124, 124, 124, 124, 124, 124, 124, 127, 127, 127, 127, 127, 127, -127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, -126, 126, 126, 126, 126, 126, 121, 121, 121, 121, 121, 121, 121, -121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, -120, 120, 120, 120, 120, 120, 123, 123, 123, 123, 123, 123, 123, -123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, -122, 122, 122, 122, 122, 122, 101, 101, 101, 101, 101, 101, 101, -101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, -101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, -100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, -100, 100, 100, 100, 100, 100, 100, 103, 103, 103, 103, 103, 103, -103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, -103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, -102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, -102, 102, 102, 102, 102, 102, 102, 102, 102, 97, 97, 97, 97, 97, -97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, -97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, -96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, -96, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, -99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, -98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, -98, 98, 98, 98, 98, 98, 98, 98, 98, 109, 109, 109, 109, 109, 109, -109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, -109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, -108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, -108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 111, -111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, -110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, -110, 110, 110, 110, 110, 110, 105, 105, 105, 105, 105, 105, 105, -105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, -105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, -104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, -104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, -104, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, -107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, -107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, -106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, -106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, -18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -19, 19, 19, 19, 19, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -17, 17, 17, 17, 17, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, -22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, -106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, -106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, -107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, -107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 104, 104, -104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, -104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, -104, 104, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, -105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, -105, 105, 105, 105, 105, 105, 110, 110, 110, 110, 110, 110, 110, -110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, -110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 111, -111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, -108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, -108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, -109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, -109, 109, 109, 109, 109, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, -98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, -98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, -99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 96, 96, -96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, -96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 97, -97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, -97, 97, 97, 97, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, -102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, -102, 102, 102, 102, 103, 103, 103, 103, 103, 103, 103, 103, 103, -103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, -103, 103, 103, 103, 103, 100, 100, 100, 100, 100, 100, 100, 100, -100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, -100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 101, 101, -101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, -101, 101, 101, 101, 101, 101, 122, 122, 122, 122, 122, 122, 122, -122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, -123, 123, 123, 123, 123, 123, 120, 120, 120, 120, 120, 120, 120, -120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, -121, 121, 121, 121, 121, 121, 126, 126, 126, 126, 126, 126, 126, -126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, -127, 127, 127, 127, 127, 124, 124, 124, 124, 124, 124, 124, 124, -124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, -125, 125, 125, 125, 125, 114, 114, 114, 114, 114, 114, 114, 114, -114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 115, -115, 115, 115, 115, 115, 112, 112, 112, 112, 112, 112, 112, 112, -112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 113, 113, 113, -113, 113, 113, 113, 118, 118, 118, 118, 118, 118, 118, 118, 118, -118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, -119, 119, 119, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, -116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, -117, 117, 117, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 72, -72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 78, 78, 78, 78, -78, 78, 79, 79, 79, 79, 79, 79, 76, 76, 76, 76, 76, 76, 76, 77, -77, 77, 77, 77, 77, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, -67, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 70, 70, -70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 68, 68, 68, 68, 68, 68, -68, 69, 69, 69, 69, 69, 69, 90, 90, 90, 90, 90, 90, 91, 91, 91, -91, 91, 91, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, -94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 92, 92, 92, 92, -92, 92, 93, 93, 93, 93, 93, 93, 93, 82, 82, 82, 82, 82, 82, 83, -83, 83, 83, 83, 83, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, -81, 81, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 84, 84, -84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 90, 90, 90 }; - -/*===========================================================================*/ diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c deleted file mode 100644 index 80f9b6e534a2..000000000000 --- a/sys/i4b/driver/i4b_trace.c +++ /dev/null @@ -1,430 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4btrc - device driver for trace data read device - * --------------------------------------------------- - * last edit-date: [Sun Mar 17 09:52:51 2002] - * - * NOTE: the code assumes that SPLI4B >= splimp ! - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -static struct ifqueue trace_queue[NI4BTRC]; - -static int device_state[NI4BTRC]; -#define ST_IDLE 0x00 -#define ST_ISOPEN 0x01 -#define ST_WAITDATA 0x02 - -static int analyzemode = 0; -static int rxunit = -1; -static int txunit = -1; -static int outunit = -1; - -static d_open_t i4btrcopen; -static d_close_t i4btrcclose; -static d_read_t i4btrcread; -static d_ioctl_t i4btrcioctl; -static d_poll_t i4btrcpoll; - - -static struct cdevsw i4btrc_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = i4btrcopen, - .d_close = i4btrcclose, - .d_read = i4btrcread, - .d_ioctl = i4btrcioctl, - .d_poll = i4btrcpoll, - .d_name = "i4btrc", -}; - -static void i4btrcattach(void *); -PSEUDO_SET(i4btrcattach, i4b_trace); - -int get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf); - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -static void -i4btrcattach(void *dummy) -{ - int i; - - printf("i4btrc: %d ISDN trace device(s) attached\n", NI4BTRC); - - for(i=0; i < NI4BTRC; i++) - { - make_dev(&i4btrc_cdevsw, i, - UID_ROOT, GID_WHEEL, 0600, "i4btrc%d", i); - trace_queue[i].ifq_maxlen = IFQ_MAXLEN; - - if(!mtx_initialized(&trace_queue[i].ifq_mtx)) - mtx_init(&trace_queue[i].ifq_mtx, "i4b_trace", NULL, MTX_DEF); - - device_state[i] = ST_IDLE; - } -} - -/*---------------------------------------------------------------------------* - * get_trace_data_from_l1() - * ------------------------ - * is called from layer 1, adds timestamp to trace data and puts - * it into a queue, from which it can be read from the i4btrc - * device. The unit number in the trace header selects the minor - * device's queue the data is put into. - *---------------------------------------------------------------------------*/ -int -get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf) -{ - struct mbuf *m; - int x; - int unit; - int trunc = 0; - int totlen = len + sizeof(i4b_trace_hdr_t); - - /* - * for telephony (or better non-HDLC HSCX mode) we get - * (MCLBYTE + sizeof(i4b_trace_hdr_t)) length packets - * to put into the queue to userland. because of this - * we detect this situation, strip the length to MCLBYTES - * max size, and infor the userland program of this fact - * by putting the no of truncated bytes into hdr->trunc. - */ - - if(totlen > MCLBYTES) - { - trunc = 1; - hdr->trunc = totlen - MCLBYTES; - totlen = MCLBYTES; - } - else - { - hdr->trunc = 0; - } - - /* set length of trace record */ - - hdr->length = totlen; - - /* check valid unit no */ - - if((unit = hdr->unit) >= NI4BTRC) - { - printf("i4b_trace: get_trace_data_from_l1 - unit > NI4BTRC!\n"); - return(0); - } - - /* get mbuf */ - - if(!(m = i4b_Bgetmbuf(totlen))) - { - printf("i4b_trace: get_trace_data_from_l1 - i4b_getmbuf() failed!\n"); - return(0); - } - - /* check if we are in analyzemode */ - - if(analyzemode && (unit == rxunit || unit == txunit)) - { - if(unit == rxunit) - hdr->dir = FROM_NT; - else - hdr->dir = FROM_TE; - unit = outunit; - } - - IF_LOCK(&trace_queue[unit]); - - if(_IF_QFULL(&trace_queue[unit])) - { - struct mbuf *m1; - - x = SPLI4B(); - _IF_DEQUEUE(&trace_queue[unit], m1); - splx(x); - - i4b_Bfreembuf(m1); - } - - /* copy trace header */ - memcpy(m->m_data, hdr, sizeof(i4b_trace_hdr_t)); - - /* copy trace data */ - if(trunc) - memcpy(&m->m_data[sizeof(i4b_trace_hdr_t)], buf, totlen-sizeof(i4b_trace_hdr_t)); - else - memcpy(&m->m_data[sizeof(i4b_trace_hdr_t)], buf, len); - - x = SPLI4B(); - - _IF_ENQUEUE(&trace_queue[unit], m); - IF_UNLOCK(&trace_queue[unit]); - - if(device_state[unit] & ST_WAITDATA) - { - device_state[unit] &= ~ST_WAITDATA; - wakeup( &trace_queue[unit]); - } - - splx(x); - - return(1); -} - -/*---------------------------------------------------------------------------* - * open trace device - *---------------------------------------------------------------------------*/ -static int -i4btrcopen(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - int x; - int unit = minor(dev); - - if(unit >= NI4BTRC) - return(ENXIO); - - if(device_state[unit] & ST_ISOPEN) - return(EBUSY); - - if(analyzemode && (unit == outunit || unit == rxunit || unit == txunit)) - return(EBUSY); - - x = SPLI4B(); - - device_state[unit] = ST_ISOPEN; - - splx(x); - - return(0); -} - -/*---------------------------------------------------------------------------* - * close trace device - *---------------------------------------------------------------------------*/ -static int -i4btrcclose(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - int unit = minor(dev); - int i, x; - int cno = -1; - - for(i=0; i < nctrl; i++) - { - if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[i].unit == unit)) - { - cno = i; - break; - } - } - - if(analyzemode && (unit == outunit)) - { - analyzemode = 0; - outunit = -1; - - if(cno >= 0) - { - (*ctrl_desc[cno].N_MGMT_COMMAND)(rxunit, CMR_SETTRACE, TRACE_OFF); - (*ctrl_desc[cno].N_MGMT_COMMAND)(txunit, CMR_SETTRACE, TRACE_OFF); - } - rxunit = -1; - txunit = -1; - } - - if(cno >= 0) - { - (*ctrl_desc[cno].N_MGMT_COMMAND)(ctrl_desc[cno].unit, CMR_SETTRACE, TRACE_OFF); - } - - x = SPLI4B(); - device_state[unit] = ST_IDLE; - splx(x); - - return(0); -} - -/*---------------------------------------------------------------------------* - * read from trace device - *---------------------------------------------------------------------------*/ -static int -i4btrcread(struct cdev *dev, struct uio * uio, int ioflag) -{ - struct mbuf *m; - int x; - int error = 0; - int unit = minor(dev); - - if(!(device_state[unit] & ST_ISOPEN)) - return(EIO); - - x = SPLI4B(); - - IF_LOCK(&trace_queue[unit]); - - while(IF_QEMPTY(&trace_queue[unit]) && (device_state[unit] & ST_ISOPEN)) - { - device_state[unit] |= ST_WAITDATA; - - if((error = msleep( &trace_queue[unit], - &trace_queue[unit].ifq_mtx, - I4BPRI | PCATCH, - "bitrc", 0 )) != 0) - { - device_state[unit] &= ~ST_WAITDATA; - IF_UNLOCK(&trace_queue[unit]); - splx(x); - return(error); - } - } - - _IF_DEQUEUE(&trace_queue[unit], m); - IF_UNLOCK(&trace_queue[unit]); - - if(m && m->m_len) - error = uiomove(m->m_data, m->m_len, uio); - else - error = EIO; - - if(m) - i4b_Bfreembuf(m); - - splx(x); - - return(error); -} - -/*---------------------------------------------------------------------------* - * poll device - *---------------------------------------------------------------------------*/ -static int -i4btrcpoll(struct cdev *dev, int events, struct thread *td) -{ - return(ENODEV); -} - -/*---------------------------------------------------------------------------* - * device driver ioctl routine - *---------------------------------------------------------------------------*/ -static int -i4btrcioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) -{ - int error = 0; - int unit = minor(dev); - i4b_trace_setupa_t *tsa; - int i; - int cno = -1; - - /* find the first passive controller matching our unit no */ - - for(i=0; i < nctrl; i++) - { - if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[i].unit == unit)) - { - cno = i; - break; - } - } - - switch(cmd) - { - case I4B_TRC_SET: - if(cno < 0) - return ENOTTY; - (*ctrl_desc[cno].N_MGMT_COMMAND)(ctrl_desc[cno].unit, CMR_SETTRACE, (void *)*(unsigned int *)data); - break; - - case I4B_TRC_SETA: - tsa = (i4b_trace_setupa_t *)data; - - if(tsa->rxunit >= 0 && tsa->rxunit < NI4BTRC) - rxunit = tsa->rxunit; - else - error = EINVAL; - - if(tsa->txunit >= 0 && tsa->txunit < NI4BTRC) - txunit = tsa->txunit; - else - error = EINVAL; - - if(error) - { - outunit = -1; - rxunit = -1; - txunit = -1; - } - else - { - if(cno < 0) - return ENOTTY; - - outunit = unit; - analyzemode = 1; - (*ctrl_desc[cno].N_MGMT_COMMAND)(rxunit, CMR_SETTRACE, (int *)(tsa->rxflags & (TRACE_I | TRACE_D_RX | TRACE_B_RX))); - (*ctrl_desc[cno].N_MGMT_COMMAND)(txunit, CMR_SETTRACE, (int *)(tsa->txflags & (TRACE_I | TRACE_D_RX | TRACE_B_RX))); - } - break; - - case I4B_TRC_RESETA: - analyzemode = 0; - outunit = -1; - rxunit = -1; - txunit = -1; - break; - - default: - error = ENOTTY; - break; - } - return(error); -} diff --git a/sys/i4b/include/i4b_cause.h b/sys/i4b/include/i4b_cause.h deleted file mode 100644 index 0e94483d48b0..000000000000 --- a/sys/i4b/include/i4b_cause.h +++ /dev/null @@ -1,148 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_cause.h - causes and cause handling for i4b - * ----------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Mar 17 10:08:21 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_CAUSE_H_ -#define _I4B_CAUSE_H_ - -/*---------------------------------------------------------------------------* - * ISDN4BSD internal causes specification - *---------------------------------------------------------------------------*/ - -#define CAUSE_VAL 0x000000ff /* cause value */ -#define CAUSE_TYPE 0x0000ff00 /* cause type */ -#define CAUSET_Q850 0 /* value coded according to Q.850 */ -#define CAUSET_I4B 1 /* i4b protocol independent causes*/ - -#define GET_CAUSE_VAL(cause) ((cause) & 0xff) -#define SET_CAUSE_VAL(dest, val) ((dest) = ((dest & 0xffffff00) | \ - (val & 0x000000ff))) - -#define GET_CAUSE_TYPE(cause) (((cause) >> 8) & 0xff) -#define SET_CAUSE_TYPE(dest, type) ((dest) = ((dest & 0xffff00ff) | \ - ((type << 8) & 0x0000ff00))) - -#define SET_CAUSE_TV(dest, type, val) ((dest) = ((val & 0x000000ff) | \ - ((type << 8) & 0x0000ff00))) - -/* CAUSET_I4B - protocol independent cause values */ - -#define CAUSE_I4B_NORMAL 0 /* normal call clearing */ -#define CAUSE_I4B_BUSY 1 /* user busy */ -#define CAUSE_I4B_NOCHAN 2 /* circuit/channel not available*/ -#define CAUSE_I4B_INCOMP 3 /* incompatible source/dest */ -#define CAUSE_I4B_REJECT 4 /* call rejected */ -#define CAUSE_I4B_OOO 5 /* destination out of order */ -#define CAUSE_I4B_TMPFAIL 6 /* temporary failure */ -#define CAUSE_I4B_L1ERROR 7 /* L1 error / persistent deact */ -#define CAUSE_I4B_LLDIAL 8 /* no dialout on leased line */ -#define CAUSE_I4B_MAX 9 - /* NOTE: update isdnd/pcause.c when adding causes !!!!! */ - /* NOTE: update layer3/i4b_q931.c when adding causes !!!!! */ - -/* CAUSET_Q850 - causes defined in Q.850 */ - -#define CAUSE_Q850_SHUTDN 0x00 /* normal D-channel shutdown */ -#define CAUSE_Q850_NUNALLC 0x01 /* Unallocated (unassigned) number */ -#define CAUSE_Q850_NRTTN 0x02 /* No route to specified transit network */ -#define CAUSE_Q850_NRTDST 0x03 /* No route to destination */ -#define CAUSE_Q850_SSINFTN 0x04 /* Send special information tone */ -#define CAUSE_Q850_MDIALTP 0x05 /* Misdialled trunk prefix */ -#define CAUSE_Q850_CHUNACC 0x06 /* Channel unacceptable */ -#define CAUSE_Q850_CALLAWD 0x07 /* Call awarded and being delivered in an established channel */ -#define CAUSE_Q850_PREEMPT 0x08 /* Preemption */ -#define CAUSE_Q850_PREECRR 0x09 /* Preemption - circuit reserved for reuse */ -#define CAUSE_Q850_NCCLR 0x10 /* Normal call clearing */ -#define CAUSE_Q850_USRBSY 0x11 /* User busy */ -#define CAUSE_Q850_NOUSRRSP 0x12 /* No user responding */ -#define CAUSE_Q850_NOANSWR 0x13 /* No answer from user (user alerted) */ -#define CAUSE_Q850_SUBSABS 0x14 /* Subscriber absent */ -#define CAUSE_Q850_CALLREJ 0x15 /* Call rejected */ -#define CAUSE_Q850_NUCHNG 0x16 /* Number changed */ -#define CAUSE_Q850_NONSELUC 0x1A /* Non-selected user clearing */ -#define CAUSE_Q850_DSTOOORDR 0x1B /* Destination out of order */ -#define CAUSE_Q850_INVNUFMT 0x1C /* Invalid number format */ -#define CAUSE_Q850_FACREJ 0x1D /* Facility rejected */ -#define CAUSE_Q850_STENQRSP 0x1E /* Response to STATUS ENQUIRY */ -#define CAUSE_Q850_NORMUNSP 0x1F /* Normal, unspecified */ -#define CAUSE_Q850_NOCAVAIL 0x22 /* No circuit / channel available */ -#define CAUSE_Q850_NETOOORDR 0x26 /* Network out of order */ -#define CAUSE_Q850_PFMCDOOSERV 0x27 /* Permanent frame mode connection out of service */ -#define CAUSE_Q850_PFMCOPER 0x28 /* Permanent frame mode connection operational */ -#define CAUSE_Q850_TMPFAIL 0x29 /* Temporary failure */ -#define CAUSE_Q850_SWEQCONG 0x2A /* Switching equipment congestion */ -#define CAUSE_Q850_ACCINFDIS 0x2B /* Access information discarded */ -#define CAUSE_Q850_REQCNOTAV 0x2C /* Requested circuit/channel not available */ -#define CAUSE_Q850_PRECALBLK 0x2E /* Precedence call blocked */ -#define CAUSE_Q850_RESUNAVAIL 0x2F /* Resources unavailable, unspecified */ -#define CAUSE_Q850_QOSUNAVAIL 0x31 /* Quality of service unavailable */ -#define CAUSE_Q850_REQSERVNS 0x32 /* Requested facility not subscribed */ -#define CAUSE_Q850_OCBARRCUG 0x35 /* Outgoing calls barred within CUG */ -#define CAUSE_Q850_ICBARRCUG 0x36 /* Incoming calls barred within CUG */ -#define CAUSE_Q850_BCAPNAUTH 0x39 /* Bearer capability not authorized */ -#define CAUSE_Q850_BCAPNAVAIL 0x3A /* Bearer capability not presently available */ -#define CAUSE_Q850_INCSTOACISC 0x3E /* Inconsistenciy in designated outgoing access information and subscriber class */ -#define CAUSE_Q850_SOONOTAVAIL 0x3F /* Service or option not available, unspecified */ -#define CAUSE_Q850_BCAPNOTIMPL 0x41 /* Bearer capability not implemented */ -#define CAUSE_Q850_CHTYPNIMPL 0x42 /* Channel type not implemented */ -#define CAUSE_Q850_REQFACNIMPL 0x45 /* Requested facility not implemented */ -#define CAUSE_Q850_ORDINBCAVL 0x46 /* Only restricted digital information bearer capability is available */ -#define CAUSE_Q850_SOONOTIMPL 0x4F /* Service or option not implemented, unspecified */ -#define CAUSE_Q850_INVCLRFVAL 0x51 /* Invalid call reference value */ -#define CAUSE_Q850_IDCHDNOEX 0x52 /* Identified channel does not exist */ -#define CAUSE_Q850_SUSCAEXIN 0x53 /* A suspended call exists, but this call identity does not */ -#define CAUSE_Q850_CLIDINUSE 0x54 /* Call identity in use */ -#define CAUSE_Q850_NOCLSUSP 0x55 /* No call suspended */ -#define CAUSE_Q850_CLIDCLRD 0x56 /* Call having the requested call identity has been cleared */ -#define CAUSE_Q850_UNOTMEMCUG 0x57 /* User not member of CUG */ -#define CAUSE_Q850_INCDEST 0x58 /* Incompatible destination */ -#define CAUSE_Q850_NONEXCUG 0x5A /* Non-existent CUG */ -#define CAUSE_Q850_INVNTWSEL 0x5B /* Invalid transit network selection */ -#define CAUSE_Q850_INVMSG 0x5F /* Invalid message, unspecified */ -#define CAUSE_Q850_MIEMISS 0x60 /* Mandatory information element is missing */ -#define CAUSE_Q850_MSGTNI 0x61 /* Message type non-existent or not implemented */ -#define CAUSE_Q850_MSGNCMPT 0x62 /* Message not compatible with call state or message type non-existent or not implemented */ -#define CAUSE_Q850_IENENI 0x63 /* Information element/parameter non-existent or not implemented */ -#define CAUSE_Q850_INVIEC 0x64 /* Invalid information element contents */ -#define CAUSE_Q850_MSGNCWCS 0x65 /* Message not compatible with call state */ -#define CAUSE_Q850_RECOTIMEXP 0x66 /* Recovery on timer expiry */ -#define CAUSE_Q850_PARMNENIPO 0x67 /* Parameter non-existent or not implemented, passed on */ -#define CAUSE_Q850_MSGUNRDPRM 0x6E /* Message with unrecognized parameter, discarded */ -#define CAUSE_Q850_PROTERR 0x6F /* Protocol error, unspecified */ -#define CAUSE_Q850_INTWRKU 0x7F /* Interworking, unspecified */ - -#define CAUSE_Q850_MAX 128 - -#endif /* _I4B_CAUSE_H_ */ diff --git a/sys/i4b/include/i4b_debug.h b/sys/i4b/include/i4b_debug.h deleted file mode 100644 index 38ae5ad6230e..000000000000 --- a/sys/i4b/include/i4b_debug.h +++ /dev/null @@ -1,302 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_debug.h - i4b debug header file - * ----------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Mar 17 10:08:41 2002] - * - *---------------------------------------------------------------------------*/ - -#if !defined DO_I4B_DEBUG -# define DO_I4B_DEBUG 1 /* default = include debugging code */ -#elif DO_I4B_DEBUG != 0 -# undef DO_I4B_DEBUG -# define DO_I4B_DEBUG 1 -#endif - -#undef DO_I4B_MAXDEBUG /* default = disable ALL debug messages */ - -#if DO_I4B_DEBUG - -extern unsigned int i4b_l1_debug; -extern unsigned int i4b_l2_debug; -extern unsigned int i4b_l3_debug; -extern unsigned int i4b_l4_debug; - -#define NDBGL1(bits, fmt, args...) \ - if(bits & i4b_l1_debug) \ - { printf("i4b-L1 %s: " fmt "\n", __func__ , ##args ); } - -#define NDBGL2(bits, fmt, args...) \ - if(bits & i4b_l2_debug) \ - { printf("i4b-L2 %s: " fmt "\n", __func__ , ##args ); } - -#define NDBGL3(bits, fmt, args...) \ - if(bits & i4b_l3_debug) \ - { printf("i4b-L3 %s: " fmt "\n", __func__ , ##args ); } - -#define NDBGL4(bits, fmt, args...) \ - if(bits & i4b_l4_debug) \ - { printf("i4b-L4 %s: " fmt "\n", __func__ , ##args ); } - -#else /* !DO_I4B_DEBUG */ - -#define NDBGL1(bits, fmt, args...); -#define NDBGL2(bits, fmt, args...); -#define NDBGL3(bits, fmt, args...); -#define NDBGL4(bits, fmt, args...); - -#endif /* DO_I4B_DEBUG */ - -/* Layer 1 */ - -#define L1_ERROR 0x000001 /* general error message*/ -#define L1_PRIM 0x000002 /* interlayer primitives*/ -#define L1_BCHAN 0x000004 /* B channel action */ -#define L1_H_ERR 0x000008 /* HSCX errors */ -#define L1_H_IRQ 0x000010 /* HSCX IRQ messages */ -#define L1_I_ERR 0x000020 /* ISAC errors */ -#define L1_I_MSG 0x000040 /* ISAC messages */ -#define L1_I_SETUP 0x000080 /* ISAC setup messages */ -#define L1_F_MSG 0x000100 /* FSM messages */ -#define L1_F_ERR 0x000200 /* FSM error messages */ -#define L1_T_MSG 0x000400 /* Timer messages */ -#define L1_T_ERR 0x000800 /* Timer error messages */ -#define L1_H_XFRERR 0x001000 /* HSCX data xfer error */ -#define L1_I_CICO 0x002000 /* ISAC command in/out */ -#define L1_S_MSG 0x004000 /* silent messages (soft-HDLC) */ -#define L1_S_ERR 0x008000 /* error messages (soft-HDLC) */ -#define L1_HFC_DBG 0x010000 /* HFC-S PCI messages */ -#define L1_DEBUG_MAX 0x01ffef /* all messages on except IRQ! */ -#define L1_DEBUG_ERR (L1_S_ERR | L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR) - -#ifndef L1_DEBUG_DEFAULT -#ifdef DO_I4B_MAXDEBUG -#define L1_DEBUG_DEFAULT L1_DEBUG_MAX -#else -#define L1_DEBUG_DEFAULT L1_DEBUG_ERR -#endif -#endif - -/* Layer 2 */ - -#define L2_ERROR 0x0001 /* general error message */ -#define L2_PRIM 0x0002 /* interlayer primitives */ -#define L2_U_MSG 0x0004 /* U frame messages */ -#define L2_U_ERR 0x0008 /* U frame error messages */ -#define L2_S_MSG 0x0010 /* S frame messages */ -#define L2_S_ERR 0x0020 /* S frame error messages */ -#define L2_I_MSG 0x0040 /* I frame messages */ -#define L2_I_ERR 0x0080 /* I frame error messages */ -#define L2_F_MSG 0x0100 /* FSM messages */ -#define L2_F_ERR 0x0200 /* FSM error messages */ -#define L2_T_MSG 0x0400 /* timer messages */ -#define L2_T_ERR 0x0800 /* timer error messages */ -#define L2_TEI_MSG 0x1000 /* TEI messages */ -#define L2_TEI_ERR 0x2000 /* TEI error messages */ - -#define L2_DEBUG_MAX 0x3fff /* all messages on */ -#define L2_DEBUG_ERR (L2_ERROR | L2_I_ERR | L2_F_ERR | L2_T_ERR | L2_S_ERR | L2_TEI_ERR | L2_U_ERR ) - -#ifndef L2_DEBUG_DEFAULT -#ifdef DO_I4B_MAXDEBUG -#define L2_DEBUG_DEFAULT L2_DEBUG_MAX -#else -#define L2_DEBUG_DEFAULT L2_DEBUG_ERR -#endif -#endif - -/* Layer 3 */ - -#define L3_ERR 0x0001 /* general error message */ -#define L3_MSG 0x0002 /* general message */ -#define L3_F_MSG 0x0004 /* FSM messages */ -#define L3_F_ERR 0x0008 /* FSM error messages */ -#define L3_T_MSG 0x0010 /* timer messages */ -#define L3_T_ERR 0x0020 /* timer error messages */ -#define L3_P_MSG 0x0040 /* protocol messages */ -#define L3_P_ERR 0x0080 /* protocol error messages */ -#define L3_A_MSG 0x0100 /* AOC messages */ -#define L3_A_ERR 0x0200 /* AOC error messages */ -#define L3_PRIM 0x0400 /* messages exchanged */ - -#define L3_DEBUG_MAX 0x07ff /* all messages on */ -#define L3_DEBUG_ERR (L3_ERR | L3_F_ERR | L3_T_ERR | L3_P_ERR | L3_A_ERR) - -#ifndef L3_DEBUG_DEFAULT -#ifdef DO_I4B_MAXDEBUG -#define L3_DEBUG_DEFAULT L3_DEBUG_MAX -#else -#define L3_DEBUG_DEFAULT L3_DEBUG_ERR -#endif -#endif - -/* Layer 4 */ - -#define L4_ERR 0x0001 /* general error message */ -#define L4_MSG 0x0002 /* general message */ -#define L4_TIMO 0x0004 /* b channel idle timeout msgs */ -#define L4_DIALST 0x0008 /* network driver dial states */ -#define L4_IPRDBG 0x0010 /* ipr driver debug messages */ -#define L4_RBCHDBG 0x0020 /* rbch driver debug messages */ -#define L4_ISPDBG 0x0040 /* isp driver debug messages */ -#define L4_TELDBG 0x0080 /* tel driver debug messages */ -#define L4_INGDBG 0x0100 /* ing driver debug messages */ -#define L4_IAVCDBG 0x0200 /* AVM B1 driver debug messages */ -#define L4_CAPIDBG 0x0400 /* CAPI driver debug messages */ - -#define L4_DEBUG_MAX 0x0fff /* all messages on */ -#define L4_DEBUG_ERR L4_ERR - -#ifndef L4_DEBUG_DEFAULT -#ifdef DO_I4B_MAXDEBUG -#define L4_DEBUG_DEFAULT L4_DEBUG_MAX -#else -#define L4_DEBUG_DEFAULT L4_DEBUG_ERR -#endif -#endif - -/*---------------------------------------------------------------------------* - * ioctl via /dev/i4bctl: - * get/set current debug bits settings - *---------------------------------------------------------------------------*/ - -typedef struct { - unsigned int l1; - unsigned int l2; - unsigned int l3; - unsigned int l4; -} ctl_debug_t; - -#define I4B_CTL_GET_DEBUG _IOR('C', 0, ctl_debug_t) - -#define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t) - -/*---------------------------------------------------------------------------* - * generic get chipset statistics - *---------------------------------------------------------------------------*/ - -/* for the ihfc-driver: structure for HFC-1/S/SP statistics */ - -typedef struct { - int txframes; - int rxframes; - int xdu; - int rdo; - int crc; - int rab; -} hfcstat_t; - - -/* for the isic-driver: structure for HSCX statistics */ - -typedef struct { - int unit; /* controller number */ - int chan; /* channel number */ - int vfr; - int rdo; - int crc; - int rab; - int xdu; - int rfo; -} hscxstat_t; - -/* generic statistics structure */ - -struct chipstat { - int driver_type; /* type, L1DRVR_XXXX */ - int driver_unit; /* the unit number */ - int driver_bchannel; /* the B-channel */ - union stats { /* union for all drivers */ - hfcstat_t hfcstat; /* for ihfc driver, L1DRVR_IHFC */ - hscxstat_t hscxstat; /* for isic driver, L1DRVR_ISIC */ - } stats; -}; - -/* get statistics */ - -#define I4B_CTL_GET_CHIPSTAT _IOWR('C', 2, struct chipstat) - -/* clear statistics */ - -#define I4B_CTL_CLR_CHIPSTAT _IOW('C', 3, struct chipstat) - -/*---------------------------------------------------------------------------* - * get LAPD/Q.921 statistics - *---------------------------------------------------------------------------*/ -typedef struct { - - /* transmit */ - - u_long tx_i; /* I */ - u_long tx_rr; /* RR */ - u_long tx_rnr; /* RNR */ - u_long tx_rej; /* REJ */ - u_long tx_sabme; /* SABME*/ - u_long tx_dm; /* DM */ - u_long tx_disc; /* DISC */ - u_long tx_ua; /* UA */ - u_long tx_frmr; /* FRMR */ - u_long tx_tei; /* TEI */ - - /* receive */ - - u_long rx_i; /* I */ - u_long rx_rr; /* RR */ - u_long rx_rnr; /* RNR */ - u_long rx_rej; /* REJ */ - u_long rx_sabme; /* SABME*/ - u_long rx_tei; /* TEI */ - u_long rx_ui; /* UI */ - u_long rx_disc; /* DISC */ - u_long rx_xid; /* XID */ - u_long rx_dm; /* DM */ - u_long rx_ua; /* UA */ - u_long rx_frmr; /* FRMR */ - - /* errors */ - - u_long err_rx_len; /* incorrect length */ - u_long err_rx_badf; /* bad frame type */ - u_long err_rx_bads; /* bad s frame */ - u_long err_rx_badu; /* bad u frame */ - u_long err_rx_badui; /* bad ui frame */ -} lapdstat_t; - -typedef struct { - int unit; - lapdstat_t lapdstat; -} l2stat_t; - -#define I4B_CTL_GET_LAPDSTAT _IOWR('C', 4, l2stat_t) - -#define I4B_CTL_CLR_LAPDSTAT _IOW('C', 5, int) - -/* EOF */ diff --git a/sys/i4b/include/i4b_global.h b/sys/i4b/include/i4b_global.h deleted file mode 100644 index c7bcf319e0e0..000000000000 --- a/sys/i4b/include/i4b_global.h +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_global.h - i4b global include file - * -------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Mar 17 09:55:26 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_GLOBAL_H_ -#define _I4B_GLOBAL_H_ - -/*---------------------------------------------------------------------------* - * hiding OS differences in the kernel - *---------------------------------------------------------------------------*/ - -#if defined(__FreeBSD__) && __FreeBSD__ >= 5 -/* - * Deprecated LKM interface. - */ -#include -#define PSEUDO_SET(sym, name) \ - static int name ## _modevent(module_t mod, int type, void *data) \ - { \ - void (*initfunc)(void *) = (void (*)(void *))data; \ - switch (type) { \ - case MOD_LOAD: \ - /* printf(#name " module load\n"); */ \ - initfunc(NULL); \ - break; \ - case MOD_UNLOAD: \ - printf(#name " module unload - not possible for this module type\n"); \ - return EINVAL; \ - default: \ - return EOPNOTSUPP; \ - } \ - return 0; \ - } \ - static moduledata_t name ## _mod = { \ - #name, \ - name ## _modevent, \ - (void *)sym \ - }; \ - DECLARE_MODULE(name, name ## _mod, SI_SUB_PSEUDO, SI_ORDER_ANY) -#endif - -/*---------------*/ -/* time handling */ -/*---------------*/ - -#include - -#define TIMEOUT_FUNC_T timeout_t * -#define SECOND time_second -#define MICROTIME(x) getmicrotime(&(x)) - -/*----------------*/ -/* timer handling */ -/*----------------*/ - -#define START_TIMER(XHANDLE, XF, XSC, XTIME) XHANDLE = timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME) -#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XHANDLE) - -/*---------------------------------------------------------------------------* - * misc globally used things in the kernel - *---------------------------------------------------------------------------*/ - -/* timer states */ - -#define TIMER_IDLE 1 /* a timer is running */ -#define TIMER_ACTIVE 2 /* a timer is idle */ - -/* priority */ -#define I4BPRI (PSOCK + 1) - -/* i4b's spl */ - -#define SPLI4B() splimp() /* spl for i4b */ - -/* critial code region handling macros */ - -#define CRIT_VAR int _svd_spl_ /* declare variable */ -#define CRIT_BEG _svd_spl_ = SPLI4B() /* save spl */ -#define CRIT_END splx(_svd_spl_) /* restore spl */ - -/* definitions for the STATUS indications L1 -> L2 -> L3 */ - -#define STI_ATTACH 0 /* attach at boot time */ -#define STI_L1STAT 1 /* layer 1 status */ -#define STI_L2STAT 2 /* layer 2 status */ -#define STI_TEIASG 3 /* TEI assignments */ -#define STI_PDEACT 4 /* Layer 1 T4 expired = persistent deactivation */ -#define STI_NOL1ACC 5 /* no outgoing L1 access possible */ - -/* definitions for the COMMAND requests L3 -> L2 -> L1 */ - -#define CMR_DOPEN 0 /* daemon opened /dev/i4b */ -#define CMR_DCLOSE 1 /* daemon closed /dev/i4b */ -#define CMR_SETTRACE 2 /* set D-channel and B-channel trace */ -#define CMR_GCST 3 /* get chipset statistics */ -#define CMR_CCST 4 /* clear chipset statistics */ - -#endif /* _I4B_GLOBAL_H_ */ diff --git a/sys/i4b/include/i4b_ioctl.h b/sys/i4b/include/i4b_ioctl.h deleted file mode 100644 index 5c8e4fee3b29..000000000000 --- a/sys/i4b/include/i4b_ioctl.h +++ /dev/null @@ -1,744 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ioctl.h - messages kernel <--> userland - * ------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Aug 11 19:19:08 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IOCTL_H_ -#define _I4B_IOCTL_H_ - -/*---------------------------------------------------------------------------* - * version and release number for isdn4bsd package - *---------------------------------------------------------------------------*/ -#define VERSION 1 /* version number */ -#define REL 4 /* release number */ -#define STEP 1 /* release step */ - -/*---------------------------------------------------------------------------* - * date/time format in i4b log messages - * ------------------------------------ - * Being year 2000 clean is not easy with the current state of the - * ANSI C library standard and it's implementation for some locales. - * You might like to use the "%c" format of "strftime" sometimes, - * but this breaks Y2K in some locales. Also the old standard logfile - * format "%d.%m.%y %H:%M:%S" is non compliant. - * NetBSD's current toolset warns about this problems, and we compile - * with -Werror, so this problems need to be resolved. - *---------------------------------------------------------------------------*/ -#define I4B_TIME_FORMAT "%d.%m.%Y %H:%M:%S" - -/*---------------------------------------------------------------------------* - * max number of controllers in system - *---------------------------------------------------------------------------*/ -#define MAX_CONTROLLERS 8 /* max number of controllers */ - -/*---------------------------------------------------------------------------* - * ISDN D-channel protocols - *---------------------------------------------------------------------------*/ -#define PROTOCOL_DSS1 0 /* default, Euro-ISDN/DSS1 */ -#define PROTOCOL_D64S 1 /* 64k leased line, no protocol */ - -/*---------------------------------------------------------------------------* - * controller types - *---------------------------------------------------------------------------*/ -#define CTRL_INVALID (-1) /* invalid, error */ -#define CTRL_UNKNOWN 0 /* unknown controller type */ -#define CTRL_PASSIVE 1 /* passive ISDN controller cards*/ -#define CTRL_DAIC 2 /* Diehl active controller cards*/ -#define CTRL_TINADD 3 /* Stollmann Tina-dd active card*/ -#define CTRL_AVMB1 4 /* AVM B1 active card */ -#define CTRL_CAPI 5 /* cards seen via the CAPI layer*/ -#define CTRL_CAPIMGR 6 /* boards accessed through the CAPI manager */ -#define CTRL_NUMTYPES 7 /* number of controller types */ - -/*---------------------------------------------------------------------------* - * CTRL_PASSIVE: driver types - *---------------------------------------------------------------------------*/ -#define MAXL1UNITS 8 /* max number of units */ - -#define L1DRVR_ISIC 0 /* isic - driver */ -#define L1DRVR_IWIC 1 /* iwic - driver */ -#define L1DRVR_IFPI 2 /* ifpi - driver */ -#define L1DRVR_IHFC 3 /* ihfc - driver */ -#define L1DRVR_IFPNP 4 /* ifpnp - driver */ -#define L1DRVR_ICCHP 5 /* icchp - driver */ -#define L1DRVR_ITJC 6 /* itjc - driver */ -#define L1DRVR_IFPI2 7 /* ifpi2 - driver */ - -/* MAXL1DRVR MUST be updated when more passive drivers are added !!! */ -#define MAXL1DRVR (L1DRVR_IFPI2 + 1) - -/*---------------------------------------------------------------------------* - * card types for CTRL_PASSIVE - *---------------------------------------------------------------------------*/ -#define CARD_TYPEP_INVAL (-1) /* invalid, error */ -#define CARD_TYPEP_UNK 0 /* unknown */ -#define CARD_TYPEP_8 1 /* Teles, S0/8 */ -#define CARD_TYPEP_16 2 /* Teles, S0/16 */ -#define CARD_TYPEP_16_3 3 /* Teles, S0/16.3 */ -#define CARD_TYPEP_AVMA1 4 /* AVM A1 or AVM Fritz!Card */ -#define CARD_TYPEP_163P 5 /* Teles, S0/16.3 PnP */ -#define CARD_TYPEP_CS0P 6 /* Creatix, S0 PnP */ -#define CARD_TYPEP_USRTA 7 /* US Robotics ISDN TA internal */ -#define CARD_TYPEP_DRNNGO 8 /* Dr. Neuhaus Niccy GO@ */ -#define CARD_TYPEP_SWS 9 /* Sedlbauer Win Speed */ -#define CARD_TYPEP_DYNALINK 10 /* Dynalink IS64PH */ -#define CARD_TYPEP_BLMASTER 11 /* ISDN Blaster / ISDN Master */ -#define CARD_TYPEP_PCFRITZ 12 /* AVM PCMCIA Fritz!Card */ -#define CARD_TYPEP_ELSAQS1ISA 13 /* ELSA QuickStep 1000pro ISA */ -#define CARD_TYPEP_ELSAQS1PCI 14 /* ELSA QuickStep 1000pro PCI */ -#define CARD_TYPEP_SIEMENSITALK 15 /* Siemens I-Talk */ -#define CARD_TYPEP_ELSAMLIMC 16 /* ELSA MicroLink ISDN/MC */ -#define CARD_TYPEP_ELSAMLMCALL 17 /* ELSA MicroLink MCall */ -#define CARD_TYPEP_ITKIX1 18 /* ITK ix1 micro */ -#define CARD_TYPEP_AVMA1PCI 19 /* AVM FRITZ!CARD PCI */ -#define CARD_TYPEP_PCC16 20 /* ELSA PCC-16 */ -#define CARD_TYPEP_AVM_PNP 21 /* AVM FRITZ!CARD PnP */ -#define CARD_TYPEP_SIE_ISURF2 22 /* Siemens I-Surf 2 PnP */ -#define CARD_TYPEP_ASUSCOMIPAC 23 /* Asuscom ISDNlink 128 K PnP */ -#define CARD_TYPEP_WINB6692 24 /* Winbond W6692 based */ -#define CARD_TYPEP_16_3C 25 /* Teles S0/16.3c PnP (HFC-S/SP */ -#define CARD_TYPEP_ACERP10 26 /* Acer ISDN P10 (HFC-S) */ -#define CARD_TYPEP_TELEINT_NO_1 27 /* TELEINT ISDN SPEED No. 1 (HFC-1) */ -#define CARD_TYPEP_CCD_HFCS_PCI 28 /* Cologne Chip HFC-S PCI based */ -#define CARD_TYPEP_NETJET_S 29 /* Traverse NetJet-S (Tiger300) */ -#define CARD_TYPEP_DIVA_ISA 30 /* Eicon DIVA ISA PnP 2.0 or 2.02 */ -#define CARD_TYPEP_COMPAQ_M610 31 /* Compaq Microcom 610 */ -#define CARD_TYPEP_AVMA1PCI_V2 32 /* AVM FRITZ!CARD PCI Ver. 2 */ -/* - * in case you add support for more cards, please update: - * - * isdnd: controller.c, name_of_controller() - * - * and adjust CARD_TYPEP_MAX below. - */ - -#define CARD_TYPEP_MAX 32 /* max type */ - -/*---------------------------------------------------------------------------* - * card types for CTRL_DAIC - *---------------------------------------------------------------------------*/ -#define CARD_TYPEA_DAIC_UNK 0 -#define CARD_TYPEA_DAIC_S 1 -#define CARD_TYPEA_DAIC_SX 2 -#define CARD_TYPEA_DAIC_SCOM 3 -#define CARD_TYPEA_DAIC_QUAD 4 - -/*---------------------------------------------------------------------------* - * card types for CTRL_CAPI - *---------------------------------------------------------------------------*/ -#define CARD_TYPEC_CAPI_UNK 0 -#define CARD_TYPEC_AVM_T1_PCI 1 -#define CARD_TYPEC_AVM_B1_PCI 2 -#define CARD_TYPEC_AVM_B1_ISA 3 - -/*---------------------------------------------------------------------------* - * max length of some strings - *---------------------------------------------------------------------------*/ -#define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */ -#define SUBADDR_MAX 21 /* max length of a subaddress (+ '\0') */ -#define DISPLAY_MAX 91 /* max length of display information (+ '\0') */ -#define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/ -#define KEYPAD_MAX 35 /* max length of a keypad string (+ '\0') */ - -/*---------------------------------------------------------------------------* - * in case the src or dst telephone number is empty - *---------------------------------------------------------------------------*/ -#define TELNO_EMPTY "NotAvailable" - -/*---------------------------------------------------------------------------* - * B channel parameters - *---------------------------------------------------------------------------*/ -#define BCH_MAX_DATALEN 2048 /* max length of a B channel frame */ - -/*---------------------------------------------------------------------------* - * userland driver types - * --------------------- - * a "driver" is defined here as a piece of software interfacing an - * ISDN B channel with a userland service, such as IP, Telephony etc. - *---------------------------------------------------------------------------*/ -#define BDRV_RBCH 0 /* raw b-channel interface driver */ -#define BDRV_TEL 1 /* telephone (speech) interface driver */ -#define BDRV_IPR 2 /* IP over raw HDLC interface driver */ -#define BDRV_ISPPP 3 /* sync Kernel PPP interface driver */ -#define BDRV_IBC 4 /* BSD/OS point to point driver */ -#define BDRV_ING 5 /* NetGraph ing driver */ - -/*---------------------------------------------------------------------------* - * B channel protocol - *---------------------------------------------------------------------------*/ -#define BPROT_NONE 0 /* no protocol at all, raw data */ -#define BPROT_RHDLC 1 /* raw HDLC: flag, data, crc, flag */ - -/*---------------------------------------------------------------------------* - * special bearer capability settings (i.e. Data over Voice) - *---------------------------------------------------------------------------*/ -#define BCAP_NONE 0 /* no special bearer capability */ -#define BCAP_DOV 1 /* Data over Voice */ - -/*---------------------------------------------------------------------------* - * causes data type - *---------------------------------------------------------------------------*/ -typedef unsigned int cause_t; /* 32 bit unsigned int */ - -/*---------------------------------------------------------------------------* - * call descriptor id (cdid) definitions - *---------------------------------------------------------------------------*/ -#define CDID_UNUSED 0 /* cdid is invalid and unused */ -#define CDID_MAX 99999 /* highest valid cdid, wraparound to 1 */ - -/*---------------------------------------------------------------------------* - * The shorthold algorithm to use - *---------------------------------------------------------------------------*/ -#define SHA_FIXU 0 /* timeout algorithm for fix unit charging */ -#define SHA_VARU 1 /* timeout algorithm for variable unit charging */ - -/*---------------------------------------------------------------------------* - * The shorthold data struct - *---------------------------------------------------------------------------*/ -typedef struct { - int shorthold_algorithm; /* shorthold algorithm to use */ - int unitlen_time; /* length of a charging unit */ - int idle_time; /* time without activity on b ch*/ - int earlyhup_time; /* safety area at end of unit */ -} msg_shorthold_t; - - -/**************************************************************************** - - outgoing call: - -------------- - - userland kernel - -------- ------ - - CDID_REQ -----------------> - - <------------------ cdid - - CONNECT_REQ --------------> - - <------------------ PROCEEDING_IND (if connect req ok) - - <------------------ CONNECT_ACTIVE_IND (if connection ok) - - or - - <------------------ DISCONNECT_IND (if connection failed) - - - - incoming call: - -------------- - - userland kernel - -------- ------ - - <------------------ CONNECT_IND - - CONNECT_RESP -------------> - - <------------------ CONNECT_ACTIVE_IND (if accepted) - - - - active disconnect: - ------------------ - - userland kernel - -------- ------ - - DISCONNECT_REQ ------------> - - <------------------ DISCONNECT_IND - - - passive disconnect: - ------------------- - - userland kernel - -------- ------ - - <------------------ DISCONNECT_IND - - -****************************************************************************/ - - -/*===========================================================================* - *===========================================================================* - * "read" messages from kernel -> userland - *===========================================================================* - *===========================================================================*/ - - -/*---------------------------------------------------------------------------* - * message header, included in every message - *---------------------------------------------------------------------------*/ -typedef struct { - char type; /* message identifier */ -#define MSG_CONNECT_IND 'a' -#define MSG_CONNECT_ACTIVE_IND 'b' -#define MSG_DISCONNECT_IND 'c' -#define MSG_DIALOUT_IND 'd' -#define MSG_IDLE_TIMEOUT_IND 'e' -#define MSG_ACCT_IND 'f' -#define MSG_CHARGING_IND 'g' -#define MSG_PROCEEDING_IND 'h' -#define MSG_ALERT_IND 'i' -#define MSG_DRVRDISC_REQ 'j' -#define MSG_L12STAT_IND 'k' -#define MSG_TEIASG_IND 'l' -#define MSG_PDEACT_IND 'm' -#define MSG_NEGCOMP_IND 'n' -#define MSG_IFSTATE_CHANGED_IND 'o' -#define MSG_DIALOUTNUMBER_IND 'p' -#define MSG_PACKET_IND 'q' -#define MSG_KEYPAD_IND 'r' - int cdid; /* call descriptor id */ -} msg_hdr_t; - -/*---------------------------------------------------------------------------* - * connect indication - * indicates incoming connection - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller number */ - int channel; /* channel number */ -#define CHAN_B1 0 /* this _must_ be 0, HSCX B1 is also 0 */ -#define CHAN_B2 1 /* this _must_ be 1, HSCX B2 is also 1 */ -#define CHAN_ANY (-1) /* outgoing, not possible for incoming */ -#define CHAN_NO (-2) /* call waiting (CW) for incoming */ - int bprot; /* b channel protocot, see BPROT_XXX */ - int bcap; /* special bearer capability, see BCAP_XXX */ - char dst_telno[TELNO_MAX]; /* destination telno */ - char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */ - char src_telno[TELNO_MAX]; /* source telno */ - char src_subaddr[SUBADDR_MAX]; /* src subaddr */ - int dst_ton; /* dest. type of number */ - int src_ton; /* src. type of number */ -#define TON_OTHER 0 /* other type of number */ -#define TON_INTERNAT 1 /* international number */ -#define TON_NATIONAL 2 /* national number */ - int scr_ind;/* screening indicator */ -#define SCR_NONE 0 /* no screening indicator transmitted */ -#define SCR_USR_NOSC 1 /* screening user provided, not screened*/ -#define SCR_USR_PASS 2 /* screening user provided, verified & passed */ -#define SCR_USR_FAIL 3 /* screening user provided, verified & failed */ -#define SCR_NET 4 /* screening network provided */ - int prs_ind;/* presentation indicator */ -#define PRS_NONE 0 /* no presentation indicator transmitted*/ -#define PRS_ALLOWED 1 /* presentation allowed */ -#define PRS_RESTRICT 2 /* presentation restricted */ -#define PRS_NNINTERW 3 /* number not available due to interworking */ -#define PRS_RESERVED 4 /* reserved */ - char display[DISPLAY_MAX]; /* content of display IE*/ -} msg_connect_ind_t; - -/*---------------------------------------------------------------------------* - * connect active indication - * indicates active connection - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller number actually used */ - int channel; /* channel number actually used */ - char datetime[DATETIME_MAX]; /* content of date/time IE */ -} msg_connect_active_ind_t; - -/*---------------------------------------------------------------------------* - * disconnect indication - * indicates a disconnect - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - cause_t cause; /* cause code */ -} msg_disconnect_ind_t; - -/*---------------------------------------------------------------------------* - * negotiation complete - * indicates an interface is completely up & running - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ -} msg_negcomplete_ind_t; - -/*---------------------------------------------------------------------------* - * interface changes internal state - * indicates an interface has somehow switched its FSM - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int state; /* new interface state */ -} msg_ifstatechg_ind_t; - -/*---------------------------------------------------------------------------* - * initiate a call to a remote site - * i.e. the IP driver got a packet and wants a connection - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int driver; /* driver type */ - int driver_unit; /* driver unit number */ -} msg_dialout_ind_t; - -/*---------------------------------------------------------------------------* - * dial a number - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int driver; /* driver type */ - int driver_unit; /* driver unit number */ - int cmdlen; /* length of string */ - int subaddrlen; /* length of subaddr */ - char cmd[TELNO_MAX]; /* the number to dial */ - char subaddr[SUBADDR_MAX]; /* dest subaddr */ -} msg_dialoutnumber_ind_t; - -/*---------------------------------------------------------------------------* - * send keypad string - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int driver; /* driver type */ - int driver_unit; /* driver unit number */ - int cmdlen; /* length of string */ - char cmd[KEYPAD_MAX];/* keypad string */ -} msg_keypad_ind_t; - -/*---------------------------------------------------------------------------* - * idle timeout disconnect sent indication - * kernel has sent disconnect request because of b-ch idle - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ -} msg_idle_timeout_ind_t; - -/*---------------------------------------------------------------------------* - * accounting information from userland interface driver to daemon - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int accttype; /* accounting type */ -#define ACCT_DURING 0 -#define ACCT_FINAL 1 - int driver; /* driver type */ - int driver_unit; /* driver unit number */ - int ioutbytes; /* ISDN # of bytes sent */ - int iinbytes; /* ISDN # of bytes received */ - int outbps; /* bytes per sec out */ - int inbps; /* bytes per sec in */ - int outbytes; /* driver # of bytes sent */ - int inbytes; /* driver # of bytes received */ -} msg_accounting_ind_t; - -/*---------------------------------------------------------------------------* - * charging information from isdn driver to daemon - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int units; /* number of units */ - int units_type; /* type of units info */ -#define CHARGE_INVALID 0 /* invalid, unknown */ -#define CHARGE_AOCD 1 /* advice of charge during call */ -#define CHARGE_AOCE 2 /* advice of charge at end of call */ -#define CHARGE_CALC 3 /* locally calculated from rates information */ -} msg_charging_ind_t; - -/*---------------------------------------------------------------------------* - * call proceeding indication - * indicates outgoing SETUP has been acknowleged - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller number actually used */ - int channel; /* channel number actually used */ -} msg_proceeding_ind_t; - -/*---------------------------------------------------------------------------* - * alert indication - * indicates remote user side "rings" - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ -} msg_alert_ind_t; - -/*---------------------------------------------------------------------------* - * driver requests to disconnect line - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int driver; /* driver type */ - int driver_unit; /* driver unit number */ -} msg_drvrdisc_req_t; - -/*---------------------------------------------------------------------------* - * connect packet logging - *---------------------------------------------------------------------------*/ - -typedef struct { - msg_hdr_t header; /* common header */ - int driver; /* driver type */ - int driver_unit; /* driver unit number */ - int direction; /* 0=in 1=out */ -#define DIRECTION_IN 0 /* sending packet to remote */ -#define DIRECTION_OUT 1 /* received packet from remote */ -#define MAX_PACKET_LOG 40 /* space for IP and TCP header */ - u_int8_t pktdata[MAX_PACKET_LOG]; -} msg_packet_ind_t; - -/*---------------------------------------------------------------------------* - * state of layer 1/2 - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller unit */ - int layer; /* layer number (1/2) */ -#define LAYER_ONE 1 -#define LAYER_TWO 2 - int state; /* state info */ -#define LAYER_IDLE 0 -#define LAYER_ACTIVE 1 -} msg_l12stat_ind_t; - -/*---------------------------------------------------------------------------* - * TEI assignment messages - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller unit */ - int tei; /* TEI or -1 if invalid */ -} msg_teiasg_ind_t; - -/*---------------------------------------------------------------------------* - * persistent deactivation state of stack - *---------------------------------------------------------------------------*/ -typedef struct { - msg_hdr_t header; /* common header */ - int controller; /* controller unit */ - int numactive; /* number of active connections */ -} msg_pdeact_ind_t; - - -/*===========================================================================* - *===========================================================================* - * "ioctl" messages from userland -> kernel - *===========================================================================* - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * request a unique cdid (to setup an outgoing call) - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ -} msg_cdid_req_t; - -#define I4B_CDID_REQ _IOWR('4', 0, int) - -/*---------------------------------------------------------------------------* - * connect request - * requests an outgoing connection - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ - int controller; /* controller to use */ - int channel; /* channel to use */ - int txdelay; /* tx delay after connect */ - int bprot; /* b channel protocol */ - int bcap; /* special bearer capability */ - int driver; /* driver to route b channel data to */ - int driver_unit; /* unit number for above driver */ - msg_shorthold_t shorthold_data; /* the shorthold data */ - int unitlen_method; /* how to calculate the unitlength */ -#define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */ -#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */ - char dst_telno[TELNO_MAX]; /* destination telephone no */ - char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */ - char src_telno[TELNO_MAX]; /* source telephone number */ - char src_subaddr[SUBADDR_MAX]; /* source subaddr */ - char keypad[KEYPAD_MAX]; /* keypad string */ -} msg_connect_req_t; - -#define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t) - -/*---------------------------------------------------------------------------* - * connect response - * this is the answer to an incoming connect indication - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ - int response; /* what to do with incoming call */ -#define SETUP_RESP_DNTCRE 0 /* dont care, call is not for me */ -#define SETUP_RESP_REJECT 1 /* reject call */ -#define SETUP_RESP_ACCEPT 2 /* accept call */ - cause_t cause; /* cause for case SETUP_RESP_REJECT */ - /* the following are only used for SETUP_RESP_ACCEPT !! */ - int txdelay; /* tx delay after connect */ - int bprot; /* B chan protocol */ - int bcap; /* special bearer capability */ - int driver; /* driver to route b channel data to */ - int driver_unit; /* unit number for above driver */ - int max_idle_time; /* max time without activity on b ch */ -} msg_connect_resp_t; - -#define I4B_CONNECT_RESP _IOW('4', 2, msg_connect_resp_t) - -/*---------------------------------------------------------------------------* - * disconnect request - * active disconnect request - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ - cause_t cause; /* protocol independent cause */ -} msg_discon_req_t; - -#define I4B_DISCONNECT_REQ _IOW('4', 3, msg_discon_req_t) - -/*---------------------------------------------------------------------------* - * controller info request - *---------------------------------------------------------------------------*/ -typedef struct { - int controller; /* controller number */ - int ncontroller; /* number of controllers in system */ - int ctrl_type; /* controller type passive/active */ - int card_type; /* brand / version */ - int tei; /* tei controller probably has */ - int nbch; /* number of b channels provided */ -} msg_ctrl_info_req_t; - -#define I4B_CTRL_INFO_REQ _IOWR('4', 4, msg_ctrl_info_req_t) - -/*---------------------------------------------------------------------------* - * dialout response - * status report to driver who requested a dialout - *---------------------------------------------------------------------------*/ -typedef struct { - int driver; /* driver to route b channel data to */ - int driver_unit; /* unit number for above driver */ - int stat; /* state of dialout request */ -#define DSTAT_NONE 0 -#define DSTAT_TFAIL 1 /* transient failure */ -#define DSTAT_PFAIL 2 /* permanent failure */ -#define DSTAT_INONLY 3 /* no outgoing dials allowed */ - cause_t cause; /* exact i4b cause */ -} msg_dialout_resp_t; - -#define I4B_DIALOUT_RESP _IOW('4', 5, msg_dialout_resp_t) - -/*---------------------------------------------------------------------------* - * timeout value update - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ - msg_shorthold_t shorthold_data; -} msg_timeout_upd_t; - -#define I4B_TIMEOUT_UPD _IOW('4', 6, msg_timeout_upd_t) - -/*---------------------------------------------------------------------------* - * soft enable/disable - *---------------------------------------------------------------------------*/ -typedef struct { - int driver; /* driver to route b channel data to */ - int driver_unit; /* unit number for above driver */ - int updown; /* what to do */ -#define SOFT_ENA 0 /* enable interface */ -#define SOFT_DIS 1 /* disable interface */ -} msg_updown_ind_t; - -#define I4B_UPDOWN_IND _IOW('4', 7, msg_updown_ind_t) - -/*---------------------------------------------------------------------------* - * send alert request - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call descriptor id */ -} msg_alert_req_t; - -#define I4B_ALERT_REQ _IOW('4', 8, msg_alert_req_t) - -/*---------------------------------------------------------------------------* - * request version and release info from kernel part - * (msg_vr_req_t is also used by tel & rbch drivers) - *---------------------------------------------------------------------------*/ -typedef struct { - int version; /* version number */ - int release; /* release number */ - int step; /* release step number */ -} msg_vr_req_t; - -#define I4B_VR_REQ _IOR('4', 9, msg_vr_req_t) - -/*---------------------------------------------------------------------------* - * set ISDN protocol used by a controller - *---------------------------------------------------------------------------*/ -typedef struct { - int controller; /* controller number */ - int protocol; /* ISDN D-channel protocol type */ -} msg_prot_ind_t; - -#define I4B_PROT_IND _IOW('4', 10, msg_prot_ind_t) - -/*---------------------------------------------------------------------------* - * Protocol download to active cards - *---------------------------------------------------------------------------*/ -struct isdn_dr_prot { - size_t bytecount; /* length of code */ - u_int8_t *microcode; /* pointer to microcode */ -}; - -struct isdn_download_request { - int controller; /* controller number */ - int numprotos; /* number of protocols in 'protocols' */ - struct isdn_dr_prot *protocols; -}; - -#define I4B_CTRL_DOWNLOAD _IOW('4', 100, struct isdn_download_request) - -/*---------------------------------------------------------------------------* - * Generic diagnostic interface for active cards - *---------------------------------------------------------------------------*/ -struct isdn_diagnostic_request { - int controller; /* controller number */ - u_int32_t cmd; /* diagnostic command to execute */ - size_t in_param_len; /* length of additional input parameter */ -#define I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN 65536 - void *in_param; /* optional input parameter */ - size_t out_param_len; /* available output space */ - void *out_param; /* output data goes here */ -}; - -#define I4B_ACTIVE_DIAGNOSTIC _IOW('4', 102, struct isdn_diagnostic_request) - -#endif /* _I4B_IOCTL_H_ */ diff --git a/sys/i4b/include/i4b_isdnq931.h b/sys/i4b/include/i4b_isdnq931.h deleted file mode 100644 index e5a8a2d143e9..000000000000 --- a/sys/i4b/include/i4b_isdnq931.h +++ /dev/null @@ -1,167 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_isdnq931.h - DSS1 layer 3 message types - * ------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 9 15:53:49 2002] - * - *---------------------------------------------------------------------------*/ - -/* protocol discriminators */ - -#define PD_Q931 0x08 /* Q.931/I.451 */ - -/* Q.931 single octett information element identifiers */ - -#define IEI_SENDCOMPL 0xa1 /* sending complete */ - -/* Q.931 variable length information element identifiers */ - -#define IEI_SEGMMSG 0x00 /* segmented message */ -#define IEI_BEARERCAP 0x04 /* bearer capabilities */ -#define IEI_CAUSE 0x08 /* cause */ -#define IEI_CALLID 0x10 /* call identity */ -#define IEI_CALLSTATE 0x14 /* call state */ -#define IEI_CHANNELID 0x18 /* channel identification */ -#define IEI_PROGRESSI 0x1e /* progress indicator */ -#define IEI_NETSPCFAC 0x20 /* network specific facilities */ -#define IEI_NOTIFIND 0x27 /* notification indicator */ -#define IEI_DISPLAY 0x28 /* display */ -#define IEI_DATETIME 0x29 /* date/time */ -#define IEI_KEYPAD 0x2c /* keypad facility */ -#define IEI_SIGNAL 0x34 /* signal */ -#define IEI_INFRATE 0x40 /* information rate */ -#define IEI_ETETDEL 0x42 /* end to end transit delay */ -#define IEI_TDELSELIND 0x43 /* transit delay selection and indication */ -#define IEI_PLBPARMS 0x44 /* packet layer binary parameters */ -#define IEI_PLWSIZE 0x45 /* packet layer window size */ -#define IEI_PSIZE 0x46 /* packet size */ -#define IEI_CUG 0x47 /* closed user group */ -#define IEI_REVCHRGI 0x4a /* reverse charge indication */ -#define IEI_CALLINGPN 0x6c /* calling party number */ -#define IEI_CALLINGPS 0x6d /* calling party subaddress */ -#define IEI_CALLEDPN 0x70 /* called party number */ -#define IEI_CALLEDPS 0x71 /* called party subaddress */ -#define IEI_REDIRNO 0x74 /* redirecting number */ -#define IEI_TRNSEL 0x78 /* transit network selection */ -#define IEI_RESTARTI 0x79 /* restart indicator */ -#define IEI_LLCOMPAT 0x7c /* low layer compatibility */ -#define IEI_HLCOMPAT 0x7d /* high layer compatibility */ -#define IEI_USERUSER 0x7e /* user-user */ -#define IEI_ESCAPE 0x7f /* escape for extension */ - -/* Q.932 variable length information element identifiers */ - -#define IEI_EXTFAC 0x0d /* extended facility */ -#define IEI_FACILITY 0x1c /* facility */ -#define IEI_INFOREQ 0x32 /* information request */ -#define IEI_FEATACT 0x38 /* feature activation */ -#define IEI_FEATIND 0x39 /* feature indication */ -#define IEI_SERVPID 0x3a /* service profile identification */ -#define IEI_ENDPTID 0x3b /* endpoint identifier */ - -/* Q.933 variable length information element identifiers */ - -#define IEI_DATALCID 0x19 /* data link connection identifier */ -#define IEI_LLCOREP 0x48 /* link layer core parameters */ -#define IEI_LLPROTP 0x49 /* link layer protocol parameters */ -#define IEI_X213PRI 0x50 /* X.213 priority */ -#define IEI_REPORTT 0x51 /* report type */ -#define IEI_LNKITYVERF 0x53 /* link integrity verification */ -#define IEI_PVCSTAT 0x57 /* PVC status */ - -/* Q.95x variable length information element identifiers */ - -#define IEI_PRECLEV 0x41 /* precedence level */ -#define IEI_CONCTDNO 0x4c /* connected number */ -#define IEI_CONCTDSA 0x4d /* connected subaddress */ -#define IEI_REDICNNO 0x76 /* redirection number */ - -/* single octett information elements */ - -#define SOIE_SHIFT 0x90 /* shift codeset */ -#define SHIFT_LOCK 0x08 /* shift codeset, locking shift bit */ -#define SOIE_MDSC 0xa0 /* more data AND/OR sending complete */ -#define SOIE_SENDC 0xa1 /* sending complete */ -#define SOIE_CONGL 0xb0 /* congestion level */ -#define SOIE_REPTI 0xd0 /* repeat indicator */ - -/* codesets */ - -#define CODESET_0 0 /* codeset 0, normal DSS1 codeset */ - -/* Q.931/Q.932 message types (see Q.931 03/93 p10 and p311) */ - -/* call establishment messages */ - -#define ALERT 0x01 -#define CALL_PROCEEDING 0x02 -#define PROGRESS 0x03 -#define SETUP 0x05 -#define CONNECT 0x07 -#define SETUP_ACKNOWLEDGE 0x0d -#define CONNECT_ACKNOWLEDGE 0x0f - -/* call information phase messages */ - -#define USER_INFORMATION 0x20 -#define SUSPEND_REJECT 0x21 -#define RESUME_REJECT 0x22 -#define HOLD 0x24 -#define SUSPEND 0x25 -#define RESUME 0x26 -#define HOLD_ACKNOWLEDGE 0x28 -#define SUSPEND_ACKNOWLEDGE 0x2d -#define RESUME_ACKNOWLEDGE 0x2e -#define HOLD_REJECT 0x30 -#define RETRIEVE 0x31 -#define RETRIEVE_ACKNOWLEDGE 0x32 -#define RETRIEVE_REJECT 0x37 - -/* call clearing */ - -#define DISCONNECT 0x45 -#define RESTART 0x46 -#define RELEASE 0x4d -#define RESTART_ACKNOWLEDGE 0x4e -#define RELEASE_COMPLETE 0x5a - -/* misc messages */ - -#define SEGMENT 0x60 -#define FACILITY 0x62 -#define REGISTER 0x64 -#define NOTIFY 0x6e -#define STATUS_ENQUIRY 0x75 -#define CONGESTION_CONTROL 0x79 -#define INFORMATION 0x7b -#define STATUS 0x7d - -/* EOF */ diff --git a/sys/i4b/include/i4b_l1l2.h b/sys/i4b/include/i4b_l1l2.h deleted file mode 100644 index b804ea7ecc98..000000000000 --- a/sys/i4b/include/i4b_l1l2.h +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l1l2.h - i4b layer 1 / layer 2 interactions - * --------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 9 15:54:49 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L1L2_H_ -#define _I4B_L1L2_H_ - -#include - -extern struct i4b_l1l2_func i4b_l1l2_func; - -struct i4b_l1l2_func -{ - /* Layer 1 --> Layer 2 */ - /* =================== */ - - int (*PH_DATA_IND) (int, struct mbuf *); - int (*PH_ACTIVATE_IND) (int); - int (*PH_DEACTIVATE_IND) (int); - -#define PH_Data_Ind(unit, data) \ - ((*i4b_l1l2_func.PH_DATA_IND)(unit, data)) -#define PH_Act_Ind(unit) \ - ((*i4b_l1l2_func.PH_ACTIVATE_IND)(unit)) -#define PH_Deact_Ind(unit) \ - ((*i4b_l1l2_func.PH_DEACTIVATE_IND)(unit)) - - - /* Layer 2 --> Layer 1 */ - /* =================== */ - - int (*PH_DATA_REQ) (int, struct mbuf *, int); - int (*PH_ACTIVATE_REQ) (int); - -#define PH_Data_Req(unit, data, freeflag) \ - ((*i4b_l1l2_func.PH_DATA_REQ)(unit, data, freeflag)) -#define PH_Act_Req(unit) \ - ((*i4b_l1l2_func.PH_ACTIVATE_REQ)(unit)) - - /* Layer 1 --> upstream, ISDN trace data */ - /* ===================================== */ - int (*MPH_TRACE_IND) (i4b_trace_hdr_t *, int, unsigned char *); - -#define MPH_Trace_Ind(header, length, pointer) \ - ((*i4b_l1l2_func.MPH_TRACE_IND)(header, length, pointer)) - - /* L1/L2 management command and status information */ - /* =============================================== */ - int (*MPH_STATUS_IND) (int, int, int); - int (*MPH_COMMAND_REQ) (int, int, void *); - -#define MPH_Status_Ind(unit, status, parm) \ - ((*i4b_l1l2_func.MPH_STATUS_IND)(unit, status, parm)) -#define MPH_Command_Req(unit, command, parm) \ - ((*i4b_l1l2_func.MPH_COMMAND_REQ)(unit, command, parm)) -}; - -#endif /* _I4B_L1L2_H_ */ diff --git a/sys/i4b/include/i4b_l2l3.h b/sys/i4b/include/i4b_l2l3.h deleted file mode 100644 index e866073f9ac5..000000000000 --- a/sys/i4b/include/i4b_l2l3.h +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l2l3.h - i4b layer 2 / layer 3 interactions - * ----------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 9 15:55:16 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L2L3_H_ -#define _I4B_L2L3_H_ - -extern struct i4b_l2l3_func i4b_l2l3_func; - -struct i4b_l2l3_func -{ - /* Layer 2 --> Layer 3 */ - /* =================== */ - - int (*DL_ESTABLISH_IND) (int); - int (*DL_ESTABLISH_CNF) (int); - - int (*DL_RELEASE_IND) (int); - int (*DL_RELEASE_CNF) (int); - - int (*DL_DATA_IND) (int, struct mbuf *); - - int (*DL_UNIT_DATA_IND) (int, struct mbuf *); - -#define DL_Est_Ind(unit) \ - ((*i4b_l2l3_func.DL_ESTABLISH_IND)(unit)) -#define DL_Est_Cnf(unit) \ - ((*i4b_l2l3_func.DL_ESTABLISH_CNF)(unit)) -#define DL_Rel_Ind(unit) \ - ((*i4b_l2l3_func.DL_RELEASE_IND)(unit)) -#define DL_Rel_Cnf(unit) \ - ((*i4b_l2l3_func.DL_RELEASE_CNF)(unit)) -#define DL_Data_Ind(unit, data) \ - ((*i4b_l2l3_func.DL_DATA_IND)(unit, data)) -#define DL_Unit_Data_Ind(unit, data) \ - ((*i4b_l2l3_func.DL_UNIT_DATA_IND)(unit, data)) - -#define DL_Est_Ind_A \ - (i4b_l2l3_func.DL_ESTABLISH_IND) -#define DL_Est_Cnf_A \ - (i4b_l2l3_func.DL_ESTABLISH_CNF) -#define DL_Rel_Ind_A \ - (i4b_l2l3_func.DL_RELEASE_IND) -#define DL_Rel_Cnf_A \ - (i4b_l2l3_func.DL_RELEASE_CNF) - - /* Layer 3 --> Layer 2 */ - /* =================== */ - - int (*DL_ESTABLISH_REQ) (int); - - int (*DL_RELEASE_REQ) (int); - - int (*DL_DATA_REQ) (int, struct mbuf *); - - int (*DL_UNIT_DATA_REQ) (int, struct mbuf *); - -#define DL_Est_Req(unit) \ - ((*i4b_l2l3_func.DL_ESTABLISH_REQ)(unit)) -#define DL_Rel_Req(unit) \ - ((*i4b_l2l3_func.DL_RELEASE_REQ)(unit)) -#define DL_Data_Req(unit, data) \ - ((*i4b_l2l3_func.DL_DATA_REQ)(unit, data)) -#define DL_Unit_Data_Req(unit, data) \ - ((*i4b_l2l3_func.DL_UNIT_DATA_REQ)(unit, data)) - - /* Layer 2 --> Layer 3 management */ - /* ============================== */ - - int (*MDL_STATUS_IND) (int, int, int); /* L2 --> L3 status */ - -#define MDL_Status_Ind(unit, status, parm) \ - ((*i4b_l2l3_func.MDL_STATUS_IND)(unit, status, parm)) - - /* Layer 3 --> Layer 2 management */ - /* ============================== */ - - int (*MDL_COMMAND_REQ) (int, int, void *); /* L3 --> L2 command */ - -#define MDL_Command_Req(unit, command, parm) \ - ((*i4b_l2l3_func.MDL_COMMAND_REQ)(unit, command, parm)) -}; - -#endif /* _I4B_L2L3_H_ */ diff --git a/sys/i4b/include/i4b_l3l4.h b/sys/i4b/include/i4b_l3l4.h deleted file mode 100644 index 08a7c5dc0f5c..000000000000 --- a/sys/i4b/include/i4b_l3l4.h +++ /dev/null @@ -1,274 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l3l4.h - layer 3 / layer 4 interface - * ------------------------------------------ - * - * $FreeBSD$ - * - * last edit-date: [Sun Aug 11 12:52:41 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L3L4_H_ -#define _I4B_L3L4_H_ - -#define T303VAL (hz*4) /* 4 seconds timeout */ -#define T305VAL (hz*30) /* 30 seconds timeout */ -#define T308VAL (hz*4) /* 4 seconds timeout */ -#define T309VAL (hz*90) /* 90 seconds timeout */ -#define T310VAL (hz*60) /* 30-120 seconds timeout */ -#define T313VAL (hz*4) /* 4 seconds timeout */ -#define T400DEF (hz*10) /* 10 seconds timeout */ - -#define MAX_BCHAN 30 -#define N_CALL_DESC (MAX_CONTROLLERS*MAX_BCHAN) /* no of call descriptors */ - -extern int nctrl; /* number of controllers detected in system */ - -typedef struct bchan_statistics { - int outbytes; - int inbytes; -} bchan_statistics_t; - -/*---------------------------------------------------------------------------* - * table of things the driver needs to know about the b channel - * it is connected to for data transfer - *---------------------------------------------------------------------------*/ -typedef struct i4l_isdn_bchan_linktab { - int unit; - int channel; - void (*bch_config)(int unit, int channel, int bprot, int updown); - void (*bch_tx_start)(int unit, int channel); - void (*bch_stat)(int unit, int channel, bchan_statistics_t *bsp); - struct ifqueue *tx_queue; - struct ifqueue *rx_queue; /* data xfer for NON-HDLC traffic */ - struct mbuf **rx_mbuf; /* data xfer for HDLC based traffic */ -} isdn_link_t; - -/*---------------------------------------------------------------------------* - * table of things the b channel handler needs to know about - * the driver it is connected to for data transfer - *---------------------------------------------------------------------------*/ -typedef struct i4l_driver_bchan_linktab { - int unit; - void (*bch_rx_data_ready)(int unit); - void (*bch_tx_queue_empty)(int unit); - void (*bch_activity)(int unit, int rxtx); -#define ACT_RX 0 -#define ACT_TX 1 - void (*line_connected)(int unit, void *cde); - void (*line_disconnected)(int unit, void *cde); - void (*dial_response)(int unit, int stat, cause_t cause); - void (*updown_ind)(int unit, int updown); -} drvr_link_t; - -/* global linktab functions for controller types (aka hardware drivers) */ -struct ctrl_type_desc { - isdn_link_t* (*get_linktab)(int unit, int channel); - void (*set_linktab)(int unit, int channel, drvr_link_t *dlt); -}; -extern struct ctrl_type_desc ctrl_types[]; - -/* global linktab functions for RBCH userland driver */ - -drvr_link_t *rbch_ret_linktab(int unit); -void rbch_set_linktab(int unit, isdn_link_t *ilt); - -/* global linktab functions for IPR network driver */ - -drvr_link_t *ipr_ret_linktab(int unit); -void ipr_set_linktab(int unit, isdn_link_t *ilt); - -/* global linktab functions for TEL userland driver */ - -drvr_link_t *tel_ret_linktab(int unit); -void tel_set_linktab(int unit, isdn_link_t *ilt); - -/* global linktab functions for ISPPP userland driver */ - -drvr_link_t *i4bisppp_ret_linktab(int unit); -void i4bisppp_set_linktab(int unit, isdn_link_t *ilt); - -/* global linktab functions for ING network driver */ - -drvr_link_t *ing_ret_linktab(int unit); -void ing_set_linktab(int unit, isdn_link_t *ilt); - - -/*---------------------------------------------------------------------------* - * this structure describes one call/connection on one B-channel - * and all its parameters - *---------------------------------------------------------------------------*/ -typedef struct -{ - u_int cdid; /* call descriptor id */ - int controller; /* isdn controller number */ - int cr; /* call reference value */ - - int crflag; /* call reference flag */ -#define CRF_ORIG 0 /* originating side */ -#define CRF_DEST 1 /* destinating side */ - - int channelid; /* channel id value */ - int channelexcl; /* channel exclusive */ - - int bprot; /* B channel protocol BPROT_XXX */ - - int bcap; /* special bearer capabilities BCAP_XXX */ - - int driver; /* driver to use for B channel */ - int driver_unit; /* unit for above driver number */ - - cause_t cause_in; /* cause value from NT */ - cause_t cause_out; /* cause value to NT */ - - int call_state; /* from incoming SETUP */ - - u_char dst_telno[TELNO_MAX]; /* destination number */ - u_char dst_subaddr[SUBADDR_MAX]; /* destination subaddr */ - u_char src_telno[TELNO_MAX]; /* source number */ - u_char src_subaddr[SUBADDR_MAX]; /* source subaddr */ - - int dst_ton; /* destination type of number */ - int src_ton; /* source type of number */ - - int scr_ind; /* screening ind for incoming call */ - int prs_ind; /* presentation ind for incoming call */ - - int Q931state; /* Q.931 state for call */ - int event; /* event to be processed */ - - int response; /* setup response type */ - - int T303; /* SETUP sent response timeout */ - int T303_first_to; /* first timeout flag */ - - int T305; /* DISC without PROG IND */ - - int T308; /* RELEASE sent response timeout*/ - int T308_first_to; /* first timeout flag */ - - int T309; /* data link disconnect timeout */ - - int T310; /* CALL PROC received */ - - int T313; /* CONNECT sent timeout */ - - int T400; /* L4 timeout */ - - isdn_link_t *ilt; /* isdn B channel linktab */ - drvr_link_t *dlt; /* driver linktab */ - - int dir; /* outgoing or incoming call */ -#define DIR_OUTGOING 0 -#define DIR_INCOMING 1 - - int timeout_active; /* idle timeout() active flag */ - - int callouts_inited; /* must init before use */ - struct callout_handle idle_timeout_handle; - struct callout_handle T303_callout; - struct callout_handle T305_callout; - struct callout_handle T308_callout; - struct callout_handle T309_callout; - struct callout_handle T310_callout; - struct callout_handle T313_callout; - struct callout_handle T400_callout; - - int idletime_state; /* wait for idle_time begin */ -#define IST_IDLE 0 /* shorthold mode disabled */ -#define IST_NONCHK 1 /* in non-checked window */ -#define IST_CHECK 2 /* in idle check window */ -#define IST_SAFE 3 /* in safety zone */ - - time_t idletimechk_start; /* check idletime window start */ - time_t connect_time; /* time connect was made */ - time_t last_active_time; /* last time with activity */ - - /* for incoming connections: */ - time_t max_idle_time; /* max time without activity */ - - /* for outgoing connections: */ - msg_shorthold_t shorthold_data; /* shorthold data to use */ - - int aocd_flag; /* AOCD used for unitlength calc*/ - time_t last_aocd_time; /* last time AOCD received */ - int units; /* number of AOCD charging units*/ - int units_type; /* units type: AOCD, AOCE */ - int cunits; /* calculated units */ - - int isdntxdelay; /* isdn tx delay after connect */ - - u_char display[DISPLAY_MAX]; /* display information element */ - char datetime[DATETIME_MAX]; /* date/time information element*/ - u_char keypad[KEYPAD_MAX]; /* keypad facility */ -} call_desc_t; - -extern call_desc_t call_desc[N_CALL_DESC]; - -/* forward decl. */ -struct isdn_diagnostic_request; -struct isdn_dr_prot; - -/*---------------------------------------------------------------------------* - * this structure "describes" one controller - *---------------------------------------------------------------------------*/ -typedef struct -{ - int unit; /* unit number of this contr. */ - int ctrl_type; /* controller type (CTRL_XXX) */ - int card_type; /* card manufacturer (CARD_XXX) */ - - int protocol; /* D-channel protocol type */ - - int dl_est; /* layer 2 established */ -#define DL_DOWN 0 -#define DL_UP 1 - - int nbch; /* number of b channels */ - int bch_state[MAX_BCHAN]; /* states of the b channels */ -#define BCH_ST_FREE 0 /* free to be used, idle */ -#define BCH_ST_RSVD 1 /* reserved, may become free or used */ -#define BCH_ST_USED 2 /* in use for data transfer */ - - int tei; /* current tei or -1 if invalid */ - - /* pointers to functions to be called from L4 */ - - void (*N_CONNECT_REQUEST) (unsigned int); - void (*N_CONNECT_RESPONSE) (unsigned int, int, int); - void (*N_DISCONNECT_REQUEST) (unsigned int, int); - void (*N_ALERT_REQUEST) (unsigned int); - int (*N_DOWNLOAD) (int unit, int numprotos, struct isdn_dr_prot *protocols); - int (*N_DIAGNOSTICS) (int unit, struct isdn_diagnostic_request*); - void (*N_MGMT_COMMAND) (int unit, int cmd, void *); -} ctrl_desc_t; - -extern ctrl_desc_t ctrl_desc[MAX_CONTROLLERS]; - -#endif /* _I4B_Q931_H_ */ diff --git a/sys/i4b/include/i4b_mbuf.h b/sys/i4b/include/i4b_mbuf.h deleted file mode 100644 index dbca59067daf..000000000000 --- a/sys/i4b/include/i4b_mbuf.h +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b - mbuf handling support routines - * -------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 9 15:58:11 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_MBUF_H_ -#define _I4B_MBUF_H_ - -/* layer 1 / layer 2 comunication: 3rd ph_data_req parameter */ -#define MBUF_DONTFREE 0 -#define MBUF_FREE 1 - -#define IF_QEMPTY(ifq) ((ifq)->ifq_len == 0) - -struct mbuf *i4b_Dgetmbuf( int ); -void i4b_Dfreembuf( struct mbuf *m ); -void i4b_Dcleanifq( struct ifqueue * ); - -struct mbuf *i4b_Bgetmbuf( int ); -void i4b_Bfreembuf( struct mbuf *m ); -void i4b_Bcleanifq( struct ifqueue * ); - -#endif /* _I4B_MBUF_H_ */ - -/* EOF */ diff --git a/sys/i4b/include/i4b_rbch_ioctl.h b/sys/i4b/include/i4b_rbch_ioctl.h deleted file mode 100644 index 334aa9dc9305..000000000000 --- a/sys/i4b/include/i4b_rbch_ioctl.h +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_rbch_ioctl.h raw B-channel driver interface ioctls - * ------------------------------------------------------ - * - * $FreeBSD$ - * - * last edit-date: [Sun Mar 17 10:10:25 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_RBCH_IOCTL_H_ -#define _I4B_RBCH_IOCTL_H_ - -/*---------------------------------------------------------------------------* - * instruct the rbch device to dial the given number - *---------------------------------------------------------------------------*/ - -typedef char telno_t[TELNO_MAX]; - -#define I4B_RBCH_DIALOUT _IOW('R', 1, telno_t) - -/*---------------------------------------------------------------------------* - * request version and release info from kernel part - *---------------------------------------------------------------------------*/ - -#define I4B_RBCH_VR_REQ _IOR('R', 2, msg_vr_req_t) - -#endif /* _I4B_RBCH_IOCTL_H_ */ diff --git a/sys/i4b/include/i4b_tel_ioctl.h b/sys/i4b/include/i4b_tel_ioctl.h deleted file mode 100644 index 47ffc7075f91..000000000000 --- a/sys/i4b/include/i4b_tel_ioctl.h +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_tel_ioctl.h telephony interface ioctls - * ------------------------------------------ - * - * $FreeBSD$ - * - * last edit-date: [Sun Mar 17 10:10:39 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_TEL_IOCTL_H_ -#define _I4B_TEL_IOCTL_H_ - -/*===========================================================================* - * /dev/i4btel devices (audio data) - *===========================================================================*/ - -/* supported audio format conversions */ - -#define CVT_NONE 0 /* no A-law/u-law conversion */ -#define CVT_ALAW2ULAW 1 /* ISDN line: A-law, user: u-law */ -#define CVT_ULAW2ALAW 2 /* ISDN line: u-law, user: A-law */ - -/*---------------------------------------------------------------------------* - * get / set audio format - *---------------------------------------------------------------------------*/ - -#define I4B_TEL_GETAUDIOFMT _IOR('A', 0, int) -#define I4B_TEL_SETAUDIOFMT _IOW('A', 1, int) -#define I4B_TEL_EMPTYINPUTQUEUE _IOW('A', 2, int) - -/*---------------------------------------------------------------------------* - * request version and release info from kernel part - *---------------------------------------------------------------------------*/ - -#define I4B_TEL_VR_REQ _IOR('A', 3, msg_vr_req_t) - -/*---------------------------------------------------------------------------* - * send tones out of the tel interface - *---------------------------------------------------------------------------*/ - -#define I4B_TEL_MAXTONES 32 - -struct i4b_tel_tones { - int frequency[I4B_TEL_MAXTONES]; - int duration[I4B_TEL_MAXTONES]; -}; - -#define I4B_TEL_TONES _IOR('A', 4, struct i4b_tel_tones) - -/*===========================================================================* - * /dev/i4bteld devices (dialer interface) - *===========================================================================*/ - -/* dialer commands */ - -#define CMD_DIAL 'D' /* dial the following number string */ -#define CMD_HUP 'H' /* hangup */ -#define CMD_KEYP 'K' /* send keypad string */ - -/* dialer responses */ - -#define RSP_CONN '0' /* connect */ -#define RSP_BUSY '1' /* busy */ -#define RSP_HUP '2' /* hangup */ -#define RSP_NOA '3' /* no answer */ - -#endif /* _I4B_TEL_IOCTL_H_ */ diff --git a/sys/i4b/include/i4b_trace.h b/sys/i4b/include/i4b_trace.h deleted file mode 100644 index fbd40afc2444..000000000000 --- a/sys/i4b/include/i4b_trace.h +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_trace.h - header file for trace data read device - * ---------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Mar 17 10:10:52 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_TRACE_H_ -#define _I4B_TRACE_H_ - -/*---------------------------------------------------------------------------* - * structure of the header at the beginning of every trace mbuf - *---------------------------------------------------------------------------*/ -typedef struct { - int length; /* length of the following mbuf */ - int unit; /* controller unit number */ - int type; /* type of channel */ -#define TRC_CH_I 0 /* Layer 1 INFO's */ -#define TRC_CH_D 1 /* D channel */ -#define TRC_CH_B1 2 /* B1 channel */ -#define TRC_CH_B2 3 /* B2 channel */ - int dir; /* direction */ -#define FROM_TE 0 /* user -> network */ -#define FROM_NT 1 /* network -> user */ - int trunc; /* # of truncated bytes (frame > MCLBYTES) */ - unsigned int count; /* frame count for this unit/type */ - struct timeval time; /* timestamp for this frame */ -} i4b_trace_hdr_t; - -#define INFO0 0 /* layer 1 */ -#define INFO1_8 1 -#define INFO1_10 2 -#define INFO2 3 -#define INFO3 4 -#define INFO4_8 5 -#define INFO4_10 6 - -/*---------------------------------------------------------------------------* - * ioctl via /dev/i4btrc device(s): - * get/set current trace flag settings - *---------------------------------------------------------------------------*/ - -#define I4B_TRC_SET _IOW('T', 0, int) /* set trace settings */ - -#define TRACE_OFF 0x00 /* tracing off */ -#define TRACE_I 0x01 /* trace L1 INFO's on */ -#define TRACE_D_TX 0x02 /* trace D channel on */ -#define TRACE_D_RX 0x04 /* trace D channel on */ -#define TRACE_B_TX 0x08 /* trace B channel on */ -#define TRACE_B_RX 0x10 /* trace B channel on */ - -typedef struct { - int rxunit; /* unit # for rx frames */ - int rxflags; /* d and/or b channel */ - int txunit; /* unit # for tx frames */ - int txflags; /* d and/or b channel */ -} i4b_trace_setupa_t; - -#define I4B_TRC_SETA _IOW('T', 1, i4b_trace_setupa_t) /* set analyze mode */ -#define I4B_TRC_RESETA _IOW('T', 2, int) /* reset analyze mode */ - -#endif /* _I4B_TRACE_H_ */ diff --git a/sys/i4b/layer1/i4b_hdlc.c b/sys/i4b/layer1/i4b_hdlc.c deleted file mode 100644 index 15c22b2f821c..000000000000 --- a/sys/i4b/layer1/i4b_hdlc.c +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_hdlc.c - software-HDLC constant tables - * ------------------------------------------ - * $Id: i4b_hdlc.h,v 1.5 2000/08/28 07:41:19 hm Exp $ - * last edit-date: [Wed Jul 19 09:41:13 2000] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include - -/*---------------------------------------------------------------------------* - * HDLC CRC table - * - * Usage: - * crc = (HDLC_FCS_TAB[(u_char)(crc ^ byte of data)] ^ (u_char)(crc >> 8)); - * - * For more information see RFC 1662 (p. 10) - *---------------------------------------------------------------------------*/ -const uint16_t HDLC_FCS_TAB[256] = { 0x0000, - 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, - 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, - 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, - 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, - 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, - 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, - 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, - 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, - 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, - 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, - 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, - 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, - 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, - 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, - 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, - 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, - 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, - 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, - 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, - 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, - 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, - 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, - 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, - 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, - 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, - 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, - 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, - 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, - 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, - 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, - 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, - 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 -}; - -/*---------------------------------------------------------------------------* - * HDLC bit table - * ============== - * - * bits[0..3]: A value which tells how many set bits there are at the - * beginning of the byte. - * - * bits[4..7]: Special bytes like 0x7e, 0x7d, 0xfd ... are flagged here - * NOTE: Special bytes also means 'abort' bytes (7 or more - * continuous set bits) - * - * bits[8..11]: A copy of bits[0..3] but only incremented by one. - * NOTE: 0x7e has value '8' instead of '0'. Internal reasons. - * - * bits[12..15]: A value which tells how many set bits there are at the - * end of the byte. - * NOTE: 0xff has both '8' incoming and '8' outgoing bits. - * - *---------------------------------------------------------------------------*/ -const uint16_t HDLC_BIT_TAB[256] = { 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0403, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0504, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0403, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0605, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0403, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0504, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0403, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0160, 0x0706, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0403, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0504, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0403, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0605, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0403, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0504, 0x0100, - 0x0201, 0x0100, 0x0302, 0x0100, 0x0201, 0x0100, 0x0403, 0x0100, - 0x0201, 0x0100, 0x0302, 0x01a0, 0x02a1, 0x0860, 0x0807, 0x1100, - 0x1201, 0x1100, 0x1302, 0x1100, 0x1201, 0x1100, 0x1403, 0x1100, - 0x1201, 0x1100, 0x1302, 0x1100, 0x1201, 0x1100, 0x1504, 0x1100, - 0x1201, 0x1100, 0x1302, 0x1100, 0x1201, 0x1100, 0x1403, 0x1100, - 0x1201, 0x1100, 0x1302, 0x1100, 0x1201, 0x1100, 0x1605, 0x1100, - 0x1201, 0x1100, 0x1302, 0x1100, 0x1201, 0x1100, 0x1403, 0x1100, - 0x1201, 0x1100, 0x1302, 0x1100, 0x1201, 0x1100, 0x1504, 0x1100, - 0x1201, 0x1100, 0x1302, 0x1100, 0x1201, 0x1100, 0x1403, 0x1100, - 0x1201, 0x1100, 0x1302, 0x1100, 0x1201, 0x1160, 0x1706, 0x2100, - 0x2201, 0x2100, 0x2302, 0x2100, 0x2201, 0x2100, 0x2403, 0x2100, - 0x2201, 0x2100, 0x2302, 0x2100, 0x2201, 0x2100, 0x2504, 0x2100, - 0x2201, 0x2100, 0x2302, 0x2100, 0x2201, 0x2100, 0x2403, 0x2100, - 0x2201, 0x2100, 0x2302, 0x2100, 0x2201, 0x2100, 0x2605, 0x3100, - 0x3201, 0x3100, 0x3302, 0x3100, 0x3201, 0x3100, 0x3403, 0x3100, - 0x3201, 0x3100, 0x3302, 0x3100, 0x3201, 0x3100, 0x3504, 0x4100, - 0x4201, 0x4100, 0x4302, 0x4100, 0x4201, 0x4100, 0x4403, 0x5100, - 0x5201, 0x5100, 0x5302, 0x6180, 0x6281, 0x7150, 0x8908 -}; diff --git a/sys/i4b/layer1/i4b_hdlc.h b/sys/i4b/layer1/i4b_hdlc.h deleted file mode 100644 index 83aaf35efc34..000000000000 --- a/sys/i4b/layer1/i4b_hdlc.h +++ /dev/null @@ -1,300 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_hdlc.h - software-HDLC header file - * -------------------------------------- - * - * $Id: i4b_hdlc.h,v 1.5 2000/08/28 07:41:19 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Wed Jul 19 09:41:13 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_HDLC_H_ -#define _I4B_HDLC_H_ - -extern const u_short HDLC_FCS_TAB[256]; -extern const u_short HDLC_BIT_TAB[256]; - -/*---------------------------------------------------------------------------* - * HDLC_DECODE - * =========== - * - * u_char: flag, blevel - * u_short: crc, ib, tmp, tmp2, len - * - * next: 'continue' or 'goto xxx' - * - * cfr: complete frame - * nfr: new frame - * NOTE: must setup 'len' and 'dst', so that 'dst' may be written - * at most 'len' times. - * - * rab: abort - * rdd: read data (read byte is stored in 'tmp2') - * rdo: overflow - * - * d: dummy - * - * NOTE: setting flag to '0' and len to '0' => recover from rdu - * NOTE: bits[8 .. ] of tmp2 may be used to store custom data/flags - * NOTE: these variables have to be 'suspended' / 'resumed' somehow: - * flag, blevel, crc, ib, tmp, len - * NOTE: zero is default value for all variables. - * NOTE: each time 'dst' is written, 'len' is decreased by one. - *---------------------------------------------------------------------------*/ - -#define HDLC_DECODE(dst, len, tmp, tmp2, blevel, ib, crc, flag, rddcmd, nfrcmd, \ - cfrcmd, rabcmd, rdocmd, nextcmd, d) \ - \ - rddcmd; \ - \ - ib += HDLC_BIT_TAB[(u_char)tmp2]; \ - \ - if ((u_char)ib >= 5) \ - { \ - if (ib & 0x20) /* de-stuff (msb) */ \ - { \ - if ((u_char)tmp2 == 0x7e) goto j0##d; \ - tmp2 += tmp2 & 0x7f; \ - blevel--; \ - \ - if ((ib += 0x100) & 0xc) tmp2 |= 1; /* */ \ - } \ - \ - ib &= ~0xe0; \ - \ - if ((u_char)ib == 6) /* flag seq (lsb) */ \ - { \ - j0##d: if (flag >= 2) \ - { \ - len += (4 - flag) & 3; /* remove CRC bytes */ \ - crc ^= 0xf0b8; \ - cfrcmd; \ - len = 0; \ - } \ - \ - flag = 1; \ - \ - blevel = (ib >> 8) & 0xf; \ - tmp = ((u_char)tmp2) >> blevel; \ - blevel = 8 - blevel; \ - \ - ib >>= 12; \ - \ - nextcmd; \ - } \ - if ((u_char)ib >= 7) /* abort (msb & lsb) */ \ - { \ - if (flag >= 2) \ - { \ - rabcmd; \ - len = 0; \ - } \ - \ - flag = 0; \ - \ - ib >>= 12; \ - \ - nextcmd; \ - } \ - if ((u_char)ib == 5) /* de-stuff (lsb) */ \ - { \ - tmp2 = (tmp2 | (tmp2 + 1)) & ~0x1; \ - blevel--; \ - } \ - if (blevel > 7) /* EO - bits */ \ - { \ - tmp |= (u_char)tmp2 >> (8 - (blevel &= 7)); \ - \ - ib >>= 12; \ - \ - nextcmd; \ - } \ - } \ - \ - tmp |= (u_char)tmp2 << blevel; \ - \ - if (!len--) \ - { \ - len++; \ - \ - if (!flag++) { flag--; goto j5##d;} /* hunt mode */ \ - \ - switch (flag) \ - { case 2: /* new frame */ \ - nfrcmd; \ - crc = -1; \ - if (!len--) { len++; flag++; goto j4##d; } \ - goto j3##d; \ - case 3: /* CRC (lsb's) */ \ - case 4: /* CRC (msb's) */ \ - goto j4##d; \ - case 5: /* RDO */ \ - rdocmd; \ - flag = 0; \ - break; \ - } \ - } \ - else \ - { \ - j3##d: dst = (u_char)tmp; \ - j4##d: crc = (HDLC_FCS_TAB[(u_char)(tmp ^ crc)] ^ (u_char)(crc >> 8)); \ - } \ - \ - j5##d: ib >>= 12; \ - tmp >>= 8; \ - -/*------ end of HDLC_DECODE -------------------------------------------------*/ - - -/*---------------------------------------------------------------------------* - * HDLC_ENCODE - * =========== - * - * u_char: flag, src - * u_short: tmp2, blevel, ib, crc, len - * u_int: tmp - * - * gfr: This is the place where you free the last [mbuf] chain, and get - * the next one. If a mbuf is available the code should setup 'len' - * and 'src' so that 'src' may be read 'len' times. If no mbuf is - * available leave 'len' and 'src' untouched. - * - * wrd: write data (output = (u_char)tmp) - * - * d: dummy - * - * NOTE: setting flag to '-2' and len to '0' => abort bytes will be sent - * NOTE: these variables have to be 'suspended' / 'resumed' somehow: - * flag, blevel, crc, ib, tmp, len - * NOTE: zero is default value for all variables. - * NOTE: each time 'src' is read, 'len' is decreased by one. - * NOTE: neither cmd's should exit through 'goto' or 'break' statements. - *---------------------------------------------------------------------------*/ - -#define HDLC_ENCODE(src, len, tmp, tmp2, blevel, ib, crc, flag, gfrcmd, wrdcmd, d) \ - \ - if (blevel >= 0x800) { blevel -= 0x800; goto j4##d; } \ - \ - if (!len--) \ - { \ - len++; \ - \ - switch(++flag) \ - { default: /* abort */ \ - tmp = blevel = 0; /* zero is default */ \ - tmp2 = 0xff; \ - goto j3##d; \ - case 1: /* 1st time FS */ \ - case 2: /* 2nd time FS */ \ - tmp2 = 0x7e; \ - goto j3##d; \ - case 3: \ - gfrcmd; /* get new frame */ \ - if (!len--) \ - { \ - len++; \ - flag--; /* don't proceed */ \ - tmp2 = 0x7e; \ - goto j3##d; /* final FS */ \ - } \ - else \ - { \ - crc = -1; \ - ib = 0; \ - goto j1##d; /* first byte */ \ - } \ - case 4: \ - crc ^= -1; \ - tmp2 = (u_char)crc; \ - goto j2##d; /* CRC (lsb's) */ \ - case 5: \ - tmp2 = (u_char)(crc >> 8); \ - flag = 1; \ - goto j2##d; /* CRC (msb's) */ \ - } \ - } \ - else \ - { j1##d : \ - tmp2 = (u_char)src; \ - crc =(HDLC_FCS_TAB[(u_char)(crc ^ tmp2)] ^ (u_char)(crc >> 8)); \ - j2##d: \ - \ - ib >>= 12; \ - ib += HDLC_BIT_TAB[(u_char)tmp2]; \ - \ - if ((u_char)ib >= 5) /* stuffing */ \ - { \ - blevel &= ~0xff; \ - \ - if (ib & 0xc0) /* bit stuff (msb) */ \ - { \ - tmp2 += tmp2 & (0xff * (ib & 0xc0)); \ - ib %= 0x5000; \ - blevel++; \ - } \ - \ - ib &= ~0xf0; \ - \ - if ((u_char)ib >= 5) /* bit stuff (lsb) */ \ - { \ - tmp2 += tmp2 & ~0x1f >> ((ib - (ib >> 8) + 1) \ - & 7); \ - blevel++; \ - \ - if ((u_char)ib >= 10) /* bit stuff (msb) */ \ - { \ - tmp2 += tmp2 & ~0x7ff >> ((ib - \ - (ib >> 8) + 1) & 7); \ - blevel++; \ - } \ - if (ib & 0x8000) /* bit walk */ \ - { \ - ib = ((u_char)ib % 5) << 12; \ - } \ - } \ - \ - tmp |= tmp2 << (u_char)(blevel >> 8); \ - blevel += (u_char)blevel << 8; \ - } \ - else /* no stuffing */ \ - { \ - j3##d:tmp |= tmp2 << (u_char)(blevel >> 8); \ - } \ - } \ - \ - j4##d: wrdcmd; \ - tmp >>= 8; \ - -/*------ end of HDLC_ENCODE -------------------------------------------------*/ - - -#endif /* _I4B_HDLC_H_ */ - diff --git a/sys/i4b/layer1/i4b_l1.h b/sys/i4b/layer1/i4b_l1.h deleted file mode 100644 index ac6a67162d2c..000000000000 --- a/sys/i4b/layer1/i4b_l1.h +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*---------------------------------------------------------------------------* - * - * i4b_l1.h - isdn4bsd layer 1 header file - * --------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Tue Jan 23 17:04:57 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L1_H_ -#define _I4B_L1_H_ - -#include - -#define SEC_DELAY 1000000 /* one second DELAY for DELAY*/ - -#define MAX_DFRAME_LEN 264 /* max length of a D frame */ - -#define min(a,b) ((a)<(b)?(a):(b)) - -/* L1DRVR_XXXX moved to i4b_ioctl.h */ - -#define L0DRVR(du) (((du) >> 8) & 0xff) -#define L0UNIT(du) ((du) & 0xff) - -#define L0DRVRUNIT(d, u) ( (((d) << 8) & 0xff00) | ((u) & 0xff)) - -#define L0ISICUNIT(u) ( (((L1DRVR_ISIC) << 8) & 0xff00) | ((u) & 0xff)) -#define L0IWICUNIT(u) ( (((L1DRVR_IWIC) << 8) & 0xff00) | ((u) & 0xff)) -#define L0IFPIUNIT(u) ( (((L1DRVR_IFPI) << 8) & 0xff00) | ((u) & 0xff)) -#define L0IHFCUNIT(u) ( (((L1DRVR_IHFC) << 8) & 0xff00) | ((u) & 0xff)) -#define L0IFPNPUNIT(u) ( (((L1DRVR_IFPNP) << 8) & 0xff00) | ((u) & 0xff)) -#define L0ICCHPUNIT(u) ( (((L1DRVR_ICCHP) << 8) & 0xff00) | ((u) & 0xff)) -#define L0ITJCUNIT(u) ( (((L1DRVR_ITJC) << 8) & 0xff00) | ((u) & 0xff)) -#define L0IFPI2UNIT(u) ( (((L1DRVR_IFPI2) << 8) & 0xff00) | ((u) & 0xff)) - -/* jump table for the multiplex functions */ -struct i4b_l1mux_func { - isdn_link_t * (*ret_linktab)(int, int); - void (*set_linktab)(int, int, drvr_link_t *); - int (*mph_command_req)(int, int, void *); - int (*ph_data_req)(int, struct mbuf *, int); - int (*ph_activate_req)(int); -}; - -int i4b_l1_ph_data_ind(int unit, struct mbuf *m); -int i4b_l1_ph_activate_ind(int unit); -int i4b_l1_ph_deactivate_ind(int unit); -int i4b_l1_mph_status_ind(int, int, int, struct i4b_l1mux_func *); - -isdn_link_t *i4b_l1_ret_linktab(int unit, int channel); -void i4b_l1_set_linktab(int unit, int channel, drvr_link_t *dlt); - -int i4b_l1_trace_ind(i4b_trace_hdr_t *, int, u_char *); - -/* i4b_l1lib.c */ - -int i4b_l1_bchan_tel_silence(unsigned char *data, int len); - -#endif /* _I4B_L1_H_ */ diff --git a/sys/i4b/layer1/i4b_l1dmux.c b/sys/i4b/layer1/i4b_l1dmux.c deleted file mode 100644 index 15f3783f1fbb..000000000000 --- a/sys/i4b/layer1/i4b_l1dmux.c +++ /dev/null @@ -1,421 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l1dmux.c - isdn4bsd layer 1 driver multiplexer - * -------------------------------------------------- - * last edit-date: [Wed Jan 10 16:43:24 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include - -#include -#include -#include - -#include - -#include -#include - -/* - * this code is nothing but a big dynamic switch to multiplex and demultiplex - * layer 1 hardware isdn drivers to a common layer 2. - * - * when a card is successfully attached at system boot time, the driver for - * this card calls the routine i4b_l1_mph_status_ind() with status = STI_ATTACH. - * - * This command is used to setup the tables for converting a "driver unit" and - * "driver type" pair (encoded in the calls from the hardware driver to the - * routines in this source file) to a "unit number" used in layer 2 and the - * layers above (up to and including the isdnd daemon) and for converting - * layer 2 units back to calling the appropriate driver and driver unit - * number. - * - * Example: in my setup, a Winbond (iwic) card is probed first and gets - * driver unit number 0, driver type 1 in layer 1. This becomes unit - * number 0 in layer 2 and up. The second card probed is a Teles card - * (isic) and gets driver unit number 0, driver type 0 in layer 1. This - * becomes unit number 1 in layer 1 and up. - * - * To add support for a new driver, add a new driver number to i4b_l1.h: - * currently we have L1DRVR_ISIC and L1DRVR_IWIC, so you would add - * L1DRVR_FOO. More you would want to add a L0FOOUNIT to encode unit - * numbers in your driver. You then have to add a l1foounittab[] and - * add an entry to the getl1tab() routine for your driver. The only - * thing left now is to write your driver with the support functions - * for this multiplexer ;-) - */ - -unsigned int i4b_l1_debug = L1_DEBUG_DEFAULT; - -static int l1isicunittab[MAXL1UNITS]; - -static int l1iwicunittab[MAXL1UNITS]; - -static int l1ifpiunittab[MAXL1UNITS]; - -static int l1ifpi2unittab[MAXL1UNITS]; - -static int l1ihfcunittab[MAXL1UNITS]; - -static int l1ifpnpunittab[MAXL1UNITS]; - -static int l1itjcunittab[MAXL1UNITS]; - -static int numl1units = 0; - -static int l1drvunittab[MAXL1UNITS]; -static struct i4b_l1mux_func *l1mux_func[MAXL1DRVR]; - -static int i4b_l1_ph_data_req(int, struct mbuf *, int); -static int i4b_l1_ph_activate_req(int); - -/* from i4btrc driver i4b_trace.c */ -int get_trace_data_from_l1(int unit, int what, int len, char *buf); - -/* from layer 2 */ -int i4b_ph_data_ind(int unit, struct mbuf *m); -int i4b_ph_activate_ind(int unit); -int i4b_ph_deactivate_ind(int unit); -int i4b_mph_status_ind(int, int, int); - -/* layer 1 lme */ -int i4b_l1_mph_command_req(int, int, void *); - -/*---------------------------------------------------------------------------* - * jump table: interface function pointers L1/L2 interface - *---------------------------------------------------------------------------*/ -struct i4b_l1l2_func i4b_l1l2_func = { - - /* Layer 1 --> Layer 2 */ - - (int (*)(int, struct mbuf *)) i4b_ph_data_ind, - (int (*)(int)) i4b_ph_activate_ind, - (int (*)(int)) i4b_ph_deactivate_ind, - - /* Layer 2 --> Layer 1 */ - - (int (*)(int, struct mbuf *, int)) i4b_l1_ph_data_req, - - (int (*)(int)) i4b_l1_ph_activate_req, - - /* Layer 1 --> trace interface driver, ISDN trace data */ - - (int (*)(i4b_trace_hdr_t *, int, u_char *)) get_trace_data_from_l1, - - /* Driver control and status information */ - - (int (*)(int, int, int)) i4b_mph_status_ind, - (int (*)(int, int, void *)) i4b_l1_mph_command_req, -}; - -/*---------------------------------------------------------------------------* - * return a pointer to a layer 0 drivers unit tab - *---------------------------------------------------------------------------*/ -static __inline int * -getl1tab(int drv) -{ - switch(drv) - { - case L1DRVR_ISIC: - return(l1isicunittab); - break; - case L1DRVR_IWIC: - return(l1iwicunittab); - break; - case L1DRVR_IFPI: - return(l1ifpiunittab); - break; - case L1DRVR_IFPI2: - return(l1ifpi2unittab); - break; - case L1DRVR_IHFC: - return(l1ihfcunittab); - break; - case L1DRVR_IFPNP: - return(l1ifpnpunittab); - break; - case L1DRVR_ITJC: - return(l1itjcunittab); - break; - default: - return(NULL); - break; - } -} - -/*===========================================================================* - * B - Channel (data transfer) - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * return the address of ISDN drivers linktab - *---------------------------------------------------------------------------*/ -isdn_link_t * -i4b_l1_ret_linktab(int unit, int channel) -{ - int drv_unit, ch_unit; - - drv_unit = L0DRVR(l1drvunittab[unit]); - ch_unit = L0UNIT(l1drvunittab[unit]); - - NDBGL1(L1_PRIM, "unit %d -> drv %d / drvunit %d", unit, drv_unit, ch_unit); - - if (drv_unit >= MAXL1DRVR || l1mux_func[drv_unit] == NULL - || l1mux_func[drv_unit]->ret_linktab == NULL) - panic("i4b_l1_ret_linktab: unknown driver type %d\n", drv_unit); - - return(l1mux_func[drv_unit]->ret_linktab(ch_unit, channel)); -} - -/*---------------------------------------------------------------------------* - * set the ISDN driver linktab - *---------------------------------------------------------------------------*/ -void -i4b_l1_set_linktab(int unit, int channel, drvr_link_t *dlt) -{ - int drv_unit, ch_unit; - - drv_unit = L0DRVR(l1drvunittab[unit]); - ch_unit = L0UNIT(l1drvunittab[unit]); - - NDBGL1(L1_PRIM, "unit %d -> drv %d / drvunit %d", unit, drv_unit, ch_unit); - - if (drv_unit >= MAXL1DRVR || l1mux_func[drv_unit] == NULL - || l1mux_func[drv_unit]->set_linktab == NULL) - panic("i4b_l1_set_linktab: unknown driver type %d\n", drv_unit); - - l1mux_func[drv_unit]->set_linktab(ch_unit, channel, dlt); -} - -/*===========================================================================* - * trace D- and B-Channel support - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * L0 -> L1 trace information to trace driver - *---------------------------------------------------------------------------*/ -int -i4b_l1_trace_ind(i4b_trace_hdr_t *hdr, int len, u_char *data) -{ - register int *tab; - - if((tab = getl1tab(L0DRVR(hdr->unit))) == NULL) - panic("i4b_l1_trace_ind: unknown driver type %d\n", L0DRVR(hdr->unit)); - - NDBGL1(L1_PRIM, "(drv %d / drvunit %d) -> unit %d", L0DRVR(hdr->unit), L0UNIT(hdr->unit), tab[L0UNIT(hdr->unit)]); - - hdr->unit = tab[L0UNIT(hdr->unit)]; - - return(MPH_Trace_Ind(hdr, len, data)); -} - -/*===========================================================================* - * D - Channel (signalling) - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * L0 -> L1 status indication from hardware - *---------------------------------------------------------------------------*/ -int -i4b_l1_mph_status_ind(int drv_unit, int status, int parm, struct i4b_l1mux_func *l1mux_func_p) -{ - register int *tab; - - /* - * in case the status STI_ATTACH is sent from the hardware, the - * driver has just attached itself and we need to initialize - * the tables and assorted variables. - */ - - if(status == STI_ATTACH) - { - if (l1mux_func_p == (struct i4b_l1mux_func *)0) - panic("i4b_l1_mph_status_ind: i4b_l1mux_func pointer is NULL\n"); - - if(numl1units < MAXL1UNITS) - { - if((tab = getl1tab(L0DRVR(drv_unit))) == NULL) - panic("i4b_l1_mph_status_ind: unknown driver type %d\n", L0DRVR(drv_unit)); - - tab[L0UNIT(drv_unit)] = numl1units; - - l1drvunittab[numl1units] = drv_unit; - - l1mux_func[L0DRVR(drv_unit)] = l1mux_func_p; - - switch(L0DRVR(drv_unit)) - { - case L1DRVR_ISIC: - printf("isic%d: passive stack unit %d\n", L0UNIT(drv_unit), numl1units); - break; - case L1DRVR_IWIC: - printf("iwic%d: passive stack unit %d\n", L0UNIT(drv_unit), numl1units); - break; - case L1DRVR_IFPI: - printf("ifpi%d: passive stack unit %d\n", L0UNIT(drv_unit), numl1units); - break; - case L1DRVR_IFPI2: - printf("ifpi2-%d: passive stack unit %d\n", L0UNIT(drv_unit), numl1units); - break; - case L1DRVR_IFPNP: - printf("ifpnp%d: passive stack unit %d\n", L0UNIT(drv_unit), numl1units); - break; - case L1DRVR_IHFC: - printf("ihfc%d: passive stack unit %d\n", L0UNIT(drv_unit), numl1units); - break; - case L1DRVR_ITJC: - printf("itjc%d: passive stack unit %d\n", L0UNIT(drv_unit), numl1units); - break; - } - - NDBGL1(L1_PRIM, "ATTACH drv %d, drvunit %d -> unit %d", L0DRVR(drv_unit), L0UNIT(drv_unit), numl1units); - - numl1units++; - } - } - - if((tab = getl1tab(L0DRVR(drv_unit))) == NULL) - panic("i4b_l1_mph_status_ind: unknown driver type %d\n", L0DRVR(drv_unit)); - - NDBGL1(L1_PRIM, "(drv %d / drvunit %d) -> unit %d\n", L0DRVR(drv_unit), L0UNIT(drv_unit), tab[L0UNIT(drv_unit)]); - - return(MPH_Status_Ind(tab[L0UNIT(drv_unit)], status, parm)); -} - -/*---------------------------------------------------------------------------* - * L0 -> L1 data from hardware - *---------------------------------------------------------------------------*/ -int -i4b_l1_ph_data_ind(int drv_unit, struct mbuf *data) -{ - register int *tab; - - if((tab = getl1tab(L0DRVR(drv_unit))) == NULL) - panic("i4b_l1_ph_data_ind: unknown driver type %d\n", L0DRVR(drv_unit)); - -#if 0 - NDBGL1(L1_PRIM, "(drv %d / drvunit %d) -> unit %d", L0DRVR(drv_unit), L0UNIT(drv_unit), tab[L0UNIT(drv_unit)]); -#endif - - return(PH_Data_Ind(tab[L0UNIT(drv_unit)], data)); -} - -/*---------------------------------------------------------------------------* - * L0 -> L1 activate indication from hardware - *---------------------------------------------------------------------------*/ -int -i4b_l1_ph_activate_ind(int drv_unit) -{ - register int *tab; - - if((tab = getl1tab(L0DRVR(drv_unit))) == NULL) - panic("i4b_l1_ph_activate_ind: unknown driver type %d\n", L0DRVR(drv_unit)); - - NDBGL1(L1_PRIM, "(drv %d / drvunit %d) -> unit %d", L0DRVR(drv_unit), L0UNIT(drv_unit), tab[L0UNIT(drv_unit)]); - - return(PH_Act_Ind(tab[L0UNIT(drv_unit)])); -} - -/*---------------------------------------------------------------------------* - * L0 -> L1 deactivate indication from hardware - *---------------------------------------------------------------------------*/ -int -i4b_l1_ph_deactivate_ind(int drv_unit) -{ - register int *tab; - - if((tab = getl1tab(L0DRVR(drv_unit))) == NULL) - panic("i4b_l1_ph_deactivate_ind: unknown driver type %d\n", L0DRVR(drv_unit)); - - NDBGL1(L1_PRIM, "(drv %d / drvunit %d) -> unit %d", L0DRVR(drv_unit), L0UNIT(drv_unit), tab[L0UNIT(drv_unit)]); - - return(PH_Deact_Ind(tab[L0UNIT(drv_unit)])); -} - -/*---------------------------------------------------------------------------* - * L2 -> L1 command to hardware - *---------------------------------------------------------------------------*/ -int -i4b_l1_mph_command_req(int unit, int command, void * parm) -{ - register int drv_unit = L0DRVR(l1drvunittab[unit]); - register int ch_unit = L0UNIT(l1drvunittab[unit]); - - NDBGL1(L1_PRIM, "unit %d -> drv %d / drvunit %d", unit, drv_unit, ch_unit); - - if (drv_unit >= MAXL1DRVR || l1mux_func[drv_unit] == NULL - || l1mux_func[drv_unit]->mph_command_req == NULL) - panic("i4b_l1_mph_command_req: unknown driver type %d\n", drv_unit); - - return(l1mux_func[drv_unit]->mph_command_req(ch_unit, command, parm)); -} - -/*---------------------------------------------------------------------------* - * L2 -> L1 data to be transmitted to hardware - *---------------------------------------------------------------------------*/ -static int -i4b_l1_ph_data_req(int unit, struct mbuf *data, int flag) -{ - register int drv_unit = L0DRVR(l1drvunittab[unit]); - register int ch_unit = L0UNIT(l1drvunittab[unit]); - -#if 0 - NDBGL1(L1_PRIM, "unit %d -> drv %d / drvunit %d", unit, drv_unit, ch_unit); -#endif - - if (drv_unit >= MAXL1DRVR || l1mux_func[drv_unit] == NULL - || l1mux_func[drv_unit]->ph_data_req == NULL) - panic("i4b_l1_ph_data_req: unknown driver type %d\n", drv_unit); - - return(l1mux_func[drv_unit]->ph_data_req(ch_unit, data, flag)); -} - -/*---------------------------------------------------------------------------* - * L2 -> L1 activate request to hardware - *---------------------------------------------------------------------------*/ -static int -i4b_l1_ph_activate_req(int unit) -{ - register int drv_unit = L0DRVR(l1drvunittab[unit]); - register int ch_unit = L0UNIT(l1drvunittab[unit]); - - NDBGL1(L1_PRIM, "unit %d -> drv %d / drvunit %d", unit, drv_unit, ch_unit); - - if (drv_unit >= MAXL1DRVR || l1mux_func[drv_unit] == NULL - || l1mux_func[drv_unit]->ph_activate_req == NULL) - panic("i4b_l1_ph_activate_req: unknown driver type %d\n", drv_unit); - - return(l1mux_func[drv_unit]->ph_activate_req(ch_unit)); -} - -/* EOF */ diff --git a/sys/i4b/layer1/i4b_l1lib.c b/sys/i4b/layer1/i4b_l1lib.c deleted file mode 100644 index abce3bd0b31e..000000000000 --- a/sys/i4b/layer1/i4b_l1lib.c +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * Copyright (c) 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l1lib.c - general useful L1 procedures - * ------------------------------------------ - * $Id: i4b_l1lib.c,v 1.3 2000/05/29 15:41:41 hm Exp $ - * last edit-date: [Mon May 29 15:24:21 2000] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include - -#include -#include - -#include - -#define TEL_IDLE_MIN (BCH_MAX_DATALEN/2) - -/*---------------------------------------------------------------------------* - * telephony silence detection - *---------------------------------------------------------------------------*/ -int -i4b_l1_bchan_tel_silence(unsigned char *data, int len) -{ - register int i = 0; - register int j = 0; - - /* count idle bytes */ - - for(;i < len; i++) - { - if((*data >= 0xaa) && (*data <= 0xac)) - j++; - data++; - } - -#ifdef NOTDEF - printf("i4b_l1_bchan_tel_silence: got %d silence bytes in frame\n", j); -#endif - - if(j < (TEL_IDLE_MIN)) - return(0); - else - return(1); - -} diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_ext.h b/sys/i4b/layer1/ifpi/i4b_ifpi_ext.h deleted file mode 100644 index 127f1e30cb98..000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_ext.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2000 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi - Fritz!Card PCI for split layers - * ------------------------------------------ - * - * $Id: i4b_ifpi_ext.h,v 1.2 2000/06/02 16:14:36 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jun 2 14:53:31 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IFPI_EXT_H_ -#define _I4B_IFPI_EXT_H_ - -#include - -void ifpi_set_linktab(int unit, int channel, drvr_link_t * dlt); -isdn_link_t *ifpi_ret_linktab(int unit, int channel); - -int ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag); -int ifpi_ph_activate_req(int unit); -int ifpi_mph_command_req(int unit, int command, void *parm); - -void ifpi_isac_irq(struct l1_softc *sc, int ista); -void ifpi_isac_l1_cmd(struct l1_softc *sc, int command); -int ifpi_isac_init(struct l1_softc *sc); - -void ifpi_recover(struct l1_softc *sc); -char * ifpi_printstate(struct l1_softc *sc); -void ifpi_next_state(struct l1_softc *sc, int event); - -#define IFPI_MAXUNIT 4 -extern struct l1_softc *ifpi_scp[IFPI_MAXUNIT]; - -#endif /* _I4B_IFPI_EXT_H_ */ diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c b/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c deleted file mode 100644 index e97b2dfaaccf..000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c +++ /dev/null @@ -1,658 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi_isac.c - i4b Fritz PCI ISAC handler - * -------------------------------------------- - * $Id: i4b_ifpi_isac.c,v 1.3 2000/05/29 15:41:41 hm Exp $ - * last edit-date: [Mon May 29 15:22:52 2000] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include - -static u_char ifpi_isac_exir_hdlr(register struct l1_softc *sc, u_char exir); -static void ifpi_isac_ind_hdlr(register struct l1_softc *sc, int ind); - -/*---------------------------------------------------------------------------* - * ISAC interrupt service routine - *---------------------------------------------------------------------------*/ -void -ifpi_isac_irq(struct l1_softc *sc, int ista) -{ - register u_char c = 0; - NDBGL1(L1_F_MSG, "unit %d: ista = 0x%02x", sc->sc_unit, ista); - - if(ista & ISAC_ISTA_EXI) /* extended interrupt */ - { - c |= ifpi_isac_exir_hdlr(sc, ISAC_READ(I_EXIR)); - } - - if(ista & ISAC_ISTA_RME) /* receive message end */ - { - register int rest; - u_char rsta; - - /* get rx status register */ - - rsta = ISAC_READ(I_RSTA); - - if((rsta & ISAC_RSTA_MASK) != 0x20) - { - int error = 0; - - if(!(rsta & ISAC_RSTA_CRC)) /* CRC error */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: CRC error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RDO) /* ReceiveDataOverflow */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Data Overrun error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RAB) /* ReceiveABorted */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Receive Aborted error", sc->sc_unit); - } - - if(error == 0) - NDBGL1(L1_I_ERR, "unit %d: RME unknown error, RSTA = 0x%02x!", sc->sc_unit, rsta); - - i4b_Dfreembuf(sc->sc_ibuf); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - ISAC_WRITE(I_CMDR, ISAC_CMDR_RMC|ISAC_CMDR_RRES); - ISACCMDRWRDELAY(); - - return; - } - - rest = (ISAC_READ(I_RBCL) & (ISAC_FIFO_LEN-1)); - - if(rest == 0) - rest = ISAC_FIFO_LEN; - - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(rest)) != NULL) - sc->sc_ib = sc->sc_ibuf->m_data; - else - panic("ifpi_isac_irq: RME, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - rest)) - { - ISAC_RDFIFO(sc->sc_ib, rest); - sc->sc_ilen += rest; - - sc->sc_ibuf->m_pkthdr.len = - sc->sc_ibuf->m_len = sc->sc_ilen; - - if(sc->sc_trace & TRACE_D_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data); - } - - c |= ISAC_CMDR_RMC; - - if(sc->sc_enabled && - (ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S)) - { - i4b_l1_ph_data_ind(L0IFPIUNIT(sc->sc_unit), sc->sc_ibuf); - } - else - { - i4b_Dfreembuf(sc->sc_ibuf); - } - } - else - { - NDBGL1(L1_I_ERR, "RME, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - } - - if(ista & ISAC_ISTA_RPF) /* receive fifo full */ - { - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(MAX_DFRAME_LEN)) != NULL) - sc->sc_ib= sc->sc_ibuf->m_data; - else - panic("ifpi_isac_irq: RPF, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - ISAC_FIFO_LEN)) - { - ISAC_RDFIFO(sc->sc_ib, ISAC_FIFO_LEN); - sc->sc_ilen += ISAC_FIFO_LEN; - sc->sc_ib += ISAC_FIFO_LEN; - c |= ISAC_CMDR_RMC; - } - else - { - NDBGL1(L1_I_ERR, "RPF, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - } - - if(ista & ISAC_ISTA_XPR) /* transmit fifo empty (XPR bit set) */ - { - if((sc->sc_obuf2 != NULL) && (sc->sc_obuf == NULL)) - { - sc->sc_freeflag = sc->sc_freeflag2; - sc->sc_obuf = sc->sc_obuf2; - sc->sc_op = sc->sc_obuf->m_data; - sc->sc_ol = sc->sc_obuf->m_len; - sc->sc_obuf2 = NULL; -#ifdef NOTDEF - printf("ob2=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - else - { -#ifdef NOTDEF - printf("ob=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - - if(sc->sc_obuf) - { - ISAC_WRFIFO(sc->sc_op, min(sc->sc_ol, ISAC_FIFO_LEN)); - - if(sc->sc_ol > ISAC_FIFO_LEN) /* length > 32 ? */ - { - sc->sc_op += ISAC_FIFO_LEN; /* bufferptr+32 */ - sc->sc_ol -= ISAC_FIFO_LEN; /* length - 32 */ - c |= ISAC_CMDR_XTF; /* set XTF bit */ - } - else - { - if(sc->sc_freeflag) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_freeflag = 0; - } - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - c |= ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - } - else - { - sc->sc_state &= ~ISAC_TX_ACTIVE; - } - } - - if(ista & ISAC_ISTA_CISQ) /* channel status change CISQ */ - { - register u_char ci; - - /* get command/indication rx register*/ - - ci = ISAC_READ(I_CIRR); - - /* if S/Q IRQ, read SQC reg to clr SQC IRQ */ - - if(ci & ISAC_CIRR_SQC) - (void) ISAC_READ(I_SQRR); - - /* C/I code change IRQ (flag already cleared by CIRR read) */ - - if(ci & ISAC_CIRR_CIC0) - ifpi_isac_ind_hdlr(sc, (ci >> 2) & 0xf); - } - - if(c) - { - ISAC_WRITE(I_CMDR, c); - ISACCMDRWRDELAY(); - } -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Extended IRQ handler - *---------------------------------------------------------------------------*/ -static u_char -ifpi_isac_exir_hdlr(register struct l1_softc *sc, u_char exir) -{ - u_char c = 0; - - if(exir & ISAC_EXIR_XMR) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Message Repeat"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_XDU) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Data Underrun"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_PCE) - { - NDBGL1(L1_I_ERR, "EXIRQ Protocol Error"); - } - - if(exir & ISAC_EXIR_RFO) - { - NDBGL1(L1_I_ERR, "EXIRQ Rx Frame Overflow"); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - if(exir & ISAC_EXIR_SOV) - { - NDBGL1(L1_I_ERR, "EXIRQ Sync Xfer Overflow"); - } - - if(exir & ISAC_EXIR_MOS) - { - NDBGL1(L1_I_ERR, "EXIRQ Monitor Status"); - } - - if(exir & ISAC_EXIR_SAW) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Subscriber Awake"); - } - - if(exir & ISAC_EXIR_WOV) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Watchdog Timer Overflow"); - } - - return(c); -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Indication handler - *---------------------------------------------------------------------------*/ -static void -ifpi_isac_ind_hdlr(register struct l1_softc *sc, int ind) -{ - register int event; - - switch(ind) - { - case ISAC_CIRR_IAI8: - NDBGL1(L1_I_CICO, "rx AI8 in state %s", ifpi_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpi_isac_l1_cmd(sc, CMD_AR8); - event = EV_INFO48; - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IAI10: - NDBGL1(L1_I_CICO, "rx AI10 in state %s", ifpi_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpi_isac_l1_cmd(sc, CMD_AR10); - event = EV_INFO410; - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IRSY: - NDBGL1(L1_I_CICO, "rx RSY in state %s", ifpi_printstate(sc)); - event = EV_RSY; - break; - - case ISAC_CIRR_IPU: - NDBGL1(L1_I_CICO, "rx PU in state %s", ifpi_printstate(sc)); - event = EV_PU; - break; - - case ISAC_CIRR_IDR: - NDBGL1(L1_I_CICO, "rx DR in state %s", ifpi_printstate(sc)); - ifpi_isac_l1_cmd(sc, CMD_DIU); - event = EV_DR; - break; - - case ISAC_CIRR_IDID: - NDBGL1(L1_I_CICO, "rx DID in state %s", ifpi_printstate(sc)); - event = EV_INFO0; - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_L1STAT, LAYER_IDLE, NULL); - break; - - case ISAC_CIRR_IDIS: - NDBGL1(L1_I_CICO, "rx DIS in state %s", ifpi_printstate(sc)); - event = EV_DIS; - break; - - case ISAC_CIRR_IEI: - NDBGL1(L1_I_CICO, "rx EI in state %s", ifpi_printstate(sc)); - ifpi_isac_l1_cmd(sc, CMD_DIU); - event = EV_EI; - break; - - case ISAC_CIRR_IARD: - NDBGL1(L1_I_CICO, "rx ARD in state %s", ifpi_printstate(sc)); - event = EV_INFO2; - break; - - case ISAC_CIRR_ITI: - NDBGL1(L1_I_CICO, "rx TI in state %s", ifpi_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_IATI: - NDBGL1(L1_I_CICO, "rx ATI in state %s", ifpi_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_ISD: - NDBGL1(L1_I_CICO, "rx SD in state %s", ifpi_printstate(sc)); - event = EV_INFO0; - break; - - default: - NDBGL1(L1_I_ERR, "UNKNOWN Indication 0x%x in state %s", ind, ifpi_printstate(sc)); - event = EV_INFO0; - break; - } - ifpi_next_state(sc, event); -} - -/*---------------------------------------------------------------------------* - * execute a layer 1 command - *---------------------------------------------------------------------------*/ -void -ifpi_isac_l1_cmd(struct l1_softc *sc, int command) -{ - u_char cmd; - -#ifdef I4B_SMP_WORKAROUND - - /* XXXXXXXXXXXXXXXXXXX */ - - /* - * patch from Wolfgang Helbig: - * - * Here is a patch that makes i4b work on an SMP: - * The card (TELES 16.3) didn't interrupt on an SMP machine. - * This is a gross workaround, but anyway it works *and* provides - * some information as how to finally fix this problem. - */ - - HSCX_WRITE(0, H_MASK, 0xff); - HSCX_WRITE(1, H_MASK, 0xff); - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - HSCX_WRITE(0, H_MASK, HSCX_A_IMASK); - HSCX_WRITE(1, H_MASK, HSCX_B_IMASK); - ISAC_WRITE(I_MASK, ISAC_IMASK); - - /* XXXXXXXXXXXXXXXXXXX */ - -#endif /* I4B_SMP_WORKAROUND */ - - if(command < 0 || command > CMD_ILL) - { - NDBGL1(L1_I_ERR, "illegal cmd 0x%x in state %s", command, ifpi_printstate(sc)); - return; - } - - if(sc->sc_bustyp == BUS_TYPE_IOM2) - cmd = ISAC_CIX0_LOW; - else - cmd = 0; - - switch(command) - { - case CMD_TIM: - NDBGL1(L1_I_CICO, "tx TIM in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CTIM << 2); - break; - - case CMD_RS: - NDBGL1(L1_I_CICO, "tx RS in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CRS << 2); - break; - - case CMD_AR8: - NDBGL1(L1_I_CICO, "tx AR8 in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CAR8 << 2); - break; - - case CMD_AR10: - NDBGL1(L1_I_CICO, "tx AR10 in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CAR10 << 2); - break; - - case CMD_DIU: - NDBGL1(L1_I_CICO, "tx DIU in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CDIU << 2); - break; - } - ISAC_WRITE(I_CIXR, cmd); -} - -/*---------------------------------------------------------------------------* - * L1 ISAC initialization - *---------------------------------------------------------------------------*/ -int -ifpi_isac_init(struct l1_softc *sc) -{ - ISAC_IMASK = 0xff; /* disable all irqs */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - if(sc->sc_bustyp != BUS_TYPE_IOM2) - { - NDBGL1(L1_I_SETUP, "configuring for IOM-1 mode"); - - /* ADF2: Select mode IOM-1 */ - ISAC_WRITE(I_ADF2, 0x00); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SAC - SIP port high Z - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 and B2 switched to/from SPa - */ - ISAC_WRITE(I_SPCR, ISAC_SPCR_C1C1|ISAC_SPCR_C2C1); - - /* SQXR: S/Q channel xmit register: - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * CFS - IOM clock/frame always active - * FSC1/2 - polarity of 8kHz strobe - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, ISAC_ADF1_FC2); /* ADF1 */ - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - else - { - NDBGL1(L1_I_SETUP, "configuring for IOM-2 mode"); - - /* ADF2: Select mode IOM-2 */ - ISAC_WRITE(I_ADF2, ISAC_ADF2_IMS); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 + C1 and B2 + IC2 monitoring - */ - ISAC_WRITE(I_SPCR, 0x00); - - /* SQXR: S/Q channel xmit register: - * IDC - IOM direction = 0 (master) - * CFS - Config Select = 0 (clock always active) - * CI1E - C/I channel 1 IRQ enable = 0 - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * IOF - IOM i/f off = 0 - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, 0x00); - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - -#ifdef NOTDEF - /* - * XXX a transmitter reset causes an ISAC tx IRQ which will not - * be serviced at attach time under some circumstances leaving - * the associated IRQ line on the ISA bus active. This prevents - * any further interrupts to be serviced because no low -> high - * transition can take place anymore. (-hm) - */ - - /* command register: - * RRES - HDLC receiver reset - * XRES - transmitter reset - */ - ISAC_WRITE(I_CMDR, ISAC_CMDR_RRES|ISAC_CMDR_XRES); - ISACCMDRWRDELAY(); -#endif - - /* enabled interrupts: - * =================== - * RME - receive message end - * RPF - receive pool full - * XPR - transmit pool ready - * CISQ - CI or S/Q channel change - * EXI - extended interrupt - */ - - ISAC_IMASK = ISAC_MASK_RSC | /* auto mode only */ - ISAC_MASK_TIN | /* timer irq */ - ISAC_MASK_SIN; /* sync xfer irq */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - return(0); -} diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c b/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c deleted file mode 100644 index da63967a3a42..000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c +++ /dev/null @@ -1,236 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi_l1.c - AVM Fritz PCI layer 1 handler - * --------------------------------------------- - * $Id: i4b_ifpi_l1.c,v 1.4 2000/06/02 16:14:36 hm Exp $ - * last edit-date: [Fri Jun 2 14:54:30 2000] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-DATA-REQUEST - * ========================= - * - * parms: - * unit physical interface unit number - * m mbuf containing L2 frame to be sent out - * freeflag MBUF_FREE: free mbuf here after having sent - * it out - * MBUF_DONTFREE: mbuf is freed by Layer 2 - * returns: - * ==0 fail, nothing sent out - * !=0 ok, frame sent out - * - *---------------------------------------------------------------------------*/ -int -ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - u_char cmd; - int s; - struct l1_softc *sc = ifpi_scp[unit]; - -#ifdef NOTDEF - NDBGL1(L1_PRIM, "PH-DATA-REQ, unit %d, freeflag=%d", unit, freeflag); -#endif - - if(m == NULL) /* failsafe */ - return (0); - - s = SPLI4B(); - - if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ - { - NDBGL1(L1_I_ERR, "still in state F3!"); - ifpi_ph_activate_req(unit); - } - - if(sc->sc_state & ISAC_TX_ACTIVE) - { - if(sc->sc_obuf2 == NULL) - { - sc->sc_obuf2 = m; /* save mbuf ptr */ - - if(freeflag) - sc->sc_freeflag2 = 1; /* IRQ must mfree */ - else - sc->sc_freeflag2 = 0; /* IRQ must not mfree */ - - NDBGL1(L1_I_MSG, "using 2nd ISAC TX buffer, state = %s", ifpi_printstate(sc)); - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - splx(s); - return(1); - } - - NDBGL1(L1_I_ERR, "No Space in TX FIFO, state = %s", ifpi_printstate(sc)); - - if(freeflag == MBUF_FREE) - i4b_Dfreembuf(m); - - splx(s); - return (0); - } - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - sc->sc_state |= ISAC_TX_ACTIVE; /* set transmitter busy flag */ - - NDBGL1(L1_I_MSG, "ISAC_TX_ACTIVE set"); - - sc->sc_freeflag = 0; /* IRQ must NOT mfree */ - - ISAC_WRFIFO(m->m_data, min(m->m_len, ISAC_FIFO_LEN)); /* output to TX fifo */ - - if(m->m_len > ISAC_FIFO_LEN) /* message > 32 bytes ? */ - { - sc->sc_obuf = m; /* save mbuf ptr */ - sc->sc_op = m->m_data + ISAC_FIFO_LEN; /* ptr for irq hdl */ - sc->sc_ol = m->m_len - ISAC_FIFO_LEN; /* length for irq hdl */ - - if(freeflag) - sc->sc_freeflag = 1; /* IRQ must mfree */ - - cmd = ISAC_CMDR_XTF; - } - else - { - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - if(freeflag) - i4b_Dfreembuf(m); - - cmd = ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - - ISAC_WRITE(I_CMDR, cmd); - ISACCMDRWRDELAY(); - - splx(s); - - return(1); -} - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-ACTIVATE-REQUEST - * ============================= - * - * parms: - * unit physical interface unit number - * - * returns: - * ==0 - * !=0 - * - *---------------------------------------------------------------------------*/ -int -ifpi_ph_activate_req(int unit) -{ - struct l1_softc *sc = ifpi_scp[unit]; - NDBGL1(L1_PRIM, "PH-ACTIVATE-REQ, unit %d", unit); - ifpi_next_state(sc, EV_PHAR); - return(0); -} - -/*---------------------------------------------------------------------------* - * command from the upper layers - *---------------------------------------------------------------------------*/ -int -ifpi_mph_command_req(int unit, int command, void *parm) -{ - struct l1_softc *sc = ifpi_scp[unit]; - - switch(command) - { - case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DOPEN", unit); - sc->sc_enabled = 1; - break; - - case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DCLOSE", unit); - sc->sc_enabled = 0; - break; - - case CMR_SETTRACE: - NDBGL1(L1_PRIM, "unit %d, command = CMR_SETTRACE, parm = %d", unit, (unsigned int)parm); - sc->sc_trace = (unsigned int)parm; - break; - - default: - NDBGL1(L1_ERROR, "ERROR, unknown command = %d, unit = %d, parm = %d", command, unit, (unsigned int)parm); - break; - } - - return(0); -} diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c b/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c deleted file mode 100644 index b0532065412c..000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c +++ /dev/null @@ -1,509 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi_l1fsm.c - AVM Fritz PCI layer 1 I.430 state machine - * ------------------------------------------------------------ - * $Id: i4b_ifpi_l1fsm.c,v 1.4 2000/05/29 15:41:41 hm Exp $ - * last edit-date: [Mon May 29 15:23:15 2000] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include - -#include - -#include - -#include - -#if DO_I4B_DEBUG -static char *state_text[N_STATES] = { - "F3 Deactivated", - "F4 Awaiting Signal", - "F5 Identifying Input", - "F6 Synchronized", - "F7 Activated", - "F8 Lost Framing", - "Illegal State" -}; - -static char *event_text[N_EVENTS] = { - "EV_PHAR PH_ACT_REQ", - "EV_T3 Timer 3 expired", - "EV_INFO0 INFO0 received", - "EV_RSY Level Detected", - "EV_INFO2 INFO2 received", - "EV_INFO48 INFO4 received", - "EV_INFO410 INFO4 received", - "EV_DR Deactivate Req", - "EV_PU Power UP", - "EV_DIS Disconnected", - "EV_EI Error Ind", - "Illegal Event" -}; -#endif - -/* Function prototypes */ - -static void timer3_expired (struct l1_softc *sc); -static void T3_start (struct l1_softc *sc); -static void T3_stop (struct l1_softc *sc); -static void F_T3ex (struct l1_softc *sc); -static void timer4_expired (struct l1_softc *sc); -static void T4_start (struct l1_softc *sc); -static void T4_stop (struct l1_softc *sc); -static void F_AI8 (struct l1_softc *sc); -static void F_AI10 (struct l1_softc *sc); -static void F_I01 (struct l1_softc *sc); -static void F_I02 (struct l1_softc *sc); -static void F_I03 (struct l1_softc *sc); -static void F_I2 (struct l1_softc *sc); -static void F_ill (struct l1_softc *sc); -static void F_NULL (struct l1_softc *sc); - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expire function - *---------------------------------------------------------------------------*/ -static void -timer3_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T3) - { - NDBGL1(L1_T_ERR, "state = %s", ifpi_printstate(sc)); - sc->sc_I430T3 = 0; - - /* XXX try some recovery here XXX */ - - ifpi_recover(sc); - - sc->sc_init_tries++; /* increment retry count */ - -/*XXX*/ if(sc->sc_init_tries > 4) - { - int s = SPLI4B(); - - sc->sc_init_tries = 0; - - if(sc->sc_obuf2 != NULL) - { - i4b_Dfreembuf(sc->sc_obuf2); - sc->sc_obuf2 = NULL; - } - if(sc->sc_obuf != NULL) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_obuf = NULL; - sc->sc_freeflag = 0; - sc->sc_op = NULL; - sc->sc_ol = 0; - } - - splx(s); - - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); - } - - ifpi_next_state(sc, EV_T3); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 start - *---------------------------------------------------------------------------*/ -static void -T3_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - sc->sc_I430T3 = 1; - sc->sc_T3_callout = timeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, 2*hz); -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 stop - *---------------------------------------------------------------------------*/ -static void -T3_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - - sc->sc_init_tries = 0; /* init connect retry count */ - - if(sc->sc_I430T3) - { - sc->sc_I430T3 = 0; - untimeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, sc->sc_T3_callout); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expiry - *---------------------------------------------------------------------------*/ -static void -F_T3ex(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_T3ex executing"); - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPIUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * Timer T4 expire function - *---------------------------------------------------------------------------*/ -static void -timer4_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T4) - { - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - sc->sc_I430T4 = 0; - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_PDEACT, 0, NULL); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * Timer T4 start - *---------------------------------------------------------------------------*/ -static void -T4_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - sc->sc_I430T4 = 1; - sc->sc_T4_callout = timeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, hz); -} - -/*---------------------------------------------------------------------------* - * Timer T4 stop - *---------------------------------------------------------------------------*/ -static void -T4_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - - if(sc->sc_I430T4) - { - sc->sc_I430T4 = 0; - untimeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, sc->sc_T4_callout); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI8 - *---------------------------------------------------------------------------*/ -static void -F_AI8(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI8 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPIUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_8; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI10 - *---------------------------------------------------------------------------*/ -static void -F_AI10(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI10 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPIUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_10; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in states F3 .. F5 - *---------------------------------------------------------------------------*/ -static void -F_I01(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I01 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F6 - *---------------------------------------------------------------------------*/ -static void -F_I02(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I02 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPIUNIT(sc->sc_unit)); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F7 or F8 - *---------------------------------------------------------------------------*/ -static void -F_I03(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I03 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPIUNIT(sc->sc_unit)); - - T4_start(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: activate request - *---------------------------------------------------------------------------*/ -static void -F_AR(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO1_8; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_TE; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - - ifpi_isac_l1_cmd(sc, CMD_AR8); - - T3_start(sc); -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO2 - *---------------------------------------------------------------------------*/ -static void -F_I2(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I2 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO2; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - -} - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(struct l1_softc *sc) -{ - NDBGL1(L1_F_ERR, "FSM function F_ill executing"); -} - -/*---------------------------------------------------------------------------* - * No action - *---------------------------------------------------------------------------*/ -static void -F_NULL(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_NULL executing"); -} - - -/*---------------------------------------------------------------------------* - * layer 1 state transition table - *---------------------------------------------------------------------------*/ -struct ifpi_state_tab { - void (*func) (struct l1_softc *sc); /* function to execute */ - int newstate; /* next state */ -} ifpi_state_tab[N_EVENTS][N_STATES] = { - -/* STATE: F3 F4 F5 F6 F7 F8 ILLEGAL STATE */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* EV_PHAR x*/ {{F_AR, ST_F4}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_ill, ST_ILL}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_T3 x*/ {{F_NULL, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO0 */ {{F_I01, ST_F3}, {F_I01, ST_F4}, {F_I01, ST_F5}, {F_I02, ST_F3}, {F_I03, ST_F3}, {F_I03, ST_F3}, {F_ill, ST_ILL}}, -/* EV_RSY x*/ {{F_NULL, ST_F3}, {F_NULL, ST_F5}, {F_NULL, ST_F5}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO2 */ {{F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_ill, ST_ILL}}, -/* EV_INFO48*/ {{F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_NULL, ST_F7}, {F_AI8, ST_F7}, {F_ill, ST_ILL}}, -/* EV_INFO41*/ {{F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_NULL, ST_F7}, {F_AI10, ST_F7}, {F_ill, ST_ILL}}, -/* EV_DR */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_PU */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_DIS */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_EI */ {{F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_ill, ST_ILL}}, -/* EV_ILL */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -ifpi_next_state(struct l1_softc *sc, int event) -{ - int currstate, newstate; - - if(event >= N_EVENTS) - panic("i4b_l1fsm.c: event >= N_EVENTS\n"); - - currstate = sc->sc_I430state; - - if(currstate >= N_STATES) - panic("i4b_l1fsm.c: currstate >= N_STATES\n"); - - newstate = ifpi_state_tab[event][currstate].newstate; - - if(newstate >= N_STATES) - panic("i4b_l1fsm.c: newstate >= N_STATES\n"); - - NDBGL1(L1_F_MSG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]); - - (*ifpi_state_tab[event][currstate].func)(sc); - - if(newstate == ST_ILL) - { - newstate = ST_F3; - NDBGL1(L1_F_ERR, "FSM Illegal State ERROR, oldstate = %s, newstate = %s, event = %s!", - state_text[currstate], - state_text[newstate], - event_text[event]); - } - - sc->sc_I430state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -ifpi_printstate(struct l1_softc *sc) -{ - return((char *) state_text[sc->sc_I430state]); -} -#endif diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c b/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c deleted file mode 100644 index 2b674320495e..000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c +++ /dev/null @@ -1,1494 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi_pci.c: AVM Fritz!Card PCI hardware driver - * -------------------------------------------------- - * $Id: i4b_ifpi_pci.c,v 1.4 2000/06/02 11:58:56 hm Exp $ - * last edit-date: [Fri Jan 12 17:01:26 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#define PCI_AVMA1_VID 0x1244 -#define PCI_AVMA1_DID 0x0a00 - -/* prototypes */ - -static void avma1pp_disable(device_t); -static void avma1pp_intr(void *); -static void hscx_write_reg(int, u_int, u_int, struct l1_softc *); -static u_char hscx_read_reg(int, u_int, struct l1_softc *); -static u_int hscx_read_reg_int(int, u_int, struct l1_softc *); -static void hscx_read_fifo(int, void *, size_t, struct l1_softc *); -static void hscx_write_fifo(int, void *, size_t, struct l1_softc *); -static void avma1pp_hscx_int_handler(struct l1_softc *); -static void avma1pp_hscx_intr(int, u_int, struct l1_softc *); -static void avma1pp_init_linktab(struct l1_softc *); -static void avma1pp_bchannel_setup(int, int, int, int); -static void avma1pp_bchannel_start(int, int); -static void avma1pp_hscx_init(struct l1_softc *, int, int); -static void avma1pp_bchannel_stat(int, int, bchan_statistics_t *); -static void avma1pp_set_linktab(int, int, drvr_link_t *); -static isdn_link_t * avma1pp_ret_linktab(int, int); -static int avma1pp_pci_probe(device_t); -static int avma1pp_hscx_fifo(l1_bchan_state_t *, struct l1_softc *); -int avma1pp_attach_avma1pp(device_t); -static void ifpi_isac_intr(struct l1_softc *sc); - -static device_method_t avma1pp_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, avma1pp_pci_probe), - DEVMETHOD(device_attach, avma1pp_attach_avma1pp), - DEVMETHOD(device_shutdown, avma1pp_disable), - - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - { 0, 0 } -}; - -#if 0 /* use what's in l1_softc */ -/* a minimal softc for the Fritz!Card PCI */ -struct avma1pp_softc -{ - bus_space_handle_t avma1pp_bhandle; - bus_space_tag_t avma1pp_btag; - void *avma1pp_intrhand; - struct resource *avma1pp_irq; - struct resource *avma1pp_res; - /* pointer to ifpi_sc */ - struct l1_softc *avma1pp_isc; -}; -#endif - -static driver_t avma1pp_pci_driver = { - "ifpi", - avma1pp_pci_methods, - sizeof(struct l1_softc) -}; - -static devclass_t avma1pp_pci_devclass; - -DRIVER_MODULE(avma1pp, pci, avma1pp_pci_driver, avma1pp_pci_devclass, 0, 0); - -/* jump table for multiplex routines */ - -struct i4b_l1mux_func avma1pp_l1mux_func = { - avma1pp_ret_linktab, - avma1pp_set_linktab, - ifpi_mph_command_req, - ifpi_ph_data_req, - ifpi_ph_activate_req, -}; - -struct l1_softc *ifpi_scp[IFPI_MAXUNIT]; - -/*---------------------------------------------------------------------------* - * AVM PCI Fritz!Card special registers - *---------------------------------------------------------------------------*/ - -/* - * register offsets from i/o base - */ -#define STAT0_OFFSET 0x02 -#define STAT1_OFFSET 0x03 -#define ADDR_REG_OFFSET 0x04 -/*#define MODREG_OFFSET 0x06 -#define VERREG_OFFSET 0x07*/ - -/* these 2 are used to select an ISAC register set */ -#define ISAC_LO_REG_OFFSET 0x04 -#define ISAC_HI_REG_OFFSET 0x06 - -/* offset higher than this goes to the HI register set */ -#define MAX_LO_REG_OFFSET 0x2f - -/* mask for the offset */ -#define ISAC_REGSET_MASK 0x0f - -/* the offset from the base to the ISAC registers */ -#define ISAC_REG_OFFSET 0x10 - -/* the offset from the base to the ISAC FIFO */ -#define ISAC_FIFO 0x02 - -/* not really the HSCX, but sort of */ -#define HSCX_FIFO 0x00 -#define HSCX_STAT 0x04 - -/* - * AVM PCI Status Latch 0 read only bits - */ -#define ASL_IRQ_ISAC 0x01 /* ISAC interrupt, active low */ -#define ASL_IRQ_HSCX 0x02 /* HSX interrupt, active low */ -#define ASL_IRQ_TIMER 0x04 /* Timer interrupt, active low */ -#define ASL_IRQ_BCHAN ASL_IRQ_HSCX -/* actually active LOW */ -#define ASL_IRQ_Pending (ASL_IRQ_ISAC | ASL_IRQ_HSCX | ASL_IRQ_TIMER) - -/* - * AVM Status Latch 0 write only bits - */ -#define ASL_RESET_ALL 0x01 /* reset siemens IC's, active 1 */ -#define ASL_TIMERDISABLE 0x02 /* active high */ -#define ASL_TIMERRESET 0x04 /* active high */ -#define ASL_ENABLE_INT 0x08 /* active high */ -#define ASL_TESTBIT 0x10 /* active high */ - -/* - * AVM Status Latch 1 write only bits - */ -#define ASL1_INTSEL 0x0f /* active high */ -#define ASL1_ENABLE_IOM 0x80 /* active high */ - -/* - * "HSCX" mode bits - */ -#define HSCX_MODE_ITF_FLG 0x01 -#define HSCX_MODE_TRANS 0x02 -#define HSCX_MODE_CCR_7 0x04 -#define HSCX_MODE_CCR_16 0x08 -#define HSCX_MODE_TESTLOOP 0x80 - -/* - * "HSCX" status bits - */ -#define HSCX_STAT_RME 0x01 -#define HSCX_STAT_RDO 0x10 -#define HSCX_STAT_CRCVFRRAB 0x0E -#define HSCX_STAT_CRCVFR 0x06 -#define HSCX_STAT_RML_MASK 0x3f00 - -/* - * "HSCX" interrupt bits - */ -#define HSCX_INT_XPR 0x80 -#define HSCX_INT_XDU 0x40 -#define HSCX_INT_RPR 0x20 -#define HSCX_INT_MASK 0xE0 - -/* - * "HSCX" command bits - */ -#define HSCX_CMD_XRS 0x80 -#define HSCX_CMD_XME 0x01 -#define HSCX_CMD_RRS 0x20 -#define HSCX_CMD_XML_MASK 0x3f00 - -/* - * Commands and parameters are sent to the "HSCX" as a long, but the - * fields are handled as bytes. - * - * The long contains: - * (prot << 16)|(txl << 8)|cmd - * - * where: - * prot = protocol to use - * txl = transmit length - * cmd = the command to be executed - * - * The fields are defined as u_char in struct l1_softc. - * - * Macro to coalesce the byte fields into a u_int - */ -#define AVMA1PPSETCMDLONG(f) (f) = ((sc->avma1pp_cmd) | (sc->avma1pp_txl << 8) \ - | (sc->avma1pp_prot << 16)) - -/* - * to prevent deactivating the "HSCX" when both channels are active we - * define an HSCX_ACTIVE flag which is or'd into the channel's state - * flag in avma1pp_bchannel_setup upon active and cleared upon deactivation. - * It is set high to allow room for new flags. - */ -#define HSCX_AVMA1PP_ACTIVE 0x1000 - -/*---------------------------------------------------------------------------* - * AVM read fifo routines - *---------------------------------------------------------------------------*/ - -static void -avma1pp_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, ISAC_FIFO); - bus_space_read_multi_1(btag, bhandle, ISAC_REG_OFFSET, buf, size); - break; - case ISIC_WHAT_HSCXA: - hscx_read_fifo(0, buf, size, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_read_fifo(1, buf, size, sc); - break; - } -} - -static void -hscx_read_fifo(int chan, void *buf, size_t len, struct l1_softc *sc) -{ - u_int32_t *ip; - size_t cnt; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - bus_space_write_4(btag, bhandle, ADDR_REG_OFFSET, chan); - ip = (u_int32_t *)buf; - cnt = 0; - /* what if len isn't a multiple of sizeof(int) and buf is */ - /* too small ???? */ - while (cnt < len) - { - *ip++ = bus_space_read_4(btag, bhandle, ISAC_REG_OFFSET); - cnt += 4; - } -} - -/*---------------------------------------------------------------------------* - * AVM write fifo routines - *---------------------------------------------------------------------------*/ -static void -avma1pp_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, ISAC_FIFO); - bus_space_write_multi_1(btag, bhandle, ISAC_REG_OFFSET, (u_int8_t*)buf, size); - break; - case ISIC_WHAT_HSCXA: - hscx_write_fifo(0, buf, size, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_write_fifo(1, buf, size, sc); - break; - } -} - -static void -hscx_write_fifo(int chan, void *buf, size_t len, struct l1_softc *sc) -{ - u_int32_t *ip; - size_t cnt; - l1_bchan_state_t *Bchan = &sc->sc_chan[chan]; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - - sc->avma1pp_cmd &= ~HSCX_CMD_XME; - sc->avma1pp_txl = 0; - if (Bchan->out_mbuf_cur == NULL) - { - if (Bchan->bprot != BPROT_NONE) - sc->avma1pp_cmd |= HSCX_CMD_XME; - } - if (len != sc->sc_bfifolen) - sc->avma1pp_txl = len; - - cnt = 0; /* borrow cnt */ - AVMA1PPSETCMDLONG(cnt); - hscx_write_reg(chan, HSCX_STAT, cnt, sc); - - ip = (u_int32_t *)buf; - cnt = 0; - while (cnt < len) - { - bus_space_write_4(btag, bhandle, ISAC_REG_OFFSET, *ip); - ip++; - cnt += 4; - } -} - -/*---------------------------------------------------------------------------* - * AVM write register routines - *---------------------------------------------------------------------------*/ - -static void -avma1pp_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - u_char reg_bank; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - reg_bank = (offs > MAX_LO_REG_OFFSET) ? ISAC_HI_REG_OFFSET:ISAC_LO_REG_OFFSET; -#ifdef AVMA1PCI_DEBUG - printf("write_reg bank %d off %ld.. ", (int)reg_bank, (long)offs); -#endif - /* set the register bank */ - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, reg_bank); - bus_space_write_1(btag, bhandle, ISAC_REG_OFFSET + (offs & ISAC_REGSET_MASK), data); - break; - case ISIC_WHAT_HSCXA: - hscx_write_reg(0, offs, data, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_write_reg(1, offs, data, sc); - break; - } -} - -static void -hscx_write_reg(int chan, u_int off, u_int val, struct l1_softc *sc) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* point at the correct channel */ - bus_space_write_4(btag, bhandle, ADDR_REG_OFFSET, chan); - bus_space_write_4(btag, bhandle, ISAC_REG_OFFSET + off, val); -} - -/*---------------------------------------------------------------------------* - * AVM read register routines - *---------------------------------------------------------------------------*/ -static u_int8_t -avma1pp_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - u_char reg_bank; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - reg_bank = (offs > MAX_LO_REG_OFFSET) ? ISAC_HI_REG_OFFSET:ISAC_LO_REG_OFFSET; -#ifdef AVMA1PCI_DEBUG - printf("read_reg bank %d off %ld.. ", (int)reg_bank, (long)offs); -#endif - /* set the register bank */ - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, reg_bank); - return(bus_space_read_1(btag, bhandle, ISAC_REG_OFFSET + - (offs & ISAC_REGSET_MASK))); - case ISIC_WHAT_HSCXA: - return hscx_read_reg(0, offs, sc); - case ISIC_WHAT_HSCXB: - return hscx_read_reg(1, offs, sc); - } - return 0; -} - -static u_char -hscx_read_reg(int chan, u_int off, struct l1_softc *sc) -{ - return(hscx_read_reg_int(chan, off, sc) & 0xff); -} - -/* - * need to be able to return an int because the RBCH is in the 2nd - * byte. - */ -static u_int -hscx_read_reg_int(int chan, u_int off, struct l1_softc *sc) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* point at the correct channel */ - bus_space_write_4(btag, bhandle, ADDR_REG_OFFSET, chan); - return(bus_space_read_4(btag, bhandle, ISAC_REG_OFFSET + off)); -} - -/*---------------------------------------------------------------------------* - * avma1pp_probe - probe for a card - *---------------------------------------------------------------------------*/ -static int -avma1pp_pci_probe(dev) - device_t dev; -{ - u_int16_t did, vid; - - vid = pci_get_vendor(dev); - did = pci_get_device(dev); - - if ((vid == PCI_AVMA1_VID) && (did == PCI_AVMA1_DID)) { - device_set_desc(dev, "AVM Fritz!Card PCI"); - return(0); - } - - return(ENXIO); -} - -/*---------------------------------------------------------------------------* - * avma1pp_attach_avma1pp - attach Fritz!Card PCI - *---------------------------------------------------------------------------*/ -int -avma1pp_attach_avma1pp(device_t dev) -{ - struct l1_softc *sc; - u_int v; - int unit, error = 0; - int s; - u_int16_t did, vid; - void *ih = 0; - bus_space_handle_t bhandle; - bus_space_tag_t btag; - l1_bchan_state_t *chan; - - s = splimp(); - - vid = pci_get_vendor(dev); - did = pci_get_device(dev); - sc = device_get_softc(dev); - unit = device_get_unit(dev); - bzero(sc, sizeof(struct l1_softc)); - - /* probably not really required */ - if(unit >= IFPI_MAXUNIT) { - printf("avma1pp%d: Error, unit >= IFPI_MAXUNIT!\n", unit); - splx(s); - return(ENXIO); - } - - if ((vid != PCI_AVMA1_VID) && (did != PCI_AVMA1_DID)) { - printf("avma1pp%d: unknown device!?\n", unit); - goto fail; - } - - ifpi_scp[unit] = sc; - - sc->sc_resources.io_rid[0] = PCIR_BAR(1); - sc->sc_resources.io_base[0] = bus_alloc_resource_any(dev, - SYS_RES_IOPORT, &sc->sc_resources.io_rid[0], RF_ACTIVE); - - if (sc->sc_resources.io_base[0] == NULL) { - printf("avma1pp%d: couldn't map IO port\n", unit); - error = ENXIO; - goto fail; - } - - bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* Allocate interrupt */ - sc->sc_resources.irq_rid = 0; - sc->sc_resources.irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, RF_SHAREABLE | RF_ACTIVE); - - if (sc->sc_resources.irq == NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(1), sc->sc_resources.io_base[0]); - printf("avma1pp%d: couldn't map interrupt\n", unit); - error = ENXIO; - goto fail; - } - - error = bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL, avma1pp_intr, sc, &ih); - - if (error) { - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_resources.irq); - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(1), sc->sc_resources.io_base[0]); - printf("avma1pp%d: couldn't set up irq\n", unit); - goto fail; - } - - sc->sc_unit = unit; - - /* end of new-bus stuff */ - - ISAC_BASE = (caddr_t)ISIC_WHAT_ISAC; - - HSCX_A_BASE = (caddr_t)ISIC_WHAT_HSCXA; - HSCX_B_BASE = (caddr_t)ISIC_WHAT_HSCXB; - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = avma1pp_read_reg; - sc->writereg = avma1pp_write_reg; - - sc->readfifo = avma1pp_read_fifo; - sc->writefifo = avma1pp_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_AVMA1PCI; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* set up some other miscellaneous things */ - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* reset the card */ - /* the Linux driver does this to clear any pending ISAC interrupts */ - v = 0; - v = ISAC_READ(I_STAR); -#ifdef AVMA1PCI_DEBUG - printf("avma1pp_attach: I_STAR %x...", v); -#endif - v = ISAC_READ(I_MODE); -#ifdef AVMA1PCI_DEBUG - printf("avma1pp_attach: I_MODE %x...", v); -#endif - v = ISAC_READ(I_ADF2); -#ifdef AVMA1PCI_DEBUG - printf("avma1pp_attach: I_ADF2 %x...", v); -#endif - v = ISAC_READ(I_ISTA); -#ifdef AVMA1PCI_DEBUG - printf("avma1pp_attach: I_ISTA %x...", v); -#endif - if (v & ISAC_ISTA_EXI) - { - v = ISAC_READ(I_EXIR); -#ifdef AVMA1PCI_DEBUG - printf("avma1pp_attach: I_EXIR %x...", v); -#endif - } - v = ISAC_READ(I_CIRR); -#ifdef AVMA1PCI_DEBUG - printf("avma1pp_attach: I_CIRR %x...", v); -#endif - ISAC_WRITE(I_MASK, 0xff); - /* the Linux driver does this to clear any pending HSCX interrupts */ - v = hscx_read_reg_int(0, HSCX_STAT, sc); -#ifdef AVMA1PCI_DEBUG - printf("avma1pp_attach: 0 HSCX_STAT %x...", v); -#endif - v = hscx_read_reg_int(1, HSCX_STAT, sc); -#ifdef AVMA1PCI_DEBUG - printf("avma1pp_attach: 1 HSCX_STAT %x\n", v); -#endif - - bus_space_write_1(btag, bhandle, STAT0_OFFSET, ASL_RESET_ALL|ASL_TIMERDISABLE); - DELAY(SEC_DELAY/100); /* 10 ms */ - bus_space_write_1(btag, bhandle, STAT0_OFFSET, ASL_TIMERRESET|ASL_ENABLE_INT|ASL_TIMERDISABLE); - DELAY(SEC_DELAY/100); /* 10 ms */ -#ifdef AVMA1PCI_DEBUG - bus_space_write_1(btag, bhandle, STAT1_OFFSET, ASL1_ENABLE_IOM|sc->sc_irq); - DELAY(SEC_DELAY/100); /* 10 ms */ - v = bus_space_read_1(btag, bhandle, STAT1_OFFSET); - printf("after reset: S1 %#x\n", v); - - v = bus_space_read_4(btag, bhandle, 0); - printf("avma1pp_attach_avma1pp: v %#x\n", v); -#endif - - /* from here to the end would normally be done in isic_pciattach */ - - printf("ifpi%d: ISAC %s (IOM-%c)\n", unit, - "2085 Version A1/A2 or 2086/2186 Version 1.1", - sc->sc_bustyp == BUS_TYPE_IOM1 ? '1' : '2'); - - /* init the ISAC */ - ifpi_isac_init(sc); - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - /* Init the channel mutexes */ - chan = &sc->sc_chan[HSCX_CH_A]; - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp_rx", NULL, MTX_DEF); - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp_tx", NULL, MTX_DEF); - chan = &sc->sc_chan[HSCX_CH_B]; - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp_rx", NULL, MTX_DEF); - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp_tx", NULL, MTX_DEF); -#endif - - /* init the "HSCX" */ - avma1pp_bchannel_setup(sc->sc_unit, HSCX_CH_A, BPROT_NONE, 0); - - avma1pp_bchannel_setup(sc->sc_unit, HSCX_CH_B, BPROT_NONE, 0); - - /* can't use the normal B-Channel stuff */ - avma1pp_init_linktab(sc); - - /* set trace level */ - - sc->sc_trace = TRACE_OFF; - - sc->sc_state = ISAC_IDLE; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - sc->sc_freeflag = 0; - - sc->sc_obuf2 = NULL; - sc->sc_freeflag2 = 0; - -#if defined(__FreeBSD__) && __FreeBSD__ >=3 - callout_handle_init(&sc->sc_T3_callout); - callout_handle_init(&sc->sc_T4_callout); -#endif - - /* init higher protocol layers */ - - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &avma1pp_l1mux_func); - - fail: - splx(s); - return(error); -} - -/* - * this is the real interrupt routine - */ -static void -avma1pp_hscx_intr(int h_chan, u_int stat, struct l1_softc *sc) -{ - register l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int activity = -1; - u_int param = 0; - - NDBGL1(L1_H_IRQ, "%#x", stat); - - if((stat & HSCX_INT_XDU) && (chan->bprot != BPROT_NONE))/* xmit data underrun */ - { - chan->stat_XDU++; - NDBGL1(L1_H_XFRERR, "xmit data underrun"); - /* abort the transmission */ - sc->avma1pp_txl = 0; - sc->avma1pp_cmd |= HSCX_CMD_XRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - sc->avma1pp_cmd &= ~HSCX_CMD_XRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - - if (chan->out_mbuf_head != NULL) /* don't continue to transmit this buffer */ - { - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_cur = chan->out_mbuf_head = NULL; - } - } - - /* - * The following is based on examination of the Linux driver. - * - * The logic here is different than with a "real" HSCX; all kinds - * of information (interrupt/status bits) are in stat. - * HSCX_INT_RPR indicates a receive interrupt - * HSCX_STAT_RDO indicates an overrun condition, abort - - * otherwise read the bytes ((stat & HSCX_STZT_RML_MASK) >> 8) - * HSCX_STAT_RME indicates end-of-frame and apparently any - * CRC/framing errors are only reported in this state. - * if ((stat & HSCX_STAT_CRCVFRRAB) != HSCX_STAT_CRCVFR) - * CRC/framing error - */ - - if(stat & HSCX_INT_RPR) - { - register int fifo_data_len; - int error = 0; - /* always have to read the FIFO, so use a scratch buffer */ - u_char scrbuf[HSCX_FIFO_LEN]; - - if(stat & HSCX_STAT_RDO) - { - chan->stat_RDO++; - NDBGL1(L1_H_XFRERR, "receive data overflow"); - error++; - } - - /* - * check whether we're receiving data for an inactive B-channel - * and discard it. This appears to happen for telephony when - * both B-channels are active and one is deactivated. Since - * it is not really possible to deactivate the channel in that - * case (the ASIC seems to deactivate _both_ channels), the - * "deactivated" channel keeps receiving data which can lead - * to exhaustion of mbufs and a kernel panic. - * - * This is a hack, but it's the only solution I can think of - * without having the documentation for the ASIC. - * GJ - 28 Nov 1999 - */ - if (chan->state == HSCX_IDLE) - { - NDBGL1(L1_H_XFRERR, "toss data from %d", h_chan); - error++; - } - - fifo_data_len = ((stat & HSCX_STAT_RML_MASK) >> 8); - - if(fifo_data_len == 0) - fifo_data_len = sc->sc_bfifolen; - - /* ALWAYS read data from HSCX fifo */ - - HSCX_RDFIFO(h_chan, scrbuf, fifo_data_len); - chan->rxcount += fifo_data_len; - - /* all error conditions checked, now decide and take action */ - - if(error == 0) - { - if(chan->in_mbuf == NULL) - { - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 avma1pp_hscx_intr: RME, cannot allocate mbuf!\n"); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - - if((chan->in_len + fifo_data_len) <= BCH_MAX_DATALEN) - { - /* OK to copy the data */ - bcopy(scrbuf, chan->in_cbptr, fifo_data_len); - chan->in_cbptr += fifo_data_len; - chan->in_len += fifo_data_len; - - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - if (stat & HSCX_STAT_RME) - { - if((stat & HSCX_STAT_CRCVFRRAB) == HSCX_STAT_CRCVFR) - { - (*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit); - activity = ACT_RX; - - /* mark buffer ptr as unused */ - - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - else - { - chan->stat_CRC++; - NDBGL1(L1_H_XFRERR, "CRC/RAB"); - if (chan->in_mbuf != NULL) - { - i4b_Bfreembuf(chan->in_mbuf); - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - } - } - } /* END enough space in mbuf */ - else - { - if(chan->bprot == BPROT_NONE) - { - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - if(!(i4b_l1_bchan_tel_silence(chan->in_mbuf->m_data, chan->in_mbuf->m_len))) - activity = ACT_RX; - - /* move rx'd data to rx queue */ - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - (void) IF_HANDOFF(&chan->rx_queue, chan->in_mbuf, NULL); -#else - if(!(IF_QFULL(&chan->rx_queue))) - { - IF_ENQUEUE(&chan->rx_queue, chan->in_mbuf); - } - else - { - i4b_Bfreembuf(chan->in_mbuf); - } -#endif - /* signal upper layer that data are available */ - (*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit); - - /* alloc new buffer */ - - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 avma1pp_hscx_intr: RPF, cannot allocate new mbuf!\n"); - - /* setup new data ptr */ - - chan->in_cbptr = chan->in_mbuf->m_data; - - /* OK to copy the data */ - bcopy(scrbuf, chan->in_cbptr, fifo_data_len); - - chan->in_cbptr += fifo_data_len; - chan->in_len = fifo_data_len; - - chan->rxcount += fifo_data_len; - } - else - { - NDBGL1(L1_H_XFRERR, "RAWHDLC rx buffer overflow in RPF, in_len=%d", chan->in_len); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - } - } /* if(error == 0) */ - else - { - /* land here for RDO */ - if (chan->in_mbuf != NULL) - { - i4b_Bfreembuf(chan->in_mbuf); - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - sc->avma1pp_txl = 0; - sc->avma1pp_cmd |= HSCX_CMD_RRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - sc->avma1pp_cmd &= ~HSCX_CMD_RRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - } - } - - - /* transmit fifo empty, new data can be written to fifo */ - - if(stat & HSCX_INT_XPR) - { - /* - * for a description what is going on here, please have - * a look at isic_bchannel_start() in i4b_bchan.c ! - */ - - NDBGL1(L1_H_IRQ, "unit %d, chan %d - XPR, Tx Fifo Empty!", sc->sc_unit, h_chan); - - if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */ - { - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) - { - chan->state &= ~HSCX_TX_ACTIVE; - (*chan->isic_drvr_linktab->bch_tx_queue_empty)(chan->isic_drvr_linktab->unit); - } - else - { - chan->state |= HSCX_TX_ACTIVE; - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - } - } - - avma1pp_hscx_fifo(chan, sc); - } - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); -} - -/* - * this is the main routine which checks each channel and then calls - * the real interrupt routine as appropriate - */ -static void -avma1pp_hscx_int_handler(struct l1_softc *sc) -{ - u_int stat; - - /* has to be a u_int because the byte count is in the 2nd byte */ - stat = hscx_read_reg_int(0, HSCX_STAT, sc); - if (stat & HSCX_INT_MASK) - avma1pp_hscx_intr(0, stat, sc); - stat = hscx_read_reg_int(1, HSCX_STAT, sc); - if (stat & HSCX_INT_MASK) - avma1pp_hscx_intr(1, stat, sc); -} - -static void -avma1pp_disable(device_t dev) -{ - struct l1_softc *sc = device_get_softc(dev); - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - bus_space_write_1(btag, bhandle, STAT0_OFFSET, ASL_RESET_ALL|ASL_TIMERDISABLE); -} - -static void -avma1pp_intr(void *xsc) -{ - u_char stat; - struct l1_softc *sc; - bus_space_handle_t bhandle; - bus_space_tag_t btag; - - sc = xsc; - bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - stat = bus_space_read_1(btag, bhandle, STAT0_OFFSET); - NDBGL1(L1_H_IRQ, "stat %x", stat); - /* was there an interrupt from this card ? */ - if ((stat & ASL_IRQ_Pending) == ASL_IRQ_Pending) - return; /* no */ - /* interrupts are low active */ - if (!(stat & ASL_IRQ_TIMER)) - NDBGL1(L1_H_IRQ, "timer interrupt ???"); - if (!(stat & ASL_IRQ_HSCX)) - { - NDBGL1(L1_H_IRQ, "HSCX"); - avma1pp_hscx_int_handler(sc); - } - if (!(stat & ASL_IRQ_ISAC)) - { - NDBGL1(L1_H_IRQ, "ISAC"); - ifpi_isac_intr(sc); - } -} - -static void -avma1pp_hscx_init(struct l1_softc *sc, int h_chan, int activate) -{ - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - u_int param = 0; - - NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", - sc->sc_unit, h_chan, activate ? "activate" : "deactivate"); - - if (activate == 0) - { - /* only deactivate if both channels are idle */ - if (sc->sc_chan[HSCX_CH_A].state != HSCX_IDLE || - sc->sc_chan[HSCX_CH_B].state != HSCX_IDLE) - { - return; - } - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_TRANS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - return; - } - if(chan->bprot == BPROT_RHDLC) - { - NDBGL1(L1_BCHAN, "BPROT_RHDLC"); - - /* HDLC Frames, transparent mode 0 */ - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_ITF_FLG; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - sc->avma1pp_cmd = HSCX_CMD_XRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - sc->avma1pp_cmd = 0; - } - else - { - NDBGL1(L1_BCHAN, "BPROT_NONE??"); - - /* Raw Telephony, extended transparent mode 1 */ - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_TRANS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - sc->avma1pp_cmd = HSCX_CMD_XRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, HSCX_STAT, param, sc); - sc->avma1pp_cmd = 0; - } -} - -static void -avma1pp_bchannel_setup(int unit, int h_chan, int bprot, int activate) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - int s = SPLI4B(); - - if(activate == 0) - { - /* deactivation */ - chan->state = HSCX_IDLE; - avma1pp_hscx_init(sc, h_chan, activate); - } - - NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", - sc->sc_unit, h_chan, activate ? "activate" : "deactivate"); - - /* general part */ - - chan->unit = sc->sc_unit; /* unit number */ - chan->channel = h_chan; /* B channel */ - chan->bprot = bprot; /* B channel protocol */ - chan->state = HSCX_IDLE; /* B channel state */ - - /* receiver part */ - - chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; - - i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ - - chan->rxcount = 0; /* reset rx counter */ - - i4b_Bfreembuf(chan->in_mbuf); /* clean rx mbuf */ - - chan->in_mbuf = NULL; /* reset mbuf ptr */ - chan->in_cbptr = NULL; /* reset mbuf curr ptr */ - chan->in_len = 0; /* reset mbuf data len */ - - /* transmitter part */ - - chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; - - i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ - - chan->txcount = 0; /* reset tx counter */ - - i4b_Bfreembuf(chan->out_mbuf_head); /* clean tx mbuf */ - - chan->out_mbuf_head = NULL; /* reset head mbuf ptr */ - chan->out_mbuf_cur = NULL; /* reset current mbuf ptr */ - chan->out_mbuf_cur_ptr = NULL; /* reset current mbuf data ptr */ - chan->out_mbuf_cur_len = 0; /* reset current mbuf data cnt */ - - if(activate != 0) - { - /* activation */ - avma1pp_hscx_init(sc, h_chan, activate); - chan->state |= HSCX_AVMA1PP_ACTIVE; - } - - splx(s); -} - -static void -avma1pp_bchannel_start(int unit, int h_chan) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - register l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - int activity = -1; - - s = SPLI4B(); /* enter critical section */ - if(chan->state & HSCX_TX_ACTIVE) /* already running ? */ - { - splx(s); - return; /* yes, leave */ - } - - /* get next mbuf from queue */ - - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) /* queue empty ? */ - { - splx(s); /* leave critical section */ - return; /* yes, exit */ - } - - /* init current mbuf values */ - - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - - /* activity indicator for timeout handling */ - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - - chan->state |= HSCX_TX_ACTIVE; /* we start transmitting */ - - if(sc->sc_trace & TRACE_B_TX) /* if trace, send mbuf to trace dev */ - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - avma1pp_hscx_fifo(chan, sc); - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); - - splx(s); -} - -/*---------------------------------------------------------------------------* - * return the address of isic drivers linktab - *---------------------------------------------------------------------------*/ -static isdn_link_t * -avma1pp_ret_linktab(int unit, int channel) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - return(&chan->isic_isdn_linktab); -} - -/*---------------------------------------------------------------------------* - * set the driver linktab in the b channel softc - *---------------------------------------------------------------------------*/ -static void -avma1pp_set_linktab(int unit, int channel, drvr_link_t *dlt) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - chan->isic_drvr_linktab = dlt; -} - - -/*---------------------------------------------------------------------------* - * initialize our local linktab - *---------------------------------------------------------------------------*/ -static void -avma1pp_init_linktab(struct l1_softc *sc) -{ - l1_bchan_state_t *chan = &sc->sc_chan[HSCX_CH_A]; - isdn_link_t *lt = &chan->isic_isdn_linktab; - - /* make sure the hardware driver is known to layer 4 */ - /* avoid overwriting if already set */ - if (ctrl_types[CTRL_PASSIVE].set_linktab == NULL) - { - ctrl_types[CTRL_PASSIVE].set_linktab = i4b_l1_set_linktab; - ctrl_types[CTRL_PASSIVE].get_linktab = i4b_l1_ret_linktab; - } - - /* local setup */ - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_A; - lt->bch_config = avma1pp_bchannel_setup; - lt->bch_tx_start = avma1pp_bchannel_start; - lt->bch_stat = avma1pp_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; - - chan = &sc->sc_chan[HSCX_CH_B]; - lt = &chan->isic_isdn_linktab; - - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_B; - lt->bch_config = avma1pp_bchannel_setup; - lt->bch_tx_start = avma1pp_bchannel_start; - lt->bch_stat = avma1pp_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; -} - -/* - * use this instead of isic_bchannel_stat in i4b_bchan.c because it's static - */ -static void -avma1pp_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - - s = SPLI4B(); - - bsp->outbytes = chan->txcount; - bsp->inbytes = chan->rxcount; - - chan->txcount = 0; - chan->rxcount = 0; - - splx(s); -} - -/*---------------------------------------------------------------------------* - * fill HSCX fifo with data from the current mbuf - * Put this here until it can go into i4b_hscx.c - *---------------------------------------------------------------------------*/ -static int -avma1pp_hscx_fifo(l1_bchan_state_t *chan, struct l1_softc *sc) -{ - int len; - int nextlen; - int i; - int cmd = 0; - /* using a scratch buffer simplifies writing to the FIFO */ - u_char scrbuf[HSCX_FIFO_LEN]; - - len = 0; - - /* - * fill the HSCX tx fifo with data from the current mbuf. if - * current mbuf holds less data than HSCX fifo length, try to - * get the next mbuf from (a possible) mbuf chain. if there is - * not enough data in a single mbuf or in a chain, then this - * is the last mbuf and we tell the HSCX that it has to send - * CRC and closing flag - */ - - while(chan->out_mbuf_cur && len != sc->sc_bfifolen) - { - nextlen = min(chan->out_mbuf_cur_len, sc->sc_bfifolen - len); - -#ifdef NOTDEF - printf("i:mh=%p, mc=%p, mcp=%p, mcl=%d l=%d nl=%d # ", - chan->out_mbuf_head, - chan->out_mbuf_cur, - chan->out_mbuf_cur_ptr, - chan->out_mbuf_cur_len, - len, - nextlen); -#endif - - cmd |= HSCX_CMDR_XTF; - /* collect the data in the scratch buffer */ - for (i = 0; i < nextlen; i++) - scrbuf[i + len] = chan->out_mbuf_cur_ptr[i]; - - len += nextlen; - chan->txcount += nextlen; - - chan->out_mbuf_cur_ptr += nextlen; - chan->out_mbuf_cur_len -= nextlen; - - if(chan->out_mbuf_cur_len == 0) - { - if((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL) - { - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = (chan->channel == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - } - else - { - if (chan->bprot != BPROT_NONE) - cmd |= HSCX_CMDR_XME; - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_head = NULL; - } - } - } - /* write what we have from the scratch buf to the HSCX fifo */ - if (len != 0) - HSCX_WRFIFO(chan->channel, scrbuf, len); - return(cmd); -} - -/*---------------------------------------------------------------------------* - * ifpi - ISAC interrupt routine - *---------------------------------------------------------------------------*/ -static void -ifpi_isac_intr(struct l1_softc *sc) -{ - register u_char isac_irq_stat; - - for(;;) - { - /* get isac irq status */ - isac_irq_stat = ISAC_READ(I_ISTA); - - if(isac_irq_stat) - ifpi_isac_irq(sc, isac_irq_stat); /* isac handler */ - else - break; - } - - ISAC_WRITE(I_MASK, 0xff); - - DELAY(100); - - ISAC_WRITE(I_MASK, ISAC_IMASK); -} - -/*---------------------------------------------------------------------------* - * ifpi_recover - try to recover from irq lockup - *---------------------------------------------------------------------------*/ -void -ifpi_recover(struct l1_softc *sc) -{ - u_char byte; - - /* get isac irq status */ - - byte = ISAC_READ(I_ISTA); - - NDBGL1(L1_ERROR, " ISAC: ISTA = 0x%x", byte); - - if(byte & ISAC_ISTA_EXI) - NDBGL1(L1_ERROR, " ISAC: EXIR = 0x%x", (u_char)ISAC_READ(I_EXIR)); - - if(byte & ISAC_ISTA_CISQ) - { - byte = ISAC_READ(I_CIRR); - - NDBGL1(L1_ERROR, " ISAC: CISQ = 0x%x", byte); - - if(byte & ISAC_CIRR_SQC) - NDBGL1(L1_ERROR, " ISAC: SQRR = 0x%x", (u_char)ISAC_READ(I_SQRR)); - } - - NDBGL1(L1_ERROR, " ISAC: IMASK = 0x%x", ISAC_IMASK); - - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - ISAC_WRITE(I_MASK, ISAC_IMASK); -} diff --git a/sys/i4b/layer1/ifpi2/i4b_ifpi2_ext.h b/sys/i4b/layer1/ifpi2/i4b_ifpi2_ext.h deleted file mode 100644 index 84f44de94bfd..000000000000 --- a/sys/i4b/layer1/ifpi2/i4b_ifpi2_ext.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2001 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi2 - Fritz!Card PCI Version 2 for split layers - * ------------------------------------------ - * - * $Id$ - * - * $FreeBSD$ - * - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IFPI2_EXT_H_ -#define _I4B_IFPI2_EXT_H_ - -#include - -void ifpi2_set_linktab(int , int , drvr_link_t * ); -isdn_link_t *ifpi2_ret_linktab(int , int ); - -int ifpi2_ph_data_req(int , struct mbuf *, int ); -int ifpi2_ph_activate_req(int ); -int ifpi2_mph_command_req(int , int , void *); - -void ifpi2_isacsx_irq(struct l1_softc *, int ); -void ifpi2_isacsx_l1_cmd(struct l1_softc *, int ); -int ifpi2_isacsx_init(struct l1_softc *); - -void ifpi2_recover(struct l1_softc *); -char * ifpi2_printstate(struct l1_softc *); -void ifpi2_next_state(struct l1_softc *, int ); - -#define IFPI2_MAXUNIT 4 -extern struct l1_softc *ifpi2_scp[IFPI2_MAXUNIT]; - -/* the ISACSX has 2 mask registers of interest - cannot use ISAC_IMASK */ -extern unsigned char isacsx_imaskd; -extern unsigned char isacsx_imask; - -#endif /* _I4B_IFPI2_EXT_H_ */ diff --git a/sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c b/sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c deleted file mode 100644 index f0a31820de5e..000000000000 --- a/sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c +++ /dev/null @@ -1,593 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * Copyright (c) 2001 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi2_isac.c - i4b Fritz PCI Version 2 ISACSX handler - * -------------------------------------------- - * $Id$ - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - - -#include - -#include -#include -#include - -#include - -#include -#include - -#include -#include - -#include -#include - -static u_char ifpi2_isacsx_exir_hdlr(register struct l1_softc *sc, u_char exir); -static void ifpi2_isacsx_ind_hdlr(register struct l1_softc *sc, int ind); - -/* the ISACSX has 2 mask registers of interest - cannot use ISAC_IMASK */ -unsigned char isacsx_imaskd; -unsigned char isacsx_imask; - -/*---------------------------------------------------------------------------* - * ISACSX interrupt service routine - *---------------------------------------------------------------------------*/ -void -ifpi2_isacsx_irq(struct l1_softc *sc, int ista) -{ - register u_char c = 0; - register u_char istad = 0; - - NDBGL1(L1_F_MSG, "unit %d: ista = 0x%02x", sc->sc_unit, ista); - - /* was it an HDLC interrupt ? */ - if (ista & ISACSX_ISTA_ICD) - { - istad = ISAC_READ(I_ISTAD); - NDBGL1(L1_F_MSG, "unit %d: istad = 0x%02x", sc->sc_unit, istad); - - if(istad & (ISACSX_ISTAD_RFO|ISACSX_ISTAD_XMR|ISACSX_ISTAD_XDU)) - { - /* not really EXIR, but very similar */ - c |= ifpi2_isacsx_exir_hdlr(sc, istad); - } - } - - if(istad & ISACSX_ISTAD_RME) /* receive message end */ - { - register int rest; - u_char rsta; - - /* get rx status register */ - - rsta = ISAC_READ(I_RSTAD); - - /* Check for Frame and CRC valid */ - if((rsta & ISACSX_RSTAD_MASK) != (ISACSX_RSTAD_VFR|ISACSX_RSTAD_CRC)) - { - int error = 0; - - if(!(rsta & ISACSX_RSTAD_VFR)) /* VFR error */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Frame not valid error", sc->sc_unit); - } - - if(!(rsta & ISACSX_RSTAD_CRC)) /* CRC error */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: CRC error", sc->sc_unit); - } - - if(rsta & ISACSX_RSTAD_RDO) /* ReceiveDataOverflow */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Data Overrun error", sc->sc_unit); - } - - if(rsta & ISACSX_RSTAD_RAB) /* ReceiveABorted */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Receive Aborted error", sc->sc_unit); - } - - if(error == 0) - NDBGL1(L1_I_ERR, "unit %d: RME unknown error, RSTAD = 0x%02x!", sc->sc_unit, rsta); - - i4b_Dfreembuf(sc->sc_ibuf); - - c |= ISACSX_CMDRD_RMC|ISACSX_CMDRD_RRES; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - ISAC_WRITE(I_CMDRD, ISACSX_CMDRD_RMC|ISACSX_CMDRD_RRES); - - return; - } - - rest = (ISAC_READ(I_RBCLD) & (ISACSX_FIFO_LEN-1)); - - if(rest == 0) - rest = ISACSX_FIFO_LEN; - - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(rest)) != NULL) - sc->sc_ib = sc->sc_ibuf->m_data; - else - panic("ifpi2_isacsx_irq: RME, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - rest)) - { - ISAC_RDFIFO(sc->sc_ib, rest); - /* the last byte contains status, strip it */ - sc->sc_ilen += rest - 1; - - sc->sc_ibuf->m_pkthdr.len = - sc->sc_ibuf->m_len = sc->sc_ilen; - - if(sc->sc_trace & TRACE_D_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data); - } - - c |= ISACSX_CMDRD_RMC; - - if(sc->sc_enabled && - (ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S)) - { - i4b_l1_ph_data_ind(L0IFPI2UNIT(sc->sc_unit), sc->sc_ibuf); - } - else - { - i4b_Dfreembuf(sc->sc_ibuf); - } - } - else - { - NDBGL1(L1_I_ERR, "RME, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - c |= ISACSX_CMDRD_RMC|ISACSX_CMDRD_RRES; - } - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - } - - if(istad & ISACSX_ISTAD_RPF) /* receive fifo full */ - { - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(MAX_DFRAME_LEN)) != NULL) - sc->sc_ib= sc->sc_ibuf->m_data; - else - panic("ifpi2_isacsx_irq: RPF, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - ISACSX_FIFO_LEN)) - { - ISAC_RDFIFO(sc->sc_ib, ISACSX_FIFO_LEN); - sc->sc_ilen += ISACSX_FIFO_LEN; - sc->sc_ib += ISACSX_FIFO_LEN; - c |= ISACSX_CMDRD_RMC; - } - else - { - NDBGL1(L1_I_ERR, "RPF, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - c |= ISACSX_CMDRD_RMC|ISACSX_CMDRD_RRES; - } - } - - if(istad & ISACSX_ISTAD_XPR) /* transmit fifo empty (XPR bit set) */ - { - if((sc->sc_obuf2 != NULL) && (sc->sc_obuf == NULL)) - { - sc->sc_freeflag = sc->sc_freeflag2; - sc->sc_obuf = sc->sc_obuf2; - sc->sc_op = sc->sc_obuf->m_data; - sc->sc_ol = sc->sc_obuf->m_len; - sc->sc_obuf2 = NULL; -#ifdef NOTDEF - printf("ob2=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - else - { -#ifdef NOTDEF - printf("ob=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - - if(sc->sc_obuf) - { - ISAC_WRFIFO(sc->sc_op, min(sc->sc_ol, ISACSX_FIFO_LEN)); - - if(sc->sc_ol > ISACSX_FIFO_LEN) /* length > 32 ? */ - { - sc->sc_op += ISACSX_FIFO_LEN; /* bufferptr+32 */ - sc->sc_ol -= ISACSX_FIFO_LEN; /* length - 32 */ - c |= ISACSX_CMDRD_XTF; /* set XTF bit */ - } - else - { - if(sc->sc_freeflag) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_freeflag = 0; - } - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - c |= ISACSX_CMDRD_XTF | ISACSX_CMDRD_XME; - } - } - else - { - sc->sc_state &= ~ISAC_TX_ACTIVE; - } - } - - if(ista & ISACSX_ISTA_CIC) /* channel status change CISQ */ - { - register u_char ci; - - /* get command/indication rx register*/ - - ci = ISAC_READ(I_CIR0); - - /* C/I code change IRQ (flag already cleared by CIR0 read) */ - - if(ci & ISACSX_CIR0_CIC0) - ifpi2_isacsx_ind_hdlr(sc, (ci >> 4) & 0xf); - } - - if(c) - { - ISAC_WRITE(I_CMDRD, c); - } -} - -/*---------------------------------------------------------------------------* - * ISACSX L1 Extended IRQ handler - *---------------------------------------------------------------------------*/ -static u_char -ifpi2_isacsx_exir_hdlr(register struct l1_softc *sc, u_char exir) -{ - u_char c = 0; - - if(exir & ISACSX_ISTAD_XMR) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Message Repeat"); - - c |= ISACSX_CMDRD_XRES; - } - - if(exir & ISACSX_ISTAD_XDU) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Data Underrun"); - - c |= ISACSX_CMDRD_XRES; - } - - if(exir & ISACSX_ISTAD_RFO) - { - NDBGL1(L1_I_ERR, "EXIRQ Rx Frame Overflow"); - - c |= ISACSX_CMDRD_RMC; - } - -#if 0 /* all blocked per default */ - if(exir & ISACSX_EXIR_SOV) - { - NDBGL1(L1_I_ERR, "EXIRQ Sync Xfer Overflow"); - } - - if(exir & ISACSX_EXIR_MOS) - { - NDBGL1(L1_I_ERR, "EXIRQ Monitor Status"); - } - - if(exir & ISACSX_EXIR_SAW) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Subscriber Awake"); - } - - if(exir & ISACSX_EXIR_WOV) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Watchdog Timer Overflow"); - } -#endif - - return(c); -} - -/*---------------------------------------------------------------------------* - * ISACSX L1 Indication handler - *---------------------------------------------------------------------------*/ -static void -ifpi2_isacsx_ind_hdlr(register struct l1_softc *sc, int ind) -{ - register int event; - - switch(ind) - { - case ISACSX_CIR0_IAI8: - NDBGL1(L1_I_CICO, "rx AI8 in state %s", ifpi2_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpi2_isacsx_l1_cmd(sc, CMD_AR8); - event = EV_INFO48; - i4b_l1_mph_status_ind(L0IFPI2UNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISACSX_CIR0_IAI10: - NDBGL1(L1_I_CICO, "rx AI10 in state %s", ifpi2_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpi2_isacsx_l1_cmd(sc, CMD_AR10); - event = EV_INFO410; - i4b_l1_mph_status_ind(L0IFPI2UNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISACSX_CIR0_IRSY: - NDBGL1(L1_I_CICO, "rx RSY in state %s", ifpi2_printstate(sc)); - event = EV_RSY; - break; - - case ISACSX_CIR0_IPU: - NDBGL1(L1_I_CICO, "rx PU in state %s", ifpi2_printstate(sc)); - event = EV_PU; - break; - - case ISACSX_CIR0_IDR: - NDBGL1(L1_I_CICO, "rx DR in state %s", ifpi2_printstate(sc)); - ifpi2_isacsx_l1_cmd(sc, CMD_DIU); - event = EV_DR; - break; - - case ISACSX_CIR0_IDID: - NDBGL1(L1_I_CICO, "rx DID in state %s", ifpi2_printstate(sc)); - event = EV_INFO0; - i4b_l1_mph_status_ind(L0IFPI2UNIT(sc->sc_unit), STI_L1STAT, LAYER_IDLE, NULL); - break; - - case ISACSX_CIR0_IDIS: - NDBGL1(L1_I_CICO, "rx DIS in state %s", ifpi2_printstate(sc)); - event = EV_DIS; - break; - - case ISACSX_CIR0_IEI: - NDBGL1(L1_I_CICO, "rx EI in state %s", ifpi2_printstate(sc)); - ifpi2_isacsx_l1_cmd(sc, CMD_DIU); - event = EV_EI; - break; - - case ISACSX_CIR0_IARD: - NDBGL1(L1_I_CICO, "rx ARD in state %s", ifpi2_printstate(sc)); - event = EV_INFO2; - break; - - case ISACSX_CIR0_ITI: - NDBGL1(L1_I_CICO, "rx TI in state %s", ifpi2_printstate(sc)); - event = EV_INFO0; - break; - - case ISACSX_CIR0_IATI: - NDBGL1(L1_I_CICO, "rx ATI in state %s", ifpi2_printstate(sc)); - event = EV_INFO0; - break; - - case ISACSX_CIR0_ISD: - NDBGL1(L1_I_CICO, "rx SD in state %s", ifpi2_printstate(sc)); - event = EV_INFO0; - break; - - default: - NDBGL1(L1_I_ERR, "UNKNOWN Indication 0x%x in state %s", ind, ifpi2_printstate(sc)); - event = EV_INFO0; - break; - } - ifpi2_next_state(sc, event); -} - -/*---------------------------------------------------------------------------* - * execute a layer 1 command - *---------------------------------------------------------------------------*/ -void -ifpi2_isacsx_l1_cmd(struct l1_softc *sc, int command) -{ - u_char cmd; - -#ifdef I4B_SMP_WORKAROUND - - /* XXXXXXXXXXXXXXXXXXX */ - - /* - * patch from Wolfgang Helbig: - * - * Here is a patch that makes i4b work on an SMP: - * The card (TELES 16.3) didn't interrupt on an SMP machine. - * This is a gross workaround, but anyway it works *and* provides - * some information as how to finally fix this problem. - */ - - HSCX_WRITE(0, H_MASK, 0xff); - HSCX_WRITE(1, H_MASK, 0xff); - ISAC_WRITE(I_MASKD, 0xff); - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - HSCX_WRITE(0, H_MASK, HSCX_A_IMASK); - HSCX_WRITE(1, H_MASK, HSCX_B_IMASK); - ISAC_WRITE(I_MASKD, isacsx_imaskd); - ISAC_WRITE(I_MASK, isacsx_imask); - - /* XXXXXXXXXXXXXXXXXXX */ - -#endif /* I4B_SMP_WORKAROUND */ - - if(command < 0 || command > CMD_ILL) - { - NDBGL1(L1_I_ERR, "illegal cmd 0x%x in state %s", command, ifpi2_printstate(sc)); - return; - } - - cmd = ISACSX_CIX0_LOW; - - switch(command) - { - case CMD_TIM: - NDBGL1(L1_I_CICO, "tx TIM in state %s", ifpi2_printstate(sc)); - cmd |= (ISACSX_CIX0_CTIM << 4); - break; - - case CMD_RS: - NDBGL1(L1_I_CICO, "tx RS in state %s", ifpi2_printstate(sc)); - cmd |= (ISACSX_CIX0_CRS << 4); - break; - - case CMD_AR8: - NDBGL1(L1_I_CICO, "tx AR8 in state %s", ifpi2_printstate(sc)); - cmd |= (ISACSX_CIX0_CAR8 << 4); - break; - - case CMD_AR10: - NDBGL1(L1_I_CICO, "tx AR10 in state %s", ifpi2_printstate(sc)); - cmd |= (ISACSX_CIX0_CAR10 << 4); - break; - - case CMD_DIU: - NDBGL1(L1_I_CICO, "tx DIU in state %s", ifpi2_printstate(sc)); - cmd |= (ISACSX_CIX0_CDIU << 4); - break; - } - ISAC_WRITE(I_CIX0, cmd); -} - -/*---------------------------------------------------------------------------* - * L1 ISACSX initialization - *---------------------------------------------------------------------------*/ -int -ifpi2_isacsx_init(struct l1_softc *sc) -{ - isacsx_imaskd = 0xff; /* disable all irqs */ - isacsx_imask = 0xff; /* disable all irqs */ - - ISAC_WRITE(I_MASKD, isacsx_imaskd); - ISAC_WRITE(I_MASK, isacsx_imask); - - /* the ISACSX only runs in IOM-2 mode */ - NDBGL1(L1_I_SETUP, "configuring for IOM-2 mode"); - - /* TR_CONF0: Transceiver Configuration Register 0: - * DIS_TR - transceiver enabled - * EN_ICV - normal operation - * EXLP - no external loop - * LDD - automatic clock generation - */ - ISAC_WRITE(I_WTR_CONF0, 0); - - /* TR_CONF2: Transceiver Configuration Register 1: - * DIS_TX - transmitter enabled - * PDS - phase deviation 2 S-bits - * RLP - remote line loop open - */ - ISAC_WRITE(I_WTR_CONF2, 0); - - /* MODED: Mode Register: - * MDSx - transparent mode 0 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_WMODED, ISACSX_MODED_MDS2|ISACSX_MODED_MDS1|ISACSX_MODED_RAC|ISACSX_MODED_DIM0); - - /* enabled interrupts: - * =================== - * RME - receive message end - * RPF - receive pool full - * RPO - receive pool overflow - * XPR - transmit pool ready - * XMR - transmit message repeat - * XDU - transmit data underrun - */ - - isacsx_imaskd = ISACSX_MASKD_LOW; - ISAC_WRITE(I_MASKD, isacsx_imaskd); - - /* enabled interrupts: - * =================== - * ICD - HDLC interrupt from D-channel - * CIC - C/I channel change - */ - - isacsx_imask = ~(ISACSX_MASK_ICD | ISACSX_MASK_CIC); - - ISAC_WRITE(I_MASK, isacsx_imask); - - return(0); -} diff --git a/sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.h b/sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.h deleted file mode 100644 index 4d6690546bdc..000000000000 --- a/sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.h +++ /dev/null @@ -1,574 +0,0 @@ -/*- - * Copyright (c) 2001 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * $FreeBSD$ - * - * - *---------------------------------------------------------------------------*/ - -#ifndef I4B_ISACSX_H_ -#define I4B_ISACSX_H_ - -#define ISACSX_FIFO_LEN 32 /* 32 bytes FIFO on chip */ - -#define ISACSX_V13 0x01 - -/* - * definitions of registers and bits for the ISAC-SX ISDN chip. - */ - -typedef struct isacsx_reg { - - /* 32 byte deep FIFO always first */ - - unsigned char isacsx_fifo [ISACSX_FIFO_LEN]; - - /* most registers can be read/written, but have different names */ - /* so define a union with read/write names to make that clear */ - - union { - struct { - unsigned char isacsx_istad; - unsigned char isacsx_stard; - unsigned char isacsx_moded; - unsigned char isacsx_exmd1; - unsigned char isacsx_timr1; - unsigned char dummy_25; - unsigned char isacsx_rbcld; - unsigned char isacsx_rbchd; - unsigned char isacsx_rstad; - unsigned char isacsx_tmd; - unsigned char dummy_2a; - unsigned char dummy_2b; - unsigned char dummy_2c; - unsigned char dummy_2d; - unsigned char isacsx_cir0; - unsigned char isacsx_codr1; - unsigned char isacsx_tr_conf0; - unsigned char isacsx_tr_conf1; - unsigned char isacsx_tr_conf2; - unsigned char isacsx_tr_sta; - unsigned char dummy_34; - unsigned char isacsx_sqrr1; - unsigned char isacsx_sqrr2; - unsigned char isacsx_sqrr3; - unsigned char isacsx_istatr; - unsigned char isacsx_masktr; - unsigned char dummy_3a; - unsigned char dummy_3b; - unsigned char isacsx_acgf2; - unsigned char dummy_3d; - unsigned char dummy_3e; - unsigned char dummy_3f; - unsigned char isacsx_cda10; - unsigned char isacsx_cda11; - unsigned char isacsx_cda20; - unsigned char isacsx_cda21; - unsigned char isacsx_cda_tsdp10; - unsigned char isacsx_cda_tsdp11; - unsigned char isacsx_cda_tsdp20; - unsigned char isacsx_cda_tsdp21; - unsigned char dummy_48; - unsigned char dummy_49; - unsigned char dummy_4a; - unsigned char dummy_4b; - unsigned char isacsx_tr_tsdp_bc1; - unsigned char isacsx_tr_tsdp_bc2; - unsigned char isacsx_cda1_cr; - unsigned char isacsx_cda2_cr; - unsigned char isacsx_tr_cr; - unsigned char dummy_51; - unsigned char dummy_52; - unsigned char isacsx_dci_cr; - unsigned char isacsx_mon_cr; - unsigned char isacsx_sds_cr; - unsigned char dummy_56; - unsigned char isacsx_iom_cr; - unsigned char isacsx_sti; - unsigned char isacsx_msti; - unsigned char isacsx_sds_conf; - unsigned char isacsx_mcda; - unsigned char isacsx_mor; - unsigned char isacsx_mosr; - unsigned char isacsx_mocr; - unsigned char isacsx_msta; - unsigned char isacsx_ista; - unsigned char isacsx_auxi; - unsigned char isacsx_mode1; - unsigned char isacsx_mode2; - unsigned char isacsx_id; - unsigned char isacsx_timr2; - unsigned char dummy_66; - unsigned char dummy_67; - unsigned char dummy_68; - unsigned char dummy_69; - unsigned char dummy_6a; - unsigned char dummy_6b; - unsigned char dummy_6c; - unsigned char dummy_6d; - unsigned char dummy_6e; - unsigned char dummy_6f; - } isacsx_r; - struct { - unsigned char isacsx_maskd; - unsigned char isacsx_cmdrd; - unsigned char isacsx_moded; - unsigned char isacsx_exmd1; - unsigned char isacsx_timr1; - unsigned char isacsx_sap1; - unsigned char isacsx_sap2; - unsigned char isacsx_tei1; - unsigned char isacsx_tei2; - unsigned char isacsx_tmd; - unsigned char dummy_2a; - unsigned char dummy_2b; - unsigned char dummy_2c; - unsigned char dummy_2d; - unsigned char isacsx_cix0; - unsigned char isacsx_codx1; - unsigned char isacsx_tr_conf0; - unsigned char isacsx_tr_conf1; - unsigned char isacsx_tr_conf2; - unsigned char dummy_33; - unsigned char dummy_34; - unsigned char isacsx_sqrx1; - unsigned char dummy_36; - unsigned char dummy_37; - unsigned char dummy_38; - unsigned char isacsx_masktr; - unsigned char dummy_3a; - unsigned char dummy_3b; - unsigned char isacsx_acgf2; - unsigned char dummy_3d; - unsigned char dummy_3e; - unsigned char dummy_3f; - unsigned char isacsx_cda10; - unsigned char isacsx_cda11; - unsigned char isacsx_cda20; - unsigned char isacsx_cda21; - unsigned char isacsx_cda_tsdp10; - unsigned char isacsx_cda_tsdp11; - unsigned char isacsx_cda_tsdp20; - unsigned char isacsx_cda_tsdp21; - unsigned char dummy_48; - unsigned char dummy_49; - unsigned char dummy_4a; - unsigned char dummy_4b; - unsigned char isacsx_tr_tsdp_bc1; - unsigned char isacsx_tr_tsdp_bc2; - unsigned char isacsx_cda1_cr; - unsigned char isacsx_cda2_cr; - unsigned char isacsx_tr_cr; - unsigned char dummy_51; - unsigned char dummy_52; - unsigned char isacsx_dci_cr; - unsigned char isacsx_mon_cr; - unsigned char isacsx_sds_cr; - unsigned char dummy_56; - unsigned char isacsx_iom_cr; - unsigned char isacsx_asti; - unsigned char isacsx_msti; - unsigned char isacsx_sds_conf; - unsigned char dummy_5b; - unsigned char isacsx_mox; - unsigned char dummy_5d; - unsigned char isacsx_mocr; - unsigned char isacsx_mconf; - unsigned char isacsx_mask; - unsigned char isacsx_auxm; - unsigned char isacsx_mode1; - unsigned char isacsx_mode2; - unsigned char isacsx_sres; - unsigned char isacsx_timr2; - unsigned char dummy_66; - unsigned char dummy_67; - unsigned char dummy_68; - unsigned char dummy_69; - unsigned char dummy_6a; - unsigned char dummy_6b; - unsigned char dummy_6c; - unsigned char dummy_6d; - unsigned char dummy_6e; - unsigned char dummy_6f; - } isacsx_w; - } isacsx_rw; -} isacsx_reg_t; - -#define REG_OFFSET(type, field) (int)(&(((type *)0)->field)) - -/* ISACSX read registers */ - -#define i_istad isacsx_rw.isacsx_r.isacsx_istad -#define I_ISTAD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_istad) -#define i_stard isacsx_rw.isacsx_r.isacsx_stard -#define I_STARD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_stard) -#define i_rmoded isacsx_rw.isacsx_r.isacsx_moded -#define I_RMODED REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_moded) -#define i_rexmd1 isacsx_rw.isacsx_r.isacsx_exmd1 -#define I_REXMD1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_exmd1) -#define i_rtimr1 isacsx_rw.isacsx_r.isacsx_timr1 -#define I_RTIMR1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_timr1) -#define i_rbcld isacsx_rw.isacsx_r.isacsx_rbcld -#define I_RBCLD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_rbcld) -#define i_rbchd isacsx_rw.isacsx_r.isacsx_rbchd -#define I_RBCHD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_rbchd) -#define i_rstad isacsx_rw.isacsx_r.isacsx_rstad -#define I_RSTAD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_rstad) -#define i_rtmd isacsx_rw.isacsx_r.isacsx_tmd -#define I_RTMD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tmd) -#define i_cir0 isacsx_rw.isacsx_r.isacsx_cir0 -#define I_CIR0 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cir0) -#define i_codr1 isacsx_rw.isacsx_r.isacsx_codr1 -#define I_CODR1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_codr1) -#define i_rtr_conf0 isacsx_rw.isacsx_r.isacsx_tr_conf0 -#define I_RTR_CONF0 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_conf0) -#define i_rtr_conf1 isacsx_rw.isacsx_r.isacsx_tr_conf1 -#define I_RTR_CONF1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_conf1) -#define i_rtr_conf2 isacsx_rw.isacsx_r.isacsx_tr_conf2 -#define I_RTR_CONF2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_conf2) -#define i_sta isacsx_rw.isacsx_r.isacsx_sta -#define I_STA REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sta) -#define i_sqrr1 isacsx_rw.isacsx_r.isacsx_sqrr1 -#define I_SQRR1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sqrr1) -#define i_sqrr2 isacsx_rw.isacsx_r.isacsx_sqrr2 -#define I_SQRR2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sqrr2) -#define i_sqrr3 isacsx_rw.isacsx_r.isacsx_sqrr3 -#define I_SQRR3 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sqrr3) -#define i_istatr isacsx_rw.isacsx_r.isacsx_istatr -#define I_ISTATR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_istatr) -#define i_rmasktr isacsx_rw.isacsx_r.isacsx_masktr -#define I_RMASKTR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_masktr) -#define i_racgf2 isacsx_rw.isacsx_r.isacsx_acgf2 -#define I_RACGF2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_acgf2) -#define i_rcda10 isacsx_rw.isacsx_r.isacsx_cda10 -#define I_RCDA10 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda10) -#define i_rcda11 isacsx_rw.isacsx_r.isacsx_cda11 -#define I_RCDA11 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda11) -#define i_rcda20 isacsx_rw.isacsx_r.isacsx_cda20 -#define I_RCDA20 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda20) -#define i_rcda21 isacsx_rw.isacsx_r.isacsx_cda21 -#define I_RCDA21 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda21) -#define i_cda_tsdp10 isacsx_rw.isacsx_r.isacsx_cda_tsdp10 -#define I_CDA_TSDP10 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda_tsdp10) -#define i_cda_tsdp11 isacsx_rw.isacsx_r.isacsx_cda_tsdp11 -#define I_CDA_TSDP11 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda_tsdp11) -#define i_cda_tsdp20 isacsx_rw.isacsx_r.isacsx_cda_tsdp20 -#define I_CDA_TSDP20 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda_tsdp20) -#define i_cda_tsdp21 isacsx_rw.isacsx_r.isacsx_cda_tsdp21 -#define I_CDA_TSDP21 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda_tsdp21) -#define i_tr_tsdp_bc1 isacsx_rw.isacsx_r.isacsx_tr_tsdp_bc1 -#define I_TR_TSDP_BC1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_tsdp_bc1) -#define i_tr_tsdp_bc2 isacsx_rw.isacsx_r.isacsx_tr_tsdp_bc2 -#define I_TR_TSDP_BC2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_tsdp_bc2) -#define i_cda1_cr isacsx_rw.isacsx_r.isacsx_cda1_cr -#define I_CDA1_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda1_cr) -#define i_cda2_cr isacsx_rw.isacsx_r.isacsx_cda2_cr -#define I_CDA2_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda2_cr) -#define i_tr_cr isacsx_rw.isacsx_r.isacsx_tr_cr -#define I_TR_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_cr) -#define i_dci_cr isacsx_rw.isacsx_r.isacsx_dci_cr -#define I_DCI_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_dci_cr) -#define i_mon_cr isacsx_rw.isacsx_r.isacsx_mon_cr -#define I_MON_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_mon_cr) -#define i_sds_cr isacsx_rw.isacsx_r.isacsx_sds_cr -#define I_SDS_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sds_cr) -#define i_iom_cr isacsx_rw.isacsx_r.isacsx_iom_cr -#define I_IOM_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_iom_cr) -#define i_sti isacsx_rw.isacsx_r.isacsx_sti -#define I_STI REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sti) -#define i_msti isacsx_rw.isacsx_r.isacsx_msti -#define I_MSTI REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_msti) -#define i_sds_conf isacsx_rw.isacsx_r.isacsx_sds_conf -#define I_SDS_CONF REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sds_conf) -#define i_mcda isacsx_rw.isacsx_r.isacsx_mcda -#define I_MCDA REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_mcda) -#define i_mor isacsx_rw.isacsx_r.isacsx_mor -#define I_MOR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_mor) -#define i_mosr isacsx_rw.isacsx_r.isacsx_mosr -#define I_MOSR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_mosr) -#define i_rmocr isacsx_rw.isacsx_r.isacsx_mocr -#define I_RMOCR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_mocr) -#define i_msta isacsx_rw.isacsx_r.isacsx_msta -#define I_MSTA REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_msta) -#define i_ista isacsx_rw.isacsx_r.isacsx_ista -#define I_ISTA REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_ista) -#define i_auxi isacsx_rw.isacsx_r.isacsx_auxi -#define I_AUXI REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_auxi) -#define i_rmode1 isacsx_rw.isacsx_r.isacsx_mode1 -#define I_RMODE1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_mode1) -#define i_rmode2 isacsx_rw.isacsx_r.isacsx_mode2 -#define I_RMODE2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_mode2) -#define i_id isacsx_rw.isacsx_r.isacsx_id -#define I_ID REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_id) -#define i_rtimr2 isacsx_rw.isacsx_r.isacsx_timr2 -#define I_RTIMR2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_timr2) - -/* ISAC write registers - isacsx_mode, isacsx_timr, isacsx_star2, isacsx_spcr, */ -/* isacsx_c1r, isacsx_c2r, isacsx_adf2 see read registers */ - -#define i_maskd isacsx_rw.isacsx_w.isacsx_maskd -#define I_MASKD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_maskd) -#define i_cmdrd isacsx_rw.isacsx_w.isacsx_cmdrd -#define I_CMDRD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_cmdrd) -#define i_wmoded isacsx_rw.isacsx_w.isacsx_moded -#define I_WMODED REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_moded) -#define i_wexmd1 isacsx_rw.isacsx_w.isacsx_exmd1 -#define I_WEXMD1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_exmd1) -#define i_wtimr1 isacsx_rw.isacsx_w.isacsx_timr1 -#define I_WTIMR1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_timr1) -#define i_sap1 isacsx_rw.isacsx_w.isacsx_sap1 -#define I_SAP1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_sap1) -#define i_sap2 isacsx_rw.isacsx_w.isacsx_sap2 -#define I_SAP2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_sap2) -#define i_tei1 isacsx_rw.isacsx_w.isacsx_tei1 -#define i_tei2 isacsx_rw.isacsx_w.isacsx_tei2 -#define i_wtmd isacsx_rw.isacsx_w.isacsx_tmd -#define I_WTMD REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_tmd) -#define i_cix0 isacsx_rw.isacsx_w.isacsx_cix0 -#define I_CIX0 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_cix0) -#define i_codx1 isacsx_rw.isacsx_w.isacsx_codx1 -#define I_CODX1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_codx1) -#define i_wtr_conf0 isacsx_rw.isacsx_w.isacsx_tr_conf0 -#define I_WTR_CONF0 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_tr_conf0) -#define i_wtr_conf1 isacsx_rw.isacsx_w.isacsx_tr_conf1 -#define I_WTR_CONF1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_tr_conf1) -#define i_wtr_conf2 isacsx_rw.isacsx_w.isacsx_tr_conf2 -#define I_WTR_CONF2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_tr_conf2) -#define i_sqrx1 isacsx_rw.isacsx_w.isacsx_sqrx1 -#define I_SQRX1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_sqrx1) -#define i_wmasktr isacsx_rw.isacsx_w.isacsx_masktr -#define I_WMASKTR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_masktr) -#define i_wacgf2 isacsx_rw.isacsx_w.isacsx_acgf2 -#define I_WACGF2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_acgf2) -#define i_wcda10 isacsx_rw.isacsx_w.isacsx_cda10 -#define I_WCDA10 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_cda10) -#define i_wcda11 isacsx_rw.isacsx_r.isacsx_cda11 -#define I_WCDA11 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda11) -#define i_wcda20 isacsx_rw.isacsx_r.isacsx_cda20 -#define I_WCDA20 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda20) -#define i_wcda21 isacsx_rw.isacsx_r.isacsx_cda21 -#define I_WCDA21 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda21) -#define i_cda_tsdp10 isacsx_rw.isacsx_r.isacsx_cda_tsdp10 -#define I_CDA_TSDP10 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda_tsdp10) -#define i_cda_tsdp11 isacsx_rw.isacsx_r.isacsx_cda_tsdp11 -#define I_CDA_TSDP11 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda_tsdp11) -#define i_cda_tsdp20 isacsx_rw.isacsx_r.isacsx_cda_tsdp20 -#define I_CDA_TSDP20 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda_tsdp20) -#define i_cda_tsdp21 isacsx_rw.isacsx_r.isacsx_cda_tsdp21 -#define I_CDA_TSDP21 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda_tsdp21) -#define i_tr_tsdp_bc1 isacsx_rw.isacsx_r.isacsx_tr_tsdp_bc1 -#define I_TR_TSDP_BC1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_tsdp_bc1) -#define i_tr_tsdp_bc2 isacsx_rw.isacsx_r.isacsx_tr_tsdp_bc2 -#define I_TR_TSDP_BC2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_tsdp_bc2) -#define i_cda1_cr isacsx_rw.isacsx_r.isacsx_cda1_cr -#define I_CDA1_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda1_cr) -#define i_cda2_cr isacsx_rw.isacsx_r.isacsx_cda2_cr -#define I_CDA2_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_cda2_cr) -#define i_tr_cr isacsx_rw.isacsx_r.isacsx_tr_cr -#define I_TR_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_tr_cr) -#define i_dci_cr isacsx_rw.isacsx_r.isacsx_dci_cr -#define I_DCI_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_dci_cr) -#define i_mon_cr isacsx_rw.isacsx_r.isacsx_mon_cr -#define I_MON_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_mon_cr) -#define i_sds_cr isacsx_rw.isacsx_r.isacsx_sds_cr -#define I_SDS_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sds_cr) -#define i_iom_cr isacsx_rw.isacsx_r.isacsx_iom_cr -#define I_IOM_CR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_iom_cr) -#define i_asti isacsx_rw.isacsx_r.isacsx_asti -#define I_ASTI REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_asti) -#define i_msti isacsx_rw.isacsx_r.isacsx_msti -#define I_MSTI REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_msti) -#define i_sds_conf isacsx_rw.isacsx_r.isacsx_sds_conf -#define I_SDS_CONF REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_r.isacsx_sds_conf) -#define i_mox isacsx_rw.isacsx_w.isacsx_mox -#define I_MOX REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_mox) -#define i_wmocr isacsx_rw.isacsx_w.isacsx_mocr -#define I_WMOCR REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_mocr) -#define i_mconf isacsx_rw.isacsx_w.isacsx_mconf -#define I_MCONF REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_mconf) -#define i_mask isacsx_rw.isacsx_w.isacsx_mask -#define I_MASK REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_mask) -#define i_auxm isacsx_rw.isacsx_w.isacsx_auxm -#define I_AUXM REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_auxm) -#define i_wmode1 isacsx_rw.isacsx_w.isacsx_mode1 -#define I_WMODE1 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_mode1) -#define i_wmode2 isacsx_rw.isacsx_w.isacsx_mode2 -#define I_WMODE2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_mode2) -#define i_sres isacsx_rw.isacsx_w.isacsx_sres -#define I_SRES REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_sres) -#define i_wtimr2 isacsx_rw.isacsx_w.isacsx_timr2 -#define I_WTIMR2 REG_OFFSET(isacsx_reg_t, isacsx_rw.isacsx_w.isacsx_timr2) - -#define ISACSX_ISTAD_RME 0x80 -#define ISACSX_ISTAD_RPF 0x40 -#define ISACSX_ISTAD_RFO 0x20 -#define ISACSX_ISTAD_XPR 0x10 -#define ISACSX_ISTAD_XMR 0x08 -#define ISACSX_ISTAD_XDU 0x04 - -#define ISACSX_MASKD_RME 0x80 -#define ISACSX_MASKD_RPF 0x40 -#define ISACSX_MASKD_RFO 0x20 -#define ISACSX_MASKD_XPR 0x10 -#define ISACSX_MASKD_XMR 0x08 -#define ISACSX_MASKD_XDU 0x04 -/* these must always be set */ -#define ISACSX_MASKD_LOW 0x03 -#define ISACSX_MASKD_ALL 0xff - -#define ISACSX_STARD_XDOV 0x80 -#define ISACSX_STARD_XFW 0x40 -#define ISACSX_STARD_RAC1 0x08 -#define ISACSX_STARD_XAC1 0x02 - -#define ISACSX_CMDRD_RMC 0x80 -#define ISACSX_CMDRD_RRES 0x40 -#define ISACSX_CMDRD_STI 0x10 -#define ISACSX_CMDRD_XTF 0x08 -#define ISACSX_CMDRD_XME 0x02 -#define ISACSX_CMDRD_XRES 0x01 - -#define ISACSX_MODED_MDS2 0x80 -#define ISACSX_MODED_MDS1 0x40 -#define ISACSX_MODED_MDS0 0x20 -#define ISACSX_MODED_RAC 0x08 -#define ISACSX_MODED_DIM2 0x04 -#define ISACSX_MODED_DIM1 0x02 -#define ISACSX_MODED_DIM0 0x01 - -/* default */ -#define ISACSX_EXMD1_XFBS_32 0x00 /* XFIFO is 32 bytes */ -#define ISACSX_EXMD1_XFBS_16 0x80 /* XFIFO is 16 bytes */ -/* default */ -#define ISACSX_EXMD1_RFBS_32 0x00 /* XFIFO is 32 bytes */ -#define ISACSX_EXMD1_RFBS_16 0x20 /* XFIFO is 16 bytes */ -#define ISACSX_EXMD1_RFBS_08 0x40 /* XFIFO is 8 bytes */ -#define ISACSX_EXMD1_RFBS_04 0x60 /* XFIFO is 4 bytes */ -#define ISACSX_EXMD1_SRA 0x10 -#define ISACSX_EXMD1_XCRC 0x08 -#define ISACSX_EXMD1_RCRC 0x04 -#define ISACSX_EXMD1_ITF 0x01 - -#define ISACSX_RSTAD_VFR 0x80 -#define ISACSX_RSTAD_RDO 0x40 -#define ISACSX_RSTAD_CRC 0x20 -#define ISACSX_RSTAD_RAB 0x10 -#define ISACSX_RSTAD_SA1 0x08 -#define ISACSX_RSTAD_SA0 0x04 -#define ISACSX_RSTAD_CR 0x02 -#define ISACSX_RSTAD_TA 0x01 - -#define ISACSX_RSTAD_MASK 0xf0 /* the interesting bits */ - -#define ISACSX_RBCHD_OV 0x10 -/* the other 4 bits are the high bits of the receive byte count */ - -#define ISACSX_CIR0_CIC0 0x08 -/* CODR0 >> 4 */ -#define ISACSX_CIR0_IPU 0x07 -#define ISACSX_CIR0_IDR 0x00 -#define ISACSX_CIR0_ISD 0x02 -#define ISACSX_CIR0_IDIS 0x03 -#define ISACSX_CIR0_IEI 0x06 -#define ISACSX_CIR0_IRSY 0x04 -#define ISACSX_CIR0_IARD 0x08 -#define ISACSX_CIR0_ITI 0x0a -#define ISACSX_CIR0_IATI 0x0b -#define ISACSX_CIR0_IAI8 0x0c -#define ISACSX_CIR0_IAI10 0x0d -#define ISACSX_CIR0_IDID 0x0f - -#define ISACSX_IOM_CR_SPU 0x80 -#define ISACSX_IOM_CR_CI_CS 0x20 -#define ISACSX_IOM_CR_TIC_DIS 0x10 -#define ISACSX_IOM_CR_EN_BCL 0x08 -#define ISACSX_IOM_CR_CLKM 0x04 -#define ISACSX_IOM_CR_DIS_OD 0x02 -#define ISACSX_IOM_CR_DIS_IOM 0x01 - -#define ISACSX_CI_MASK 0x0f - -#define ISACSX_CIX0_BAC 0x01 -/* in IOM-2 mode the low bits are always 1 */ -#define ISACSX_CIX0_LOW 0x0e -/* C/I codes from bits 7-4 (>> 4 & 0xf) */ -/* the commands */ -#define ISACSX_CIX0_CTIM 0 -#define ISACSX_CIX0_CRS 0x01 -/* test mode only */ -#define ISACSX_CIX0_CSSSP 0x02 -/* test mode only */ -#define ISACSX_CIX0_CSSCP 0x03 -#define ISACSX_CIX0_CAR8 0x08 -#define ISACSX_CIX0_CAR10 0x09 -#define ISACSX_CIX0_CARL 0x0a -#define ISACSX_CIX0_CDIU 0x0f - -/* Interrupt, General Configuration Registers */ - -#define ISACSX_ISTA_ST 0x20 -#define ISACSX_ISTA_CIC 0x10 -#define ISACSX_ISTA_AUX 0x08 -#define ISACSX_ISTA_TRAN 0x04 -#define ISACSX_ISTA_MOS 0x02 -#define ISACSX_ISTA_ICD 0x01 - -#define ISACSX_MASK_ST 0x20 -#define ISACSX_MASK_CIC 0x10 -#define ISACSX_MASK_AUX 0x08 -#define ISACSX_MASK_TRAN 0x04 -#define ISACSX_MASK_MOS 0x02 -#define ISACSX_MASK_ICD 0x01 - -#define ISACSX_AUXI_EAW 0x20 -#define ISACSX_AUXI_WOV 0x10 -#define ISACSX_AUXI_TIN2 0x08 -#define ISACSX_AUXI_TIN1 0x04 - -#define ISACSX_AUXM_EAW 0x20 -#define ISACSX_AUXM_WOV 0x10 -#define ISACSX_AUXM_TIN2 0x08 -#define ISACSX_AUXM_TIN1 0x04 - -#define ISACSX_MODE1_WTC1 0x10 -#define ISACSX_MODE1_WTC2 0x08 -#define ISACSX_MODE1_CFS 0x04 -#define ISACSX_MODE1_RSS2 0x02 -#define ISACSX_MODE1_RSS1 0x01 - -#define ISACSX_MODE2_INT_POL 0x08 -#define ISACSX_MODE2_PPSDX 0x01 - -#define ISACSX_ID_MASK 0x2F /* 0x01 = Version 1.3 */ - -#endif /* I4B_ISACSX_H_ */ diff --git a/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1.c b/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1.c deleted file mode 100644 index 33defe348394..000000000000 --- a/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1.c +++ /dev/null @@ -1,236 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * Copyright (c) 2001 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi2_l1.c - AVM Fritz PCI Version 2 layer 1 handler - * --------------------------------------------- - * $Id$ - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-DATA-REQUEST - * ========================= - * - * parms: - * unit physical interface unit number - * m mbuf containing L2 frame to be sent out - * freeflag MBUF_FREE: free mbuf here after having sent - * it out - * MBUF_DONTFREE: mbuf is freed by Layer 2 - * returns: - * ==0 fail, nothing sent out - * !=0 ok, frame sent out - * - *---------------------------------------------------------------------------*/ -int -ifpi2_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - u_char cmd; - int s; - struct l1_softc *sc = ifpi2_scp[unit]; - -#ifdef NOTDEF - NDBGL1(L1_PRIM, "PH-DATA-REQ, unit %d, freeflag=%d", unit, freeflag); -#endif - - if(m == NULL) /* failsafe */ - return (0); - - s = SPLI4B(); - - if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ - { - NDBGL1(L1_I_ERR, "still in state F3!"); - ifpi2_ph_activate_req(unit); - } - - if(sc->sc_state & ISAC_TX_ACTIVE) - { - if(sc->sc_obuf2 == NULL) - { - sc->sc_obuf2 = m; /* save mbuf ptr */ - - if(freeflag) - sc->sc_freeflag2 = 1; /* IRQ must mfree */ - else - sc->sc_freeflag2 = 0; /* IRQ must not mfree */ - - NDBGL1(L1_I_MSG, "using 2nd ISAC TX buffer, state = %s", ifpi2_printstate(sc)); - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPI2UNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - splx(s); - return(1); - } - - NDBGL1(L1_I_ERR, "No Space in TX FIFO, state = %s", ifpi2_printstate(sc)); - - if(freeflag == MBUF_FREE) - i4b_Dfreembuf(m); - - splx(s); - return (0); - } - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPI2UNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - sc->sc_state |= ISAC_TX_ACTIVE; /* set transmitter busy flag */ - - NDBGL1(L1_I_MSG, "ISAC_TX_ACTIVE set"); - - sc->sc_freeflag = 0; /* IRQ must NOT mfree */ - - ISAC_WRFIFO(m->m_data, min(m->m_len, ISAC_FIFO_LEN)); /* output to TX fifo */ - - if(m->m_len > ISAC_FIFO_LEN) /* message > 32 bytes ? */ - { - sc->sc_obuf = m; /* save mbuf ptr */ - sc->sc_op = m->m_data + ISAC_FIFO_LEN; /* ptr for irq hdl */ - sc->sc_ol = m->m_len - ISAC_FIFO_LEN; /* length for irq hdl */ - - if(freeflag) - sc->sc_freeflag = 1; /* IRQ must mfree */ - - cmd = ISAC_CMDR_XTF; - } - else - { - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - if(freeflag) - i4b_Dfreembuf(m); - - cmd = ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - - ISAC_WRITE(I_CMDR, cmd); - ISACCMDRWRDELAY(); - - splx(s); - - return(1); -} - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-ACTIVATE-REQUEST - * ============================= - * - * parms: - * unit physical interface unit number - * - * returns: - * ==0 - * !=0 - * - *---------------------------------------------------------------------------*/ -int -ifpi2_ph_activate_req(int unit) -{ - struct l1_softc *sc = ifpi2_scp[unit]; - NDBGL1(L1_PRIM, "PH-ACTIVATE-REQ, unit %d", unit); - ifpi2_next_state(sc, EV_PHAR); - return(0); -} - -/*---------------------------------------------------------------------------* - * command from the upper layers - *---------------------------------------------------------------------------*/ -int -ifpi2_mph_command_req(int unit, int command, void *parm) -{ - struct l1_softc *sc = ifpi2_scp[unit]; - - switch(command) - { - case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DOPEN", unit); - sc->sc_enabled = 1; - break; - - case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DCLOSE", unit); - sc->sc_enabled = 0; - break; - - case CMR_SETTRACE: - NDBGL1(L1_PRIM, "unit %d, command = CMR_SETTRACE, parm = %d", unit, (unsigned int)parm); - sc->sc_trace = (unsigned int)parm; - break; - - default: - NDBGL1(L1_ERROR, "ERROR, unknown command = %d, unit = %d, parm = %d", command, unit, (unsigned int)parm); - break; - } - - return(0); -} diff --git a/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c b/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c deleted file mode 100644 index 58b87e7897b5..000000000000 --- a/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c +++ /dev/null @@ -1,508 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi2_l1fsm.c - AVM Fritz PCI layer 1 I.430 state machine - * ------------------------------------------------------------ - * $Id$ - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include - -#include - -#include - -#include - -#if DO_I4B_DEBUG -static char *state_text[N_STATES] = { - "F3 Deactivated", - "F4 Awaiting Signal", - "F5 Identifying Input", - "F6 Synchronized", - "F7 Activated", - "F8 Lost Framing", - "Illegal State" -}; - -static char *event_text[N_EVENTS] = { - "EV_PHAR PH_ACT_REQ", - "EV_T3 Timer 3 expired", - "EV_INFO0 INFO0 received", - "EV_RSY Level Detected", - "EV_INFO2 INFO2 received", - "EV_INFO48 INFO4 received", - "EV_INFO410 INFO4 received", - "EV_DR Deactivate Req", - "EV_PU Power UP", - "EV_DIS Disconnected", - "EV_EI Error Ind", - "Illegal Event" -}; -#endif - -/* Function prototypes */ - -static void timer3_expired (struct l1_softc *sc); -static void T3_start (struct l1_softc *sc); -static void T3_stop (struct l1_softc *sc); -static void F_T3ex (struct l1_softc *sc); -static void timer4_expired (struct l1_softc *sc); -static void T4_start (struct l1_softc *sc); -static void T4_stop (struct l1_softc *sc); -static void F_AI8 (struct l1_softc *sc); -static void F_AI10 (struct l1_softc *sc); -static void F_I01 (struct l1_softc *sc); -static void F_I02 (struct l1_softc *sc); -static void F_I03 (struct l1_softc *sc); -static void F_I2 (struct l1_softc *sc); -static void F_ill (struct l1_softc *sc); -static void F_NULL (struct l1_softc *sc); - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expire function - *---------------------------------------------------------------------------*/ -static void -timer3_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T3) - { - NDBGL1(L1_T_ERR, "state = %s", ifpi2_printstate(sc)); - sc->sc_I430T3 = 0; - - /* XXX try some recovery here XXX */ - - ifpi2_recover(sc); - - sc->sc_init_tries++; /* increment retry count */ - -/*XXX*/ if(sc->sc_init_tries > 4) - { - int s = SPLI4B(); - - sc->sc_init_tries = 0; - - if(sc->sc_obuf2 != NULL) - { - i4b_Dfreembuf(sc->sc_obuf2); - sc->sc_obuf2 = NULL; - } - if(sc->sc_obuf != NULL) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_obuf = NULL; - sc->sc_freeflag = 0; - sc->sc_op = NULL; - sc->sc_ol = 0; - } - - splx(s); - - i4b_l1_mph_status_ind(L0IFPI2UNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); - } - - ifpi2_next_state(sc, EV_T3); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 start - *---------------------------------------------------------------------------*/ -static void -T3_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi2_printstate(sc)); - sc->sc_I430T3 = 1; - sc->sc_T3_callout = timeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, 2*hz); -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 stop - *---------------------------------------------------------------------------*/ -static void -T3_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi2_printstate(sc)); - - sc->sc_init_tries = 0; /* init connect retry count */ - - if(sc->sc_I430T3) - { - sc->sc_I430T3 = 0; - untimeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, sc->sc_T3_callout); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expiry - *---------------------------------------------------------------------------*/ -static void -F_T3ex(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_T3ex executing"); - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPI2UNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * Timer T4 expire function - *---------------------------------------------------------------------------*/ -static void -timer4_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T4) - { - NDBGL1(L1_T_MSG, "state = %s", ifpi2_printstate(sc)); - sc->sc_I430T4 = 0; - i4b_l1_mph_status_ind(L0IFPI2UNIT(sc->sc_unit), STI_PDEACT, 0, NULL); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * Timer T4 start - *---------------------------------------------------------------------------*/ -static void -T4_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi2_printstate(sc)); - sc->sc_I430T4 = 1; - sc->sc_T4_callout = timeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, hz); -} - -/*---------------------------------------------------------------------------* - * Timer T4 stop - *---------------------------------------------------------------------------*/ -static void -T4_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi2_printstate(sc)); - - if(sc->sc_I430T4) - { - sc->sc_I430T4 = 0; - untimeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, sc->sc_T4_callout); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI8 - *---------------------------------------------------------------------------*/ -static void -F_AI8(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI8 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPI2UNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_8; - - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI10 - *---------------------------------------------------------------------------*/ -static void -F_AI10(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI10 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPI2UNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_10; - - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in states F3 .. F5 - *---------------------------------------------------------------------------*/ -static void -F_I01(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I01 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F6 - *---------------------------------------------------------------------------*/ -static void -F_I02(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I02 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPI2UNIT(sc->sc_unit)); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F7 or F8 - *---------------------------------------------------------------------------*/ -static void -F_I03(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I03 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPI2UNIT(sc->sc_unit)); - - T4_start(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: activate request - *---------------------------------------------------------------------------*/ -static void -F_AR(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO1_8; - - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_TE; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - - ifpi2_isacsx_l1_cmd(sc, CMD_AR8); - - T3_start(sc); -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO2 - *---------------------------------------------------------------------------*/ -static void -F_I2(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I2 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO2; - - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - -} - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(struct l1_softc *sc) -{ - NDBGL1(L1_F_ERR, "FSM function F_ill executing"); -} - -/*---------------------------------------------------------------------------* - * No action - *---------------------------------------------------------------------------*/ -static void -F_NULL(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_NULL executing"); -} - - -/*---------------------------------------------------------------------------* - * layer 1 state transition table - *---------------------------------------------------------------------------*/ -struct ifpi2_state_tab { - void (*func) (struct l1_softc *sc); /* function to execute */ - int newstate; /* next state */ -} ifpi2_state_tab[N_EVENTS][N_STATES] = { - -/* STATE: F3 F4 F5 F6 F7 F8 ILLEGAL STATE */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* EV_PHAR x*/ {{F_AR, ST_F4}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_ill, ST_ILL}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_T3 x*/ {{F_NULL, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO0 */ {{F_I01, ST_F3}, {F_I01, ST_F4}, {F_I01, ST_F5}, {F_I02, ST_F3}, {F_I03, ST_F3}, {F_I03, ST_F3}, {F_ill, ST_ILL}}, -/* EV_RSY x*/ {{F_NULL, ST_F3}, {F_NULL, ST_F5}, {F_NULL, ST_F5}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO2 */ {{F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_ill, ST_ILL}}, -/* EV_INFO48*/ {{F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_NULL, ST_F7}, {F_AI8, ST_F7}, {F_ill, ST_ILL}}, -/* EV_INFO41*/ {{F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_NULL, ST_F7}, {F_AI10, ST_F7}, {F_ill, ST_ILL}}, -/* EV_DR */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_PU */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_DIS */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_EI */ {{F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_ill, ST_ILL}}, -/* EV_ILL */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -ifpi2_next_state(struct l1_softc *sc, int event) -{ - int currstate, newstate; - - if(event >= N_EVENTS) - panic("i4b_l1fsm.c: event >= N_EVENTS\n"); - - currstate = sc->sc_I430state; - - if(currstate >= N_STATES) - panic("i4b_l1fsm.c: currstate >= N_STATES\n"); - - newstate = ifpi2_state_tab[event][currstate].newstate; - - if(newstate >= N_STATES) - panic("i4b_l1fsm.c: newstate >= N_STATES\n"); - - NDBGL1(L1_F_MSG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]); - - (*ifpi2_state_tab[event][currstate].func)(sc); - - if(newstate == ST_ILL) - { - newstate = ST_F3; - NDBGL1(L1_F_ERR, "FSM Illegal State ERROR, oldstate = %s, newstate = %s, event = %s!", - state_text[currstate], - state_text[newstate], - event_text[event]); - } - - sc->sc_I430state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -ifpi2_printstate(struct l1_softc *sc) -{ - return((char *) state_text[sc->sc_I430state]); -} -#endif diff --git a/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c b/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c deleted file mode 100644 index e8dbbde58e05..000000000000 --- a/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c +++ /dev/null @@ -1,1449 +0,0 @@ -/*- - * Copyright (c) 2001 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpi2_pci.c: AVM Fritz!Card PCI hardware driver - * -------------------------------------------------- - * $Id$ - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -/*#include */ -#include - -#include -#include - -#define PCI_AVMA1_VID 0x1244 -#define PCI_AVMA1_V2_DID 0x0e00 - -/* prototypes */ -static void avma1pp2_disable(device_t); -static void avma1pp2_intr(void *); -static void hscx_write_reg(int, u_int, struct l1_softc *); -static u_char hscx_read_reg(int, struct l1_softc *); -static u_int hscx_read_reg_int(int, struct l1_softc *); -static void hscx_read_fifo(int, void *, size_t, struct l1_softc *); -static void hscx_write_fifo(int, void *, size_t, struct l1_softc *); -static void avma1pp2_hscx_int_handler(struct l1_softc *); -static void avma1pp2_hscx_intr(int, u_int, struct l1_softc *); -static void avma1pp2_init_linktab(struct l1_softc *); -static void avma1pp2_bchannel_setup(int, int, int, int); -static void avma1pp2_bchannel_start(int, int); -static void avma1pp2_hscx_init(struct l1_softc *, int, int); -static void avma1pp2_bchannel_stat(int, int, bchan_statistics_t *); -static void avma1pp2_set_linktab(int, int, drvr_link_t *); -static isdn_link_t * avma1pp2_ret_linktab(int, int); -static int avma1pp2_pci_probe(device_t); -static int avma1pp2_hscx_fifo(l1_bchan_state_t *, struct l1_softc *); -int avma1pp2_attach_avma1pp(device_t); -static void ifpi2_isacsx_intr(struct l1_softc *sc); - -static device_method_t avma1pp2_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, avma1pp2_pci_probe), - DEVMETHOD(device_attach, avma1pp2_attach_avma1pp), - DEVMETHOD(device_shutdown, avma1pp2_disable), - - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - { 0, 0 } -}; - -static driver_t avma1pp2_pci_driver = { - "ifpi2-", - avma1pp2_pci_methods, - sizeof(struct l1_softc) -}; - -static devclass_t avma1pp2_pci_devclass; - -DRIVER_MODULE(avma1pp2, pci, avma1pp2_pci_driver, avma1pp2_pci_devclass, 0, 0); - -/* jump table for multiplex routines */ - -struct i4b_l1mux_func avma1pp2_l1mux_func = { - avma1pp2_ret_linktab, - avma1pp2_set_linktab, - ifpi2_mph_command_req, - ifpi2_ph_data_req, - ifpi2_ph_activate_req, -}; - -struct l1_softc *ifpi2_scp[IFPI2_MAXUNIT]; - -/*---------------------------------------------------------------------------* - * AVM PCI Fritz!Card V. 2 special registers - *---------------------------------------------------------------------------*/ - -/* - * AVM PCI Status Latch 0 read only bits - */ -#define ASL_IRQ_ISAC 0x01 /* ISAC interrupt, active high */ -#define ASL_IRQ_HSCX 0x02 /* HSX interrupt, active high */ -#define ASL_IRQ_TIMER 0x04 /* Timer interrupt, active high */ -#define ASL_IRQ_BCHAN ASL_IRQ_HSCX -/* actually active high */ -#define ASL_IRQ_Pending (ASL_IRQ_ISAC | ASL_IRQ_HSCX | ASL_IRQ_TIMER) - -/* - * AVM PCI Status Latch 0 read only bits - */ -#define ASL_RESET 0x01 -#define ASL_TIMERRESET 0x04 -#define ASL_ENABLE_INT 0x08 - -/* - * "HSCX" status bits - */ -#define HSCX_STAT_RME 0x01 -#define HSCX_STAT_RDO 0x10 -#define HSCX_STAT_CRCVFRRAB 0x0E -#define HSCX_STAT_CRCVFR 0x06 -#define HSCX_STAT_RML_MASK 0x3f00 - -/* - * "HSCX" interrupt bits - */ -#define HSCX_INT_XPR 0x80 -#define HSCX_INT_XDU 0x40 -#define HSCX_INT_RPR 0x20 -#define HSCX_INT_MASK 0xE0 - -/* - * "HSCX" command bits - */ -#define HSCX_CMD_XRS 0x80 -#define HSCX_CMD_XME 0x01 -#define HSCX_CMD_RRS 0x20 -#define HSCX_CMD_XML_MASK 0x3f00 - -/* "HSCX" mode bits */ -#define HSCX_MODE_ITF_FLG 0x01 -#define HSCX_MODE_TRANS 0x02 - -/* offsets to various registers in the ASIC, evidently */ -#define STAT0_OFFSET 0x02 - -#define HSCX_FIFO1 0x10 -#define HSCX_FIFO2 0x18 - -#define HSCX_STAT1 0x14 -#define HSCX_STAT2 0x1c - -#define ISACSX_INDEX 0x04 -#define ISACSX_DATA 0x08 - -/* - * Commands and parameters are sent to the "HSCX" as a long, but the - * fields are handled as bytes. - * - * The long contains: - * (prot << 16)|(txl << 8)|cmd - * - * where: - * prot = protocol to use - * txl = transmit length - * cmd = the command to be executed - * - * The fields are defined as u_char in struct l1_softc. - * - * Macro to coalesce the byte fields into a u_int - */ -#define AVMA1PPSETCMDLONG(f) (f) = ((sc->avma1pp_cmd) | (sc->avma1pp_txl << 8) \ - | (sc->avma1pp_prot << 16)) - -/* - * to prevent deactivating the "HSCX" when both channels are active we - * define an HSCX_ACTIVE flag which is or'd into the channel's state - * flag in avma1pp2_bchannel_setup upon active and cleared upon deactivation. - * It is set high to allow room for new flags. - */ -#define HSCX_AVMA1PP_ACTIVE 0x1000 - -/*---------------------------------------------------------------------------* - * AVM read fifo routines - *---------------------------------------------------------------------------*/ - -static void -avma1pp2_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - int i; - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_4(btag, bhandle, ISACSX_INDEX, 0); - /* evidently each byte must be read as a long */ - for (i = 0; i < size; i++) - ((u_int8_t *)buf)[i] = (u_int8_t)bus_space_read_4(btag, bhandle, ISACSX_DATA); - break; - case ISIC_WHAT_HSCXA: - hscx_read_fifo(0, buf, size, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_read_fifo(1, buf, size, sc); - break; - } -} - -static void -hscx_read_fifo(int chan, void *buf, size_t len, struct l1_softc *sc) -{ - u_int32_t *ip; - size_t cnt; - int dataoff; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - dataoff = chan ? HSCX_FIFO2 : HSCX_FIFO1; - - ip = (u_int32_t *)buf; - cnt = 0; - /* what if len isn't a multiple of sizeof(int) and buf is */ - /* too small ???? */ - while (cnt < len) - { - *ip++ = bus_space_read_4(btag, bhandle, dataoff); - cnt += 4; - } -} - -/*---------------------------------------------------------------------------* - * AVM write fifo routines - *---------------------------------------------------------------------------*/ -static void -avma1pp2_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - int i; - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_4(btag, bhandle, ISACSX_INDEX, 0); - /* evidently each byte must written as a long */ - for (i = 0; i < size; i++) - bus_space_write_4(btag, bhandle, ISACSX_DATA, ((unsigned char *)buf)[i]); - break; - case ISIC_WHAT_HSCXA: - hscx_write_fifo(0, buf, size, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_write_fifo(1, buf, size, sc); - break; - } -} - -static void -hscx_write_fifo(int chan, void *buf, size_t len, struct l1_softc *sc) -{ - u_int32_t *ip; - size_t cnt; - int dataoff; - l1_bchan_state_t *Bchan = &sc->sc_chan[chan]; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - dataoff = chan ? HSCX_FIFO2 : HSCX_FIFO1; - - sc->avma1pp_cmd &= ~HSCX_CMD_XME; - sc->avma1pp_txl = 0; - if (Bchan->out_mbuf_cur == NULL) - { - if (Bchan->bprot != BPROT_NONE) - sc->avma1pp_cmd |= HSCX_CMD_XME; - } - if (len != sc->sc_bfifolen) - sc->avma1pp_txl = len; - - cnt = 0; /* borrow cnt */ - AVMA1PPSETCMDLONG(cnt); - hscx_write_reg(chan, cnt, sc); - - ip = (u_int32_t *)buf; - cnt = 0; - while (cnt < len) - { - bus_space_write_4(btag, bhandle, dataoff, *ip); - ip++; - cnt += 4; - } -} - -/*---------------------------------------------------------------------------* - * AVM write register routines - *---------------------------------------------------------------------------*/ - -static void -avma1pp2_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_4(btag, bhandle, ISACSX_INDEX, offs); - bus_space_write_4(btag, bhandle, ISACSX_DATA, data); - break; - case ISIC_WHAT_HSCXA: - hscx_write_reg(0, data, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_write_reg(1, data, sc); - break; - } -} - -static void -hscx_write_reg(int chan, u_int val, struct l1_softc *sc) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - u_int off; - - off = (chan == 0 ? HSCX_STAT1 : HSCX_STAT2); - - bus_space_write_4(btag, bhandle, off, val); -} - -/*---------------------------------------------------------------------------* - * AVM read register routines - *---------------------------------------------------------------------------*/ -static u_int8_t -avma1pp2_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - u_int8_t val; - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_4(btag, bhandle, ISACSX_INDEX, offs); - val = (u_int8_t)bus_space_read_4(btag, bhandle, ISACSX_DATA); - return(val); - case ISIC_WHAT_HSCXA: - return hscx_read_reg(0, sc); - case ISIC_WHAT_HSCXB: - return hscx_read_reg(1, sc); - } - return 0; -} - -static u_char -hscx_read_reg(int chan, struct l1_softc *sc) -{ - return(hscx_read_reg_int(chan, sc) & 0xff); -} - -/* - * need to be able to return an int because the RBCH is in the 2nd - * byte. - */ -static u_int -hscx_read_reg_int(int chan, struct l1_softc *sc) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - u_int off; - - off = (chan == 0 ? HSCX_STAT1 : HSCX_STAT2); - return(bus_space_read_4(btag, bhandle, off)); -} - -/*---------------------------------------------------------------------------* - * avma1pp2_probe - probe for a card - *---------------------------------------------------------------------------*/ -static int -avma1pp2_pci_probe(dev) - device_t dev; -{ - u_int16_t did, vid; - - vid = pci_get_vendor(dev); - did = pci_get_device(dev); - - if ((vid == PCI_AVMA1_VID) && (did == PCI_AVMA1_V2_DID)) { - device_set_desc(dev, "AVM Fritz!Card PCI Version 2"); - return(0); - } - - return(ENXIO); -} - -/*---------------------------------------------------------------------------* - * avma1pp2_attach_avma1pp - attach Fritz!Card PCI - *---------------------------------------------------------------------------*/ -int -avma1pp2_attach_avma1pp(device_t dev) -{ - struct l1_softc *sc; - u_int v; - int unit, error = 0; - int s; - u_int16_t did, vid; - void *ih = 0; - bus_space_handle_t bhandle; - bus_space_tag_t btag; - l1_bchan_state_t *chan; - - s = splimp(); - - vid = pci_get_vendor(dev); - did = pci_get_device(dev); - sc = device_get_softc(dev); - unit = device_get_unit(dev); - bzero(sc, sizeof(struct l1_softc)); - - /* probably not really required */ - if(unit >= IFPI2_MAXUNIT) { - printf("ifpi2-%d: Error, unit >= IFPI_MAXUNIT!\n", unit); - splx(s); - return(ENXIO); - } - - if ((vid != PCI_AVMA1_VID) && (did != PCI_AVMA1_V2_DID)) { - printf("ifpi2-%d: unknown device!?\n", unit); - goto fail; - } - - ifpi2_scp[unit] = sc; - - sc->sc_resources.io_rid[0] = PCIR_BAR(1); - sc->sc_resources.io_base[0] = bus_alloc_resource_any(dev, - SYS_RES_IOPORT, &sc->sc_resources.io_rid[0], RF_ACTIVE); - - if (sc->sc_resources.io_base[0] == NULL) { - printf("ifpi2-%d: couldn't map IO port\n", unit); - error = ENXIO; - goto fail; - } - - bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* Allocate interrupt */ - sc->sc_resources.irq_rid = 0; - sc->sc_resources.irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, RF_SHAREABLE | RF_ACTIVE); - - if (sc->sc_resources.irq == NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(1), sc->sc_resources.io_base[0]); - printf("ifpi2-%d: couldn't map interrupt\n", unit); - error = ENXIO; - goto fail; - } - - error = bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL, avma1pp2_intr, sc, &ih); - - if (error) { - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_resources.irq); - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(1), sc->sc_resources.io_base[0]); - printf("ifpi2-%d: couldn't set up irq\n", unit); - goto fail; - } - - sc->sc_unit = unit; - - /* end of new-bus stuff */ - - ISAC_BASE = (caddr_t)ISIC_WHAT_ISAC; - - HSCX_A_BASE = (caddr_t)ISIC_WHAT_HSCXA; - HSCX_B_BASE = (caddr_t)ISIC_WHAT_HSCXB; - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = avma1pp2_read_reg; - sc->writereg = avma1pp2_write_reg; - - sc->readfifo = avma1pp2_read_fifo; - sc->writefifo = avma1pp2_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_AVMA1PCI_V2; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* set up some other miscellaneous things */ - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* reset the card */ - /* the Linux driver does this to clear any pending ISAC interrupts */ - v = 0; - v = ISAC_READ(I_RMODED); -#ifdef AVMA1PCI_V2_DEBUG - printf("avma1pp2_attach: I_MODED %x...", v); -#endif - v = ISAC_READ(I_ISTAD); -#ifdef AVMA1PCI_V2_DEBUG - printf("avma1pp2_attach: I_ISTAD %x...", v); -#endif - v = ISAC_READ(I_ISTA); -#ifdef AVMA1PCI_V2_DEBUG - printf("avma1pp2_attach: I_ISTA %x...", v); -#endif - ISAC_WRITE(I_MASKD, 0xff); - ISAC_WRITE(I_MASK, 0xff); - /* the Linux driver does this to clear any pending HSCX interrupts */ - v = hscx_read_reg_int(0, sc); -#ifdef AVMA1PCI_V2_DEBUG - printf("avma1pp2_attach: 0 HSCX_STAT %x...", v); -#endif - v = hscx_read_reg_int(1, sc); -#ifdef AVMA1PCI_V2_DEBUG - printf("avma1pp2_attach: 1 HSCX_STAT %x\n", v); -#endif - - bus_space_write_1(btag, bhandle, STAT0_OFFSET, 0); - DELAY(SEC_DELAY/100); /* 10 ms */ - bus_space_write_1(btag, bhandle, STAT0_OFFSET, ASL_RESET); - DELAY(SEC_DELAY/100); /* 10 ms */ - bus_space_write_1(btag, bhandle, STAT0_OFFSET, 0); - DELAY(SEC_DELAY/100); /* 10 ms */ - - bus_space_write_1(btag, bhandle, STAT0_OFFSET, ASL_TIMERRESET); - DELAY(SEC_DELAY/100); /* 10 ms */ - bus_space_write_1(btag, bhandle, STAT0_OFFSET, ASL_ENABLE_INT); - DELAY(SEC_DELAY/100); /* 10 ms */ - - /* from here to the end would normally be done in isic_pciattach */ - - printf("ifpi2-%d: ISACSX %s\n", unit, "PSB3186"); - - /* init the ISAC */ - ifpi2_isacsx_init(sc); - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - /* Init the channel mutexes */ - chan = &sc->sc_chan[HSCX_CH_A]; - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp2_rx", NULL, MTX_DEF); - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp2_tx", NULL, MTX_DEF); - chan = &sc->sc_chan[HSCX_CH_B]; - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp2_rx", NULL, MTX_DEF); - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp2_tx", NULL, MTX_DEF); -#endif - - /* init the "HSCX" */ - avma1pp2_bchannel_setup(sc->sc_unit, HSCX_CH_A, BPROT_NONE, 0); - - avma1pp2_bchannel_setup(sc->sc_unit, HSCX_CH_B, BPROT_NONE, 0); - - /* can't use the normal B-Channel stuff */ - avma1pp2_init_linktab(sc); - - /* set trace level */ - - sc->sc_trace = TRACE_OFF; - - sc->sc_state = ISAC_IDLE; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - sc->sc_freeflag = 0; - - sc->sc_obuf2 = NULL; - sc->sc_freeflag2 = 0; - -#if defined(__FreeBSD__) && __FreeBSD__ >=3 - callout_handle_init(&sc->sc_T3_callout); - callout_handle_init(&sc->sc_T4_callout); -#endif - - /* init higher protocol layers */ - - i4b_l1_mph_status_ind(L0IFPI2UNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &avma1pp2_l1mux_func); - - fail: - splx(s); - return(error); -} - -/* - * this is the real interrupt routine - */ -static void -avma1pp2_hscx_intr(int h_chan, u_int stat, struct l1_softc *sc) -{ - register l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int activity = -1; - u_int param = 0; - - NDBGL1(L1_H_IRQ, "%#x", stat); - - if((stat & HSCX_INT_XDU) && (chan->bprot != BPROT_NONE))/* xmit data underrun */ - { - chan->stat_XDU++; - NDBGL1(L1_H_XFRERR, "xmit data underrun"); - /* abort the transmission */ - sc->avma1pp_txl = 0; - sc->avma1pp_cmd |= HSCX_CMD_XRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - sc->avma1pp_cmd &= ~HSCX_CMD_XRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - - if (chan->out_mbuf_head != NULL) /* don't continue to transmit this buffer */ - { - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_cur = chan->out_mbuf_head = NULL; - } - } - - /* - * The following is based on examination of the Linux driver. - * - * The logic here is different than with a "real" HSCX; all kinds - * of information (interrupt/status bits) are in stat. - * HSCX_INT_RPR indicates a receive interrupt - * HSCX_STAT_RDO indicates an overrun condition, abort - - * otherwise read the bytes ((stat & HSCX_STZT_RML_MASK) >> 8) - * HSCX_STAT_RME indicates end-of-frame and apparently any - * CRC/framing errors are only reported in this state. - * if ((stat & HSCX_STAT_CRCVFRRAB) != HSCX_STAT_CRCVFR) - * CRC/framing error - */ - - if(stat & HSCX_INT_RPR) - { - register int fifo_data_len; - int error = 0; - /* always have to read the FIFO, so use a scratch buffer */ - u_char scrbuf[HSCX_FIFO_LEN]; - - if(stat & HSCX_STAT_RDO) - { - chan->stat_RDO++; - NDBGL1(L1_H_XFRERR, "receive data overflow"); - error++; - } - - /* - * check whether we're receiving data for an inactive B-channel - * and discard it. This appears to happen for telephony when - * both B-channels are active and one is deactivated. Since - * it is not really possible to deactivate the channel in that - * case (the ASIC seems to deactivate _both_ channels), the - * "deactivated" channel keeps receiving data which can lead - * to exhaustion of mbufs and a kernel panic. - * - * This is a hack, but it's the only solution I can think of - * without having the documentation for the ASIC. - * GJ - 28 Nov 1999 - */ - if (chan->state == HSCX_IDLE) - { - NDBGL1(L1_H_XFRERR, "toss data from %d", h_chan); - error++; - } - - fifo_data_len = ((stat & HSCX_STAT_RML_MASK) >> 8); - - if(fifo_data_len == 0) - fifo_data_len = sc->sc_bfifolen; - - /* ALWAYS read data from HSCX fifo */ - - HSCX_RDFIFO(h_chan, scrbuf, fifo_data_len); - chan->rxcount += fifo_data_len; - - /* all error conditions checked, now decide and take action */ - - if(error == 0) - { - if(chan->in_mbuf == NULL) - { - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 avma1pp2_hscx_intr: RME, cannot allocate mbuf!\n"); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - - if((chan->in_len + fifo_data_len) <= BCH_MAX_DATALEN) - { - /* OK to copy the data */ - bcopy(scrbuf, chan->in_cbptr, fifo_data_len); - chan->in_cbptr += fifo_data_len; - chan->in_len += fifo_data_len; - - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - if (stat & HSCX_STAT_RME) - { - if((stat & HSCX_STAT_CRCVFRRAB) == HSCX_STAT_CRCVFR) - { - (*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit); - activity = ACT_RX; - - /* mark buffer ptr as unused */ - - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - else - { - chan->stat_CRC++; - NDBGL1(L1_H_XFRERR, "CRC/RAB"); - if (chan->in_mbuf != NULL) - { - i4b_Bfreembuf(chan->in_mbuf); - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - } - } - } /* END enough space in mbuf */ - else - { - if(chan->bprot == BPROT_NONE) - { - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - if(!(i4b_l1_bchan_tel_silence(chan->in_mbuf->m_data, chan->in_mbuf->m_len))) - activity = ACT_RX; - - /* move rx'd data to rx queue */ - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - (void) IF_HANDOFF(&chan->rx_queue, chan->in_mbuf, NULL); -#else - if(!(IF_QFULL(&chan->rx_queue))) - { - IF_ENQUEUE(&chan->rx_queue, chan->in_mbuf); - } - else - { - i4b_Bfreembuf(chan->in_mbuf); - } -#endif - /* signal upper layer that data are available */ - (*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit); - - /* alloc new buffer */ - - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 avma1pp2_hscx_intr: RPF, cannot allocate new mbuf!\n"); - - /* setup new data ptr */ - - chan->in_cbptr = chan->in_mbuf->m_data; - - /* OK to copy the data */ - bcopy(scrbuf, chan->in_cbptr, fifo_data_len); - - chan->in_cbptr += fifo_data_len; - chan->in_len = fifo_data_len; - - chan->rxcount += fifo_data_len; - } - else - { - NDBGL1(L1_H_XFRERR, "RAWHDLC rx buffer overflow in RPF, in_len=%d", chan->in_len); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - } - } /* if(error == 0) */ - else - { - /* land here for RDO */ - if (chan->in_mbuf != NULL) - { - i4b_Bfreembuf(chan->in_mbuf); - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - sc->avma1pp_txl = 0; - sc->avma1pp_cmd |= HSCX_CMD_RRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - sc->avma1pp_cmd &= ~HSCX_CMD_RRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - } - } - - - /* transmit fifo empty, new data can be written to fifo */ - - if(stat & HSCX_INT_XPR) - { - /* - * for a description what is going on here, please have - * a look at isic_bchannel_start() in i4b_bchan.c ! - */ - - NDBGL1(L1_H_IRQ, "unit %d, chan %d - XPR, Tx Fifo Empty!", sc->sc_unit, h_chan); - - if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */ - { - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) - { - chan->state &= ~HSCX_TX_ACTIVE; - (*chan->isic_drvr_linktab->bch_tx_queue_empty)(chan->isic_drvr_linktab->unit); - } - else - { - chan->state |= HSCX_TX_ACTIVE; - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - } - } - - avma1pp2_hscx_fifo(chan, sc); - } - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); -} - -/* - * this is the main routine which checks each channel and then calls - * the real interrupt routine as appropriate - */ -static void -avma1pp2_hscx_int_handler(struct l1_softc *sc) -{ - u_int stat; - - /* has to be a u_int because the byte count is in the 2nd byte */ - stat = hscx_read_reg_int(0, sc); - if (stat & HSCX_INT_MASK) - avma1pp2_hscx_intr(0, stat, sc); - stat = hscx_read_reg_int(1, sc); - if (stat & HSCX_INT_MASK) - avma1pp2_hscx_intr(1, stat, sc); -} - -static void -avma1pp2_disable(device_t dev) -{ - struct l1_softc *sc = device_get_softc(dev); - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* could be still be wrong, but seems to prevent hangs */ - bus_space_write_1(btag, bhandle, STAT0_OFFSET, 0x00); -} - -static void -avma1pp2_intr(void *xsc) -{ - u_char stat; - struct l1_softc *sc; - bus_space_handle_t bhandle; - bus_space_tag_t btag; - - sc = xsc; - bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - stat = bus_space_read_1(btag, bhandle, STAT0_OFFSET); - NDBGL1(L1_H_IRQ, "stat %x", stat); - /* was there an interrupt from this card ? */ - if ((stat & ASL_IRQ_Pending) == 0) - return; /* no */ - /* For slow machines loop as long as an interrupt is active */ - for (; ((stat & ASL_IRQ_Pending) != 0) ;) - { - /* interrupts are high active */ - if (stat & ASL_IRQ_TIMER) - NDBGL1(L1_H_IRQ, "timer interrupt ???"); - if (stat & ASL_IRQ_HSCX) - { - NDBGL1(L1_H_IRQ, "HSCX"); - avma1pp2_hscx_int_handler(sc); - } - if (stat & ASL_IRQ_ISAC) - { - NDBGL1(L1_H_IRQ, "ISAC"); - ifpi2_isacsx_intr(sc); - } - stat = bus_space_read_1(btag, bhandle, STAT0_OFFSET); - NDBGL1(L1_H_IRQ, "stat %x", stat); - - } -} - -static void -avma1pp2_hscx_init(struct l1_softc *sc, int h_chan, int activate) -{ - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - u_int param = 0; - - NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", - sc->sc_unit, h_chan, activate ? "activate" : "deactivate"); - - sc->avma1pp_cmd = sc->avma1pp_prot = sc->avma1pp_txl = 0; - - if (activate == 0) - { - /* only deactivate if both channels are idle */ - if (sc->sc_chan[HSCX_CH_A].state != HSCX_IDLE || - sc->sc_chan[HSCX_CH_B].state != HSCX_IDLE) - { - return; - } - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_TRANS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - return; - } - if(chan->bprot == BPROT_RHDLC) - { - NDBGL1(L1_BCHAN, "BPROT_RHDLC"); - - /* HDLC Frames, transparent mode 0 */ - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_ITF_FLG; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - sc->avma1pp_cmd = HSCX_CMD_XRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - sc->avma1pp_cmd = 0; - } - else - { - NDBGL1(L1_BCHAN, "BPROT_NONE??"); - - /* Raw Telephony, extended transparent mode 1 */ - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_TRANS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - sc->avma1pp_cmd = HSCX_CMD_XRS; - AVMA1PPSETCMDLONG(param); - hscx_write_reg(h_chan, param, sc); - sc->avma1pp_cmd = 0; - } -} - -static void -avma1pp2_bchannel_setup(int unit, int h_chan, int bprot, int activate) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi2_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - int s = SPLI4B(); - - if(activate == 0) - { - /* deactivation */ - chan->state = HSCX_IDLE; - avma1pp2_hscx_init(sc, h_chan, activate); - } - - NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", - sc->sc_unit, h_chan, activate ? "activate" : "deactivate"); - - /* general part */ - - chan->unit = sc->sc_unit; /* unit number */ - chan->channel = h_chan; /* B channel */ - chan->bprot = bprot; /* B channel protocol */ - chan->state = HSCX_IDLE; /* B channel state */ - - /* receiver part */ - - chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; - - i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ - - chan->rxcount = 0; /* reset rx counter */ - - i4b_Bfreembuf(chan->in_mbuf); /* clean rx mbuf */ - - chan->in_mbuf = NULL; /* reset mbuf ptr */ - chan->in_cbptr = NULL; /* reset mbuf curr ptr */ - chan->in_len = 0; /* reset mbuf data len */ - - /* transmitter part */ - - chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; - - i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ - - chan->txcount = 0; /* reset tx counter */ - - i4b_Bfreembuf(chan->out_mbuf_head); /* clean tx mbuf */ - - chan->out_mbuf_head = NULL; /* reset head mbuf ptr */ - chan->out_mbuf_cur = NULL; /* reset current mbuf ptr */ - chan->out_mbuf_cur_ptr = NULL; /* reset current mbuf data ptr */ - chan->out_mbuf_cur_len = 0; /* reset current mbuf data cnt */ - - if(activate != 0) - { - /* activation */ - avma1pp2_hscx_init(sc, h_chan, activate); - chan->state |= HSCX_AVMA1PP_ACTIVE; - } - - splx(s); -} - -static void -avma1pp2_bchannel_start(int unit, int h_chan) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi2_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - register l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - int activity = -1; - - s = SPLI4B(); /* enter critical section */ - if(chan->state & HSCX_TX_ACTIVE) /* already running ? */ - { - splx(s); - return; /* yes, leave */ - } - - /* get next mbuf from queue */ - - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) /* queue empty ? */ - { - splx(s); /* leave critical section */ - return; /* yes, exit */ - } - - /* init current mbuf values */ - - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - - /* activity indicator for timeout handling */ - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - - chan->state |= HSCX_TX_ACTIVE; /* we start transmitting */ - - if(sc->sc_trace & TRACE_B_TX) /* if trace, send mbuf to trace dev */ - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - avma1pp2_hscx_fifo(chan, sc); - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); - - splx(s); -} - -/*---------------------------------------------------------------------------* - * return the address of isic drivers linktab - *---------------------------------------------------------------------------*/ -static isdn_link_t * -avma1pp2_ret_linktab(int unit, int channel) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi2_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - return(&chan->isic_isdn_linktab); -} - -/*---------------------------------------------------------------------------* - * set the driver linktab in the b channel softc - *---------------------------------------------------------------------------*/ -static void -avma1pp2_set_linktab(int unit, int channel, drvr_link_t *dlt) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi2_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - chan->isic_drvr_linktab = dlt; -} - - -/*---------------------------------------------------------------------------* - * initialize our local linktab - *---------------------------------------------------------------------------*/ -static void -avma1pp2_init_linktab(struct l1_softc *sc) -{ - l1_bchan_state_t *chan = &sc->sc_chan[HSCX_CH_A]; - isdn_link_t *lt = &chan->isic_isdn_linktab; - - /* make sure the hardware driver is known to layer 4 */ - /* avoid overwriting if already set */ - if (ctrl_types[CTRL_PASSIVE].set_linktab == NULL) - { - ctrl_types[CTRL_PASSIVE].set_linktab = i4b_l1_set_linktab; - ctrl_types[CTRL_PASSIVE].get_linktab = i4b_l1_ret_linktab; - } - - /* local setup */ - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_A; - lt->bch_config = avma1pp2_bchannel_setup; - lt->bch_tx_start = avma1pp2_bchannel_start; - lt->bch_stat = avma1pp2_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; - - chan = &sc->sc_chan[HSCX_CH_B]; - lt = &chan->isic_isdn_linktab; - - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_B; - lt->bch_config = avma1pp2_bchannel_setup; - lt->bch_tx_start = avma1pp2_bchannel_start; - lt->bch_stat = avma1pp2_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; -} - -/* - * use this instead of isic_bchannel_stat in i4b_bchan.c because it's static - */ -static void -avma1pp2_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = ifpi2_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - - s = SPLI4B(); - - bsp->outbytes = chan->txcount; - bsp->inbytes = chan->rxcount; - - chan->txcount = 0; - chan->rxcount = 0; - - splx(s); -} - -/*---------------------------------------------------------------------------* - * fill HSCX fifo with data from the current mbuf - * Put this here until it can go into i4b_hscx.c - *---------------------------------------------------------------------------*/ -static int -avma1pp2_hscx_fifo(l1_bchan_state_t *chan, struct l1_softc *sc) -{ - int len; - int nextlen; - int i; - int cmd = 0; - /* using a scratch buffer simplifies writing to the FIFO */ - u_char scrbuf[HSCX_FIFO_LEN]; - - len = 0; - - /* - * fill the HSCX tx fifo with data from the current mbuf. if - * current mbuf holds less data than HSCX fifo length, try to - * get the next mbuf from (a possible) mbuf chain. if there is - * not enough data in a single mbuf or in a chain, then this - * is the last mbuf and we tell the HSCX that it has to send - * CRC and closing flag - */ - - while(chan->out_mbuf_cur && len != sc->sc_bfifolen) - { - nextlen = min(chan->out_mbuf_cur_len, sc->sc_bfifolen - len); - -#ifdef NOTDEF - printf("i:mh=%p, mc=%p, mcp=%p, mcl=%d l=%d nl=%d # ", - chan->out_mbuf_head, - chan->out_mbuf_cur, - chan->out_mbuf_cur_ptr, - chan->out_mbuf_cur_len, - len, - nextlen); -#endif - - cmd |= HSCX_CMDR_XTF; - /* collect the data in the scratch buffer */ - for (i = 0; i < nextlen; i++) - scrbuf[i + len] = chan->out_mbuf_cur_ptr[i]; - - len += nextlen; - chan->txcount += nextlen; - - chan->out_mbuf_cur_ptr += nextlen; - chan->out_mbuf_cur_len -= nextlen; - - if(chan->out_mbuf_cur_len == 0) - { - if((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL) - { - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPI2UNIT(sc->sc_unit); - hdr.type = (chan->channel == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - } - else - { - if (chan->bprot != BPROT_NONE) - cmd |= HSCX_CMDR_XME; - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_head = NULL; - } - } - } - /* write what we have from the scratch buf to the HSCX fifo */ - if (len != 0) - HSCX_WRFIFO(chan->channel, scrbuf, len); - return(cmd); -} - -/*---------------------------------------------------------------------------* - * ifpi2 - ISAC interrupt routine - *---------------------------------------------------------------------------*/ -static void -ifpi2_isacsx_intr(struct l1_softc *sc) -{ - register u_char isacsx_irq_stat; - - for(;;) - { - /* get isac irq status */ - /* ISTA tells us whether it was a C/I or HDLC int. */ - isacsx_irq_stat = ISAC_READ(I_ISTA); - - if(isacsx_irq_stat) - ifpi2_isacsx_irq(sc, isacsx_irq_stat); /* isac handler */ - else - break; - } - - ISAC_WRITE(I_MASKD, 0xff); - ISAC_WRITE(I_MASK, 0xff); - - DELAY(100); - - ISAC_WRITE(I_MASKD, isacsx_imaskd); - ISAC_WRITE(I_MASK, isacsx_imask); -} - -/*---------------------------------------------------------------------------* - * ifpi2_recover - try to recover from irq lockup - *---------------------------------------------------------------------------*/ -void -ifpi2_recover(struct l1_softc *sc) -{ - printf("ifpi2_recover %d\n", sc->sc_unit); -#if 0 /* fix me later */ - u_char byte; - - /* get isac irq status */ - - byte = ISAC_READ(I_ISTA); - - NDBGL1(L1_ERROR, " ISAC: ISTA = 0x%x", byte); - - if(byte & ISACSX_ISTA_EXI) - NDBGL1(L1_ERROR, " ISAC: EXIR = 0x%x", (u_char)ISAC_READ(I_EXIR)); - - if(byte & ISACSX_ISTA_CISQ) - { - byte = ISAC_READ(I_CIRR); - - NDBGL1(L1_ERROR, " ISAC: CISQ = 0x%x", byte); - - if(byte & ISACSX_CIRR_SQC) - NDBGL1(L1_ERROR, " ISAC: SQRR = 0x%x", (u_char)ISAC_READ(I_SQRR)); - } - - NDBGL1(L1_ERROR, " ISAC: IMASK = 0x%x", ISACSX_IMASK); - - ISAC_WRITE(I_MASKD, 0xff); - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - ISAC_WRITE(I_MASKD, isacsx_imaskd); - ISAC_WRITE(I_MASK, isacsx_imask); -#endif -} diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c b/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c deleted file mode 100644 index fc06acfc27c6..000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c +++ /dev/null @@ -1,1397 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Udo Schweigert. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpnp_avm.c: AVM Fritz!Card PnP hardware driver - * --------------------------------------------------- - * last edit-date: [Fri Jan 12 17:05:28 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -/* prototypes */ -static void avm_pnp_intr(void *); -static void hscx_write_reg(int, u_int, struct l1_softc *, u_int); -static void hscx_write_reg_val(int, u_int, u_int8_t, struct l1_softc *); -static u_int hscx_read_reg(int, u_int, struct l1_softc *); -static void hscx_read_fifo(int, void *, size_t, struct l1_softc *); -static void hscx_write_fifo(int, void *, size_t, struct l1_softc *); -static void avm_pnp_hscx_int_handler(struct l1_softc *); -static void avm_pnp_hscx_intr(int, u_int, u_int, struct l1_softc *); -static void avm_pnp_init_linktab(struct l1_softc *); -static void avm_pnp_bchannel_setup(int, int, int, int); -static void avm_pnp_bchannel_start(int, int); -static void avm_pnp_hscx_init(struct l1_softc *, int, int); -static void avm_pnp_bchannel_stat(int, int, bchan_statistics_t *); -static void avm_pnp_set_linktab(int, int, drvr_link_t *); -static isdn_link_t * avm_pnp_ret_linktab(int, int); -static int avm_pnp_probe(device_t); -static int avm_pnp_hscx_fifo(l1_bchan_state_t *, struct l1_softc *); -int avm_pnp_attach(device_t); -static void ifpnp_isac_intr(struct l1_softc *sc); - -static device_method_t avm_pnp_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, avm_pnp_probe), - DEVMETHOD(device_attach, avm_pnp_attach), - { 0, 0 } -}; - -static driver_t avm_pnp_driver = { - "ifpnp", - avm_pnp_methods, - sizeof(struct l1_softc) -}; - -static devclass_t avm_pnp_devclass; - -DRIVER_MODULE(avm_pnp, isa, avm_pnp_driver, avm_pnp_devclass, 0, 0); - -/* jump table for multiplex routines */ - -struct i4b_l1mux_func avm_pnp_l1mux_func = { - avm_pnp_ret_linktab, - avm_pnp_set_linktab, - ifpnp_mph_command_req, - ifpnp_ph_data_req, - ifpnp_ph_activate_req, -}; - -struct l1_softc *ifpnp_scp[IFPNP_MAXUNIT]; - -/*---------------------------------------------------------------------------* - * AVM PnP Fritz!Card special registers - *---------------------------------------------------------------------------*/ - -/* - * register offsets from i/o base - */ -#define CLASS_OFFSET 0x00 -#define REVISION_OFFSET 0x01 -#define STAT0_OFFSET 0x02 -#define STAT1_OFFSET 0x03 -#define ADDR_REG_OFFSET 0x04 -/*#define MODREG_OFFSET 0x06 -#define VERREG_OFFSET 0x07*/ - -/* these 2 are used to select an ISAC register set */ -#define ISAC_LO_REG_OFFSET 0x04 -#define ISAC_HI_REG_OFFSET 0x06 - -/* offset higher than this goes to the HI register set */ -#define MAX_LO_REG_OFFSET 0x2f - -/* mask for the offset */ -#define ISAC_REGSET_MASK 0x0f - -/* the offset from the base to the ISAC registers */ -#define ISAC_REG_OFFSET 0x10 - -/* the offset from the base to the ISAC FIFO */ -#define ISAC_FIFO 0x02 - -/* not really the HSCX, but sort of */ -#define HSCX_FIFO 0x00 -#define HSCX_STAT 0x04 - -/* - * AVM PnP Status Latch 0 read only bits - */ -#define ASL_IRQ_ISAC 0x01 /* ISAC interrupt, active low */ -#define ASL_IRQ_HSCX 0x02 /* HSX interrupt, active low */ -#define ASL_IRQ_TIMER 0x04 /* Timer interrupt, active low */ -#define ASL_IRQ_BCHAN ASL_IRQ_HSCX -/* actually active LOW */ -#define ASL_IRQ_Pending (ASL_IRQ_ISAC | ASL_IRQ_HSCX | ASL_IRQ_TIMER) - -/* - * AVM Status Latch 0 write only bits - */ -#define ASL_RESET_ALL 0x01 /* reset siemens IC's, active 1 */ -#define ASL_TIMERDISABLE 0x02 /* active high */ -#define ASL_TIMERRESET 0x04 /* active high */ -#define ASL_ENABLE_INT 0x08 /* active high */ -#define ASL_TESTBIT 0x10 /* active high */ - -/* - * AVM Status Latch 1 write only bits - */ -#define ASL1_INTSEL 0x0f /* active high */ -#define ASL1_ENABLE_IOM 0x80 /* active high */ - -/* - * "HSCX" mode bits - */ -#define HSCX_MODE_ITF_FLG 0x01 -#define HSCX_MODE_TRANS 0x02 -#define HSCX_MODE_CCR_7 0x04 -#define HSCX_MODE_CCR_16 0x08 -#define HSCX_MODE_TESTLOOP 0x80 - -/* - * "HSCX" status bits - */ -#define HSCX_STAT_RME 0x01 -#define HSCX_STAT_RDO 0x10 -#define HSCX_STAT_CRCVFRRAB 0x0E -#define HSCX_STAT_CRCVFR 0x06 -#define HSCX_STAT_RML_MASK 0x3f00 - -/* - * "HSCX" interrupt bits - */ -#define HSCX_INT_XPR 0x80 -#define HSCX_INT_XDU 0x40 -#define HSCX_INT_RPR 0x20 -#define HSCX_INT_MASK 0xE0 - -/* - * "HSCX" command bits - */ -#define HSCX_CMD_XRS 0x80 -#define HSCX_CMD_XME 0x01 -#define HSCX_CMD_RRS 0x20 -#define HSCX_CMD_XML_MASK 0x3f00 - -/* - * to prevent deactivating the "HSCX" when both channels are active we - * define an HSCX_ACTIVE flag which is or'd into the channel's state - * flag in avm_pnp_bchannel_setup upon active and cleared upon deactivation. - * It is set high to allow room for new flags. - */ -#define HSCX_AVMA1PP_ACTIVE 0x1000 - -/*---------------------------------------------------------------------------* - * AVM read fifo routines - *---------------------------------------------------------------------------*/ - -static void -avm_pnp_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, ISAC_FIFO); - bus_space_read_multi_1(btag, bhandle, ISAC_REG_OFFSET, buf, size); - break; - case ISIC_WHAT_HSCXA: - hscx_read_fifo(0, buf, size, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_read_fifo(1, buf, size, sc); - break; - } -} - -static void -hscx_read_fifo(int chan, void *buf, size_t len, struct l1_softc *sc) -{ - u_int8_t *ip; - size_t cnt; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, chan); - ip = (u_int8_t *)buf; - cnt = 0; - while (cnt++ < len) - { - *ip++ = bus_space_read_1(btag, bhandle, ISAC_REG_OFFSET); - } -} - -/*---------------------------------------------------------------------------* - * AVM write fifo routines - *---------------------------------------------------------------------------*/ -static void -avm_pnp_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, ISAC_FIFO); - bus_space_write_multi_1(btag, bhandle, ISAC_REG_OFFSET, (u_int8_t*)buf, size); - break; - case ISIC_WHAT_HSCXA: - hscx_write_fifo(0, buf, size, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_write_fifo(1, buf, size, sc); - break; - } -} - -static void -hscx_write_fifo(int chan, void *buf, size_t len, struct l1_softc *sc) -{ - u_int8_t *ip; - size_t cnt; - l1_bchan_state_t *Bchan = &sc->sc_chan[chan]; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - sc->avma1pp_cmd &= ~HSCX_CMD_XME; - sc->avma1pp_txl = 0; - - if (Bchan->out_mbuf_cur == NULL) - { - if (Bchan->bprot != BPROT_NONE) - sc->avma1pp_cmd |= HSCX_CMD_XME; - } - if (len != sc->sc_bfifolen) - sc->avma1pp_txl = len; - - hscx_write_reg(chan, HSCX_STAT, sc, 3); - - ip = (u_int8_t *)buf; - cnt = 0; - while (cnt++ < len) - { - bus_space_write_1(btag, bhandle, ISAC_REG_OFFSET, *ip++); - } -} - -/*---------------------------------------------------------------------------* - * AVM write register routines - *---------------------------------------------------------------------------*/ - -static void -avm_pnp_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - u_char reg_bank; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - reg_bank = (offs > MAX_LO_REG_OFFSET) ? ISAC_HI_REG_OFFSET:ISAC_LO_REG_OFFSET; - /* set the register bank */ - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, reg_bank); - bus_space_write_1(btag, bhandle, ISAC_REG_OFFSET + (offs & ISAC_REGSET_MASK), data); - break; - case ISIC_WHAT_HSCXA: - hscx_write_reg_val(0, offs, data, sc); - break; - case ISIC_WHAT_HSCXB: - hscx_write_reg_val(1, offs, data, sc); - break; - } -} - -static void -hscx_write_reg(int chan, u_int off, struct l1_softc *sc, u_int which) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* point at the correct channel */ - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, chan); - if (which & 4) - bus_space_write_1(btag, bhandle, ISAC_REG_OFFSET + off + 2, sc->avma1pp_prot); - if (which & 2) - bus_space_write_1(btag, bhandle, ISAC_REG_OFFSET + off + 1, sc->avma1pp_txl); - if (which & 1) - bus_space_write_1(btag, bhandle, ISAC_REG_OFFSET + off, sc->avma1pp_cmd); -} - -static void -hscx_write_reg_val(int chan, u_int off, u_int8_t val, struct l1_softc *sc) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* point at the correct channel */ - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, chan); - bus_space_write_1(btag, bhandle, ISAC_REG_OFFSET + off, val); -} - -/*---------------------------------------------------------------------------* - * AVM read register routines - *---------------------------------------------------------------------------*/ -static u_int8_t -avm_pnp_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - u_char reg_bank; - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - reg_bank = (offs > MAX_LO_REG_OFFSET) ? ISAC_HI_REG_OFFSET:ISAC_LO_REG_OFFSET; - /* set the register bank */ - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, reg_bank); - return(bus_space_read_1(btag, bhandle, ISAC_REG_OFFSET + - (offs & ISAC_REGSET_MASK))); - case ISIC_WHAT_HSCXA: - return hscx_read_reg(0, offs, sc); - case ISIC_WHAT_HSCXB: - return hscx_read_reg(1, offs, sc); - } - return 0; -} - -static u_int -hscx_read_reg(int chan, u_int off, struct l1_softc *sc) -{ - bus_space_handle_t bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_tag_t btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* point at the correct channel */ - bus_space_write_1(btag, bhandle, ADDR_REG_OFFSET, chan); - return(bus_space_read_1(btag, bhandle, ISAC_REG_OFFSET + off)); -} - - -static struct ifpnp_ids { - u_long vend_id; - char *id_str; -} ifpnp_ids[] = { - { 0x0009cd06, "AVM Fritz!Card PnP" }, - { 0, 0 } -}; - -/*---------------------------------------------------------------------------* - * avm_pnp_probe - probe for a card - *---------------------------------------------------------------------------*/ -static int -avm_pnp_probe(dev) - device_t dev; -{ - struct ifpnp_ids *ids; /* pnp id's */ - char *string = NULL; /* the name */ - u_int32_t vend_id = isa_get_vendorid(dev); /* vendor id */ - - /* search table of knowd id's */ - - for(ids = ifpnp_ids; ids->vend_id != 0; ids++) - { - if(vend_id == ids->vend_id) - { - string = ids->id_str; - break; - } - } - - if(string) /* set name if we have one */ - { - device_set_desc(dev, string); /* set description */ - return 0; - } - else - { - return ENXIO; - } -} - -/*---------------------------------------------------------------------------* - * avm_pnp_attach - attach Fritz!Card PnP - *---------------------------------------------------------------------------*/ -int -avm_pnp_attach(device_t dev) -{ - struct l1_softc *sc; - u_int v; - int unit, error = 0; - int s; - u_int16_t vid; - void *ih = 0; - bus_space_handle_t bhandle; - bus_space_tag_t btag; - - s = splimp(); - - vid = isa_get_vendorid(dev); - sc = device_get_softc(dev); - unit = device_get_unit(dev); - bzero(sc, sizeof(struct l1_softc)); - - /* probably not really required */ - if(unit >= IFPNP_MAXUNIT) { - printf("avm_pnp%d: Error, unit >= IFPNP_MAXUNIT!\n", unit); - splx(s); - return(ENXIO); - } - - ifpnp_scp[unit] = sc; - - - /* get io_base */ - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE ) )) - { - printf("avm_pnp_attach: Couldn't get my io_base.\n"); - return ENXIO; - } - if (sc->sc_resources.io_base[0] == NULL) { - printf("avm_pnp%d: couldn't map IO port\n", unit); - error = ENXIO; - goto fail; - } - - bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - /* will not be used for pnp devices */ - sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]); - - /* get irq, release io_base if we don't get it */ - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE))) - { - printf("avm_pnp%d: Could not get irq.\n",unit); - error = ENXIO; - goto fail; - } - - /* not needed */ - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - error = bus_setup_intr(dev,sc->sc_resources.irq,INTR_TYPE_NET, - NULL, (void(*)(void*))avm_pnp_intr, sc,&ih); - if (error != 0) - { - printf("avm_pnp%d: Could not setup irq.\n",unit); - error = ENXIO; - goto fail; - } - sc->sc_unit = unit; - - /* end of new-bus stuff */ - - ISAC_BASE = (caddr_t)ISIC_WHAT_ISAC; - - HSCX_A_BASE = (caddr_t)ISIC_WHAT_HSCXA; - HSCX_B_BASE = (caddr_t)ISIC_WHAT_HSCXB; - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = avm_pnp_read_reg; - sc->writereg = avm_pnp_write_reg; - - sc->readfifo = avm_pnp_read_fifo; - sc->writefifo = avm_pnp_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_AVM_PNP; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* set up some other miscellaneous things */ - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* reset the card */ - /* the Linux driver does this to clear any pending ISAC interrupts */ - v = 0; - v = ISAC_READ(I_STAR); - v = ISAC_READ(I_MODE); - v = ISAC_READ(I_ADF2); - v = ISAC_READ(I_ISTA); - if (v & ISAC_ISTA_EXI) - { - v = ISAC_READ(I_EXIR); - } - v = ISAC_READ(I_CIRR); - ISAC_WRITE(I_MASK, 0xff); - /* the Linux driver does this to clear any pending HSCX interrupts */ - v = hscx_read_reg(0, HSCX_STAT, sc); - v = hscx_read_reg(1, HSCX_STAT, sc); - - bus_space_write_1(btag, bhandle, STAT0_OFFSET, ASL_RESET_ALL|ASL_TIMERDISABLE); - DELAY(SEC_DELAY/100); /* 10 ms */ - bus_space_write_1(btag, bhandle, STAT1_OFFSET, ASL1_ENABLE_IOM|sc->sc_irq); - DELAY(SEC_DELAY/100); /* 10 ms */ - bus_space_write_1(btag, bhandle, STAT0_OFFSET, ASL_TIMERRESET|ASL_ENABLE_INT|ASL_TIMERDISABLE); - DELAY(SEC_DELAY/100); /* 10 ms */ - - printf("ifpnp%d: AVM Fritz!Card PnP Class %#x Revision %d \n", unit, - bus_space_read_1(btag, bhandle, CLASS_OFFSET), - bus_space_read_1(btag, bhandle, REVISION_OFFSET)); - - printf("ifpnp%d: ISAC %s (IOM-%c)\n", unit, - "2085 Version A1/A2 or 2086/2186 Version 1.1", - sc->sc_bustyp == BUS_TYPE_IOM1 ? '1' : '2'); - - - /* init the ISAC */ - ifpnp_isac_init(sc); - - /* init the "HSCX" */ - avm_pnp_bchannel_setup(sc->sc_unit, HSCX_CH_A, BPROT_NONE, 0); - - avm_pnp_bchannel_setup(sc->sc_unit, HSCX_CH_B, BPROT_NONE, 0); - - /* can't use the normal B-Channel stuff */ - avm_pnp_init_linktab(sc); - - /* set trace level */ - - sc->sc_trace = TRACE_OFF; - - sc->sc_state = ISAC_IDLE; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - sc->sc_freeflag = 0; - - sc->sc_obuf2 = NULL; - sc->sc_freeflag2 = 0; - - callout_handle_init(&sc->sc_T3_callout); - callout_handle_init(&sc->sc_T4_callout); - - /* init higher protocol layers */ - - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &avm_pnp_l1mux_func); - - fail: - splx(s); - return(error); -} - -/* - * this is the real interrupt routine - */ -static void -avm_pnp_hscx_intr(int h_chan, u_int stat, u_int cnt, struct l1_softc *sc) -{ - register l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int activity = -1; - - NDBGL1(L1_H_IRQ, "%#x", stat); - - if((stat & HSCX_INT_XDU) && (chan->bprot != BPROT_NONE))/* xmit data underrun */ - { - chan->stat_XDU++; - NDBGL1(L1_H_XFRERR, "xmit data underrun"); - /* abort the transmission */ - sc->avma1pp_txl = 0; - sc->avma1pp_cmd |= HSCX_CMD_XRS; - hscx_write_reg(h_chan, HSCX_STAT, sc, 1); - sc->avma1pp_cmd &= ~HSCX_CMD_XRS; - hscx_write_reg(h_chan, HSCX_STAT, sc, 1); - - if (chan->out_mbuf_head != NULL) /* don't continue to transmit this buffer */ - { - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_cur = chan->out_mbuf_head = NULL; - } - } - - /* - * The following is based on examination of the Linux driver. - * - * The logic here is different than with a "real" HSCX; all kinds - * of information (interrupt/status bits) are in stat. - * HSCX_INT_RPR indicates a receive interrupt - * HSCX_STAT_RDO indicates an overrun condition, abort - - * otherwise read the bytes ((stat & HSCX_STZT_RML_MASK) >> 8) - * HSCX_STAT_RME indicates end-of-frame and apparently any - * CRC/framing errors are only reported in this state. - * if ((stat & HSCX_STAT_CRCVFRRAB) != HSCX_STAT_CRCVFR) - * CRC/framing error - */ - - if(stat & HSCX_INT_RPR) - { - register int fifo_data_len; - int error = 0; - /* always have to read the FIFO, so use a scratch buffer */ - u_char scrbuf[HSCX_FIFO_LEN]; - - if(stat & HSCX_STAT_RDO) - { - chan->stat_RDO++; - NDBGL1(L1_H_XFRERR, "receive data overflow"); - error++; - } - - /* - * check whether we're receiving data for an inactive B-channel - * and discard it. This appears to happen for telephony when - * both B-channels are active and one is deactivated. Since - * it is not really possible to deactivate the channel in that - * case (the ASIC seems to deactivate _both_ channels), the - * "deactivated" channel keeps receiving data which can lead - * to exhaustion of mbufs and a kernel panic. - * - * This is a hack, but it's the only solution I can think of - * without having the documentation for the ASIC. - * GJ - 28 Nov 1999 - */ - if (chan->state == HSCX_IDLE) - { - NDBGL1(L1_H_XFRERR, "toss data from %d", h_chan); - error++; - } - - fifo_data_len = cnt; - - if(fifo_data_len == 0) - fifo_data_len = sc->sc_bfifolen; - - /* ALWAYS read data from HSCX fifo */ - - HSCX_RDFIFO(h_chan, scrbuf, fifo_data_len); - chan->rxcount += fifo_data_len; - - /* all error conditions checked, now decide and take action */ - - if(error == 0) - { - if(chan->in_mbuf == NULL) - { - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 avm_pnp_hscx_intr: RME, cannot allocate mbuf!\n"); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - - if((chan->in_len + fifo_data_len) <= BCH_MAX_DATALEN) - { - /* OK to copy the data */ - bcopy(scrbuf, chan->in_cbptr, fifo_data_len); - chan->in_cbptr += fifo_data_len; - chan->in_len += fifo_data_len; - - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - if (stat & HSCX_STAT_RME) - { - if((stat & HSCX_STAT_CRCVFRRAB) == HSCX_STAT_CRCVFR) - { - (*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit); - activity = ACT_RX; - - /* mark buffer ptr as unused */ - - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - else - { - chan->stat_CRC++; - NDBGL1(L1_H_XFRERR, "CRC/RAB"); - if (chan->in_mbuf != NULL) - { - i4b_Bfreembuf(chan->in_mbuf); - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - } - } - } /* END enough space in mbuf */ - else - { - if(chan->bprot == BPROT_NONE) - { - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - if(!(i4b_l1_bchan_tel_silence(chan->in_mbuf->m_data, chan->in_mbuf->m_len))) - activity = ACT_RX; - - /* move rx'd data to rx queue */ -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - (void) IF_HANDOFF(&chan->rx_queue, chan->in_mbuf, NULL); -#else - if(!(IF_QFULL(&chan->rx_queue))) - { - IF_ENQUEUE(&chan->rx_queue, chan->in_mbuf); - } - else - { - i4b_Bfreembuf(chan->in_mbuf); - } -#endif - /* signal upper layer that data are available */ - (*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit); - - /* alloc new buffer */ - - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 avm_pnp_hscx_intr: RPF, cannot allocate new mbuf!\n"); - - /* setup new data ptr */ - - chan->in_cbptr = chan->in_mbuf->m_data; - - /* OK to copy the data */ - bcopy(scrbuf, chan->in_cbptr, fifo_data_len); - - chan->in_cbptr += fifo_data_len; - chan->in_len = fifo_data_len; - - chan->rxcount += fifo_data_len; - } - else - { - NDBGL1(L1_H_XFRERR, "RAWHDLC rx buffer overflow in RPF, in_len=%d", chan->in_len); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - } - } /* if(error == 0) */ - else - { - /* land here for RDO */ - if (chan->in_mbuf != NULL) - { - i4b_Bfreembuf(chan->in_mbuf); - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - sc->avma1pp_txl = 0; - sc->avma1pp_cmd |= HSCX_CMD_RRS; - hscx_write_reg(h_chan, HSCX_STAT, sc, 1); - sc->avma1pp_cmd &= ~HSCX_CMD_RRS; - hscx_write_reg(h_chan, HSCX_STAT, sc, 1); - } - } - - - /* transmit fifo empty, new data can be written to fifo */ - - if(stat & HSCX_INT_XPR) - { - /* - * for a description what is going on here, please have - * a look at isic_bchannel_start() in i4b_bchan.c ! - */ - - NDBGL1(L1_H_IRQ, "unit %d, chan %d - XPR, Tx Fifo Empty!", sc->sc_unit, h_chan); - - if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */ - { - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) - { - chan->state &= ~HSCX_TX_ACTIVE; - (*chan->isic_drvr_linktab->bch_tx_queue_empty)(chan->isic_drvr_linktab->unit); - } - else - { - chan->state |= HSCX_TX_ACTIVE; - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - } - } - - avm_pnp_hscx_fifo(chan, sc); - } - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); -} - -/* - * this is the main routine which checks each channel and then calls - * the real interrupt routine as appropriate - */ -static void -avm_pnp_hscx_int_handler(struct l1_softc *sc) -{ - u_char stat = 0; - u_char cnt = 0; - - stat = hscx_read_reg(0, HSCX_STAT, sc); - if (stat & HSCX_INT_RPR) - cnt = hscx_read_reg(0, HSCX_STAT+1, sc); - if (stat & HSCX_INT_MASK) - avm_pnp_hscx_intr(0, stat, cnt, sc); - - cnt = 0; - stat = hscx_read_reg(1, HSCX_STAT, sc); - if (stat & HSCX_INT_RPR) - cnt = hscx_read_reg(1, HSCX_STAT+1, sc); - if (stat & HSCX_INT_MASK) - avm_pnp_hscx_intr(1, stat, cnt, sc); -} - -static void -avm_pnp_intr(void *xsc) -{ - u_char stat; - struct l1_softc *sc; - bus_space_handle_t bhandle; - bus_space_tag_t btag; - - sc = xsc; - bhandle = rman_get_bushandle(sc->sc_resources.io_base[0]); - btag = rman_get_bustag(sc->sc_resources.io_base[0]); - - stat = bus_space_read_1(btag, bhandle, STAT0_OFFSET); - NDBGL1(L1_H_IRQ, "stat %x", stat); - /* was there an interrupt from this card ? */ - if ((stat & ASL_IRQ_Pending) == ASL_IRQ_Pending) - return; /* no */ - /* interrupts are low active */ - if (!(stat & ASL_IRQ_TIMER)) - NDBGL1(L1_H_IRQ, "timer interrupt ???"); - if (!(stat & ASL_IRQ_HSCX)) - { - NDBGL1(L1_H_IRQ, "HSCX"); - avm_pnp_hscx_int_handler(sc); - } - if (!(stat & ASL_IRQ_ISAC)) - { - NDBGL1(L1_H_IRQ, "ISAC"); - ifpnp_isac_intr(sc); - } -} - -static void -avm_pnp_hscx_init(struct l1_softc *sc, int h_chan, int activate) -{ - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", - sc->sc_unit, h_chan, activate ? "activate" : "deactivate"); - - if (activate == 0) - { - /* only deactivate if both channels are idle */ - if (sc->sc_chan[HSCX_CH_A].state != HSCX_IDLE || - sc->sc_chan[HSCX_CH_B].state != HSCX_IDLE) - { - return; - } - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_TRANS; - hscx_write_reg(h_chan, HSCX_STAT, sc, 5); - return; - } - if(chan->bprot == BPROT_RHDLC) - { - NDBGL1(L1_BCHAN, "BPROT_RHDLC"); - - /* HDLC Frames, transparent mode 0 */ - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_ITF_FLG; - hscx_write_reg(h_chan, HSCX_STAT, sc, 5); - sc->avma1pp_cmd = HSCX_CMD_XRS; - hscx_write_reg(h_chan, HSCX_STAT, sc, 1); - sc->avma1pp_cmd = 0; - } - else - { - NDBGL1(L1_BCHAN, "BPROT_NONE??"); - - /* Raw Telephony, extended transparent mode 1 */ - sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS; - sc->avma1pp_prot = HSCX_MODE_TRANS; - hscx_write_reg(h_chan, HSCX_STAT, sc, 5); - sc->avma1pp_cmd = HSCX_CMD_XRS; - hscx_write_reg(h_chan, HSCX_STAT, sc, 1); - sc->avma1pp_cmd = 0; - } -} - -static void -avm_pnp_bchannel_setup(int unit, int h_chan, int bprot, int activate) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - int s = SPLI4B(); - - if(activate == 0) - { - /* deactivation */ - chan->state = HSCX_IDLE; - avm_pnp_hscx_init(sc, h_chan, activate); - } - - NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", - sc->sc_unit, h_chan, activate ? "activate" : "deactivate"); - - /* general part */ - - chan->unit = sc->sc_unit; /* unit number */ - chan->channel = h_chan; /* B channel */ - chan->bprot = bprot; /* B channel protocol */ - chan->state = HSCX_IDLE; /* B channel state */ - - /* receiver part */ - - chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avm_pnp_rx", NULL, MTX_DEF); -#endif - - i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ - - chan->rxcount = 0; /* reset rx counter */ - - i4b_Bfreembuf(chan->in_mbuf); /* clean rx mbuf */ - - chan->in_mbuf = NULL; /* reset mbuf ptr */ - chan->in_cbptr = NULL; /* reset mbuf curr ptr */ - chan->in_len = 0; /* reset mbuf data len */ - - /* transmitter part */ - - chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avm_pnp_tx", NULL, MTX_DEF); -#endif - i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ - - chan->txcount = 0; /* reset tx counter */ - - i4b_Bfreembuf(chan->out_mbuf_head); /* clean tx mbuf */ - - chan->out_mbuf_head = NULL; /* reset head mbuf ptr */ - chan->out_mbuf_cur = NULL; /* reset current mbuf ptr */ - chan->out_mbuf_cur_ptr = NULL; /* reset current mbuf data ptr */ - chan->out_mbuf_cur_len = 0; /* reset current mbuf data cnt */ - - if(activate != 0) - { - /* activation */ - avm_pnp_hscx_init(sc, h_chan, activate); - chan->state |= HSCX_AVMA1PP_ACTIVE; - } - - splx(s); -} - -static void -avm_pnp_bchannel_start(int unit, int h_chan) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - register l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - int activity = -1; - - s = SPLI4B(); /* enter critical section */ - if(chan->state & HSCX_TX_ACTIVE) /* already running ? */ - { - splx(s); - return; /* yes, leave */ - } - - /* get next mbuf from queue */ - - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) /* queue empty ? */ - { - splx(s); /* leave critical section */ - return; /* yes, exit */ - } - - /* init current mbuf values */ - - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - - /* activity indicator for timeout handling */ - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - - chan->state |= HSCX_TX_ACTIVE; /* we start transmitting */ - - if(sc->sc_trace & TRACE_B_TX) /* if trace, send mbuf to trace dev */ - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - avm_pnp_hscx_fifo(chan, sc); - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); - - splx(s); -} - -/*---------------------------------------------------------------------------* - * return the address of isic drivers linktab - *---------------------------------------------------------------------------*/ -static isdn_link_t * -avm_pnp_ret_linktab(int unit, int channel) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - return(&chan->isic_isdn_linktab); -} - -/*---------------------------------------------------------------------------* - * set the driver linktab in the b channel softc - *---------------------------------------------------------------------------*/ -static void -avm_pnp_set_linktab(int unit, int channel, drvr_link_t *dlt) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - chan->isic_drvr_linktab = dlt; -} - - -/*---------------------------------------------------------------------------* - * initialize our local linktab - *---------------------------------------------------------------------------*/ -static void -avm_pnp_init_linktab(struct l1_softc *sc) -{ - l1_bchan_state_t *chan = &sc->sc_chan[HSCX_CH_A]; - isdn_link_t *lt = &chan->isic_isdn_linktab; - - /* make sure the hardware driver is known to layer 4 */ - /* avoid overwriting if already set */ - if (ctrl_types[CTRL_PASSIVE].set_linktab == NULL) - { - ctrl_types[CTRL_PASSIVE].set_linktab = avm_pnp_set_linktab; - ctrl_types[CTRL_PASSIVE].get_linktab = avm_pnp_ret_linktab; - } - - /* local setup */ - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_A; - lt->bch_config = avm_pnp_bchannel_setup; - lt->bch_tx_start = avm_pnp_bchannel_start; - lt->bch_stat = avm_pnp_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; - - chan = &sc->sc_chan[HSCX_CH_B]; - lt = &chan->isic_isdn_linktab; - - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_B; - lt->bch_config = avm_pnp_bchannel_setup; - lt->bch_tx_start = avm_pnp_bchannel_start; - lt->bch_stat = avm_pnp_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; -} - -/* - * use this instead of isic_bchannel_stat in i4b_bchan.c because it's static - */ -static void -avm_pnp_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - - s = SPLI4B(); - - bsp->outbytes = chan->txcount; - bsp->inbytes = chan->rxcount; - - chan->txcount = 0; - chan->rxcount = 0; - - splx(s); -} - -/*---------------------------------------------------------------------------* - * fill HSCX fifo with data from the current mbuf - * Put this here until it can go into i4b_hscx.c - *---------------------------------------------------------------------------*/ -static int -avm_pnp_hscx_fifo(l1_bchan_state_t *chan, struct l1_softc *sc) -{ - int len; - int nextlen; - int i; - int cmd = 0; - /* using a scratch buffer simplifies writing to the FIFO */ - u_char scrbuf[HSCX_FIFO_LEN]; - - len = 0; - - /* - * fill the HSCX tx fifo with data from the current mbuf. if - * current mbuf holds less data than HSCX fifo length, try to - * get the next mbuf from (a possible) mbuf chain. if there is - * not enough data in a single mbuf or in a chain, then this - * is the last mbuf and we tell the HSCX that it has to send - * CRC and closing flag - */ - - while(chan->out_mbuf_cur && len != sc->sc_bfifolen) - { - nextlen = min(chan->out_mbuf_cur_len, sc->sc_bfifolen - len); - -#ifdef NOTDEF - printf("i:mh=%p, mc=%p, mcp=%p, mcl=%d l=%d nl=%d # ", - chan->out_mbuf_head, - chan->out_mbuf_cur, - chan->out_mbuf_cur_ptr, - chan->out_mbuf_cur_len, - len, - nextlen); -#endif - - cmd |= HSCX_CMDR_XTF; - /* collect the data in the scratch buffer */ - for (i = 0; i < nextlen; i++) - scrbuf[i + len] = chan->out_mbuf_cur_ptr[i]; - - len += nextlen; - chan->txcount += nextlen; - - chan->out_mbuf_cur_ptr += nextlen; - chan->out_mbuf_cur_len -= nextlen; - - if(chan->out_mbuf_cur_len == 0) - { - if((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL) - { - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = (chan->channel == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - } - else - { - if (chan->bprot != BPROT_NONE) - cmd |= HSCX_CMDR_XME; - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_head = NULL; - } - } - } - /* write what we have from the scratch buf to the HSCX fifo */ - if (len != 0) - HSCX_WRFIFO(chan->channel, scrbuf, len); - return(cmd); -} - -/*---------------------------------------------------------------------------* - * ifpnp - ISAC interrupt routine - *---------------------------------------------------------------------------*/ -static void -ifpnp_isac_intr(struct l1_softc *sc) -{ - register u_char isac_irq_stat; - - for(;;) - { - /* get isac irq status */ - isac_irq_stat = ISAC_READ(I_ISTA); - - if(isac_irq_stat) - ifpnp_isac_irq(sc, isac_irq_stat); /* isac handler */ - else - break; - } - - ISAC_WRITE(I_MASK, 0xff); - - DELAY(100); - - ISAC_WRITE(I_MASK, ISAC_IMASK); -} - -/*---------------------------------------------------------------------------* - * ifpnp_recover - try to recover from irq lockup - *---------------------------------------------------------------------------*/ -void -ifpnp_recover(struct l1_softc *sc) -{ - u_char byte; - - /* get isac irq status */ - - byte = ISAC_READ(I_ISTA); - - NDBGL1(L1_ERROR, " ISAC: ISTA = 0x%x", byte); - - if(byte & ISAC_ISTA_EXI) - NDBGL1(L1_ERROR, " ISAC: EXIR = 0x%x", (u_char)ISAC_READ(I_EXIR)); - - if(byte & ISAC_ISTA_CISQ) - { - byte = ISAC_READ(I_CIRR); - - NDBGL1(L1_ERROR, " ISAC: CISQ = 0x%x", byte); - - if(byte & ISAC_CIRR_SQC) - NDBGL1(L1_ERROR, " ISAC: SQRR = 0x%x", (u_char)ISAC_READ(I_SQRR)); - } - - NDBGL1(L1_ERROR, " ISAC: IMASK = 0x%x", ISAC_IMASK); - - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - ISAC_WRITE(I_MASK, ISAC_IMASK); -} diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_ext.h b/sys/i4b/layer1/ifpnp/i4b_ifpnp_ext.h deleted file mode 100644 index e89dacf0e545..000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_ext.h +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * Copyright (c) 2000 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpnp - Fritz!Card PnP for split layers - * ------------------------------------------- - * - * $Id: i4b_ifpnp_ext.h,v 1.2 2000/06/02 16:14:36 hm Exp $ - * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_ext.h,v 1.4 2000/04/18 08:03:05 ust Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jun 2 14:54:57 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IFPNP_EXT_H_ -#define _I4B_IFPNP_EXT_H_ - -#include - -void ifpnp_set_linktab(int unit, int channel, drvr_link_t * dlt); -isdn_link_t *ifpnp_ret_linktab(int unit, int channel); - -int ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag); -int ifpnp_ph_activate_req(int unit); -int ifpnp_mph_command_req(int unit, int command, void *parm); - -void ifpnp_isac_irq(struct l1_softc *sc, int ista); -void ifpnp_isac_l1_cmd(struct l1_softc *sc, int command); -int ifpnp_isac_init(struct l1_softc *sc); - -void ifpnp_recover(struct l1_softc *sc); -char * ifpnp_printstate(struct l1_softc *sc); -void ifpnp_next_state(struct l1_softc *sc, int event); - -#define IFPNP_MAXUNIT 4 -extern struct l1_softc *ifpnp_scp[IFPNP_MAXUNIT]; - -#endif /* _I4B_IFPNP_EXT_H_ */ diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_isac.c b/sys/i4b/layer1/ifpnp/i4b_ifpnp_isac.c deleted file mode 100644 index 4a9494087a29..000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_isac.c +++ /dev/null @@ -1,659 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpnp_isac.c - i4b Fritz PnP ISAC handler - * --------------------------------------------- - * $Id: i4b_ifpnp_isac.c,v 1.3 2000/05/29 15:41:41 hm Exp $ - * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_isac.c,v 1.4 2000/04/18 08:03:05 ust Exp $ - * last edit-date: [Mon May 29 15:24:49 2000] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include - -static u_char ifpnp_isac_exir_hdlr(register struct l1_softc *sc, u_char exir); -static void ifpnp_isac_ind_hdlr(register struct l1_softc *sc, int ind); - -/*---------------------------------------------------------------------------* - * ISAC interrupt service routine - *---------------------------------------------------------------------------*/ -void -ifpnp_isac_irq(struct l1_softc *sc, int ista) -{ - register u_char c = 0; - NDBGL1(L1_F_MSG, "unit %d: ista = 0x%02x", sc->sc_unit, ista); - - if(ista & ISAC_ISTA_EXI) /* extended interrupt */ - { - c |= ifpnp_isac_exir_hdlr(sc, ISAC_READ(I_EXIR)); - } - - if(ista & ISAC_ISTA_RME) /* receive message end */ - { - register int rest; - u_char rsta; - - /* get rx status register */ - - rsta = ISAC_READ(I_RSTA); - - if((rsta & ISAC_RSTA_MASK) != 0x20) - { - int error = 0; - - if(!(rsta & ISAC_RSTA_CRC)) /* CRC error */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: CRC error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RDO) /* ReceiveDataOverflow */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Data Overrun error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RAB) /* ReceiveABorted */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Receive Aborted error", sc->sc_unit); - } - - if(error == 0) - NDBGL1(L1_I_ERR, "unit %d: RME unknown error, RSTA = 0x%02x!", sc->sc_unit, rsta); - - i4b_Dfreembuf(sc->sc_ibuf); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - ISAC_WRITE(I_CMDR, ISAC_CMDR_RMC|ISAC_CMDR_RRES); - ISACCMDRWRDELAY(); - - return; - } - - rest = (ISAC_READ(I_RBCL) & (ISAC_FIFO_LEN-1)); - - if(rest == 0) - rest = ISAC_FIFO_LEN; - - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(rest)) != NULL) - sc->sc_ib = sc->sc_ibuf->m_data; - else - panic("ifpnp_isac_irq: RME, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - rest)) - { - ISAC_RDFIFO(sc->sc_ib, rest); - sc->sc_ilen += rest; - - sc->sc_ibuf->m_pkthdr.len = - sc->sc_ibuf->m_len = sc->sc_ilen; - - if(sc->sc_trace & TRACE_D_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data); - } - - c |= ISAC_CMDR_RMC; - - if(sc->sc_enabled && - (ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S)) - { - i4b_l1_ph_data_ind(L0IFPNPUNIT(sc->sc_unit), sc->sc_ibuf); - } - else - { - i4b_Dfreembuf(sc->sc_ibuf); - } - } - else - { - NDBGL1(L1_I_ERR, "RME, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - } - - if(ista & ISAC_ISTA_RPF) /* receive fifo full */ - { - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(MAX_DFRAME_LEN)) != NULL) - sc->sc_ib= sc->sc_ibuf->m_data; - else - panic("ifpnp_isac_irq: RPF, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - ISAC_FIFO_LEN)) - { - ISAC_RDFIFO(sc->sc_ib, ISAC_FIFO_LEN); - sc->sc_ilen += ISAC_FIFO_LEN; - sc->sc_ib += ISAC_FIFO_LEN; - c |= ISAC_CMDR_RMC; - } - else - { - NDBGL1(L1_I_ERR, "RPF, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - } - - if(ista & ISAC_ISTA_XPR) /* transmit fifo empty (XPR bit set) */ - { - if((sc->sc_obuf2 != NULL) && (sc->sc_obuf == NULL)) - { - sc->sc_freeflag = sc->sc_freeflag2; - sc->sc_obuf = sc->sc_obuf2; - sc->sc_op = sc->sc_obuf->m_data; - sc->sc_ol = sc->sc_obuf->m_len; - sc->sc_obuf2 = NULL; -#ifdef NOTDEF - printf("ob2=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - else - { -#ifdef NOTDEF - printf("ob=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - - if(sc->sc_obuf) - { - ISAC_WRFIFO(sc->sc_op, min(sc->sc_ol, ISAC_FIFO_LEN)); - - if(sc->sc_ol > ISAC_FIFO_LEN) /* length > 32 ? */ - { - sc->sc_op += ISAC_FIFO_LEN; /* bufferptr+32 */ - sc->sc_ol -= ISAC_FIFO_LEN; /* length - 32 */ - c |= ISAC_CMDR_XTF; /* set XTF bit */ - } - else - { - if(sc->sc_freeflag) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_freeflag = 0; - } - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - c |= ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - } - else - { - sc->sc_state &= ~ISAC_TX_ACTIVE; - } - } - - if(ista & ISAC_ISTA_CISQ) /* channel status change CISQ */ - { - register u_char ci; - - /* get command/indication rx register*/ - - ci = ISAC_READ(I_CIRR); - - /* if S/Q IRQ, read SQC reg to clr SQC IRQ */ - - if(ci & ISAC_CIRR_SQC) - (void) ISAC_READ(I_SQRR); - - /* C/I code change IRQ (flag already cleared by CIRR read) */ - - if(ci & ISAC_CIRR_CIC0) - ifpnp_isac_ind_hdlr(sc, (ci >> 2) & 0xf); - } - - if(c) - { - ISAC_WRITE(I_CMDR, c); - ISACCMDRWRDELAY(); - } -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Extended IRQ handler - *---------------------------------------------------------------------------*/ -static u_char -ifpnp_isac_exir_hdlr(register struct l1_softc *sc, u_char exir) -{ - u_char c = 0; - - if(exir & ISAC_EXIR_XMR) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Message Repeat"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_XDU) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Data Underrun"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_PCE) - { - NDBGL1(L1_I_ERR, "EXIRQ Protocol Error"); - } - - if(exir & ISAC_EXIR_RFO) - { - NDBGL1(L1_I_ERR, "EXIRQ Rx Frame Overflow"); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - if(exir & ISAC_EXIR_SOV) - { - NDBGL1(L1_I_ERR, "EXIRQ Sync Xfer Overflow"); - } - - if(exir & ISAC_EXIR_MOS) - { - NDBGL1(L1_I_ERR, "EXIRQ Monitor Status"); - } - - if(exir & ISAC_EXIR_SAW) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Subscriber Awake"); - } - - if(exir & ISAC_EXIR_WOV) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Watchdog Timer Overflow"); - } - - return(c); -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Indication handler - *---------------------------------------------------------------------------*/ -static void -ifpnp_isac_ind_hdlr(register struct l1_softc *sc, int ind) -{ - register int event; - - switch(ind) - { - case ISAC_CIRR_IAI8: - NDBGL1(L1_I_CICO, "rx AI8 in state %s", ifpnp_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpnp_isac_l1_cmd(sc, CMD_AR8); - event = EV_INFO48; - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IAI10: - NDBGL1(L1_I_CICO, "rx AI10 in state %s", ifpnp_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpnp_isac_l1_cmd(sc, CMD_AR10); - event = EV_INFO410; - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IRSY: - NDBGL1(L1_I_CICO, "rx RSY in state %s", ifpnp_printstate(sc)); - event = EV_RSY; - break; - - case ISAC_CIRR_IPU: - NDBGL1(L1_I_CICO, "rx PU in state %s", ifpnp_printstate(sc)); - event = EV_PU; - break; - - case ISAC_CIRR_IDR: - NDBGL1(L1_I_CICO, "rx DR in state %s", ifpnp_printstate(sc)); - ifpnp_isac_l1_cmd(sc, CMD_DIU); - event = EV_DR; - break; - - case ISAC_CIRR_IDID: - NDBGL1(L1_I_CICO, "rx DID in state %s", ifpnp_printstate(sc)); - event = EV_INFO0; - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_L1STAT, LAYER_IDLE, NULL); - break; - - case ISAC_CIRR_IDIS: - NDBGL1(L1_I_CICO, "rx DIS in state %s", ifpnp_printstate(sc)); - event = EV_DIS; - break; - - case ISAC_CIRR_IEI: - NDBGL1(L1_I_CICO, "rx EI in state %s", ifpnp_printstate(sc)); - ifpnp_isac_l1_cmd(sc, CMD_DIU); - event = EV_EI; - break; - - case ISAC_CIRR_IARD: - NDBGL1(L1_I_CICO, "rx ARD in state %s", ifpnp_printstate(sc)); - event = EV_INFO2; - break; - - case ISAC_CIRR_ITI: - NDBGL1(L1_I_CICO, "rx TI in state %s", ifpnp_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_IATI: - NDBGL1(L1_I_CICO, "rx ATI in state %s", ifpnp_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_ISD: - NDBGL1(L1_I_CICO, "rx SD in state %s", ifpnp_printstate(sc)); - event = EV_INFO0; - break; - - default: - NDBGL1(L1_I_ERR, "UNKNOWN Indication 0x%x in state %s", ind, ifpnp_printstate(sc)); - event = EV_INFO0; - break; - } - ifpnp_next_state(sc, event); -} - -/*---------------------------------------------------------------------------* - * execute a layer 1 command - *---------------------------------------------------------------------------*/ -void -ifpnp_isac_l1_cmd(struct l1_softc *sc, int command) -{ - u_char cmd; - -#ifdef I4B_SMP_WORKAROUND - - /* XXXXXXXXXXXXXXXXXXX */ - - /* - * patch from Wolfgang Helbig: - * - * Here is a patch that makes i4b work on an SMP: - * The card (TELES 16.3) didn't interrupt on an SMP machine. - * This is a gross workaround, but anyway it works *and* provides - * some information as how to finally fix this problem. - */ - - HSCX_WRITE(0, H_MASK, 0xff); - HSCX_WRITE(1, H_MASK, 0xff); - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - HSCX_WRITE(0, H_MASK, HSCX_A_IMASK); - HSCX_WRITE(1, H_MASK, HSCX_B_IMASK); - ISAC_WRITE(I_MASK, ISAC_IMASK); - - /* XXXXXXXXXXXXXXXXXXX */ - -#endif /* I4B_SMP_WORKAROUND */ - - if(command < 0 || command > CMD_ILL) - { - NDBGL1(L1_I_ERR, "illegal cmd 0x%x in state %s", command, ifpnp_printstate(sc)); - return; - } - - if(sc->sc_bustyp == BUS_TYPE_IOM2) - cmd = ISAC_CIX0_LOW; - else - cmd = 0; - - switch(command) - { - case CMD_TIM: - NDBGL1(L1_I_CICO, "tx TIM in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CTIM << 2); - break; - - case CMD_RS: - NDBGL1(L1_I_CICO, "tx RS in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CRS << 2); - break; - - case CMD_AR8: - NDBGL1(L1_I_CICO, "tx AR8 in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CAR8 << 2); - break; - - case CMD_AR10: - NDBGL1(L1_I_CICO, "tx AR10 in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CAR10 << 2); - break; - - case CMD_DIU: - NDBGL1(L1_I_CICO, "tx DIU in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CDIU << 2); - break; - } - ISAC_WRITE(I_CIXR, cmd); -} - -/*---------------------------------------------------------------------------* - * L1 ISAC initialization - *---------------------------------------------------------------------------*/ -int -ifpnp_isac_init(struct l1_softc *sc) -{ - ISAC_IMASK = 0xff; /* disable all irqs */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - if(sc->sc_bustyp != BUS_TYPE_IOM2) - { - NDBGL1(L1_I_SETUP, "configuring for IOM-1 mode"); - - /* ADF2: Select mode IOM-1 */ - ISAC_WRITE(I_ADF2, 0x00); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SAC - SIP port high Z - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 and B2 switched to/from SPa - */ - ISAC_WRITE(I_SPCR, ISAC_SPCR_C1C1|ISAC_SPCR_C2C1); - - /* SQXR: S/Q channel xmit register: - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * CFS - IOM clock/frame always active - * FSC1/2 - polarity of 8kHz strobe - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, ISAC_ADF1_FC2); /* ADF1 */ - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - else - { - NDBGL1(L1_I_SETUP, "configuring for IOM-2 mode"); - - /* ADF2: Select mode IOM-2 */ - ISAC_WRITE(I_ADF2, ISAC_ADF2_IMS); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 + C1 and B2 + IC2 monitoring - */ - ISAC_WRITE(I_SPCR, 0x00); - - /* SQXR: S/Q channel xmit register: - * IDC - IOM direction = 0 (master) - * CFS - Config Select = 0 (clock always active) - * CI1E - C/I channel 1 IRQ enable = 0 - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * IOF - IOM i/f off = 0 - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, 0x00); - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - -#ifdef NOTDEF - /* - * XXX a transmitter reset causes an ISAC tx IRQ which will not - * be serviced at attach time under some circumstances leaving - * the associated IRQ line on the ISA bus active. This prevents - * any further interrupts to be serviced because no low -> high - * transition can take place anymore. (-hm) - */ - - /* command register: - * RRES - HDLC receiver reset - * XRES - transmitter reset - */ - ISAC_WRITE(I_CMDR, ISAC_CMDR_RRES|ISAC_CMDR_XRES); - ISACCMDRWRDELAY(); -#endif - - /* enabled interrupts: - * =================== - * RME - receive message end - * RPF - receive pool full - * XPR - transmit pool ready - * CISQ - CI or S/Q channel change - * EXI - extended interrupt - */ - - ISAC_IMASK = ISAC_MASK_RSC | /* auto mode only */ - ISAC_MASK_TIN | /* timer irq */ - ISAC_MASK_SIN; /* sync xfer irq */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - return(0); -} diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c b/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c deleted file mode 100644 index e0cfc502db15..000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c +++ /dev/null @@ -1,237 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpnp_l1.c - AVM Fritz PnP layer 1 handler - * ---------------------------------------------- - * $Id: i4b_ifpnp_l1.c,v 1.4 2000/06/02 16:14:36 hm Exp $ - * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_l1.c,v 1.4 2000/04/18 08:03:05 ust Exp $ - * last edit-date: [Fri Jun 2 14:55:49 2000] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-DATA-REQUEST - * ========================= - * - * parms: - * unit physical interface unit number - * m mbuf containing L2 frame to be sent out - * freeflag MBUF_FREE: free mbuf here after having sent - * it out - * MBUF_DONTFREE: mbuf is freed by Layer 2 - * returns: - * ==0 fail, nothing sent out - * !=0 ok, frame sent out - * - *---------------------------------------------------------------------------*/ -int -ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - u_char cmd; - int s; - struct l1_softc *sc = ifpnp_scp[unit]; - -#ifdef NOTDEF - NDBGL1(L1_PRIM, "PH-DATA-REQ, unit %d, freeflag=%d", unit, freeflag); -#endif - - if(m == NULL) /* failsafe */ - return (0); - - s = SPLI4B(); - - if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ - { - NDBGL1(L1_I_ERR, "still in state F3!"); - ifpnp_ph_activate_req(unit); - } - - if(sc->sc_state & ISAC_TX_ACTIVE) - { - if(sc->sc_obuf2 == NULL) - { - sc->sc_obuf2 = m; /* save mbuf ptr */ - - if(freeflag) - sc->sc_freeflag2 = 1; /* IRQ must mfree */ - else - sc->sc_freeflag2 = 0; /* IRQ must not mfree */ - - NDBGL1(L1_I_MSG, "using 2nd ISAC TX buffer, state = %s", ifpnp_printstate(sc)); - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - splx(s); - return(1); - } - - NDBGL1(L1_I_ERR, "No Space in TX FIFO, state = %s", ifpnp_printstate(sc)); - - if(freeflag == MBUF_FREE) - i4b_Dfreembuf(m); - - splx(s); - return (0); - } - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - sc->sc_state |= ISAC_TX_ACTIVE; /* set transmitter busy flag */ - - NDBGL1(L1_I_MSG, "ISAC_TX_ACTIVE set"); - - sc->sc_freeflag = 0; /* IRQ must NOT mfree */ - - ISAC_WRFIFO(m->m_data, min(m->m_len, ISAC_FIFO_LEN)); /* output to TX fifo */ - - if(m->m_len > ISAC_FIFO_LEN) /* message > 32 bytes ? */ - { - sc->sc_obuf = m; /* save mbuf ptr */ - sc->sc_op = m->m_data + ISAC_FIFO_LEN; /* ptr for irq hdl */ - sc->sc_ol = m->m_len - ISAC_FIFO_LEN; /* length for irq hdl */ - - if(freeflag) - sc->sc_freeflag = 1; /* IRQ must mfree */ - - cmd = ISAC_CMDR_XTF; - } - else - { - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - if(freeflag) - i4b_Dfreembuf(m); - - cmd = ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - - ISAC_WRITE(I_CMDR, cmd); - ISACCMDRWRDELAY(); - - splx(s); - - return(1); -} - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-ACTIVATE-REQUEST - * ============================= - * - * parms: - * unit physical interface unit number - * - * returns: - * ==0 - * !=0 - * - *---------------------------------------------------------------------------*/ -int -ifpnp_ph_activate_req(int unit) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - NDBGL1(L1_PRIM, "PH-ACTIVATE-REQ, unit %d\n", unit); - ifpnp_next_state(sc, EV_PHAR); - return(0); -} - -/*---------------------------------------------------------------------------* - * command from the upper layers - *---------------------------------------------------------------------------*/ -int -ifpnp_mph_command_req(int unit, int command, void *parm) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - - switch(command) - { - case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DOPEN", unit); - sc->sc_enabled = 1; - break; - - case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DCLOSE", unit); - sc->sc_enabled = 0; - break; - - case CMR_SETTRACE: - NDBGL1(L1_PRIM, "unit %d, command = CMR_SETTRACE, parm = %d", unit, (unsigned int)parm); - sc->sc_trace = (unsigned int)parm; - break; - - default: - NDBGL1(L1_ERROR, "ERROR, unknown command = %d, unit = %d, parm = %d", command, unit, (unsigned int)parm); - break; - } - - return(0); -} diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c b/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c deleted file mode 100644 index 6a26c0e74752..000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c +++ /dev/null @@ -1,510 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ifpnp_l1fsm.c - AVM Fritz PnP layer 1 I.430 state machine - * ------------------------------------------------------------- - * $Id: i4b_ifpnp_l1fsm.c,v 1.4 2000/05/29 15:41:41 hm Exp $ - * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_l1fsm.c,v 1.4 2000/04/18 08:03:05 ust Exp $ - * last edit-date: [Mon May 29 15:25:04 2000] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include - -#include - -#include - -#include - -#if DO_I4B_DEBUG -static char *state_text[N_STATES] = { - "F3 Deactivated", - "F4 Awaiting Signal", - "F5 Identifying Input", - "F6 Synchronized", - "F7 Activated", - "F8 Lost Framing", - "Illegal State" -}; - -static char *event_text[N_EVENTS] = { - "EV_PHAR PH_ACT_REQ", - "EV_T3 Timer 3 expired", - "EV_INFO0 INFO0 received", - "EV_RSY Level Detected", - "EV_INFO2 INFO2 received", - "EV_INFO48 INFO4 received", - "EV_INFO410 INFO4 received", - "EV_DR Deactivate Req", - "EV_PU Power UP", - "EV_DIS Disconnected", - "EV_EI Error Ind", - "Illegal Event" -}; -#endif - -/* Function prototypes */ - -static void timer3_expired (struct l1_softc *sc); -static void T3_start (struct l1_softc *sc); -static void T3_stop (struct l1_softc *sc); -static void F_T3ex (struct l1_softc *sc); -static void timer4_expired (struct l1_softc *sc); -static void T4_start (struct l1_softc *sc); -static void T4_stop (struct l1_softc *sc); -static void F_AI8 (struct l1_softc *sc); -static void F_AI10 (struct l1_softc *sc); -static void F_I01 (struct l1_softc *sc); -static void F_I02 (struct l1_softc *sc); -static void F_I03 (struct l1_softc *sc); -static void F_I2 (struct l1_softc *sc); -static void F_ill (struct l1_softc *sc); -static void F_NULL (struct l1_softc *sc); - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expire function - *---------------------------------------------------------------------------*/ -static void -timer3_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T3) - { - NDBGL1(L1_T_ERR, "state = %s", ifpnp_printstate(sc)); - sc->sc_I430T3 = 0; - - /* XXX try some recovery here XXX */ - - ifpnp_recover(sc); - - sc->sc_init_tries++; /* increment retry count */ - -/*XXX*/ if(sc->sc_init_tries > 4) - { - int s = SPLI4B(); - - sc->sc_init_tries = 0; - - if(sc->sc_obuf2 != NULL) - { - i4b_Dfreembuf(sc->sc_obuf2); - sc->sc_obuf2 = NULL; - } - if(sc->sc_obuf != NULL) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_obuf = NULL; - sc->sc_freeflag = 0; - sc->sc_op = NULL; - sc->sc_ol = 0; - } - - splx(s); - - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); - } - - ifpnp_next_state(sc, EV_T3); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 start - *---------------------------------------------------------------------------*/ -static void -T3_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - sc->sc_I430T3 = 1; - sc->sc_T3_callout = timeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, 2*hz); -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 stop - *---------------------------------------------------------------------------*/ -static void -T3_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - - sc->sc_init_tries = 0; /* init connect retry count */ - - if(sc->sc_I430T3) - { - sc->sc_I430T3 = 0; - untimeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, sc->sc_T3_callout); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expiry - *---------------------------------------------------------------------------*/ -static void -F_T3ex(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_T3ex executing"); - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPNPUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * Timer T4 expire function - *---------------------------------------------------------------------------*/ -static void -timer4_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T4) - { - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - sc->sc_I430T4 = 0; - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_PDEACT, 0, NULL); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * Timer T4 start - *---------------------------------------------------------------------------*/ -static void -T4_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - sc->sc_I430T4 = 1; - sc->sc_T4_callout = timeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, hz); -} - -/*---------------------------------------------------------------------------* - * Timer T4 stop - *---------------------------------------------------------------------------*/ -static void -T4_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - - if(sc->sc_I430T4) - { - sc->sc_I430T4 = 0; - untimeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, sc->sc_T4_callout); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI8 - *---------------------------------------------------------------------------*/ -static void -F_AI8(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI8 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPNPUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_8; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI10 - *---------------------------------------------------------------------------*/ -static void -F_AI10(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI10 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPNPUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_10; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in states F3 .. F5 - *---------------------------------------------------------------------------*/ -static void -F_I01(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I01 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F6 - *---------------------------------------------------------------------------*/ -static void -F_I02(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I02 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPNPUNIT(sc->sc_unit)); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F7 or F8 - *---------------------------------------------------------------------------*/ -static void -F_I03(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I03 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPNPUNIT(sc->sc_unit)); - - T4_start(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: activate request - *---------------------------------------------------------------------------*/ -static void -F_AR(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO1_8; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_TE; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - - ifpnp_isac_l1_cmd(sc, CMD_AR8); - - T3_start(sc); -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO2 - *---------------------------------------------------------------------------*/ -static void -F_I2(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I2 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO2; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - -} - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(struct l1_softc *sc) -{ - NDBGL1(L1_F_ERR, "FSM function F_ill executing"); -} - -/*---------------------------------------------------------------------------* - * No action - *---------------------------------------------------------------------------*/ -static void -F_NULL(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_NULL executing"); -} - - -/*---------------------------------------------------------------------------* - * layer 1 state transition table - *---------------------------------------------------------------------------*/ -struct ifpnp_state_tab { - void (*func) (struct l1_softc *sc); /* function to execute */ - int newstate; /* next state */ -} ifpnp_state_tab[N_EVENTS][N_STATES] = { - -/* STATE: F3 F4 F5 F6 F7 F8 ILLEGAL STATE */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* EV_PHAR x*/ {{F_AR, ST_F4}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_ill, ST_ILL}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_T3 x*/ {{F_NULL, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO0 */ {{F_I01, ST_F3}, {F_I01, ST_F4}, {F_I01, ST_F5}, {F_I02, ST_F3}, {F_I03, ST_F3}, {F_I03, ST_F3}, {F_ill, ST_ILL}}, -/* EV_RSY x*/ {{F_NULL, ST_F3}, {F_NULL, ST_F5}, {F_NULL, ST_F5}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO2 */ {{F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_ill, ST_ILL}}, -/* EV_INFO48*/ {{F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_NULL, ST_F7}, {F_AI8, ST_F7}, {F_ill, ST_ILL}}, -/* EV_INFO41*/ {{F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_NULL, ST_F7}, {F_AI10, ST_F7}, {F_ill, ST_ILL}}, -/* EV_DR */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_PU */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_DIS */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_EI */ {{F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_ill, ST_ILL}}, -/* EV_ILL */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -ifpnp_next_state(struct l1_softc *sc, int event) -{ - int currstate, newstate; - - if(event >= N_EVENTS) - panic("i4b_l1fsm.c: event >= N_EVENTS\n"); - - currstate = sc->sc_I430state; - - if(currstate >= N_STATES) - panic("i4b_l1fsm.c: currstate >= N_STATES\n"); - - newstate = ifpnp_state_tab[event][currstate].newstate; - - if(newstate >= N_STATES) - panic("i4b_l1fsm.c: newstate >= N_STATES\n"); - - NDBGL1(L1_F_MSG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]); - - (*ifpnp_state_tab[event][currstate].func)(sc); - - if(newstate == ST_ILL) - { - newstate = ST_F3; - NDBGL1(L1_F_ERR, "FSM Illegal State ERROR, oldstate = %s, newstate = %s, event = %s!", - state_text[currstate], - state_text[newstate], - event_text[event]); - } - - sc->sc_I430state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -ifpnp_printstate(struct l1_softc *sc) -{ - return((char *) state_text[sc->sc_I430state]); -} -#endif diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc.h b/sys/i4b/layer1/ihfc/i4b_ihfc.h deleted file mode 100644 index f4d724125b7c..000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc.h +++ /dev/null @@ -1,338 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ihfc.h - ihfc common header file - * ------------------------------------ - * - * last edit-date: [Wed Jul 19 09:40:45 2000] - * - * $Id: i4b_ihfc.h,v 1.9 2000/09/19 13:50:36 hm Exp $ - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IHFC_H_ -#define _I4B_IHFC_H_ - -#include - -/*---------------------------------------------------------------------------* - * global stuff (HFC-1/S/SP) - *---------------------------------------------------------------------------*/ -#define DCH_MAX_LEN 264 /* max length of a D frame */ - -#define IHFC_ACTIVATION_TIMEOUT 3*hz /* S0-bus must activate before this time */ - -#define IHFC_IO_BASES 1 - -#define IHFC_DISBUSYTO 500 /* do at least 500 inb's before giving up */ -#define IHFC_NONBUSYTO 8000 /* do at least 8000 inb's before giving up */ - -#define IHFC_NTMODE 0 /* use TE-mode as default */ -#define IHFC_DLP 0 /* use (8/9) priority as default */ - -#define IHFC_MAXUNIT 4 - -/* #define IHFC_DEBUG internal debugging enabled * - * #undef IHFC_DEBUG internal debugging disabled */ - -/* chan: * - * 0 - D1 (tx) * - * 1 - D1 (rx) * - * 2 - B1 (tx) * - * 3 - B1 (rx) * - * 4 - B2 (tx) * - * 5 - B2 (rx) */ - -#define HFC_1 0x01 /* HFC 2B */ -#define HFC_S 0x02 /* HFC - S 2BDS0 */ -#define HFC_SP 0x04 /* HFC - SP 2BDS0 */ -#define HFC_SPCI 0x08 /* HFC - SPCI 2BDS0 X */ -#define HFC_S2M 0x10 /* HFC - S2M 2BDS0 X */ -#define HFC_USB 0x20 /* HFC - USB 2BDS0 X */ - -/*---------------------------------------------------------------------------* - * "Help Fix Corruption" macros (HFC-1/S/SP) - * - * NOTE: If the code does not run at splhigh, we will sporadically - * lose bytes. On fast PC's (200 Mhz), this is very little noticable. - *---------------------------------------------------------------------------*/ -#define HFC_VAR int _s_ /* declare variable */ -#define HFC_BEG _s_ = splhigh() /* save spl */ -#define HFC_END splx(_s_) /* restore spl */ - -/*---------------------------------------------------------------------------* - * macros related to i4b linking (HFC-1/S/SP) - *---------------------------------------------------------------------------*/ -#define S_BLINK sc->sc_blinktab[(chan > 3) ? 1 : 0] -#define S_BDRVLINK sc->sc_bdrvlinktab[(chan > 3) ? 1 : 0] - -/*---------------------------------------------------------------------------* - * macros related to ihfc_sc (HFC-1/S/SP) - *---------------------------------------------------------------------------*/ - -/* statemachine */ - -#define S_IOM2 (sc->sc_config.i_adf2 & 0x80) - /* 0x80: IOM2 mode selected */ - -#define S_DLP (sc->sc_config.dlp) -#define S_NTMODE (sc->sc_config.ntmode) -#define S_STDEL (sc->sc_config.stdel) - -#define S_PHSTATE sc->sc_statemachine.state -#define S_STM_T3 sc->sc_statemachine.T3 -#define S_STM_T3CALLOUT sc->sc_statemachine.T3callout - -/* unitnumbers */ - -#define S_UNIT sc->sc_unit -#define S_FLAG sc->sc_flag -#define S_I4BUNIT sc->sc_i4bunit -#define S_I4BFLAG sc->sc_i4bflag - -/* ISA bus setup */ - -#define S_IOBASE sc->sc_resources.io_base -#define S_IORID sc->sc_resources.io_rid -#define S_IRQ sc->sc_resources.irq -#define S_IRQRID sc->sc_resources.irq_rid - -/* hardware setup */ - -#define S_HFC sc->sc_config.chiptype -#define S_IIO sc->sc_config.iio -#define S_IIRQ sc->sc_config.iirq - -/* registers of the HFC-S/SP (write only) */ - -#define S_HFC_CONFIG sc->sc_config.cirm - -#define S_CIRM sc->sc_config.cirm -#define S_CTMT sc->sc_config.ctmt -#define S_TEST sc->sc_config.test -#define S_SCTRL sc->sc_config.sctrl -#define S_CLKDEL sc->sc_config.clkdel -#define S_INT_M1 sc->sc_config.int_m1 -#define S_INT_M2 sc->sc_config.int_m2 -#define S_CONNECT sc->sc_config.connect -#define S_SCTRL_R sc->sc_config.sctrl_r -#define S_MST_MODE sc->sc_config.mst_mode - -/* registers of the HFC-S/SP (read only) */ - -#define S_INT_S1 sc->sc_config.int_s1 - -/* registers of the ISAC (write only) */ - -#define S_ISAC_CONFIG sc->sc_config.i_adf2 - -#define S_ADF1 sc->sc_config.i_adf1 -#define S_ADF2 sc->sc_config.i_adf2 -#define S_MASK sc->sc_config.i_mask -#define S_MODE sc->sc_config.i_mode -#define S_SPCR sc->sc_config.i_spcr -#define S_SQXR sc->sc_config.i_sqxr -#define S_STCR sc->sc_config.i_stcr -#define S_STAR2 sc->sc_config.i_star2 - -/* registers of the ISAC (read only) */ - -#define S_ISTA sc->sc_config.i_ista - -/* state of the softc */ - -#define S_ENABLED sc->sc_enabled -#define S_INTR_ACTIVE sc->sc_intr_active - -/* SOFT-HDLC */ - -#define S_HDLC_IB sc->sc_fifo.chan[chan].hdlc.ib /* u_short */ -#define S_HDLC_CRC sc->sc_fifo.chan[chan].hdlc.crc /* u_short */ -#define S_HDLC_TMP sc->sc_fifo.chan[chan].hdlc.tmp /* u_int */ -#define S_HDLC_FLAG sc->sc_fifo.chan[chan].hdlc.flag /* u_char */ -#define S_HDLC_BLEVEL sc->sc_fifo.chan[chan].hdlc.blevel /* u_short */ - -/* stats */ - -#define S_BYTES sc->sc_fifo.chan[chan].bytes - -/* "Z"-values */ - -#define S_HDLC_DZ_TAB sc->sc_fifo.dztable - -/* filters */ - -#define S_PROT sc->sc_fifo.chan[chan].prot -#define S_FILTER sc->sc_fifo.chan[chan].filter -#define S_ACTIVITY sc->sc_fifo.chan[chan].activity -#define S_LAST_CHAN sc->sc_fifo.last_chan - -/* soft reset */ - -#define RESET_SOFT_CHAN(sc, chan) bzero(&sc->sc_fifo.chan[chan], sizeof(sc->sc_fifo.chan[0])) - -/* trace */ - -#define S_TRACE sc->sc_trace -#define S_DTRACECOUNT sc->sc_Dtracecount -#define S_BTRACECOUNT sc->sc_Btracecount - -/* mbuf */ - -#define S_MBUF sc->sc_fifo.chan[chan].buffer.mbuf -#define S_MBUFDUMMY sc->sc_fifo.chan[chan].buffer.mbufdummy -#define S_MBUFLEN sc->sc_fifo.chan[chan].buffer.mbuf->m_len -#define S_MBUFPKTHDR sc->sc_fifo.chan[chan].buffer.mbuf->m_pkthdr -#define S_MBUFDATA sc->sc_fifo.chan[chan].buffer.mbuf->m_data -#define S_MBUFDAT sc->sc_fifo.chan[chan].buffer.mbuf->m_dat - -#define S_IFQUEUE sc->sc_fifo.chan[chan].buffer.ifqueue - -/* hfc control */ - -#define HFC_INIT ihfc_init -#define HFC_INTR ((S_HFC & HFC_1) ? ihfc_intr1 : ihfc_intr2) -#define HFC_FSM ihfc_fsm -#define HFC_CONTROL ihfc_control - -/* softc parts */ - -struct ihfc_sc; - -struct sc_resources { - struct resource * io_base[IHFC_IO_BASES]; - int io_rid [IHFC_IO_BASES]; - struct resource * irq; - int irq_rid; -}; - -struct hdlc { - u_char flag; - u_short blevel; - u_short crc; - u_short ib; - u_int tmp; -}; - -struct buffer { - struct ifqueue ifqueue; /* data queue */ - struct mbuf *mbuf; /* current mbuf */ - struct mbuf *mbufdummy; /* temporary */ -}; - -struct chan { - struct hdlc hdlc; - u_int bytes; - u_int prot; - struct buffer buffer; - void (*filter)(struct ihfc_sc *sc, u_char chan); -}; - -struct sc_fifo { - struct chan chan[6]; - u_short dztable[16]; - u_char last_chan; -}; - -struct sc_config { - /* software only: */ - - u_short chiptype; /* chiptype (eg. HFC_1) */ - u_char dlp; /* D-priority */ - u_short iio; /* internal IO */ - u_char iirq; /* internal IRQ */ - u_char ntmode; /* mode */ - u_char stdel; /* S/T delay */ - - /* write only: */ - u_char cirm; - u_char ctmt; - u_char int_m1; - u_char int_m2; - u_char mst_mode; - u_char clkdel; - u_char sctrl; - u_char connect; - u_char test; - u_char sctrl_r; - - /* isac write only - hfc-1: */ - u_char i_adf2; - u_char i_spcr; - u_char i_sqxr; - u_char i_adf1; - u_char i_stcr; - u_char i_mode; - u_char i_mask; - u_char i_star2; - - /* read only: */ - u_char int_s1; - - /* isac read only - hfc-1: */ - u_char i_ista; -}; - -struct sc_statemachine { - u_char state; /* see i4b_ihfc_drv.h */ - u_char usync; - u_char T3; /* T3 running */ - struct callout_handle T3callout; -}; - -/*---------------------------------------------------------------------------* - * HFC softc - *---------------------------------------------------------------------------*/ -typedef struct ihfc_sc -{ int sc_unit; - int sc_flag; - - int sc_i4bunit; /* L0IHFCUNIT(sc_unit) */ - int sc_i4bflag; /* FLAG_TEL_S0_16_3C .. */ - - u_char sc_enabled; /* daemon running if set */ - u_char sc_intr_active; /* interrupt is active */ - - int sc_trace; - u_int sc_Btracecount; - u_int sc_Dtracecount; - - struct sc_config sc_config; - struct sc_resources sc_resources; - struct sc_statemachine sc_statemachine; - - isdn_link_t sc_blinktab[2]; - drvr_link_t *sc_bdrvlinktab[2]; - - struct sc_fifo sc_fifo; -} ihfc_sc_t; - -extern ihfc_sc_t ihfc_softc[]; - -#endif /* _I4B_IHFC_H_ */ diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c b/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c deleted file mode 100644 index 630aa6716dab..000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c +++ /dev/null @@ -1,1760 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ihfc_drv.c - ihfc ISA PnP-bus interface - * ------------------------------------------- - * Everything which has got anything to do with the - * HFC-1/S/SP chips has been put here. - * - * last edit-date: [Fri Jan 12 17:06:52 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - - -/*---------------------------------------------------------------------------* - * Local prototypes - *---------------------------------------------------------------------------*/ - void ihfc_loadconfig (ihfc_sc_t *sc); - -static void ihfc_trans_Bread (ihfc_sc_t *sc, u_char chan); -static void ihfc_trans_Bwrite (ihfc_sc_t *sc, u_char chan); -static void ihfc_hdlc_Bread (ihfc_sc_t *sc, u_char chan); -static void ihfc_hdlc_Bwrite (ihfc_sc_t *sc, u_char chan); -static void ihfc_hdlc_Dread (ihfc_sc_t *sc, u_char chan); -static void ihfc_hdlc_Dwrite (ihfc_sc_t *sc, u_char chan); - -static void ihfc_isac_Dread (ihfc_sc_t *sc, u_char chan); -static void ihfc_isac_Dwrite (ihfc_sc_t *sc, u_char chan); - - void ihfc_cmdr_hdlr (ihfc_sc_t *sc, u_char cmdr); - void ihfc_exir_hdlr (ihfc_sc_t *sc, u_char exir); - - void ihfc_sq (ihfc_sc_t *sc); - -static void ihfc_test_Bread (ihfc_sc_t *sc, u_char chan); -static void ihfc_test_Bwrite (ihfc_sc_t *sc, u_char chan); - -u_short ihfc_Bsel_fifo (ihfc_sc_t *sc, u_char chan, u_char flag); -u_int32_t ihfc_Dsel_fifo (ihfc_sc_t *sc, u_char chan, u_char flag); - - -/*---------------------------------------------------------------------------* - * Commonly used ISA bus commands - *---------------------------------------------------------------------------*/ -#define IHFC_DATA_OFFSET 0 -#define IHFC_REG_OFFSET 1 - -#define BUS_VAR bus_space_handle_t h = rman_get_bushandle(S_IOBASE[0]); \ - bus_space_tag_t t = rman_get_bustag (S_IOBASE[0]) - -#define SET_REG(reg) bus_space_write_1(t,h, IHFC_REG_OFFSET, reg) -#define GET_STAT bus_space_read_1 (t,h, IHFC_REG_OFFSET) - -#define READ_DATA_1 bus_space_read_1 (t,h, IHFC_DATA_OFFSET) -#define READ_BOTH_2 bus_space_read_2 (t,h, IHFC_DATA_OFFSET) - -#define WRITE_DATA_1(data) bus_space_write_1(t,h, IHFC_DATA_OFFSET, data) -#define WRITE_BOTH_2(data) bus_space_write_2(t,h, IHFC_DATA_OFFSET, data) - -#define DISBUSY(okcmd, tocmd) \ -{ \ - if (GET_STAT & 1) \ - { \ - register u_char a; \ - register u_int to = IHFC_DISBUSYTO; \ - \ - while(((a = GET_STAT) & 1) && --to); \ - \ - if (!to) \ - { \ - NDBGL1(L1_ERROR, "DISBUSY-TIMEOUT! (a=%04x, " \ - "unit=%d)", a, S_UNIT); \ - tocmd; \ - } \ - else \ - { \ - okcmd; \ - } \ - } \ - else \ - { \ - okcmd; \ - } \ -} - -#define WAITBUSY_2(okcmd, tocmd) \ - { \ - register u_short a; \ - register u_int to = IHFC_NONBUSYTO; \ - \ - while((~(a = READ_BOTH_2) & 0x100) && --to); \ - \ - if (!to) \ - { \ - NDBGL1(L1_ERROR, "NONBUSY-TIMEOUT! (a=%04x, " \ - "unit=%d)", a, S_UNIT); \ - tocmd; \ - } \ - else \ - { \ - okcmd; \ - } \ - } - -/*---------------------------------------------------------------------------* - * Control function (HFC-1/S/SP) - * - * Flag: - * 1: reset and unlock chip (at boot only) - * 2: prepare for shutdown (at shutdown only) - * 3: reset and resume - * 4: select TE-mode (boot default) - * 5: select NT-mode (only HFC-S/SP/PCI) - * - * Returns != 0 on errornous chip - *---------------------------------------------------------------------------*/ -int -ihfc_control(ihfc_sc_t *sc, int flag) -{ - BUS_VAR; - - if (flag == 3) goto reset0; - if (flag == 4) - { - S_NTMODE = 0; - goto mode0; - } - if (flag == 5) - { - S_NTMODE = 1; - goto mode0; - } - if (flag == 1) - { - WRITE_BOTH_2(0x5400 | S_IIO); /* enable IO (HFC-1/S) */ - - S_LAST_CHAN = -1; - - /* HFC-S/SP configuration */ - - S_CIRM = S_IIRQ|0x10; /* IRQ, 8K fifo mode */ - S_CLKDEL = 0x00; /* 12.288mhz */ - S_CTMT = 0x03; /* transperant mode */ - S_CONNECT = 0x00; /* B channel data flow */ - S_INT_M1 = 0x40; /* interrupt mask */ - S_INT_M2 = 0x08; /* enable interrupt output */ - S_MST_MODE = 0x01; /* master mode */ - S_SCTRL = 0x50; /* S/Q on, non cap. line mode */ - S_SCTRL_R = 0x00; /* B channel receive disable */ - S_TEST = 0x00; /* no need for awake enable */ - - if (S_HFC & (HFC_1 | HFC_S)) /* configure timer (50ms) */ - { - S_CTMT |= 0x08; - } - else - { - S_CTMT |= 0x14; - } - - /* HFC-1 ISAC configuration (IOM-2 mode) */ - - S_ADF1 = 0x00; /* */ - S_ADF2 = 0x80; /* select mode IOM-2 */ - S_SPCR = 0x00; /* B channel send disable (0x10 for test loop) */ - S_MASK = 0xfb; /* enable CISQ */ - S_MODE = 0xc9; /* receiver enabled */ - S_SQXR = 0x0f; /* master, clock always active */ - S_STCR = 0x70; /* TIC bus address = 7 */ - S_STAR2 = 0x04; /* enable S/Q */ - - mode0: - if (S_NTMODE) /* configure NT- or TE-mode */ - { - S_SCTRL |= 0x04; /* NT mode */ - S_CLKDEL &= ~0x7f; /* clear delay */ - S_CLKDEL |= 0x6c; /* set delay */ - } - else - { - S_SCTRL &= ~0x04; /* TE mode */ - S_STDEL &= 0x7f; /* use mask! */ - S_CLKDEL &= ~0x7f; /* clear delay */ - S_CLKDEL |= S_STDEL; /* set delay */ - } - if (S_DLP) /* configure D-priority */ - { - S_SCTRL |= 0x08; /* (10/11) */ - } - else - { - S_SCTRL &= ~0x08; /* (8/9) */ - } - - reset0: - /* chip reset (HFC-1/S/SP) */ - - if (S_HFC & HFC_1) - { - SET_REG((S_CIRM | 0xc8) & 0xdf); - - DELAY(10); /* HFC-2B manual recommends a 4 * - * clock cycle delay after CIRM * - * write with reset=1. A 1us * - * delay, should do for 7.68mhz,* - * but just in case I make that * - * 10us. */ - - SET_REG((S_CIRM | 0xc0) & 0xdf); - - DELAY(250); /* ISAC manual says reset pulse * - * length is 125us. Accessing * - * ISAC before those 125us, we * - * may risk chip corruption and * - * irq failure. The HFC-2B also * - * needs some delay to recover, * - * so we add some us. */ - } - else - { - SET_REG(0x18); - - WRITE_DATA_1(S_CIRM | 8); - - DELAY(10); /* HFC-2BDS0 manual recommends * - * a 4 clock cycle delay after * - * CIRM write with reset=1. * - * A 1us delay, should do for * - * 12.288mhz, but just in case * - * I make that 10us. */ - - WRITE_DATA_1(S_CIRM); - - DELAY(25); /* HFC-2BDS0 needs some time to * - * recover after CIRM write * - * with reset=0. Experiments * - * show this delay should be * - * 8-9us. Just in case we make * - * that 25us. */ - } - - { - /* HFC-1/S/SP chip test * - * * - * NOTE: after reset the HFC-1/S/SP should be * - * in a mode where it is always non-busy/non- * - * processing, and bit[0] of STATUS/DISBUSY * - * register, should always return binary '0' * - * until we configure the chips for normal * - * operation. */ -#ifdef IHFC_DEBUG - printf("ihfc: GET_STAT value is: 0x%x\n", GET_STAT); -#endif - SET_REG(0x30); - - if ((GET_STAT & 1) || (READ_DATA_1 & 0xf)) goto f0; - } - - ihfc_loadconfig(sc); - - if (S_HFC & HFC_1) ihfc_cmdr_hdlr(sc, 0x41); /* rres, xres */ - - S_PHSTATE = 0; - HFC_FSM(sc, 0); - } - - if (flag == 2) - { - if (S_HFC & HFC_1) S_CIRM &= ~0x03; /* disable interrupt */ - - S_SQXR |= 0x40; /* power down */ - - S_INT_M2 &= ~0x01; - S_MASK |= 0x02; - - S_SPCR &= ~0x0f; /* send 1's only */ - S_SCTRL &= ~0x83; /* send 1's only + enable oscillator */ - - ihfc_loadconfig(sc); - } - - return(0); /* success */ - - f0: - return(1); /* failure */ -} - -/*---------------------------------------------------------------------------* - * Softc initializer and hardware setup (HFC-1/S/SP) - * - * Returns: 0 on success - * 1 on failure - *---------------------------------------------------------------------------*/ -int -ihfc_init (ihfc_sc_t *sc, u_char chan, int prot, int activate) -{ - if (chan > 5) goto f0; - - chan &= ~1; - - do - { if (chan < 2) /* D-Channel */ - { - i4b_Dfreembuf(S_MBUF); - if (!IF_QEMPTY(&S_IFQUEUE)) i4b_Dcleanifq(&S_IFQUEUE); - - RESET_SOFT_CHAN(sc, chan); - - S_IFQUEUE.ifq_maxlen = IFQ_MAXLEN; - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - if(!mtx_initialized(&S_IFQUEUE.ifq_mtx)) - mtx_init(&S_IFQUEUE.ifq_mtx, "i4b_ihfc", NULL, MTX_DEF); -#endif - if (!activate) continue; - - if (S_HFC & HFC_1) - { - S_FILTER = (chan & 1) ? ihfc_isac_Dread : - ihfc_isac_Dwrite; - } - else - { - S_FILTER = (chan & 1) ? ihfc_hdlc_Dread : - ihfc_hdlc_Dwrite; - } - } - else /* B-Channel */ - { - i4b_Bfreembuf(S_MBUF); - if (!IF_QEMPTY(&S_IFQUEUE)) i4b_Bcleanifq(&S_IFQUEUE); - - RESET_SOFT_CHAN(sc, chan); - - S_IFQUEUE.ifq_maxlen = IFQ_MAXLEN; - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - if(!mtx_initialized(&S_IFQUEUE.ifq_mtx)) - mtx_init(&S_IFQUEUE.ifq_mtx, "i4b_ihfc", NULL, MTX_DEF); -#endif - S_PROT = prot; - - if (!activate) continue; - - switch(prot) - { case(BPROT_NONE): - S_FILTER = (chan & 1) ? - ihfc_trans_Bread : - ihfc_trans_Bwrite; - break; - case(BPROT_RHDLC): - S_FILTER = (chan & 1) ? - ihfc_hdlc_Bread : - ihfc_hdlc_Bwrite; - break; - case(5): - S_FILTER = (chan & 1) ? - ihfc_test_Bread : - ihfc_test_Bwrite; - break; - } - } - } while (++chan & 1); - - S_MASK |= 0xfb; /* disable all, but CISQ interrupt (ISAC) */ - S_INT_M1 &= 0x40; /* disable all, but TE/NT state machine (HFC) */ - S_SCTRL &= ~0x03; /* B1/B2 send disable (HFC) */ - S_SPCR &= ~0x0f; /* B1/B2 send disable (ISAC) */ - S_SCTRL_R &= ~0x03; /* B1/B2 receive disable (HFC) */ - - chan = 0; - if (S_FILTER) /* D-Channel active */ - { - S_MASK &= 0x2e; /* enable RME, RPF, XPR, EXI */ - S_INT_M1 |= 0x24; /* enable D-receive, D-transmit */ - } - - chan = 2; - if (S_FILTER) /* B1-Channel active */ - { - S_SCTRL |= 1; /* send enable (HFC) */ - S_SPCR |= 8; /* send enable (ISAC) */ - S_SCTRL_R |= 1; /* receive enable (HFC) */ - S_INT_M1 |= 0x80; /* timer enable (HFC) */ - S_INT_M1 &= ~0x04; /* let D-channel use timer too */ - } - - chan = 4; - if (S_FILTER) /* B2-Channel active */ - { - S_SCTRL |= 2; /* send enable (HFC) */ - S_SPCR |= 2; /* send enable (ISAC) */ - S_SCTRL_R |= 2; /* receive enable (HFC) */ - S_INT_M1 |= 0x80; /* timer enable (HFC) */ - S_INT_M1 &= ~0x04; /* let D-channel use timer too */ - } - - ihfc_loadconfig(sc); - - /* XXX reset timer? */ - - return 0; /* success */ - f0: - return 1; /* failure */ -} - -/*---------------------------------------------------------------------------* - * Load configuration data (HFC-1/S/SP) - *---------------------------------------------------------------------------*/ -void -ihfc_loadconfig(ihfc_sc_t *sc) -{ - BUS_VAR; - - if (S_HFC & HFC_1) - { - /* HFC-1 chips w/ISAC: */ - - const u_char *src = (void *)&S_ISAC_CONFIG; - const u_char *dst = (void *)&isac_configtable; - - SET_REG((S_CIRM | 0xc0) & 0xdf); - - S_CTMT = (S_CTMT & ~0x14) | ((S_INT_M1 >> 5) & 0x4); - - SET_REG((S_CTMT | 0xe0) & 0xff); - - while(*dst) - { - SET_REG(*dst++); /* set register */ - - /* write configuration */ - DISBUSY(WRITE_DATA_1(*src++), break); - } - } - else - { - /* HFC-S/SP chips: */ - - const u_char *src = (void *)&S_HFC_CONFIG; - const u_char *dst = (void *)&ihfc_configtable; - - while(*dst) - { - SET_REG(*dst++); /* set register */ - WRITE_DATA_1(*src++); /* write configuration */ - } - } -} - -/*---------------------------------------------------------------------------* - * Function State Machine handler (PH layer) (HFC-1/S/SP) - * - * Flag: 0 = Refresh softc S_PHSTATE + take hints - * 1 = Activate - * 2 = Deactivate - * - * NOTE: HFC-1 only supports TE mode. - *---------------------------------------------------------------------------*/ -void -ihfc_fsm(ihfc_sc_t *sc, int flag) -{ - const struct ihfc_FSMtable *fsmtab; - u_char ihfc_cmd = 0; - u_char isac_cmd = 0; - u_char tmp; - BUS_VAR; - - /* get current state (rx/downstream) */ - - if (S_HFC & HFC_1) - { - SET_REG(0x31); DISBUSY(tmp = (READ_DATA_1 >> 2) & 0xf, return); - - fsmtab = (S_NTMODE) ? &ihfc_TEtable2[tmp]: - &ihfc_TEtable2[tmp]; - } - else - { - SET_REG(0x30); tmp = READ_DATA_1 & 0xf; - - fsmtab = (S_NTMODE) ? &ihfc_NTtable[tmp]: - &ihfc_TEtable[tmp]; - } - - if (fsmtab->string) - { - NDBGL1(L1_I_CICO, "%s (ind=0x%x, flag=%d, unit=%d).", - fsmtab->string, tmp, flag, S_UNIT); - } - else - { - NDBGL1(L1_I_ERR, "Illegal indicatation (ind=0x%x, " - "flag=%d, unit=%d).", tmp, flag, S_UNIT); - } - - /* indication machine / state change * - * * - * Whenever the state of the S0-line changes, we check to see in which * - * direction the change went. Generally upwards means activate, and * - * downwards means deactivate. * - * The test signal is used to ensure proper syncronization. */ - - if (fsmtab->state == 0) /* deactivated indication */ - { - if (S_PHSTATE != 0) - { - isac_cmd = 0x3c; /* deactivate DUI */ - - i4b_l1_ph_deactivate_ind(S_I4BUNIT); - } - } - if (fsmtab->state == 2) /* syncronized indication */ - { - if (S_PHSTATE != 2) - { - if (S_NTMODE) ihfc_cmd = 0x80; - } - } - if (fsmtab->state == 3) /* activated indication */ - { - if (S_PHSTATE != 3) - { - isac_cmd = (S_DLP) ? 0x24 /* activate AR10 */ - : 0x20; /* activate AR8 */ - - i4b_l1_ph_activate_ind(S_I4BUNIT); - } - } - if (fsmtab->state == 4) /* error indication */ - { - if (S_PHSTATE < 4) - { - isac_cmd = 0x3c; /* deactivate DUI */ - } - } - - S_PHSTATE = fsmtab->state; - - if ((flag == 1) && (fsmtab->state != 3)) - { - isac_cmd = (S_DLP) ? 0x24 : 0x20; - ihfc_cmd = 0x60; - } - if ((flag == 2) && (fsmtab->state != 0)) - { - isac_cmd = 0x3c; - ihfc_cmd = 0x40; - } - - /* set new state (tx / upstream) * - * * - * NOTE: HFC-S/SP and ISAC transmitters are always active when * - * activated state is reached. The bytes sent to the S0-bus are all * - * high impedance, so they do not disturb. * - * The HFC-1 has a separate SIEMENS S0-device. */ - - if (S_HFC & HFC_1) - { - if (isac_cmd) - { - if (S_IOM2) isac_cmd |= 3; - - SET_REG(0x31); DISBUSY(WRITE_DATA_1(isac_cmd), ); - - NDBGL1(L1_I_CICO, "(isac_cmd=0x%x, unit=%d).", - isac_cmd, S_UNIT); - } - } - else - { - if (ihfc_cmd || (fsmtab->state == 5)) - { - SET_REG(0x30); WRITE_DATA_1(ihfc_cmd); - - NDBGL1(L1_I_CICO, "(ihfc_cmd=0x%x, unit=%d).", - ihfc_cmd, S_UNIT); - } - } -} - -/*---------------------------------------------------------------------------* - * S/Q - channel handler (read) (HFC-S/SP) - *---------------------------------------------------------------------------*/ -void -ihfc_sq (ihfc_sc_t *sc) -{ - const struct ihfc_SQtable *SQtab; - register u_char a = 0; - BUS_VAR; - - if (S_HFC & HFC_1) - { - SET_REG(0x31); - DISBUSY(a = READ_DATA_1, a = 0); - - if (a & 0x80) - { - SET_REG(0x3b); - DISBUSY(a = READ_DATA_1, a = 0); - } - } - else - { - SET_REG(0x34); - a = READ_DATA_1; - } - - SQtab = (S_NTMODE) ? &ihfc_Qtable[a & 7]: - &ihfc_Stable[a & 7]; - - if (a & 0x10) - { - if (SQtab->string) - { - NDBGL1(L1_I_CICO, "%s (unit=%d, int=%x)", - SQtab->string, S_UNIT, S_INT_S1); - } - else - { - NDBGL1(L1_ERROR, "Unknown indication = %x (unit=%d)", - a & 7, S_UNIT); - } - } -} - -/*---------------------------------------------------------------------------* - * Interrupt handler (HFC-1) - *---------------------------------------------------------------------------*/ -void -ihfc_intr1 (ihfc_sc_t *sc) -{ - u_char chan; - u_char tmp; - BUS_VAR; - HFC_VAR; - - HFC_BEG; - - SET_REG(0x20); tmp = GET_STAT; DISBUSY(S_ISTA |= READ_DATA_1, ); - - if (S_ISTA & 0x04) /* CIRQ */ - { - HFC_FSM(sc, 0); - - ihfc_sq(sc); - } - - S_INTR_ACTIVE = 1; - - if (S_ISTA & 0xc0) /* RPF or RME */ - { - chan = 1; - if (S_FILTER) S_FILTER(sc, chan); - } - if (S_ISTA & 0x10) /* XPR */ - { - chan = 0; - if (S_FILTER) S_FILTER(sc, chan); - } - if (tmp & 0x04) /* Timer elapsed (50ms) */ - { - SET_REG((S_CTMT | 0xf0) & 0xff); - - chan = 6; - while(chan--) - { - if (chan == 1) break; - if (S_FILTER) S_FILTER(sc, chan); - - HFC_END; - DELAY(10); - HFC_BEG; - } - } - - S_INTR_ACTIVE = 0; - - if (S_ISTA & 0x01) /* EXIR */ - { - SET_REG(0x24); DISBUSY(ihfc_exir_hdlr(sc, READ_DATA_1), ); - } - - S_ISTA &= ~(0x1 | 0x4); - - HFC_END; -} - -/*---------------------------------------------------------------------------* - * Interrupt handler (HFC-S/SP) - *---------------------------------------------------------------------------*/ -void -ihfc_intr2 (ihfc_sc_t *sc) -{ - u_char chan; - BUS_VAR; - HFC_VAR; - - HFC_BEG; - - SET_REG(0x1e); S_INT_S1 = READ_DATA_1; /* this will enable new interrupts! */ - - if (S_INT_S1 & 0x40) - { - HFC_FSM(sc, 0); /* statemachine changed */ - - ihfc_sq(sc); - } - - S_INTR_ACTIVE = 1; - - if (S_INT_S1 & 0x20) /* D-Channel frame (rx) */ - { - chan = 1; - if (S_FILTER) S_FILTER(sc, chan); - } - if (S_INT_S1 & 0x04) /* D-Channel frame (tx) */ - { - chan = 0; - if (S_FILTER && (~S_INT_S1 & 0x80)) S_FILTER(sc, chan); - } - if (S_INT_S1 & 0x80) /* Timer elapsed (50ms) */ - { - chan = 6; - while(chan--) - { - if (chan == 1) continue; - if (S_FILTER) S_FILTER(sc, chan); - - HFC_END; - DELAY(10); - HFC_BEG; - } - } - - S_INTR_ACTIVE = 0; - - HFC_END; -} - -/*---------------------------------------------------------------------------* - * Select a Bfifo (HFC-1/S/SP) - * and return bytes in FIFO - * - * (this code is optimized) - *---------------------------------------------------------------------------*/ -u_short -ihfc_Bsel_fifo(ihfc_sc_t *sc, u_char chan, u_char flag) -{ - register u_char reg = 0x7e + chan; - register u_short tmp = 0x100; - register u_short z1; - register u_short z2; - - BUS_VAR; - - if (S_HFC & (HFC_1 | HFC_S)) - { - if (S_LAST_CHAN != chan) - { - SET_REG(reg); - DISBUSY(WAITBUSY_2( , return 0), return 0); - - S_LAST_CHAN = chan; - } - } - else - { - SET_REG(0x10); - WRITE_DATA_1(chan - 2); - DISBUSY( , return 0); - } - -#define FAST_READ (u_char)(tmp = READ_BOTH_2) -#define FAST_STAT if (tmp & 0x100) DISBUSY( , return 0); - - SET_REG(reg ); FAST_STAT; z1 = FAST_READ; - SET_REG(reg += 4); FAST_STAT; z1 |= FAST_READ << 8; - SET_REG(reg += 4); FAST_STAT; z2 = FAST_READ; - SET_REG(reg += 4); FAST_STAT; z2 |= READ_DATA_1 << 8; - -#undef FAST_READ -#undef FAST_STAT - - z1 &= 0x1fff; - z2 &= 0x1fff; - - z1 = 0x5ff - (z2 = z1 - z2 + ((z2 <= z1) ? 0 : 0x600)); - - if (chan & 1) - return(z2); /* receive channel */ - else - return(z1); /* transmit channel */ -} - -/*---------------------------------------------------------------------------* - * Select a Dfifo (HFC-S/SP) - * and return bytes, and frames in FIFO - * - * Flag values: - * 0x00: select new fifo + update counters - * 0x10: increment f1 + update counters - * 0x20: increment f2 + update counters - * - * NOTE: The upper 16bits holds the number of frames in the FIFO. - * NOTE: FIFO has to be selected before you can use flags 0x10/0x20. - *---------------------------------------------------------------------------*/ -u_int32_t -ihfc_Dsel_fifo(ihfc_sc_t *sc, u_char chan, u_char flag) -{ - register u_char reg = 0x90 + chan; - register u_short tmp = 0x100; - register u_char f1; - register u_char f2; - register u_short z1; - register u_short z2; - - BUS_VAR; - - if (S_HFC & (HFC_1 | HFC_S)) - { - switch(flag) - { - case(0x10): - case(0x20): - SET_REG(reg); - if (~GET_STAT & 1) - WAITBUSY_2( , return 0); - - SET_REG(0xa2 - (flag & 0x10) + chan); - DISBUSY(READ_DATA_1, return 0); - - SET_REG(reg); - if (~GET_STAT & 1) - WAITBUSY_2( , return 0); - break; - - default: - if (S_LAST_CHAN != chan) - { - SET_REG(reg); - DISBUSY(WAITBUSY_2( , return 0), return 0); - - S_LAST_CHAN = chan; - } - break; - } - } - else - { - switch(flag) - { - case(0x10): - case(0x20): - SET_REG(0xb8 - (flag & 0x10) + chan); - READ_DATA_1; - - DISBUSY( , return 0); - - if (chan & 1) - { - /* Before reading a FIFO a change * - * FIFO operation must be done. * - * (see HFC-SP manual p.38) */ - - SET_REG(0x10); - WRITE_DATA_1(chan | 4); - - DISBUSY( , return 0); - } - break; - - default: - SET_REG(0x10); - WRITE_DATA_1(chan | 4); - - DISBUSY( , return 0); - break; - } - } - -#define FAST_READ (u_char)(tmp = READ_BOTH_2) -#define FAST_STAT if (tmp & 0x100) DISBUSY( , return 0); - - if (S_HFC & HFC_SP) reg = 0x80 + chan; - - SET_REG(reg ); FAST_STAT; z1 = FAST_READ; - SET_REG(reg += 4); FAST_STAT; z1 |= FAST_READ << 8; - SET_REG(reg += 4); FAST_STAT; z2 = FAST_READ; - SET_REG(reg += 4); FAST_STAT; z2 |= FAST_READ << 8; - - if (S_HFC & HFC_SP) reg += 0x26; - - SET_REG(reg -= 2); FAST_STAT; f1 = FAST_READ; - SET_REG(reg += 4); FAST_STAT; f2 = READ_DATA_1; - -#undef FAST_READ -#undef FAST_STAT - - if (~chan & 1) - { /* XXX was Z1 */ - S_HDLC_DZ_TAB[f1 & 0xf] = z2; /* We keep track of the 'Z' * - * values for D-channel (tx),* - * so we may calculate the # * - * of FIFO bytes free when * - * f1 != f2. */ - z2 = S_HDLC_DZ_TAB[f2 & 0xf]; - } - - z1 = 0x1ff - (z2 = (z1 - z2) & 0x1ff); - f1 = 0xf - (f2 = (f1 - f2) & 0xf); - - if (chan & 1) - return(z2 | (f2 << 16)); /* receive channel */ - else - return(z1 | (f1 << 16)); /* transmit channel */ -} - - -/*---------------------------------------------------------------------------* - * Data handler for D channel(write) - chan 0 (HFC-S/SP) - *---------------------------------------------------------------------------*/ -static void -ihfc_hdlc_Dwrite (ihfc_sc_t *sc, u_char chan) -{ - register u_int32_t sendlen; - register u_short len; - register u_char * src; - - BUS_VAR; - - if (!S_MBUF && IF_QEMPTY(&S_IFQUEUE)) return; - - sendlen = ihfc_Dsel_fifo(sc, chan, 0); /* select new fifo * - * NOTE: the 16 higher bits * - * contain the # of frame- * - * etries free in the FIFO */ - while (sendlen & ~0xffff) - { - if (!S_MBUF) - { - if (!(S_MBUF = ihfc_getmbuf(sc, chan))) goto j1; - } - - src = S_MBUFDATA; - len = S_MBUFLEN; - - if (len >= 0x1ff) goto j0; /* frame is too big: skip! */ - - sendlen &= 0xffff; /* only keep # of * - * bytes free */ - - SET_REG((S_HFC & HFC_SP) ? 0xac : 0x96); - - while (sendlen--) - { - if (!len--) break; - - DISBUSY(WRITE_DATA_1(*src++), sendlen = -1; len++; break); - } - - if (!++sendlen) /* out of fifo: suspend */ - { - S_MBUFDATA = src; - S_MBUFLEN = len; - break; - } - - sendlen = ihfc_Dsel_fifo(sc, chan, 0x10); /* inc F1 */ - j0: - i4b_Dfreembuf(S_MBUF); - S_MBUF = NULL; - } - j1: - return; -} - -/*---------------------------------------------------------------------------* - * Data handler for D channel(read) - chan 1 (HFC-S/SP) - * - * NOTE: Max framelength is (511 - 3) = 508 bytes, when only one frame - * is received at a time. - *---------------------------------------------------------------------------*/ -static void -ihfc_hdlc_Dread (ihfc_sc_t *sc, u_char chan) -{ - register u_char tmp = -1; - register u_char to = 15; - register u_int32_t reclen; - register u_short crc; - register u_short len; - register u_char * dst; - - BUS_VAR; - - reclen = ihfc_Dsel_fifo(sc, chan, 0); /* select new fifo * - * NOTE: the higher 16 bits * - * contain the # of frames * - * to receive. */ - while ((reclen & ~0xffff) && to--) - { - reclen &= 0xffff; /* only keep # of * - * bytes to receive */ - - if (!(S_MBUF = i4b_Dgetmbuf(DCH_MAX_LEN))) - panic("ihfc_hdlc_Dread: No mbufs(unit=%d)!\n", S_UNIT); - - SET_REG((S_HFC & HFC_SP) ? 0xbd : 0xa7); - - if ((reclen > 2) && (reclen <= (DCH_MAX_LEN+2))) - { - dst = S_MBUFDATA; - len = S_MBUFLEN = (reclen += 1) - 3; - } - else - { - len = 0; - dst = NULL; - } - - crc = -1; /* NOTE: after a "F1" or "Z1" hardware overflow * - * it appears not to be necessary to reset the * - * HFC-1/S or SP chips to continue proper * - * operation, only and only, if we always read * - * "Z1-Z2+1" bytes when F1!=F2 followed by a * - * F2-counter increment. The bi-effect of doing * - * this is the "STAT" field may say frame is ok * - * when the frame is actually bad. * - * The simple solution is to re-CRC the frame * - * including "STAT" field to see if we get * - * CRC == 0x3933. Then we're 99% sure all * - * frames received are good. */ - - while(reclen--) - { - DISBUSY(tmp = READ_DATA_1, break); - if (len) { len--; *dst++ = tmp; } - - crc = (HDLC_FCS_TAB[(u_char)(tmp ^ crc)] ^ (u_char)(crc >> 8)); - } - - crc ^= 0x3933; - - if (!tmp && !crc) - { - ihfc_putmbuf(sc, chan, S_MBUF); - S_MBUF = NULL; - } - else - { - NDBGL1(L1_ERROR, "Frame error (len=%d, stat=0x%x, " - "crc=0x%x, unit=%d)", S_MBUFLEN, (u_char)tmp, crc, - S_UNIT); - - i4b_Dfreembuf(S_MBUF); - S_MBUF = NULL; - } - - reclen = ihfc_Dsel_fifo(sc, chan, 0x20); - } -} - -/*---------------------------------------------------------------------------* - * EXIR error handler - ISAC (D - channel) (HFC-1) - *---------------------------------------------------------------------------*/ -void -ihfc_exir_hdlr (ihfc_sc_t *sc, u_char exir) -{ - register u_char a; - register u_char cmd; - - for (a = 0, cmd = 0; exir; a++, exir >>= 1) - { - if (exir & 1) - { - NDBGL1(L1_I_ERR, "%s. (unit=%d)", - ihfc_EXIRtable[a].string, S_UNIT); - cmd |= ihfc_EXIRtable[a].cmd; - } - } - - if (cmd) ihfc_cmdr_hdlr(sc, cmd); -} - -/*---------------------------------------------------------------------------* - * CMDR handler - ISAC (D - channel) (HFC-1) - *---------------------------------------------------------------------------*/ -void -ihfc_cmdr_hdlr (ihfc_sc_t *sc, u_char cmdr) -{ - BUS_VAR; - - SET_REG(0x21); DISBUSY(WRITE_DATA_1(cmdr); DELAY(30), ); -} - -/*---------------------------------------------------------------------------* - * Data handler for D channel(write) - chan 0 (HFC-1) - *---------------------------------------------------------------------------*/ -static void -ihfc_isac_Dwrite (ihfc_sc_t *sc, u_char chan) -{ - register u_char sendlen = 32; - register u_char cmd = 0; - register u_short len; - register u_char * src; - - BUS_VAR; - - if (~S_ISTA & 0x10) goto j0; - - if (!S_MBUF) - if (!(S_MBUF = ihfc_getmbuf(sc, chan))) goto j0; - - len = S_MBUFLEN; - src = S_MBUFDATA; - - SET_REG(0x00); - - while(sendlen--) /* write data */ - { - if (!len--) break; - DISBUSY(WRITE_DATA_1(*src++), goto a0); - } - - cmd |= 0x08; - - if (!++sendlen) /* suspend */ - { - S_MBUFLEN = len; - S_MBUFDATA = src; - } - else - { - a0: - i4b_Dfreembuf(S_MBUF); - S_MBUF = NULL; - - cmd |= 0x02; - } - - if (cmd) ihfc_cmdr_hdlr(sc, cmd); - - S_ISTA &= ~0x10; - j0: - return; -} - -/*---------------------------------------------------------------------------* - * Data handler for D channel(read) - chan 1 (HFC-1) - *---------------------------------------------------------------------------*/ -static void -ihfc_isac_Dread (ihfc_sc_t *sc, u_char chan) -{ - register u_char cmd = 0; - register u_char reclen; - register u_short tmp; - register u_short len; - register u_char * dst; - - BUS_VAR; - - if (!(S_ISTA & 0xc0)) goto j1; /* only receive data * - * on interrupt */ - - if (!S_MBUF) - { - if (!(S_MBUF = i4b_Dgetmbuf(DCH_MAX_LEN))) - panic("ihfc%d: (D) Out of mbufs!\n", S_UNIT); - } - - len = S_MBUFLEN; - dst = S_MBUFDATA + (DCH_MAX_LEN - len); - - if (S_ISTA & 0x80) /* RME */ - { - SET_REG(0x27); DISBUSY(tmp = (READ_DATA_1 ^ 0x20), goto j0); - - if (tmp & 0x70) goto j0; /* error */ - - SET_REG(0x25); DISBUSY(tmp = (READ_DATA_1 & 0x1f), goto j0); - - reclen = (tmp) ? tmp : 32; - } - else /* RPF */ - { - reclen = 32; - } - - if ((len -= reclen) <= DCH_MAX_LEN) /* get data */ - { - SET_REG(0x00); - - while(reclen--) - { - DISBUSY(*dst++ = READ_DATA_1, goto j0); - } - } - else /* soft rdo or error */ - { - j0: i4b_Dfreembuf(S_MBUF); - S_MBUF = NULL; - - cmd |= 0x40; - - NDBGL1(L1_I_ERR, "Frame error (unit=%d)", S_UNIT); - } - - if (S_ISTA & 0x80) /* frame complete */ - { - if (S_MBUF) - { - S_MBUFLEN = (DCH_MAX_LEN - len); - ihfc_putmbuf(sc, chan, S_MBUF); - S_MBUF = NULL; - } - } - - if (S_MBUF) /* suspend */ - { - S_MBUFLEN = len; - } - - ihfc_cmdr_hdlr(sc, cmd | 0x80); - - S_ISTA &= ~0xc0; - j1: - return; -} - -/*---------------------------------------------------------------------------* - * Data handler for B channel(write) - chan 2 and 4 (HFC-1/S/SP) - * - * NOTE: No XDU checking! - *---------------------------------------------------------------------------*/ -static void -ihfc_trans_Bwrite (ihfc_sc_t *sc, u_char chan) -{ - register u_short sendlen; - register u_short len; - register u_char * src; - - BUS_VAR; - - if (!S_MBUF && IF_QEMPTY(&S_IFQUEUE)) return; - - sendlen = (u_short)ihfc_Bsel_fifo(sc, chan, 0); - - SET_REG(0xaa + chan); - - while (1) - { - if (!S_MBUF) - { - S_MBUF = ihfc_getmbuf(sc, chan); - if (!S_MBUF) break; - } - - src = S_MBUFDATA; - len = S_MBUFLEN; - - while (sendlen--) - { - if (!len--) break; - - DISBUSY(WRITE_DATA_1(*src++), sendlen = -1; len++; break); - } - - if (!++sendlen) /* out of fifo: Suspend */ - { - S_MBUFDATA = src; - S_MBUFLEN = len; - break; - } - - i4b_Dfreembuf(S_MBUF); - S_MBUF = NULL; - } -} - -/*---------------------------------------------------------------------------* - * Data handler for B channel(read) - chan 3 and 5 (HFC-1/S/SP) - * (this code is optimized) - *---------------------------------------------------------------------------*/ -static void -ihfc_trans_Bread (ihfc_sc_t *sc, u_char chan) -{ - register u_short reclen; - register u_short tmp; - register u_short len; - register u_char * dst; - - BUS_VAR; - - reclen = (u_short)ihfc_Bsel_fifo(sc, chan, 0); - - while (1) - { - SET_REG(0xba + chan); - - tmp = 0x100; - - if (!S_MBUF) - if (!(S_MBUF = i4b_Bgetmbuf(BCH_MAX_DATALEN))) - panic("ihfc%d: (B) Out of mbufs!\n", S_UNIT); - - len = S_MBUFLEN; - dst = S_MBUFDATA + (BCH_MAX_DATALEN - len); - - while (reclen--) - { - if (!len--) break; - - if (tmp & 0x100) DISBUSY( , reclen = -1; len++; break); - *dst++ = (u_char)(tmp = READ_BOTH_2); - } - - if (~tmp & 0x100) - { - SET_REG(0x30); - READ_DATA_1; /* a read to the data port * - * will disable the internal * - * disbusy signal for HFC-1/S * - * chips. This is neccessary * - * to avvoid data loss. */ - } - - if (!++reclen) /* out of fifo: suspend */ - { - S_MBUFLEN = len; - break; - } - - S_MBUFLEN = (BCH_MAX_DATALEN - ++len); - - ihfc_putmbuf(sc, chan, S_MBUF); - - S_MBUF = NULL; - } -} - -/*---------------------------------------------------------------------------* - * Data handler for B channel(write) - chan 2 and 4 (HFC-1/S/SP) - * - * NOTE: Software HDLC encoding! - *---------------------------------------------------------------------------*/ -static void -ihfc_hdlc_Bwrite (ihfc_sc_t *sc, u_char chan) -{ - register u_short blevel = S_HDLC_BLEVEL; - register u_char flag = S_HDLC_FLAG; - register u_int tmp = S_HDLC_TMP; - register u_short crc = S_HDLC_CRC; - register u_short ib = S_HDLC_IB; - register u_char * src = NULL; - register u_short len = 0; - register u_short sendlen; - register u_short tmp2; - - BUS_VAR; - - if (!S_MBUF && IF_QEMPTY(&S_IFQUEUE) && (flag == 2)) return; - - sendlen = (u_short)ihfc_Bsel_fifo(sc, chan, 0); - - SET_REG(0xaa + chan); - - if (S_MBUF) - { - /* resume */ - - src = S_MBUFDATA; - len = S_MBUFLEN; - - if (sendlen == 0x5ff) - { - /* XDU */ - - flag = -2; - len = 0; - - NDBGL1(L1_S_ERR, "XDU (unit=%d)", S_UNIT); - } - } - - while (sendlen--) - { - HDLC_ENCODE(*src++, len, tmp, tmp2, blevel, ib, crc, flag, - {/* gfr */ - i4b_Bfreembuf(S_MBUF); - S_MBUF = ihfc_getmbuf(sc, chan); - - if (S_MBUF) - { - src = S_MBUFDATA; - len = S_MBUFLEN; - } - else - { - sendlen = 0; /* Exit after final FS, * - * else the buffer will * - * only be filled with * - * "0x7e"-bytes! */ - } - }, - {/* wrd */ - - DISBUSY(WRITE_DATA_1((u_char)tmp), sendlen = 0); - }, - d ); - } - - if (S_MBUF) /* suspend */ - { - S_MBUFDATA = src; - S_MBUFLEN = len; - } - - S_HDLC_IB = ib; - S_HDLC_BLEVEL = blevel; - S_HDLC_TMP = tmp; - S_HDLC_FLAG = flag; - S_HDLC_CRC = crc; -} - -/*---------------------------------------------------------------------------* - * Data handler for B channel(read) - chan 3 and 5 (HFC-1/S/SP) - * - * NOTE: Software HDLC decoding! - *---------------------------------------------------------------------------*/ -static void -ihfc_hdlc_Bread (ihfc_sc_t *sc, u_char chan) -{ - register u_char blevel = S_HDLC_BLEVEL; - u_char flag = S_HDLC_FLAG; - register u_short crc = S_HDLC_CRC; - register u_int tmp = S_HDLC_TMP; - register u_short ib = S_HDLC_IB; - register u_char * dst = NULL; - register u_short tmp2 = 0x100; - register u_short len = 0; - register u_short reclen; - - BUS_VAR; - - if (S_MBUF) - { - /* resume */ - - len = S_MBUFLEN; - dst = S_MBUFDATA + (BCH_MAX_DATALEN - len); - } - - reclen = (u_short)ihfc_Bsel_fifo(sc, chan, 0); - - SET_REG(0xba + chan); - - while (reclen--) - { - HDLC_DECODE(*dst++, len, tmp, tmp2, blevel, ib, crc, flag, - {/* rdd */ - /* if (tmp2 & 0x100) while (GET_STAT & 1); - * tmp2 = READ_BOTH_2; - */ - - DISBUSY(tmp2 = READ_DATA_1, reclen = 0; tmp2 = 0); - }, - {/* nfr */ - if (!(S_MBUF = i4b_Bgetmbuf(BCH_MAX_DATALEN))) - panic("ihfc:(B) Out of mbufs!\n"); - - dst = S_MBUFDATA; - len = BCH_MAX_DATALEN; - }, - {/* cfr */ - len = (BCH_MAX_DATALEN - len); - - if ((!len) || (len > BCH_MAX_DATALEN)) - { - /* NOTE: frames without any data, * - * only crc field, should be silently discared. */ - - i4b_Bfreembuf(S_MBUF); - NDBGL1(L1_S_MSG, "Bad frame (len=%d, unit=%d)", len, S_UNIT); - goto s0; - } - - if (crc) - { i4b_Bfreembuf(S_MBUF); - NDBGL1(L1_S_ERR, "CRC (crc=0x%04x, len=%d, unit=%d)", crc, len, S_UNIT); - goto s0; - } - - S_MBUFLEN = len; - - ihfc_putmbuf(sc, chan, S_MBUF); - s0: - S_MBUF = NULL; - }, - {/* rab */ - i4b_Bfreembuf(S_MBUF); - S_MBUF = NULL; - - NDBGL1(L1_S_MSG, "Read Abort (unit=%d)", S_UNIT); - }, - {/* rdo */ - i4b_Bfreembuf(S_MBUF); - S_MBUF = NULL; - - NDBGL1(L1_S_ERR, "RDO (unit=%d)", S_UNIT); - }, - continue, - d); - } - - /* SET_REG(0x30); - * if (~tmp2 & 0x100) READ_DATA_1; kill disbusy signal - */ - - if (S_MBUF) S_MBUFLEN = len; /* suspend */ - - S_HDLC_IB = ib; - S_HDLC_CRC = crc; - S_HDLC_TMP = tmp; - S_HDLC_FLAG = flag; - S_HDLC_BLEVEL = blevel; -} - -/*---------------------------------------------------------------------------* - * Data handler for B channel(write) - chan 2 and 4 (HFC-1/S/SP) - * - * This filter generates a pattern which is recognized - * and examinated and verified by ihfc_test_Bread. - * - * NOTE: This filter is only for testing purpose. - *---------------------------------------------------------------------------*/ -static void -ihfc_test_Bwrite (ihfc_sc_t *sc, u_char chan) -{ - struct mbuf *m; - - register u_char fb; - register u_short sendlen, tlen; - register u_short xlen = S_HDLC_IB; - BUS_VAR; - - goto j0; - - while((m = ihfc_getmbuf(sc, chan))) /* internal loop */ - { - if (chan == 2) - ihfc_putmbuf(sc, 5, m); - else - ihfc_putmbuf(sc, 3, m); - } - - j0: - - sendlen = /* (u_short)ihfc_Bsel_fifo(sc, chan, 0); */ 0; - - if (sendlen == 0x5ff) printf("(send empty)"); - - SET_REG(0xaa + chan); - - S_BYTES += sendlen; - - tlen = S_HDLC_CRC; - - if (sendlen > 0x400) printf("(slow: %d)", sendlen); - - fb = 0x80; - - while (sendlen--) - { - if (!tlen--) fb |= 0x20; - - if (!xlen--) - { - while(GET_STAT & 1); - WRITE_DATA_1(0x3e); - xlen = 200; - } - else - { - while(GET_STAT & 1); - WRITE_DATA_1((xlen + 1) & 0xef); - } - - fb = 0; - } - - S_HDLC_IB = xlen; -} - -/*---------------------------------------------------------------------------* - * Data handler for B channel(read) - chan 3 and 5 (HFC-1/S/SP) - * - * This filter examins and verifies the pattern - * generated by ihfc_test_Bwrite. - * - * NOTE: This filter is only for testing purpose. - *---------------------------------------------------------------------------*/ -static void -ihfc_test_Bread (ihfc_sc_t *sc, u_char chan) -{ - static u_short toterrors = 0; - - register u_short reclen, len, tlen; - register u_char fb, tmp; - - register u_short xlen = S_HDLC_IB; - register u_char *dst = NULL; - register u_char error = S_HDLC_TMP; - register u_char ecount = S_HDLC_FLAG; - - BUS_VAR; - - if (S_UNIT != 0) return; - - reclen = /* (u_short)ihfc_Bsel_fifo(sc, chan, 0); */ 0; - - S_BYTES += reclen; - - tlen = S_HDLC_CRC; - - fb = 0x40; - - if (S_MBUF) - { - len = S_MBUFLEN; - dst = S_MBUFDATA + (BCH_MAX_DATALEN - len); - } - else - { - len = 0; - } - - SET_REG(0xba + chan); - - while (reclen--) - { -/* if (tmp2 & 0x100) while(GET_STAT & 1); - * tmp = (u_char)(tmp2 = READ_BOTH_2); - */ - if (GET_STAT & 1) - { - /* if (!(++busy % 4)) reclen++; */ - while(GET_STAT & 1); - } - - tmp = READ_DATA_1; - - if ((tmp & 0x3f) == 0x3e) - { - if ((BCH_MAX_DATALEN - len) != 201) error |= 4; - - if ((S_MBUF) && (error)) - { - if (len) { len--; *dst++ = error; } - if (len) { len--; *dst++ = xlen+1; } - if (len) { len--; *dst++ = ecount; } - - S_MBUFLEN = BCH_MAX_DATALEN - len; - - if (S_TRACE & TRACE_B_RX) - ihfc_putmbuf(sc, chan, S_MBUF); - else - i4b_Bfreembuf(S_MBUF); - - S_MBUF = NULL; - printf("(error%d, %d, %d)", S_UNIT, ecount, toterrors++); - } - - i4b_Bfreembuf(S_MBUF); - S_MBUF = i4b_Bgetmbuf(BCH_MAX_DATALEN); - - dst = S_MBUFDATA; - len = BCH_MAX_DATALEN; - - xlen = 200; - error = 0; - ecount = 0; - - /* SET_REG(0xba + chan); */ - } - else - { - if (!xlen) error |= 2; - if ((tmp ^ xlen--) & 0xef) { error |= 1; ecount++; } - } - if (!tlen--) fb |= 0x20; - - if (len--) - { - *dst++ = (tmp | fb); - } - else - { - len++; - } - - fb = 0; - } - - if (S_MBUF) - { - S_MBUFLEN = len; - } - - S_HDLC_IB = xlen; - S_HDLC_TMP = error; - S_HDLC_FLAG = ecount; -} diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.h b/sys/i4b/layer1/ihfc/i4b_ihfc_drv.h deleted file mode 100644 index 9ea6720ecdc1..000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.h +++ /dev/null @@ -1,231 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ihfc_drv.h - include file for the HFC-1/S/SP driver - * ------------------------------------------------------- - * - * last edit-date: [Wed Jul 19 09:40:55 2000] - * - * $Id: i4b_ihfc_drv.h,v 1.7 2000/09/19 13:50:36 hm Exp $ - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ -#ifndef I4B_IHFC_DRV_H_ -#define I4B_IHFC_DRV_H_ - -/*---------------------------------------------------------------------------* - * Ramptables related fifo (HFC-1/S/SP) - * - * The HFC-SP chip only uses ihfc_xxx[2] values for D-channel! - * NOTE: These tables are not used anymore. - *---------------------------------------------------------------------------* - * - * w - write, r - read: D1_w D1_r B1_w B1_r B2_w B2_r - * const u_char ihfc_readtable[6] = {0xa6, 0xa7, 0xbc, 0xbd, 0xbe, 0xbf}; - * const u_char ihfc_writetable[6] = {0x96, 0x97, 0xac, 0xad, 0xae, 0xaf}; - * const u_char ihfc_f1inctable[6] = {0x92, 0x93, 0xa8, 0xa9, 0xaa, 0xab}; - * const u_char ihfc_f2inctable[6] = {0xa2, 0xa3, 0xb8, 0xb9, 0xba, 0xbb}; - * - * const struct { u_char z1L, z1H, z2L, z2H, f1, f2, dummy; } - * ihfc_countertable[6] = { - * {0x90, 0x94, 0x98, 0x9c, 0x9a, 0x9e, 0x00}, D1_w - * {0x91, 0x95, 0x99, 0x9d, 0x9b, 0x9f, 0x00}, D1_r - * {0x80, 0x84, 0x88, 0x8c, 0xb0, 0xb4, 0x00}, B1_w - * {0x81, 0x85, 0x89, 0x8d, 0xb1, 0xb5, 0x00}, B1_r - * {0x82, 0x86, 0x8a, 0x8e, 0xb2, 0xb6, 0x00}, B2_w - * {0x83, 0x87, 0x8b, 0x8f, 0xb3, 0xb7, 0x00} B2_r - * }; - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - * Ramptables related to configuration (HFC-1/S/SP) - * - * NOTE: Write registers only - *---------------------------------------------------------------------------*/ -const u_char ihfc_configtable[11] = -{ - 0x18, 0x19, 0x1a, /* cirm, ctmt, int_m1 */ - 0x1b, 0x2e, 0x37, /* int_m2, mst_mode, clkdel */ - 0x31, 0x2f, 0x32, /* sctrl, connect, test/sctrl_e */ - 0x33, 0x00 /* sctrl_r */ -}; -const u_char isac_configtable[9] = -{ - 0x39, 0x30, 0x3b, /* adf2, spcr, sqxr */ - 0x38, 0x37, 0x22, /* adf1, stcr, mode */ - 0x20, 0x2b, 0x00 /* mask, star2 */ -}; - -/*---------------------------------------------------------------------------* - * Ramptables related to statemachine (HFC-1/S/SP) - * - * state: - * 0 = deactivated - * 1 = pending - * 2 = syncronized - * 3 = activated - * 4 = error - * 5 = reset - * -1 = illegal - *---------------------------------------------------------------------------*/ - -const struct ihfc_FSMtable { u_char state, *string; } - - ihfc_TEtable[16] = /* HFC-S/SP - TE */ -{ - { 0x05 ,"Reset" }, - { 0xff , 0 }, - { 0x01 ,"Sensing" }, - { 0x00 ,"Deactivated" }, - { 0x01 ,"Awaiting signal" }, - { 0x01 ,"Identifying input" }, - { 0x02 ,"Syncronized" }, - { 0x03 ,"Activated" }, - { 0x04 ,"Lost framing" }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 } -}, - ihfc_NTtable[16] = /* HFC-S/SP - NT */ -{ - { 0x05 ,"Reset" }, - { 0x00 ,"Deactive" }, - { 0x02 ,"Pending activation" }, - { 0x03 ,"Active" }, - { 0x01 ,"Pending deactivation" }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 } -}, - ihfc_TEtable2[16] = /* HFC-1/ISAC - TE */ -{ - { 0x00 ,"Deactivate request" }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0x01 ,"Level detected" }, - { 0xff , 0 }, - { 0x04 ,"Error indication" }, - { 0x00 ,"Power-up" }, - { 0x02 ,"Activate request downstream" }, - { 0xff , 0 }, - { 0x00 ,"Test indication" }, - { 0x00 ,"Awake test indication" }, - { 0x03 ,"Activate ind. with priority class 8" }, - { 0x03 ,"Activate ind. with priority class 10" }, - { 0xff , 0 }, - { 0x00 ,"Deactivate indication downstream" } -}; - -/*---------------------------------------------------------------------------* - * Ramptable related to ISAC EXIR (HFC-1) - * - * cmd: command to execute, if any. - * - *---------------------------------------------------------------------------*/ -const struct ihfc_EXIRtable { u_char cmd, *string; } - - ihfc_EXIRtable[8] = -{ - { 0x00 ,"Watchdog Timer Overflow" }, - { 0x00 ,"Subscriber Awake" }, - { 0x00 ,"Monitor Status" }, - { 0x00 ,"Rx Sync Xfer Overflow" }, - { 0xc0 ,"Rx Frame Overflow" }, /* RMC + RRES */ - { 0x00 ,"Protocol Error" }, - { 0x01 ,"Tx Data Underrun" }, /* XRES */ - { 0x01 ,"Tx Message Repeat" }, /* XRES */ -}; - -/*---------------------------------------------------------------------------* - * Ramptables related to S/Q - channel (HFC-1/S/SP) - * - * From TE's viewpoint: - * Q: commands to NT - * S: indications from NT - * - * From NT's viewpoint: - * Q: indications from TE - * S: commands to TE - * - * cmd: not used - *---------------------------------------------------------------------------*/ -const struct ihfc_SQtable { u_char cmd, *string; } - - ihfc_Qtable[16] = -{ - { 0x00, "Loss of Power indication" }, - { 0x00, "ST request" }, - { 0x00, 0 }, - { 0x00, "LoopBack request (B1/B2)" }, - { 0x00, 0 }, - { 0x00, 0 }, - { 0x00, 0 }, - { 0x00, "LoopBack request (B1)" }, - { 0x00, 0 }, - { 0x00, 0 }, - { 0x00, 0 }, - { 0x00, "LoopBack request (B2)" }, - { 0x00, "V-DCE slave mode" }, - { 0x00, "V-DTE slave mode" }, - { 0x00, 0 }, - { 0x00, "Idle" } -}, - ihfc_Stable[16] = -{ - { 0x00, "Idle" }, - { 0x00, "ST Fail" }, - { 0x00, "ST Pass" }, - { 0x00, "Disruptive Operation Indication" }, - { 0x00, "DTSE-OUT" }, - { 0x00, "V-DCE master mode" }, - { 0x00, "ST Indication" }, - { 0x00, "DTSE-IN" }, - { 0x00, "LoopBack indication (B1/B2)" }, - { 0x00, "Loss of Received Signal indication" }, - { 0x00, "LoopBack indication (B2)" }, - { 0x00, "DTSE-IN and OUT" }, - { 0x00, "LoopBack indication (B1)" }, - { 0x00, "Loss of power indication" } -}; - - -#endif /* I4B_IHFC_DRV_H_ */ - diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_ext.h b/sys/i4b/layer1/ihfc/i4b_ihfc_ext.h deleted file mode 100644 index fde0c87a8cc1..000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_ext.h +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ihfc_ext.h - ihfc common prototypes - * --------------------------------------- - * - * last edit-date: [Wed Jul 19 09:40:59 2000] - * - * $Id: i4b_ihfc_ext.h,v 1.6 2000/08/20 07:14:08 hm Exp $ - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ - -#ifndef I4B_IHFC_EXT_H_ -#define I4B_IHFC_EXT_H_ - -#include - - -/* prototypes from i4b_ihfc_l1if.c */ - -extern struct i4b_l1mux_func ihfc_l1mux_func; - -void ihfc_B_linkinit (ihfc_sc_t *sc); -struct mbuf * ihfc_getmbuf (ihfc_sc_t *sc, u_char chan); -void ihfc_putmbuf (ihfc_sc_t *sc, u_char chan, struct mbuf *m); - - -/* prototypes from i4b_ihfc_drv.c */ - -void ihfc_intr1 (ihfc_sc_t *sc); -void ihfc_intr2 (ihfc_sc_t *sc); - -int ihfc_control (ihfc_sc_t *sc, int flag); -void ihfc_fsm (ihfc_sc_t *sc, int flag); -int ihfc_init (ihfc_sc_t *sc, u_char chan, int prot, int activate); - -#endif /* I4B_IHFC_EXT_H_ */ diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c b/sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c deleted file mode 100644 index 2ed4c46cce49..000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c +++ /dev/null @@ -1,510 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ihfc_l1.c - hfc layer 1 handler - * ----------------------------------- - * The idea of this file is to separate hfcs/sp/pci data/signal - * handling and the I4B data/signal handling. - * - * Everything which has got anything to do with I4B has been put here! - * - * last edit-date: [Wed Jul 19 09:41:03 2000] - * $Id: i4b_ihfc_l1if.c,v 1.10 2000/09/19 13:50:36 hm Exp $ - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -/*---------------------------------------------------------------------------* - * Local prototypes - * - * NOTE: The prototypes for get/putmbuf and B_linkinit - * have been put in i4b_hfc_ext.h for global hfc use. - * - * NOTE: channel != chan - *---------------------------------------------------------------------------*/ -static -isdn_link_t * ihfc_B_ret_linktab (int unit, int channel); -static void ihfc_B_set_linktab (int unit, int channel, drvr_link_t *B_linktab); - -static void ihfc_B_start (int unit, int chan); -static void ihfc_B_stat (int unit, int chan, bchan_statistics_t *bsp); - void ihfc_B_setup (int unit, int chan, int bprot, int activate); - -static int ihfc_mph_command_req (int unit, int command, void *parm); - -static int ihfc_ph_activate_req (int unit); -static int ihfc_ph_data_req (int unit, struct mbuf *m, int freeflag); - -static void ihfc_T3_expired (ihfc_sc_t *sc); - -/*---------------------------------------------------------------------------* - * Our I4B L1 mulitplexer link - *---------------------------------------------------------------------------*/ -struct i4b_l1mux_func ihfc_l1mux_func = { - ihfc_B_ret_linktab, - ihfc_B_set_linktab, - ihfc_mph_command_req, - ihfc_ph_data_req, - ihfc_ph_activate_req, -}; - -/*---------------------------------------------------------------------------* - * L2 -> L1: PH-DATA-REQUEST (D-Channel) - * - * NOTE: We may get called here from ihfc_hdlc_Dread or isac_hdlc_Dread - * via the upper layers. - *---------------------------------------------------------------------------*/ -static int -ihfc_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - ihfc_sc_t *sc = &ihfc_softc[unit]; - u_char chan = 0; - HFC_VAR; - - if (!m) return 0; - - HFC_BEG; - - if(S_PHSTATE != 3) - { - NDBGL1(L1_PRIM, "L1 was not running: " - "ihfc_ph_activate_req(unit = %d)!", unit); - - ihfc_ph_activate_req(unit); - } - - /* "Allow" I-frames (-hp) */ - - if (freeflag == MBUF_DONTFREE) m = m_copypacket(m, M_DONTWAIT); - - if (!_IF_QFULL(&S_IFQUEUE) && m) - { - IF_ENQUEUE(&S_IFQUEUE, m); - - ihfc_B_start(unit, chan); /* (recycling) */ - } - else - { - NDBGL1(L1_ERROR, "No frame out (unit = %d)", unit); - if (m) i4b_Dfreembuf(m); - - HFC_END; - return 0; - } - - if (S_INTR_ACTIVE) S_INT_S1 |= 0x04; - - HFC_END; - - return 1; -} - -/*---------------------------------------------------------------------------* - * L2 -> L1: PH-ACTIVATE-REQUEST (B-channel and D-channel) - *---------------------------------------------------------------------------*/ -static int -ihfc_ph_activate_req(int unit) -{ - ihfc_sc_t *sc = &ihfc_softc[unit]; - HFC_VAR; - - HFC_BEG; - - if ((!S_STM_T3) && (S_PHSTATE != 3)) - { - HFC_FSM(sc, 1); - - S_STM_T3 = 1; - S_STM_T3CALLOUT = timeout((TIMEOUT_FUNC_T) - ihfc_T3_expired, (ihfc_sc_t *)sc, - IHFC_ACTIVATION_TIMEOUT); - } - - HFC_END; - return 0; -} -/*---------------------------------------------------------------------------* - * T3 timeout - persistant deactivation - *---------------------------------------------------------------------------*/ -static void -ihfc_T3_expired(ihfc_sc_t *sc) -{ - u_char chan = 0; - HFC_VAR; - - HFC_BEG; - - S_STM_T3 = 0; - - if (S_PHSTATE != 3) /* line was not activated */ - { - i4b_Dcleanifq(&S_IFQUEUE); - i4b_l1_ph_deactivate_ind(S_I4BUNIT); - - i4b_l1_mph_status_ind(S_I4BUNIT, STI_PDEACT, 0, 0); - - HFC_FSM(sc, 2); /* L1 deactivate */ - } - - HFC_END; -} - -/*---------------------------------------------------------------------------* - * Command from the upper layers (B-channel and D-channel) - *---------------------------------------------------------------------------*/ -static int -ihfc_mph_command_req(int unit, int command, void *parm) -{ - ihfc_sc_t *sc = &ihfc_softc[unit]; - - switch(command) - { - case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, - "unit %d, command = CMR_DOPEN", unit); - S_ENABLED = 1; - break; - - case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, - "unit %d, command = CMR_DCLOSE", unit); - S_ENABLED = 0; - break; - - case CMR_SETTRACE: /* set new trace mask */ - NDBGL1(L1_PRIM, - "unit %d, command = CMR_SETTRACE, parm = %d", - unit, (unsigned int)parm); - S_TRACE = (unsigned int)parm; - break; - - case CMR_GCST: /* get chip statistic */ - NDBGL1(L1_PRIM, - "unit %d, command = CMR_GCST, parm = %d", - unit, (unsigned int)parm); - - #define CST ((struct chipstat *)parm) - - CST->driver_type = L1DRVR_IHFC; - - /* XXX CST->xxxx_stat = xxx; */ - - #undef CST - break; - - default: - NDBGL1(L1_ERROR, - "ERROR, unknown command = %d, unit = %d, parm = %d", - command, unit, (unsigned int)parm); - break; - } - - return 0; -} - -/*---------------------------------------------------------------------------* - * Data source switch for Read channels - 1, 3 and 5 (B and D-Channel) - *---------------------------------------------------------------------------*/ -void -ihfc_putmbuf (ihfc_sc_t *sc, u_char chan, struct mbuf *m) -{ - i4b_trace_hdr_t hdr; - - if (chan < 2) - { - if(S_TRACE & TRACE_D_RX) - { - hdr.count = ++S_DTRACECOUNT; - hdr.dir = FROM_NT; - hdr.type = TRC_CH_D; - hdr.unit = S_I4BUNIT; - - MICROTIME(hdr.time); - - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - if (!S_ENABLED) { i4b_Dfreembuf(m); return; } - - m->m_pkthdr.len = m->m_len; - - i4b_l1_ph_data_ind(S_I4BUNIT, m); - } - else - { - if(S_TRACE & TRACE_B_RX) - { - hdr.count = ++S_BTRACECOUNT; - hdr.dir = FROM_NT; - hdr.type = (chan < 4) ? TRC_CH_B1 : TRC_CH_B2; - hdr.unit = S_I4BUNIT; - - MICROTIME(hdr.time); - - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - if (!S_ENABLED) { i4b_Bfreembuf(m); return; } - - if (S_PROT == BPROT_NONE) - { - if(!i4b_l1_bchan_tel_silence(m->m_data, m->m_len)) - { - S_BDRVLINK->bch_activity(S_BDRVLINK->unit, ACT_RX); - } - - if (!_IF_QFULL(&S_IFQUEUE)) - { - S_BYTES += m->m_len; - IF_ENQUEUE(&S_IFQUEUE, m); - S_BDRVLINK->bch_rx_data_ready(S_BDRVLINK->unit); - } - - return; - } - - if (S_PROT == BPROT_RHDLC) - { - S_MBUFDUMMY = m; - S_BYTES += m->m_pkthdr.len = m->m_len; - S_BDRVLINK->bch_rx_data_ready(S_BDRVLINK->unit); - S_MBUFDUMMY = NULL; - - return; - } - - NDBGL1(L1_ERROR, "Unknown protocol: %d", S_PROT); - } -} - -/*---------------------------------------------------------------------------* - * Data destinator switch for write channels - 0, 2 and 4 - *---------------------------------------------------------------------------*/ -struct mbuf * -ihfc_getmbuf (ihfc_sc_t *sc, u_char chan) -{ - register struct mbuf *m; - i4b_trace_hdr_t hdr; - - if (chan < 2) - { - IF_DEQUEUE(&S_IFQUEUE, m); - - if((S_TRACE & TRACE_D_TX) && m) - { - hdr.count = ++S_DTRACECOUNT; - hdr.dir = FROM_TE; - hdr.type = TRC_CH_D; - hdr.unit = S_I4BUNIT; - - MICROTIME(hdr.time); - - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - } - else - { - IF_DEQUEUE(&S_IFQUEUE, m); - - if (!m) - { - S_BDRVLINK->bch_tx_queue_empty(S_BDRVLINK->unit); - - IF_DEQUEUE(&S_IFQUEUE, m); - } - if (m) - { - if(!i4b_l1_bchan_tel_silence(m->m_data, m->m_len)) - { - S_BDRVLINK->bch_activity(S_BDRVLINK->unit, ACT_TX); - } - - S_BYTES += m->m_len; - - if(S_TRACE & TRACE_B_TX) - { - hdr.count = ++S_BTRACECOUNT; - hdr.dir = FROM_TE; - hdr.type = (chan < 4) ? TRC_CH_B1 : TRC_CH_B2; - hdr.unit = S_I4BUNIT; - - MICROTIME(hdr.time); - - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - } - } - - return(m); -} - -/*---------------------------------------------------------------------------* - * Initialize rx/tx data structures (B-channel) - *---------------------------------------------------------------------------*/ -void -ihfc_B_setup(int unit, int chan, int bprot, int activate) -{ - ihfc_sc_t *sc = &ihfc_softc[unit]; - HFC_VAR; - - if (((u_int)chan > 5) || ((u_int)chan < 2)) return; - - HFC_BEG; - - HFC_INIT(sc, chan, bprot, activate); - - HFC_END; -} - -/*---------------------------------------------------------------------------* - * Start transmission (B-channel or D-channel tx) - * NOTE: if "chan" variable is corrupted, it will not cause any harm, - * but data may be lost and there may be software sync. errors. - *---------------------------------------------------------------------------*/ -static void -ihfc_B_start(int unit, int chan) -{ - ihfc_sc_t *sc = &ihfc_softc[unit]; - HFC_VAR; - - if ((u_int)chan > 5) return; - - HFC_BEG; - - if (S_FILTER && !S_MBUF && !S_INTR_ACTIVE) - { - S_INTR_ACTIVE |= 2; /* never know what * - * they put in the * - * L2 code */ - - S_FILTER(sc, chan); /* quick tx */ - - S_INTR_ACTIVE &= ~2; - } - - HFC_END; -} - -/*---------------------------------------------------------------------------* - * Fill statistics struct (B-channel) - *---------------------------------------------------------------------------*/ -static void -ihfc_B_stat(int unit, int chan, bchan_statistics_t *bsp) -{ - ihfc_sc_t *sc = &ihfc_softc[unit]; - HFC_VAR; - - if ((u_int)chan > 5) return; - - chan &= ~1; - - HFC_BEG; - - bsp->inbytes = S_BYTES; S_BYTES = 0; - - chan++; - - bsp->outbytes = S_BYTES; S_BYTES = 0; - - HFC_END; -} - -/*---------------------------------------------------------------------------* - * Return the address of IHFC linktab to I4B (B-channel) - *---------------------------------------------------------------------------*/ -static isdn_link_t * -ihfc_B_ret_linktab(int unit, int channel) -{ - ihfc_sc_t *sc = &ihfc_softc[unit]; - - if (channel < 2) - return(&sc->sc_blinktab[channel]); - else - return 0; -} - -/*---------------------------------------------------------------------------* - * Set the I4B driver linktab for IHFC use (B-channel) - *---------------------------------------------------------------------------*/ -static void -ihfc_B_set_linktab(int unit, int channel, drvr_link_t *B_linktab) -{ - ihfc_sc_t *sc = &ihfc_softc[unit]; - - if (channel < 2) - sc->sc_bdrvlinktab[channel] = B_linktab; -} - -/*---------------------------------------------------------------------------* - * Initialize linktab for I4B use (B-channel) - *---------------------------------------------------------------------------*/ -void -ihfc_B_linkinit(ihfc_sc_t *sc) -{ - u_char chan; - - /* make sure the hardware driver is known to layer 4 */ - ctrl_types[CTRL_PASSIVE].set_linktab = i4b_l1_set_linktab; - ctrl_types[CTRL_PASSIVE].get_linktab = i4b_l1_ret_linktab; - - for (chan = 2; chan < 6; chan++) - { - S_BLINK.unit = S_UNIT; - S_BLINK.channel = chan; /* point to tx-chan */ - S_BLINK.bch_config = ihfc_B_setup; - S_BLINK.bch_tx_start = ihfc_B_start; - S_BLINK.bch_stat = ihfc_B_stat; - - /* This is a transmit channel (even) */ - S_BLINK.tx_queue = &S_IFQUEUE; - chan++; - /* This is a receive channel (odd) */ - S_BLINK.rx_queue = &S_IFQUEUE; - S_BLINK.rx_mbuf = &S_MBUFDUMMY; - } -} diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c b/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c deleted file mode 100644 index b305f90b611a..000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c +++ /dev/null @@ -1,445 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ihfc_pnp.c - common hfc ISA PnP-bus interface - * ------------------------------------------------- - * - Everything which has got anything to to with "PnP" bus setup has - * been put here, except the chip spesific "PnP" setup. - * - * last edit-date: [Tue Jan 23 16:03:33 2001] - * $Id: i4b_ihfc_pnp.c,v 1.9 2000/09/19 13:50:36 hm Exp $ - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include - -/*---------------------------------------------------------------------------* - * Softc - *---------------------------------------------------------------------------*/ -ihfc_sc_t ihfc_softc[IHFC_MAXUNIT]; - -/*---------------------------------------------------------------------------* - * Prototypes - *---------------------------------------------------------------------------*/ -static int ihfc_isa_probe (device_t dev); -static int ihfc_pnp_probe (device_t dev); -static int ihfc_pnp_attach (device_t dev); -static int ihfc_pnp_detach (device_t dev, u_int flag); -static int ihfc_pnp_shutdown (device_t dev); - -const struct ihfc_pnp_ids -{ - u_long vid; /* vendor id */ - int flag; /* */ - u_char hfc; /* chip type */ - u_char iirq; /* internal irq */ - u_short iio; /* internal io-address */ - u_char stdel; /* S/T delay compensation */ -} - ihfc_pnp_ids[] = -{ - { 0x10262750, CARD_TYPEP_16_3C, HFC_S, 2, 0x200, 0x2d}, - { 0x20262750, CARD_TYPEP_16_3C, HFC_SP, 0, 0x000, 0x0f}, - { 0x1411d805, CARD_TYPEP_ACERP10, HFC_S, 1, 0x300, 0x0e}, - { 0 } -}; - -typedef const struct ihfc_pnp_ids ihfc_id_t; - -/*---------------------------------------------------------------------------* - * PCB layout - * - * IIRQx: Internal IRQ cross reference for a card - * IRQx : Supported IRQ's for a card - * IOx : Supported IO-bases for a card - * - * IO0, IRQ0, IIRQ0: TELEINT ISDN SPEED No. 1 - * IIRQ3: Teles 16.3c PnP (B version) - *---------------------------------------------------------------------------*/ - /* IRQ -> 0 1 2 3 4 5 6 7 8 9 a b c d e f */ -#define IIRQ0 ((const u_char []){ 0, 0, 0, 1, 2, 3, 0, 4, 0, 0, 5, 6, 0, 0, 0, 0 }) -#define IRQ0 ((const u_char []){ 3, 4, 5, 7, 0xa, 0xb, 0 }) - -#define IO0 ((const u_long []){ 0x300, 0x330, 0x278, 0x2e8, 0 }) - -#define IIRQ3 ((const u_char []){ 0, 0, 0, 7, 0, 1, 0, 0, 0, 2, 3, 4, 5, 0, 0, 6 }) - -/*---------------------------------------------------------------------------* - * ISA PnP setup - *---------------------------------------------------------------------------*/ -static device_method_t ihfc_pnp_methods[] = -{ - DEVMETHOD(device_probe, ihfc_pnp_probe), - DEVMETHOD(device_attach, ihfc_pnp_attach), - DEVMETHOD(device_shutdown, ihfc_pnp_shutdown), - { 0, 0 } -}; - -static driver_t ihfc_pnp_driver = -{ - "ihfc", - ihfc_pnp_methods, - 0, -}; - -static devclass_t ihfc_devclass; - -DRIVER_MODULE(ihfcpnp, isa, ihfc_pnp_driver, ihfc_devclass, 0, 0); - -/*---------------------------------------------------------------------------* - * probe for ISA "PnP" card - *---------------------------------------------------------------------------*/ -static int -ihfc_pnp_probe(device_t dev) -{ - u_int unit = device_get_unit(dev); /* get unit */ - u_int32_t vid = isa_get_vendorid(dev); /* vendor id */ - ihfc_id_t *ids = &ihfc_pnp_ids[0]; /* ids ptr */ - ihfc_sc_t *sc = &ihfc_softc[unit]; /* softc */ - u_char flag = 0; /* flag */ - void *dummy = 0; /* a dummy */ - - HFC_VAR; - - if (unit >= IHFC_MAXUNIT) - { - printf("ihfc%d: Error, unit %d >= IHFC_MAXUNIT", unit, unit); - return ENXIO; - } - - if (!vid) return ihfc_isa_probe(dev); - - HFC_BEG; - - for ( ;(ids->vid); ids++) - { - if (ids->vid == vid) - { - flag = 0; - - bzero(sc, sizeof(ihfc_sc_t)); /* reset data structure.* - * Zero is default for * - * most, so calling the * - * int. handler now will* - * not be a problem. */ - - S_IOBASE[0] = bus_alloc_resource( - dev, SYS_RES_IOPORT, &S_IORID[0], - 0UL, ~0UL, 2, RF_ACTIVE - ); - - S_IRQ = bus_alloc_resource_any( - dev, SYS_RES_IRQ, &S_IRQRID, - RF_ACTIVE - ); - - S_DLP = IHFC_DLP; /* set D-priority */ - S_HFC = ids->hfc; /* set chip type */ - S_I4BFLAG = ids->flag; /* set flag */ - S_NTMODE = IHFC_NTMODE; /* set mode */ - S_STDEL = ids->stdel; /* set delay */ - - S_I4BUNIT = L0IHFCUNIT(unit); /* set "i4b" unit */ - S_TRACE = TRACE_OFF; /* set trace mask */ - S_UNIT = unit; /* set up unit numbers */ - - if (S_IOBASE[0] && S_IRQ) - { - if (ids->iio) - { - S_IIO = ids->iio; - S_IIRQ = ids->iirq; - } - else - { - S_IIO = rman_get_start(S_IOBASE[0]) & 0x3ff; - S_IIRQ = IIRQ3[rman_get_start(S_IRQ) & 0xf]; - } - - /* setup interrupt routine now to avvoid stray * - * interrupts. */ - - if (bus_setup_intr(dev, S_IRQ, INTR_TYPE_NET, - NULL, (void(*)(void*)) HFC_INTR, sc, - &dummy) != 0) - { - printf("ihfc%d: failed to setup irq.\n", - unit); - HFC_END; - return ENXIO; - } - - flag = 1; - - if (!HFC_CONTROL(sc, 1)) - { - HFC_END; - return 0; /* success */ - } - else - { - printf("ihfc%d: Chip seems corrupted. " - "Please hard reboot your computer!\n", - unit); - } - } - - ihfc_pnp_detach(dev, flag); - } - } - - HFC_END; - return ENXIO; /* failure */ -} - -/*---------------------------------------------------------------------------* - * probe for "ISA" cards - *---------------------------------------------------------------------------*/ -static int -ihfc_isa_probe(device_t dev) -{ - u_int unit = device_get_unit(dev); /* get unit */ - ihfc_sc_t *sc = &ihfc_softc[unit]; /* softc */ - const u_char *irq = &IRQ0[0]; /* irq's to try */ - const u_long *iobase = &IO0[0]; /* iobases to try */ - u_char flag = 0; /* flag */ - void *dummy = 0; /* a dummy */ - - HFC_VAR; - - bzero(sc, sizeof(ihfc_sc_t)); /* reset data structure * - * We must reset the * - * datastructure here, * - * else we risk zero-out * - * our gotten resources. */ - HFC_BEG; - - j0: while(*irq) /* get supported IRQ */ - { - if ((S_IRQ = bus_alloc_resource( - dev, SYS_RES_IRQ, &S_IRQRID, - *irq, *irq, 1, RF_ACTIVE - ) - )) - break; - else - irq++; - } - - while(*iobase) /* get supported IO-PORT */ - { - if ((S_IOBASE[0] = bus_alloc_resource( - dev, SYS_RES_IOPORT, &S_IORID[0], - *iobase, *iobase, 2, RF_ACTIVE - ) - )) - break; - else - iobase++; - } - - flag = 0; - - if (*irq && *iobase) /* we got our resources, now test chip */ - { - S_DLP = IHFC_DLP; /* set D-priority */ - S_HFC = HFC_1; /* set chip type */ - S_I4BFLAG = CARD_TYPEP_TELEINT_NO_1; /* set flag */ - S_NTMODE = IHFC_NTMODE; /* set mode */ - S_STDEL = 0x00; /* set delay (not used) */ - - S_I4BUNIT = L0IHFCUNIT(unit); /* set "i4b" unit */ - S_TRACE = TRACE_OFF; /* set trace mask */ - S_UNIT = unit; /* set up unit numbers */ - - S_IIRQ = IIRQ0[*irq]; /* set internal irq */ - S_IIO = *iobase; /* set internal iobase */ - - /* setup interrupt routine now to avvoid stray * - * interrupts. */ - - if (bus_setup_intr(dev, S_IRQ, INTR_TYPE_NET, NULL, - (void(*)(void*)) HFC_INTR, sc, &dummy) != 0) - { - printf("ihfc%d: failed to setup irq.\n", unit); - HFC_END; - return ENXIO; - } - - flag = 1; - - if (!HFC_CONTROL(sc, 1)) - { - device_set_desc(dev, "TELEINT ISDN SPEED No. 1"); - - HFC_END; - return 0; /* success */ - } - } - - ihfc_pnp_detach(dev, flag); - - if (*irq && *++iobase) goto j0; /* try again */ - - HFC_END; - - printf("ihfc%d: Chip not found. " - "A hard reboot may help!\n", unit); - - return ENXIO; /* failure */ -} - -/*---------------------------------------------------------------------------* - * attach ISA "PnP" card - *---------------------------------------------------------------------------*/ -static int -ihfc_pnp_attach(device_t dev) -{ - u_int unit = device_get_unit(dev); /* get unit */ - ihfc_sc_t *sc = &ihfc_softc[unit]; /* softc */ - HFC_VAR; - - HFC_BEG; - - ihfc_B_linkinit(sc); /* Setup B-Channel linktabs */ - - i4b_l1_mph_status_ind(S_I4BUNIT, STI_ATTACH, S_I4BFLAG, &ihfc_l1mux_func); - - HFC_INIT(sc, 0, 0, 1); /* Setup D - Channel */ - - HFC_INIT(sc, 2, 0, 0); /* Init B1 - Channel */ - HFC_INIT(sc, 4, 0, 0); /* Init B2 - Channel */ - - HFC_END; - return 0; /* success */ - - HFC_END; - return ENXIO; /* failure */ -} - -/*---------------------------------------------------------------------------* - * shutdown for our ISA PnP card - *---------------------------------------------------------------------------*/ -static int -ihfc_pnp_shutdown(device_t dev) -{ - u_int unit = device_get_unit(dev); /* get unit */ - ihfc_sc_t *sc = &ihfc_softc[unit]; /* softc */ - HFC_VAR; - - HFC_BEG; - - if (unit >= IHFC_MAXUNIT) - { - printf("ihfc%d: Error, unit %d >= IHFC_MAXUNIT", unit, unit); - goto f0; - } - - HFC_CONTROL(sc, 2); /* shutdown chip */ - - HFC_END; - return 0; - f0: - HFC_END; - return ENXIO; - -} - -/*---------------------------------------------------------------------------* - * detach for our ISA PnP card - * - * flag: bit[0] set: teardown interrupt handler too - *---------------------------------------------------------------------------*/ -static int -ihfc_pnp_detach (device_t dev, u_int flag) -{ - u_int unit = device_get_unit(dev); /* get unit */ - ihfc_sc_t *sc = &ihfc_softc[unit]; /* softc */ - u_char i; - - if (unit >= IHFC_MAXUNIT) - { - printf("ihfc%d: Error, unit %d >= IHFC_MAXUNIT", unit, unit); - return 0; - } - - /* free interrupt resources */ - - if(S_IRQ) - { - if (flag & 1) - { - /* tear down interrupt handler */ - bus_teardown_intr(dev, S_IRQ, (void(*)(void *))HFC_INTR); - } - - /* free irq */ - bus_release_resource(dev, SYS_RES_IRQ, S_IRQRID, S_IRQ); - - S_IRQRID = 0; - S_IRQ = 0; - } - - - /* free iobases */ - - for (i = IHFC_IO_BASES; i--;) - { - if(S_IOBASE[i]) - { - bus_release_resource(dev, SYS_RES_IOPORT, - S_IORID[i], S_IOBASE[i]); - S_IORID[i] = 0; - S_IOBASE[i] = 0; - } - } - - return 0; -} diff --git a/sys/i4b/layer1/isic/i4b_asuscom_ipac.c b/sys/i4b/layer1/isic/i4b_asuscom_ipac.c deleted file mode 100644 index 16cf38327b15..000000000000 --- a/sys/i4b/layer1/isic/i4b_asuscom_ipac.c +++ /dev/null @@ -1,234 +0,0 @@ -/*- - * Copyright (c) 1999 Ari Suutari. All rights reserved. - * - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isic - I4B Siemens ISDN Chipset Driver for Asuscom ISDNlink 128K PnP - * ===================================================================== - * - * This driver works with Asuscom ISDNlink 128K PnP ISA adapter, - * which is based on Siemens IPAC chip (my card probes as ASU1690). - * Older Asuscom ISA cards are based on different chipset - * (containing two chips) - for those cards, one might want - * to try the Dynalink driver. - * - * This driver is heavily based on ELSA Quickstep 1000pro PCI - * driver written by Hellmuth Michaelis. Card initialization - * code is modeled after Linux i4l driver written by Karsten - * Keil. - * - * last edit-date: [Wed Jan 24 09:06:30 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined (ASUSCOM_IPAC) - -#include -#include -#include -#include - -#include -#include -#include - -/* masks for register encoded in base addr */ - -#define ASI_BASE_MASK 0x0ffff -#define ASI_OFF_MASK 0xf0000 - -/* register id's to be encoded in base addr */ - -#define ASI_IDISAC 0x00000 -#define ASI_IDHSCXA 0x10000 -#define ASI_IDHSCXB 0x20000 -#define ASI_IDIPAC 0x40000 - -/* offsets from base address */ - -#define ASI_OFF_ALE 0x00 -#define ASI_OFF_RW 0x01 - -/*---------------------------------------------------------------------------* - * Asuscom ISDNlink 128K ISAC get fifo routine - *---------------------------------------------------------------------------*/ -static void -asi_read_fifo(struct l1_softc *sc,int what,void *buf,size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,ASI_OFF_ALE,IPAC_ISAC_OFF); - bus_space_read_multi_1(t,h,ASI_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,ASI_OFF_ALE,IPAC_HSCXA_OFF); - bus_space_read_multi_1(t,h,ASI_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,ASI_OFF_ALE,IPAC_HSCXB_OFF); - bus_space_read_multi_1(t,h,ASI_OFF_RW,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Asuscom ISDNlink 128K ISAC put fifo routine - *---------------------------------------------------------------------------*/ -static void -asi_write_fifo(struct l1_softc *sc,int what,void *buf,size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,ASI_OFF_ALE,IPAC_ISAC_OFF); - bus_space_write_multi_1(t,h,ASI_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,ASI_OFF_ALE,IPAC_HSCXA_OFF); - bus_space_write_multi_1(t,h,ASI_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,ASI_OFF_ALE,IPAC_HSCXB_OFF); - bus_space_write_multi_1(t,h,ASI_OFF_RW,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Asuscom ISDNlink 128K ISAC put register routine - *---------------------------------------------------------------------------*/ -static void -asi_write_reg(struct l1_softc *sc,int what,bus_size_t reg,u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,ASI_OFF_ALE,reg+IPAC_ISAC_OFF); - bus_space_write_1(t,h,ASI_OFF_RW,data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,ASI_OFF_ALE,reg+IPAC_HSCXA_OFF); - bus_space_write_1(t,h,ASI_OFF_RW,data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,ASI_OFF_ALE,reg+IPAC_HSCXB_OFF); - bus_space_write_1(t,h,ASI_OFF_RW,data); - break; - case ISIC_WHAT_IPAC: - bus_space_write_1(t,h,ASI_OFF_ALE,reg+IPAC_IPAC_OFF); - bus_space_write_1(t,h,ASI_OFF_RW,data); - break; - } -} - -/*---------------------------------------------------------------------------* - * Asuscom ISDNlink 128K ISAC get register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -asi_read_reg(struct l1_softc *sc,int what,bus_size_t reg) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,ASI_OFF_ALE,reg+IPAC_ISAC_OFF); - return bus_space_read_1(t,h,ASI_OFF_RW); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,ASI_OFF_ALE,reg+IPAC_HSCXA_OFF); - return bus_space_read_1(t,h,ASI_OFF_RW); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,ASI_OFF_ALE,reg+IPAC_HSCXB_OFF); - return bus_space_read_1(t,h,ASI_OFF_RW); - case ISIC_WHAT_IPAC: - bus_space_write_1(t,h,ASI_OFF_ALE,reg+IPAC_IPAC_OFF); - return bus_space_read_1(t,h,ASI_OFF_RW); - default: - return 0; - } -} - -/*---------------------------------------------------------------------------* - * isic_attach_siemens_isurf - attach for Asuscom ISDNlink 128K - *---------------------------------------------------------------------------*/ -int -isic_attach_asi(device_t dev) -{ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = asi_read_reg; - sc->writereg = asi_write_reg; - - sc->readfifo = asi_read_fifo; - sc->writefifo = asi_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_ASUSCOMIPAC; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* setup chip type = IPAC ! */ - - sc->sc_ipac = 1; - sc->sc_bfifolen = IPAC_BFIFO_LEN; - - /* enable hscx/isac irq's */ -/* - * This has been taken from Linux driver. - * (Removed initialization that was not applicaple to - * this board or was already register default setting.) - */ - IPAC_WRITE (IPAC_ACFG, 0xff); /* Setup AUX pin modes */ - IPAC_WRITE (IPAC_AOE, 0x0); /* Setup AUX pin modes */ - IPAC_WRITE (IPAC_MASK, (IPAC_MASK_INT1 | IPAC_MASK_INT0)); - - return(0); -} -#endif /* defined (ASUSCOM_IPAC) */ diff --git a/sys/i4b/layer1/isic/i4b_avm_a1.c b/sys/i4b/layer1/isic/i4b_avm_a1.c deleted file mode 100644 index e9b0416882ad..000000000000 --- a/sys/i4b/layer1/isic/i4b_avm_a1.c +++ /dev/null @@ -1,413 +0,0 @@ -/*- - * Copyright (c) 1996 Andrew Gordon. All rights reserved. - * - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_avm_a1.c - AVM A1/Fritz passive card driver for isdn4bsd - * ------------------------------------------------------------ - * last edit-date: [Wed Jan 24 09:25:23 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(AVM_A1) - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -/*---------------------------------------------------------------------------* - * AVM A1 and AVM Fritz! Card special registers - *---------------------------------------------------------------------------*/ - -#define AVM_CONF_REG 0x1800 /* base offset for config register */ -#define AVM_CONF_IRQ 0x1801 /* base offset for IRQ register */ - /* config register write */ -#define AVM_CONF_WR_RESET 0x01 /* 1 = RESET ISAC and HSCX */ -#define AVM_CONF_WR_CCL 0x02 /* 1 = clear counter low nibble */ -#define AVM_CONF_WR_CCH 0x04 /* 1 = clear counter high nibble */ -#define AVM_CONF_WR_IRQEN 0x08 /* 1 = enable IRQ */ -#define AVM_CONF_WR_TEST 0x10 /* test bit */ - /* config register read */ -#define AVM_CONF_RD_IIRQ 0x01 /* 0 = ISAC IRQ active */ -#define AVM_CONF_RD_HIRQ 0x02 /* 0 = HSCX IRQ active */ -#define AVM_CONF_RD_CIRQ 0x04 /* 0 = counter IRQ active */ -#define AVM_CONF_RD_ZER1 0x08 /* unused, always read 0 */ -#define AVM_CONF_RD_TEST 0x10 /* test bit read back */ -#define AVM_CONF_RD_ZER2 0x20 /* unused, always read 0 */ - -#define AVM_ISAC_R_OFFS (0x1400-0x20) -#define AVM_HSCXA_R_OFFS (0x400-0x20) -#define AVM_HSCXB_R_OFFS (0xc00-0x20) -#define AVM_ISAC_F_OFFS (0x1400-0x20-0x3e0) -#define AVM_HSCXA_F_OFFS (0x400-0x20-0x3e0) -#define AVM_HSCXB_F_OFFS (0xc00-0x20-0x3e0) - -/*---------------------------------------------------------------------------* - * AVM read fifo routine - *---------------------------------------------------------------------------*/ -static void -avma1_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+4]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+4]); - bus_space_read_multi_1(t, h, 0, buf, size); -} - -/*---------------------------------------------------------------------------* - * AVM write fifo routine - *---------------------------------------------------------------------------*/ -static void -avma1_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+4]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+4]); - bus_space_write_multi_1(t, h, 0, (u_int8_t*)buf, size); -} - -/*---------------------------------------------------------------------------* - * AVM write register routine - *---------------------------------------------------------------------------*/ -static void -avma1_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+1]); - bus_space_write_1(t, h, offs, data); -} - -/*---------------------------------------------------------------------------* - * AVM read register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -avma1_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+1]); - return bus_space_read_1(t, h, offs); -} - -/*---------------------------------------------------------------------------* - * allocate an io port - *---------------------------------------------------------------------------*/ -static int -isic_alloc_port(device_t dev, int rid, u_int base, u_int len) -{ - size_t unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - - sc->sc_resources.io_rid[rid] = rid; - - bus_set_resource(dev, SYS_RES_IOPORT, rid, base, len); - - if(!(sc->sc_resources.io_base[rid] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[rid], - RF_ACTIVE))) - { - printf("isic%d: Error, failed to reserve io #%d!\n", unit, rid); - isic_detach_common(dev); - return(ENXIO); - } - return(0); -} - -/*---------------------------------------------------------------------------* - * isic_probe_avma1 - probe for AVM A1 and compatibles - *---------------------------------------------------------------------------*/ -int -isic_probe_avma1(device_t dev) -{ - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = 0; /* pointer to softc */ - void *ih = 0; /* dummy */ - bus_space_tag_t t; /* bus things */ - bus_space_handle_t h; - u_char savebyte; - u_char byte; - - /* check max unit range */ - - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for AVM A1/Fritz!\n", - unit, unit); - return(ENXIO); - } - - sc = &l1_sc[unit]; /* get pointer to softc */ - sc->sc_unit = unit; /* set unit */ - - /* see if an io base was supplied */ - - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - printf("isic%d: Could not get iobase for AVM A1/Fritz!\n", - unit); - return(ENXIO); - } - - /* set io base */ - - sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]); - - /* release io base */ - - bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - - switch(sc->sc_port) - { - case 0x200: - case 0x240: - case 0x300: - case 0x340: - break; - - default: - printf("isic%d: Error, invalid iobase 0x%x specified for AVM A1/Fritz!\n", - unit, sc->sc_port); - return(ENXIO); - break; - } - - if(isic_alloc_port(dev, 0, sc->sc_port+AVM_CONF_REG, 0x20)) - return(ENXIO); - - if(isic_alloc_port(dev, 1, sc->sc_port+AVM_ISAC_R_OFFS, 0x20)) - return(ENXIO); - - if(isic_alloc_port(dev, 2, sc->sc_port+AVM_HSCXA_R_OFFS, 0x20)) - return(ENXIO); - - if(isic_alloc_port(dev, 3, sc->sc_port+AVM_HSCXB_R_OFFS, 0x20)) - return(ENXIO); - - if(isic_alloc_port(dev, 4, sc->sc_port+AVM_ISAC_F_OFFS, 0x20)) - return(ENXIO); - - if(isic_alloc_port(dev, 5, sc->sc_port+AVM_HSCXA_F_OFFS, 0x20)) - return(ENXIO); - - if(isic_alloc_port(dev, 6, sc->sc_port+AVM_HSCXB_F_OFFS, 0x20)) - return(ENXIO); - - /* get our irq */ - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, RF_ACTIVE))) - { - printf("isic%d: Could not get an irq for AVM A1/Fritz!\n",unit); - isic_detach_common(dev); - return ENXIO; - } - - /* get the irq number */ - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - /* register interrupt routine */ - if (bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL, - (void(*)(void *))(isicintr), sc, &ih) != 0) - { - printf("isic%d: Could not setup the irq for AVM A1/Fritz!\n",unit); - isic_detach_common(dev); - return ENXIO; - } - - /* check IRQ validity */ - - switch(sc->sc_irq) - { - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - break; - - default: - printf("isic%d: Error, invalid IRQ [%d] specified for AVM A1/Fritz!\n", - unit, sc->sc_irq); - isic_detach_common(dev); - return(ENXIO); - break; - } - - sc->clearirq = NULL; - sc->readreg = avma1_read_reg; - sc->writereg = avma1_write_reg; - - sc->readfifo = avma1_read_fifo; - sc->writefifo = avma1_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_AVMA1; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* - * Read HSCX A/B VSTR. - * Expected value for AVM A1 is 0x04 or 0x05 and for the - * AVM Fritz!Card is 0x05 in the least significant bits. - */ - - if( (((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) && - ((HSCX_READ(0, H_VSTR) & 0xf) != 0x4)) || - (((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) && - ((HSCX_READ(1, H_VSTR) & 0xf) != 0x4)) ) - { - printf("isic%d: HSCX VSTR test failed for AVM A1/Fritz\n", - unit); - printf("isic%d: HSC0: VSTR: %#x\n", - unit, HSCX_READ(0, H_VSTR)); - printf("isic%d: HSC1: VSTR: %#x\n", - unit, HSCX_READ(1, H_VSTR)); - return(ENXIO); - } - - /* AVM A1 or Fritz! control register bits: */ - /* read write */ - /* 0x01 hscx irq* RESET */ - /* 0x02 isac irq* clear counter1 */ - /* 0x04 counter irq* clear counter2 */ - /* 0x08 always 0 irq enable */ - /* 0x10 read test bit set test bit */ - /* 0x20 always 0 unused */ - - /* - * XXX the following test may be destructive, to prevent the - * worst case, we save the byte first, and in case the test - * fails, we write back the saved byte ..... - */ - - t = rman_get_bustag(sc->sc_resources.io_base[0]); - h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - savebyte = bus_space_read_1(t, h, 0); - - /* write low to test bit */ - - bus_space_write_1(t, h, 0, 0x00); - - /* test bit and next higher and lower bit must be 0 */ - - if((byte = bus_space_read_1(t, h, 0) & 0x38) != 0x00) - { - printf("isic%d: Error, probe-1 failed, 0x%02x should be 0x00 for AVM A1/Fritz!\n", - unit, byte); - bus_space_write_1(t, h, 0, savebyte); - return(ENXIO); - } - - /* write high to test bit */ - - bus_space_write_1(t, h, 0, 0x10); - - /* test bit must be high, next higher and lower bit must be 0 */ - - if((byte = bus_space_read_1(t, h, 0) & 0x38) != 0x10) - { - printf("isic%d: Error, probe-2 failed, 0x%02x should be 0x10 for AVM A1/Fritz!\n", - unit, byte); - bus_space_write_1(t, h, 0, savebyte); - return(ENXIO); - } - return(0); -} - -/*---------------------------------------------------------------------------* - * isic_attach_avma1 - attach AVM A1 and compatibles - *---------------------------------------------------------------------------*/ -int -isic_attach_avma1(device_t dev) -{ - size_t unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - /* reset ISAC/HSCX */ - - bus_space_write_1(t, h, 0, 0x00); - DELAY(SEC_DELAY / 10); - - bus_space_write_1(t, h, 0, AVM_CONF_WR_RESET); - DELAY(SEC_DELAY / 10); - - bus_space_write_1(t, h, 0, 0x00); - DELAY(SEC_DELAY / 10); - - /* setup IRQ */ - - bus_space_write_1(t, h, 1, sc->sc_irq); - DELAY(SEC_DELAY / 10); - - /* enable IRQ, disable counter IRQ */ - - bus_space_write_1(t, h, 0, AVM_CONF_WR_IRQEN | - AVM_CONF_WR_CCH | AVM_CONF_WR_CCL); - DELAY(SEC_DELAY / 10); - - return(0); -} - -#endif /* defined(AVM_A1) */ diff --git a/sys/i4b/layer1/isic/i4b_bchan.c b/sys/i4b/layer1/isic/i4b_bchan.c deleted file mode 100644 index 5dbffca2ac62..000000000000 --- a/sys/i4b/layer1/isic/i4b_bchan.c +++ /dev/null @@ -1,398 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_bchan.c - B channel handling L1 procedures - * ---------------------------------------------- - * last edit-date: [Sat Mar 9 16:00:56 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -#include -#include - -static void isic_bchannel_start(int unit, int h_chan); -static void isic_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp); - -/*---------------------------------------------------------------------------* - * initialize one B channels rx/tx data structures and init/deinit HSCX - *---------------------------------------------------------------------------*/ -void -isic_bchannel_setup(int unit, int h_chan, int bprot, int activate) -{ - struct l1_softc *sc = &l1_sc[unit]; - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - int s = SPLI4B(); - - if(activate == 0) - { - /* deactivation */ - isic_hscx_init(sc, h_chan, activate); - } - - NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", - sc->sc_unit, h_chan, activate ? "activate" : "deactivate"); - - /* general part */ - - chan->unit = sc->sc_unit; /* unit number */ - chan->channel = h_chan; /* B channel */ - chan->bprot = bprot; /* B channel protocol */ - chan->state = HSCX_IDLE; /* B channel state */ - - /* receiver part */ - - chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; - - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_isic_rx", NULL, MTX_DEF); - - i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ - - chan->rxcount = 0; /* reset rx counter */ - - i4b_Bfreembuf(chan->in_mbuf); /* clean rx mbuf */ - - chan->in_mbuf = NULL; /* reset mbuf ptr */ - chan->in_cbptr = NULL; /* reset mbuf curr ptr */ - chan->in_len = 0; /* reset mbuf data len */ - - /* transmitter part */ - - chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; - - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_isic_tx", NULL, MTX_DEF); - - i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ - - chan->txcount = 0; /* reset tx counter */ - - i4b_Bfreembuf(chan->out_mbuf_head); /* clean tx mbuf */ - - chan->out_mbuf_head = NULL; /* reset head mbuf ptr */ - chan->out_mbuf_cur = NULL; /* reset current mbuf ptr */ - chan->out_mbuf_cur_ptr = NULL; /* reset current mbuf data ptr */ - chan->out_mbuf_cur_len = 0; /* reset current mbuf data cnt */ - - if(activate != 0) - { - /* activation */ - isic_hscx_init(sc, h_chan, activate); - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * start transmission on a b channel - *---------------------------------------------------------------------------*/ -static void -isic_bchannel_start(int unit, int h_chan) -{ - struct l1_softc *sc = &l1_sc[unit]; - register l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - register int next_len; - register int len; - - int s; - int activity = -1; - int cmd = 0; - - s = SPLI4B(); /* enter critical section */ - if(chan->state & HSCX_TX_ACTIVE) /* already running ? */ - { - splx(s); - return; /* yes, leave */ - } - - /* get next mbuf from queue */ - - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) /* queue empty ? */ - { - splx(s); /* leave critical section */ - return; /* yes, exit */ - } - - /* init current mbuf values */ - - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - - /* activity indicator for timeout handling */ - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - - chan->state |= HSCX_TX_ACTIVE; /* we start transmitting */ - - if(sc->sc_trace & TRACE_B_TX) /* if trace, send mbuf to trace dev */ - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - len = 0; /* # of chars put into HSCX tx fifo this time */ - - /* - * fill the HSCX tx fifo with data from the current mbuf. if - * current mbuf holds less data than HSCX fifo length, try to - * get the next mbuf from (a possible) mbuf chain. if there is - * not enough data in a single mbuf or in a chain, then this - * is the last mbuf and we tell the HSCX that it has to send - * CRC and closing flag - */ - - while((len < sc->sc_bfifolen) && chan->out_mbuf_cur) - { - /* - * put as much data into the HSCX fifo as is - * available from the current mbuf - */ - - if((len + chan->out_mbuf_cur_len) >= sc->sc_bfifolen) - next_len = sc->sc_bfifolen - len; - else - next_len = chan->out_mbuf_cur_len; - -#ifdef NOTDEF - printf("b:mh=%x, mc=%x, mcp=%x, mcl=%d l=%d nl=%d # ", - chan->out_mbuf_head, - chan->out_mbuf_cur, - chan->out_mbuf_cur_ptr, - chan->out_mbuf_cur_len, - len, - next_len); -#endif - - /* wait for tx fifo write enabled */ - - isic_hscx_waitxfw(sc, h_chan); - - /* write what we have from current mbuf to HSCX fifo */ - - HSCX_WRFIFO(h_chan, chan->out_mbuf_cur_ptr, next_len); - - len += next_len; /* update # of bytes written */ - chan->txcount += next_len; /* statistics */ - chan->out_mbuf_cur_ptr += next_len; /* data ptr */ - chan->out_mbuf_cur_len -= next_len; /* data len */ - - /* - * in case the current mbuf (of a possible chain) data - * has been put into the fifo, check if there is a next - * mbuf in the chain. If there is one, get ptr to it - * and update the data ptr and the length - */ - - if((chan->out_mbuf_cur_len <= 0) && - ((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL)) - { - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - } - } - - /* - * if there is either still data in the current mbuf and/or - * there is a successor on the chain available issue just - * a XTF (transmit) command to HSCX. if ther is no more - * data available from the current mbuf (-chain), issue - * an XTF and an XME (message end) command which will then - * send the CRC and the closing HDLC flag sequence - */ - - if(chan->out_mbuf_cur && (chan->out_mbuf_cur_len > 0)) - { - /* - * more data available, send current fifo out. - * next xfer to HSCX tx fifo is done in the - * HSCX interrupt routine. - */ - - cmd |= HSCX_CMDR_XTF; - } - else - { - /* end of mbuf chain */ - - if(chan->bprot == BPROT_NONE) - cmd |= HSCX_CMDR_XTF; - else - cmd |= HSCX_CMDR_XTF | HSCX_CMDR_XME; - - i4b_Bfreembuf(chan->out_mbuf_head); /* free mbuf chain */ - - chan->out_mbuf_head = NULL; - chan->out_mbuf_cur = NULL; - chan->out_mbuf_cur_ptr = NULL; - chan->out_mbuf_cur_len = 0; - } - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); - - if(cmd) - isic_hscx_cmd(sc, h_chan, cmd); - - splx(s); -} - -/*---------------------------------------------------------------------------* - * fill statistics struct - *---------------------------------------------------------------------------*/ -static void -isic_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) -{ - struct l1_softc *sc = &l1_sc[unit]; - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - - s = SPLI4B(); - - bsp->outbytes = chan->txcount; - bsp->inbytes = chan->rxcount; - - chan->txcount = 0; - chan->rxcount = 0; - - splx(s); -} - -/*---------------------------------------------------------------------------* - * return the address of isic drivers linktab - *---------------------------------------------------------------------------*/ -isdn_link_t * -isic_ret_linktab(int unit, int channel) -{ - struct l1_softc *sc = &l1_sc[unit]; - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - return(&chan->isic_isdn_linktab); -} - -/*---------------------------------------------------------------------------* - * set the driver linktab in the b channel softc - *---------------------------------------------------------------------------*/ -void -isic_set_linktab(int unit, int channel, drvr_link_t *dlt) -{ - struct l1_softc *sc = &l1_sc[unit]; - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - chan->isic_drvr_linktab = dlt; -} - -/*---------------------------------------------------------------------------* - * initialize our local linktab - *---------------------------------------------------------------------------*/ -void -isic_init_linktab(struct l1_softc *sc) -{ - l1_bchan_state_t *chan = &sc->sc_chan[HSCX_CH_A]; - isdn_link_t *lt = &chan->isic_isdn_linktab; - - /* make sure the hardware driver is known to layer 4 */ - ctrl_types[CTRL_PASSIVE].set_linktab = i4b_l1_set_linktab; - ctrl_types[CTRL_PASSIVE].get_linktab = i4b_l1_ret_linktab; - - /* local setup */ - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_A; - lt->bch_config = isic_bchannel_setup; - lt->bch_tx_start = isic_bchannel_start; - lt->bch_stat = isic_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; - - chan = &sc->sc_chan[HSCX_CH_B]; - lt = &chan->isic_isdn_linktab; - - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_B; - lt->bch_config = isic_bchannel_setup; - lt->bch_tx_start = isic_bchannel_start; - lt->bch_stat = isic_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; -} diff --git a/sys/i4b/layer1/isic/i4b_ctx_s0P.c b/sys/i4b/layer1/isic/i4b_ctx_s0P.c deleted file mode 100644 index afa665dd15c6..000000000000 --- a/sys/i4b/layer1/isic/i4b_ctx_s0P.c +++ /dev/null @@ -1,316 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isic - I4B Siemens ISDN Chipset Driver for Creatix/Teles PnP - * ============================================================ - * last edit-date: [Wed Jan 24 09:07:22 2001] - * - * Note: this driver works for the Creatix ISDN S0-16 P+P and - * for the Teles S0/16.3 PnP card. Although they are not - * the same hardware and don't share the same PnP config - * information, once the base addresses are set, the - * offsets are same and therefore they can use the same - * driver. - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if (defined(CRTX_S0_P) || defined(TEL_S0_16_3_P) || defined(COMPAQ_M610)) - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -/*---------------------------------------------------------------------------* - * Creatix / Teles PnP ISAC get fifo routine - *---------------------------------------------------------------------------*/ -static void -ctxs0P_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+2]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+2]); - bus_space_read_multi_1(t,h,0x3e,buf,size); -} - -/*---------------------------------------------------------------------------* - * Creatix / Teles PnP ISAC put fifo routine - *---------------------------------------------------------------------------*/ -static void -ctxs0P_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+2]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+2]); - bus_space_write_multi_1(t,h,0x3e,buf,size); -} - -/*---------------------------------------------------------------------------* - * Creatix / Teles PnP ISAC put register routine - *---------------------------------------------------------------------------*/ -static void -ctxs0P_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+2]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+2]); - bus_space_write_1(t,h,offs,data); -} - -/*---------------------------------------------------------------------------* - * Creatix / Teles PnP ISAC get register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -ctxs0P_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+2]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+2]); - return bus_space_read_1(t,h,offs); -} - -/*---------------------------------------------------------------------------* - * isic_attach_Cs0P - attach Creatix / Teles PnP - *---------------------------------------------------------------------------*/ -int -isic_attach_Cs0P(device_t dev) -{ - u_int32_t iobase1; - u_int32_t iobase2; - u_int32_t iocfg = 0; /* quiet bogus gcc warning */ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - bus_space_tag_t t; - bus_space_handle_t h; - - /* - * this card needs a second io_base, - * free resources if we don't get it - */ - - sc->sc_resources.io_rid[1] = 1; - - if(!(sc->sc_resources.io_base[1] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[1], - RF_ACTIVE))) - { - printf("isic%d: Could not get io area 1 for Creatix / Teles PnP!\n", unit); - isic_detach_common(dev); - return ENXIO; - } - - /* - * Compaq M610 has a cfg io area, - * we need it - */ - - if (sc->sc_cardtyp == CARD_TYPEP_COMPAQ_M610) - { - sc->sc_resources.io_rid[2] = 2; - - if(!(sc->sc_resources.io_base[2] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[2], - RF_ACTIVE))) - { - printf("isic%d: Could not get cfg io area for Compaq Microcom 610\n", unit); - isic_detach_common(dev); - return ENXIO; - } - - iocfg = rman_get_start(sc->sc_resources.io_base[2]); - - bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[2], - sc->sc_resources.io_base[2]); - } - - /* remember the io base addresses */ - - if (sc->sc_cardtyp != CARD_TYPEP_COMPAQ_M610) - { - iobase1 = rman_get_start(sc->sc_resources.io_base[0]); - iobase2 = rman_get_start(sc->sc_resources.io_base[1]); - } - else - { - iobase1 = rman_get_start(sc->sc_resources.io_base[1]); - iobase2 = rman_get_start(sc->sc_resources.io_base[0]); - } - - /* - * because overlapping resources are invalid, - * release the first and second io port resource - */ - - bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - - bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[1], - sc->sc_resources.io_base[1]); - - /* set and allocate a base io address for the ISAC chip */ - - sc->sc_resources.io_rid[2] = 2; - - bus_set_resource(dev, SYS_RES_IOPORT, 2, iobase1-0x20, 0x40); - - if(!(sc->sc_resources.io_base[2] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[2], - RF_ACTIVE))) - { - printf("isic%d: Could not get io area 2 for Creatix / Teles PnP!\n", unit); - isic_detach_common(dev); - return ENXIO; - } - - - /* set and allocate a resource for the HSCX channel A */ - - sc->sc_resources.io_rid[3] = 3; - -/*XXX*/ /* FIXME !!!! - * the width of the resource is too small, there are accesses - * to it with an offset of 0x3e into the next resource. anyway, - * it seems to work and i have no idea how to do 2 resources - * overlapping each other. - */ - -#if 0 - bus_set_resource(dev, SYS_RES_IOPORT, 3, iobase2-0x20, 0x20); -#else - bus_set_resource(dev, SYS_RES_IOPORT, 3, iobase2-0x20, 0x10); -#endif - - if(!(sc->sc_resources.io_base[3] = - bus_alloc_resource_any(dev,SYS_RES_IOPORT, - &sc->sc_resources.io_rid[3], - RF_ACTIVE))) - { - printf("isic%d: Could not get io area 3 for Creatix / Teles PnP!\n", unit); - isic_detach_common(dev); - return ENXIO; - } - - /* set and allocate a resources for the HSCX channel B */ - - sc->sc_resources.io_rid[4] = 4; - - bus_set_resource(dev, SYS_RES_IOPORT, 4, iobase2, 0x40); - - if(!(sc->sc_resources.io_base[4] = - bus_alloc_resource_any(dev,SYS_RES_IOPORT, - &sc->sc_resources.io_rid[4], - RF_ACTIVE))) - { - printf("isic%d: Could not get io area 4 for Creatix / Teles PnP!\n", unit); - isic_detach_common(dev); - return ENXIO; - } - - /* - * set and allocate a resource for the cfg io - * for compaq m610 - */ - - if (sc->sc_cardtyp == CARD_TYPEP_COMPAQ_M610) - { - sc->sc_resources.io_rid[5] = 5; - - bus_set_resource(dev, SYS_RES_IOPORT, 5, iocfg, 0x01); - - if(!(sc->sc_resources.io_base[5] = - bus_alloc_resource_any(dev,SYS_RES_IOPORT, - &sc->sc_resources.io_rid[5], - RF_ACTIVE))) - { - printf("isic%d: Could not get cfg io area for Compaq Microcom 610!\n", unit); - isic_detach_common(dev); - return ENXIO; - } - } - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = ctxs0P_read_reg; - sc->writereg = ctxs0P_write_reg; - - sc->readfifo = ctxs0P_read_fifo; - sc->writefifo = ctxs0P_write_fifo; - - /* setup card type */ - - if (sc->sc_cardtyp != CARD_TYPEP_COMPAQ_M610) - sc->sc_cardtyp = CARD_TYPEP_CS0P; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* enable the card */ - - if (sc->sc_cardtyp != CARD_TYPEP_COMPAQ_M610) - { - t = rman_get_bustag(sc->sc_resources.io_base[2]); - h = rman_get_bushandle(sc->sc_resources.io_base[2]); - - bus_space_write_1(t, h, 0x3c, 0); - DELAY(SEC_DELAY / 10); - - bus_space_write_1(t, h, 0x3c, 1); - DELAY(SEC_DELAY / 10); - } - else - { - t = rman_get_bustag(sc->sc_resources.io_base[5]); - h = rman_get_bushandle(sc->sc_resources.io_base[5]); - - bus_space_write_1(t, h, 0xff, 0); - DELAY(SEC_DELAY / 10); - - bus_space_write_1(t, h, 0x00, 1); - DELAY(SEC_DELAY / 10); - } - - return 0; -} - -#endif /* (defined(CRTX_S0_P) || defined(TEL_S0_16_3_P) || defined(COMPAQ_M610)) */ - diff --git a/sys/i4b/layer1/isic/i4b_diva.c b/sys/i4b/layer1/isic/i4b_diva.c deleted file mode 100644 index c189f1c08cb3..000000000000 --- a/sys/i4b/layer1/isic/i4b_diva.c +++ /dev/null @@ -1,398 +0,0 @@ -/*- - * Copyright (c) 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * Eicon Diehl DIVA 2.0 or 2.02 (ISA PnP) support for isic driver - * -------------------------------------------------------------- - * last edit-date: [Fri Jan 26 13:57:10 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined EICON_DIVA - -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include - -/* offsets from base address */ - -#define DIVA_IPAC_OFF_ALE 0x00 -#define DIVA_IPAC_OFF_RW 0x01 - -#define DIVA_ISAC_OFF_RW 0x02 -#define DIVA_ISAC_OFF_ALE 0x06 - -#define DIVA_HSCX_OFF_RW 0x00 -#define DIVA_HSCX_OFF_ALE 0x04 - -#define DIVA_CTRL_OFF 0x07 -#define DIVA_CTRL_RDIST 0x01 -#define DIVA_CTRL_WRRST 0x08 -#define DIVA_CTRL_WRLDA 0x20 -#define DIVA_CTRL_WRLDB 0x40 -#define DIVA_CTRL_WRICL 0x80 - -/* HSCX channel base offsets */ - -#define DIVA_HSCXA 0x00 -#define DIVA_HSCXB 0x40 - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.02 - *---------------------------------------------------------------------------*/ -static void -diva_ipac_read_fifo(struct l1_softc *sc,int what,void *buf,size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,IPAC_ISAC_OFF); - bus_space_read_multi_1(t,h,DIVA_IPAC_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,IPAC_HSCXA_OFF); - bus_space_read_multi_1(t,h,DIVA_IPAC_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,IPAC_HSCXB_OFF); - bus_space_read_multi_1(t,h,DIVA_IPAC_OFF_RW,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.02 - *---------------------------------------------------------------------------*/ -static void -diva_ipac_write_fifo(struct l1_softc *sc,int what,void *buf,size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,IPAC_ISAC_OFF); - bus_space_write_multi_1(t,h,DIVA_IPAC_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,IPAC_HSCXA_OFF); - bus_space_write_multi_1(t,h,DIVA_IPAC_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,IPAC_HSCXB_OFF); - bus_space_write_multi_1(t,h,DIVA_IPAC_OFF_RW,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.02 - *---------------------------------------------------------------------------*/ -static void -diva_ipac_write_reg(struct l1_softc *sc,int what,bus_size_t reg,u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,reg+IPAC_ISAC_OFF); - bus_space_write_1(t,h,DIVA_IPAC_OFF_RW,data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,reg+IPAC_HSCXA_OFF); - bus_space_write_1(t,h,DIVA_IPAC_OFF_RW,data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,reg+IPAC_HSCXB_OFF); - bus_space_write_1(t,h,DIVA_IPAC_OFF_RW,data); - break; - case ISIC_WHAT_IPAC: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,reg+IPAC_IPAC_OFF); - bus_space_write_1(t,h,DIVA_IPAC_OFF_RW,data); - break; - } -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.02 - *---------------------------------------------------------------------------*/ -static u_int8_t -diva_ipac_read_reg(struct l1_softc *sc,int what,bus_size_t reg) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,reg+IPAC_ISAC_OFF); - return bus_space_read_1(t,h,DIVA_IPAC_OFF_RW); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,reg+IPAC_HSCXA_OFF); - return bus_space_read_1(t,h,DIVA_IPAC_OFF_RW); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,reg+IPAC_HSCXB_OFF); - return bus_space_read_1(t,h,DIVA_IPAC_OFF_RW); - case ISIC_WHAT_IPAC: - bus_space_write_1(t,h,DIVA_IPAC_OFF_ALE,reg+IPAC_IPAC_OFF); - return bus_space_read_1(t,h,DIVA_IPAC_OFF_RW); - default: - return 0; - } -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.02 - *---------------------------------------------------------------------------*/ -int -isic_attach_diva_ipac(device_t dev) -{ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = diva_ipac_read_reg; - sc->writereg = diva_ipac_write_reg; - - sc->readfifo = diva_ipac_read_fifo; - sc->writefifo = diva_ipac_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_DIVA_ISA; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* setup chip type = IPAC */ - - sc->sc_ipac = 1; - sc->sc_bfifolen = IPAC_BFIFO_LEN; - - /* enable hscx/isac irq's */ - - IPAC_WRITE(IPAC_MASK, (IPAC_MASK_INT1 | IPAC_MASK_INT0)); - - IPAC_WRITE(IPAC_ACFG, 0); /* outputs are open drain */ - - IPAC_WRITE(IPAC_AOE, /* aux 5..2 are inputs, 7, 6 outputs */ - (IPAC_AOE_OE5 | IPAC_AOE_OE4 | IPAC_AOE_OE3 | IPAC_AOE_OE2)); - - IPAC_WRITE(IPAC_ATX, 0xff); /* set all output lines high */ - - return(0); -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.0 - *---------------------------------------------------------------------------*/ -static void -diva_read_fifo(struct l1_softc *sc,int what,void *buf,size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,DIVA_ISAC_OFF_ALE,0); - bus_space_read_multi_1(t,h,DIVA_ISAC_OFF_RW,buf,size); - break; - - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,DIVA_HSCX_OFF_ALE,DIVA_HSCXA); - bus_space_read_multi_1(t,h,DIVA_HSCX_OFF_RW,buf,size); - break; - - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,DIVA_HSCX_OFF_ALE,DIVA_HSCXB); - bus_space_read_multi_1(t,h,DIVA_HSCX_OFF_RW,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.0 - *---------------------------------------------------------------------------*/ -static void -diva_write_fifo(struct l1_softc *sc,int what,void *buf,size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,DIVA_ISAC_OFF_ALE,0); - bus_space_write_multi_1(t,h,DIVA_ISAC_OFF_RW,buf,size); - break; - - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,DIVA_HSCX_OFF_ALE,DIVA_HSCXA); - bus_space_write_multi_1(t,h,DIVA_HSCX_OFF_RW,buf,size); - break; - - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,DIVA_HSCX_OFF_ALE,DIVA_HSCXB); - bus_space_write_multi_1(t,h,DIVA_HSCX_OFF_RW,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.0 - *---------------------------------------------------------------------------*/ -static void -diva_write_reg(struct l1_softc *sc,int what,bus_size_t reg,u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,DIVA_ISAC_OFF_ALE,reg); - bus_space_write_1(t,h,DIVA_ISAC_OFF_RW,data); - break; - - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,DIVA_HSCX_OFF_ALE,reg+DIVA_HSCXA); - bus_space_write_1(t,h,DIVA_HSCX_OFF_RW,data); - break; - - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,DIVA_HSCX_OFF_ALE,reg+DIVA_HSCXB); - bus_space_write_1(t,h,DIVA_HSCX_OFF_RW,data); - break; - } -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.0 - *---------------------------------------------------------------------------*/ -static u_int8_t -diva_read_reg(struct l1_softc *sc,int what,bus_size_t reg) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,DIVA_ISAC_OFF_ALE,reg); - return bus_space_read_1(t,h,DIVA_ISAC_OFF_RW); - - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,DIVA_HSCX_OFF_ALE,reg+DIVA_HSCXA); - return bus_space_read_1(t,h,DIVA_HSCX_OFF_RW); - - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,DIVA_HSCX_OFF_ALE,reg+DIVA_HSCXB); - return bus_space_read_1(t,h,DIVA_HSCX_OFF_RW); - - default: - return 0; - } -} - -/*---------------------------------------------------------------------------* - * Eicon Diehl DIVA 2.0 - *---------------------------------------------------------------------------*/ -int -isic_attach_diva(device_t dev) -{ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = diva_read_reg; - sc->writereg = diva_write_reg; - - sc->readfifo = diva_read_fifo; - sc->writefifo = diva_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_DIVA_ISA; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* setup chip type = ISAC/HSCX */ - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* Read HSCX A/B VSTR. Expected value is 0x05 (V2.1). */ - - if( ((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) || - ((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) ) - { - printf("isic%d: HSCX VSTR test failed for Eicon DIVA 2.0\n", - sc->sc_unit); - printf("isic%d: HSC0: VSTR: %#x\n", - sc->sc_unit, HSCX_READ(0, H_VSTR)); - printf("isic%d: HSC1: VSTR: %#x\n", - sc->sc_unit, HSCX_READ(1, H_VSTR)); - return ENXIO; - } - /* reset on */ - bus_space_write_1(t,h,DIVA_CTRL_OFF,0); - DELAY(100); - /* reset off */ - bus_space_write_1(t,h,DIVA_CTRL_OFF,DIVA_CTRL_WRRST); - return(0); -} - -#endif /* defined EICON_DIVA */ diff --git a/sys/i4b/layer1/isic/i4b_drn_ngo.c b/sys/i4b/layer1/isic/i4b_drn_ngo.c deleted file mode 100644 index 8a1764ce8052..000000000000 --- a/sys/i4b/layer1/isic/i4b_drn_ngo.c +++ /dev/null @@ -1,260 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_drn_ngo.c - Dr. Neuhaus Niccy GO@ and SAGEM Cybermod - * -------------------------------------------------------- - * last edit-date: [Wed Jan 24 09:07:44 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(DRN_NGO) - -#include -#include -#include -#include - -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * Niccy GO@ definitions - * - * the card uses 2 i/o addressranges each using 2 bytes - * - * addressrange 0: - * offset 0 - ISAC dataregister - * offset 1 - HSCX dataregister - * addressrange 1: - * offset 0 - ISAC addressregister - * offset 1 - HSCX addressregister - * - * to access an ISAC/HSCX register, you have to write the register - * number into the ISAC or HSCX addressregister and then read/write - * data for the ISAC/HSCX register into/from the corresponding - * dataregister. - * - * Thanks to Klaus Muehle of Dr. Neuhaus Telekommunikation for giving - * out this information! - * - *---------------------------------------------------------------------------*/ -#define NICCY_PORT_MIN 0x200 -#define NICCY_PORT_MAX 0x3e0 - -#define HSCX_ABIT 0x1000 /* flag, HSCX A is meant */ -#define HSCX_BBIT 0x2000 /* flag, HSCX B is meant */ - -#define HSCX_BOFF 0x40 - -#define ADDR_OFF 2 /* address register range offset */ - -#define ISAC_DATA 0 -#define HSCX_DATA 1 - -#define ISAC_ADDR 0 -#define HSCX_ADDR 1 - -/*---------------------------------------------------------------------------* - * Dr. Neuhaus Niccy GO@ read fifo routine - *---------------------------------------------------------------------------*/ -static void -drnngo_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t tdata, tadr; - bus_space_handle_t hdata, hadr; - - tdata = rman_get_bustag(sc->sc_resources.io_base[0]); - hdata = rman_get_bushandle(sc->sc_resources.io_base[0]); - tadr = rman_get_bustag(sc->sc_resources.io_base[1]); - hadr = rman_get_bushandle(sc->sc_resources.io_base[1]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1 (tadr ,hadr, ISAC_ADDR,0x0); - bus_space_read_multi_1(tdata,hdata,ISAC_DATA,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1 (tadr ,hadr ,HSCX_ADDR,0x0); - bus_space_read_multi_1(tdata,hdata,HSCX_DATA,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1 (tadr ,hadr ,HSCX_ADDR,HSCX_BOFF); - bus_space_read_multi_1(tdata,hdata,HSCX_DATA,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Dr. Neuhaus Niccy GO@ write fifo routine - *---------------------------------------------------------------------------*/ -static void -drnngo_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t tdata, tadr; - bus_space_handle_t hdata, hadr; - - tdata = rman_get_bustag(sc->sc_resources.io_base[0]); - hdata = rman_get_bushandle(sc->sc_resources.io_base[0]); - tadr = rman_get_bustag(sc->sc_resources.io_base[1]); - hadr = rman_get_bushandle(sc->sc_resources.io_base[1]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1 (tadr ,hadr, ISAC_ADDR,0x0); - bus_space_write_multi_1(tdata,hdata,ISAC_DATA,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1 (tadr ,hadr ,HSCX_ADDR,0x0); - bus_space_write_multi_1(tdata,hdata,HSCX_DATA,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1 (tadr ,hadr ,HSCX_ADDR,HSCX_BOFF); - bus_space_write_multi_1(tdata,hdata,HSCX_DATA,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Dr. Neuhaus Niccy GO@ write register routine - *---------------------------------------------------------------------------*/ -static void -drnngo_write_reg(struct l1_softc *sc, int what, bus_size_t reg, u_int8_t data) -{ - bus_space_tag_t tdata, tadr; - bus_space_handle_t hdata, hadr; - - tdata = rman_get_bustag(sc->sc_resources.io_base[0]); - hdata = rman_get_bushandle(sc->sc_resources.io_base[0]); - tadr = rman_get_bustag(sc->sc_resources.io_base[1]); - hadr = rman_get_bushandle(sc->sc_resources.io_base[1]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(tadr ,hadr, ISAC_ADDR,reg); - bus_space_write_1(tdata,hdata,ISAC_DATA,data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(tadr ,hadr ,HSCX_ADDR,reg); - bus_space_write_1(tdata,hdata,HSCX_DATA,data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(tadr ,hadr ,HSCX_ADDR,reg+HSCX_BOFF); - bus_space_write_1(tdata,hdata,HSCX_DATA,data); - break; - } -} - -/*---------------------------------------------------------------------------* - * Dr. Neuhaus Niccy GO@ read register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -drnngo_read_reg(struct l1_softc *sc, int what, bus_size_t reg) -{ - bus_space_tag_t tdata, tadr; - bus_space_handle_t hdata, hadr; - - tdata = rman_get_bustag(sc->sc_resources.io_base[0]); - hdata = rman_get_bushandle(sc->sc_resources.io_base[0]); - tadr = rman_get_bustag(sc->sc_resources.io_base[1]); - hadr = rman_get_bushandle(sc->sc_resources.io_base[1]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(tadr ,hadr, ISAC_ADDR,reg); - return bus_space_read_1(tdata,hdata,ISAC_DATA); - case ISIC_WHAT_HSCXA: - bus_space_write_1(tadr ,hadr ,HSCX_ADDR,reg); - return bus_space_read_1(tdata,hdata,HSCX_DATA); - case ISIC_WHAT_HSCXB: - bus_space_write_1(tadr ,hadr ,HSCX_ADDR,reg+HSCX_BOFF); - return bus_space_read_1(tdata,hdata,HSCX_DATA); - default: - return 0; - } -} - -/*---------------------------------------------------------------------------* - * probe for ISA PnP cards - *---------------------------------------------------------------------------*/ -int -isic_attach_drnngo(device_t dev) -{ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - - sc->sc_resources.io_rid[1] = 1; - - /* - * this card needs a second io_base, - * free resources if we don't get it - */ - - if(!(sc->sc_resources.io_base[1] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[1], - RF_ACTIVE))) - { - printf("isic%d: Failed to get second io base.\n", unit); - isic_detach_common(dev); - return ENXIO; - } - - /* setup ISAC access routines */ - - sc->clearirq = NULL; - sc->readreg = drnngo_read_reg; - sc->writereg = drnngo_write_reg; - - sc->readfifo = drnngo_read_fifo; - sc->writefifo = drnngo_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_DRNNGO; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - return (0); -} - -#endif /* defined(DRN_NGO) */ diff --git a/sys/i4b/layer1/isic/i4b_dynalink.c b/sys/i4b/layer1/isic/i4b_dynalink.c deleted file mode 100644 index 798e8755f407..000000000000 --- a/sys/i4b/layer1/isic/i4b_dynalink.c +++ /dev/null @@ -1,233 +0,0 @@ -/*- - * Copyright (c) 1998 Martijn Plak. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isdn4bsd layer1 driver for Dynalink IS64PH isdn TA - * ================================================== - * last edit-date: [Wed Jan 24 09:08:03 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -/* NOTES: - - This driver was written for the Dynalink IS64PH ISDN TA, based on two - Siemens chips (HSCX 21525 and ISAC 2186). It is sold in the Netherlands. - - model numbers found on (my) card: - IS64PH, TAS100H-N, P/N:89590555, TA200S100045521 - - chips: - Siemens PSB 21525N, HSCX TE V2.1 - Siemens PSB 2186N, ISAC-S TE V1.1 - 95MS14, PNP - - plug-and-play info: - device id "ASU1688" - vendor id 0x88167506 - serial 0x00000044 - i/o port 4 byte alignment, 4 bytes requested, - 10 bit i/o decoding, 0x100-0x3f8 (?) - irq 3,4,5,9,10,11,12,15, high true, edge sensitive - - At the moment I'm writing this Dynalink is replacing this card with - one based on a single Siemens chip (IPAC). It will apparently be sold - under the same model name. - - This driver might also work for Asuscom cards. -*/ - -#include "opt_i4b.h" - -#if defined(DYNALINK) - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -/* io address mapping */ -#define ISAC 0 -#define HSCX 1 -#define ADDR 2 - -/* ADDR bits */ -#define ADDRMASK 0x7F -#define RESET 0x80 - -/* HSCX register offsets */ -#define HSCXA 0x00 -#define HSCXB 0x40 - -/* LOW-LEVEL DEVICE ACCESS -*/ - -static void -dynalink_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ADDR, 0); - bus_space_read_multi_1(t, h, ISAC, buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ADDR, HSCXA); - bus_space_read_multi_1(t, h, HSCX, buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ADDR, HSCXB); - bus_space_read_multi_1(t, h, HSCX, buf, size); - break; - } -} - -static void -dynalink_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ADDR, 0); - bus_space_write_multi_1(t, h, ISAC, (u_int8_t*)buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ADDR, HSCXA); - bus_space_write_multi_1(t, h, HSCX, (u_int8_t*)buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ADDR, HSCXB); - bus_space_write_multi_1(t, h, HSCX, (u_int8_t*)buf, size); - break; - } -} - -static void -dynalink_write_reg(struct l1_softc *sc, int what, bus_size_t reg, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ADDR, reg); - bus_space_write_1(t, h, ISAC, data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ADDR, HSCXA+reg); - bus_space_write_1(t, h, HSCX, data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ADDR, HSCXB+reg); - bus_space_write_1(t, h, HSCX, data); - break; - } -} - -static u_int8_t -dynalink_read_reg(struct l1_softc *sc, int what, bus_size_t reg) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ADDR, reg); - return bus_space_read_1(t, h, ISAC); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ADDR, HSCXA+reg); - return bus_space_read_1(t, h, HSCX); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ADDR, HSCXB+reg); - return bus_space_read_1(t, h, HSCX); - } - return 0; -} - -/* attach callback routine */ -int -isic_attach_Dyn(device_t dev) -{ - int unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = &l1_sc[unit]; /* pointer to softc */ - - struct i4b_info * info = &(sc->sc_resources); - bus_space_tag_t t = rman_get_bustag(info->io_base[0]); - bus_space_handle_t h = rman_get_bushandle(info->io_base[0]); - - /* fill in l1_softc structure */ - sc->readreg = dynalink_read_reg; - sc->writereg = dynalink_write_reg; - sc->readfifo = dynalink_read_fifo; - sc->writefifo = dynalink_write_fifo; - sc->clearirq = NULL; - sc->sc_cardtyp = CARD_TYPEP_DYNALINK; - sc->sc_bustyp = BUS_TYPE_IOM2; - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* Read HSCX A/B VSTR. Expected value is 0x05 (V2.1). */ - if( ((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) || - ((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) ) - { - printf("isic%d: HSCX VSTR test failed for Dynalink\n", - sc->sc_unit); - printf("isic%d: HSC0: VSTR: %#x\n", - sc->sc_unit, HSCX_READ(0, H_VSTR)); - printf("isic%d: HSC1: VSTR: %#x\n", - sc->sc_unit, HSCX_READ(1, H_VSTR)); - return ENXIO; - } - - /* reset card */ - bus_space_write_1(t,h,ADDR,RESET); - DELAY(SEC_DELAY / 10); - bus_space_write_1(t,h,ADDR,0); - DELAY(SEC_DELAY / 10); - - return 0; -} - -#endif /* defined(DYNALINK) */ diff --git a/sys/i4b/layer1/isic/i4b_elsa_pcc16.c b/sys/i4b/layer1/isic/i4b_elsa_pcc16.c deleted file mode 100644 index 359d2397eaa5..000000000000 --- a/sys/i4b/layer1/isic/i4b_elsa_pcc16.c +++ /dev/null @@ -1,391 +0,0 @@ -/*- - * Copyright (c) 1999, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isic - I4B driver for ELSA MicroLink ISDN/PCC-16 and ELSA PCFpro - * ================================================================ - * last edit-date: [Sun Oct 21 09:42:17 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(ELSA_PCC16) - -#include -#include -#include -#include - -#include - -#include -#include - -static void i4b_epcc16_clrirq(struct l1_softc *sc); - -/* masks for register encoded in base addr */ - -#define ELSA_BASE_MASK 0x0ffff -#define ELSA_OFF_MASK 0xf0000 - -/* register id's to be encoded in base addr */ - -#define ELSA_IDISAC 0x00000 -#define ELSA_IDHSCXA 0x10000 -#define ELSA_IDHSCXB 0x20000 - -/* offsets from base address */ - -#define ELSA_OFF_ISAC 0x00 -#define ELSA_OFF_HSCX 0x02 -#define ELSA_OFF_OFF 0x03 -#define ELSA_OFF_CTRL 0x04 -#define ELSA_OFF_CFG 0x05 -#define ELSA_OFF_TIMR 0x06 -#define ELSA_OFF_IRQ 0x07 - -/* control register (write access) */ - -#define ELSA_CTRL_LED_YELLOW 0x02 -#define ELSA_CTRL_LED_GREEN 0x08 -#define ELSA_CTRL_RESET 0x20 -#define ELSA_CTRL_TIMEREN 0x80 -#define ELSA_CTRL_SECRET 0x50 - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCC-16 clear IRQ routine - *---------------------------------------------------------------------------*/ -static void -i4b_epcc16_clrirq(struct l1_softc *sc) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_write_1(t, h, ELSA_OFF_IRQ, 0); -} - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCC-16 ISAC get fifo routine - *---------------------------------------------------------------------------*/ -static void -epcc16_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0); - bus_space_read_multi_1(t, h, ELSA_OFF_ISAC, buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0); - bus_space_read_multi_1(t, h, ELSA_OFF_HSCX, buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0x40); - bus_space_read_multi_1(t, h, ELSA_OFF_HSCX, buf, size); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCC-16 ISAC put fifo routine - *---------------------------------------------------------------------------*/ -static void -epcc16_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0); - bus_space_write_multi_1(t, h, ELSA_OFF_ISAC, buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0); - bus_space_write_multi_1(t, h, ELSA_OFF_HSCX, buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0x40); - bus_space_write_multi_1(t, h, ELSA_OFF_HSCX, buf, size); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCC-16 ISAC put register routine - *---------------------------------------------------------------------------*/ -static void -epcc16_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_OFF, offs); - bus_space_write_1(t, h, ELSA_OFF_ISAC, data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_OFF, offs); - bus_space_write_1(t, h, ELSA_OFF_HSCX, data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0x40+offs); - bus_space_write_1(t, h, ELSA_OFF_HSCX, data); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCC-16 ISAC get register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -epcc16_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_OFF, offs); - return bus_space_read_1(t, h, ELSA_OFF_ISAC); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_OFF, offs); - return bus_space_read_1(t, h, ELSA_OFF_HSCX); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0x40+offs); - return bus_space_read_1(t, h, ELSA_OFF_HSCX); - } - return 0; -} - -/*---------------------------------------------------------------------------* - * isic_detach_Epcc16 - detach for ELSA MicroLink ISDN/PCC-16 - *---------------------------------------------------------------------------*/ -static void -isic_detach_Epcc16(device_t dev) -{ - struct l1_softc *sc = &l1_sc[device_get_unit(dev)]; - - if ( sc->sc_resources.irq ) - { - bus_teardown_intr(dev,sc->sc_resources.irq, - (void(*)(void *))isicintr); - bus_release_resource(dev,SYS_RES_IRQ, - sc->sc_resources.irq_rid, - sc->sc_resources.irq); - sc->sc_resources.irq = 0; - } - - if ( sc->sc_resources.io_base[0] ) { - bus_release_resource(dev,SYS_RES_IOPORT, - sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - sc->sc_resources.io_base[0] = 0; - } -} - -/*---------------------------------------------------------------------------* - * isic_probe_Epcc16 - probe for ELSA MicroLink ISDN/PCC-16 - *---------------------------------------------------------------------------*/ -int -isic_probe_Epcc16(device_t dev) -{ - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = 0; /* pointer to softc */ - void *ih = 0; /* dummy */ - - /* check max unit range */ - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for ELSA PCC-16!\n", - unit, unit); - return(ENXIO); - } - - sc = &l1_sc[unit]; /* get pointer to softc */ - sc->sc_unit = unit; /* set unit */ - - /* see if an io base was supplied */ - - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - printf("isic%d: Could not get iobase for ELSA PCC-16.\n", - unit); - return(ENXIO); - } - - /* check if we got an iobase */ - - sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]); - - switch(sc->sc_port) - { - case 0x160: - case 0x170: - case 0x260: - case 0x360: - break; - default: - printf("isic%d: Error, invalid iobase 0x%x specified for ELSA MicroLink ISDN/PCC-16!\n", - unit, sc->sc_port); - isic_detach_Epcc16(dev); - return(ENXIO); - break; - } - - /* setup access routines */ - - sc->clearirq = i4b_epcc16_clrirq; - sc->readreg = epcc16_read_reg; - sc->writereg = epcc16_write_reg; - - sc->readfifo = epcc16_read_fifo; - sc->writefifo = epcc16_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_PCC16; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* - * Read HSCX A/B VSTR. Expected value for the ELSA PCC-16 - * is 0x05 ( = version 2.1 ) in the least significant bits. - */ - - if( ((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) || - ((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) ) - { - /* patch from "Doobee R . Tzeck" : - * I own an ELSA PCFpro. To my knowledge, the ELSA PCC16 is - * a stripped down Version on the PCFpro. By patching the - * card detection routine for the PPC16 I was able to use - * the PPC16 driver for the PCFpro. - */ - if( ((HSCX_READ(0, H_VSTR) & 0xf) != 0x85) || - ((HSCX_READ(1, H_VSTR) & 0xf) != 0x85) ) - { - printf("isic%d: HSCX VSTR test failed for ELSA MicroLink ISDN/PCC-16\n", - unit); - isic_detach_Epcc16(dev); - printf("isic%d: HSC0: VSTR: %#x\n", - unit, HSCX_READ(0, H_VSTR)); - printf("isic%d: HSC1: VSTR: %#x\n", - unit, HSCX_READ(1, H_VSTR)); - return (ENXIO); - } - else - { - printf("isic%d: ELSA MicroLink ISDN/PCFpro found, going to tread it as PCC-16\n", - unit); - } - } - - /* get our irq */ - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE))) - { - printf("isic%d: Could not get an irq.\n",unit); - isic_detach_Epcc16(dev); - return ENXIO; - } - - /* get the irq number */ - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - /* check IRQ validity */ - switch(sc->sc_irq) - { - case 2: - case 9: - case 3: - case 5: - case 10: - case 11: - case 15: - break; - - default: - printf("isic%d: Error, invalid IRQ [%d] specified for ELSA MicroLink ISDN/PCC-16!\n", - unit, sc->sc_irq); - isic_detach_Epcc16(dev); - return(ENXIO); - break; - } - - /* register interrupt routine */ - bus_setup_intr(dev,sc->sc_resources.irq,INTR_TYPE_NET, - NULL, (void(*)(void *))(isicintr), - sc,&ih); - - - return (0); -} - -/*---------------------------------------------------------------------------* - * isic_attach_Epcc16 - attach for ELSA MicroLink ISDN/PCC-16 - *---------------------------------------------------------------------------*/ -int -isic_attach_Epcc16(device_t dev) -{ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - u_char byte = ELSA_CTRL_SECRET; - - byte &= ~ELSA_CTRL_RESET; - bus_space_write_1(t, h, ELSA_OFF_CTRL, byte); - DELAY(20); - byte |= ELSA_CTRL_RESET; - bus_space_write_1(t, h, ELSA_OFF_CTRL, byte); - - DELAY(20); - bus_space_write_1(t, h, ELSA_OFF_IRQ, 0xff); - - return 0; -} - -#endif /* defined(ELSA_PCC16) */ diff --git a/sys/i4b/layer1/isic/i4b_elsa_qs1i.c b/sys/i4b/layer1/isic/i4b_elsa_qs1i.c deleted file mode 100644 index d17cdfd1defd..000000000000 --- a/sys/i4b/layer1/isic/i4b_elsa_qs1i.c +++ /dev/null @@ -1,237 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isic - I4B Siemens ISDN Chipset Driver for ELSA Quickstep 1000pro ISA - * ===================================================================== - * last edit-date: [Wed Jan 24 09:09:03 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(ELSA_QS1ISA) - -#include -#include -#include -#include - -#include - -#include -#include - -static void i4b_eq1i_clrirq(struct l1_softc *sc); - -/* masks for register encoded in base addr */ - -#define ELSA_BASE_MASK 0x0ffff -#define ELSA_OFF_MASK 0xf0000 - -/* register id's to be encoded in base addr */ - -#define ELSA_IDISAC 0x00000 -#define ELSA_IDHSCXA 0x10000 -#define ELSA_IDHSCXB 0x20000 - -/* offsets from base address */ - -#define ELSA_OFF_ISAC 0x00 -#define ELSA_OFF_HSCX 0x02 -#define ELSA_OFF_OFF 0x03 -#define ELSA_OFF_CTRL 0x04 -#define ELSA_OFF_CFG 0x05 -#define ELSA_OFF_TIMR 0x06 -#define ELSA_OFF_IRQ 0x07 - -/* control register (write access) */ - -#define ELSA_CTRL_LED_YELLOW 0x02 -#define ELSA_CTRL_LED_GREEN 0x08 -#define ELSA_CTRL_RESET 0x20 -#define ELSA_CTRL_TIMEREN 0x80 -#define ELSA_CTRL_SECRET 0x50 - -/*---------------------------------------------------------------------------* - * ELSA QuickStep 1000pro/ISA clear IRQ routine - *---------------------------------------------------------------------------*/ -static void -i4b_eq1i_clrirq(struct l1_softc *sc) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - bus_space_write_1(t, h, ELSA_OFF_IRQ, 0); -} - -/*---------------------------------------------------------------------------* - * ELSA QuickStep 1000pro/ISA ISAC get fifo routine - *---------------------------------------------------------------------------*/ -static void -eqs1pi_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0); - bus_space_read_multi_1(t, h, ELSA_OFF_ISAC, buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0); - bus_space_read_multi_1(t, h, ELSA_OFF_HSCX, buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0x40); - bus_space_read_multi_1(t, h, ELSA_OFF_HSCX, buf, size); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA QuickStep 1000pro/ISA ISAC put fifo routine - *---------------------------------------------------------------------------*/ -static void -eqs1pi_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0); - bus_space_write_multi_1(t, h, ELSA_OFF_ISAC, buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0); - bus_space_write_multi_1(t, h, ELSA_OFF_HSCX, buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0x40); - bus_space_write_multi_1(t, h, ELSA_OFF_HSCX, buf, size); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA QuickStep 1000pro/ISA ISAC put register routine - *---------------------------------------------------------------------------*/ -static void -eqs1pi_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_OFF, offs); - bus_space_write_1(t, h, ELSA_OFF_ISAC, data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_OFF, offs); - bus_space_write_1(t, h, ELSA_OFF_HSCX, data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0x40+offs); - bus_space_write_1(t, h, ELSA_OFF_HSCX, data); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA QuickStep 1000pro/ISA ISAC get register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -eqs1pi_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch (what) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_OFF, offs); - return bus_space_read_1(t, h, ELSA_OFF_ISAC); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_OFF, offs); - return bus_space_read_1(t, h, ELSA_OFF_HSCX); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_OFF, 0x40+offs); - return bus_space_read_1(t, h, ELSA_OFF_HSCX); - } - return 0; -} - -/*---------------------------------------------------------------------------* - * isic_attach_Eqs1pi - attach for ELSA QuickStep 1000pro/ISA - *---------------------------------------------------------------------------*/ -int -isic_attach_Eqs1pi(device_t dev) -{ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - u_char byte = ELSA_CTRL_SECRET; - - /* setup access routines */ - - sc->clearirq = i4b_eq1i_clrirq; - sc->readreg = eqs1pi_read_reg; - sc->writereg = eqs1pi_write_reg; - - sc->readfifo = eqs1pi_read_fifo; - sc->writefifo = eqs1pi_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_ELSAQS1ISA; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* enable the card */ - - byte &= ~ELSA_CTRL_RESET; - bus_space_write_1(t, h, ELSA_OFF_CTRL, byte); - DELAY(20); - byte |= ELSA_CTRL_RESET; - bus_space_write_1(t, h, ELSA_OFF_CTRL, byte); - - DELAY(20); - bus_space_write_1(t, h, ELSA_OFF_IRQ, 0xff); - - return 0; -} -#endif /* defined(ELSA_QS1ISA) */ diff --git a/sys/i4b/layer1/isic/i4b_elsa_qs1p.c b/sys/i4b/layer1/isic/i4b_elsa_qs1p.c deleted file mode 100644 index 6a929221cb2a..000000000000 --- a/sys/i4b/layer1/isic/i4b_elsa_qs1p.c +++ /dev/null @@ -1,353 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isic - I4B Siemens ISDN Chipset Driver for ELSA MicroLink ISDN/PCI - * ================================================================== - * last edit-date: [Wed Jan 24 09:09:28 2001] - * - * Note: ELSA Quickstep 1000pro PCI = ELSA MicroLink ISDN/PCI - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(ELSA_QS1PCI) - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -#define MEM0_BAR 0 -#define PORT0_BAR 1 -#define PORT1_BAR 3 - -#define ELSA_PORT0_MAPOFF PCIR_BAR(PORT0_BAR) -#define ELSA_PORT1_MAPOFF PCIR_BAR(PORT1_BAR) - -#define PCI_QS1000_DID 0x1000 -#define PCI_QS1000_VID 0x1048 - -/* masks for register encoded in base addr */ - -#define ELSA_BASE_MASK 0x0ffff -#define ELSA_OFF_MASK 0xf0000 - -/* register id's to be encoded in base addr */ - -#define ELSA_IDISAC 0x00000 -#define ELSA_IDHSCXA 0x10000 -#define ELSA_IDHSCXB 0x20000 -#define ELSA_IDIPAC 0x40000 - -/* offsets from base address */ - -#define ELSA_OFF_ALE 0x00 -#define ELSA_OFF_RW 0x01 - - -static int eqs1p_pci_probe(device_t dev); -static int eqs1p_pci_attach(device_t dev); - -static device_method_t eqs1p_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, eqs1p_pci_probe), - DEVMETHOD(device_attach, eqs1p_pci_attach), - { 0, 0 } -}; - -static driver_t eqs1p_pci_driver = { - "isic", - eqs1p_pci_methods, - 0 -}; - -static devclass_t eqs1p_pci_devclass; - -DRIVER_MODULE(eqs1p, pci, eqs1p_pci_driver, eqs1p_pci_devclass, 0, 0); - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCI fifo read routine - *---------------------------------------------------------------------------*/ -static void -eqs1pp_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[1]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_ISAC_OFF); - bus_space_read_multi_1(t, h, ELSA_OFF_RW, buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_HSCXA_OFF); - bus_space_read_multi_1(t, h, ELSA_OFF_RW, buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_HSCXB_OFF); - bus_space_read_multi_1(t, h, ELSA_OFF_RW, buf, size); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCI fifo write routine - *---------------------------------------------------------------------------*/ -static void -eqs1pp_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[1]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_ISAC_OFF); - bus_space_write_multi_1(t, h, ELSA_OFF_RW, (u_int8_t*)buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_HSCXA_OFF); - bus_space_write_multi_1(t, h, ELSA_OFF_RW, (u_int8_t*)buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_HSCXB_OFF); - bus_space_write_multi_1(t, h, ELSA_OFF_RW, (u_int8_t*)buf, size); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCI register write routine - *---------------------------------------------------------------------------*/ -static void -eqs1pp_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[1]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_ISAC_OFF+offs); - bus_space_write_1(t, h, ELSA_OFF_RW, data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_HSCXA_OFF+offs); - bus_space_write_1(t, h, ELSA_OFF_RW, data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_HSCXB_OFF+offs); - bus_space_write_1(t, h, ELSA_OFF_RW, data); - break; - case ISIC_WHAT_IPAC: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_IPAC_OFF+offs); - bus_space_write_1(t, h, ELSA_OFF_RW, data); - break; - } -} - -/*---------------------------------------------------------------------------* - * ELSA MicroLink ISDN/PCI register read routine - *---------------------------------------------------------------------------*/ -static u_int8_t -eqs1pp_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[1]); - - switch(what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_ISAC_OFF+offs); - return bus_space_read_1(t, h, ELSA_OFF_RW); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_HSCXA_OFF+offs); - return bus_space_read_1(t, h, ELSA_OFF_RW); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_HSCXB_OFF+offs); - return bus_space_read_1(t, h, ELSA_OFF_RW); - case ISIC_WHAT_IPAC: - bus_space_write_1(t, h, ELSA_OFF_ALE, IPAC_IPAC_OFF+offs); - return bus_space_read_1(t, h, ELSA_OFF_RW); - } - return 0; -} - -/*---------------------------------------------------------------------------* - * avma1pp_probe - probe for a card - *---------------------------------------------------------------------------*/ -static int -eqs1p_pci_probe(device_t dev) -{ - if((pci_get_vendor(dev) == PCI_QS1000_VID) && - (pci_get_device(dev) == PCI_QS1000_DID)) - { - device_set_desc(dev, "ELSA MicroLink ISDN/PCI"); - return(0); - } - return(ENXIO); -} - -/*---------------------------------------------------------------------------* - * isic_attach_Eqs1pp - attach for ELSA MicroLink ISDN/PCI - *---------------------------------------------------------------------------*/ -static int -eqs1p_pci_attach(device_t dev) -{ - bus_space_tag_t t; - bus_space_handle_t h; - struct l1_softc *sc; - void *ih = 0; - int unit = device_get_unit(dev); - - /* check max unit range */ - - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for ELSA MicroLink ISDN/PCI!\n", - unit, unit); - return(ENXIO); - } - - sc = &l1_sc[unit]; /* get softc */ - - sc->sc_unit = unit; - - /* get io_base */ - - sc->sc_resources.io_rid[0] = ELSA_PORT0_MAPOFF; - - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - printf("isic%d: Couldn't get first iobase for ELSA MicroLink ISDN/PCI!\n", unit); - return(ENXIO); - } - - sc->sc_resources.io_rid[1] = ELSA_PORT1_MAPOFF; - - if(!(sc->sc_resources.io_base[1] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[1], - RF_ACTIVE))) - { - printf("isic%d: Couldn't get second iobase for ELSA MicroLink ISDN/PCI!\n", unit); - isic_detach_common(dev); - return(ENXIO); - } - - sc->sc_port = rman_get_start(sc->sc_resources.io_base[1]); - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE | RF_SHAREABLE))) - { - printf("isic%d: Could not get irq for ELSA MicroLink ISDN/PCI!\n",unit); - isic_detach_common(dev); - return(ENXIO); - } - - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = eqs1pp_read_reg; - sc->writereg = eqs1pp_write_reg; - - sc->readfifo = eqs1pp_read_fifo; - sc->writefifo = eqs1pp_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_ELSAQS1PCI; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* setup chip type = IPAC ! */ - - sc->sc_ipac = 1; - sc->sc_bfifolen = IPAC_BFIFO_LEN; - - if(isic_attach_common(dev)) - { - isic_detach_common(dev); - return(ENXIO); - } - - if(bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, - NULL, (void(*)(void*))isicintr, - sc, &ih)) - { - printf("isic%d: Couldn't set up irq for ELSA MicroLink ISDN/PCI!\n", unit); - isic_detach_common(dev); - return(ENXIO); - } - - /* enable hscx/isac irq's */ - - IPAC_WRITE(IPAC_MASK, (IPAC_MASK_INT1 | IPAC_MASK_INT0)); - - IPAC_WRITE(IPAC_ACFG, 0); /* outputs are open drain */ - IPAC_WRITE(IPAC_AOE, /* aux 5..2 are inputs, 7, 6 outputs */ - (IPAC_AOE_OE5 | IPAC_AOE_OE4 | IPAC_AOE_OE3 | IPAC_AOE_OE2)); - IPAC_WRITE(IPAC_ATX, 0xff); /* set all output lines high */ - - t = rman_get_bustag(sc->sc_resources.io_base[0]); - h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - bus_space_write_1(t, h, 0x4c, 0x41); /* enable card interrupt */ - - return(0); -} - -#endif /* defined(ELSA_QS1PCI) */ diff --git a/sys/i4b/layer1/isic/i4b_hscx.c b/sys/i4b/layer1/isic/i4b_hscx.c deleted file mode 100644 index c947a7a2bf47..000000000000 --- a/sys/i4b/layer1/isic/i4b_hscx.c +++ /dev/null @@ -1,648 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b - Siemens HSCX chip (B-channel) handling - * -------------------------------------------- - * last edit-date: [Sat Mar 9 16:01:49 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * HSCX IRQ Handler - *---------------------------------------------------------------------------*/ -void -isic_hscx_irq(register struct l1_softc *sc, u_char ista, int h_chan, u_char ex_irq) -{ - register l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - u_char exir = 0; - int activity = -1; - u_char cmd = 0; - - NDBGL1(L1_H_IRQ, "%#x", ista); - - if(ex_irq) - { - /* get channel extended irq reg */ - - exir = HSCX_READ(h_chan, H_EXIR); - - if(exir & HSCX_EXIR_RFO) - { - chan->stat_RFO++; - NDBGL1(L1_H_XFRERR, "ex_irq: receive data overflow"); - } - - if((exir & HSCX_EXIR_XDU) && (chan->bprot != BPROT_NONE))/* xmit data underrun */ - { - chan->stat_XDU++; - NDBGL1(L1_H_XFRERR, "ex_irq: xmit data underrun"); - isic_hscx_cmd(sc, h_chan, HSCX_CMDR_XRES); - - if (chan->out_mbuf_head != NULL) /* don't continue to transmit this buffer */ - { - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_cur = chan->out_mbuf_head = NULL; - } - } - - } - - /* rx message end, end of frame */ - - if(ista & HSCX_ISTA_RME) - { - register int fifo_data_len; - u_char rsta; - int error = 0; - - rsta = HSCX_READ(h_chan, H_RSTA); - - if((rsta & 0xf0) != 0xa0) - { - if((rsta & HSCX_RSTA_VFR) == 0) - { - chan->stat_VFR++; - cmd |= (HSCX_CMDR_RHR); - NDBGL1(L1_H_XFRERR, "received invalid Frame"); - error++; - } - - if(rsta & HSCX_RSTA_RDO) - { - chan->stat_RDO++; - NDBGL1(L1_H_XFRERR, "receive data overflow"); - error++; - } - - if((rsta & HSCX_RSTA_CRC) == 0) - { - chan->stat_CRC++; - cmd |= (HSCX_CMDR_RHR); - NDBGL1(L1_H_XFRERR, "CRC check failed"); - error++; - } - - if(rsta & HSCX_RSTA_RAB) - { - chan->stat_RAB++; - NDBGL1(L1_H_XFRERR, "Receive message aborted"); - error++; - } - } - - fifo_data_len = ((HSCX_READ(h_chan, H_RBCL)) & - ((sc->sc_bfifolen)-1)); - - if(fifo_data_len == 0) - fifo_data_len = sc->sc_bfifolen; - - /* all error conditions checked, now decide and take action */ - - if(error == 0) - { - if(chan->in_mbuf == NULL) - { - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 isic_hscx_irq: RME, cannot allocate mbuf!\n"); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - - fifo_data_len -= 1; /* last byte in fifo is RSTA ! */ - - if((chan->in_len + fifo_data_len) <= BCH_MAX_DATALEN) - { - /* read data from HSCX fifo */ - - HSCX_RDFIFO(h_chan, chan->in_cbptr, fifo_data_len); - - cmd |= (HSCX_CMDR_RMC); - isic_hscx_cmd(sc, h_chan, cmd); - cmd = 0; - - chan->in_len += fifo_data_len; - chan->rxcount += fifo_data_len; - - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - (*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit); - - activity = ACT_RX; - - /* mark buffer ptr as unused */ - - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - else - { - NDBGL1(L1_H_XFRERR, "RAWHDLC rx buffer overflow in RME, in_len=%d, fifolen=%d", chan->in_len, fifo_data_len); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - cmd |= (HSCX_CMDR_RHR | HSCX_CMDR_RMC); - } - } - else - { - if (chan->in_mbuf != NULL) - { - i4b_Bfreembuf(chan->in_mbuf); - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - cmd |= (HSCX_CMDR_RMC); - } - } - - /* rx fifo full */ - - if(ista & HSCX_ISTA_RPF) - { - if(chan->in_mbuf == NULL) - { - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 isic_hscx_irq: RPF, cannot allocate mbuf!\n"); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - - chan->rxcount += sc->sc_bfifolen; - - if((chan->in_len + sc->sc_bfifolen) <= BCH_MAX_DATALEN) - { - /* read data from HSCX fifo */ - - HSCX_RDFIFO(h_chan, chan->in_cbptr, sc->sc_bfifolen); - - chan->in_cbptr += sc->sc_bfifolen; - chan->in_len += sc->sc_bfifolen; - } - else - { - if(chan->bprot == BPROT_NONE) - { - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - /* silence detection */ - - if(!(i4b_l1_bchan_tel_silence(chan->in_mbuf->m_data, chan->in_mbuf->m_len))) - activity = ACT_RX; - - (void) IF_HANDOFF(&chan->rx_queue, chan->in_mbuf, NULL); - - /* signal upper driver that data is available */ - - (*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit); - - /* alloc new buffer */ - - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 isic_hscx_irq: RPF, cannot allocate new mbuf!\n"); - - /* setup new data ptr */ - - chan->in_cbptr = chan->in_mbuf->m_data; - - /* read data from HSCX fifo */ - - HSCX_RDFIFO(h_chan, chan->in_cbptr, sc->sc_bfifolen); - - chan->in_cbptr += sc->sc_bfifolen; - chan->in_len = sc->sc_bfifolen; - - chan->rxcount += sc->sc_bfifolen; - } - else - { - NDBGL1(L1_H_XFRERR, "RAWHDLC rx buffer overflow in RPF, in_len=%d", chan->in_len); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - cmd |= (HSCX_CMDR_RHR); - } - } - - /* command to release fifo space */ - - cmd |= HSCX_CMDR_RMC; - } - - /* transmit fifo empty, new data can be written to fifo */ - - if(ista & HSCX_ISTA_XPR) - { - /* - * for a description what is going on here, please have - * a look at isic_bchannel_start() in i4b_bchan.c ! - */ - - int activity = -1; - int len; - int nextlen; - - NDBGL1(L1_H_IRQ, "unit %d, chan %d - XPR, Tx Fifo Empty!", sc->sc_unit, h_chan); - - if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */ - { - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) - { - chan->state &= ~HSCX_TX_ACTIVE; - (*chan->isic_drvr_linktab->bch_tx_queue_empty)(chan->isic_drvr_linktab->unit); - } - else - { - chan->state |= HSCX_TX_ACTIVE; - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - } - } - - len = 0; - - while(chan->out_mbuf_cur && len != sc->sc_bfifolen) - { - nextlen = min(chan->out_mbuf_cur_len, sc->sc_bfifolen - len); - -#ifdef NOTDEF - printf("i:mh=%x, mc=%x, mcp=%x, mcl=%d l=%d nl=%d # ", - chan->out_mbuf_head, - chan->out_mbuf_cur, - chan->out_mbuf_cur_ptr, - chan->out_mbuf_cur_len, - len, - next_len); -#endif - - isic_hscx_waitxfw(sc, h_chan); /* necessary !!! */ - - HSCX_WRFIFO(h_chan, chan->out_mbuf_cur_ptr, nextlen); - cmd |= HSCX_CMDR_XTF; - - len += nextlen; - chan->txcount += nextlen; - - chan->out_mbuf_cur_ptr += nextlen; - chan->out_mbuf_cur_len -= nextlen; - - if(chan->out_mbuf_cur_len == 0) - { - if((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL) - { - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - } - else - { - if (chan->bprot != BPROT_NONE) - cmd |= HSCX_CMDR_XME; - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_head = NULL; - } - - } - } - } - - if(cmd) /* is there a command for the HSCX ? */ - { - isic_hscx_cmd(sc, h_chan, cmd); /* yes, to HSCX */ - } - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); -} - -/*---------------------------------------------------------------------------* - * HSCX initialization - * - * for telephony: extended transparent mode 1 - * for raw hdlc: transparent mode 0 - *---------------------------------------------------------------------------*/ -void -isic_hscx_init(struct l1_softc *sc, int h_chan, int activate) -{ - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - HSCX_WRITE(h_chan, H_MASK, 0xff); /* mask irq's */ - - if(sc->sc_ipac) - { - /* CCR1: Power Up, Clock Mode 5 */ - HSCX_WRITE(h_chan, H_CCR1, HSCX_CCR1_PU | /* power up */ - HSCX_CCR1_CM1); /* IPAC clock mode 5 */ - } - else - { - /* CCR1: Power Up, Clock Mode 5 */ - HSCX_WRITE(h_chan, H_CCR1, HSCX_CCR1_PU | /* power up */ - HSCX_CCR1_CM2 | /* HSCX clock mode 5 */ - HSCX_CCR1_CM0); - } - - /* XAD1: Transmit Address Byte 1 */ - HSCX_WRITE(h_chan, H_XAD1, 0xff); - - /* XAD2: Transmit Address Byte 2 */ - HSCX_WRITE(h_chan, H_XAD2, 0xff); - - /* RAH2: Receive Address Byte High Reg. 2 */ - HSCX_WRITE(h_chan, H_RAH2, 0xff); - - /* XBCH: reset Transmit Byte Count High */ - HSCX_WRITE(h_chan, H_XBCH, 0x00); - - /* RLCR: reset Receive Length Check Register */ - HSCX_WRITE(h_chan, H_RLCR, 0x00); - - /* CCR2: set tx/rx clock shift bit 0 */ - /* disable CTS irq, disable RIE irq*/ - HSCX_WRITE(h_chan, H_CCR2, HSCX_CCR2_XCS0|HSCX_CCR2_RCS0); - - /* XCCR: tx bit count per time slot */ - HSCX_WRITE(h_chan, H_XCCR, 0x07); - - /* RCCR: rx bit count per time slot */ - HSCX_WRITE(h_chan, H_RCCR, 0x07); - - if(sc->sc_bustyp == BUS_TYPE_IOM2) - { - switch(h_chan) - { - case HSCX_CH_A: /* Prepare HSCX channel A */ - /* TSAX: tx clock shift bits 1 & 2 */ - /* tx time slot number */ - HSCX_WRITE(h_chan, H_TSAX, 0x2f); - - /* TSAR: rx clock shift bits 1 & 2 */ - /* rx time slot number */ - HSCX_WRITE(h_chan, H_TSAR, 0x2f); - break; - - case HSCX_CH_B: /* Prepare HSCX channel B */ - /* TSAX: tx clock shift bits 1 & 2 */ - /* tx time slot number */ - HSCX_WRITE(h_chan, H_TSAX, 0x03); - - /* TSAR: rx clock shift bits 1 & 2 */ - /* rx time slot number */ - HSCX_WRITE(h_chan, H_TSAR, 0x03); - break; - } - } - else /* IOM 1 setup */ - { - /* TSAX: tx clock shift bits 1 & 2 */ - /* tx time slot number */ - HSCX_WRITE(h_chan, H_TSAX, 0x07); - - /* TSAR: rx clock shift bits 1 & 2 */ - /* rx time slot number */ - HSCX_WRITE(h_chan, H_TSAR, 0x07); - } - - if(activate) - { - if(chan->bprot == BPROT_RHDLC) - { - /* HDLC Frames, transparent mode 0 */ - HSCX_WRITE(h_chan, H_MODE, - HSCX_MODE_MDS1|HSCX_MODE_RAC|HSCX_MODE_RTS); - } - else - { - /* Raw Telephony, extended transparent mode 1 */ - HSCX_WRITE(h_chan, H_MODE, - HSCX_MODE_MDS1|HSCX_MODE_MDS0|HSCX_MODE_ADM|HSCX_MODE_RTS); - } -#if 0 - isic_hscx_cmd(sc, h_chan, HSCX_CMDR_RHR|HSCX_CMDR_XRES); -#else - isic_hscx_cmd(sc, h_chan, HSCX_CMDR_RHR); -#endif - } - else - { - /* TSAX: tx time slot */ - HSCX_WRITE(h_chan, H_TSAX, 0xff); - - /* TSAR: rx time slot */ - HSCX_WRITE(h_chan, H_TSAR, 0xff); - - /* Raw Telephony, extended transparent mode 1 */ - HSCX_WRITE(h_chan, H_MODE, - HSCX_MODE_MDS1|HSCX_MODE_MDS0|HSCX_MODE_ADM|HSCX_MODE_RTS); - } - - /* don't touch ICA, EXA and EXB bits, this could be HSCX_CH_B */ - /* always disable RSC and TIN */ - - chan->hscx_mask |= HSCX_MASK_RSC | HSCX_MASK_TIN; - - if(activate) - { - /* enable */ - chan->hscx_mask &= ~(HSCX_MASK_RME | HSCX_MASK_RPF | HSCX_MASK_XPR); - } - else - { - /* disable */ - chan->hscx_mask |= HSCX_MASK_RME | HSCX_MASK_RPF | HSCX_MASK_XPR; - } - - /* handle ICA, EXA, and EXB via interrupt mask of channel b */ - - if (h_chan == HSCX_CH_A) - { - if (activate) - HSCX_B_IMASK &= ~(HSCX_MASK_EXA | HSCX_MASK_ICA); - else - HSCX_B_IMASK |= HSCX_MASK_EXA | HSCX_MASK_ICA; - HSCX_WRITE(HSCX_CH_A, H_MASK, HSCX_A_IMASK); - HSCX_WRITE(HSCX_CH_B, H_MASK, HSCX_B_IMASK); - } - else - { - if (activate) - HSCX_B_IMASK &= ~HSCX_MASK_EXB; - else - HSCX_B_IMASK |= HSCX_MASK_EXB; - HSCX_WRITE(HSCX_CH_B, H_MASK, HSCX_B_IMASK); - } - - /* clear spurious interrupts left over */ - - if(h_chan == HSCX_CH_A) - { - HSCX_READ(h_chan, H_EXIR); - HSCX_READ(h_chan, H_ISTA); - } - else /* mask ICA, because it must not be cleared by reading ISTA */ - { - HSCX_WRITE(HSCX_CH_B, H_MASK, HSCX_B_IMASK | HSCX_MASK_ICA); - HSCX_READ(h_chan, H_EXIR); - HSCX_READ(h_chan, H_ISTA); - HSCX_WRITE(HSCX_CH_B, H_MASK, HSCX_B_IMASK); - } -} - -/*---------------------------------------------------------------------------* - * write command to HSCX command register - *---------------------------------------------------------------------------*/ -void -isic_hscx_cmd(struct l1_softc *sc, int h_chan, unsigned char cmd) -{ - int timeout = 20; - - while(((HSCX_READ(h_chan, H_STAR)) & HSCX_STAR_CEC) && timeout) - { - DELAY(10); - timeout--; - } - - if(timeout == 0) - { - NDBGL1(L1_H_ERR, "HSCX wait for CEC timeout!"); - } - - HSCX_WRITE(h_chan, H_CMDR, cmd); -} - -/*---------------------------------------------------------------------------* - * wait for HSCX transmit FIFO write enable - *---------------------------------------------------------------------------*/ -void -isic_hscx_waitxfw(struct l1_softc *sc, int h_chan) -{ -#define WAITVAL 50 -#define WAITTO 200 - - int timeout = WAITTO; - - while((!(((HSCX_READ(h_chan, H_STAR)) & - (HSCX_STAR_CEC | HSCX_STAR_XFW)) == HSCX_STAR_XFW)) && timeout) - { - DELAY(WAITVAL); - timeout--; - } - - if(timeout == 0) - { - NDBGL1(L1_H_ERR, "HSCX wait for XFW timeout!"); - } - else if (timeout != WAITTO) - { - NDBGL1(L1_H_XFRERR, "HSCX wait for XFW time: %d uS", (WAITTO-timeout)*50); - } -} diff --git a/sys/i4b/layer1/isic/i4b_hscx.h b/sys/i4b/layer1/isic/i4b_hscx.h deleted file mode 100644 index 890d6b73b6b4..000000000000 --- a/sys/i4b/layer1/isic/i4b_hscx.h +++ /dev/null @@ -1,298 +0,0 @@ -/*- - * Copyright (c) 1996, 2000 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Wed Jan 24 09:09:51 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef I4B_HSCX_H_ -#define I4B_HSCX_H_ - -enum HSCX_VERSIONS { - HSCX_VA1, /* 82525 A1 */ - HSCX_UNKN1, /* unknown 1 */ - HSCX_VA2, /* 82525 A2 */ - HSCX_UNKN3, /* unknown 3 */ - HSCX_VA3, /* 82525 A3 */ - HSCX_V21, /* 82525 2.1 */ - HSCX_UNKN /* unknown version */ -}; - -#define HSCX_CH_A 0 /* channel A */ -#define HSCX_CH_B 1 /* channel B */ - -#define HSCX_FIFO_LEN 32 /* 32 bytes FIFO on chip */ - -/* - * definitions of registers and bits for the HSCX ISDN chip. - */ - -typedef struct hscx_reg { - - /* 32 byte deep FIFO always first */ - - unsigned char hscx_fifo [HSCX_FIFO_LEN]; - - /* most registers can be read/written, but have different names */ - /* so define a union with read/write names to make that clear */ - - union { - struct { - unsigned char hscx_ista; - unsigned char hscx_star; - unsigned char hscx_mode; - unsigned char hscx_timr; - unsigned char hscx_exir; - unsigned char hscx_rbcl; - unsigned char dummy_26; - unsigned char hscx_rsta; - unsigned char hscx_ral1; - unsigned char hscx_rhcr; - unsigned char dummy_2a; - unsigned char dummy_2b; - unsigned char hscx_ccr2; - unsigned char hscx_rbch; - unsigned char hscx_vstr; - unsigned char hscx_ccr; - unsigned char dummy_30; - unsigned char dummy_31; - unsigned char dummy_32; - unsigned char dummy_33; - } hscx_r; - struct { - unsigned char hscx_mask; - unsigned char hscx_cmdr; - unsigned char hscx_mode; - unsigned char hscx_timr; - unsigned char hscx_xad1; - unsigned char hscx_xad2; - unsigned char hscx_rah1; - unsigned char hscx_rah2; - unsigned char hscx_ral1; - unsigned char hscx_ral2; - unsigned char hscx_xbcl; - unsigned char hscx_bgr; - unsigned char hscx_ccr2; - unsigned char hscx_xbch; - unsigned char hscx_rlcr; - unsigned char hscx_ccr1; - unsigned char hscx_tsax; - unsigned char hscx_tsar; - unsigned char hscx_xccr; - unsigned char hscx_rccr; - } hscx_w; - } hscx_rw; -} hscx_reg_t; - -#define REG_OFFSET(type, field) (int)(&(((type *)0)->field)) - -/* HSCX read registers */ - -#define h_ista hscx_rw.hscx_r.hscx_ista -#define H_ISTA REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_ista) -#define h_star hscx_rw.hscx_r.hscx_star -#define H_STAR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_star) -#define h_mode hscx_rw.hscx_r.hscx_mode -#define H_MODE REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_mode) -#define h_timr hscx_rw.hscx_r.hscx_timr -#define H_TIMR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_timr) -#define h_exir hscx_rw.hscx_r.hscx_exir -#define H_EXIR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_exir) -#define h_rbcl hscx_rw.hscx_r.hscx_rbcl -#define H_RBCL REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_rbcl) -#define h_rsta hscx_rw.hscx_r.hscx_rsta -#define H_RSTA REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_rsta) -#define h_ral1 hscx_rw.hscx_r.hscx_ral1 -#define H_RAL1 REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_ral1) -#define h_rhcr hscx_rw.hscx_r.hscx_rhcr -#define H_RHCR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_rhcr) -#define h_ccr2 hscx_rw.hscx_r.hscx_ccr2 -#define H_CCR2 REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_ccr2) -#define h_rbch hscx_rw.hscx_r.hscx_rbch -#define H_RBCH REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_rbch) -#define h_vstr hscx_rw.hscx_r.hscx_vstr -#define H_VSTR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_vstr) -#define h_ccr hscx_rw.hscx_r.hscx_ccr -#define H_CCR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_r.hscx_ccr) - -/* HSCX write registers - for hscx_mode, hscx_timr, hscx_ral1, hscx_ccr2 */ -/* see read registers */ - -#define h_mask hscx_rw.hscx_w.hscx_mask -#define H_MASK REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_mask) -#define h_cmdr hscx_rw.hscx_w.hscx_cmdr -#define H_CMDR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_cmdr) -#define h_xad1 hscx_rw.hscx_w.hscx_xad1 -#define H_XAD1 REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_xad1) -#define h_xad2 hscx_rw.hscx_w.hscx_xad2 -#define H_XAD2 REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_xad2) -#define h_rah1 hscx_rw.hscx_w.hscx_rah1 -#define H_RAH1 REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_rah1) -#define h_rah2 hscx_rw.hscx_w.hscx_rah2 -#define H_RAH2 REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_rah2) -#define h_ral2 hscx_rw.hscx_w.hscx_ral2 -#define H_RAL2 REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_ral2) -#define h_xbcl hscx_rw.hscx_w.hscx_xbcl -#define H_XBCL REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_xbcl) -#define h_bgr hscx_rw.hscx_w.hscx_bgr -#define H_BGR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_bgr) -#define h_xbch hscx_rw.hscx_w.hscx_xbch -#define H_XBCH REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_xbch) -#define h_rlcr hscx_rw.hscx_w.hscx_rlcr -#define H_RLCR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_rlcr) -#define h_ccr1 hscx_rw.hscx_w.hscx_ccr1 -#define H_CCR1 REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_ccr1) -#define h_tsax hscx_rw.hscx_w.hscx_tsax -#define H_TSAX REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_tsax) -#define h_tsar hscx_rw.hscx_w.hscx_tsar -#define H_TSAR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_tsar) -#define h_xccr hscx_rw.hscx_w.hscx_xccr -#define H_XCCR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_xccr) -#define h_rccr hscx_rw.hscx_w.hscx_rccr -#define H_RCCR REG_OFFSET(hscx_reg_t, hscx_rw.hscx_w.hscx_rccr) - -#define HSCX_ISTA_RME 0x80 -#define HSCX_ISTA_RPF 0x40 -#define HSCX_ISTA_RSC 0x20 -#define HSCX_ISTA_XPR 0x10 -#define HSCX_ISTA_TIN 0x08 -#define HSCX_ISTA_ICA 0x04 -#define HSCX_ISTA_EXA 0x02 -#define HSCX_ISTA_EXB 0x01 - -#define HSCX_MASK_RME 0x80 -#define HSCX_MASK_RPF 0x40 -#define HSCX_MASK_RSC 0x20 -#define HSCX_MASK_XPR 0x10 -#define HSCX_MASK_TIN 0x08 -#define HSCX_MASK_ICA 0x04 -#define HSCX_MASK_EXA 0x02 -#define HSCX_MASK_EXB 0x01 - -#define HSCX_EXIR_XMR 0x80 -#define HSCX_EXIR_XDU 0x40 -#define HSCX_EXIR_PCE 0x20 -#define HSCX_EXIR_RFO 0x10 -#define HSCX_EXIR_CSC 0x08 -#define HSCX_EXIR_RFS 0x04 - -/* the other bits are always 0 */ - -#define HSCX_STAR_XDOV 0x80 -#define HSCX_STAR_XFW 0x40 -#define HSCX_STAR_XRNR 0x20 -#define HSCX_STAR_RRNR 0x10 -#define HSCX_STAR_RLI 0x08 -#define HSCX_STAR_CEC 0x04 -#define HSCX_STAR_CTS 0x02 -#define HSCX_STAR_WFA 0x01 - -#define HSCX_CMDR_RMC 0x80 -#define HSCX_CMDR_RHR 0x40 -/* also known as XREP in transparent mode */ -#define HSCX_CMDR_RNR 0x20 -#define HSCX_CMDR_STI 0x10 -#define HSCX_CMDR_XTF 0x08 -#define HSCX_CMDR_XIF 0x04 -#define HSCX_CMDR_XME 0x02 -#define HSCX_CMDR_XRES 0x01 - -#define HSCX_MODE_MDS1 0x80 -#define HSCX_MODE_MDS0 0x40 -#define HSCX_MODE_ADM 0x20 -#define HSCX_MODE_TMD 0x10 -#define HSCX_MODE_RAC 0x08 -#define HSCX_MODE_RTS 0x04 -#define HSCX_MODE_TRS 0x02 -#define HSCX_MODE_TLP 0x01 - -#define HSCX_RSTA_VFR 0x80 -#define HSCX_RSTA_RDO 0x40 -#define HSCX_RSTA_CRC 0x20 -#define HSCX_RSTA_RAB 0x10 -#define HSCX_RSTA_HA1 0x08 -#define HSCX_RSTA_HA0 0x04 -#define HSCX_RSTA_CR 0x02 -#define HSCX_RSTA_LA 0x01 - -#define HSCX_RSTA_MASK 0xf0 /* the interesting ones */ - -/* only used in DMA mode */ -#define HSCX_XBCH_DMA 0x80 -#define HSCX_XBCH_NRM 0x40 -#define HSCX_XBCH_CAS 0x20 -#define HSCX_XBCH_XC 0x10 -/* the rest are bits 11 thru 8 of the byte count */ - -#define HSCX_RBCH_DMA 0x80 -#define HSCX_RBCH_NRM 0x40 -#define HSCX_RBCH_CAS 0x20 -#define HSCX_RBCH_OV 0x10 -/* the rest are bits 11 thru 8 of the byte count */ - -#define HSCX_VSTR_CD 0x80 -/* bits 6 thru 4 are 0 */ -/* bits 3 thru 0 are the version number */ - -#define HSCX_RLCR_RC 0x80 -/* the rest of the bits are used to set the received length */ - -#define HSCX_CCR1_PU 0x80 -/* bits 6 and 5 are SC1 SC0 */ -#define HSCX_CCR1_ODS 0x10 -#define HSCX_CCR1_ITF 0x08 -#define HSCX_CCR1_CM2 0x04 -#define HSCX_CCR1_CM1 0x02 -#define HSCX_CCR1_CM0 0x01 - -/* for clock mode 5 */ -#define HSCX_CCR2_SOC2 0x80 -#define HSCX_CCR2_SOC1 0x40 -#define HSCX_CCR2_XCS0 0x20 -#define HSCX_CCR2_RCS0 0x10 -#define HSCX_CCR2_TIO 0x08 -#define HSCX_CCR2_CIE 0x04 -#define HSCX_CCR2_RIE 0x02 -#define HSCX_CCR2_DIV 0x01 - -/* bits 7 thru 2 are TSNX */ -#define HSCX_TSAX_XCS2 0x02 -#define HSCX_TSAX_XCS1 0x01 - -/* bits 7 thru 2 are TSNR */ -#define HSCX_TSAR_RCS2 0x02 -#define HSCX_TSAR_RCS1 0x01 - -#endif /* I4B_HSCX_H_ */ diff --git a/sys/i4b/layer1/isic/i4b_ipac.h b/sys/i4b/layer1/isic/i4b_ipac.h deleted file mode 100644 index 6361b351f6a3..000000000000 --- a/sys/i4b/layer1/isic/i4b_ipac.h +++ /dev/null @@ -1,205 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_ipac.h - definitions for the Siemens IPAC PSB2115 chip - * ========================================================== - * - * $FreeBSD$ - * - * last edit-date: [Wed Jan 24 09:10:09 2001] - * - *--------------------------------------------------------------------------- - */ - -#ifndef _I4B_IPAC_H_ -#define _I4B_IPAC_H_ - -#define IPAC_BFIFO_LEN 64 /* 64 bytes B-channel FIFO on chip */ - -#define IPAC_HSCXA_OFF 0x00 -#define IPAC_HSCXB_OFF 0x40 -#define IPAC_ISAC_OFF 0x80 -#define IPAC_IPAC_OFF 0xc0 - -/* chip version */ - -#define IPAC_V11 0x01 /* IPAC Version 1.1 */ -#define IPAC_V12 0x02 /* IPAC Version 1.2 */ - -/* - * definitions of registers and bits for the IPAC ISDN chip. - */ - -typedef struct ipac_reg { - - /* most registers can be read/written, but have different names */ - /* so define a union with read/write names to make that clear */ - - union { - struct { - unsigned char ipac_conf; - unsigned char ipac_ista; - unsigned char ipac_id; - unsigned char ipac_acfg; - unsigned char ipac_aoe; - unsigned char ipac_arx; - unsigned char ipac_pita1; - unsigned char ipac_pita2; - unsigned char ipac_pota1; - unsigned char ipac_pota2; - unsigned char ipac_pcfg; - unsigned char ipac_scfg; - unsigned char ipac_timr2; - } ipac_r; - struct { - unsigned char ipac_conf; - unsigned char ipac_mask; - unsigned char ipac_dummy; - unsigned char ipac_acfg; - unsigned char ipac_aoe; - unsigned char ipac_atx; - unsigned char ipac_pita1; - unsigned char ipac_pita2; - unsigned char ipac_pota1; - unsigned char ipac_pota2; - unsigned char ipac_pcfg; - unsigned char ipac_scfg; - unsigned char ipac_timr2; - } ipac_w; - } ipac_rw; -} ipac_reg_t; - -#define REG_OFFSET(type, field) (int)(&(((type *)0)->field)) - -/* IPAC read registers */ - -#define IPAC_CONF REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_conf) -#define IPAC_ISTA REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_ista) -#define IPAC_ID REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_id) -#define IPAC_ACFG REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_acfg) -#define IPAC_AOE REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_aoe) -#define IPAC_ARX REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_arx) -#define IPAC_PITA1 REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_pita1) -#define IPAC_PITA2 REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_pita2) -#define IPAC_POTA1 REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_pota1) -#define IPAC_POTA2 REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_pota2) -#define IPAC_PCFG REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_pcfg) -#define IPAC_SCFG REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_scfg) -#define IPAC_TIMR2 REG_OFFSET(ipac_reg_t, ipac_rw.ipac_r.ipac_timr2) - -/* IPAC write registers */ - -#define IPAC_MASK REG_OFFSET(ipac_reg_t, ipac_rw.ipac_w.ipac_mask) -#define IPAC_ATX REG_OFFSET(ipac_reg_t, ipac_rw.ipac_w.ipac_atx) - -/* register bits */ - -#define IPAC_CONF_AMP 0x80 -#define IPAC_CONF_CFS 0x40 -#define IPAC_CONF_TEM 0x20 -#define IPAC_CONF_PDS 0x10 -#define IPAC_CONF_IDH 0x08 -#define IPAC_CONF_SGO 0x04 -#define IPAC_CONF_ODS 0x02 -#define IPAC_CONF_IOF 0x01 - -#define IPAC_ISTA_INT1 0x80 -#define IPAC_ISTA_INT0 0x40 -#define IPAC_ISTA_ICD 0x20 -#define IPAC_ISTA_EXD 0x10 -#define IPAC_ISTA_ICA 0x08 -#define IPAC_ISTA_EXA 0x04 -#define IPAC_ISTA_ICB 0x02 -#define IPAC_ISTA_EXB 0x01 - -#define IPAC_MASK_INT1 0x80 -#define IPAC_MASK_INT0 0x40 -#define IPAC_MASK_ICD 0x20 -#define IPAC_MASK_EXD 0x10 -#define IPAC_MASK_ICA 0x08 -#define IPAC_MASK_EXA 0x04 -#define IPAC_MASK_ICB 0x02 -#define IPAC_MASK_EXB 0x01 - -#define IPAC_ACFG_OD7 0x80 -#define IPAC_ACFG_OD6 0x40 -#define IPAC_ACFG_OD5 0x20 -#define IPAC_ACFG_OD4 0x10 -#define IPAC_ACFG_OD3 0x08 -#define IPAC_ACFG_OD2 0x04 -#define IPAC_ACFG_EL1 0x02 -#define IPAC_ACFG_EL2 0x01 - -#define IPAC_AOE_OE7 0x80 -#define IPAC_AOE_OE6 0x40 -#define IPAC_AOE_OE5 0x20 -#define IPAC_AOE_OE4 0x10 -#define IPAC_AOE_OE3 0x08 -#define IPAC_AOE_OE2 0x04 - -#define IPAC_ARX_AR7 0x80 -#define IPAC_ARX_AR6 0x40 -#define IPAC_ARX_AR5 0x20 -#define IPAC_ARX_AR4 0x10 -#define IPAC_ARX_AR3 0x08 -#define IPAC_ARX_AR2 0x04 - -#define IPAC_ATX_AT7 0x80 -#define IPAC_ATX_AT6 0x40 -#define IPAC_ATX_AT5 0x20 -#define IPAC_ATX_AT4 0x10 -#define IPAC_ATX_AT3 0x08 -#define IPAC_ATX_AT2 0x04 - -#define IPAC_PITA1_ENA 0x80 -#define IPAC_PITA1_DUDD 0x40 - -#define IPAC_PITA2_ENA 0x80 -#define IPAC_PITA2_DUDD 0x40 - -#define IPAC_POTA1_ENA 0x80 -#define IPAC_POTA1_DUDD 0x40 - -#define IPAC_POTA2_ENA 0x80 -#define IPAC_POTA2_DUDD 0x40 - -#define IPAC_PCFG_DPS 0x80 -#define IPAC_PCFG_ACL 0x40 -#define IPAC_PCFG_LED 0x20 -#define IPAC_PCFG_PLD 0x10 -#define IPAC_PCFG_FBS 0x08 -#define IPAC_PCFG_CSL2 0x04 -#define IPAC_PCFG_CSL1 0x02 -#define IPAC_PCFG_CSL0 0x01 - -#define IPAC_SCFG_PRI 0x80 -#define IPAC_SCFG_TXD 0x40 -#define IPAC_SCFG_TLEN 0x20 - -#define IPAC_TIMR2_TMD 0x80 - -#endif /* _I4B_IPAC_H_ */ diff --git a/sys/i4b/layer1/isic/i4b_isac.c b/sys/i4b/layer1/isic/i4b_isac.c deleted file mode 100644 index 8a50efcf9138..000000000000 --- a/sys/i4b/layer1/isic/i4b_isac.c +++ /dev/null @@ -1,655 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_isac.c - i4b siemens isdn chipset driver ISAC handler - * --------------------------------------------------------- - * last edit-date: [Wed Jan 24 09:10:36 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -static u_char isic_isac_exir_hdlr(register struct l1_softc *sc, u_char exir); -static void isic_isac_ind_hdlr(register struct l1_softc *sc, int ind); - -/*---------------------------------------------------------------------------* - * ISAC interrupt service routine - *---------------------------------------------------------------------------*/ -void -isic_isac_irq(struct l1_softc *sc, int ista) -{ - register u_char c = 0; - NDBGL1(L1_F_MSG, "unit %d: ista = 0x%02x", sc->sc_unit, ista); - - if(ista & ISAC_ISTA_EXI) /* extended interrupt */ - { - c |= isic_isac_exir_hdlr(sc, ISAC_READ(I_EXIR)); - } - - if(ista & ISAC_ISTA_RME) /* receive message end */ - { - register int rest; - u_char rsta; - - /* get rx status register */ - - rsta = ISAC_READ(I_RSTA); - - if((rsta & ISAC_RSTA_MASK) != 0x20) - { - int error = 0; - - if(!(rsta & ISAC_RSTA_CRC)) /* CRC error */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: CRC error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RDO) /* ReceiveDataOverflow */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Data Overrun error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RAB) /* ReceiveABorted */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Receive Aborted error", sc->sc_unit); - } - - if(error == 0) - NDBGL1(L1_I_ERR, "unit %d: RME unknown error, RSTA = 0x%02x!", sc->sc_unit, rsta); - - i4b_Dfreembuf(sc->sc_ibuf); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - ISAC_WRITE(I_CMDR, ISAC_CMDR_RMC|ISAC_CMDR_RRES); - ISACCMDRWRDELAY(); - - return; - } - - rest = (ISAC_READ(I_RBCL) & (ISAC_FIFO_LEN-1)); - - if(rest == 0) - rest = ISAC_FIFO_LEN; - - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(rest)) != NULL) - sc->sc_ib = sc->sc_ibuf->m_data; - else - panic("isic_isac_irq: RME, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - rest)) - { - ISAC_RDFIFO(sc->sc_ib, rest); - sc->sc_ilen += rest; - - sc->sc_ibuf->m_pkthdr.len = - sc->sc_ibuf->m_len = sc->sc_ilen; - - if(sc->sc_trace & TRACE_D_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data); - } - - c |= ISAC_CMDR_RMC; - - if(sc->sc_enabled && - (ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S)) - { - i4b_l1_ph_data_ind(L0ISICUNIT(sc->sc_unit), sc->sc_ibuf); - } - else - { - i4b_Dfreembuf(sc->sc_ibuf); - } - } - else - { - NDBGL1(L1_I_ERR, "RME, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - } - - if(ista & ISAC_ISTA_RPF) /* receive fifo full */ - { - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(MAX_DFRAME_LEN)) != NULL) - sc->sc_ib= sc->sc_ibuf->m_data; - else - panic("isic_isac_irq: RPF, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - ISAC_FIFO_LEN)) - { - ISAC_RDFIFO(sc->sc_ib, ISAC_FIFO_LEN); - sc->sc_ilen += ISAC_FIFO_LEN; - sc->sc_ib += ISAC_FIFO_LEN; - c |= ISAC_CMDR_RMC; - } - else - { - NDBGL1(L1_I_ERR, "RPF, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - } - - if(ista & ISAC_ISTA_XPR) /* transmit fifo empty (XPR bit set) */ - { - if((sc->sc_obuf2 != NULL) && (sc->sc_obuf == NULL)) - { - sc->sc_freeflag = sc->sc_freeflag2; - sc->sc_obuf = sc->sc_obuf2; - sc->sc_op = sc->sc_obuf->m_data; - sc->sc_ol = sc->sc_obuf->m_len; - sc->sc_obuf2 = NULL; -#ifdef NOTDEF - printf("ob2=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - else - { -#ifdef NOTDEF - printf("ob=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - - if(sc->sc_obuf) - { - ISAC_WRFIFO(sc->sc_op, min(sc->sc_ol, ISAC_FIFO_LEN)); - - if(sc->sc_ol > ISAC_FIFO_LEN) /* length > 32 ? */ - { - sc->sc_op += ISAC_FIFO_LEN; /* bufferptr+32 */ - sc->sc_ol -= ISAC_FIFO_LEN; /* length - 32 */ - c |= ISAC_CMDR_XTF; /* set XTF bit */ - } - else - { - if(sc->sc_freeflag) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_freeflag = 0; - } - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - c |= ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - } - else - { - sc->sc_state &= ~ISAC_TX_ACTIVE; - } - } - - if(ista & ISAC_ISTA_CISQ) /* channel status change CISQ */ - { - register u_char ci; - - /* get command/indication rx register*/ - - ci = ISAC_READ(I_CIRR); - - /* if S/Q IRQ, read SQC reg to clr SQC IRQ */ - - if(ci & ISAC_CIRR_SQC) - (void) ISAC_READ(I_SQRR); - - /* C/I code change IRQ (flag already cleared by CIRR read) */ - - if(ci & ISAC_CIRR_CIC0) - isic_isac_ind_hdlr(sc, (ci >> 2) & 0xf); - } - - if(c) - { - ISAC_WRITE(I_CMDR, c); - ISACCMDRWRDELAY(); - } -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Extended IRQ handler - *---------------------------------------------------------------------------*/ -static u_char -isic_isac_exir_hdlr(register struct l1_softc *sc, u_char exir) -{ - u_char c = 0; - - if(exir & ISAC_EXIR_XMR) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Message Repeat"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_XDU) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Data Underrun"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_PCE) - { - NDBGL1(L1_I_ERR, "EXIRQ Protocol Error"); - } - - if(exir & ISAC_EXIR_RFO) - { - NDBGL1(L1_I_ERR, "EXIRQ Rx Frame Overflow"); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - if(exir & ISAC_EXIR_SOV) - { - NDBGL1(L1_I_ERR, "EXIRQ Sync Xfer Overflow"); - } - - if(exir & ISAC_EXIR_MOS) - { - NDBGL1(L1_I_ERR, "EXIRQ Monitor Status"); - } - - if(exir & ISAC_EXIR_SAW) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Subscriber Awake"); - } - - if(exir & ISAC_EXIR_WOV) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Watchdog Timer Overflow"); - } - - return(c); -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Indication handler - *---------------------------------------------------------------------------*/ -static void -isic_isac_ind_hdlr(register struct l1_softc *sc, int ind) -{ - register int event; - - switch(ind) - { - case ISAC_CIRR_IAI8: - NDBGL1(L1_I_CICO, "rx AI8 in state %s", isic_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - isic_isac_l1_cmd(sc, CMD_AR8); - event = EV_INFO48; - i4b_l1_mph_status_ind(L0ISICUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IAI10: - NDBGL1(L1_I_CICO, "rx AI10 in state %s", isic_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - isic_isac_l1_cmd(sc, CMD_AR10); - event = EV_INFO410; - i4b_l1_mph_status_ind(L0ISICUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IRSY: - NDBGL1(L1_I_CICO, "rx RSY in state %s", isic_printstate(sc)); - event = EV_RSY; - break; - - case ISAC_CIRR_IPU: - NDBGL1(L1_I_CICO, "rx PU in state %s", isic_printstate(sc)); - event = EV_PU; - break; - - case ISAC_CIRR_IDR: - NDBGL1(L1_I_CICO, "rx DR in state %s", isic_printstate(sc)); - isic_isac_l1_cmd(sc, CMD_DIU); - event = EV_DR; - break; - - case ISAC_CIRR_IDID: - NDBGL1(L1_I_CICO, "rx DID in state %s", isic_printstate(sc)); - event = EV_INFO0; - i4b_l1_mph_status_ind(L0ISICUNIT(sc->sc_unit), STI_L1STAT, LAYER_IDLE, NULL); - break; - - case ISAC_CIRR_IDIS: - NDBGL1(L1_I_CICO, "rx DIS in state %s", isic_printstate(sc)); - event = EV_DIS; - break; - - case ISAC_CIRR_IEI: - NDBGL1(L1_I_CICO, "rx EI in state %s", isic_printstate(sc)); - isic_isac_l1_cmd(sc, CMD_DIU); - event = EV_EI; - break; - - case ISAC_CIRR_IARD: - NDBGL1(L1_I_CICO, "rx ARD in state %s", isic_printstate(sc)); - event = EV_INFO2; - break; - - case ISAC_CIRR_ITI: - NDBGL1(L1_I_CICO, "rx TI in state %s", isic_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_IATI: - NDBGL1(L1_I_CICO, "rx ATI in state %s", isic_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_ISD: - NDBGL1(L1_I_CICO, "rx SD in state %s", isic_printstate(sc)); - event = EV_INFO0; - break; - - default: - NDBGL1(L1_I_ERR, "UNKNOWN Indication 0x%x in state %s", ind, isic_printstate(sc)); - event = EV_INFO0; - break; - } - isic_next_state(sc, event); -} - -/*---------------------------------------------------------------------------* - * execute a layer 1 command - *---------------------------------------------------------------------------*/ -void -isic_isac_l1_cmd(struct l1_softc *sc, int command) -{ - u_char cmd; - -#ifdef I4B_SMP_WORKAROUND - - /* XXXXXXXXXXXXXXXXXXX */ - - /* - * patch from Wolfgang Helbig: - * - * Here is a patch that makes i4b work on an SMP: - * The card (TELES 16.3) didn't interrupt on an SMP machine. - * This is a gross workaround, but anyway it works *and* provides - * some information as how to finally fix this problem. - */ - - HSCX_WRITE(0, H_MASK, 0xff); - HSCX_WRITE(1, H_MASK, 0xff); - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - HSCX_WRITE(0, H_MASK, HSCX_A_IMASK); - HSCX_WRITE(1, H_MASK, HSCX_B_IMASK); - ISAC_WRITE(I_MASK, ISAC_IMASK); - - /* XXXXXXXXXXXXXXXXXXX */ - -#endif /* I4B_SMP_WORKAROUND */ - - if(command < 0 || command > CMD_ILL) - { - NDBGL1(L1_I_ERR, "illegal cmd 0x%x in state %s", command, isic_printstate(sc)); - return; - } - - if(sc->sc_bustyp == BUS_TYPE_IOM2) - cmd = ISAC_CIX0_LOW; - else - cmd = 0; - - switch(command) - { - case CMD_TIM: - NDBGL1(L1_I_CICO, "tx TIM in state %s", isic_printstate(sc)); - cmd |= (ISAC_CIXR_CTIM << 2); - break; - - case CMD_RS: - NDBGL1(L1_I_CICO, "tx RS in state %s", isic_printstate(sc)); - cmd |= (ISAC_CIXR_CRS << 2); - break; - - case CMD_AR8: - NDBGL1(L1_I_CICO, "tx AR8 in state %s", isic_printstate(sc)); - cmd |= (ISAC_CIXR_CAR8 << 2); - break; - - case CMD_AR10: - NDBGL1(L1_I_CICO, "tx AR10 in state %s", isic_printstate(sc)); - cmd |= (ISAC_CIXR_CAR10 << 2); - break; - - case CMD_DIU: - NDBGL1(L1_I_CICO, "tx DIU in state %s", isic_printstate(sc)); - cmd |= (ISAC_CIXR_CDIU << 2); - break; - } - ISAC_WRITE(I_CIXR, cmd); -} - -/*---------------------------------------------------------------------------* - * L1 ISAC initialization - *---------------------------------------------------------------------------*/ -int -isic_isac_init(struct l1_softc *sc) -{ - ISAC_IMASK = 0xff; /* disable all irqs */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - if(sc->sc_bustyp != BUS_TYPE_IOM2) - { - NDBGL1(L1_I_SETUP, "configuring for IOM-1 mode"); - - /* ADF2: Select mode IOM-1 */ - ISAC_WRITE(I_ADF2, 0x00); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SAC - SIP port high Z - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 and B2 switched to/from SPa - */ - ISAC_WRITE(I_SPCR, ISAC_SPCR_C1C1|ISAC_SPCR_C2C1); - - /* SQXR: S/Q channel xmit register: - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * CFS - IOM clock/frame always active - * FSC1/2 - polarity of 8kHz strobe - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, ISAC_ADF1_FC2); /* ADF1 */ - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - else - { - NDBGL1(L1_I_SETUP, "configuring for IOM-2 mode"); - - /* ADF2: Select mode IOM-2 */ - ISAC_WRITE(I_ADF2, ISAC_ADF2_IMS); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 + C1 and B2 + IC2 monitoring - */ - ISAC_WRITE(I_SPCR, 0x00); - - /* SQXR: S/Q channel xmit register: - * IDC - IOM direction = 0 (master) - * CFS - Config Select = 0 (clock always active) - * CI1E - C/I channel 1 IRQ enable = 0 - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * IOF - IOM i/f off = 0 - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, 0x00); - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - -#ifdef NOTDEF - /* - * XXX a transmitter reset causes an ISAC tx IRQ which will not - * be serviced at attach time under some circumstances leaving - * the associated IRQ line on the ISA bus active. This prevents - * any further interrupts to be serviced because no low -> high - * transition can take place anymore. (-hm) - */ - - /* command register: - * RRES - HDLC receiver reset - * XRES - transmitter reset - */ - ISAC_WRITE(I_CMDR, ISAC_CMDR_RRES|ISAC_CMDR_XRES); - ISACCMDRWRDELAY(); -#endif - - /* enabled interrupts: - * =================== - * RME - receive message end - * RPF - receive pool full - * XPR - transmit pool ready - * CISQ - CI or S/Q channel change - * EXI - extended interrupt - */ - - ISAC_IMASK = ISAC_MASK_RSC | /* auto mode only */ - ISAC_MASK_TIN | /* timer irq */ - ISAC_MASK_SIN; /* sync xfer irq */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - return(0); -} diff --git a/sys/i4b/layer1/isic/i4b_isac.h b/sys/i4b/layer1/isic/i4b_isac.h deleted file mode 100644 index 7435104eee03..000000000000 --- a/sys/i4b/layer1/isic/i4b_isac.h +++ /dev/null @@ -1,389 +0,0 @@ -/*- - * Copyright (c) 1996, 2000 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Wed Jan 24 09:10:42 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef I4B_ISAC_H_ -#define I4B_ISAC_H_ - -/* - * The ISAC databook specifies a delay of 2.5 DCL clock cycles between - * writes to the ISAC command register CMDR. This is the delay used to - * satisfy this requirement. - */ - -#define I4B_ISAC_CMDRWRDELAY 30 - -#if (I4B_ISAC_CMDRWRDELAY > 0) -#define ISACCMDRWRDELAY() DELAY(I4B_ISAC_CMDRWRDELAY) -#else -#warning "I4B_ISAC_CMDRWRDELAY set to 0!" -#define ISACCMDRWRDELAY() -#endif - -enum ISAC_VERSIONS { - ISAC_VA, /* 2085 A1 or A2, 2086/2186 V1.1 */ - ISAC_VB1, /* 2085 B1 */ - ISAC_VB2, /* 2085 B2 */ - ISAC_VB3, /* 2085 B3/V2.3 */ - ISAC_UNKN /* unknown version */ -}; - -#define ISAC_FIFO_LEN 32 /* 32 bytes FIFO on chip */ - -/* - * definitions of registers and bits for the ISAC ISDN chip. - */ - -typedef struct isac_reg { - - /* 32 byte deep FIFO always first */ - - unsigned char isac_fifo [ISAC_FIFO_LEN]; - - /* most registers can be read/written, but have different names */ - /* so define a union with read/write names to make that clear */ - - union { - struct { - unsigned char isac_ista; - unsigned char isac_star; - unsigned char isac_mode; - unsigned char isac_timr; - unsigned char isac_exir; - unsigned char isac_rbcl; - unsigned char isac_sapr; - unsigned char isac_rsta; - unsigned char dummy_28; - unsigned char isac_rhcr; - unsigned char isac_rbch; - unsigned char isac_star2; - unsigned char dummy_2c; - unsigned char dummy_2d; - unsigned char dummy_2e; - unsigned char dummt_2f; - unsigned char isac_spcr; - unsigned char isac_cirr; - unsigned char isac_mor; - unsigned char isac_sscr; - unsigned char isac_sfcr; - unsigned char isac_c1r; - unsigned char isac_c2r; - unsigned char isac_b1cr; - unsigned char isac_b2cr; - unsigned char isac_adf2; - unsigned char isac_mosr; - unsigned char isac_sqrr; - } isac_r; - struct { - unsigned char isac_mask; - unsigned char isac_cmdr; - unsigned char isac_mode; - unsigned char isac_timr; - unsigned char isac_xad1; - unsigned char isac_xad2; - unsigned char isac_sap1; - unsigned char isac_sap2; - unsigned char isac_tei1; - unsigned char isac_tei2; - unsigned char dummy_2a; - unsigned char isac_star2; - unsigned char dummy_2c; - unsigned char dummy_2d; - unsigned char dummy_2e; - unsigned char dummt_2f; - unsigned char isac_spcr; - unsigned char isac_cixr; - unsigned char isac_mox; - unsigned char isac_sscx; - unsigned char isac_sfcw; - unsigned char isac_c1r; - unsigned char isac_c2r; - unsigned char isac_stcr; - unsigned char isac_adf1; - unsigned char isac_adf2; - unsigned char isac_mocr; - unsigned char isac_sqxr; - } isac_w; - } isac_rw; -} isac_reg_t; - -#define REG_OFFSET(type, field) (int)(&(((type *)0)->field)) - -/* ISAC read registers */ - -#define i_ista isac_rw.isac_r.isac_ista -#define I_ISTA REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_ista) -#define i_star isac_rw.isac_r.isac_star -#define I_STAR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_star) -#define i_mode isac_rw.isac_r.isac_mode -#define I_MODE REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_mode) -#define i_timr isac_rw.isac_r.isac_timr -#define I_TIMR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_timr) -#define i_exir isac_rw.isac_r.isac_exir -#define I_EXIR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_exir) -#define i_rbcl isac_rw.isac_r.isac_rbcl -#define I_RBCL REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_rbcl) -#define i_sapr isac_rw.isac_r.isac_sapr -#define I_SAPR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_sapr) -#define i_rsta isac_rw.isac_r.isac_rsta -#define I_RSTA REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_rsta) -#define i_rhcr isac_rw.isac_r.isac_rhcr -#define I_RHCR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_rhcr) -#define i_rbch isac_rw.isac_r.isac_rbch -#define I_RBCH REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_rbch) -#define i_star2 isac_rw.isac_r.isac_star2 -#define I_STAR2 REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_star2) -#define i_spcr isac_rw.isac_r.isac_spcr -#define I_SPCR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_spcr) -#define i_cirr isac_rw.isac_r.isac_cirr -#define I_CIRR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_cirr) -#define i_mor isac_rw.isac_r.isac_mor -#define I_MOR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_mor) -#define i_sscr isac_rw.isac_r.isac_sscr -#define I_SSCR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_sscr) -#define i_sfcr isac_rw.isac_r.isac_sfcr -#define I_SFCR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_sfcr) -#define i_c1r isac_rw.isac_r.isac_c1r -#define I_C1R REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_c1r) -#define i_c2r isac_rw.isac_r.isac_c2r -#define I_C2R REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_c2r) -#define i_b1cr isac_rw.isac_r.isac_b1cr -#define I_B1CR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_b1cr) -#define i_b2cr isac_rw.isac_r.isac_b2cr -#define I_B2CR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_b2cr) -#define i_adf2 isac_rw.isac_r.isac_adf2 -#define I_ADF2 REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_adf2) -#define i_mosr isac_rw.isac_r.isac_mosr -#define I_MOSR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_mosr) -#define i_sqrr isac_rw.isac_r.isac_sqrr -#define I_SQRR REG_OFFSET(isac_reg_t, isac_rw.isac_r.isac_sqrr) - -/* ISAC write registers - isac_mode, isac_timr, isac_star2, isac_spcr, */ -/* isac_c1r, isac_c2r, isac_adf2 see read registers */ - -#define i_mask isac_rw.isac_w.isac_mask -#define I_MASK REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_mask) -#define i_cmdr isac_rw.isac_w.isac_cmdr -#define I_CMDR REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_cmdr) -#define i_xad1 isac_rw.isac_w.isac_xad1 -#define I_XAD1 REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_xad1) -#define i_xad2 isac_rw.isac_w.isac_xad2 -#define I_XAD2 REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_xad2) -#define i_sap1 isac_rw.isac_w.isac_sap1 -#define I_SAP1 REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_sap1) -#define i_sap2 isac_rw.isac_w.isac_sap2 -#define I_SAP2 REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_sap2) -#define i_tei1 isac_rw.isac_w.isac_tei1 -#define i_tei2 isac_rw.isac_w.isac_tei2 -#define i_cixr isac_rw.isac_w.isac_cixr -#define I_CIXR REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_cixr) -#define I_CIX0 I_CIXR -#define i_mox isac_rw.isac_w.isac_mox -#define I_MOX REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_mox) -#define i_sscx isac_rw.isac_w.isac_sscx -#define I_SSCX REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_sscx) -#define i_sfcw isac_rw.isac_w.isac_sfcw -#define I_SFCW REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_sfcw) -#define i_stcr isac_rw.isac_w.isac_stcr -#define I_STCR REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_stcr) -#define i_adf1 isac_rw.isac_w.isac_adf1 -#define I_ADF1 REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_adf1) -#define i_mocr isac_rw.isac_w.isac_mocr -#define I_MOCR REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_mocr) -#define i_sqxr isac_rw.isac_w.isac_sqxr -#define I_SQXR REG_OFFSET(isac_reg_t, isac_rw.isac_w.isac_sqxr) - -#define ISAC_ISTA_RME 0x80 -#define ISAC_ISTA_RPF 0x40 -#define ISAC_ISTA_RSC 0x20 -#define ISAC_ISTA_XPR 0x10 -#define ISAC_ISTA_TIN 0x08 -#define ISAC_ISTA_CISQ 0x04 -#define ISAC_ISTA_SIN 0x02 -#define ISAC_ISTA_EXI 0x01 - -#define ISAC_MASK_RME 0x80 -#define ISAC_MASL_RPF 0x40 -#define ISAC_MASK_RSC 0x20 -#define ISAC_MASK_XPR 0x10 -#define ISAC_MASK_TIN 0x08 -#define ISAC_MASK_CISQ 0x04 -#define ISAC_MASK_SIN 0x02 -#define ISAC_MASK_EXI 0x01 -#define ISAC_MASK_ALL 0xff - -#define ISAC_STAR_XDOV 0x80 -#define ISAC_STAR_XFW 0x40 -#define ISAC_STAR_XRNR 0x20 -#define ISAC_STAR_RRNR 0x10 -#define ISAC_STAR_MBR 0x08 -#define ISAC_STAR_MAC1 0x04 -#define ISAC_STAR_BVS 0x02 -#define ISAC_STAR_MAC0 0x01 - -#define ISAC_CMDR_RMC 0x80 -#define ISAC_CMDR_RRES 0x40 -#define ISAC_CMDR_RNR 0x20 -#define ISAC_CMDR_STI 0x10 -#define ISAC_CMDR_XTF 0x08 -#define ISAC_CMDR_XIF 0x04 -#define ISAC_CMDR_XME 0x02 -#define ISAC_CMDR_XRES 0x01 - -#define ISAC_MODE_MDS2 0x80 -#define ISAC_MODE_MDS1 0x40 -#define ISAC_MODE_MDS0 0x20 -#define ISAC_MODE_TMD 0x10 -#define ISAC_MODE_RAC 0x08 -#define ISAC_MODE_DIM2 0x04 -#define ISAC_MODE_DIM1 0x02 -#define ISAC_MODE_DIM0 0x01 - -#define ISAC_EXIR_XMR 0x80 -#define ISAC_EXIR_XDU 0x40 -#define ISAC_EXIR_PCE 0x20 -#define ISAC_EXIR_RFO 0x10 -#define ISAC_EXIR_SOV 0x08 -#define ISAC_EXIR_MOS 0x04 -#define ISAC_EXIR_SAW 0x02 -#define ISAC_EXIR_WOV 0x01 - -#define ISAC_RSTA_RDA 0x80 -#define ISAC_RSTA_RDO 0x40 -#define ISAC_RSTA_CRC 0x20 -#define ISAC_RSTA_RAB 0x10 -#define ISAC_RSTA_SA1 0x08 -#define ISAC_RSTA_SA0 0x04 -#define ISAC_RSTA_CR 0x02 -#define ISAC_RSTA_TA 0x01 - -#define ISAC_RSTA_MASK 0x70 /* the interesting bits */ - -#define ISAC_RBCH_XAC 0x80 -#define ISAC_RBCH_VN1 0x40 -#define ISAC_RBCH_VN0 0x20 -#define ISAC_RBCH_OV 0x10 -/* the other 4 bits are the high bits of the receive byte count */ - -#define ISAC_SPCR_SPU 0x80 -#define ISAC_SPCR_SAC 0x40 -#define ISAC_SPCR_SPM 0x20 -#define ISAC_SPCR_TLP 0x10 -#define ISAC_SPCR_C1C1 0x08 -#define ISAC_SPCR_C1C0 0x04 -#define ISAC_SPCR_C2C1 0x02 -#define ISAC_SPCR_C2C0 0x01 - -#define ISAC_CIRR_SQC 0x80 -#define ISAC_CIRR_BAS 0x40 -/* bits 5-2 CODR */ -#define ISAC_CIRR_CIC0 0x02 -/* bit 0 is always 0 */ -/* C/I codes from bits 5-2 (>> 2 & 0xf) */ -/* the indications */ -#define ISAC_CIRR_IPU 0x07 -#define ISAC_CIRR_IDR 0x00 -#define ISAC_CIRR_ISD 0x02 -#define ISAC_CIRR_IDIS 0x03 -#define ISAC_CIRR_IEI 0x06 -#define ISAC_CIRR_IRSY 0x04 -#define ISAC_CIRR_IARD 0x08 -#define ISAC_CIRR_ITI 0x0a -#define ISAC_CIRR_IATI 0x0b -#define ISAC_CIRR_IAI8 0x0c -#define ISAC_CIRR_IAI10 0x0d -#define ISAC_CIRR_IDID 0x0f - -#define ISAC_CI_MASK 0x0f - -#define ISAC_CIXR_RSS 0x80 -#define ISAC_CIXR_BAC 0x40 -/* bits 5-2 CODX */ -#define ISAC_CIXR_TCX 0x02 -#define ISAC_CIXR_ECX 0x01 -/* in IOM-2 mode the low bits are always 1 */ -#define ISAC_CIX0_LOW 0x03 -/* C/I codes from bits 5-2 (>> 2 & 0xf) */ -/* the commands */ -#define ISAC_CIXR_CTIM 0 -#define ISAC_CIXR_CRS 0x01 -#define ISAC_CIXR_CSCZ 0x04 -#define ISAC_CIXR_CSSZ 0x02 -#define ISAC_CIXR_CAR8 0x08 -#define ISAC_CIXR_CAR10 0x09 -#define ISAC_CIXR_CARL 0x0a -#define ISAC_CIXR_CDIU 0x0f - -#define ISAC_STCR_TSF 0x80 -#define ISAC_STCR_TBA2 0x40 -#define ISAC_STCR_TBA1 0x20 -#define ISAC_STCR_TBA0 0x10 -#define ISAC_STCR_ST1 0x08 -#define ISAC_STCR_ST0 0x04 -#define ISAC_STCR_SC1 0x02 -#define ISAC_STCR_SC0 0x01 - -#define ISAC_ADF1_WTC1 0x80 -#define ISAC_ADF1_WTC2 0x40 -#define ISAC_ADF1_TEM 0x20 -#define ISAC_ADF1_PFS 0x10 -#define ISAC_ADF1_CFS 0x08 -#define ISAC_ADF1_FC2 0x04 -#define ISAC_ADF1_FC1 0x02 -#define ISAC_ADF1_ITF 0x01 - -#define ISAC_ADF2_IMS 0x80 -/* all other bits are 0 */ - -/* bits 7-5 are always 0 */ -#define ISAC_SQRR_SYN 0x10 -#define ISAC_SQRR_SQR1 0x08 -#define ISAC_SQRR_SQR2 0x04 -#define ISAC_SQRR_SQR3 0x02 -#define ISAC_SQRR_SQR4 0x01 - -#define ISAC_SQXR_IDC 0x80 -#define ISAC_SQXR_CFS 0x40 -#define ISAC_SQXR_CI1E 0x20 -#define ISAC_SQXR_SQIE 0x10 -#define ISAC_SQXR_SQX1 0x08 -#define ISAC_SQXR_SQX2 0x04 -#define ISAC_SQXR_SQX3 0x02 -#define ISAC_SQXR_SQX4 0x01 - -#endif /* I4B_ISAC_H_ */ diff --git a/sys/i4b/layer1/isic/i4b_isic.c b/sys/i4b/layer1/isic/i4b_isic.c deleted file mode 100644 index 4b9af7478b06..000000000000 --- a/sys/i4b/layer1/isic/i4b_isic.c +++ /dev/null @@ -1,494 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_isic.c - global isic stuff - * ============================== - * last edit-date: [Wed Jan 24 09:29:42 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include - -static char *ISACversion[] = { - "2085 Version A1/A2 or 2086/2186 Version 1.1", - "2085 Version B1", - "2085 Version B2", - "2085 Version V2.3 (B3)", - "Unknown Version" -}; - -static char *HSCXversion[] = { - "82525 Version A1", - "Unknown (0x01)", - "82525 Version A2", - "Unknown (0x03)", - "82525 Version A3", - "82525 or 21525 Version 2.1", - "Unknown Version" -}; - -/* jump table for multiplex routines */ -struct i4b_l1mux_func isic_l1mux_func = { - isic_ret_linktab, - isic_set_linktab, - isic_mph_command_req, - isic_ph_data_req, - isic_ph_activate_req, -}; - -/*---------------------------------------------------------------------------* - * isic - device driver interrupt routine - *---------------------------------------------------------------------------*/ -void -isicintr(struct l1_softc *sc) -{ - if(sc->sc_ipac == 0) /* HSCX/ISAC interrupt routine */ - { - u_char was_hscx_irq = 0; - u_char was_isac_irq = 0; - - register u_char hscx_irq_stat; - register u_char isac_irq_stat; - - for(;;) - { - /* get hscx irq status from hscx b ista */ - hscx_irq_stat = - HSCX_READ(HSCX_CH_B, H_ISTA) & ~HSCX_B_IMASK; - - /* get isac irq status */ - isac_irq_stat = ISAC_READ(I_ISTA); - - /* do as long as there are pending irqs in the chips */ - if(!hscx_irq_stat && !isac_irq_stat) - break; - - if(hscx_irq_stat & (HSCX_ISTA_RME | HSCX_ISTA_RPF | - HSCX_ISTA_RSC | HSCX_ISTA_XPR | - HSCX_ISTA_TIN | HSCX_ISTA_EXB)) - { - isic_hscx_irq(sc, hscx_irq_stat, - HSCX_CH_B, - hscx_irq_stat & HSCX_ISTA_EXB); - was_hscx_irq = 1; - } - - if(hscx_irq_stat & (HSCX_ISTA_ICA | HSCX_ISTA_EXA)) - { - isic_hscx_irq(sc, - HSCX_READ(HSCX_CH_A, H_ISTA) & ~HSCX_A_IMASK, - HSCX_CH_A, - hscx_irq_stat & HSCX_ISTA_EXA); - was_hscx_irq = 1; - } - - if(isac_irq_stat) - { - isic_isac_irq(sc, isac_irq_stat); /* isac handler */ - was_isac_irq = 1; - } - } - - HSCX_WRITE(0, H_MASK, 0xff); - ISAC_WRITE(I_MASK, 0xff); - HSCX_WRITE(1, H_MASK, 0xff); - -#ifdef ELSA_QS1ISA - DELAY(80); - - if((sc->sc_cardtyp == CARD_TYPEP_ELSAQS1ISA) && (sc->clearirq)) - { - sc->clearirq(sc); - } -#else - DELAY(100); -#endif - - HSCX_WRITE(0, H_MASK, HSCX_A_IMASK); - ISAC_WRITE(I_MASK, ISAC_IMASK); - HSCX_WRITE(1, H_MASK, HSCX_B_IMASK); - } - else /* IPAC interrupt routine */ - { - register u_char ipac_irq_stat; - register u_char was_ipac_irq = 0; - - for(;;) - { - /* get global irq status */ - - ipac_irq_stat = (IPAC_READ(IPAC_ISTA)) & 0x3f; - - /* check hscx a */ - - if(ipac_irq_stat & (IPAC_ISTA_ICA | IPAC_ISTA_EXA)) - { - /* HSCX A interrupt */ - isic_hscx_irq(sc, HSCX_READ(HSCX_CH_A, H_ISTA), - HSCX_CH_A, - ipac_irq_stat & IPAC_ISTA_EXA); - was_ipac_irq = 1; - } - if(ipac_irq_stat & (IPAC_ISTA_ICB | IPAC_ISTA_EXB)) - { - /* HSCX B interrupt */ - isic_hscx_irq(sc, HSCX_READ(HSCX_CH_B, H_ISTA), - HSCX_CH_B, - ipac_irq_stat & IPAC_ISTA_EXB); - was_ipac_irq = 1; - } - if(ipac_irq_stat & IPAC_ISTA_ICD) - { - /* ISAC interrupt */ - isic_isac_irq(sc, ISAC_READ(I_ISTA)); - was_ipac_irq = 1; - } - if(ipac_irq_stat & IPAC_ISTA_EXD) - { - /* force ISAC interrupt handling */ - isic_isac_irq(sc, ISAC_ISTA_EXI); - was_ipac_irq = 1; - } - - /* do as long as there are pending irqs in the chip */ - if(!ipac_irq_stat) - break; - } - - IPAC_WRITE(IPAC_MASK, 0xff); - DELAY(50); - IPAC_WRITE(IPAC_MASK, 0xc0); - } -} - -/*---------------------------------------------------------------------------* - * isic_recover - try to recover from irq lockup - *---------------------------------------------------------------------------*/ -void -isic_recover(struct l1_softc *sc) -{ - u_char byte; - - /* get hscx irq status from hscx b ista */ - - byte = HSCX_READ(HSCX_CH_B, H_ISTA); - - NDBGL1(L1_ERROR, "HSCX B: ISTA = 0x%x", byte); - - if(byte & HSCX_ISTA_ICA) - NDBGL1(L1_ERROR, "HSCX A: ISTA = 0x%x", (u_char)HSCX_READ(HSCX_CH_A, H_ISTA)); - - if(byte & HSCX_ISTA_EXB) - NDBGL1(L1_ERROR, "HSCX B: EXIR = 0x%x", (u_char)HSCX_READ(HSCX_CH_B, H_EXIR)); - - if(byte & HSCX_ISTA_EXA) - NDBGL1(L1_ERROR, "HSCX A: EXIR = 0x%x", (u_char)HSCX_READ(HSCX_CH_A, H_EXIR)); - - /* get isac irq status */ - - byte = ISAC_READ(I_ISTA); - - NDBGL1(L1_ERROR, " ISAC: ISTA = 0x%x", byte); - - if(byte & ISAC_ISTA_EXI) - NDBGL1(L1_ERROR, " ISAC: EXIR = 0x%x", (u_char)ISAC_READ(I_EXIR)); - - if(byte & ISAC_ISTA_CISQ) - { - byte = ISAC_READ(I_CIRR); - - NDBGL1(L1_ERROR, " ISAC: CISQ = 0x%x", byte); - - if(byte & ISAC_CIRR_SQC) - NDBGL1(L1_ERROR, " ISAC: SQRR = 0x%x", (u_char)ISAC_READ(I_SQRR)); - } - - NDBGL1(L1_ERROR, "HSCX B: IMASK = 0x%x", HSCX_B_IMASK); - NDBGL1(L1_ERROR, "HSCX A: IMASK = 0x%x", HSCX_A_IMASK); - - HSCX_WRITE(0, H_MASK, 0xff); - HSCX_WRITE(1, H_MASK, 0xff); - DELAY(100); - HSCX_WRITE(0, H_MASK, HSCX_A_IMASK); - HSCX_WRITE(1, H_MASK, HSCX_B_IMASK); - DELAY(100); - - NDBGL1(L1_ERROR, " ISAC: IMASK = 0x%x", ISAC_IMASK); - - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - ISAC_WRITE(I_MASK, ISAC_IMASK); -} - -/*---------------------------------------------------------------------------* - * isic_attach_common - common attach routine for all busses - *---------------------------------------------------------------------------*/ -int -isic_attach_common(device_t dev) -{ - char *drvid = NULL; - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - - sc->sc_unit = unit; - - sc->sc_isac_version = 0; - sc->sc_hscx_version = 0; - - if(sc->sc_ipac) - { - sc->sc_ipac_version = IPAC_READ(IPAC_ID); - - switch(sc->sc_ipac_version) - { - case IPAC_V11: - case IPAC_V12: - break; - - default: - printf("isic%d: Error, IPAC version %d unknown!\n", - unit, sc->sc_ipac_version); - return(0); - break; - } - } - else - { - sc->sc_isac_version = ((ISAC_READ(I_RBCH)) >> 5) & 0x03; - - switch(sc->sc_isac_version) - { - case ISAC_VA: - case ISAC_VB1: - case ISAC_VB2: - case ISAC_VB3: - break; - - default: - printf("isic%d: Error, ISAC version %d unknown!\n", - unit, sc->sc_isac_version); - return ENXIO; - break; - } - - sc->sc_hscx_version = HSCX_READ(0, H_VSTR) & 0xf; - - switch(sc->sc_hscx_version) - { - case HSCX_VA1: - case HSCX_VA2: - case HSCX_VA3: - case HSCX_V21: - break; - - default: - printf("isic%d: Error, HSCX version %d unknown!\n", - unit, sc->sc_hscx_version); - return ENXIO; - break; - } - } - - isic_isac_init(sc); /* ISAC setup */ - - /* HSCX setup */ - - isic_bchannel_setup(sc->sc_unit, HSCX_CH_A, BPROT_NONE, 0); - - isic_bchannel_setup(sc->sc_unit, HSCX_CH_B, BPROT_NONE, 0); - - isic_init_linktab(sc); /* setup linktab */ - - sc->sc_trace = TRACE_OFF; /* set trace level */ - - sc->sc_state = ISAC_IDLE; /* set state */ - - sc->sc_ibuf = NULL; /* input buffering */ - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - sc->sc_obuf = NULL; /* output buffering */ - sc->sc_op = NULL; - sc->sc_ol = 0; - sc->sc_freeflag = 0; - - sc->sc_obuf2 = NULL; /* second output buffer */ - sc->sc_freeflag2 = 0; - - /* timer setup */ - - callout_handle_init(&sc->sc_T3_callout); - callout_handle_init(&sc->sc_T4_callout); - - /* init higher protocol layers */ - - i4b_l1_mph_status_ind(L0ISICUNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &isic_l1mux_func); - - /* announce manufacturer and card type for ISA cards */ - - switch(sc->sc_cardtyp) - { - case CARD_TYPEP_8: - drvid = "Teles S0/8 (or compatible)"; - break; - - case CARD_TYPEP_16: - drvid = "Teles S0/16 (or compatible)"; - break; - - case CARD_TYPEP_16_3: - drvid = "Teles S0/16.3"; - break; - - case CARD_TYPEP_AVMA1: - drvid = "AVM A1 or Fritz!Card Classic"; - break; - - case CARD_TYPEP_PCFRITZ: - drvid = "AVM Fritz!Card PCMCIA"; - break; - - case CARD_TYPEP_USRTA: - drvid = "USRobotics Sportster ISDN TA intern"; - break; - - case CARD_TYPEP_ITKIX1: - drvid = "ITK ix1 micro"; - break; - - case CARD_TYPEP_PCC16: - drvid = "ELSA MicroLink ISDN/PCC-16"; - break; - - default: - drvid = NULL; /* pnp/pci cards announce themselves */ - break; - } - - if(drvid) - printf("isic%d: %s\n", unit, drvid); - - if(bootverbose) - { - /* announce chip versions */ - - if(sc->sc_ipac) - { - if(sc->sc_ipac_version == IPAC_V11) - printf("isic%d: IPAC PSB2115 Version 1.1\n", unit); - else - printf("isic%d: IPAC PSB2115 Version 1.2\n", unit); - } - else - { - printf("isic%d: ISAC %s (IOM-%c)\n", - unit, - ISACversion[sc->sc_isac_version], - sc->sc_bustyp == BUS_TYPE_IOM1 ? '1' : '2'); - - printf("isic%d: HSCX %s\n", - unit, - HSCXversion[sc->sc_hscx_version]); - } - } - return 0; -} - -/*---------------------------------------------------------------------------* - * isic_detach_common - common detach routine for all busses - *---------------------------------------------------------------------------*/ -void -isic_detach_common(device_t dev) -{ - struct l1_softc *sc = &l1_sc[device_get_unit(dev)]; - int i; - - sc->sc_cardtyp = CARD_TYPEP_UNK; - - /* free interrupt resources */ - - if(sc->sc_resources.irq) - { - /* tear down interrupt handler */ - bus_teardown_intr(dev, sc->sc_resources.irq, - (void(*)(void *))isicintr); - - /* free irq */ - bus_release_resource(dev, SYS_RES_IRQ, - sc->sc_resources.irq_rid, - sc->sc_resources.irq); - sc->sc_resources.irq_rid = 0; - sc->sc_resources.irq = 0; - } - - /* free memory resource */ - - if(sc->sc_resources.mem) - { - bus_release_resource(dev,SYS_RES_MEMORY, - sc->sc_resources.mem_rid, - sc->sc_resources.mem); - sc->sc_resources.mem_rid = 0; - sc->sc_resources.mem = 0; - } - - /* free iobases */ - - for(i=0; i < INFO_IO_BASES ; i++) - { - if(sc->sc_resources.io_base[i]) - { - bus_release_resource(dev, SYS_RES_IOPORT, - sc->sc_resources.io_rid[i], - sc->sc_resources.io_base[i]); - sc->sc_resources.io_rid[i] = 0; - sc->sc_resources.io_base[i] = 0; - } - } -} diff --git a/sys/i4b/layer1/isic/i4b_isic.h b/sys/i4b/layer1/isic/i4b_isic.h deleted file mode 100644 index d4c3bcec22a6..000000000000 --- a/sys/i4b/layer1/isic/i4b_isic.h +++ /dev/null @@ -1,330 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*---------------------------------------------------------------------------* - * - * i4b_l1.h - isdn4bsd layer 1 header file - * --------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Fri Jan 26 13:55:12 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_ISIC_H_ -#define _I4B_ISIC_H_ - -#include -#include -#include -#include -#include - -#include - -#include - -/*--------------------------------------------------------------------------- - * isic driver: max no of units - * Teles/Creatix/Neuhaus cards have a hardware limitation - * as one is able to set 3 (sometimes 4) different configurations by - * jumpers so a maximum of 3 (4) cards per ISA bus is possible. - *---------------------------------------------------------------------------*/ -#define ISIC_MAXUNIT 3 /* max no of supported units 0..3 */ - -#define INFO_IO_BASES 50 /* 49 needed for USR */ - -struct i4b_info { - struct resource * io_base[INFO_IO_BASES]; - int io_rid [INFO_IO_BASES]; - struct resource * irq; - int irq_rid; - struct resource * mem; - int mem_rid; -}; - -/*---------------------------------------------------------------------------* - * l1_bchan_state: the state of one B channel - *---------------------------------------------------------------------------*/ -typedef struct -{ - int unit; /* cards unit number */ - int channel; /* which channel is this*/ - caddr_t hscx; /* HSCX address */ - u_char hscx_mask; /* HSCX interrupt mask */ - int bprot; /* B channel protocol */ - int state; /* this channels state */ -#define HSCX_IDLE 0x00 /* channel idle */ -#define HSCX_TX_ACTIVE 0x01 /* tx running */ - - /* receive data from ISDN */ - - struct ifqueue rx_queue; /* receiver queue */ - - int rxcount; /* rx statistics counter*/ - - struct mbuf *in_mbuf; /* rx input buffer */ - u_char *in_cbptr; /* curr buffer pointer */ - int in_len; /* rx input buffer len */ - - /* transmit data to ISDN */ - - struct ifqueue tx_queue; /* transmitter queue */ - - int txcount; /* tx statistics counter*/ - - struct mbuf *out_mbuf_head; /* first mbuf in possible chain */ - struct mbuf *out_mbuf_cur; /* current mbuf in possbl chain */ - unsigned char *out_mbuf_cur_ptr; /* data pointer into mbuf */ - int out_mbuf_cur_len; /* remaining bytes in mbuf */ - - /* link between b channel and driver */ - - isdn_link_t isic_isdn_linktab; /* b channel addresses */ - drvr_link_t *isic_drvr_linktab; /* ptr to driver linktab*/ - - /* statistics */ - - /* RSTA */ - - int stat_VFR; /* HSCX RSTA Valid FRame */ - int stat_RDO; /* HSCX RSTA Rx Data Overflow */ - int stat_CRC; /* HSCX RSTA CRC */ - int stat_RAB; /* HSCX RSTA Rx message ABorted */ - - /* EXIR */ - - int stat_XDU; /* HSCX EXIR tx data underrun */ - int stat_RFO; /* HSCX EXIR rx frame overflow */ - -} l1_bchan_state_t; - -/*---------------------------------------------------------------------------* - * l1_softc: the state of the layer 1 of the D channel - *---------------------------------------------------------------------------*/ -struct l1_softc -{ - int sc_unit; /* unit number */ - int sc_irq; /* interrupt vector */ - struct i4b_info sc_resources; - - int sc_port; /* port base address */ - - int sc_cardtyp; /* CARD_TYPEP_xxxx */ - - int sc_bustyp; /* IOM1 or IOM2 */ -#define BUS_TYPE_IOM1 0x01 -#define BUS_TYPE_IOM2 0x02 - - int sc_trace; /* output protocol data for tracing */ - unsigned int sc_trace_dcount;/* d channel trace frame counter */ - unsigned int sc_trace_bcount;/* b channel trace frame counter */ - - int sc_state; /* ISAC state flag */ -#define ISAC_IDLE 0x00 /* state = idle */ -#define ISAC_TX_ACTIVE 0x01 /* state = transmitter active */ - - int sc_init_tries; /* no of out tries to access S0 */ - - caddr_t sc_vmem_addr; /* card RAM virtual memory base */ - caddr_t sc_isac; /* ISAC port base addr */ -#define ISAC_BASE (sc->sc_isac) - - caddr_t sc_ipacbase; /* IPAC port base addr */ -#define IPAC_BASE (sc->sc_ipacbase) - - u_char sc_isac_mask; /* ISAC IRQ mask */ -#define ISAC_IMASK (sc->sc_isac_mask) - - l1_bchan_state_t sc_chan[2]; /* B-channel state */ -#define HSCX_A_BASE (sc->sc_chan[0].hscx) -#define HSCX_A_IMASK (sc->sc_chan[0].hscx_mask) -#define HSCX_B_BASE (sc->sc_chan[1].hscx) -#define HSCX_B_IMASK (sc->sc_chan[1].hscx_mask) - - struct mbuf *sc_ibuf; /* input buffer mgmt */ - u_short sc_ilen; - u_char *sc_ib; - /* this is for the irq TX routine */ - struct mbuf *sc_obuf; /* pointer to an mbuf with TX frame */ - u_char *sc_op; /* ptr to next chunk of frame to tx */ - int sc_ol; /* length of remaining frame to tx */ - int sc_freeflag; /* m_freem mbuf if set */ - - struct mbuf *sc_obuf2; /* pointer to an mbuf with TX frame */ - int sc_freeflag2; /* m_freem mbuf if set */ - - int sc_isac_version; /* version number of ISAC */ - int sc_hscx_version; /* version number of HSCX */ - int sc_ipac_version; /* version number of IPAC */ - - int sc_I430state; /* I.430 state F3 .... F8 */ - - int sc_I430T3; /* I.430 Timer T3 running */ - - struct callout_handle sc_T3_callout; - - int sc_I430T4; /* Timer T4 running */ - - struct callout_handle sc_T4_callout; - - /* - * byte fields for the AVM Fritz!Card PCI. These are packed into - * a u_int in the driver. - */ - u_char avma1pp_cmd; - u_char avma1pp_txl; - u_char avma1pp_prot; - - int sc_enabled; /* daemon is running */ - - int sc_ipac; /* flag, running on ipac */ - int sc_bfifolen; /* length of b channel fifos */ - -#define ISIC_WHAT_ISAC 0 -#define ISIC_WHAT_HSCXA 1 -#define ISIC_WHAT_HSCXB 2 -#define ISIC_WHAT_IPAC 3 - - u_int8_t (*readreg) (struct l1_softc *sc, int what, bus_size_t offs); - void (*writereg) (struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data); - void (*readfifo) (struct l1_softc *sc, int what, void *buf, size_t size); - void (*writefifo) (struct l1_softc *sc, int what, void *data, size_t size); - void (*clearirq) (struct l1_softc *sc); - -#define ISAC_READ(r) (*sc->readreg)(sc, ISIC_WHAT_ISAC, (r)) -#define ISAC_WRITE(r,v) (*sc->writereg)(sc, ISIC_WHAT_ISAC, (r), (v)) -#define ISAC_RDFIFO(b,s) (*sc->readfifo)(sc, ISIC_WHAT_ISAC, (b), (s)) -#define ISAC_WRFIFO(b,s) (*sc->writefifo)(sc, ISIC_WHAT_ISAC, (b), (s)) - -#define HSCX_READ(n,r) (*sc->readreg)(sc, ISIC_WHAT_HSCXA+(n), (r)) -#define HSCX_WRITE(n,r,v) (*sc->writereg)(sc, ISIC_WHAT_HSCXA+(n), (r), (v)) -#define HSCX_RDFIFO(n,b,s) (*sc->readfifo)(sc, ISIC_WHAT_HSCXA+(n), (b), (s)) -#define HSCX_WRFIFO(n,b,s) (*sc->writefifo)(sc, ISIC_WHAT_HSCXA+(n), (b), (s)) - -#define IPAC_READ(r) (*sc->readreg)(sc, ISIC_WHAT_IPAC, (r)) -#define IPAC_WRITE(r, v) (*sc->writereg)(sc, ISIC_WHAT_IPAC, (r), (v)) -}; - -/*---------------------------------------------------------------------------* - * possible I.430/ISAC states - *---------------------------------------------------------------------------*/ -enum I430states { - ST_F3, /* F3 Deactivated */ - ST_F4, /* F4 Awaiting Signal */ - ST_F5, /* F5 Identifying Input */ - ST_F6, /* F6 Synchronized */ - ST_F7, /* F7 Activated */ - ST_F8, /* F8 Lost Framing */ - ST_ILL, /* Illegal State */ - N_STATES -}; - -/*---------------------------------------------------------------------------* - * possible I.430/ISAC events - *---------------------------------------------------------------------------*/ -enum I430events { - EV_PHAR, /* PH ACTIVATE REQUEST */ - EV_T3, /* Timer 3 expired */ - EV_INFO0, /* receiving INFO0 */ - EV_RSY, /* receiving any signal */ - EV_INFO2, /* receiving INFO2 */ - EV_INFO48, /* receiving INFO4 pri 8/9 */ - EV_INFO410, /* receiving INFO4 pri 10/11 */ - EV_DR, /* Deactivate Request */ - EV_PU, /* Power UP */ - EV_DIS, /* Disconnected (only 2085) */ - EV_EI, /* Error Indication */ - EV_ILL, /* Illegal Event */ - N_EVENTS -}; - -enum I430commands { - CMD_TIM, /* Timing */ - CMD_RS, /* Reset */ - CMD_AR8, /* Activation request pri 8 */ - CMD_AR10, /* Activation request pri 10 */ - CMD_DIU, /* Deactivate Indication Upstream */ - CMD_ILL /* Illegal command */ -}; - -#define N_COMMANDS CMD_ILL - -extern struct l1_softc l1_sc[]; - -extern void isicintr(struct l1_softc *sc); -extern int isic_attach_common(device_t dev); -extern void isic_detach_common(device_t dev); -extern void isic_recover(struct l1_softc *sc); - -extern void isic_bchannel_setup (int unit, int hscx_channel, int bprot, int activate ); - -extern void isic_init_linktab ( struct l1_softc *sc ); -extern int isic_isac_init ( struct l1_softc *sc ); -extern void isic_isac_irq ( struct l1_softc *sc, int r ); -extern void isic_isac_l1_cmd ( struct l1_softc *sc, int command ); -extern void isic_next_state ( struct l1_softc *sc, int event ); -extern char *isic_printstate ( struct l1_softc *sc ); - -extern int isic_hscx_fifo(l1_bchan_state_t *, struct l1_softc *); -extern void isic_hscx_init ( struct l1_softc *sc, int hscx_channel, int activate ); -extern void isic_hscx_irq ( struct l1_softc *sc, u_char ista, int hscx_channel, u_char ex_irq ); -extern int isic_hscx_silence ( unsigned char *data, int len ); -extern void isic_hscx_cmd( struct l1_softc *sc, int h_chan, unsigned char cmd ); -extern void isic_hscx_waitxfw( struct l1_softc *sc, int h_chan ); - -extern int isic_probe_s016 (device_t dev); -extern int isic_attach_s016 (device_t dev); - -extern int isic_probe_s08 (device_t dev); -extern int isic_attach_s08 (device_t dev); - -extern int isic_probe_Epcc16 (device_t dev); -extern int isic_attach_Epcc16 (device_t dev); - -extern int isic_probe_s0163 (device_t dev); -extern int isic_attach_s0163 (device_t dev); - -extern int isic_probe_avma1 (device_t dev); -extern int isic_attach_avma1 (device_t dev); - -extern int isic_probe_usrtai (device_t dev); -extern int isic_attach_usrtai (device_t dev); - -extern int isic_probe_itkix1 (device_t dev); -extern int isic_attach_itkix1 (device_t dev); - -extern int isic_attach_drnngo (device_t dev); -extern int isic_attach_Cs0P (device_t dev); -extern int isic_attach_Eqs1pi(device_t dev); -extern int isic_attach_sws(device_t dev); -extern int isic_attach_siemens_isurf(device_t dev); -extern int isic_attach_asi(device_t dev); -extern int isic_attach_Dyn(device_t dev); -extern int isic_attach_diva(device_t dev); -extern int isic_attach_diva_ipac(device_t dev); - -#endif /* _I4B_ISIC_H_ */ diff --git a/sys/i4b/layer1/isic/i4b_isic_ext.h b/sys/i4b/layer1/isic/i4b_isic_ext.h deleted file mode 100644 index ad99114f71ef..000000000000 --- a/sys/i4b/layer1/isic/i4b_isic_ext.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*---------------------------------------------------------------------------* - * - * i4b_l1.h - isdn4bsd layer 1 header file - * --------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Wed Jan 24 09:11:12 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_ISIC_EXT_H_ -#define _I4B_ISIC_EXT_H_ - -#include - -int isic_ph_data_req(int unit, struct mbuf *m, int freeflag); -int isic_ph_activate_req(int unit); -int isic_mph_command_req(int unit, int command, void *parm); - -void isic_set_linktab(int unit, int channel, drvr_link_t *dlt); -isdn_link_t *isic_ret_linktab(int unit, int channel); - -#endif /* _I4B_ISIC_H_ */ diff --git a/sys/i4b/layer1/isic/i4b_isic_isa.c b/sys/i4b/layer1/isic/i4b_isic_isa.c deleted file mode 100644 index 6d88caad42b5..000000000000 --- a/sys/i4b/layer1/isic/i4b_isic_isa.c +++ /dev/null @@ -1,207 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_isic_isa.c - ISA bus interface - * ================================== - * last edit-date: [Wed Jan 24 09:30:19 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -struct l1_softc l1_sc[ISIC_MAXUNIT]; - -static int isic_isa_probe(device_t dev); -static int isic_isa_attach(device_t dev); - -static device_method_t isic_methods[] = { - DEVMETHOD(device_probe, isic_isa_probe), - DEVMETHOD(device_attach, isic_isa_attach), - { 0, 0 } -}; - -static driver_t isic_driver = { - "isic", - isic_methods, - 0 -}; - -static devclass_t isic_devclass; - -DRIVER_MODULE(isic, isa, isic_driver, isic_devclass, 0, 0); - -/*---------------------------------------------------------------------------* - * probe for ISA non-PnP cards - *---------------------------------------------------------------------------*/ -static int -isic_isa_probe(device_t dev) -{ - int ret = ENXIO; - - if(isa_get_vendorid(dev)) /* no PnP probes here */ - return ENXIO; - - switch(device_get_flags(dev)) - { -#ifdef TEL_S0_16 - case CARD_TYPEP_16: - ret = isic_probe_s016(dev); - break; -#endif - -#ifdef TEL_S0_8 - case CARD_TYPEP_8: - ret = isic_probe_s08(dev); - break; -#endif - -#ifdef ELSA_PCC16 - case CARD_TYPEP_PCC16: - ret = isic_probe_Epcc16(dev); - break; -#endif - -#ifdef TEL_S0_16_3 - case CARD_TYPEP_16_3: - ret = isic_probe_s0163(dev); - break; -#endif - -#ifdef AVM_A1 - case CARD_TYPEP_AVMA1: - ret = isic_probe_avma1(dev); - break; -#endif - -#ifdef USR_STI - case CARD_TYPEP_USRTA: - ret = isic_probe_usrtai(dev); - break; -#endif - -#ifdef ITKIX1 - case CARD_TYPEP_ITKIX1: - ret = isic_probe_itkix1(dev); - break; -#endif - - default: - printf("isic%d: probe, unknown flag: %d\n", - device_get_unit(dev), device_get_flags(dev)); - break; - } - return(ret); -} - -/*---------------------------------------------------------------------------* - * attach for ISA non-PnP cards - *---------------------------------------------------------------------------*/ -static int -isic_isa_attach(device_t dev) -{ - int ret = ENXIO; - - struct l1_softc *sc = &l1_sc[device_get_unit(dev)]; - - sc->sc_unit = device_get_unit(dev); - - /* card dependent setup */ - - switch(sc->sc_cardtyp) - { -#ifdef TEL_S0_16 - case CARD_TYPEP_16: - ret = isic_attach_s016(dev); - break; -#endif - -#ifdef TEL_S0_8 - case CARD_TYPEP_8: - ret = isic_attach_s08(dev); - break; -#endif - -#ifdef ELSA_PCC16 - case CARD_TYPEP_PCC16: - ret = isic_attach_Epcc16(dev); - break; -#endif - -#ifdef TEL_S0_16_3 - case CARD_TYPEP_16_3: - ret = isic_attach_s0163(dev); - break; -#endif - -#ifdef AVM_A1 - case CARD_TYPEP_AVMA1: - ret = isic_attach_avma1(dev); - break; -#endif - -#ifdef USR_STI - case CARD_TYPEP_USRTA: - ret = isic_attach_usrtai(dev); - break; -#endif - -#ifdef ITKIX1 - case CARD_TYPEP_ITKIX1: - ret = isic_attach_itkix1(dev); - break; -#endif - - default: - printf("isic%d: attach, unknown flag: %d\n", - device_get_unit(dev), device_get_flags(dev)); - break; - } - - if(ret) - return(ret); - - ret = isic_attach_common(dev); - - return(ret); -} diff --git a/sys/i4b/layer1/isic/i4b_isic_pnp.c b/sys/i4b/layer1/isic/i4b_isic_pnp.c deleted file mode 100644 index 2a4542774745..000000000000 --- a/sys/i4b/layer1/isic/i4b_isic_pnp.c +++ /dev/null @@ -1,333 +0,0 @@ -/*- - * Copyright (c) 1998 Eivind Eklund. All rights reserved. - * - * Copyright (c) 1998, 1999 German Tischler. All rights reserved. - * - * Copyright (c) 1998, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_isic_pnp.c - i4b pnp support - * -------------------------------- - * last edit-date: [Fri Jan 26 14:01:04 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#define VID_TEL163PNP 0x10212750 /* Teles 16.3 PnP */ -#define VID_CREATIXPP 0x0000980e /* Creatix S0/16 P+P */ -#define VID_DYNALINK 0x88167506 /* Dynalink */ -#define VID_SEDLBAUER 0x0100274c /* Sedlbauer WinSpeed */ -#define VID_NICCYGO 0x5001814c /* Neuhaus Niccy GO@ */ -#define VID_ELSAQS1P 0x33019315 /* ELSA Quickstep1000pro*/ -#define VID_ITK0025 0x25008b26 /* ITK Ix1 Micro V3 */ -#define VID_AVMPNP 0x0009cd06 /* AVM Fritz! PnP */ -#define VID_SIESURF2 0x2000254d /* Siemens I-Surf 2.0 PnP*/ -#define VID_ASUSCOM_IPAC 0x90167506 /* Asuscom (with IPAC) */ -#define VID_EICON_DIVA_20 0x7100891c /* Eicon DIVA 2.0 ISAC/HSCX */ -#define VID_EICON_DIVA_202 0xa100891c /* Eicon DIVA 2.02 IPAC */ -#define VID_COMPAQ_M610 0x0210110e /* Compaq Microcom 610 */ - -static struct isic_pnp_ids { - u_long vend_id; - char *id_str; -} isic_pnp_ids[] = { -#if defined(TEL_S0_16_3_P) || defined(CRTX_S0_P) || defined(COMPAQ_M610) - { VID_TEL163PNP, "Teles S0/16.3 PnP" }, - { VID_CREATIXPP, "Creatix S0/16 PnP" }, - { VID_COMPAQ_M610, "Compaq Microcom 610" }, -#endif -#ifdef DYNALINK - { VID_DYNALINK, "Dynalink IS64PH" }, -#endif -#ifdef SEDLBAUER - { VID_SEDLBAUER, "Sedlbauer WinSpeed" }, -#endif -#ifdef DRN_NGO - { VID_NICCYGO, "Dr.Neuhaus Niccy Go@" }, -#endif -#ifdef ELSA_QS1ISA - { VID_ELSAQS1P, "ELSA QuickStep 1000pro" }, -#endif -#ifdef ITKIX1 - { VID_ITK0025, "ITK ix1 Micro V3.0" }, -#endif -#ifdef AVM_PNP - { VID_AVMPNP, "AVM Fritz!Card PnP" }, -#endif -#ifdef SIEMENS_ISURF2 - { VID_SIESURF2, "Siemens I-Surf 2.0 PnP" }, -#endif -#ifdef ASUSCOM_IPAC - { VID_ASUSCOM_IPAC, "Asuscom ISDNLink 128 PnP" }, -#endif -#ifdef EICON_DIVA - { VID_EICON_DIVA_20, "Eicon.Diehl DIVA 2.0 ISA PnP" }, - { VID_EICON_DIVA_202, "Eicon.Diehl DIVA 2.02 ISA PnP" }, -#endif - { 0, 0 } -}; - -static int isic_pnp_probe(device_t dev); -static int isic_pnp_attach(device_t dev); - -static device_method_t isic_pnp_methods[] = { - DEVMETHOD(device_probe, isic_pnp_probe), - DEVMETHOD(device_attach, isic_pnp_attach), - { 0, 0 } -}; - -static driver_t isic_pnp_driver = { - "isic", - isic_pnp_methods, - 0, -}; - -static devclass_t isic_devclass; - -DRIVER_MODULE(isicpnp, isa, isic_pnp_driver, isic_devclass, 0, 0); - -/*---------------------------------------------------------------------------* - * probe for ISA PnP cards - *---------------------------------------------------------------------------*/ -static int -isic_pnp_probe(device_t dev) -{ - struct isic_pnp_ids *ids; /* pnp id's */ - char *string = NULL; /* the name */ - u_int32_t vend_id = isa_get_vendorid(dev); /* vendor id */ - - /* search table of knowd id's */ - - for(ids = isic_pnp_ids; ids->vend_id != 0; ids++) - { - if(vend_id == ids->vend_id) - { - string = ids->id_str; - break; - } - } - - if(string) /* set name if we have one */ - { - device_set_desc(dev, string); /* set description */ - return 0; - } - else - { - return ENXIO; - } -} - -/*---------------------------------------------------------------------------* - * attach for ISA PnP cards - *---------------------------------------------------------------------------*/ -static int -isic_pnp_attach(device_t dev) -{ - u_int32_t vend_id = isa_get_vendorid(dev); /* vendor id */ - unsigned int unit = device_get_unit(dev); /* get unit */ - const char *name = device_get_desc(dev); /* get description */ - struct l1_softc *sc = 0; /* softc */ - void *ih = 0; /* a dummy */ - int ret; - - /* see if we are out of bounds */ - - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for %s\n", unit, unit, name); - return ENXIO; - } - - /* get information structure for this unit */ - - sc = &l1_sc[unit]; - - /* get io_base */ - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE ) )) - { - printf("isic_pnp_attach: Couldn't get my io_base.\n"); - return ENXIO; - } - - /* will not be used for pnp devices */ - - sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]); - - /* get irq, release io_base if we don't get it */ - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE))) - { - printf("isic%d: Could not get irq.\n",unit); - isic_detach_common(dev); - return ENXIO; - } - - /* not needed */ - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - - /* set flag so we know what this card is */ - - ret = ENXIO; - - switch(vend_id) - { -#if defined(TEL_S0_16_3_P) || defined(CRTX_S0_P) || defined(COMPAQ_M610) - case VID_TEL163PNP: - sc->sc_cardtyp = CARD_TYPEP_163P; - ret = isic_attach_Cs0P(dev); - break; - - case VID_CREATIXPP: - sc->sc_cardtyp = CARD_TYPEP_CS0P; - ret = isic_attach_Cs0P(dev); - break; - - case VID_COMPAQ_M610: - sc->sc_cardtyp = CARD_TYPEP_COMPAQ_M610; - ret = isic_attach_Cs0P(dev); - break; -#endif -#ifdef DYNALINK - case VID_DYNALINK: - sc->sc_cardtyp = CARD_TYPEP_DYNALINK; - ret = isic_attach_Dyn(dev); - break; -#endif -#ifdef SEDLBAUER - case VID_SEDLBAUER: - sc->sc_cardtyp = CARD_TYPEP_SWS; - ret = isic_attach_sws(dev); - break; -#endif -#ifdef DRN_NGO - case VID_NICCYGO: - sc->sc_cardtyp = CARD_TYPEP_DRNNGO; - ret = isic_attach_drnngo(dev); - break; -#endif -#ifdef ELSA_QS1ISA - case VID_ELSAQS1P: - sc->sc_cardtyp = CARD_TYPEP_ELSAQS1ISA; - ret = isic_attach_Eqs1pi(dev); - break; -#endif -#ifdef ITKIX1 - case VID_ITK0025: - sc->sc_cardtyp = CARD_TYPEP_ITKIX1; - ret = isic_attach_itkix1(dev); - break; -#endif -#ifdef SIEMENS_ISURF2 - case VID_SIESURF2: - sc->sc_cardtyp = CARD_TYPEP_SIE_ISURF2; - ret = isic_attach_siemens_isurf(dev); - break; -#endif -#ifdef ASUSCOM_IPAC - case VID_ASUSCOM_IPAC: - sc->sc_cardtyp = CARD_TYPEP_ASUSCOMIPAC; - ret = isic_attach_asi(dev); - break; -#endif -#ifdef EICON_DIVA - case VID_EICON_DIVA_20: - sc->sc_cardtyp = CARD_TYPEP_DIVA_ISA; - ret = isic_attach_diva(dev); - break; - - case VID_EICON_DIVA_202: - sc->sc_cardtyp = CARD_TYPEP_DIVA_ISA; - ret = isic_attach_diva_ipac(dev); - break; -#endif - default: - printf("isic%d: Error, no driver for %s\n", unit, name); - ret = ENXIO; - break; - } - - if(ret) - { - isic_detach_common(dev); - return ENXIO; - } - - if(isic_attach_common(dev)) - { - /* unset flag */ - sc->sc_cardtyp = CARD_TYPEP_UNK; - - /* free irq here, it hasn't been attached yet */ - bus_release_resource(dev,SYS_RES_IRQ,sc->sc_resources.irq_rid, - sc->sc_resources.irq); - sc->sc_resources.irq = 0; - isic_detach_common(dev); - return ENXIO; - } - else - { - /* setup intr routine */ - if (bus_setup_intr(dev,sc->sc_resources.irq,INTR_TYPE_NET, - NULL, (void(*)(void*))isicintr, sc,&ih) != 0) - { - printf("isic%d: Could not setup irq.\n",unit); - isic_detach_common(dev); - return ENXIO; - } - - return 0; - } -} diff --git a/sys/i4b/layer1/isic/i4b_itk_ix1.c b/sys/i4b/layer1/isic/i4b_itk_ix1.c deleted file mode 100644 index 7009bdbd11e0..000000000000 --- a/sys/i4b/layer1/isic/i4b_itk_ix1.c +++ /dev/null @@ -1,402 +0,0 @@ -/*- - * Copyright (c) 1998, 1999 Martin Husemann - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_itk_ix1.c - ITK ix1 micro passive card driver for isdn4bsd - * -------------------------------------------------------------- - * last edit-date: [Wed Jan 24 09:27:06 2001] - * - *--------------------------------------------------------------------------- - * - * The ITK ix1 micro ISDN card is an ISA card with one region - * of four io ports mapped and a fixed irq all jumpered on the card. - * Access to the board is straight forward and simmilar to - * the ELSA and DYNALINK cards. If a PCI version of this card - * exists all we need is probably a pci-bus attachment, all - * this low level routines should work imediately. - * - * To reset the card: - * - write 0x01 to ITK_CONFIG - * - wait >= 10 ms - * - write 0x00 to ITK_CONFIG - * - * To read or write data: - * - write address to ITK_ALE port - * - read data from or write data to ITK_ISAC_DATA port or ITK_HSCX_DATA port - * The two HSCX channel registers are offset by HSCXA (0x00) and HSCXB (0x40). - * - * The probe routine was derived by trial and error from a representative - * sample of two cards ;-) The standard way (checking HSCX versions) - * was extended by reading a zero from a non existant HSCX register (register - * 0xff). Reading the config register gives varying results, so this doesn't - * seem to be used as an id register (like the Teles S0/16.3). - * - * If the probe fails for your card use "options ITK_PROBE_DEBUG" to get - * additional debug output. - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(ITKIX1) - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* Register offsets */ -#define ITK_ISAC_DATA 0 -#define ITK_HSCX_DATA 1 -#define ITK_ALE 2 -#define ITK_CONFIG 3 - -/* Size of IO range to allocate for this card */ -#define ITK_IO_SIZE 4 - -/* Register offsets for the two HSCX channels */ -#define HSCXA 0 -#define HSCXB 0x40 - -static void -itkix1_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - switch (what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ITK_ALE, 0); - bus_space_read_multi_1(t, h, ITK_ISAC_DATA, buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ITK_ALE, HSCXA); - bus_space_read_multi_1(t, h, ITK_HSCX_DATA, buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ITK_ALE, HSCXB); - bus_space_read_multi_1(t, h, ITK_HSCX_DATA, buf, size); - break; - } -} - -static void -itkix1_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - switch (what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ITK_ALE, 0); - bus_space_write_multi_1(t, h, ITK_ISAC_DATA, (u_int8_t*)buf, size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ITK_ALE, HSCXA); - bus_space_write_multi_1(t, h, ITK_HSCX_DATA, (u_int8_t*)buf, size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ITK_ALE, HSCXB); - bus_space_write_multi_1(t, h, ITK_HSCX_DATA, (u_int8_t*)buf, size); - break; - } -} - -static void -itkix1_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - switch (what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ITK_ALE, offs); - bus_space_write_1(t, h, ITK_ISAC_DATA, data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ITK_ALE, HSCXA+offs); - bus_space_write_1(t, h, ITK_HSCX_DATA, data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ITK_ALE, HSCXB+offs); - bus_space_write_1(t, h, ITK_HSCX_DATA, data); - break; - } -} - -static u_int8_t -itkix1_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - switch (what) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t, h, ITK_ALE, offs); - return bus_space_read_1(t, h, ITK_ISAC_DATA); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t, h, ITK_ALE, HSCXA+offs); - return bus_space_read_1(t, h, ITK_HSCX_DATA); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t, h, ITK_ALE, HSCXB+offs); - return bus_space_read_1(t, h, ITK_HSCX_DATA); - } - return 0; -} - -/* - * Probe for card - */ -int -isic_probe_itkix1(device_t dev) -{ - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = 0; /* softc */ - void *ih = 0; /* dummy */ - bus_space_tag_t t; /* bus things */ - bus_space_handle_t h; - u_int8_t hd, hv1, hv2, saveale; - int ret; - - #if defined(ITK_PROBE_DEBUG) - printf("Checking unit %u\n", unit); - #endif - - /* check max unit range */ - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for ITK IX1!\n", - unit, unit); - return ENXIO; - } - - sc = &l1_sc[unit]; /* get pointer to softc */ - sc->sc_unit = unit; /* set unit */ - - #if defined(ITK_PROBE_DEBUG) - printf("Allocating io base..."); - #endif - - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - printf("isic%d: Could not allocate i/o port for ITK IX1.\n", unit); - return ENXIO; - } - - #if defined(ITK_PROBE_DEBUG) - printf("done.\n"); - #endif - - sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]); - t = rman_get_bustag(sc->sc_resources.io_base[0]); - h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - #if defined(ITK_PROBE_DEBUG) - printf("Allocating irq..."); - #endif - - /* get our irq */ - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE))) - { - printf("isic%d: Could not allocate irq for ITK IX1.\n", unit); - bus_release_resource(dev,SYS_RES_IOPORT, - sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - return ENXIO; - } - - #if defined(ITK_PROBE_DEBUG) - printf("done.\n"); - #endif - - /* get the irq number */ - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - #if defined(ITK_PROBE_DEBUG) - printf("Setting up access routines..."); - #endif - - /* setup access routines */ - sc->clearirq = NULL; - sc->readreg = itkix1_read_reg; - sc->writereg = itkix1_write_reg; - sc->readfifo = itkix1_read_fifo; - sc->writefifo = itkix1_write_fifo; - - /* setup card type */ - sc->sc_cardtyp = CARD_TYPEP_ITKIX1; - - /* setup IOM bus type */ - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - #if defined(ITK_PROBE_DEBUG) - printf("done.\n"); - #endif - - /* register interrupt routine */ - - #if defined(ITK_PROBE_DEBUG) - printf("Setting up access interrupt..."); - #endif - - if (bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL, - (void(*)(void *))(isicintr), sc, &ih) != 0) - { - printf("isic%d: Could not setup irq for ITK IX1.\n", unit); - bus_release_resource(dev,SYS_RES_IOPORT, - sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - return ENXIO; - } - - #if defined(ITK_PROBE_DEBUG) - printf("done.\n"); - - printf("Doing probe stuff..."); - #endif - - /* save old value of this port, we're stomping over it */ - saveale = bus_space_read_1(t, h, ITK_ALE); - - /* select invalid register */ - bus_space_write_1(t, h, ITK_ALE, 0xff); - /* get HSCX data for this non existent register */ - hd = bus_space_read_1(t, h, ITK_HSCX_DATA); - /* get HSCX version info */ - bus_space_write_1(t, h, ITK_ALE, HSCXA + H_VSTR); - hv1 = bus_space_read_1(t, h, ITK_HSCX_DATA); - bus_space_write_1(t, h, ITK_ALE, HSCXB + H_VSTR); - hv2 = bus_space_read_1(t, h, ITK_HSCX_DATA); - - ret = (hd == 0) && ((hv1 & 0x0f) == 0x05) && ((hv2 & 0x0f) == 0x05); - /* succeed if version bits are OK and we got a zero from the - * non existent register. we found verison 0x05 and 0x04 - * out there... */ - ret = (hd == 0) - && (((hv1 & 0x0f) == 0x05) || ((hv1 & 0x0f) == 0x04)) - && (((hv2 & 0x0f) == 0x05) || ((hv2 & 0x0f) == 0x04)); - - /* retstore save value if we fail (if we succeed the old value - * has no meaning) */ - if (!ret) - bus_space_write_1(t, h, ITK_ALE, saveale); - - #if defined(ITK_PROBE_DEBUG) - printf("done.\n"); - - printf("Doing second probe stuff..."); - #endif - - hv1 = HSCX_READ(0, H_VSTR) & 0xf; - hv2 = HSCX_READ(1, H_VSTR) & 0xf; - /* Read HSCX A/B VSTR. Expected value is 0x05 (V2.1) or 0x04 (V2.0). */ - if((hv1 != 0x05 && hv1 != 0x04) || (hv2 != 0x05 && hv2 != 0x04)) - { - printf("isic%d: HSCX VSTR test failed for ITK ix1 micro\n", - unit); - printf("isic%d: HSC0: VSTR: %#x\n", - unit, HSCX_READ(0, H_VSTR)); - printf("isic%d: HSC1: VSTR: %#x\n", - unit, HSCX_READ(1, H_VSTR)); - isic_detach_common(dev); - return ENXIO; - } - - #if defined(ITK_PROBE_DEBUG) - printf("done.\n"); - #endif - -#if defined(ITK_PROBE_DEBUG) - printf("\nITK ix1 micro probe: hscx = 0x%02x, v1 = 0x%02x, v2 = 0x%02x, would have %s\n", - hd, hv1, hv2, ret ? "succeeded" : "failed"); - isic_detach_common(dev); - return ENXIO; -#else - if ( ret ) - { - return 0; - } - else - { - isic_detach_common(dev); - return ENXIO; - } -#endif -} - -/* - * Attach card - */ -int -isic_attach_itkix1(device_t dev) -{ - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = &l1_sc[unit]; - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - /* setup access routines */ - sc->clearirq = NULL; - sc->readreg = itkix1_read_reg; - sc->writereg = itkix1_write_reg; - sc->readfifo = itkix1_read_fifo; - sc->writefifo = itkix1_write_fifo; - - /* setup card type */ - sc->sc_cardtyp = CARD_TYPEP_ITKIX1; - - /* setup IOM bus type */ - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - bus_space_write_1(t, h, ITK_CONFIG, 1); - DELAY(SEC_DELAY / 10); - bus_space_write_1(t, h, ITK_CONFIG, 0); - DELAY(SEC_DELAY / 10); - - return 0; -} - -#endif /* defined(ITKIX1) */ diff --git a/sys/i4b/layer1/isic/i4b_l1.c b/sys/i4b/layer1/isic/i4b_l1.c deleted file mode 100644 index 5af7edab2635..000000000000 --- a/sys/i4b/layer1/isic/i4b_l1.c +++ /dev/null @@ -1,249 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l1.c - isdn4bsd layer 1 handler - * ----------------------------------- - * last edit-date: [Wed Jan 24 09:12:03 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-DATA-REQUEST - * ========================= - * - * parms: - * unit physical interface unit number - * m mbuf containing L2 frame to be sent out - * freeflag MBUF_FREE: free mbuf here after having sent - * it out - * MBUF_DONTFREE: mbuf is freed by Layer 2 - * returns: - * ==0 fail, nothing sent out - * !=0 ok, frame sent out - * - *---------------------------------------------------------------------------*/ -int -isic_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - u_char cmd; - int s; - struct l1_softc *sc = &l1_sc[unit]; - -#ifdef NOTDEF - NDBGL1(L1_PRIM, "unit %d, freeflag=%d", unit, freeflag); -#endif - - if(m == NULL) /* failsafe */ - return (0); - - s = SPLI4B(); - - if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ - { - NDBGL1(L1_I_ERR, "still in state F3!"); - isic_ph_activate_req(unit); - } - - if(sc->sc_state & ISAC_TX_ACTIVE) - { - if(sc->sc_obuf2 == NULL) - { - sc->sc_obuf2 = m; /* save mbuf ptr */ - - if(freeflag) - sc->sc_freeflag2 = 1; /* IRQ must mfree */ - else - sc->sc_freeflag2 = 0; /* IRQ must not mfree */ - - NDBGL1(L1_I_MSG, "using 2nd ISAC TX buffer, state = %s", isic_printstate(sc)); - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - splx(s); - return(1); - } - - NDBGL1(L1_I_ERR, "No Space in TX FIFO, state = %s", isic_printstate(sc)); - - if(freeflag == MBUF_FREE) - i4b_Dfreembuf(m); - - splx(s); - return (0); - } - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ISICUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - sc->sc_state |= ISAC_TX_ACTIVE; /* set transmitter busy flag */ - - NDBGL1(L1_I_MSG, "ISAC_TX_ACTIVE set"); - - sc->sc_freeflag = 0; /* IRQ must NOT mfree */ - - ISAC_WRFIFO(m->m_data, min(m->m_len, ISAC_FIFO_LEN)); /* output to TX fifo */ - - if(m->m_len > ISAC_FIFO_LEN) /* message > 32 bytes ? */ - { - sc->sc_obuf = m; /* save mbuf ptr */ - sc->sc_op = m->m_data + ISAC_FIFO_LEN; /* ptr for irq hdl */ - sc->sc_ol = m->m_len - ISAC_FIFO_LEN; /* length for irq hdl */ - - if(freeflag) - sc->sc_freeflag = 1; /* IRQ must mfree */ - - cmd = ISAC_CMDR_XTF; - } - else - { - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - if(freeflag) - i4b_Dfreembuf(m); - - cmd = ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - - ISAC_WRITE(I_CMDR, cmd); - ISACCMDRWRDELAY(); - - splx(s); - - return(1); -} - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-ACTIVATE-REQUEST - * ============================= - * - * parms: - * unit physical interface unit number - * - * returns: - * ==0 - * !=0 - * - *---------------------------------------------------------------------------*/ -int -isic_ph_activate_req(int unit) -{ - struct l1_softc *sc = &l1_sc[unit]; - NDBGL1(L1_PRIM, "unit %d", unit); - isic_next_state(sc, EV_PHAR); - return(0); -} - -/*---------------------------------------------------------------------------* - * command from the upper layers - *---------------------------------------------------------------------------*/ -int -isic_mph_command_req(int unit, int command, void *parm) -{ - struct l1_softc *sc = &l1_sc[unit]; - - switch(command) - { - case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DOPEN", unit); - sc->sc_enabled = 1; - break; - - case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DCLOSE", unit); - sc->sc_enabled = 0; - break; - - case CMR_SETTRACE: - NDBGL1(L1_PRIM, "unit %d, command = CMR_SETTRACE, parm = %d", unit, (unsigned int)parm); - sc->sc_trace = (unsigned int)parm; - break; - - case CMR_GCST: - { - struct chipstat *cst; - NDBGL1(L1_PRIM, "unit %d, command = CMR_GCST, parm = %d", unit, (unsigned int)parm); - cst = (struct chipstat *)parm; - cst->driver_type = L1DRVR_ISIC; - cst->stats.hscxstat.unit = sc->sc_unit; - cst->stats.hscxstat.chan = cst->driver_bchannel; - cst->stats.hscxstat.vfr = sc->sc_chan[cst->driver_bchannel].stat_VFR; - cst->stats.hscxstat.rdo = sc->sc_chan[cst->driver_bchannel].stat_RDO; - cst->stats.hscxstat.crc = sc->sc_chan[cst->driver_bchannel].stat_CRC; - cst->stats.hscxstat.rab = sc->sc_chan[cst->driver_bchannel].stat_RAB; - cst->stats.hscxstat.xdu = sc->sc_chan[cst->driver_bchannel].stat_XDU; - cst->stats.hscxstat.rfo = sc->sc_chan[cst->driver_bchannel].stat_RFO; - break; - } - default: - NDBGL1(L1_ERROR, "ERROR, unknown command = %d, unit = %d, parm = %d", command, unit, (unsigned int)parm); - break; - } - - return(0); -} diff --git a/sys/i4b/layer1/isic/i4b_l1fsm.c b/sys/i4b/layer1/isic/i4b_l1fsm.c deleted file mode 100644 index d996c9bab6ca..000000000000 --- a/sys/i4b/layer1/isic/i4b_l1fsm.c +++ /dev/null @@ -1,506 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l1fsm.c - isdn4bsd layer 1 I.430 state machine - * -------------------------------------------------- - * last edit-date: [Wed Jan 24 09:12:18 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include - -#include - -#include - -#if DO_I4B_DEBUG -static char *state_text[N_STATES] = { - "F3 Deactivated", - "F4 Awaiting Signal", - "F5 Identifying Input", - "F6 Synchronized", - "F7 Activated", - "F8 Lost Framing", - "Illegal State" -}; - -static char *event_text[N_EVENTS] = { - "EV_PHAR PH_ACT_REQ", - "EV_T3 Timer 3 expired", - "EV_INFO0 INFO0 received", - "EV_RSY Level Detected", - "EV_INFO2 INFO2 received", - "EV_INFO48 INFO4 received", - "EV_INFO410 INFO4 received", - "EV_DR Deactivate Req", - "EV_PU Power UP", - "EV_DIS Disconnected", - "EV_EI Error Ind", - "Illegal Event" -}; -#endif - -/* Function prototypes */ - -static void timer3_expired (struct l1_softc *sc); -static void T3_start (struct l1_softc *sc); -static void T3_stop (struct l1_softc *sc); -static void F_T3ex (struct l1_softc *sc); -static void timer4_expired (struct l1_softc *sc); -static void T4_start (struct l1_softc *sc); -static void T4_stop (struct l1_softc *sc); -static void F_AI8 (struct l1_softc *sc); -static void F_AI10 (struct l1_softc *sc); -static void F_I01 (struct l1_softc *sc); -static void F_I02 (struct l1_softc *sc); -static void F_I03 (struct l1_softc *sc); -static void F_I2 (struct l1_softc *sc); -static void F_ill (struct l1_softc *sc); -static void F_NULL (struct l1_softc *sc); - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expire function - *---------------------------------------------------------------------------*/ -static void -timer3_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T3) - { - NDBGL1(L1_T_ERR, "state = %s", isic_printstate(sc)); - sc->sc_I430T3 = 0; - - /* XXX try some recovery here XXX */ - - isic_recover(sc); - - sc->sc_init_tries++; /* increment retry count */ - -/*XXX*/ if(sc->sc_init_tries > 4) - { - int s = SPLI4B(); - - sc->sc_init_tries = 0; - - if(sc->sc_obuf2 != NULL) - { - i4b_Dfreembuf(sc->sc_obuf2); - sc->sc_obuf2 = NULL; - } - if(sc->sc_obuf != NULL) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_obuf = NULL; - sc->sc_freeflag = 0; - sc->sc_op = NULL; - sc->sc_ol = 0; - } - - splx(s); - - i4b_l1_mph_status_ind(L0ISICUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); - } - - isic_next_state(sc, EV_T3); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 start - *---------------------------------------------------------------------------*/ -static void -T3_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", isic_printstate(sc)); - sc->sc_I430T3 = 1; - sc->sc_T3_callout = timeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, 2*hz); -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 stop - *---------------------------------------------------------------------------*/ -static void -T3_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", isic_printstate(sc)); - - sc->sc_init_tries = 0; /* init connect retry count */ - - if(sc->sc_I430T3) - { - sc->sc_I430T3 = 0; - untimeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, sc->sc_T3_callout); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expiry - *---------------------------------------------------------------------------*/ -static void -F_T3ex(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_T3ex executing"); - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0ISICUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * Timer T4 expire function - *---------------------------------------------------------------------------*/ -static void -timer4_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T4) - { - NDBGL1(L1_T_MSG, "state = %s", isic_printstate(sc)); - sc->sc_I430T4 = 0; - i4b_l1_mph_status_ind(L0ISICUNIT(sc->sc_unit), STI_PDEACT, 0, NULL); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * Timer T4 start - *---------------------------------------------------------------------------*/ -static void -T4_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", isic_printstate(sc)); - sc->sc_I430T4 = 1; - sc->sc_T4_callout = timeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, hz); -} - -/*---------------------------------------------------------------------------* - * Timer T4 stop - *---------------------------------------------------------------------------*/ -static void -T4_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", isic_printstate(sc)); - - if(sc->sc_I430T4) - { - sc->sc_I430T4 = 0; - untimeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, sc->sc_T4_callout); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI8 - *---------------------------------------------------------------------------*/ -static void -F_AI8(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI8 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0ISICUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_8; - - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI10 - *---------------------------------------------------------------------------*/ -static void -F_AI10(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI10 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0ISICUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_10; - - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in states F3 .. F5 - *---------------------------------------------------------------------------*/ -static void -F_I01(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I01 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F6 - *---------------------------------------------------------------------------*/ -static void -F_I02(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I02 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0ISICUNIT(sc->sc_unit)); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F7 or F8 - *---------------------------------------------------------------------------*/ -static void -F_I03(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I03 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0ISICUNIT(sc->sc_unit)); - - T4_start(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: activate request - *---------------------------------------------------------------------------*/ -static void -F_AR(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO1_8; - - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_TE; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - - isic_isac_l1_cmd(sc, CMD_AR8); - - T3_start(sc); -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO2 - *---------------------------------------------------------------------------*/ -static void -F_I2(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I2 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO2; - - hdr.unit = L0ISICUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - -} - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(struct l1_softc *sc) -{ - NDBGL1(L1_F_ERR, "FSM function F_ill executing"); -} - -/*---------------------------------------------------------------------------* - * No action - *---------------------------------------------------------------------------*/ -static void -F_NULL(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_NULL executing"); -} - - -/*---------------------------------------------------------------------------* - * layer 1 state transition table - *---------------------------------------------------------------------------*/ -struct isic_state_tab { - void (*func) (struct l1_softc *sc); /* function to execute */ - int newstate; /* next state */ -} isic_state_tab[N_EVENTS][N_STATES] = { - -/* STATE: F3 F4 F5 F6 F7 F8 ILLEGAL STATE */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* EV_PHAR x*/ {{F_AR, ST_F4}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_ill, ST_ILL}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_T3 x*/ {{F_NULL, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO0 */ {{F_I01, ST_F3}, {F_I01, ST_F4}, {F_I01, ST_F5}, {F_I02, ST_F3}, {F_I03, ST_F3}, {F_I03, ST_F3}, {F_ill, ST_ILL}}, -/* EV_RSY x*/ {{F_NULL, ST_F3}, {F_NULL, ST_F5}, {F_NULL, ST_F5}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO2 */ {{F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_ill, ST_ILL}}, -/* EV_INFO48*/ {{F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_NULL, ST_F7}, {F_AI8, ST_F7}, {F_ill, ST_ILL}}, -/* EV_INFO41*/ {{F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_NULL, ST_F7}, {F_AI10, ST_F7}, {F_ill, ST_ILL}}, -/* EV_DR */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_PU */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_DIS */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_EI */ {{F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_ill, ST_ILL}}, -/* EV_ILL */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -isic_next_state(struct l1_softc *sc, int event) -{ - int currstate, newstate; - - if(event >= N_EVENTS) - panic("i4b_l1fsm.c: event >= N_EVENTS\n"); - - currstate = sc->sc_I430state; - - if(currstate >= N_STATES) - panic("i4b_l1fsm.c: currstate >= N_STATES\n"); - - newstate = isic_state_tab[event][currstate].newstate; - - if(newstate >= N_STATES) - panic("i4b_l1fsm.c: newstate >= N_STATES\n"); - - NDBGL1(L1_F_MSG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]); - - (*isic_state_tab[event][currstate].func)(sc); - - if(newstate == ST_ILL) - { - newstate = ST_F3; - NDBGL1(L1_F_ERR, "FSM Illegal State ERROR, oldstate = %s, newstate = %s, event = %s!", - state_text[currstate], - state_text[newstate], - event_text[event]); - } - - sc->sc_I430state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -isic_printstate(struct l1_softc *sc) -{ - return((char *) state_text[sc->sc_I430state]); -} -#endif diff --git a/sys/i4b/layer1/isic/i4b_siemens_isurf.c b/sys/i4b/layer1/isic/i4b_siemens_isurf.c deleted file mode 100644 index 1a845662957b..000000000000 --- a/sys/i4b/layer1/isic/i4b_siemens_isurf.c +++ /dev/null @@ -1,230 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Udo Schweigert. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * Siemens I-Surf 2.0 PnP specific routines for isic driver - * -------------------------------------------------------- - * Based on ELSA Quickstep 1000pro PCI driver (i4b_elsa_qs1p.c) - * In case of trouble please contact Udo Schweigert - * - * last edit-date: [Wed Jan 24 09:13:25 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(SIEMENS_ISURF2) - -#include -#include -#include - -#include - -#include - -#include -#include - -/* masks for register encoded in base addr */ - -#define SIE_ISURF_BASE_MASK 0x0ffff -#define SIE_ISURF_OFF_MASK 0xf0000 - -/* register id's to be encoded in base addr */ - -#define SIE_ISURF_IDISAC 0x00000 -#define SIE_ISURF_IDHSCXA 0x10000 -#define SIE_ISURF_IDHSCXB 0x20000 -#define SIE_ISURF_IDIPAC 0x40000 - -/* offsets from base address */ - -#define SIE_ISURF_OFF_ALE 0x00 -#define SIE_ISURF_OFF_RW 0x01 - -/*---------------------------------------------------------------------------* - * Siemens I-Surf 2.0 PnP ISAC get fifo routine - *---------------------------------------------------------------------------*/ -static void -siemens_isurf_read_fifo(struct l1_softc *sc,int what,void *buf,size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,IPAC_ISAC_OFF); - bus_space_read_multi_1(t,h,SIE_ISURF_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,IPAC_HSCXA_OFF); - bus_space_read_multi_1(t,h,SIE_ISURF_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,IPAC_HSCXB_OFF); - bus_space_read_multi_1(t,h,SIE_ISURF_OFF_RW,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Siemens I-Surf 2.0 PnP ISAC put fifo routine - *---------------------------------------------------------------------------*/ -static void -siemens_isurf_write_fifo(struct l1_softc *sc,int what,void *buf,size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,IPAC_ISAC_OFF); - bus_space_write_multi_1(t,h,SIE_ISURF_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,IPAC_HSCXA_OFF); - bus_space_write_multi_1(t,h,SIE_ISURF_OFF_RW,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,IPAC_HSCXB_OFF); - bus_space_write_multi_1(t,h,SIE_ISURF_OFF_RW,buf,size); - break; - } -} - -/*---------------------------------------------------------------------------* - * Siemens I-Surf 2.0 PnP ISAC put register routine - *---------------------------------------------------------------------------*/ -static void -siemens_isurf_write_reg(struct l1_softc *sc,int what,bus_size_t reg,u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,reg+IPAC_ISAC_OFF); - bus_space_write_1(t,h,SIE_ISURF_OFF_RW,data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,reg+IPAC_HSCXA_OFF); - bus_space_write_1(t,h,SIE_ISURF_OFF_RW,data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,reg+IPAC_HSCXB_OFF); - bus_space_write_1(t,h,SIE_ISURF_OFF_RW,data); - break; - case ISIC_WHAT_IPAC: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,reg+IPAC_IPAC_OFF); - bus_space_write_1(t,h,SIE_ISURF_OFF_RW,data); - break; - } -} - -/*---------------------------------------------------------------------------* - * Siemens I-Surf 2.0 PnP ISAC get register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -siemens_isurf_read_reg(struct l1_softc *sc,int what,bus_size_t reg) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) - { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,reg+IPAC_ISAC_OFF); - return bus_space_read_1(t,h,SIE_ISURF_OFF_RW); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,reg+IPAC_HSCXA_OFF); - return bus_space_read_1(t,h,SIE_ISURF_OFF_RW); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,reg+IPAC_HSCXB_OFF); - return bus_space_read_1(t,h,SIE_ISURF_OFF_RW); - case ISIC_WHAT_IPAC: - bus_space_write_1(t,h,SIE_ISURF_OFF_ALE,reg+IPAC_IPAC_OFF); - return bus_space_read_1(t,h,SIE_ISURF_OFF_RW); - default: - return 0; - } -} - -/*---------------------------------------------------------------------------* - * isic_attach_siemens_isurf - attach for Siemens I-Surf 2.0 PnP - *---------------------------------------------------------------------------*/ -int -isic_attach_siemens_isurf(device_t dev) -{ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = siemens_isurf_read_reg; - sc->writereg = siemens_isurf_write_reg; - - sc->readfifo = siemens_isurf_read_fifo; - sc->writefifo = siemens_isurf_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_SIE_ISURF2; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* setup chip type = IPAC ! */ - - sc->sc_ipac = 1; - sc->sc_bfifolen = IPAC_BFIFO_LEN; - - /* enable hscx/isac irq's */ - - IPAC_WRITE(IPAC_MASK, (IPAC_MASK_INT1 | IPAC_MASK_INT0)); - - IPAC_WRITE(IPAC_ACFG, 0); /* outputs are open drain */ - IPAC_WRITE(IPAC_AOE, /* aux 5..2 are inputs, 7, 6 outputs */ - (IPAC_AOE_OE5 | IPAC_AOE_OE4 | IPAC_AOE_OE3 | IPAC_AOE_OE2)); - IPAC_WRITE(IPAC_ATX, 0xff); /* set all output lines high */ - - return(0); -} -#endif /* defined(SIEMENS_ISURF2) */ diff --git a/sys/i4b/layer1/isic/i4b_sws.c b/sys/i4b/layer1/isic/i4b_sws.c deleted file mode 100644 index 6f73f90d8b23..000000000000 --- a/sys/i4b/layer1/isic/i4b_sws.c +++ /dev/null @@ -1,212 +0,0 @@ -/*- - * Copyright (c) 1998, 2000 German Tischler. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * Card format: - * - * iobase + 0 : reset on (0x03) - * iobase + 1 : reset off (0x0) - * iobase + 2 : isac read/write - * iobase + 3 : hscx read/write ( offset 0-0x3f hscx0 , - * offset 0x40-0x7f hscx1 ) - * iobase + 4 : offset for indirect adressing - * - *--------------------------------------------------------------------------- - * - * isic - I4B Siemens ISDN Chipset Driver for SWS cards - * ==================================================== - * last edit-date: [Wed Jan 24 08:58:57 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined (SEDLBAUER) - -#define SWS_RESON 0 /* reset on */ -#define SWS_RESOFF 1 /* reset off */ -#define SWS_ISAC 2 /* ISAC */ -#define SWS_HSCX0 3 /* HSCX0 */ -#define SWS_RW 4 /* indirect access register */ -#define SWS_HSCX1 5 /* this is for fakeing that we mean hscx1, though */ - /* access is done through hscx0 */ - -#define SWS_REGS 8 /* we use an area of 8 bytes for io */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/*---------------------------------------------------------------------------* - * SWS P&P ISAC get fifo routine - *---------------------------------------------------------------------------*/ -static void -sws_read_fifo(struct l1_softc *sc,int what,void *buf,size_t size) { - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,SWS_RW,0x0); - bus_space_read_multi_1(t,h,SWS_ISAC,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,SWS_RW,0x0); - bus_space_read_multi_1(t,h,SWS_HSCX0,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,SWS_RW,0x0+0x40); - bus_space_read_multi_1(t,h,SWS_HSCX0,buf,size); - break; - } -} - -static void -sws_write_fifo(struct l1_softc *sc,int what,void *buf,size_t size) { - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,SWS_RW,0x0); - bus_space_write_multi_1(t,h,SWS_ISAC,buf,size); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,SWS_RW,0x0); - bus_space_write_multi_1(t,h,SWS_HSCX0,buf,size); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,SWS_RW,0x0+0x40); - bus_space_write_multi_1(t,h,SWS_HSCX0,buf,size); - break; - } -} - -static void -sws_write_reg(struct l1_softc *sc,int what,bus_size_t reg,u_int8_t data) { - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,SWS_RW,reg); - bus_space_write_1(t,h,SWS_ISAC,data); - break; - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,SWS_RW,reg); - bus_space_write_1(t,h,SWS_HSCX0,data); - break; - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,SWS_RW,reg+0x40); - bus_space_write_1(t,h,SWS_HSCX0,data); - break; - } -} - -static u_char -sws_read_reg (struct l1_softc *sc,int what,bus_size_t reg) { - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - switch ( what ) { - case ISIC_WHAT_ISAC: - bus_space_write_1(t,h,SWS_RW,reg); - return bus_space_read_1(t,h,SWS_ISAC); - case ISIC_WHAT_HSCXA: - bus_space_write_1(t,h,SWS_RW,reg); - return bus_space_read_1(t,h,SWS_HSCX0); - case ISIC_WHAT_HSCXB: - bus_space_write_1(t,h,SWS_RW,reg+0x40); - return bus_space_read_1(t,h,SWS_HSCX0); - default: - return 0; - } -} - -/* attach callback routine */ -int -isic_attach_sws(device_t dev) -{ - int unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - - struct i4b_info * info = &(sc->sc_resources); - bus_space_tag_t t = rman_get_bustag(info->io_base[0]); - bus_space_handle_t h = rman_get_bushandle(info->io_base[0]); - - /* fill in l1_softc structure */ - sc->readreg = sws_read_reg; - sc->writereg = sws_write_reg; - sc->readfifo = sws_read_fifo; - sc->writefifo = sws_write_fifo; - sc->clearirq = NULL; - sc->sc_cardtyp = CARD_TYPEP_SWS; - sc->sc_bustyp = BUS_TYPE_IOM2; - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* - * Read HSCX A/B VSTR. Expected value for the SWS PnP card is - * 0x05 ( = version 2.1 ) in the least significant bits. - */ - - if( ((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) || - ((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) ) - { - printf("isic%d: HSCX VSTR test failed for SWS PnP\n", - sc->sc_unit); - printf("isic%d: HSC0: VSTR: %#x\n", - sc->sc_unit, HSCX_READ(0, H_VSTR)); - printf("isic%d: HSC1: VSTR: %#x\n", - sc->sc_unit, HSCX_READ(1, H_VSTR)); - return (ENXIO); - } - - /* reset card */ - bus_space_write_1(t,h,SWS_RESON,0x3); - DELAY(SEC_DELAY / 5); - bus_space_write_1(t,h,SWS_RESOFF,0x0); - DELAY(SEC_DELAY / 5); - - return(0); -} -#endif /* defined(SEDLBAUER) */ diff --git a/sys/i4b/layer1/isic/i4b_tel_s016.c b/sys/i4b/layer1/isic/i4b_tel_s016.c deleted file mode 100644 index 6ffa7329032b..000000000000 --- a/sys/i4b/layer1/isic/i4b_tel_s016.c +++ /dev/null @@ -1,372 +0,0 @@ -/*- - * Copyright (c) 1996 Arne Helme. All rights reserved. - * Copyright (c) 1996 Gary Jennejohn. All rights reserved. - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isic - I4B Siemens ISDN Chipset Driver for Teles S0/16 and clones - * ================================================================= - * last edit-date: [Wed Jan 24 09:27:24 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(TEL_S0_16) - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#define TELES_S016_MEMSIZE 0x1000 - -static u_char intr_no[] = { 1, 1, 0, 2, 4, 6, 1, 1, 1, 0, 8, 10, 12, 1, 1, 14 }; -static const bus_size_t offset[] = { 0x100, 0x180, 0x1c0 }; - -/*---------------------------------------------------------------------------* - * Teles S0/16 write register routine - *---------------------------------------------------------------------------*/ -static void -tels016_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - - offs += offset[what]; - - if (offs & 0x01) - offs |= 0x200; - - bus_space_write_1(t, h, offs, data); -} - -/*---------------------------------------------------------------------------* - * Teles S0/16 read register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -tels016_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - - offs += offset[what]; - - if(offs & 0x01) - offs |= 0x200; - - return bus_space_read_1(t, h, offs); -} - -/*---------------------------------------------------------------------------* - * Teles S0/16 fifo write routine - *---------------------------------------------------------------------------*/ -static void -tels016_write_fifo(struct l1_softc *sc, int what, void *data, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - bus_space_write_region_1(t, h, offset[what], data, size); -} - -/*---------------------------------------------------------------------------* - * Teles S0/16 fifo read routine - *---------------------------------------------------------------------------*/ -static void -tels016_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - bus_space_read_region_1(t, h, offset[what], buf, size); -} - -/*---------------------------------------------------------------------------* - * isic_probe_s016 - probe for Teles S0/16 and compatibles - *---------------------------------------------------------------------------*/ -int -isic_probe_s016(device_t dev) -{ - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = 0; /* softc */ - void *ih = 0; /* dummy */ - u_int8_t b0,b1,b2; /* for signature */ - bus_space_tag_t t; /* bus things */ - bus_space_handle_t h; - - /* check max unit range */ - - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for Teles S0/16!\n", - unit, unit); - return(ENXIO); - } - - sc = &l1_sc[unit]; /* get pointer to softc */ - sc->sc_unit = unit; /* set unit */ - - /* see if an io base was supplied */ - - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - printf("isic%d: Could not allocate i/o port for Teles S0/16.\n", unit); - return(ENXIO); - } - - sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]); - - /* - * check if the provided io port is valid - */ - - switch(sc->sc_port) - { - case 0xd80: - case 0xe80: - case 0xf80: - break; - - default: - printf("isic%d: Error, invalid iobase 0x%x specified for Teles S0/16!\n", - unit, sc->sc_port); - isic_detach_common(dev); - return(ENXIO); - break; - } - - /* allocate memory resource */ - - if(!(sc->sc_resources.mem = - bus_alloc_resource(dev, SYS_RES_MEMORY, - &sc->sc_resources.mem_rid, - 0ul, ~0ul, TELES_S016_MEMSIZE, - RF_ACTIVE))) - { - printf("isic%d: Could not allocate memory for Teles S0/16.\n", unit); - isic_detach_common(dev); - return(ENXIO); - } - - /* - * get virtual addr. - */ - sc->sc_vmem_addr = rman_get_virtual(sc->sc_resources.mem); - - /* - * check for valid adresses - */ - switch(kvtop(sc->sc_vmem_addr)) - { - case 0xc0000: - case 0xc2000: - case 0xc4000: - case 0xc6000: - case 0xc8000: - case 0xca000: - case 0xcc000: - case 0xce000: - case 0xd0000: - case 0xd2000: - case 0xd4000: - case 0xd6000: - case 0xd8000: - case 0xda000: - case 0xdc000: - case 0xde000: - break; - - default: - printf("isic%d: Error, invalid memory address 0x%x for Teles S0/16!\n", - unit, kvtop(sc->sc_vmem_addr)); - isic_detach_common(dev); - return(ENXIO); - break; - } - - /* setup ISAC access routines */ - - sc->clearirq = NULL; - - sc->readreg = tels016_read_reg; - sc->writereg = tels016_write_reg; - - sc->readfifo = tels016_read_fifo; - sc->writefifo = tels016_write_fifo; - - /* setup card type */ - sc->sc_cardtyp = CARD_TYPEP_16; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM1; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* setup ISAC base addr, though we don't really need it */ - - ISAC_BASE = (caddr_t)((sc->sc_vmem_addr) + 0x100); - - /* setup HSCX base addr */ - - HSCX_A_BASE = (caddr_t)((sc->sc_vmem_addr) + 0x180); - HSCX_B_BASE = (caddr_t)((sc->sc_vmem_addr) + 0x1c0); - - t = rman_get_bustag(sc->sc_resources.io_base[0]); - h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - /* get signature bytes */ - b0 = bus_space_read_1(t, h, 0); - b1 = bus_space_read_1(t, h, 1); - b2 = bus_space_read_1(t, h, 2); - - /* check signature bytes */ - if(b0 != 0x51) - { - printf("isic%d: Error, signature 1 0x%x != 0x51 for Teles S0/16!\n", - unit, b0); - isic_detach_common(dev); - return(ENXIO); - } - - if(b1 != 0x93) - { - printf("isic%d: Error, signature 2 0x%x != 0x93 for Teles S0/16!\n", - unit, b1); - isic_detach_common(dev); - return(ENXIO); - } - - if((b2 != 0x1e) && (b2 != 0x1f)) - { - printf("isic%d: Error, signature 3 0x%x != 0x1e or 0x1f for Teles S0/16!\n", - unit, b2); - isic_detach_common(dev); - return(ENXIO); - } - - /* get our irq */ - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE))) - { - printf("isic%d: Could not allocate irq for Teles S0/16.\n", unit); - isic_detach_common(dev); - return ENXIO; - } - - /* register interrupt routine */ - - if (bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL, - (void(*)(void *))(isicintr), sc, &ih) != 0) - { - printf("isic%d: Could not setup irq for Teles S0/16.\n", unit); - isic_detach_common(dev); - return ENXIO; - } - - /* get the irq number */ - - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - /* check IRQ validity */ - - if((intr_no[sc->sc_irq]) == 1) - { - printf("isic%d: Error, invalid IRQ [%d] specified for Teles S0/16!\n", - unit, sc->sc_irq); - isic_detach_common(dev); - return(ENXIO); - } - - return (0); -} - -/*---------------------------------------------------------------------------* - * isic_attach_s016 - attach Teles S0/16 and compatibles - *---------------------------------------------------------------------------*/ -int -isic_attach_s016(device_t dev) -{ - struct l1_softc *sc = &l1_sc[device_get_unit(dev)]; - u_long irq; - - bus_space_tag_t ta = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t ha = rman_get_bushandle(sc->sc_resources.mem); - bus_space_tag_t tb = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t hb = rman_get_bushandle(sc->sc_resources.io_base[0]); - - /* is this right for FreeBSD or off by one ? */ - irq = intr_no[sc->sc_irq]; - - /* configure IRQ */ - - irq |= ((u_long) sc->sc_vmem_addr) >> 9; - - DELAY(SEC_DELAY / 10); - bus_space_write_1(tb, hb, 4, irq); - - DELAY(SEC_DELAY / 10); - bus_space_write_1(tb, hb, 4, irq | 0x01); - - DELAY(SEC_DELAY / 5); - - /* set card bit off */ - - bus_space_write_1(ta, ha, 0x80, 0); - DELAY(SEC_DELAY / 5); - - /* set card bit on */ - - bus_space_write_1(ta, ha, 0x80, 1); - DELAY(SEC_DELAY / 5); - - return 0; -} - -#endif /* defined(TEL_S0_16) */ diff --git a/sys/i4b/layer1/isic/i4b_tel_s0163.c b/sys/i4b/layer1/isic/i4b_tel_s0163.c deleted file mode 100644 index 01d274b61e90..000000000000 --- a/sys/i4b/layer1/isic/i4b_tel_s0163.c +++ /dev/null @@ -1,375 +0,0 @@ -/*- - * Copyright (c) 1996 Arne Helme. All rights reserved. - * Copyright (c) 1996 Gary Jennejohn. All rights reserved. - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isic - I4B Siemens ISDN Chipset Driver for Teles S0/16.3 - * ======================================================== - * last edit-date: [Wed Jan 24 09:27:40 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(TEL_S0_16_3) - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -static u_char intr_no[] = { 1, 1, 0, 2, 4, 6, 1, 1, 1, 0, 8, 10, 12, 1, 1, 14 }; - -#define ISAC_OFFS 0x400 -#define HSCXA_OFFS 0xc00 -#define HSCXB_OFFS 0x800 - -/*---------------------------------------------------------------------------* - * Teles S0/16.3 read fifo routine - *---------------------------------------------------------------------------*/ -static void -tels0163_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+1]); - bus_space_read_multi_1(t,h,0x1e,buf,size); -} - -/*---------------------------------------------------------------------------* - * Teles S0/16.3 write fifo routine - *---------------------------------------------------------------------------*/ -static void -tels0163_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+1]); - bus_space_write_multi_1(t,h,0x1e,buf,size); -} - -/*---------------------------------------------------------------------------* - * Teles S0/16.3 ISAC put register routine - *---------------------------------------------------------------------------*/ -static void -tels0163_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+1]); - bus_space_write_1(t,h,offs - 0x20,data); -} - -/*---------------------------------------------------------------------------* - * Teles S0/16.3 ISAC get register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -tels0163_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+1]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+1]); - return bus_space_read_1(t,h,offs - 0x20); -} - -/*---------------------------------------------------------------------------* - * isic_probe_s0163 - probe routine for Teles S0/16.3 - *---------------------------------------------------------------------------*/ -int -isic_probe_s0163(device_t dev) -{ - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = 0; /* pointer to softc */ - void *ih = 0; /* dummy */ - bus_space_tag_t t; /* bus things */ - bus_space_handle_t h; - u_int8_t b0,b1,b2; /* signature */ - - /* check max unit range */ - - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for Teles 16.3!\n", - unit, unit); - return(ENXIO); - } - - sc = &l1_sc[unit]; /* get pointer to softc */ - sc->sc_unit = unit; /* set unit */ - - /* see if an io base was supplied */ - - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - printf("isic%d: Could not get iobase for Teles S0/16.3.\n", - unit); - return(ENXIO); - } - - /* set io base */ - - sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]); - /* Release the resource - re-allocate later with correct size */ - bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - - switch(sc->sc_port) - { - case 0xd80: - case 0xe80: - case 0xf80: - break; - - case 0x180: - case 0x280: - case 0x380: - printf("isic%d: Error, instead of using iobase 0x%x for your Teles S0/16.3,\n", - unit, sc->sc_port); - printf("isic%d: please use 0x%x in the kernel configuration file!\n", - unit, sc->sc_port+0xc00); - isic_detach_common(dev); - return(ENXIO); - break; - - default: - printf("isic%d: Error, invalid iobase 0x%x specified for Teles S0/16.3!\n", - unit, sc->sc_port); - isic_detach_common(dev); - return(ENXIO); - break; - } - - /* set io port resources */ - - sc->sc_resources.io_rid[0] = 0; - bus_set_resource(dev, SYS_RES_IOPORT, 0, sc->sc_port, 0x20); - sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE); - if(!sc->sc_resources.io_base[0]) - { - printf("isic%d: Error allocating io at 0x%x for Teles S0/16.3!\n", - unit, sc->sc_port); - isic_detach_common(dev); - return ENXIO; - } - sc->sc_resources.io_rid[1] = 1; - bus_set_resource(dev, SYS_RES_IOPORT, 1, - sc->sc_port-ISAC_OFFS, 0x20); - sc->sc_resources.io_base[1] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[1], - RF_ACTIVE); - if(!sc->sc_resources.io_base[1]) - { - printf("isic%d: Error allocating io at 0x%x for Teles S0/16.3!\n", - unit, sc->sc_port-ISAC_OFFS); - isic_detach_common(dev); - return ENXIO; - } - - sc->sc_resources.io_rid[2] = 2; - bus_set_resource(dev, SYS_RES_IOPORT, 2, - sc->sc_port-HSCXA_OFFS, 0x20); - sc->sc_resources.io_base[2] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[2], - RF_ACTIVE); - if(!sc->sc_resources.io_base[2]) - { - printf("isic%d: Error allocating io at 0x%x for Teles S0/16.3!\n", - unit, sc->sc_port-HSCXA_OFFS); - isic_detach_common(dev); - return ENXIO; - } - - sc->sc_resources.io_rid[3] = 3; - bus_set_resource(dev, SYS_RES_IOPORT, 3, - sc->sc_port-HSCXB_OFFS, 0x20); - sc->sc_resources.io_base[3] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[3], - RF_ACTIVE); - if(!sc->sc_resources.io_base[3]) - { - printf("isic%d: Error allocating io at 0x%x for Teles S0/16.3!\n", - unit, sc->sc_port-HSCXB_OFFS); - isic_detach_common(dev); - return ENXIO; - } - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = tels0163_read_reg; - sc->writereg = tels0163_write_reg; - - sc->readfifo = tels0163_read_fifo; - sc->writefifo = tels0163_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp= CARD_TYPEP_16_3; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - t = rman_get_bustag(sc->sc_resources.io_base[0]); - h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - b0 = bus_space_read_1(t, h, 0); - b1 = bus_space_read_1(t, h, 1); - b2 = bus_space_read_1(t, h, 2); - - if ( b0 != 0x51 && b0 != 0x10 ) { - printf("isic%d: Error, signature 1 0x%x != 0x51 or 0x10 for Teles S0/16.3!\n", - unit, b0); - isic_detach_common(dev); - return ENXIO; - } - - if ( b1 != 0x93 ) { - printf("isic%d: Error, signature 2 0x%x != 0x93 for Teles S0/16.3!\n", - unit, b1); - isic_detach_common(dev); - return ENXIO; - } - if (( b2 != 0x1c ) && ( b2 != 0x1f )) { - printf("isic%d: Error, signature 3 0x%x != (0x1c || 0x1f) for Teles S0/16.3!\n", - unit, b2); - isic_detach_common(dev); - return ENXIO; - } - - /* - * Read HSCX A/B VSTR. Expected value for the S0/16.3 card is - * 0x05 or 0x04 (for older 16.3's) in the least significant bits. - */ - - if( (((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) && - ((HSCX_READ(0, H_VSTR) & 0xf) != 0x4)) || - (((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) && - ((HSCX_READ(1, H_VSTR) & 0xf) != 0x4)) ) - { - printf("isic%d: HSCX VSTR test failed for Teles S0/16.3\n", - unit); - printf("isic%d: HSC0: VSTR: %#x\n", - unit, HSCX_READ(0, H_VSTR)); - printf("isic%d: HSC1: VSTR: %#x\n", - unit, HSCX_READ(1, H_VSTR)); - isic_detach_common(dev); - return (ENXIO); - } - - /* get our irq */ - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE))) - { - printf("isic%d: Could not get IRQ for Teles S0/16.3.\n",unit); - isic_detach_common(dev); - return ENXIO; - } - - /* get the irq number */ - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - switch(sc->sc_irq) - { - case 2: - case 9: - case 5: - case 10: - case 12: - case 15: - break; - - default: - printf("isic%d: Error, invalid IRQ [%d] specified for Teles S0/16.3!\n", - unit, sc->sc_irq); - isic_detach_common(dev); - return(ENXIO); - break; - } - - /* register interrupt routine */ - if (bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, NULL, - (void(*)(void *))(isicintr), sc, &ih) != 0) - { - printf("isic%d: Could not setup IRQ for Teles S0/16.3.\n",unit); - isic_detach_common(dev); - return ENXIO; - } - - return (0); -} - -/*---------------------------------------------------------------------------* - * isic_attach_s0163 - attach Teles S0/16.3 and compatibles - *---------------------------------------------------------------------------*/ -int -isic_attach_s0163(device_t dev) -{ - unsigned int unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = &l1_sc[unit]; - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]); - - /* configure IRQ */ - - DELAY(SEC_DELAY / 10); - bus_space_write_1(t, h, 4, intr_no[sc->sc_irq]); - - DELAY(SEC_DELAY / 10); - bus_space_write_1(t, h, 4, intr_no[sc->sc_irq] | 0x01); - - return (0); -} - -#endif /* defined(TEL_S0_16_3) */ diff --git a/sys/i4b/layer1/isic/i4b_tel_s08.c b/sys/i4b/layer1/isic/i4b_tel_s08.c deleted file mode 100644 index 3ca0f2c23ea0..000000000000 --- a/sys/i4b/layer1/isic/i4b_tel_s08.c +++ /dev/null @@ -1,302 +0,0 @@ -/*- - * Copyright (c) 1996 Arne Helme. All rights reserved. - * Copyright (c) 1996 Gary Jennejohn. All rights reserved. - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * isic - I4B Siemens ISDN Chipset Driver for Teles S0/8 and clones - * ================================================================ - * last edit-date: [Wed Jan 24 09:27:58 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(TEL_S0_8) - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#define TELES_S08_MEMSIZE 0x1000 - -static const bus_size_t offset[] = { 0x100, 0x180, 0x1c0 }; - -/*---------------------------------------------------------------------------* - * Teles S0/8 write register routine - *---------------------------------------------------------------------------*/ -static void -tels08_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - - offs += offset[what]; - - if (offs & 0x01) - offs |= 0x200; - - bus_space_write_1(t, h, offs, data); -} - -/*---------------------------------------------------------------------------* - * Teles S0/8 read register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -tels08_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - - offs += offset[what]; - - if (offs & 0x01) - offs |= 0x200; - - return bus_space_read_1(t, h, offs); -} - -/*---------------------------------------------------------------------------* - * Teles S0/8 fifo write access - *---------------------------------------------------------------------------*/ -static void -tels08_write_fifo(struct l1_softc *sc, int what, void *data, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - bus_space_write_region_1(t, h, offset[what], data, size); -} - -/*---------------------------------------------------------------------------* - * Teles S0/8 fifo read access - *---------------------------------------------------------------------------*/ -static void -tels08_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - bus_space_read_region_1(t, h, offset[what], buf, size); -} - -/*---------------------------------------------------------------------------* - * isic_probe_s08 - probe for Teles S0/8 and compatibles - *---------------------------------------------------------------------------*/ -int -isic_probe_s08(device_t dev) -{ - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = 0; /* pointer to softc */ - void *ih = 0; /* dummy */ - - /* check max unit range */ - - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for Teles S0/8!\n", - unit, unit); - return(ENXIO); - } - - sc = &l1_sc[unit]; /* get pointer to softc */ - sc->sc_unit = unit; /* set unit */ - - /* see if an io base was supplied */ - - if((sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - /* the S0/8 is completely memory mapped ! */ - - bus_release_resource(dev,SYS_RES_IOPORT, - sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - printf("isic%d: Error, iobase specified for Teles S0/8!\n", unit); - return(ENXIO); - } - - /* allocate memory */ - - if(!(sc->sc_resources.mem = - bus_alloc_resource(dev, SYS_RES_MEMORY, - &sc->sc_resources.mem_rid, - 0ul, ~0ul, TELES_S08_MEMSIZE, RF_ACTIVE))) - { - printf("isic%d: Could not allocate memory for Teles S0/8!\n", unit); - return(ENXIO); - } - - /* - * get virtual addr. it's just needed to see if it is in - * the valid range - */ - - sc->sc_vmem_addr = rman_get_virtual(sc->sc_resources.mem); - - /* check if inside memory range of 0xA0000 .. 0xDF000 */ - - if((kvtop(sc->sc_vmem_addr) < 0xa0000) || - (kvtop(sc->sc_vmem_addr) > 0xdf000)) - { - printf("isic%d: Error, mem addr 0x%x outside 0xA0000-0xDF000 for Teles S0/8!\n", - unit, kvtop(sc->sc_vmem_addr)); - bus_release_resource(dev,SYS_RES_MEMORY, - sc->sc_resources.mem_rid, - sc->sc_resources.mem); - sc->sc_resources.mem = 0; - return(ENXIO); - } - - /* setup ISAC access routines */ - - sc->clearirq = NULL; - - sc->readreg = tels08_read_reg; - sc->writereg = tels08_write_reg; - - sc->readfifo = tels08_read_fifo; - sc->writefifo = tels08_write_fifo; - - sc->sc_cardtyp = CARD_TYPEP_8; /* setup card type */ - - sc->sc_bustyp = BUS_TYPE_IOM1; /* setup IOM bus type */ - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* setup ISAC base addr, though we don't really need it */ - - ISAC_BASE = (caddr_t)((sc->sc_vmem_addr) + 0x100); - - /* setup HSCX base addr */ - - HSCX_A_BASE = (caddr_t)((sc->sc_vmem_addr) + 0x180); - HSCX_B_BASE = (caddr_t)((sc->sc_vmem_addr) + 0x1c0); - - /* allocate our irq */ - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE))) - { - printf("isic%d: Could not allocate irq for Teles S0/8!\n",unit); - - bus_release_resource(dev,SYS_RES_MEMORY, - sc->sc_resources.mem_rid, - sc->sc_resources.mem); - - sc->sc_resources.mem = 0; - return ENXIO; - } - - /* get the irq number */ - - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - /* check IRQ validity */ - - switch(sc->sc_irq) - { - case 2: - case 9: /* XXX */ - case 3: - case 4: - case 5: - case 6: - case 7: - break; - - default: - printf("isic%d: Error, invalid IRQ [%d] specified for Teles S0/8!\n", - unit, sc->sc_irq); - bus_release_resource(dev,SYS_RES_IRQ, - sc->sc_resources.irq_rid, - sc->sc_resources.irq); - sc->sc_resources.irq = 0; - bus_release_resource(dev,SYS_RES_MEMORY, - sc->sc_resources.mem_rid, - sc->sc_resources.mem); - sc->sc_resources.mem = 0; - return(ENXIO); - break; - } - - /* register interrupt routine */ - - bus_setup_intr(dev, sc->sc_resources.irq, - INTR_TYPE_NET, - NULL, (void(*)(void *))(isicintr), - sc, &ih); - - return (0); -} - -/*---------------------------------------------------------------------------* - * isic_attach_s08 - attach Teles S0/8 and compatibles - *---------------------------------------------------------------------------*/ -int -isic_attach_s08(device_t dev) -{ - struct l1_softc *sc = &l1_sc[device_get_unit(dev)]; - bus_space_tag_t t = rman_get_bustag(sc->sc_resources.mem); - bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.mem); - - /* set card off */ - - bus_space_write_1(t, h, 0x80, 0); - - DELAY(SEC_DELAY / 5); - - /* set card on */ - - bus_space_write_1(t, h, 0x80, 1); - - DELAY(SEC_DELAY / 5); - - return 0; -} - -#endif /* defined(TEL_S0_8) */ diff --git a/sys/i4b/layer1/isic/i4b_usr_sti.c b/sys/i4b/layer1/isic/i4b_usr_sti.c deleted file mode 100644 index cbdfbc9000f7..000000000000 --- a/sys/i4b/layer1/isic/i4b_usr_sti.c +++ /dev/null @@ -1,498 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_usr_sti.c - USRobotics Sportster ISDN TA intern (Tina-pp) - * ------------------------------------------------------------- - * last edit-date: [Wed Jan 24 09:28:12 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#if defined(USR_STI) - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -/*---------------------------------------------------------------------------* - * USR Sportster TA intern special registers - *---------------------------------------------------------------------------*/ -#define USR_HSCXA_OFF 0x0000 -#define USR_HSCXB_OFF 0x4000 -#define USR_INTL_OFF 0x8000 -#define USR_ISAC_OFF 0xc000 - -#define USR_RES_BIT 0x80 /* 0 = normal, 1 = reset ISAC/HSCX */ -#define USR_INTE_BIT 0x40 /* 0 = IRQ disabled, 1 = IRQ's enabled */ -#define USR_IL_MASK 0x07 /* IRQ level config */ - -static u_char intr_no[] = { 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 3, 4, 5, 0, 6, 7 }; - -#define ADDR(reg) \ - (((reg/4) * 1024) + ((reg%4) * 2)) - -#ifdef USRTA_DEBUG_PORTACCESS -int debugcntr; -#define USRTA_DEBUG(fmt) \ - if (++debugcntr < 1000) printf fmt; -#else -#define USRTA_DEBUG(fmt) -#endif - -/*---------------------------------------------------------------------------* - * USRobotics read fifo routine - *---------------------------------------------------------------------------*/ -static void -usrtai_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - register int offset = 0; - register unsigned int base = 0; - -USRTA_DEBUG(("usrtai_read_fifo: what %d size %d\n", what, size)) - switch (what) - { - case ISIC_WHAT_ISAC: - base = (unsigned int)ISAC_BASE; - break; - case ISIC_WHAT_HSCXA: - base = (unsigned int)HSCX_A_BASE; - break; - case ISIC_WHAT_HSCXB: - base = (unsigned int)HSCX_B_BASE; - break; - default: - printf("usrtai_read_fifo: invalid what %d\n", what); - return; - } - - for(;size > 0; size--, offset++) - { - *((u_char *)buf + offset) = inb(base + ADDR(offset)); - } -} - -/*---------------------------------------------------------------------------* - * USRobotics write fifo routine - *---------------------------------------------------------------------------*/ -static void -usrtai_write_fifo(struct l1_softc *sc, int what, void *data, size_t size) -{ - register int offset = 0; - register unsigned int base = 0; - -USRTA_DEBUG(("usrtai_write_fifo: what %d size %d\n", what, size)) - switch (what) - { - case ISIC_WHAT_ISAC: - base = (unsigned int)ISAC_BASE; - break; - case ISIC_WHAT_HSCXA: - base = (unsigned int)HSCX_A_BASE; - break; - case ISIC_WHAT_HSCXB: - base = (unsigned int)HSCX_B_BASE; - break; - default: - printf("usrtai_write_fifo: invalid what %d\n", what); - return; - } - - - for(;size > 0; size--, offset++) - { - outb(base + ADDR(offset), *((u_char *)data + offset)); - } -} - -/*---------------------------------------------------------------------------* - * USRobotics write register routine - *---------------------------------------------------------------------------*/ -static void -usrtai_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - register unsigned int base = 0; - -USRTA_DEBUG(("usrtai_write_reg: what %d ADDR(%d) %d data %#x\n", what, offs, ADDR(offs), data)) - switch (what) - { - case ISIC_WHAT_ISAC: - base = (unsigned int)ISAC_BASE; - break; - case ISIC_WHAT_HSCXA: - base = (unsigned int)HSCX_A_BASE; - break; - case ISIC_WHAT_HSCXB: - base = (unsigned int)HSCX_B_BASE; - break; - default: - printf("usrtai_write_reg invalid what %d\n", what); - return; - } - - outb(base + ADDR(offs), (u_char)data); -} - -/*---------------------------------------------------------------------------* - * USRobotics read register routine - *---------------------------------------------------------------------------*/ -static u_int8_t -usrtai_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - register unsigned int base = 0; - u_int8_t byte; - -USRTA_DEBUG(("usrtai_read_reg: what %d ADDR(%d) %d..", what, offs, ADDR(offs))) - switch (what) - { - case ISIC_WHAT_ISAC: - base = (unsigned int)ISAC_BASE; - break; - case ISIC_WHAT_HSCXA: - base = (unsigned int)HSCX_A_BASE; - break; - case ISIC_WHAT_HSCXB: - base = (unsigned int)HSCX_B_BASE; - break; - default: - printf("usrtai_read_reg: invalid what %d\n", what); - return(0); - } - - byte = inb(base + ADDR(offs)); -USRTA_DEBUG(("usrtai_read_reg: got %#x\n", byte)) - return(byte); -} - -/*---------------------------------------------------------------------------* - * allocate an io port - based on code in isa_isic.c - *---------------------------------------------------------------------------*/ -static int -usrtai_alloc_port(device_t dev) -{ - size_t unit = device_get_unit(dev); - struct l1_softc *sc = &l1_sc[unit]; - int i, num = 0; - bus_size_t base; - - /* 49 io mappings: 1 config and 48x8 registers */ - - /* config at offset 0x8000 */ - base = sc->sc_port + 0x8000; - if (base < 0 || base > 0x0ffff) - return 1; - sc->sc_resources.io_rid[num] = num; - - bus_set_resource(dev, SYS_RES_IOPORT, num, base, 1); - - if(!(sc->sc_resources.io_base[num] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[num], - RF_ACTIVE))) - { - printf("isic%d: Error, failed to reserve io #%dport %#x!\n", unit, num, base); - isic_detach_common(dev); - return(ENXIO); - } - num++; - - /* HSCX A at offset 0 */ - base = sc->sc_port; - for (i = 0; i < 16; i++) { - if (base+i*1024 < 0 || base+i*1024+8 > 0x0ffff) - return 1; - sc->sc_resources.io_rid[num] = num; - - bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8); - - if(!(sc->sc_resources.io_base[num] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[num], - RF_ACTIVE))) - { - printf("isic%d: Error, failed to reserve io #%d port %#x!\n", unit, num, base+i*1024); - isic_detach_common(dev); - return(ENXIO); - } - ++num; - } - - /* HSCX B at offset 0x4000 */ - base = sc->sc_port + 0x4000; - for (i = 0; i < 16; i++) { - if (base+i*1024 < 0 || base+i*1024+8 > 0x0ffff) - return 1; - sc->sc_resources.io_rid[num] = num; - - bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8); - - if(!(sc->sc_resources.io_base[num] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[num], - RF_ACTIVE))) - { - printf("isic%d: Error, failed to reserve io #%d port %#x!\n", unit, num, base+i*1024); - isic_detach_common(dev); - return(ENXIO); - } - ++num; - } - - /* ISAC at offset 0xc000 */ - base = sc->sc_port + 0xc000; - for (i = 0; i < 16; i++) { - if (base+i*1024 < 0 || base+i*1024+8 > 0x0ffff) - return 1; - sc->sc_resources.io_rid[num] = num; - - bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8); - - if(!(sc->sc_resources.io_base[num] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[num], - RF_ACTIVE))) - { - printf("isic%d: Error, failed to reserve io #%d port %#x!\n", unit, num, base+i*1024); - isic_detach_common(dev); - return(ENXIO); - } - ++num; - } - - return(0); -} - -/*---------------------------------------------------------------------------* - * isic_probe_usrtai - probe for USR - *---------------------------------------------------------------------------*/ -int -isic_probe_usrtai(device_t dev) -{ - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = 0; /* pointer to softc */ - void *ih = 0; /* dummy */ - - /* check max unit range */ - - if(unit >= ISIC_MAXUNIT) - { - printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for USR Sportster TA!\n", - unit, unit); - return(ENXIO); - } - - sc = &l1_sc[unit]; /* get pointer to softc */ - sc->sc_unit = unit; /* set unit */ - - /* see if an io base was supplied */ - - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - printf("isic%d: Could not get iobase for USR Sportster TA!\n", - unit); - return(ENXIO); - } - - /* set io base */ - - sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]); - - /* release io base */ - - bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[0], - sc->sc_resources.io_base[0]); - - - /* check if we got an iobase */ - - switch(sc->sc_port) - { - case 0x200: - case 0x208: - case 0x210: - case 0x218: - case 0x220: - case 0x228: - case 0x230: - case 0x238: - case 0x240: - case 0x248: - case 0x250: - case 0x258: - case 0x260: - case 0x268: - case 0x270: - case 0x278: - break; - - default: - printf("isic%d: Error, invalid iobase 0x%x specified for USR Sportster TA!\n", - unit, sc->sc_port); - return(0); - break; - } - - /* allocate all the ports needed */ - - if(usrtai_alloc_port(dev)) - { - printf("isic%d: Could not get the ports for USR Sportster TA!\n", unit); - isic_detach_common(dev); - return(ENXIO); - } - - /* get our irq */ - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_ACTIVE))) - { - printf("isic%d: Could not get an irq for USR Sportster TA!\n",unit); - isic_detach_common(dev); - return ENXIO; - } - - /* get the irq number */ - sc->sc_irq = rman_get_start(sc->sc_resources.irq); - - /* register interrupt routine */ - bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, - NULL, (void(*)(void *))(isicintr), - sc, &ih); - - /* check IRQ validity */ - - if(intr_no[sc->sc_irq] == 0) - { - printf("isic%d: Error, invalid IRQ [%d] specified for USR Sportster TA!\n", - unit, sc->sc_irq); - return(1); - } - - /* setup ISAC access routines */ - - sc->clearirq = NULL; - sc->readreg = usrtai_read_reg; - sc->writereg = usrtai_write_reg; - - sc->readfifo = usrtai_read_fifo; - sc->writefifo = usrtai_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_USRTA; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - sc->sc_ipac = 0; - sc->sc_bfifolen = HSCX_FIFO_LEN; - - /* setup ISAC and HSCX base addr */ - - ISAC_BASE = (caddr_t)sc->sc_port + USR_ISAC_OFF; - HSCX_A_BASE = (caddr_t)sc->sc_port + USR_HSCXA_OFF; - HSCX_B_BASE = (caddr_t)sc->sc_port + USR_HSCXB_OFF; - - /* - * Read HSCX A/B VSTR. Expected value for USR Sportster TA based - * boards is 0x05 in the least significant bits. - */ - - if( ((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) || - ((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) ) - { - printf("isic%d: HSCX VSTR test failed for USR Sportster TA\n", - unit); - printf("isic%d: HSC0: VSTR: %#x\n", - unit, HSCX_READ(0, H_VSTR)); - printf("isic%d: HSC1: VSTR: %#x\n", - unit, HSCX_READ(1, H_VSTR)); - return (1); - } - - return (0); -} - -/*---------------------------------------------------------------------------* - * isic_attach_usrtai - attach USR - *---------------------------------------------------------------------------*/ -int -isic_attach_usrtai(device_t dev) -{ - u_char irq = 0; - size_t unit = device_get_unit(dev); /* get unit */ - struct l1_softc *sc = 0; /* pointer to softc */ - - sc = &l1_sc[unit]; /* get pointer to softc */ - - /* reset the HSCX and ISAC chips */ - - outb(sc->sc_port + USR_INTL_OFF, USR_RES_BIT); - DELAY(SEC_DELAY / 10); - - outb(sc->sc_port + USR_INTL_OFF, 0x00); - DELAY(SEC_DELAY / 10); - - /* setup IRQ */ - - if((irq = intr_no[sc->sc_irq]) == 0) - { - printf("isic%d: Attach error, invalid IRQ [%d] specified for USR Sportster TA!\n", - unit, sc->sc_irq); - return(1); - } - - /* configure and enable irq */ - - outb(sc->sc_port + USR_INTL_OFF, irq | USR_INTE_BIT); - DELAY(SEC_DELAY / 10); - - return (0); -} - -#endif /* defined(USR_STI) */ diff --git a/sys/i4b/layer1/itjc/i4b_hdlc.h b/sys/i4b/layer1/itjc/i4b_hdlc.h deleted file mode 100644 index 09c8ddd762b7..000000000000 --- a/sys/i4b/layer1/itjc/i4b_hdlc.h +++ /dev/null @@ -1,319 +0,0 @@ -/*- - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_hdlc.h - software-HDLC header file - * -------------------------------------- - * - * $Id: i4b_hdlc.h,v 1.5 2000/08/28 07:41:19 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Jan 11 11:31:01 2001] - * - * Please conform "ihfc/i4b_ihfc_drv.c" (ihfc_hdlc_Bxxxx) - * for correct usage! (-hp) - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_HDLC_H_ -#define _I4B_HDLC_H_ - -extern const u_short HDLC_FCS_TAB[256]; -extern const u_short HDLC_BIT_TAB[256]; - -/*---------------------------------------------------------------------------* - * HDLC_DECODE - * =========== - * - * u_char: flag, blevel - * u_short: crc, ib, tmp, tmp2, len - * - * next: 'continue' or 'goto xxx' - * - * cfr: complete frame - * nfr: new frame - * NOTE: must setup 'len' and 'dst', so that 'dst' may be written - * at most 'len' times. - * - * rab: abort - * rdd: read data (read byte is stored in 'tmp2') - * rdo: overflow - * - * d: dummy - * - * NOTE: setting flag to '0' and len to '0' => recover from rdu - * NOTE: bits[8 .. ] of tmp2 may be used to store custom data/flags - * NOTE: these variables have to be 'suspended' / 'resumed' somehow: - * flag, blevel, crc, ib, tmp, len - * NOTE: zero is default value for all variables. - * NOTE: each time 'dst' is written, 'len' is decreased by one. - *---------------------------------------------------------------------------*/ - -#define HDLC_DECODE(dst, len, tmp, tmp2, blevel, ib, crc, flag, rddcmd, nfrcmd, \ - cfrcmd, rabcmd, rdocmd, nextcmd, d) \ - \ - rddcmd; \ - \ - ib += HDLC_BIT_TAB[(u_char)tmp2]; \ - \ - if ((u_char)ib >= 5) \ - { \ - if (ib & 0x20) /* de-stuff (msb) */ \ - { \ - if ((u_char)tmp2 == 0x7e) goto j0##d; \ - tmp2 += tmp2 & 0x7f; \ - blevel--; \ - \ - if ((ib += 0x100) & 0xc) tmp2 |= 1; /* */ \ - } \ - \ - ib &= ~0xe0; \ - \ - if ((u_char)ib == 6) /* flag seq (lsb) */ \ - { \ - j0##d: if (flag >= 2) \ - { \ - len += (4 - flag) & 3; /* remove CRC bytes */ \ - crc ^= 0xf0b8; \ - cfrcmd; \ - len = 0; \ - } \ - \ - flag = 1; \ - \ - blevel = (ib >> 8) & 0xf; \ - tmp = ((u_char)tmp2) >> blevel; \ - blevel = 8 - blevel; \ - \ - ib >>= 12; \ - \ - nextcmd; \ - } \ - if ((u_char)ib >= 7) /* abort (msb & lsb) */ \ - { \ - if (flag >= 2) \ - { \ - rabcmd; \ - len = 0; \ - } \ - \ - flag = 0; \ - \ - ib >>= 12; \ - \ - nextcmd; \ - } \ - if ((u_char)ib == 5) /* de-stuff (lsb) */ \ - { \ - tmp2 = (tmp2 | (tmp2 + 1)) & ~0x1; \ - blevel--; \ - } \ - if (blevel > 7) /* EO - bits */ \ - { \ - tmp |= (u_char)tmp2 >> (8 - (blevel &= 7)); \ - \ - ib >>= 12; \ - \ - nextcmd; \ - } \ - } \ - \ - tmp |= (u_char)tmp2 << blevel; \ - \ - if (!len--) \ - { \ - len++; \ - \ - if (!flag++) { flag--; goto j5##d;} /* hunt mode */ \ - \ - switch (flag) \ - { case 2: /* new frame */ \ - nfrcmd; \ - crc = -1; \ - if (!len--) { len++; flag++; goto j4##d; } \ - goto j3##d; \ - case 3: /* CRC (lsb's) */ \ - case 4: /* CRC (msb's) */ \ - goto j4##d; \ - case 5: /* RDO */ \ - rdocmd; \ - flag = 0; \ - break; \ - } \ - } \ - else \ - { \ - j3##d: dst = (u_char)tmp; \ - j4##d: crc = (HDLC_FCS_TAB[(u_char)(tmp ^ crc)] ^ (u_char)(crc >> 8)); \ - } \ - \ - j5##d: ib >>= 12; \ - tmp >>= 8; \ - -/*------ end of HDLC_DECODE -------------------------------------------------*/ - - -/*---------------------------------------------------------------------------* - * HDLC_ENCODE - * =========== - * - * u_char: flag, src - * u_short: tmp2, blevel, ib, crc, len - * u_int: tmp - * - * gfr: This is the place where you free the last [mbuf] chain, and get - * the next one. If a mbuf is available the code should setup 'len' - * and 'src' so that 'src' may be read 'len' times. If no mbuf is - * available leave 'len' and 'src' untouched. - * - * nmb: If your implementation accept/use chained mbufs, this is the - * place where you update 'len' and 'src' to the next mbuf of - * the chain that makes up a frame. If no further mbuf is - * available leave 'len' and 'src' untouched. This is not the - * place where you free the mbuf. Leave the block empty if your - * implementation does not accept/use chained mbufs. - * - * wrd: write data (output = (u_char)tmp) - * - * d: dummy - * - * NOTE: setting flag to '-2' and len to '0' => abort bytes will be sent - * NOTE: these variables have to be 'suspended' / 'resumed' somehow: - * flag, blevel, crc, ib, tmp, len - * NOTE: zero is default value for all variables. - * NOTE: each time 'src' is read, 'len' is decreased by one. - * NOTE: neither cmd's should exit through 'goto' or 'break' statements. - *---------------------------------------------------------------------------*/ - -#define HDLC_ENCODE(src, len, tmp, tmp2, blevel, ib, crc, flag, gfrcmd, nmbcmd, wrdcmd, d) \ - \ - if (blevel >= 0x800) { blevel -= 0x800; goto j4##d; } \ - \ - if (!len--) \ - { \ - len++; \ - \ - switch(++flag) \ - { default: /* abort */ \ - tmp = blevel = 0; /* zero is default */ \ - tmp2 = 0xff; \ - goto j3##d; \ - case 1: /* 1st time FS */ \ - case 2: /* 2nd time FS */ \ - tmp2 = 0x7e; \ - goto j3##d; \ - case 3: \ - gfrcmd; /* get new frame */ \ - if (!len--) \ - { \ - len++; \ - flag--; /* don't proceed */ \ - tmp2 = 0x7e; \ - goto j3##d; /* final FS */ \ - } \ - else \ - { \ - crc = -1; \ - ib = 0; \ - goto j1##d; /* first byte */ \ - } \ - case 4: \ - nmbcmd; /* get next mbuf in chain */ \ - if (!len--) \ - { \ - len++; \ - crc ^= -1; \ - tmp2 = (u_char)crc; \ - goto j2##d; /* CRC (lsb's) */ \ - } \ - else \ - { \ - flag--; \ - goto j1##d; /* proceed with the frame */ \ - } \ - case 5: \ - tmp2 = (u_char)(crc >> 8); \ - flag = 1; \ - goto j2##d; /* CRC (msb's) */ \ - } \ - } \ - else \ - { j1##d : \ - tmp2 = (u_char)src; \ - crc =(HDLC_FCS_TAB[(u_char)(crc ^ tmp2)] ^ (u_char)(crc >> 8)); \ - j2##d: \ - \ - ib >>= 12; \ - ib += HDLC_BIT_TAB[(u_char)tmp2]; \ - \ - if ((u_char)ib >= 5) /* stuffing */ \ - { \ - blevel &= ~0xff; \ - \ - if (ib & 0xc0) /* bit stuff (msb) */ \ - { \ - tmp2 += tmp2 & (0xff * (ib & 0xc0)); \ - ib %= 0x5000; \ - blevel++; \ - } \ - \ - ib &= ~0xf0; \ - \ - if ((u_char)ib >= 5) /* bit stuff (lsb) */ \ - { \ - tmp2 += tmp2 & ~0x1f >> ((ib - (ib >> 8) + 1) \ - & 7); \ - blevel++; \ - \ - if ((u_char)ib >= 10) /* bit stuff (msb) */ \ - { \ - tmp2 += tmp2 & ~0x7ff >> ((ib - \ - (ib >> 8) + 1) & 7); \ - blevel++; \ - } \ - if (ib & 0x8000) /* bit walk */ \ - { \ - ib = ((u_char)ib % 5) << 12; \ - } \ - } \ - \ - tmp |= tmp2 << (u_char)(blevel >> 8); \ - blevel += (u_char)blevel << 8; \ - } \ - else /* no stuffing */ \ - { \ - j3##d:tmp |= tmp2 << (u_char)(blevel >> 8); \ - } \ - } \ - \ - j4##d: wrdcmd; \ - tmp >>= 8; \ - -/*------ end of HDLC_ENCODE -------------------------------------------------*/ - - -#endif /* _I4B_HDLC_H_ */ diff --git a/sys/i4b/layer1/itjc/i4b_itjc_ext.h b/sys/i4b/layer1/itjc/i4b_itjc_ext.h deleted file mode 100644 index 4009dde5a651..000000000000 --- a/sys/i4b/layer1/itjc/i4b_itjc_ext.h +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Sergio Prallon. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_itjc - NetJet PCI for split layers - * ------------------------------------------ - * - * $FreeBSD$ - * - * last edit-date: [Wed Jan 10 17:15:31 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_ITJC_EXT_H_ -#define _I4B_ITJC_EXT_H_ - -#include - -void itjc_set_linktab(int unit, int channel, drvr_link_t * dlt); -isdn_link_t *itjc_ret_linktab(int unit, int channel); - -int itjc_ph_data_req(int unit, struct mbuf *m, int freeflag); -int itjc_ph_activate_req(int unit); -int itjc_mph_command_req(int unit, int command, void *parm); - -void itjc_isac_irq(struct l1_softc *sc, int ista); -void itjc_isac_l1_cmd(struct l1_softc *sc, int command); -int itjc_isac_init(struct l1_softc *sc); - -void itjc_recover(struct l1_softc *sc); -char * itjc_printstate(struct l1_softc *sc); -void itjc_next_state(struct l1_softc *sc, int event); - -#define ITJC_MAXUNIT 4 -extern struct l1_softc *itjc_scp[ITJC_MAXUNIT]; - -#endif /* _I4B_ITJC_EXT_H_ */ diff --git a/sys/i4b/layer1/itjc/i4b_itjc_isac.c b/sys/i4b/layer1/itjc/i4b_itjc_isac.c deleted file mode 100644 index ab267b788732..000000000000 --- a/sys/i4b/layer1/itjc/i4b_itjc_isac.c +++ /dev/null @@ -1,545 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_itjc_isac.c - i4b NetJet-S ISAC handler - * -------------------------------------------- - * last edit-date: [Wed Jan 10 17:15:54 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include - -#include - -#include -#include - -#include - -#include -#include - -static u_char itjc_isac_exir_hdlr(register struct l1_softc *sc, u_char exir); -static void itjc_isac_ind_hdlr(register struct l1_softc *sc, int ind); - -/*---------------------------------------------------------------------------* - * ISAC interrupt service routine - *---------------------------------------------------------------------------*/ -void -itjc_isac_irq(struct l1_softc *sc, int ista) -{ - register u_char c = 0; - NDBGL1(L1_F_MSG, "unit %d: ista = 0x%02x", sc->sc_unit, ista); - - if(ista & ISAC_ISTA_EXI) /* extended interrupt */ - { - c |= itjc_isac_exir_hdlr(sc, ISAC_READ(I_EXIR)); - } - - if(ista & ISAC_ISTA_RME) /* receive message end */ - { - register int rest; - u_char rsta; - - /* get rx status register */ - - rsta = ISAC_READ(I_RSTA); - - if((rsta & ISAC_RSTA_MASK) != 0x20) - { - int error = 0; - - if(!(rsta & ISAC_RSTA_CRC)) /* CRC error */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: CRC error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RDO) /* ReceiveDataOverflow */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Data Overrun error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RAB) /* ReceiveABorted */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Receive Aborted error", sc->sc_unit); - } - - if(error == 0) - NDBGL1(L1_I_ERR, "unit %d: RME unknown error, RSTA = 0x%02x!", sc->sc_unit, rsta); - - i4b_Dfreembuf(sc->sc_ibuf); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - ISAC_WRITE(I_CMDR, ISAC_CMDR_RMC|ISAC_CMDR_RRES); - ISACCMDRWRDELAY(); - - return; - } - - rest = (ISAC_READ(I_RBCL) & (ISAC_FIFO_LEN-1)); - - if(rest == 0) - rest = ISAC_FIFO_LEN; - - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(rest)) != NULL) - sc->sc_ib = sc->sc_ibuf->m_data; - else - panic("itjc_isac_irq: RME, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - rest)) - { - ISAC_RDFIFO(sc->sc_ib, rest); - sc->sc_ilen += rest; - - sc->sc_ibuf->m_pkthdr.len = - sc->sc_ibuf->m_len = sc->sc_ilen; - - if(sc->sc_trace & TRACE_D_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data); - } - - c |= ISAC_CMDR_RMC; - - if(sc->sc_enabled && - (ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S)) - { - i4b_l1_ph_data_ind(L0ITJCUNIT(sc->sc_unit), sc->sc_ibuf); - } - else - { - i4b_Dfreembuf(sc->sc_ibuf); - } - } - else - { - NDBGL1(L1_I_ERR, "RME, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - } - - if(ista & ISAC_ISTA_RPF) /* receive fifo full */ - { - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(MAX_DFRAME_LEN)) != NULL) - sc->sc_ib= sc->sc_ibuf->m_data; - else - panic("itjc_isac_irq: RPF, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - ISAC_FIFO_LEN)) - { - ISAC_RDFIFO(sc->sc_ib, ISAC_FIFO_LEN); - sc->sc_ilen += ISAC_FIFO_LEN; - sc->sc_ib += ISAC_FIFO_LEN; - c |= ISAC_CMDR_RMC; - } - else - { - NDBGL1(L1_I_ERR, "RPF, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - } - - if(ista & ISAC_ISTA_XPR) /* transmit fifo empty (XPR bit set) */ - { - if((sc->sc_obuf2 != NULL) && (sc->sc_obuf == NULL)) - { - sc->sc_freeflag = sc->sc_freeflag2; - sc->sc_obuf = sc->sc_obuf2; - sc->sc_op = sc->sc_obuf->m_data; - sc->sc_ol = sc->sc_obuf->m_len; - sc->sc_obuf2 = NULL; - } - - if(sc->sc_obuf) - { - ISAC_WRFIFO(sc->sc_op, min(sc->sc_ol, ISAC_FIFO_LEN)); - - if(sc->sc_ol > ISAC_FIFO_LEN) /* length > 32 ? */ - { - sc->sc_op += ISAC_FIFO_LEN; /* bufferptr+32 */ - sc->sc_ol -= ISAC_FIFO_LEN; /* length - 32 */ - c |= ISAC_CMDR_XTF; /* set XTF bit */ - } - else - { - if(sc->sc_freeflag) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_freeflag = 0; - } - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - c |= ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - } - else - { - sc->sc_state &= ~ISAC_TX_ACTIVE; - } - } - - if(ista & ISAC_ISTA_CISQ) /* channel status change CISQ */ - { - register u_char ci; - - /* get command/indication rx register*/ - - ci = ISAC_READ(I_CIRR); - - /* if S/Q IRQ, read SQC reg to clr SQC IRQ */ - - if(ci & ISAC_CIRR_SQC) - (void) ISAC_READ(I_SQRR); - - /* C/I code change IRQ (flag already cleared by CIRR read) */ - - if(ci & ISAC_CIRR_CIC0) - itjc_isac_ind_hdlr(sc, (ci >> 2) & 0xf); - } - - if(c) - { - ISAC_WRITE(I_CMDR, c); - ISACCMDRWRDELAY(); - } -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Extended IRQ handler - *---------------------------------------------------------------------------*/ -static u_char -itjc_isac_exir_hdlr(register struct l1_softc *sc, u_char exir) -{ - u_char c = 0; - - if(exir & ISAC_EXIR_XMR) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Message Repeat"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_XDU) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Data Underrun"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_PCE) - { - NDBGL1(L1_I_ERR, "EXIRQ Protocol Error"); - } - - if(exir & ISAC_EXIR_RFO) - { - NDBGL1(L1_I_ERR, "EXIRQ Rx Frame Overflow"); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - if(exir & ISAC_EXIR_SOV) - { - NDBGL1(L1_I_ERR, "EXIRQ Sync Xfer Overflow"); - } - - if(exir & ISAC_EXIR_MOS) - { - NDBGL1(L1_I_ERR, "EXIRQ Monitor Status"); - } - - if(exir & ISAC_EXIR_SAW) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Subscriber Awake"); - } - - if(exir & ISAC_EXIR_WOV) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Watchdog Timer Overflow"); - } - - return(c); -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Indication handler - *---------------------------------------------------------------------------*/ -static void -itjc_isac_ind_hdlr(register struct l1_softc *sc, int ind) -{ - register int event; - - switch(ind) - { - case ISAC_CIRR_IAI8: - NDBGL1(L1_I_CICO, "rx AI8 in state %s", itjc_printstate(sc)); - itjc_isac_l1_cmd(sc, CMD_AR8); - event = EV_INFO48; - i4b_l1_mph_status_ind(L0ITJCUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IAI10: - NDBGL1(L1_I_CICO, "rx AI10 in state %s", itjc_printstate(sc)); - itjc_isac_l1_cmd(sc, CMD_AR10); - event = EV_INFO410; - i4b_l1_mph_status_ind(L0ITJCUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IRSY: - NDBGL1(L1_I_CICO, "rx RSY in state %s", itjc_printstate(sc)); - event = EV_RSY; - break; - - case ISAC_CIRR_IPU: - NDBGL1(L1_I_CICO, "rx PU in state %s", itjc_printstate(sc)); - event = EV_PU; - break; - - case ISAC_CIRR_IDR: - NDBGL1(L1_I_CICO, "rx DR in state %s", itjc_printstate(sc)); - itjc_isac_l1_cmd(sc, CMD_DIU); - event = EV_DR; - break; - - case ISAC_CIRR_IDID: - NDBGL1(L1_I_CICO, "rx DID in state %s", itjc_printstate(sc)); - event = EV_INFO0; - i4b_l1_mph_status_ind(L0ITJCUNIT(sc->sc_unit), STI_L1STAT, LAYER_IDLE, NULL); - break; - - case ISAC_CIRR_IDIS: - NDBGL1(L1_I_CICO, "rx DIS in state %s", itjc_printstate(sc)); - event = EV_DIS; - break; - - case ISAC_CIRR_IEI: - NDBGL1(L1_I_CICO, "rx EI in state %s", itjc_printstate(sc)); - itjc_isac_l1_cmd(sc, CMD_DIU); - event = EV_EI; - break; - - case ISAC_CIRR_IARD: - NDBGL1(L1_I_CICO, "rx ARD in state %s", itjc_printstate(sc)); - event = EV_INFO2; - break; - - case ISAC_CIRR_ITI: - NDBGL1(L1_I_CICO, "rx TI in state %s", itjc_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_IATI: - NDBGL1(L1_I_CICO, "rx ATI in state %s", itjc_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_ISD: - NDBGL1(L1_I_CICO, "rx SD in state %s", itjc_printstate(sc)); - event = EV_INFO0; - break; - - default: - NDBGL1(L1_I_ERR, "UNKNOWN Indication 0x%x in state %s", ind, itjc_printstate(sc)); - event = EV_INFO0; - break; - } - itjc_next_state(sc, event); -} - -/*---------------------------------------------------------------------------* - * execute a layer 1 command - *---------------------------------------------------------------------------*/ -void -itjc_isac_l1_cmd(struct l1_softc *sc, int command) -{ - u_char cmd; - - if(command < 0 || command > CMD_ILL) - { - NDBGL1(L1_I_ERR, "illegal cmd 0x%x in state %s", command, itjc_printstate(sc)); - return; - } - - cmd = ISAC_CIX0_LOW; - - switch(command) - { - case CMD_TIM: - NDBGL1(L1_I_CICO, "tx TIM in state %s", itjc_printstate(sc)); - cmd |= (ISAC_CIXR_CTIM << 2); - break; - - case CMD_RS: - NDBGL1(L1_I_CICO, "tx RS in state %s", itjc_printstate(sc)); - cmd |= (ISAC_CIXR_CRS << 2); - break; - - case CMD_AR8: - NDBGL1(L1_I_CICO, "tx AR8 in state %s", itjc_printstate(sc)); - cmd |= (ISAC_CIXR_CAR8 << 2); - break; - - case CMD_AR10: - NDBGL1(L1_I_CICO, "tx AR10 in state %s", itjc_printstate(sc)); - cmd |= (ISAC_CIXR_CAR10 << 2); - break; - - case CMD_DIU: - NDBGL1(L1_I_CICO, "tx DIU in state %s", itjc_printstate(sc)); - cmd |= (ISAC_CIXR_CDIU << 2); - break; - } - ISAC_WRITE(I_CIXR, cmd); -} - -/*---------------------------------------------------------------------------* - * L1 ISAC initialization - *---------------------------------------------------------------------------*/ -int -itjc_isac_init(struct l1_softc *sc) -{ - ISAC_IMASK = 0xff; /* disable all irqs */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - NDBGL1(L1_I_SETUP, "configuring for IOM-2 mode"); - - /* ADF2: Select mode IOM-2 */ - ISAC_WRITE(I_ADF2, ISAC_ADF2_IMS); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 + C1 and B2 + IC2 monitoring - */ - ISAC_WRITE(I_SPCR, 0x00); - - /* SQXR: S/Q channel xmit register: - * IDC - IOM direction = 0 (master) - * CFS - Config Select = 0 (clock always active) - * CI1E - C/I channel 1 IRQ enable = 0 - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * IOF - IOM i/f off = 0 - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, 0x00); - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - - /* enabled interrupts: - * =================== - * RME - receive message end - * RPF - receive pool full - * XPR - transmit pool ready - * CISQ - CI or S/Q channel change - * EXI - extended interrupt - */ - - ISAC_IMASK = ISAC_MASK_RSC | /* auto mode only */ - ISAC_MASK_TIN | /* timer irq */ - ISAC_MASK_SIN; /* sync xfer irq */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - return(0); -} diff --git a/sys/i4b/layer1/itjc/i4b_itjc_l1.c b/sys/i4b/layer1/itjc/i4b_itjc_l1.c deleted file mode 100644 index 9df9bcc02382..000000000000 --- a/sys/i4b/layer1/itjc/i4b_itjc_l1.c +++ /dev/null @@ -1,236 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_itjc_l1.c - NetJet-S layer 1 handler - * --------------------------------------------- - * last edit-date: [Wed Jan 10 17:16:19 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-DATA-REQUEST - * ========================= - * - * parms: - * unit physical interface unit number - * m mbuf containing L2 frame to be sent out - * freeflag MBUF_FREE: free mbuf here after having sent - * it out - * MBUF_DONTFREE: mbuf is freed by Layer 2 - * returns: - * ==0 fail, nothing sent out - * !=0 ok, frame sent out - * - *---------------------------------------------------------------------------*/ -int -itjc_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - u_char cmd; - int s; - struct l1_softc *sc = itjc_scp[unit]; - - NDBGL1(L1_PRIM, "PH-DATA-REQ, unit %d, freeflag=%d", unit, freeflag); - - if(m == NULL) /* failsafe */ - return (0); - - s = SPLI4B(); - - if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ - { - NDBGL1(L1_I_ERR, "still in state F3!"); - itjc_ph_activate_req(unit); - } - - if(sc->sc_state & ISAC_TX_ACTIVE) - { - if(sc->sc_obuf2 == NULL) - { - sc->sc_obuf2 = m; /* save mbuf ptr */ - - if(freeflag) - sc->sc_freeflag2 = 1; /* IRQ must mfree */ - else - sc->sc_freeflag2 = 0; /* IRQ must not mfree */ - - NDBGL1(L1_I_MSG, "using 2nd ISAC TX buffer, state = %s", itjc_printstate(sc)); - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ITJCUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - splx(s); - return(1); - } - - NDBGL1(L1_I_ERR, "No Space in TX FIFO, state = %s", itjc_printstate(sc)); - - if(freeflag == MBUF_FREE) - i4b_Dfreembuf(m); - - splx(s); - return (0); - } - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0ITJCUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - sc->sc_state |= ISAC_TX_ACTIVE; /* set transmitter busy flag */ - - NDBGL1(L1_I_MSG, "ISAC_TX_ACTIVE set"); - - sc->sc_freeflag = 0; /* IRQ must NOT mfree */ - - ISAC_WRFIFO(m->m_data, min(m->m_len, ISAC_FIFO_LEN)); /* output to TX fifo */ - - if(m->m_len > ISAC_FIFO_LEN) /* message > 32 bytes ? */ - { - sc->sc_obuf = m; /* save mbuf ptr */ - sc->sc_op = m->m_data + ISAC_FIFO_LEN; /* ptr for irq hdl */ - sc->sc_ol = m->m_len - ISAC_FIFO_LEN; /* length for irq hdl */ - - if(freeflag) - sc->sc_freeflag = 1; /* IRQ must mfree */ - - cmd = ISAC_CMDR_XTF; - } - else - { - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - if(freeflag) - i4b_Dfreembuf(m); - - cmd = ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - - ISAC_WRITE(I_CMDR, cmd); - ISACCMDRWRDELAY(); - - splx(s); - - return(1); -} - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-ACTIVATE-REQUEST - * ============================= - * - * parms: - * unit physical interface unit number - * - * returns: - * ==0 - * !=0 - * - *---------------------------------------------------------------------------*/ -int -itjc_ph_activate_req(int unit) -{ - struct l1_softc *sc = itjc_scp[unit]; - NDBGL1(L1_PRIM, "PH-ACTIVATE-REQ, unit %d", unit); - itjc_next_state(sc, EV_PHAR); - return(0); -} - -/*---------------------------------------------------------------------------* - * command from the upper layers - *---------------------------------------------------------------------------*/ -int -itjc_mph_command_req(int unit, int command, void *parm) -{ - struct l1_softc *sc = itjc_scp[unit]; - - switch(command) - { - case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DOPEN", unit); - sc->sc_enabled = 1; - break; - - case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DCLOSE", unit); - sc->sc_enabled = 0; - break; - - case CMR_SETTRACE: - NDBGL1(L1_PRIM, "unit %d, command = CMR_SETTRACE, parm = %d", unit, (unsigned int)parm); - sc->sc_trace = (unsigned int)parm; - break; - - default: - NDBGL1(L1_ERROR, "ERROR, unknown command = %d, unit = %d, parm = %d", command, unit, (unsigned int)parm); - break; - } - - return(0); -} diff --git a/sys/i4b/layer1/itjc/i4b_itjc_l1fsm.c b/sys/i4b/layer1/itjc/i4b_itjc_l1fsm.c deleted file mode 100644 index 4a43e4bfbe12..000000000000 --- a/sys/i4b/layer1/itjc/i4b_itjc_l1fsm.c +++ /dev/null @@ -1,513 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_itjc_l1fsm.c - NetJet-S layer 1 I.430 state machine - * ------------------------------------------------------------ - * last edit-date: [Wed Jan 10 17:16:33 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include - -#include - -#include - -#if DO_I4B_DEBUG -static char *state_text[N_STATES] = { - "F3 Deactivated", - "F4 Awaiting Signal", - "F5 Identifying Input", - "F6 Synchronized", - "F7 Activated", - "F8 Lost Framing", - "Illegal State" -}; - -static char *event_text[N_EVENTS] = { - "EV_PHAR PH_ACT_REQ", - "EV_T3 Timer 3 expired", - "EV_INFO0 INFO0 received", - "EV_RSY Level Detected", - "EV_INFO2 INFO2 received", - "EV_INFO48 INFO4 received", - "EV_INFO410 INFO4 received", - "EV_DR Deactivate Req", - "EV_PU Power UP", - "EV_DIS Disconnected", - "EV_EI Error Ind", - "Illegal Event" -}; -#endif - -/* Function prototypes */ - -static void timer3_expired (struct l1_softc *sc); -static void T3_start (struct l1_softc *sc); -static void T3_stop (struct l1_softc *sc); -static void F_T3ex (struct l1_softc *sc); -static void timer4_expired (struct l1_softc *sc); -static void T4_start (struct l1_softc *sc); -static void T4_stop (struct l1_softc *sc); -static void F_AI8 (struct l1_softc *sc); -static void F_AI10 (struct l1_softc *sc); -static void F_I01 (struct l1_softc *sc); -static void F_I02 (struct l1_softc *sc); -static void F_I03 (struct l1_softc *sc); -static void F_I2 (struct l1_softc *sc); -static void F_ill (struct l1_softc *sc); -static void F_NULL (struct l1_softc *sc); - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expire function - *---------------------------------------------------------------------------*/ -static void -timer3_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T3) - { - NDBGL1(L1_T_ERR, "state = %s", itjc_printstate(sc)); - sc->sc_I430T3 = 0; - - /* XXX try some recovery here XXX */ - - itjc_recover(sc); - - sc->sc_init_tries++; /* increment retry count */ - -/*XXX*/ if(sc->sc_init_tries > 4) - { - int s = SPLI4B(); - - sc->sc_init_tries = 0; - - if(sc->sc_obuf2 != NULL) - { - i4b_Dfreembuf(sc->sc_obuf2); - sc->sc_obuf2 = NULL; - } - if(sc->sc_obuf != NULL) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_obuf = NULL; - sc->sc_freeflag = 0; - sc->sc_op = NULL; - sc->sc_ol = 0; - } - - splx(s); - - i4b_l1_mph_status_ind(L0ITJCUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); - } - - itjc_next_state(sc, EV_T3); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 start - *---------------------------------------------------------------------------*/ -static void -T3_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", itjc_printstate(sc)); - sc->sc_I430T3 = 1; - sc->sc_T3_callout = timeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, 2*hz); -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 stop - *---------------------------------------------------------------------------*/ -static void -T3_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", itjc_printstate(sc)); - - sc->sc_init_tries = 0; /* init connect retry count */ - - if(sc->sc_I430T3) - { - sc->sc_I430T3 = 0; - untimeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, sc->sc_T3_callout); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expiry - *---------------------------------------------------------------------------*/ -static void -F_T3ex(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_T3ex executing"); - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0ITJCUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * Timer T4 expire function - *---------------------------------------------------------------------------*/ -static void -timer4_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T4) - { - NDBGL1(L1_T_MSG, "state = %s", itjc_printstate(sc)); - sc->sc_I430T4 = 0; - i4b_l1_mph_status_ind(L0ITJCUNIT(sc->sc_unit), STI_PDEACT, 0, NULL); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * Timer T4 start - *---------------------------------------------------------------------------*/ -static void -T4_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", itjc_printstate(sc)); - sc->sc_I430T4 = 1; - sc->sc_T4_callout = timeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, hz); -} - -/*---------------------------------------------------------------------------* - * Timer T4 stop - *---------------------------------------------------------------------------*/ -static void -T4_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", itjc_printstate(sc)); - - if(sc->sc_I430T4) - { - sc->sc_I430T4 = 0; - untimeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, sc->sc_T4_callout); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI8 - *---------------------------------------------------------------------------*/ -static void -F_AI8(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI8 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0ITJCUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_8; - - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI10 - *---------------------------------------------------------------------------*/ -static void -F_AI10(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI10 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0ITJCUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_10; - - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in states F3 .. F5 - *---------------------------------------------------------------------------*/ -static void -F_I01(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I01 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F6 - *---------------------------------------------------------------------------*/ -static void -F_I02(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I02 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0ITJCUNIT(sc->sc_unit)); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F7 or F8 - *---------------------------------------------------------------------------*/ -static void -F_I03(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I03 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0ITJCUNIT(sc->sc_unit)); - - T4_start(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: activate request - *---------------------------------------------------------------------------*/ -static void -F_AR(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO1_8; - - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_TE; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - - itjc_isac_l1_cmd(sc, CMD_AR8); - - T3_start(sc); -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO2 - *---------------------------------------------------------------------------*/ -static void -F_I2(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I2 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO2; - - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - -} - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(struct l1_softc *sc) -{ - NDBGL1(L1_F_ERR, "FSM function F_ill executing"); -} - -/*---------------------------------------------------------------------------* - * No action - *---------------------------------------------------------------------------*/ -static void -F_NULL(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_NULL executing"); -} - - -/*---------------------------------------------------------------------------* - * layer 1 state transition table - *---------------------------------------------------------------------------*/ -struct itjc_state_tab { - void (*func) (struct l1_softc *sc); /* function to execute */ - int newstate; /* next state */ -} itjc_state_tab[N_EVENTS][N_STATES] = { - -/* STATE: F3 F4 F5 F6 F7 F8 ILLEGAL STATE */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* EV_PHAR x*/ {{F_AR, ST_F4}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_ill, ST_ILL}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_T3 x*/ {{F_NULL, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO0 */ {{F_I01, ST_F3}, {F_I01, ST_F4}, {F_I01, ST_F5}, {F_I02, ST_F3}, {F_I03, ST_F3}, {F_I03, ST_F3}, {F_ill, ST_ILL}}, -/* EV_RSY x*/ {{F_NULL, ST_F3}, {F_NULL, ST_F5}, {F_NULL, ST_F5}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO2 */ {{F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_ill, ST_ILL}}, -/* EV_INFO48*/ {{F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_NULL, ST_F7}, {F_AI8, ST_F7}, {F_ill, ST_ILL}}, -/* EV_INFO41*/ {{F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_NULL, ST_F7}, {F_AI10, ST_F7}, {F_ill, ST_ILL}}, -/* EV_DR */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_PU */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_DIS */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_EI */ {{F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_ill, ST_ILL}}, -/* EV_ILL */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -itjc_next_state(struct l1_softc *sc, int event) -{ - int currstate, newstate; - - if(event >= N_EVENTS) - panic("i4b_l1fsm.c: event >= N_EVENTS\n"); - - currstate = sc->sc_I430state; - - if(currstate >= N_STATES) - panic("i4b_l1fsm.c: currstate >= N_STATES\n"); - - newstate = itjc_state_tab[event][currstate].newstate; - - if(newstate >= N_STATES) - panic("i4b_l1fsm.c: newstate >= N_STATES\n"); - - NDBGL1(L1_F_MSG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]); - - (*itjc_state_tab[event][currstate].func)(sc); - - if(newstate == ST_ILL) - { - newstate = ST_F3; - NDBGL1(L1_F_ERR, "FSM Illegal State ERROR, oldstate = %s, newstate = %s, event = %s!", - state_text[currstate], - state_text[newstate], - event_text[event]); - } - - sc->sc_I430state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -itjc_printstate(struct l1_softc *sc) -{ - return((char *) state_text[sc->sc_I430state]); -} -#endif diff --git a/sys/i4b/layer1/itjc/i4b_itjc_pci.c b/sys/i4b/layer1/itjc/i4b_itjc_pci.c deleted file mode 100644 index 6d255af43be1..000000000000 --- a/sys/i4b/layer1/itjc/i4b_itjc_pci.c +++ /dev/null @@ -1,2142 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Sergio Prallon. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_itjc_pci.c: NetJet-S hardware driver - * ---------------------------------------- - * last edit-date: [Sat May 13 15:25:47 2006] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include /* XXXXXXXXXXXXXXXXXXXXXXXX */ - -#include -#include - -#include - -#define PCI_TJNET_VID (0xe159) -#define PCI_TJ300_DID (0x0001) - - -/* - * Function prototypes - */ - -static int itjc_probe(device_t dev); -static int itjc_attach(device_t dev); -static void itjc_shutdown(device_t dev); -static void itjc_intr(void *xsc); -static int itjc_dma_start(struct l1_softc *sc); -static void itjc_dma_stop(struct l1_softc *sc); -static void itjc_isac_intr(struct l1_softc *sc); -static void itjc_init_linktab(struct l1_softc *sc); -static void itjc_bchannel_setup(int unit, int h_chan, int bprot, - int activate); -static void itjc_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp); - - -/* - * Shorter names to bus resource manager routines. - */ - -#define itjc_bus_setup(sc) \ - bus_space_handle_t h = \ - rman_get_bushandle((sc)->sc_resources.io_base[0]); \ - bus_space_tag_t t = \ - rman_get_bustag((sc)->sc_resources.io_base[0]); - -#define itjc_read_1(port) (bus_space_read_1(t, h, (port))) -#define itjc_read_4(port) (bus_space_read_4(t, h, (port))) -#define itjc_write_1(port, data) (bus_space_write_1(t, h, (port), (data))) -#define itjc_write_4(port, data) (bus_space_write_4(t, h, (port), (data))) -#define itjc_read_multi_1(port, buf, size) \ - (bus_space_read_multi_1(t, h, (port), (buf), (size))) -#define itjc_write_multi_1(port, buf, size) \ - (bus_space_write_multi_1(t, h, (port), (buf), (size))) - - -/*---------------------------------------------------------------------------* - * Glue data to register ourselves as a PCI device driver. - *---------------------------------------------------------------------------*/ - -static device_method_t itjc_pci_methods[] = -{ - /* Device interface */ - DEVMETHOD(device_probe, itjc_probe), - DEVMETHOD(device_attach, itjc_attach), - DEVMETHOD(device_shutdown, itjc_shutdown), - - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - { 0, 0 } -}; - -static driver_t itjc_pci_driver = -{ - "itjc", - itjc_pci_methods, - sizeof(struct l1_softc) -}; - -static devclass_t itjc_pci_devclass; - -DRIVER_MODULE(netjet, pci, itjc_pci_driver, itjc_pci_devclass, 0, 0); - -/* - * Jump table for multiplex routines. - */ - -struct i4b_l1mux_func itjc_l1mux_func = -{ - itjc_ret_linktab, - itjc_set_linktab, - itjc_mph_command_req, - itjc_ph_data_req, - itjc_ph_activate_req, -}; - -struct l1_softc *itjc_scp[ITJC_MAXUNIT]; - - -/*---------------------------------------------------------------------------* - * Tiger300/320 PCI ASIC registers. - *---------------------------------------------------------------------------*/ - -/* - * Register offsets from i/o base. - */ -enum tiger_regs -{ - TIGER_RESET_PIB_CL_TIME = 0x00, - TIGER_DMA_OPER = 0x01, - TIGER_AUX_PORT_CNTL = 0x02, - TIGER_AUX_PORT_DATA = 0x03, - TIGER_INT0_MASK = 0x04, - TIGER_INT1_MASK = 0x05, - TIGER_INT0_STATUS = 0x06, - TIGER_INT1_STATUS = 0x07, - TIGER_DMA_WR_START_ADDR = 0x08, - TIGER_DMA_WR_INT_ADDR = 0x0C, - TIGER_DMA_WR_END_ADDR = 0x10, - TIGER_DMA_WR_CURR_ADDR = 0x14, - TIGER_DMA_RD_START_ADDR = 0x18, - TIGER_DMA_RD_INT_ADDR = 0x1C, - TIGER_DMA_RD_END_ADDR = 0x20, - TIGER_DMA_RD_CURR_ADDR = 0x24, - TIGER_PULSE_COUNTER = 0x28, -}; - -/* - * Bits on the above registers. - */ - -enum tiger_reg_bits -{ -/* Reset and PIB Cycle Timing */ - - TIGER_DMA_OP_MODE_MASK = 0x80, - TIGER_SELF_ADDR_DMA = 0x00, /* Wrap around ending addr */ - TIGER_NORMAL_DMA = 0x80, /* Stop at ending addr */ - - TIGER_DMA_INT_MODE_MASK = 0x40, - TIGER_DONT_LATCH_DMA_INT= 0x00, /* Bits on int0 status will be - set only while curr addr - equals int or end addr */ - TIGER_LATCH_DMA_INT = 0x40, /* Bits on int0 status remain - set until cleared by CPU */ - - TIGER_PIB_CYCLE_TIMING_MASK = 0x30, - TIGER_PIB_3_CYCLES = 0x00, - TIGER_PIB_5_CYCLES = 0x10, - TIGER_PIB_12_CYCLES = 0x20, - - TIGER_RESET_MASK = 0x0F, - TIGER_RESET_PULSE_COUNT = 0x08, - TIGER_RESET_SERIAL_PORT = 0x04, - TIGER_RESET_DMA_LOGIC = 0x02, - TIGER_RESET_EXTERNAL = 0x01, - TIGER_RESET_ALL = 0x0F, - -/* DMA Operation */ - TIGER_DMA_RESTART_MASK = 0x02, - TIGER_HOLD_DMA = 0x00, - TIGER_RESTART_DMA = 0x02, - - TIGER_DMA_ENABLE_MASK = 0x01, - TIGER_ENABLE_DMA = 0x01, - TIGER_DISABLE_DMA = 0x00, - -/* AUX Port Control & Data plus Interrupt 1 Mask & Status */ - TIGER_AUX_7_MASK = 0x80, - TIGER_AUX_6_MASK = 0x40, - TIGER_AUX_5_MASK = 0x20, - TIGER_AUX_4_MASK = 0x10, - TIGER_ISAC_INT_MASK = 0x10, - TIGER_AUX_3_MASK = 0x08, - TIGER_AUX_2_MASK = 0x04, - TIGER_AUX_1_MASK = 0x02, - TIGER_AUX_0_MASK = 0x01, - -/* AUX Port Control */ - TIGER_AUX_7_IS_INPUT = 0x00, - TIGER_AUX_7_IS_OUTPUT = 0x80, - TIGER_AUX_6_IS_INPUT = 0x00, - TIGER_AUX_6_IS_OUTPUT = 0x40, - TIGER_AUX_5_IS_INPUT = 0x00, - TIGER_AUX_5_IS_OUTPUT = 0x20, - TIGER_AUX_4_IS_INPUT = 0x00, - TIGER_AUX_4_IS_OUTPUT = 0x10, - TIGER_AUX_3_IS_INPUT = 0x00, - TIGER_AUX_3_IS_OUTPUT = 0x08, - TIGER_AUX_2_IS_INPUT = 0x00, - TIGER_AUX_2_IS_OUTPUT = 0x04, - TIGER_AUX_1_IS_INPUT = 0x00, - TIGER_AUX_1_IS_OUTPUT = 0x02, - TIGER_AUX_0_IS_INPUT = 0x00, - TIGER_AUX_0_IS_OUTPUT = 0x01, - TIGER_AUX_NJ_DEFAULT = 0xEF, /* All but ISAC int is output */ - -/* Interrupt 0 Mask & Status */ - TIGER_PCI_TARGET_ABORT_INT_MASK = 0x20, - TIGER_NO_TGT_ABORT_INT = 0x00, - TIGER_TARGET_ABORT_INT = 0x20, - TIGER_PCI_MASTER_ABORT_INT_MASK = 0x10, - TIGER_NO_MST_ABORT_INT = 0x00, - TIGER_MASTER_ABORT_INT = 0x10, - TIGER_DMA_RD_END_INT_MASK = 0x08, - TIGER_NO_RD_END_INT = 0x00, - TIGER_RD_END_INT = 0x08, - TIGER_DMA_RD_INT_INT_MASK = 0x04, - TIGER_NO_RD_INT_INT = 0x00, - TIGER_RD_INT_INT = 0x04, - TIGER_DMA_WR_END_INT_MASK = 0x02, - TIGER_NO_WR_END_INT = 0x00, - TIGER_WR_END_INT = 0x02, - TIGER_DMA_WR_INT_INT_MASK = 0x01, - TIGER_NO_WR_INT_INT = 0x00, - TIGER_WR_INT_INT = 0x01, - -/* Interrupt 1 Mask & Status */ - TIGER_NO_AUX_7_INT = 0x00, - TIGER_AUX_7_INT = 0x80, - TIGER_NO_AUX_6_INT = 0x00, - TIGER_AUX_6_INT = 0x40, - TIGER_NO_AUX_5_INT = 0x00, - TIGER_AUX_5_INT = 0x20, - TIGER_NO_AUX_4_INT = 0x00, - TIGER_AUX_4_INT = 0x10, - TIGER_NO_ISAC_INT = 0x00, - TIGER_ISAC_INT = 0x10, - TIGER_NO_AUX_3_INT = 0x00, - TIGER_AUX_3_INT = 0x08, - TIGER_NO_AUX_2_INT = 0x00, - TIGER_AUX_2_INT = 0x04, - TIGER_NO_AUX_1_INT = 0x00, - TIGER_AUX_1_INT = 0x02, - TIGER_NO_AUX_0_INT = 0x00, - TIGER_AUX_0_INT = 0x01 -}; - -/* - * Peripheral Interface Bus definitions. This is an ISA like bus - * created by the Tiger ASIC to keep ISA chips like the ISAC happy - * on a PCI environment. - * - * Since the PIB only supplies 4 addressing lines, the 2 higher bits - * (A4 & A5) of the ISAC register addresses are wired on the 2 lower - * AUX lines. Another restriction is that all I/O to the PIB (8bit - * wide) is mapped on the PCI side as 32bit data. So the PCI address - * of a given ISAC register has to be multiplied by 4 before being - * added to the PIB base offset. - */ -enum tiger_pib_regs_defs -{ - /* Offset from the I/O base to the ISAC registers. */ - PIB_OFFSET = 0xC0, - PIB_LO_ADDR_MASK = 0x0F, - PIB_HI_ADDR_MASK = 0x30, - PIB_LO_ADDR_SHIFT = 2, /* Align on dword boundary */ - PIB_HI_ADDR_SHIFT = 4 /* Right shift to AUX_1 & AUX_0 */ -}; - - -#define itjc_set_pib_addr_msb(a) \ -( \ - itjc_write_1(TIGER_AUX_PORT_DATA, \ - ((a) & PIB_HI_ADDR_MASK) >> PIB_HI_ADDR_SHIFT) \ -) - -#define itjc_pib_2_pci(a) \ -( \ - (((a) & PIB_LO_ADDR_MASK) << PIB_LO_ADDR_SHIFT) + PIB_OFFSET \ -) - -#define itjc_get_dma_offset(ctx,reg) \ -( \ - (u_int16_t)((bus_addr_t)itjc_read_4((reg)) - (ctx)->bus_addr) \ -) - - -/* - * IOM-2 serial channel 0 DMA data ring buffers. - * - * The Tiger300/320 ASIC do not nothing more than transfer via DMA the - * first 32 bits of every IOM-2 frame on the serial interface to the - * ISAC. So we have no framing/deframing facilities like we would have - * with an HSCX, having to do the job with CPU cycles. On the plus side - * we are able to specify large rings which can limit the occurrence of - * over/underruns. - */ - -enum -{ - ITJC_RING_SLOT_WORDS = 64, - ITJC_RING_WORDS = 3 * ITJC_RING_SLOT_WORDS, - ITJC_RING_SLOT_BYTES = 4 * ITJC_RING_SLOT_WORDS, - ITJC_RING_BYTES = 4 * ITJC_RING_WORDS, - ITJC_DMA_POOL_WORDS = 2 * ITJC_RING_WORDS, - ITJC_DMA_POOL_BYTES = 4 * ITJC_DMA_POOL_WORDS -}; - -#define itjc_ring_add(x, d) (((x) + 4 * (d)) % ITJC_RING_BYTES) -#define itjc_ring_sub(x, d) (((x) + ITJC_RING_BYTES - 4 * (d)) \ - % ITJC_RING_BYTES) - - -enum -{ - TIGER_CH_A = 0, - TIGER_CH_B = 1, - - HSCX_CH_A = 0, /* For compatibility reasons. */ - HSCX_CH_B = 1, -}; - -enum -{ - ITJC_TEL_SILENCE_BYTE = 0x00, - ITJC_HDLC_FLAG_BYTE = 0x7E, - ITJC_HDLC_ABORT_BYTE = 0xFF -}; - -/* - * Hardware DMA control block (one per card). - */ -typedef enum -{ - ITJC_DS_LOAD_FAILED = -1, - ITJC_DS_FREE = 0, - ITJC_DS_LOADING, - ITJC_DS_STOPPED, - ITJC_DS_RUNNING -} - dma_state_t; - -typedef struct -{ - dma_state_t state; - u_int8_t *pool; - bus_addr_t bus_addr; - bus_dma_tag_t tag; - bus_dmamap_t map; - int error; -} - dma_context_t; - -dma_context_t - dma_context [ ITJC_MAXUNIT ]; - -/* - * B-channel DMA control blocks (4 per card -- 1 RX & 1 TX per channel). - */ -typedef enum -{ - ITJC_RS_IDLE = 0, - ITJC_RS_ACTIVE -} - dma_rx_state_t; - -typedef enum -{ - ITJC_TS_IDLE = 0, - ITJC_TS_ACTIVE, - ITJC_TS_AFTER_XDU -} - dma_tx_state_t; - -typedef struct -{ - u_int8_t *ring; - bus_addr_t bus_addr; - u_int16_t next_read; - u_int16_t hdlc_len; - u_int16_t hdlc_tmp; - u_int16_t hdlc_crc; - u_int16_t hdlc_ib; - u_int8_t hdlc_blevel; - u_int8_t hdlc_flag; - dma_rx_state_t state; -} - dma_rx_context_t; - -typedef struct -{ - u_int8_t *ring; - bus_addr_t bus_addr; - u_int16_t next_write; - u_int32_t hdlc_tmp; - u_int16_t hdlc_blevel; - u_int16_t hdlc_crc; - u_int16_t hdlc_ib; - u_int16_t next_frame; - u_int16_t filled; - u_int8_t hdlc_flag; - dma_tx_state_t state; -} - dma_tx_context_t; - -dma_rx_context_t - dma_rx_context [ ITJC_MAXUNIT ] [ 2 ]; - -dma_tx_context_t - dma_tx_context [ ITJC_MAXUNIT ] [ 2 ]; - -/* - * Used by the mbuf handling functions. - */ -typedef enum -{ - ITJC_MB_CURR = 0, - ITJC_MB_NEXT = 1, - ITJC_MB_NEW = 2 -} - which_mb_t; - - -/*---------------------------------------------------------------------------* - * itjc_map_callback - get DMA bus address from resource mgr. - *---------------------------------------------------------------------------*/ -static void -itjc_map_callback(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - dma_context_t *ctx = (dma_context_t *)arg; - - if (error) - { - ctx->error = error; - ctx->state = ITJC_DS_LOAD_FAILED; - return; - } - - ctx->bus_addr = segs->ds_addr; - ctx->state = ITJC_DS_STOPPED; -} - - -/*---------------------------------------------------------------------------* - * itjc_dma_start - Complete DMA setup & start the Tiger DMA engine. - *---------------------------------------------------------------------------*/ -static int -itjc_dma_start(struct l1_softc *sc) -{ - int unit = sc->sc_unit; - dma_context_t *ctx = &dma_context[unit]; - dma_rx_context_t *rxc = &dma_rx_context[unit][0]; - dma_tx_context_t *txc = &dma_tx_context[unit][0]; - bus_addr_t ba; - u_int8_t i; - u_int32_t *pool_end, - *ip; - - itjc_bus_setup(sc); - - /* See if it is already running. */ - - if (ctx->state == ITJC_DS_RUNNING) - return 0; - - if (ctx->state == ITJC_DS_LOAD_FAILED) - { - NDBGL1(L1_ERROR, "itjc%d: dma_start: DMA map loading " - "failed (error=%d).\n", unit, ctx->error); - return 1; - } - - if (ctx->state != ITJC_DS_STOPPED) - { - NDBGL1(L1_ERROR, "itjc%d: dma_start: Unexpected DMA " - "state (%d).\n", unit, ctx->state); - return 1; - } - - /* - * Initialize the DMA control structures (hardware & B-channel). - */ - ba = ctx->bus_addr; - - txc->ring = ctx->pool + TIGER_CH_A; - rxc->ring = ctx->pool + TIGER_CH_A + ITJC_RING_BYTES; - - txc->bus_addr = ba; - rxc->bus_addr = ba + ITJC_RING_BYTES; - - ++rxc; ++txc; - - txc->ring = ctx->pool + TIGER_CH_B; - rxc->ring = ctx->pool + TIGER_CH_B + ITJC_RING_BYTES; - - txc->bus_addr = ba; - rxc->bus_addr = ba + ITJC_RING_BYTES; - - /* - * Fill the DMA ring buffers with IOM-2 channel 0 frames made of - * idle/abort sequences for the B & D channels and NOP for IOM-2 - * cmd/ind, monitor handshake & data. - */ - pool_end = (u_int32_t *)ctx->pool + ITJC_DMA_POOL_WORDS; - for (ip = (u_int32_t *)ctx->pool; ip < pool_end; ++ip) - *ip = 0xFFFFFFFF; - - /* - * Program the Tiger DMA gears. - */ - - itjc_write_4(TIGER_DMA_WR_START_ADDR, ba); - itjc_write_4(TIGER_DMA_WR_INT_ADDR, ba + ITJC_RING_SLOT_BYTES - 4); - itjc_write_4(TIGER_DMA_WR_END_ADDR, ba + ITJC_RING_BYTES - 4); - - ba += ITJC_RING_BYTES; - - itjc_write_4(TIGER_DMA_RD_START_ADDR, ba); - itjc_write_4(TIGER_DMA_RD_INT_ADDR, ba + ITJC_RING_SLOT_BYTES * 2 - 4); - itjc_write_4(TIGER_DMA_RD_END_ADDR, ba + ITJC_RING_BYTES - 4); - - itjc_write_1(TIGER_INT0_MASK, - TIGER_WR_END_INT | TIGER_WR_INT_INT | TIGER_RD_INT_INT); - - itjc_write_1(TIGER_DMA_OPER, TIGER_ENABLE_DMA); - - /* - * See if it really started. - */ - ba = itjc_read_4(TIGER_DMA_RD_CURR_ADDR); - for (i = 0; i < 10; ++i) - { - DELAY(SEC_DELAY/1000); - if (ba != itjc_read_4(TIGER_DMA_RD_CURR_ADDR)) - { - ctx->state = ITJC_DS_RUNNING; - return 0; - } - } - - NDBGL1(L1_ERROR, "itjc%d: dma_start: DMA start failed.\n ", unit); - return 1; -} - - -/*---------------------------------------------------------------------------* - * itjc_dma_stop - Stop the Tiger DMA engine. - *---------------------------------------------------------------------------*/ -static void -itjc_dma_stop(struct l1_softc *sc) -{ - dma_context_t *ctx = &dma_context[sc->sc_unit]; - - itjc_bus_setup(sc); - - /* Only stop the DMA if it is running. */ - - if (ctx->state != ITJC_DS_RUNNING) - return; - - itjc_write_1(TIGER_DMA_OPER, TIGER_DISABLE_DMA); - DELAY(SEC_DELAY/1000); - - ctx->state = ITJC_DS_STOPPED; -} - - -/*---------------------------------------------------------------------------* - * itjc_bchannel_dma_setup - The DMA side of itjc_bchannel_setup. - *---------------------------------------------------------------------------*/ -static void -itjc_bchannel_dma_setup(struct l1_softc *sc, int h_chan, int activate) -{ - dma_rx_context_t *rxc = &dma_rx_context[sc->sc_unit][h_chan]; - dma_tx_context_t *txc = &dma_tx_context[sc->sc_unit][h_chan]; - - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - u_int8_t fill_byte, - *ring_end, - *cp; - - int s = SPLI4B(); - - itjc_bus_setup(sc); - - if (activate) - { - /* - * Get the DMA engine going if it's not running already. - */ - itjc_dma_start(sc); - - rxc->hdlc_len = rxc->hdlc_tmp = rxc->hdlc_crc = 0; - rxc->hdlc_ib = rxc->hdlc_blevel = rxc->hdlc_flag = 0; - - txc->hdlc_tmp = txc->hdlc_blevel = txc->hdlc_crc = 0; - txc->hdlc_ib = 0; - txc->hdlc_flag = 2; - txc->filled = 0; - - if (chan->bprot == BPROT_NONE) - fill_byte = ITJC_TEL_SILENCE_BYTE; - else - fill_byte = ITJC_HDLC_ABORT_BYTE; - - ring_end = rxc->ring + ITJC_RING_BYTES; - for (cp = rxc->ring; cp < ring_end; cp += 4) - *cp = fill_byte; - - ring_end = txc->ring + ITJC_RING_BYTES; - for (cp = txc->ring; cp < ring_end; cp += 4) - *cp = fill_byte; - - rxc->next_read = - itjc_get_dma_offset(rxc, TIGER_DMA_RD_CURR_ADDR); - - txc->next_frame = txc->next_write = - itjc_get_dma_offset(txc, TIGER_DMA_WR_CURR_ADDR); - - rxc->state = ITJC_RS_ACTIVE; - txc->state = ITJC_TS_AFTER_XDU; - } - else - { - dma_rx_context_t *rxc2; - - txc->state = ITJC_TS_IDLE; - rxc->state = ITJC_RS_IDLE; - - rxc2 = &dma_rx_context[sc->sc_unit][0]; - - if (rxc2->state == ITJC_RS_IDLE - && rxc2[1].state == ITJC_RS_IDLE) - itjc_dma_stop(sc); - } - - splx(s); -} - - -/*---------------------------------------------------------------------------* - * Mbuf & if_queues management routines. - *---------------------------------------------------------------------------*/ - -static u_int8_t * -itjc_get_rx_mbuf(l1_bchan_state_t *chan, u_int8_t **dst_end_p, -which_mb_t which) -{ - struct mbuf *mbuf = chan->in_mbuf; - - if (mbuf == NULL && which == ITJC_MB_NEW) - { - if ((mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("itjc_get_rx_mbuf: cannot allocate mbuf!"); - - chan->in_mbuf = mbuf; - chan->in_cbptr = (u_int8_t *)mbuf->m_data; - chan->in_len = 0; - } - - if (dst_end_p != NULL) - { - if (mbuf != NULL) - *dst_end_p = (u_int8_t *)(mbuf->m_data) - + BCH_MAX_DATALEN; - else - *dst_end_p = NULL; - } - - return chan->in_cbptr; -} - - -static void -itjc_save_rx_mbuf(l1_bchan_state_t *chan, u_int8_t * dst) -{ - struct mbuf *mbuf = chan->in_mbuf; - - if (dst != NULL && mbuf != NULL) - { - chan->in_cbptr = dst; - chan->in_len = dst - (u_int8_t *)mbuf->m_data; - } - else if (dst == NULL && mbuf == NULL) - { - chan->in_cbptr = NULL; - chan->in_len = 0; - } - else - panic("itjc_save_rx_mbuf: stale pointer dst=%p mbuf=%p " - "in_cbptr=%p in_len=%d", dst, mbuf, - chan->in_cbptr, chan->in_len); -} - - -static void -itjc_free_rx_mbuf(l1_bchan_state_t *chan) -{ - struct mbuf *mbuf = chan->in_mbuf; - - if (mbuf != NULL) - i4b_Bfreembuf(mbuf); - - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; -} - - -static void -itjc_put_rx_mbuf(struct l1_softc *sc, l1_bchan_state_t *chan, u_int16_t len) -{ - i4b_trace_hdr_t hdr; - struct mbuf *mbuf = chan->in_mbuf; - u_int8_t *data = mbuf->m_data; - int activity = 1; - - mbuf->m_pkthdr.len = mbuf->m_len = len; - - if (sc->sc_trace & TRACE_B_RX) - { - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = (chan->channel == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, len, data); - } - - if (chan->bprot == BPROT_NONE) - { - activity = ! i4b_l1_bchan_tel_silence(data, len); - - /* move rx'd data to rx queue */ - - if (! _IF_QFULL(&chan->rx_queue)) - { - IF_ENQUEUE(&chan->rx_queue, mbuf); - } - else - { - i4b_Bfreembuf(mbuf); - len = 0; - } - } - - if (len != 0) - { - chan->rxcount += len; - - (*chan->isic_drvr_linktab->bch_rx_data_ready) - (chan->isic_drvr_linktab->unit); - } - - if (activity) - (*chan->isic_drvr_linktab->bch_activity) - (chan->isic_drvr_linktab->unit, ACT_RX); - - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; -} - - -#define itjc_free_tx_mbufs(chan) \ -{ \ - i4b_Bfreembuf((chan)->out_mbuf_head); \ - (chan)->out_mbuf_cur = (chan)->out_mbuf_head = NULL; \ - (chan)->out_mbuf_cur_ptr = NULL; \ - (chan)->out_mbuf_cur_len = 0; \ -} - - -static u_int16_t -itjc_get_tx_mbuf(struct l1_softc *sc, l1_bchan_state_t *chan, - u_int8_t **src_p, which_mb_t which) -{ - i4b_trace_hdr_t hdr; - struct mbuf *mbuf = chan->out_mbuf_cur; - u_int8_t activity = 1; - u_int16_t len; - void *data; - - switch (which) - { - case ITJC_MB_CURR: - if (mbuf != NULL) - { - *src_p = chan->out_mbuf_cur_ptr; - return chan->out_mbuf_cur_len; - } - - break; - - case ITJC_MB_NEXT: - if (mbuf != NULL) - { - chan->txcount += mbuf->m_len; - - mbuf = mbuf->m_next; - - if (mbuf != NULL) - goto new_mbuf; - } - - chan->out_mbuf_cur_ptr = *src_p = NULL; - chan->out_mbuf_cur_len = 0; - - if (chan->out_mbuf_head != NULL) - { - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_head = NULL; - } - - return 0; - - case ITJC_MB_NEW: - if (mbuf != NULL) - chan->txcount += mbuf->m_len; - } - - if (chan->out_mbuf_head != NULL) - i4b_Bfreembuf(chan->out_mbuf_head); - - IF_DEQUEUE(&chan->tx_queue, mbuf); - - if (mbuf == NULL) - { - chan->out_mbuf_cur = chan->out_mbuf_head = NULL; - chan->out_mbuf_cur_ptr = *src_p = NULL; - chan->out_mbuf_cur_len = 0; - - chan->state &= ~(HSCX_TX_ACTIVE); - - (*chan->isic_drvr_linktab->bch_tx_queue_empty) - (chan->isic_drvr_linktab->unit); - - return 0; - } - - chan->out_mbuf_head = mbuf; - -new_mbuf: - chan->out_mbuf_cur = mbuf; - chan->out_mbuf_cur_ptr = data = mbuf->m_data; - chan->out_mbuf_cur_len = len = mbuf->m_len; - - chan->state |= HSCX_TX_ACTIVE; - - if (sc->sc_trace & TRACE_B_TX) - { - hdr.unit = L0ITJCUNIT(sc->sc_unit); - hdr.type = (chan->channel == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, len, data); - } - - if (chan->bprot == BPROT_NONE) - activity = ! i4b_l1_bchan_tel_silence(data, len); - - if (activity) - (*chan->isic_drvr_linktab->bch_activity) - (chan->isic_drvr_linktab->unit, ACT_TX); - - *src_p = data; - return len; -} - - -#define itjc_save_tx_mbuf(chan, src, dst) \ -( \ - (chan)->out_mbuf_cur != NULL ? \ - ( \ - (chan)->out_mbuf_cur_ptr = (src), \ - (chan)->out_mbuf_cur_len = (len) \ - ) \ - : \ - 0 \ -) - - -/*---------------------------------------------------------------------------* - * B-channel interrupt service routines. - *---------------------------------------------------------------------------*/ - -/* - * Since the Tiger ASIC doesn't produce a XMIT underflow indication, - * we need to deduce it ourselves. This is somewhat tricky because we - * are dealing with modulo m arithmetic. The idea here is to have a - * "XDU zone" ahead of the writing pointer sized 1/3 of total ring - * length (a ring slot). If the hardware DMA pointer is found there we - * consider that a XDU has occurred. To complete the scheme, we never - * let the ring have more than 2 slots of (unsent) data and adjust the - * interrupt registers to cause an interrupt at every slot. - */ -static u_int8_t -itjc_xdu(struct l1_softc *sc, l1_bchan_state_t *chan, dma_tx_context_t *ctx, -u_int16_t *dst_p, u_int16_t *dst_end_p, u_int8_t tx_restart) -{ - u_int8_t xdu; - - u_int16_t dst_end, - dst, - dma, - dma_l, - dma_h, - xdu_l, - xdu_h; - - itjc_bus_setup(sc); - - /* - * Since the hardware is running, be conservative and assume - * the pointer location has a `fuzy' error factor. - */ - dma = itjc_get_dma_offset(ctx, TIGER_DMA_WR_CURR_ADDR); - dma_l = dma; - dma_h = itjc_ring_add(dma, 1); - - dst_end = itjc_ring_sub(dma_l, ITJC_RING_SLOT_WORDS); - - if (ctx->state != ITJC_TS_ACTIVE) - { - xdu = (ctx->state == ITJC_TS_AFTER_XDU); - dst = itjc_ring_add(dma_h, 4); - goto done; - } - - /* - * Check for xmit underruns. - */ - xdu_l = dst = ctx->next_write; - xdu_h = itjc_ring_add(dst, ITJC_RING_SLOT_WORDS); - - if (xdu_l < xdu_h) - xdu = (xdu_l <= dma_l && dma_l < xdu_h) - || (xdu_l <= dma_h && dma_h < xdu_h); - else - xdu = (xdu_l <= dma_l || dma_l < xdu_h) - || (xdu_l <= dma_h || dma_h < xdu_h); - - if (xdu) - { - ctx->state = ITJC_TS_AFTER_XDU; - - dst = itjc_ring_add(dma_h, 4); - } - else if (tx_restart) - { - /* - * See if we still can restart from immediately - * after the last frame sent. It's a XDU test but - * using the real data end on the comparsions. We - * don't consider XDU an error here because we were - * just trying to avoid send a filling gap between - * frames. If it's already sent no harm is done. - */ - xdu_l = dst = ctx->next_frame; - xdu_h = itjc_ring_add(dst, ITJC_RING_SLOT_WORDS); - - if (xdu_l < xdu_h) - xdu = (xdu_l <= dma_l && dma_l < xdu_h) - || (xdu_l <= dma_h && dma_h < xdu_h); - else - xdu = (xdu_l <= dma_l || dma_l < xdu_h) - || (xdu_l <= dma_h || dma_h < xdu_h); - - if (xdu) - dst = itjc_ring_add(dma_h, 4); - - xdu = 0; - } - -done: - if (dst_p != NULL) - *dst_p = dst; - - if (dst_end_p != NULL) - *dst_end_p = dst_end; - - ctx->next_write = dst_end; - - return xdu; -} - - -#define itjc_rotate_hdlc_flag(blevel) \ - ((u_int8_t)(0x7E7E >> (8 - (u_int8_t)((blevel) >> 8)))) - - -static void -itjc_dma_rx_intr(struct l1_softc *sc, l1_bchan_state_t *chan, -dma_rx_context_t *ctx) -{ - u_int8_t *ring, - *dst, - *dst_end, - flag, - blevel; - - u_int16_t dma, - src, - tmp2, - tmp, - len, - crc, - ib; - - itjc_bus_setup(sc); - - - if (ctx->state == ITJC_RS_IDLE) - return; - - ring = ctx->ring; - dma = itjc_get_dma_offset(ctx, TIGER_DMA_RD_CURR_ADDR); - dma = itjc_ring_sub(dma, 1); - src = ctx->next_read; - - if (chan->bprot == BPROT_NONE) - { - dst = itjc_get_rx_mbuf(chan, &dst_end, ITJC_MB_CURR); - - while (src != dma) - { - if (dst == NULL) - dst = itjc_get_rx_mbuf(chan, &dst_end, - ITJC_MB_NEW); - - *dst++ = ring[src]; - src = itjc_ring_add(src, 1); - - if (dst >= dst_end) - { - itjc_put_rx_mbuf(sc, chan, BCH_MAX_DATALEN); - dst = dst_end = NULL; - } - } - ctx->next_read = src; - itjc_save_rx_mbuf(chan, dst); - return; - } - - blevel = ctx->hdlc_blevel; - flag = ctx->hdlc_flag; - len = ctx->hdlc_len; - tmp = ctx->hdlc_tmp; - crc = ctx->hdlc_crc; - ib = ctx->hdlc_ib; - - dst = itjc_get_rx_mbuf(chan, NULL, ITJC_MB_CURR); - - while (src != dma) - { - HDLC_DECODE(*dst++, len, tmp, tmp2, blevel, ib, crc, flag, - {/* rdd */ - tmp2 = ring[src]; - src = itjc_ring_add(src, 1); - }, - {/* nfr */ - if (dst != NULL) - panic("itjc_dma_rx_intr: nfrcmd with " - "valid current frame"); - - dst = itjc_get_rx_mbuf(chan, &dst_end, ITJC_MB_NEW); - len = dst_end - dst; - }, - {/* cfr */ - len = BCH_MAX_DATALEN - len; - - if ((!len) || (len > BCH_MAX_DATALEN)) - { - /* - * NOTE: frames without any data, only crc - * field, should be silently discared. - */ - NDBGL1(L1_S_MSG, "itjc_dma_rx_intr: " - "bad frame (len=%d, unit=%d)", - len, sc->sc_unit); - - itjc_free_rx_mbuf(chan); - - goto s0; - } - - if (crc) - { - NDBGL1(L1_S_ERR, - "CRC (crc=0x%04x, len=%d, unit=%d)", - crc, len, sc->sc_unit); - - itjc_free_rx_mbuf(chan); - - goto s0; - } - - itjc_put_rx_mbuf(sc, chan, len); - - s0: - dst = NULL; - len = 0; - }, - {/* rab */ - NDBGL1(L1_S_ERR, "Read Abort (unit=%d)", sc->sc_unit); - - itjc_free_rx_mbuf(chan); - dst = NULL; - len = 0; - }, - {/* rdo */ - NDBGL1(L1_S_ERR, "RDO (unit=%d) dma=%d src=%d", - sc->sc_unit, dma, src); - - itjc_free_rx_mbuf(chan); - dst = NULL; - len = 0; - }, - continue, - d); - } - - itjc_save_rx_mbuf(chan, dst); - - ctx->next_read = src; - ctx->hdlc_blevel= blevel; - ctx->hdlc_flag = flag; - ctx->hdlc_len = len; - ctx->hdlc_tmp = tmp; - ctx->hdlc_crc = crc; - ctx->hdlc_ib = ib; -} - - -/* - * The HDLC side of itjc_dma_tx_intr. We made a separate function - * to improve readability and (perhaps) help the compiler with - * register allocation. - */ -static void -itjc_hdlc_encode(struct l1_softc *sc, l1_bchan_state_t *chan, -dma_tx_context_t * ctx) -{ - u_int8_t *ring, - *src, - xdu, - flag, - flag_byte, - tx_restart; - - u_int16_t saved_len, - dst_end, - dst_end1, - dst, - filled, - blevel, - tmp2, - len, - crc, - ib; - - u_int32_t tmp; - - - saved_len = len = itjc_get_tx_mbuf(sc, chan, &src, ITJC_MB_CURR); - - filled = ctx->filled; - flag = ctx->hdlc_flag; - - if (src == NULL && flag == 2 && filled >= ITJC_RING_WORDS) - return; - - tx_restart = (flag == 2 && src != NULL); - xdu = itjc_xdu(sc, chan, ctx, &dst, &dst_end, tx_restart); - - ring = ctx->ring; - - ib = ctx->hdlc_ib; - crc = ctx->hdlc_crc; - tmp = ctx->hdlc_tmp; - blevel = ctx->hdlc_blevel; - - if (xdu) - { - if (flag != 2) - { - NDBGL1(L1_H_XFRERR, "XDU"); - ++chan->stat_XDU; - - /* - * Abort the current frame and - * prepare for a full restart. - */ - itjc_free_tx_mbufs(chan); - saved_len = len = filled = 0; - flag = (u_int8_t)-2; - } - else if (filled < ITJC_RING_SLOT_WORDS) - { - /* - * A little garbage may have been retransmitted. - * Send an abort before any new data. - */ - filled = 0; - flag = (u_int8_t)-2; - } - } - - if (flag != 3) - len = 0; - - while (dst != dst_end) - { - HDLC_ENCODE( - *src++, len, tmp, tmp2, blevel, ib, crc, flag, - {/* gfr */ - if ((len = saved_len) == 0) - len = itjc_get_tx_mbuf(sc, chan, &src, - ITJC_MB_NEW); - - if (len == 0) - { - ctx->next_frame = dst; - - flag_byte = itjc_rotate_hdlc_flag(blevel); - - for (dst_end1 = itjc_ring_sub(dst_end, 1); - dst != dst_end1; - dst = itjc_ring_add(dst, 1)) - { - ring[dst] = flag_byte; - ++filled; - } - } - else - filled = 0; - - ctx->state = ITJC_TS_ACTIVE; - }, - {/* nmb */ - saved_len = 0; - len = itjc_get_tx_mbuf(sc, chan, &src, ITJC_MB_NEXT); - }, - {/* wrd */ - ring[dst] = (u_int8_t)tmp; - dst = itjc_ring_add(dst, 1); - }, - d1); - } - - ctx->hdlc_blevel = blevel; - ctx->hdlc_flag = flag; - ctx->hdlc_tmp = tmp; - ctx->hdlc_crc = crc; - ctx->hdlc_ib = ib; - - ctx->filled = filled; - ctx->next_write = dst; - - itjc_save_tx_mbuf(chan, src, len); -} - - -static void -itjc_dma_tx_intr(struct l1_softc *sc, l1_bchan_state_t *chan, -dma_tx_context_t * ctx) -{ - u_int8_t *data_end, - *ring, - *src, - xdu; - - u_int16_t dst, - dst_end, - filled, - len; - - - if (ctx->state == ITJC_TS_IDLE) - goto done; - - if (chan->bprot != BPROT_NONE) - { - itjc_hdlc_encode(sc, chan, ctx); - goto done; - } - - ring = ctx->ring; - filled = ctx->filled; - - len = itjc_get_tx_mbuf(sc, chan, &src, ITJC_MB_CURR); - - if (len == 0 && filled >= ITJC_RING_WORDS) - goto done; - - xdu = itjc_xdu(sc, chan, ctx, &dst, &dst_end, len != 0); - - if (xdu && filled < ITJC_RING_WORDS) - { - NDBGL1(L1_H_XFRERR, "XDU"); - ++chan->stat_XDU; - filled = 0; - } - - if (len == 0) - goto fill_ring; - - ctx->state = ITJC_TS_ACTIVE; - - data_end = src + len; - while (dst != dst_end) - { - ring[dst] = *src++; --len; - - dst = itjc_ring_add(dst, 1); - - if (src >= data_end) - { - len = itjc_get_tx_mbuf(sc, chan, &src, ITJC_MB_NEXT); - if (len == 0) - len = itjc_get_tx_mbuf(sc, chan, - &src, ITJC_MB_NEW); - - if (len == 0) - { - data_end = NULL; - break; - } - data_end = src + len; - } - } - - itjc_save_tx_mbuf(chan, src, len); - - filled = 0; - -fill_ring: - ctx->next_frame = dst; - - for (; dst != dst_end; dst = itjc_ring_add(dst, 1)) - { - ring[dst] = ITJC_TEL_SILENCE_BYTE; - ++filled; - } - - ctx->next_write = dst; - ctx->filled = filled; - -done: - return; -} - - -/*---------------------------------------------------------------------------* - * NetJet fifo read/write routines. - *---------------------------------------------------------------------------*/ - -static void -itjc_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - itjc_bus_setup(sc); - - if (what != ISIC_WHAT_ISAC) - panic("itjc_write_fifo: Trying to read from HSCX fifo.\n"); - - itjc_set_pib_addr_msb(0); - itjc_read_multi_1(PIB_OFFSET, buf, size); -} - - -static void -itjc_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size) -{ - itjc_bus_setup(sc); - - if (what != ISIC_WHAT_ISAC) - panic("itjc_write_fifo: Trying to write to HSCX fifo.\n"); - - itjc_set_pib_addr_msb(0); - itjc_write_multi_1(PIB_OFFSET, buf, size); -} - - -/*---------------------------------------------------------------------------* - * Read an ISAC register. - *---------------------------------------------------------------------------*/ -static u_int8_t -itjc_read_reg(struct l1_softc *sc, int what, bus_size_t offs) -{ - itjc_bus_setup(sc); - - if (what != ISIC_WHAT_ISAC) - { - panic("itjc_read_reg: what(%d) != ISIC_WHAT_ISAC\n", - what); - return 0; - } - - itjc_set_pib_addr_msb(offs); - return itjc_read_1(itjc_pib_2_pci(offs)); -} - - -/*---------------------------------------------------------------------------* - * Write an ISAC register. - *---------------------------------------------------------------------------*/ -static void -itjc_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data) -{ - itjc_bus_setup(sc); - - if (what != ISIC_WHAT_ISAC) - { - panic("itjc_write_reg: what(%d) != ISIC_WHAT_ISAC\n", - what); - return; - } - - itjc_set_pib_addr_msb(offs); - itjc_write_1(itjc_pib_2_pci(offs), data); -} - - -/*---------------------------------------------------------------------------* - * itjc_probe - probe for a card. - *---------------------------------------------------------------------------*/ -static int itjc_probe(device_t dev) -{ - u_int16_t vid = pci_get_vendor(dev), - did = pci_get_device(dev); - - if ((vid == PCI_TJNET_VID) && (did == PCI_TJ300_DID)) - { - device_set_desc(dev, "NetJet-S"); - return 0; - } - - return ENXIO; -} - - -/*---------------------------------------------------------------------------* - * itjc_attach - attach a (previously probed) card. - *---------------------------------------------------------------------------*/ -static int -itjc_attach(device_t dev) -{ - bus_space_handle_t h; - bus_space_tag_t t; - - struct l1_softc *sc = device_get_softc(dev); - - u_int16_t vid = pci_get_vendor(dev), - did = pci_get_device(dev); - - int unit = device_get_unit(dev), - s = splimp(), - res_init_level = 0, - error = 0; - - void *ih = 0; - - dma_context_t *ctx = &dma_context[unit]; - l1_bchan_state_t *chan; - - bzero(sc, sizeof(struct l1_softc)); - - /* Probably not really required. */ - if (unit >= ITJC_MAXUNIT) - { - printf("itjc%d: Error, unit >= ITJC_MAXUNIT!\n", unit); - splx(s); - return ENXIO; - } - - if (!(vid == PCI_TJNET_VID && did == PCI_TJ300_DID)) - { - printf("itjc%d: unknown device (%04X,%04X)!\n", unit, vid, did); - goto fail; - } - - itjc_scp[unit] = sc; - - sc->sc_resources.io_rid[0] = PCIR_BAR(0); - sc->sc_resources.io_base[0] = bus_alloc_resource_any(dev, - SYS_RES_IOPORT, &sc->sc_resources.io_rid[0], RF_ACTIVE); - - if (sc->sc_resources.io_base[0] == NULL) - { - printf("itjc%d: couldn't map IO port\n", unit); - error = ENXIO; - goto fail; - } - - h = rman_get_bushandle(sc->sc_resources.io_base[0]); - t = rman_get_bustag(sc->sc_resources.io_base[0]); - - ++res_init_level; - - /* Allocate interrupt. */ - sc->sc_resources.irq_rid = 0; - sc->sc_resources.irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, RF_SHAREABLE | RF_ACTIVE); - - if (sc->sc_resources.irq == NULL) - { - printf("itjc%d: couldn't map interrupt\n", unit); - error = ENXIO; - goto fail; - } - - ++res_init_level; - - error = bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, - NULL, itjc_intr, sc, &ih); - - if (error) - { - printf("itjc%d: couldn't set up irq handler\n", unit); - error = ENXIO; - goto fail; - } - - /* - * Reset the ASIC & the ISAC. - */ - itjc_write_1(TIGER_RESET_PIB_CL_TIME, TIGER_RESET_ALL); - - DELAY(SEC_DELAY/100); /* Give it 10 ms to reset ...*/ - - itjc_write_1(TIGER_RESET_PIB_CL_TIME, - TIGER_SELF_ADDR_DMA | TIGER_PIB_3_CYCLES); - - DELAY(SEC_DELAY/100); /* ... and more 10 to recover. */ - - /* - * First part of DMA initialization. Create & map the memory - * pool that will be used to bear the rx & tx ring buffers. - */ - ctx->state = ITJC_DS_LOADING; - - error = bus_dma_tag_create( - NULL, /* parent */ - 4, /* alignment*/ - 0, /* boundary*/ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr*/ - BUS_SPACE_MAXADDR, /* highaddr*/ - NULL, /* filter*/ - NULL, /* filterarg*/ - ITJC_DMA_POOL_BYTES, /* maxsize*/ - 1, /* nsegments*/ - ITJC_DMA_POOL_BYTES, /* maxsegsz*/ - BUS_DMA_ALLOCNOW | BUS_DMA_COHERENT, /* flags*/ - NULL, NULL, /* lockfuunc, lockarg */ - &ctx->tag); - - if (error) - { - printf("itjc%d: couldn't create bus DMA tag.\n", unit); - goto fail; - } - - ++res_init_level; - - error = bus_dmamem_alloc( - ctx->tag, /* DMA tag */ - (void **)&ctx->pool, /* KV addr of the allocated memory */ - BUS_DMA_NOWAIT | BUS_DMA_COHERENT, /* flags */ - &ctx->map); /* KV <-> PCI map */ - - if (error) - goto fail; - - /* - * Load the KV <-> PCI map so the device sees the same - * memory segment as pointed by pool. Note: since the - * load may happen assyncronously (completion indicated by - * the execution of the callback function) we have to - * delay the initialization of the DMA engine to a moment we - * actually have the proper bus addresses to feed the Tiger - * and our DMA control blocks. This will be done in - * itjc_bchannel_setup via a call to itjc_dma_start. - */ - bus_dmamap_load( - ctx->tag, /* DMA tag */ - ctx->map, /* DMA map */ - ctx->pool, /* KV addr of buffer */ - ITJC_DMA_POOL_BYTES, /* buffer size */ - itjc_map_callback, /* this receive the bus addr/error */ - ctx, /* callback aux arg */ - 0); /* flags */ - - ++res_init_level; - - /* - * Setup the AUX port so we can talk to the ISAC. - */ - itjc_write_1(TIGER_AUX_PORT_CNTL, TIGER_AUX_NJ_DEFAULT); - itjc_write_1(TIGER_INT1_MASK, TIGER_ISAC_INT); - - /* - * From now on, almost like a `normal' ISIC driver. - */ - - sc->sc_unit = unit; - - ISAC_BASE = (caddr_t)ISIC_WHAT_ISAC; - - HSCX_A_BASE = (caddr_t)ISIC_WHAT_HSCXA; - HSCX_B_BASE = (caddr_t)ISIC_WHAT_HSCXB; - - /* setup access routines */ - - sc->clearirq = NULL; - sc->readreg = itjc_read_reg; - sc->writereg = itjc_write_reg; - - sc->readfifo = itjc_read_fifo; - sc->writefifo = itjc_write_fifo; - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_NETJET_S; - - /* setup IOM bus type */ - - sc->sc_bustyp = BUS_TYPE_IOM2; - - /* set up some other miscellaneous things */ - sc->sc_ipac = 0; - sc->sc_bfifolen = 2 * ITJC_RING_SLOT_WORDS; - - printf("itjc%d: ISAC 2186 Version 1.1 (IOM-2)\n", unit); - - /* init the ISAC */ - itjc_isac_init(sc); - - chan = &sc->sc_chan[HSCX_CH_A]; - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp_rx", NULL, MTX_DEF); - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp_tx", NULL, MTX_DEF); - chan = &sc->sc_chan[HSCX_CH_B]; - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp_rx", NULL, MTX_DEF); - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp_tx", NULL, MTX_DEF); - - /* init the "HSCX" */ - itjc_bchannel_setup(sc->sc_unit, HSCX_CH_A, BPROT_NONE, 0); - - itjc_bchannel_setup(sc->sc_unit, HSCX_CH_B, BPROT_NONE, 0); - - /* can't use the normal B-Channel stuff */ - itjc_init_linktab(sc); - - /* set trace level */ - - sc->sc_trace = TRACE_OFF; - - sc->sc_state = ISAC_IDLE; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - sc->sc_freeflag = 0; - - sc->sc_obuf2 = NULL; - sc->sc_freeflag2 = 0; - -#if defined(__FreeBSD__) && __FreeBSD__ >=3 - callout_handle_init(&sc->sc_T3_callout); - callout_handle_init(&sc->sc_T4_callout); -#endif - - /* init higher protocol layers */ - - i4b_l1_mph_status_ind(L0ITJCUNIT(sc->sc_unit), STI_ATTACH, - sc->sc_cardtyp, &itjc_l1mux_func); - - splx(s); - return 0; - - fail: - switch (res_init_level) - { - case 5: - bus_dmamap_unload(ctx->tag, ctx->map); - /* FALL TRHU */ - - case 4: - bus_dmamem_free(ctx->tag, ctx->pool, ctx->map); - bus_dmamap_destroy(ctx->tag, ctx->map); - /* FALL TRHU */ - - case 3: - bus_dma_tag_destroy(ctx->tag); - /* FALL TRHU */ - - case 2: - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_resources.irq); - /* FALL TRHU */ - - case 1: - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), - sc->sc_resources.io_base[0]); - /* FALL TRHU */ - - case 0: - break; - } - - itjc_scp[unit] = NULL; - - splx(s); - return error; -} - - -/*---------------------------------------------------------------------------* - * itjc_intr - main interrupt service routine. - *---------------------------------------------------------------------------*/ -static void -itjc_intr(void *xsc) -{ - struct l1_softc *sc = xsc; - l1_bchan_state_t *chan = &sc->sc_chan[0]; - dma_context_t *dma = &dma_context[sc->sc_unit]; - dma_rx_context_t *rxc = &dma_rx_context[sc->sc_unit][0]; - dma_tx_context_t *txc = &dma_tx_context[sc->sc_unit][0]; - - itjc_bus_setup(sc); - - /* Honor interrupts from successfully configured cards only. */ - if (dma->state < ITJC_DS_STOPPED) - return; - - /* First, we check the ISAC... */ - if (! (itjc_read_1(TIGER_AUX_PORT_DATA) & TIGER_ISAC_INT_MASK)) - { - itjc_write_1(TIGER_INT1_STATUS, TIGER_ISAC_INT); - NDBGL1(L1_H_IRQ, "ISAC"); - itjc_isac_intr(sc); - } - - /* ... after what we always have a look at the DMA rings. */ - - NDBGL1(L1_H_IRQ, "Tiger"); - - itjc_read_1(TIGER_INT0_STATUS); - itjc_write_1(TIGER_INT0_STATUS, TIGER_TARGET_ABORT_INT - | TIGER_MASTER_ABORT_INT | TIGER_RD_END_INT - | TIGER_RD_INT_INT | TIGER_WR_END_INT | TIGER_WR_INT_INT); - - itjc_dma_rx_intr(sc, chan, rxc); - itjc_dma_tx_intr(sc, chan, txc); - - ++chan; ++rxc; ++txc; - - itjc_dma_rx_intr(sc, chan, rxc); - itjc_dma_tx_intr(sc, chan, txc); -} - - -/*---------------------------------------------------------------------------* - * itjc_bchannel_setup - (Re)initialize and start/stop a Bchannel. - *---------------------------------------------------------------------------*/ -static void -itjc_bchannel_setup(int unit, int h_chan, int bprot, int activate) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = itjc_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s = SPLI4B(); - - NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", - unit, h_chan, activate ? "activate" : "deactivate"); - - /* - * If we are deactivating the channel, we have to stop - * the DMA before we reset the channel control structures. - */ - if (! activate) - itjc_bchannel_dma_setup(sc, h_chan, activate); - - /* general part */ - - chan->state = HSCX_IDLE; - - chan->unit = sc->sc_unit; /* unit number */ - chan->channel = h_chan; /* B channel */ - chan->bprot = bprot; /* B channel protocol */ - - /* receiver part */ - - i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ - - chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; - - chan->rxcount = 0; /* reset rx counter */ - - i4b_Bfreembuf(chan->in_mbuf); /* clean rx mbuf */ - - chan->in_mbuf = NULL; /* reset mbuf ptr */ - chan->in_cbptr = NULL; /* reset mbuf curr ptr */ - chan->in_len = 0; /* reset mbuf data len */ - - /* transmitter part */ - - i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ - - chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; - - chan->txcount = 0; /* reset tx counter */ - - i4b_Bfreembuf(chan->out_mbuf_head); /* clean tx mbuf */ - - chan->out_mbuf_head = NULL; /* reset head mbuf ptr */ - chan->out_mbuf_cur = NULL; /* reset current mbuf ptr */ - chan->out_mbuf_cur_ptr = NULL; /* reset current mbuf data ptr */ - chan->out_mbuf_cur_len = 0; /* reset current mbuf data cnt */ - - /* - * Only setup & start the DMA after all other channel - * control structures are in place. - */ - if (activate) - itjc_bchannel_dma_setup(sc, h_chan, activate); - - splx(s); -} - - -/*---------------------------------------------------------------------------* - * itjc_bchannel_start - Signal us we have more data to send. - *---------------------------------------------------------------------------*/ -static void -itjc_bchannel_start(int unit, int h_chan) -{ -#if 0 /* Buggy code */ - /* - * I disabled this routine because it was causing crashes when - * this driver was used with the ISP (kernel SPPP) protocol driver. - * The scenario is reproductible: - * Use the -link1 (dial on demand) ifconfig option. - * Start an interactive TCP connection to somewhere. - * Wait until the PPP connection times out and is dropped. - * Try to send something on the TCP connection. - * The machine will print some garbage and halt or reboot - * (no panic messages). - * - * I've nailed down the problem to the fact that this routine - * was being called before the B channel had been setup again. - * - * For now, I don't have a good solution other than this one. - * But, don't despair. The impact of it is unnoticeable. - */ - -#ifdef __FreeBSD__ - struct l1_softc *sc = itjc_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - int s = SPLI4B(); - - dma_tx_context_t *txc = &dma_tx_context[unit][h_chan]; - - if (chan->state & HSCX_TX_ACTIVE) - { - splx(s); - return; - } - - itjc_dma_tx_intr(sc, chan, txc); - - splx(s); -#endif -} - - -/*---------------------------------------------------------------------------* - * itjc_shutdown - Stop the driver and reset the card. - *---------------------------------------------------------------------------*/ -static void -itjc_shutdown(device_t dev) -{ - struct l1_softc *sc = device_get_softc(dev); - - itjc_bus_setup(sc); - - /* - * Stop the DMA the nice and easy way. - */ - itjc_bchannel_setup(sc->sc_unit, 0, BPROT_NONE, 0); - itjc_bchannel_setup(sc->sc_unit, 1, BPROT_NONE, 0); - - /* - * Reset the card. - */ - itjc_write_1(TIGER_RESET_PIB_CL_TIME, TIGER_RESET_ALL); - - DELAY(SEC_DELAY/100); /* Give it 10 ms to reset ...*/ - - itjc_write_1(TIGER_RESET_PIB_CL_TIME, - TIGER_SELF_ADDR_DMA | TIGER_LATCH_DMA_INT | TIGER_PIB_3_CYCLES); - - DELAY(SEC_DELAY/100); /* ... and more 10 to recover */ -} - - -/*---------------------------------------------------------------------------* - * itjc_ret_linktab - Return the address of itjc drivers linktab. - *---------------------------------------------------------------------------*/ -isdn_link_t * -itjc_ret_linktab(int unit, int channel) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = itjc_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - return(&chan->isic_isdn_linktab); -} - -/*---------------------------------------------------------------------------* - * itjc_set_linktab - Set the driver linktab in the b channel softc. - *---------------------------------------------------------------------------*/ -void -itjc_set_linktab(int unit, int channel, drvr_link_t *dlt) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = itjc_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[channel]; - - chan->isic_drvr_linktab = dlt; -} - - -/*---------------------------------------------------------------------------* - * itjc_init_linktab - Initialize our local linktab. - *---------------------------------------------------------------------------*/ -static void -itjc_init_linktab(struct l1_softc *sc) -{ - l1_bchan_state_t *chan = &sc->sc_chan[HSCX_CH_A]; - isdn_link_t *lt = &chan->isic_isdn_linktab; - - /* make sure the hardware driver is known to layer 4 */ - /* avoid overwriting if already set */ - if (ctrl_types[CTRL_PASSIVE].set_linktab == NULL) - { - ctrl_types[CTRL_PASSIVE].set_linktab = itjc_set_linktab; - ctrl_types[CTRL_PASSIVE].get_linktab = itjc_ret_linktab; - } - - /* local setup */ - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_A; - lt->bch_config = itjc_bchannel_setup; - lt->bch_tx_start = itjc_bchannel_start; - lt->bch_stat = itjc_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; - - chan = &sc->sc_chan[HSCX_CH_B]; - lt = &chan->isic_isdn_linktab; - - lt->unit = sc->sc_unit; - lt->channel = HSCX_CH_B; - lt->bch_config = itjc_bchannel_setup; - lt->bch_tx_start = itjc_bchannel_start; - lt->bch_stat = itjc_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; -} - - -/*---------------------------------------------------------------------------* - * itjc_bchannel_stat - Collect link statistics for a given B channel. - *---------------------------------------------------------------------------*/ -static void -itjc_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) -{ -#ifdef __FreeBSD__ - struct l1_softc *sc = itjc_scp[unit]; -#else - struct l1_softc *sc = isic_find_sc(unit); -#endif - l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - - s = SPLI4B(); - - bsp->outbytes = chan->txcount; - bsp->inbytes = chan->rxcount; - - chan->txcount = 0; - chan->rxcount = 0; - - splx(s); -} - - -/*---------------------------------------------------------------------------* - * Netjet - ISAC interrupt routine. - *---------------------------------------------------------------------------*/ -static void -itjc_isac_intr(struct l1_softc *sc) -{ - register u_char irq_stat; - - do - { - /* get isac irq status */ - irq_stat = ISAC_READ(I_ISTA); - - if(irq_stat) - itjc_isac_irq(sc, irq_stat); /* isac handler */ - } - while(irq_stat); - - ISAC_WRITE(I_MASK, 0xff); - - DELAY(100); - - ISAC_WRITE(I_MASK, ISAC_IMASK); -} - - -/*---------------------------------------------------------------------------* - * itjc_recover - Try to recover from ISAC irq lockup. - *---------------------------------------------------------------------------*/ -void -itjc_recover(struct l1_softc *sc) -{ - u_char byte; - - /* get isac irq status */ - - byte = ISAC_READ(I_ISTA); - - NDBGL1(L1_ERROR, " ISAC: ISTA = 0x%x", byte); - - if(byte & ISAC_ISTA_EXI) - NDBGL1(L1_ERROR, " ISAC: EXIR = 0x%x", (u_char)ISAC_READ(I_EXIR)); - - if(byte & ISAC_ISTA_CISQ) - { - byte = ISAC_READ(I_CIRR); - - NDBGL1(L1_ERROR, " ISAC: CISQ = 0x%x", byte); - - if(byte & ISAC_CIRR_SQC) - NDBGL1(L1_ERROR, " ISAC: SQRR = 0x%x", (u_char)ISAC_READ(I_SQRR)); - } - - NDBGL1(L1_ERROR, " ISAC: IMASK = 0x%x", ISAC_IMASK); - - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - ISAC_WRITE(I_MASK, ISAC_IMASK); -} diff --git a/sys/i4b/layer1/iwic/i4b_iwic.h b/sys/i4b/layer1/iwic/i4b_iwic.h deleted file mode 100644 index f48811f79895..000000000000 --- a/sys/i4b/layer1/iwic/i4b_iwic.h +++ /dev/null @@ -1,223 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Dave Boyce. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iwic - isdn4bsd Winbond W6692 driver - * ---------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Jan 21 11:08:44 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IWIC_H_ -#define _I4B_IWIC_H_ - -#include - -/*---------------------------------------------------------------------------* - * PCI resources used - *---------------------------------------------------------------------------*/ - -#define INFO_IO_BASES 2 - -struct i4b_info { - struct resource * io_base[INFO_IO_BASES]; - int io_rid [INFO_IO_BASES]; - struct resource * irq; - int irq_rid; - struct resource * mem; - int mem_rid; -}; - -/*---------------------------------------------------------------------------* - * state of a B channel - *---------------------------------------------------------------------------*/ -struct iwic_bchan -{ - int unit; /* unit number */ - int channel; /* channel number */ - int offset; /* offset from iobase */ - int bprot; /* b channel protocol used */ - int state; /* transceiver state: */ -#define ST_IDLE 0x00 /* channel idle */ -#define ST_TX_ACTIVE 0x01 /* tx running */ - - int sc_trace_bcount; - - /* receive data from ISDN */ - - struct ifqueue rx_queue; /* receiver queue */ - int rxcount; /* rx statistics counter*/ - struct mbuf *in_mbuf; /* rx input buffer */ - u_char *in_cbptr; /* curr buffer pointer */ - int in_len; /* rx input buffer len */ - - /* transmit data to ISDN */ - - struct ifqueue tx_queue; /* transmitter queue */ - int txcount; /* tx statistics counter */ - struct mbuf *out_mbuf_head; /* first mbuf in possible chain */ - struct mbuf *out_mbuf_cur; /* current mbuf in possbl chain */ - unsigned char *out_mbuf_cur_ptr; /* data pointer into mbuf */ - int out_mbuf_cur_len; /* remaining bytes in mbuf */ - - /* linktab */ - - isdn_link_t iwic_isdn_linktab; - drvr_link_t *iwic_drvr_linktab; -}; - -/*---------------------------------------------------------------------------* - * state of a D channel - *---------------------------------------------------------------------------*/ -struct iwic_dchan -{ - int enabled; - int trace_count; - struct mbuf *ibuf; - u_char *ibuf_ptr; /* Input buffer pointer */ - int ibuf_len; /* Current length of input buffer */ - int ibuf_max_len; /* Max length in input buffer */ - int rx_count; - - int tx_ready; /* Can send next 64 bytes of data. */ - int tx_count; - - struct mbuf *obuf; - int free_obuf; - u_char *obuf_ptr; - int obuf_len; - - struct mbuf *obuf2; - int free_obuf2; -}; - -/*---------------------------------------------------------------------------* - * state of one iwic unit - *---------------------------------------------------------------------------*/ -struct iwic_softc -{ - int sc_unit; - u_int32_t sc_iobase; - int sc_trace; - int sc_cardtyp; - - int sc_I430state; - int sc_I430T3; - - int enabled; - - struct iwic_dchan sc_dchan; - struct iwic_bchan sc_bchan[2]; - - struct i4b_info sc_resources; -}; - -/*---------------------------------------------------------------------------* - * rd/wr register/fifo macros - *---------------------------------------------------------------------------*/ -#define IWIC_READ(sc,reg) (inb ((sc)->sc_iobase + (u_int32_t)(reg))) -#define IWIC_WRITE(sc,reg,val) (outb ((sc)->sc_iobase + (u_int32_t)(reg), (val))) -#define IWIC_WRDFIFO(sc,p,l) (outsb ((sc)->sc_iobase + D_XFIFO, (p), (l))) -#define IWIC_RDDFIFO(sc,p,l) (insb ((sc)->sc_iobase + D_RFIFO, (p), (l))) -#define IWIC_WRBFIFO(sc,b,p,l) (outsb (((sc)->sc_iobase + (b)->offset + B_XFIFO), (p), (l))) -#define IWIC_RDBFIFO(sc,b,p,l) (insb (((sc)->sc_iobase + (b)->offset + B_RFIFO), (p), (l))) - -/*---------------------------------------------------------------------------* - * possible I.430 states - *---------------------------------------------------------------------------*/ -enum I430states -{ - ST_F3N, /* F3 Deactivated, no clock */ - ST_F3, /* F3 Deactivated */ - ST_F4, /* F4 Awaiting Signal */ - ST_F5, /* F5 Identifying Input */ - ST_F6, /* F6 Synchronized */ - ST_F7, /* F7 Activated */ - ST_F8, /* F8 Lost Framing */ - ST_ILL, /* Illegal State */ - N_STATES -}; - -/*---------------------------------------------------------------------------* - * possible I.430 events - *---------------------------------------------------------------------------*/ -enum I430events -{ - EV_PHAR, /* PH ACTIVATE REQUEST */ - EV_CE, /* Clock enabled */ - EV_T3, /* Timer 3 expired */ - EV_INFO0, /* receiving INFO0 */ - EV_RSY, /* receiving any signal */ - EV_INFO2, /* receiving INFO2 */ - EV_INFO48, /* receiving INFO4 pri 8/9 */ - EV_INFO410, /* receiving INFO4 pri 10/11 */ - EV_DR, /* Deactivate Request */ - EV_PU, /* Power UP */ - EV_DIS, /* Disconnected (only 2085) */ - EV_EI, /* Error Indication */ - EV_ILL, /* Illegal Event */ - N_EVENTS -}; - -/*---------------------------------------------------------------------------* - * available commands - *---------------------------------------------------------------------------*/ -enum I430commands -{ - CMD_ECK, /* Enable clock */ - CMD_TIM, /* Timing */ - CMD_RT, /* Reset */ - CMD_AR8, /* Activation request pri 8 */ - CMD_AR10, /* Activation request pri 10 */ - CMD_DIU, /* Deactivate Indication Upstream */ - CMD_ILL /* Illegal command */ -}; - - -extern struct iwic_softc iwic_sc[]; - -#define iwic_find_sc(unit) (&iwic_sc[(unit)]) - -extern void iwic_init(struct iwic_softc *); -extern void iwic_next_state(struct iwic_softc *, int); - -extern void iwic_dchan_init(struct iwic_softc *); -extern void iwic_dchan_xirq(struct iwic_softc *); -extern void iwic_dchan_xfer_irq(struct iwic_softc *, int); -extern void iwic_dchan_disable(struct iwic_softc *sc); -extern int iwic_dchan_data_req(struct iwic_softc *sc, struct mbuf *m, int freeflag); -extern void iwic_dchan_transmit(struct iwic_softc *sc); - -char *iwic_printstate(struct iwic_softc *sc); - -void iwic_init_linktab(struct iwic_softc *sc); -void iwic_bchan_xirq(struct iwic_softc *, int); -void iwic_bchannel_setup(int unit, int h_chan, int bprot, int activate); - -#endif /* _I4B_IWIC_H_ */ diff --git a/sys/i4b/layer1/iwic/i4b_iwic_bchan.c b/sys/i4b/layer1/iwic/i4b_iwic_bchan.c deleted file mode 100644 index 66b1b537d6b8..000000000000 --- a/sys/i4b/layer1/iwic/i4b_iwic_bchan.c +++ /dev/null @@ -1,767 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Dave Boyce. All rights reserved. - * Copyright (c) 2000, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iwic - isdn4bsd Winbond W6692 driver - * ---------------------------------------- - * last edit-date: [Tue Jan 16 13:21:24 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include - - -#include -#include -#include - -#include - -#include -#include - -#include -#include - -static void iwic_bchan_init(struct iwic_softc *sc, int chan_no, int activate); - -/*---------------------------------------------------------------------------* - * B-channel interrupt handler - *---------------------------------------------------------------------------*/ -void -iwic_bchan_xirq(struct iwic_softc *sc, int chan_no) -{ - int irq_stat; - struct iwic_bchan *chan; - int cmd = 0; - int activity = 0; - - chan = &sc->sc_bchan[chan_no]; - - irq_stat = IWIC_READ(sc, chan->offset + B_EXIR); - - NDBGL1(L1_H_IRQ, "irq_stat = 0x%x", irq_stat); - - if((irq_stat & (B_EXIR_RMR | B_EXIR_RME | B_EXIR_RDOV | B_EXIR_XFR | B_EXIR_XDUN)) == 0) - { - NDBGL1(L1_H_XFRERR, "spurious IRQ!"); - return; - } - - if (irq_stat & B_EXIR_RDOV) - { - NDBGL1(L1_H_XFRERR, "iwic%d: EXIR B-channel Receive Data Overflow", sc->sc_unit); - } - - if (irq_stat & B_EXIR_XDUN) - { - NDBGL1(L1_H_XFRERR, "iwic%d: EXIR B-channel Transmit Data Underrun", sc->sc_unit); - cmd |= (B_CMDR_XRST); /*XXX must retransmit frame ! */ - } - -/* RX message end interrupt */ - - if(irq_stat & B_EXIR_RME) - { - int error; - - NDBGL1(L1_H_IRQ, "B_EXIR_RME"); - - error = (IWIC_READ(sc,chan->offset+B_STAR) & - (B_STAR_RDOV | B_STAR_CRCE | B_STAR_RMB)); - - if(error) - { - if(error & B_STAR_RDOV) - NDBGL1(L1_H_XFRERR, "iwic%d: B-channel Receive Data Overflow", sc->sc_unit); - if(error & B_STAR_CRCE) - NDBGL1(L1_H_XFRERR, "iwic%d: B-channel CRC Error", sc->sc_unit); - if(error & B_STAR_RMB) - NDBGL1(L1_H_XFRERR, "iwic%d: B-channel Receive Message Aborted", sc->sc_unit); - } - - /* all error conditions checked, now decide and take action */ - - if(error == 0) - { - register int fifo_data_len; - fifo_data_len = ((IWIC_READ(sc,chan->offset+B_RBCL)) & - ((IWIC_BCHAN_FIFO_LEN)-1)); - - if(fifo_data_len == 0) - fifo_data_len = IWIC_BCHAN_FIFO_LEN; - - - if(chan->in_mbuf == NULL) - { - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 iwic_bchan_irq: RME, cannot allocate mbuf!\n"); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - - if((chan->in_len + fifo_data_len) <= BCH_MAX_DATALEN) - { - /* read data from fifo */ - - NDBGL1(L1_H_IRQ, "B_EXIR_RME, rd fifo, len = %d", fifo_data_len); - - IWIC_RDBFIFO(sc, chan, chan->in_cbptr, fifo_data_len); - - cmd |= (B_CMDR_RACK | B_CMDR_RACT); - IWIC_WRITE(sc, chan->offset + B_CMDR, cmd); - cmd = 0; - - chan->in_len += fifo_data_len; - chan->rxcount += fifo_data_len; - - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IWICUNIT(sc->sc_unit); - hdr.type = (chan_no == IWIC_BCH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_bchan[chan_no].sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - (*chan->iwic_drvr_linktab->bch_rx_data_ready)(chan->iwic_drvr_linktab->unit); - - activity = ACT_RX; - - /* mark buffer ptr as unused */ - - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - else - { - NDBGL1(L1_H_XFRERR, "RAWHDLC rx buffer overflow in RME, in_len=%d, fifolen=%d", chan->in_len, fifo_data_len); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - cmd |= (B_CMDR_RRST | B_CMDR_RACK); - } - } - else - { - if (chan->in_mbuf != NULL) - { - i4b_Bfreembuf(chan->in_mbuf); - chan->in_mbuf = NULL; - chan->in_cbptr = NULL; - chan->in_len = 0; - } - cmd |= (B_CMDR_RRST | B_CMDR_RACK); - } - } - -/* RX fifo full interrupt */ - - if(irq_stat & B_EXIR_RMR) - { - NDBGL1(L1_H_IRQ, "B_EXIR_RMR"); - - if(chan->in_mbuf == NULL) - { - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 iwic_bchan_irq: RMR, cannot allocate mbuf!\n"); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - } - - chan->rxcount += IWIC_BCHAN_FIFO_LEN; - - if((chan->in_len + IWIC_BCHAN_FIFO_LEN) <= BCH_MAX_DATALEN) - { - /* read data from fifo */ - - NDBGL1(L1_H_IRQ, "B_EXIR_RMR, rd fifo, len = max (64)"); - - IWIC_RDBFIFO(sc, chan, chan->in_cbptr, IWIC_BCHAN_FIFO_LEN); - - chan->in_cbptr += IWIC_BCHAN_FIFO_LEN; - chan->in_len += IWIC_BCHAN_FIFO_LEN; - } - else - { - if(chan->bprot == BPROT_NONE) - { - /* setup mbuf data length */ - - chan->in_mbuf->m_len = chan->in_len; - chan->in_mbuf->m_pkthdr.len = chan->in_len; - - if(sc->sc_trace & TRACE_B_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IWICUNIT(sc->sc_unit); - hdr.type = (chan_no == IWIC_BCH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_bchan[chan_no].sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); - } - - /* silence detection */ - - if(!(i4b_l1_bchan_tel_silence(chan->in_mbuf->m_data, chan->in_mbuf->m_len))) - activity = ACT_RX; - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - (void) IF_HANDOFF(&chan->rx_queue, chan->in_mbuf, NULL); -#else - if(!(IF_QFULL(&chan->rx_queue))) - { - IF_ENQUEUE(&chan->rx_queue, chan->in_mbuf); - } - else - { - i4b_Bfreembuf(chan->in_mbuf); - } -#endif - /* signal upper driver that data is available */ - - (*chan->iwic_drvr_linktab->bch_rx_data_ready)(chan->iwic_drvr_linktab->unit); - - /* alloc new buffer */ - - if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL) - panic("L1 iwic_bchan_irq: RMR, cannot allocate new mbuf!\n"); - - /* setup new data ptr */ - - chan->in_cbptr = chan->in_mbuf->m_data; - - /* read data from fifo */ - - NDBGL1(L1_H_IRQ, "B_EXIR_RMR, rd fifo1, len = max (64)"); - - IWIC_RDBFIFO(sc, chan, chan->in_cbptr, IWIC_BCHAN_FIFO_LEN); - - chan->in_cbptr += IWIC_BCHAN_FIFO_LEN; - chan->in_len = IWIC_BCHAN_FIFO_LEN; - - chan->rxcount += IWIC_BCHAN_FIFO_LEN; - } - else - { - NDBGL1(L1_H_XFRERR, "RAWHDLC rx buffer overflow in RPF, in_len=%d", chan->in_len); - chan->in_cbptr = chan->in_mbuf->m_data; - chan->in_len = 0; - cmd |= (B_CMDR_RRST | B_CMDR_RACK); - } - } - - /* command to release fifo space */ - - cmd |= B_CMDR_RACK; - } - -/* TX interrupt */ - - if (irq_stat & B_EXIR_XFR) - { - /* transmit fifo empty, new data can be written to fifo */ - - int activity = -1; - int len; - int nextlen; - - NDBGL1(L1_H_IRQ, "B_EXIR_XFR"); - - if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */ - { - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) - { - chan->state &= ~ST_TX_ACTIVE; - (*chan->iwic_drvr_linktab->bch_tx_queue_empty)(chan->iwic_drvr_linktab->unit); - } - else - { - chan->state |= ST_TX_ACTIVE; - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IWICUNIT(sc->sc_unit); - hdr.type = (chan_no == IWIC_BCH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_bchan[chan_no].sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - } - } - - len = 0; - - while(chan->out_mbuf_cur && len != IWIC_BCHAN_FIFO_LEN) - { - nextlen = min(chan->out_mbuf_cur_len, IWIC_BCHAN_FIFO_LEN - len); - - NDBGL1(L1_H_IRQ, "B_EXIR_XFR, wr fifo, len = %d", nextlen); - - IWIC_WRBFIFO(sc, chan, chan->out_mbuf_cur_ptr, nextlen); - - cmd |= B_CMDR_XMS; - - len += nextlen; - chan->txcount += nextlen; - - chan->out_mbuf_cur_ptr += nextlen; - chan->out_mbuf_cur_len -= nextlen; - - if(chan->out_mbuf_cur_len == 0) - { - if((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL) - { - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IWICUNIT(sc->sc_unit); - hdr.type = (chan_no == IWIC_BCH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_bchan[chan_no].sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - } - else - { - if (chan->bprot != BPROT_NONE) - cmd |= B_CMDR_XME; - i4b_Bfreembuf(chan->out_mbuf_head); - chan->out_mbuf_head = NULL; - } - } - } - } - if(cmd) - { - cmd |= B_CMDR_RACT; - IWIC_WRITE(sc, chan->offset + B_CMDR, cmd); - } -} - -/*---------------------------------------------------------------------------* - * initialize one B channels rx/tx data structures - *---------------------------------------------------------------------------*/ -void -iwic_bchannel_setup(int unit, int chan_no, int bprot, int activate) -{ - struct iwic_softc *sc = &iwic_sc[unit]; - struct iwic_bchan *chan = &sc->sc_bchan[chan_no]; - - int s = SPLI4B(); - - NDBGL1(L1_BCHAN, "unit %d, chan %d, bprot %d, activate %d", unit, chan_no, bprot, activate); - - /* general part */ - - chan->bprot = bprot; /* B channel protocol */ - chan->state = ST_IDLE; /* B channel state */ - - if(activate == 0) - { - /* deactivation */ - iwic_bchan_init(sc, chan_no, activate); - } - - /* receiver part */ - - chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_iwic_rx", NULL, MTX_DEF); -#endif - - i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ - - chan->rxcount = 0; /* reset rx counter */ - - i4b_Bfreembuf(chan->in_mbuf); /* clean rx mbuf */ - - chan->in_mbuf = NULL; /* reset mbuf ptr */ - chan->in_cbptr = NULL; /* reset mbuf curr ptr */ - chan->in_len = 0; /* reset mbuf data len */ - - /* transmitter part */ - - chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; - -#if defined (__FreeBSD__) && __FreeBSD__ > 4 - if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_iwic_tx", NULL, MTX_DEF); -#endif - - i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ - - chan->txcount = 0; /* reset tx counter */ - - i4b_Bfreembuf(chan->out_mbuf_head); /* clean tx mbuf */ - - chan->out_mbuf_head = NULL; /* reset head mbuf ptr */ - chan->out_mbuf_cur = NULL; /* reset current mbuf ptr */ - chan->out_mbuf_cur_ptr = NULL; /* reset current mbuf data ptr */ - chan->out_mbuf_cur_len = 0; /* reset current mbuf data cnt */ - - if(activate != 0) - { - /* activation */ - iwic_bchan_init(sc, chan_no, activate); - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * initalize / deinitialize B-channel hardware - *---------------------------------------------------------------------------*/ -static void -iwic_bchan_init(struct iwic_softc *sc, int chan_no, int activate) -{ - struct iwic_bchan *bchan = &sc->sc_bchan[chan_no]; - - NDBGL1(L1_BCHAN, "chan %d, activate %d", chan_no, activate); - - if(activate) - { - if(bchan->bprot == BPROT_NONE) - { - /* Extended transparent mode */ - IWIC_WRITE(sc, bchan->offset + B_MODE, B_MODE_MMS); - } - else - { - /* Transparent mode */ - IWIC_WRITE(sc, bchan->offset + B_MODE, 0); - /* disable address comparation */ - IWIC_WRITE (sc, bchan->offset+B_ADM1, 0xff); - IWIC_WRITE (sc, bchan->offset+B_ADM2, 0xff); - } - - /* reset & start receiver */ - IWIC_WRITE(sc, bchan->offset + B_CMDR, B_CMDR_RRST|B_CMDR_RACT); - - /* clear irq mask */ - IWIC_WRITE(sc, bchan->offset + B_EXIM, 0); - } - else - { - /* mask all irqs */ - IWIC_WRITE(sc, bchan->offset + B_EXIM, 0xff); - - /* reset mode */ - IWIC_WRITE(sc, bchan->offset + B_MODE, 0); - - /* Bring interface down */ - IWIC_WRITE(sc, bchan->offset + B_CMDR, B_CMDR_RRST | B_CMDR_XRST); - - /* Flush pending interrupts */ - IWIC_READ(sc, bchan->offset + B_EXIR); - } -} - -/*---------------------------------------------------------------------------* - * start transmission on a b channel - *---------------------------------------------------------------------------*/ -static void -iwic_bchannel_start(int unit, int chan_no) -{ - struct iwic_softc *sc = &iwic_sc[unit]; - register struct iwic_bchan *chan = &sc->sc_bchan[chan_no]; - register int next_len; - register int len; - - int s; - int activity = -1; - int cmd = 0; - - s = SPLI4B(); /* enter critical section */ - - NDBGL1(L1_BCHAN, "unit %d, channel %d", unit, chan_no); - - if(chan->state & ST_TX_ACTIVE) /* already running ? */ - { - splx(s); - return; /* yes, leave */ - } - - /* get next mbuf from queue */ - - IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head); - - if(chan->out_mbuf_head == NULL) /* queue empty ? */ - { - splx(s); /* leave critical section */ - return; /* yes, exit */ - } - - /* init current mbuf values */ - - chan->out_mbuf_cur = chan->out_mbuf_head; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - - /* activity indicator for timeout handling */ - - if(chan->bprot == BPROT_NONE) - { - if(!(i4b_l1_bchan_tel_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len))) - activity = ACT_TX; - } - else - { - activity = ACT_TX; - } - - chan->state |= ST_TX_ACTIVE; /* we start transmitting */ - - if(sc->sc_trace & TRACE_B_TX) /* if trace, send mbuf to trace dev */ - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IWICUNIT(unit); - hdr.type = (chan_no == IWIC_BCH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_bchan[chan_no].sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - - len = 0; /* # of chars put into tx fifo this time */ - - /* - * fill the tx fifo with data from the current mbuf. if - * current mbuf holds less data than fifo length, try to - * get the next mbuf from (a possible) mbuf chain. if there is - * not enough data in a single mbuf or in a chain, then this - * is the last mbuf and we tell the chip that it has to send - * CRC and closing flag - */ - - while((len < IWIC_BCHAN_FIFO_LEN) && chan->out_mbuf_cur) - { - /* - * put as much data into the fifo as is - * available from the current mbuf - */ - - if((len + chan->out_mbuf_cur_len) >= IWIC_BCHAN_FIFO_LEN) - next_len = IWIC_BCHAN_FIFO_LEN - len; - else - next_len = chan->out_mbuf_cur_len; - - /* write what we have from current mbuf to fifo */ - - IWIC_WRBFIFO(sc, chan, chan->out_mbuf_cur_ptr, next_len); - - len += next_len; /* update # of bytes written */ - chan->txcount += next_len; /* statistics */ - chan->out_mbuf_cur_ptr += next_len; /* data ptr */ - chan->out_mbuf_cur_len -= next_len; /* data len */ - - /* - * in case the current mbuf (of a possible chain) data - * has been put into the fifo, check if there is a next - * mbuf in the chain. If there is one, get ptr to it - * and update the data ptr and the length - */ - - if((chan->out_mbuf_cur_len <= 0) && - ((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL)) - { - chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data; - chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len; - - if(sc->sc_trace & TRACE_B_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IWICUNIT(unit); - hdr.type = (chan_no == IWIC_BCH_A ? TRC_CH_B1 : TRC_CH_B2); - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_bchan[chan_no].sc_trace_bcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); - } - } - } - - /* - * if there is either still data in the current mbuf and/or - * there is a successor on the chain available issue just - * a XTF (transmit) command to the chip. if there is no more - * data available from the current mbuf (-chain), issue - * an XTF and an XME (message end) command which will then - * send the CRC and the closing HDLC flag sequence - */ - - if(chan->out_mbuf_cur && (chan->out_mbuf_cur_len > 0)) - { - /* - * more data available, send current fifo out. - * next xfer to tx fifo is done in the - * interrupt routine. - */ - - cmd |= B_CMDR_XMS; - } - else - { - /* end of mbuf chain */ - - if(chan->bprot == BPROT_NONE) - cmd |= B_CMDR_XMS; - else - cmd |= (B_CMDR_XMS | B_CMDR_XME); - - i4b_Bfreembuf(chan->out_mbuf_head); /* free mbuf chain */ - - chan->out_mbuf_head = NULL; - chan->out_mbuf_cur = NULL; - chan->out_mbuf_cur_ptr = NULL; - chan->out_mbuf_cur_len = 0; - } - - /* call timeout handling routine */ - - if(activity == ACT_RX || activity == ACT_TX) - (*chan->iwic_drvr_linktab->bch_activity)(chan->iwic_drvr_linktab->unit, activity); - - if(cmd) - { - cmd |= B_CMDR_RACT; - IWIC_WRITE(sc, chan->offset + B_CMDR, cmd); - } - - splx(s); -} - -/*---------------------------------------------------------------------------* - * return B-channel statistics - *---------------------------------------------------------------------------*/ -static void -iwic_bchannel_stat(int unit, int chan_no, bchan_statistics_t *bsp) -{ - struct iwic_softc *sc = iwic_find_sc(unit); - struct iwic_bchan *bchan = &sc->sc_bchan[chan_no]; - - int s = SPLI4B(); - - bsp->outbytes = bchan->txcount; - bsp->inbytes = bchan->rxcount; - - bchan->txcount = 0; - bchan->rxcount = 0; - - splx(s); -} - -/*---------------------------------------------------------------------------* - * initialize our local linktab - *---------------------------------------------------------------------------*/ -void -iwic_init_linktab(struct iwic_softc *sc) -{ - struct iwic_bchan *chan; - isdn_link_t *lt; - - /* make sure the hardware driver is known to layer 4 */ - ctrl_types[CTRL_PASSIVE].set_linktab = i4b_l1_set_linktab; - ctrl_types[CTRL_PASSIVE].get_linktab = i4b_l1_ret_linktab; - - /* channel A */ - - chan = &sc->sc_bchan[IWIC_BCH_A]; - lt = &chan->iwic_isdn_linktab; - - lt->unit = sc->sc_unit; - lt->channel = IWIC_BCH_A; - lt->bch_config = iwic_bchannel_setup; - lt->bch_tx_start = iwic_bchannel_start; - lt->bch_stat = iwic_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; - - /* channel B */ - - chan = &sc->sc_bchan[IWIC_BCH_B]; - lt = &chan->iwic_isdn_linktab; - - lt->unit = sc->sc_unit; - lt->channel = IWIC_BCH_B; - lt->bch_config = iwic_bchannel_setup; - lt->bch_tx_start = iwic_bchannel_start; - lt->bch_stat = iwic_bchannel_stat; - lt->tx_queue = &chan->tx_queue; - - /* used by non-HDLC data transfers, i.e. telephony drivers */ - lt->rx_queue = &chan->rx_queue; - - /* used by HDLC data transfers, i.e. ipr and isp drivers */ - lt->rx_mbuf = &chan->in_mbuf; -} diff --git a/sys/i4b/layer1/iwic/i4b_iwic_dchan.c b/sys/i4b/layer1/iwic/i4b_iwic_dchan.c deleted file mode 100644 index d6ffa667eeb6..000000000000 --- a/sys/i4b/layer1/iwic/i4b_iwic_dchan.c +++ /dev/null @@ -1,467 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Dave Boyce. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iwic - isdn4bsd Winbond W6692 driver - * ---------------------------------------- - * last edit-date: [Tue Jan 16 13:20:14 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#define MAX_DFRAME_LEN 264 - -static void dchan_receive(struct iwic_softc *sc, int ista); - -/*---------------------------------------------------------------------------* - * initialize D-channel variables and registers - *---------------------------------------------------------------------------*/ -void -iwic_dchan_init(struct iwic_softc *sc) -{ - sc->sc_dchan.ibuf = NULL; - sc->sc_dchan.rx_count = 0; - - sc->sc_dchan.obuf = NULL; - sc->sc_dchan.obuf2 = NULL; - sc->sc_dchan.tx_count = 0; - sc->sc_dchan.tx_ready = 0; - - IWIC_WRITE(sc, D_CTL, D_CTL_SRST); - - DELAY(5000); - - IWIC_WRITE(sc, D_CTL, 0); - - IWIC_WRITE(sc, SQX, SQX_SCIE); - - IWIC_WRITE(sc, PCTL, 0x00); - IWIC_WRITE(sc, MOCR, 0x00); - IWIC_WRITE(sc, GCR, 0x00); - - IWIC_WRITE(sc, D_CMDR, D_CMDR_RRST | D_CMDR_XRST); - IWIC_WRITE(sc, D_MODE, D_MODE_RACT); - - IWIC_WRITE(sc, D_SAM, 0xff); - IWIC_WRITE(sc, D_TAM, 0xff); - - IWIC_WRITE(sc, D_EXIM, 0x00); -} - -/*---------------------------------------------------------------------------* - * Extended IRQ handler for the D-channel - *---------------------------------------------------------------------------*/ -void -iwic_dchan_xirq(struct iwic_softc *sc) -{ - int irq_stat; - int stat; - - irq_stat = IWIC_READ(sc, D_EXIR); - - if (irq_stat & D_EXIR_RDOV) - { - NDBGL1(L1_I_ERR, "RDOV in state %s", iwic_printstate(sc)); - IWIC_WRITE(sc, D_CMDR, D_CMDR_RRST); - } - if (irq_stat & D_EXIR_XDUN) - { - NDBGL1(L1_I_ERR, "XDUN in state %s", iwic_printstate(sc)); - sc->sc_dchan.tx_ready = 0; - } - if (irq_stat & D_EXIR_XCOL) - { - NDBGL1(L1_I_ERR, "XCOL in state %s", iwic_printstate(sc)); - IWIC_WRITE(sc, D_CMDR, D_CMDR_XRST); - sc->sc_dchan.tx_ready = 0; - } - if (irq_stat & D_EXIR_TIN2) - { - NDBGL1(L1_I_ERR, "TIN2 in state %s", iwic_printstate(sc)); - } - if (irq_stat & D_EXIR_MOC) - { - stat = IWIC_READ(sc, MOR); - NDBGL1(L1_I_ERR, "MOC in state %s, byte = 0x%x", iwic_printstate(sc), stat); - } - - if (irq_stat & D_EXIR_ISC) - { - stat = (IWIC_READ(sc, CIR)) & 0x0f; - - switch (stat) - { - case CIR_CE: - NDBGL1(L1_I_CICO, "rx CE in state %s", iwic_printstate(sc)); - iwic_next_state(sc, EV_CE); - break; - case CIR_DRD: - NDBGL1(L1_I_CICO, "rx DRD in state %s", iwic_printstate(sc)); - iwic_next_state(sc, EV_INFO0); - i4b_l1_mph_status_ind(L0IWICUNIT(sc->sc_unit), STI_L1STAT, LAYER_IDLE, NULL); - break; - case CIR_LD: - NDBGL1(L1_I_CICO, "rx LD in state %s", iwic_printstate(sc)); - iwic_next_state(sc, EV_RSY); - break; - case CIR_ARD: - NDBGL1(L1_I_CICO, "rx ARD in state %s", iwic_printstate(sc)); - iwic_next_state(sc, EV_INFO2); - break; - case CIR_TI: - NDBGL1(L1_I_CICO, "rx TI in state %s", iwic_printstate(sc)); - iwic_next_state(sc, EV_INFO0); - break; - case CIR_ATI: - NDBGL1(L1_I_CICO, "rx ATI in state %s", iwic_printstate(sc)); - iwic_next_state(sc, EV_INFO0); - break; - case CIR_AI8: - NDBGL1(L1_I_CICO, "rx AI8 in state %s", iwic_printstate(sc)); - i4b_l1_mph_status_ind(L0IWICUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - iwic_next_state(sc, EV_INFO48); - break; - case CIR_AI10: - NDBGL1(L1_I_CICO, "rx AI10 in state %s", iwic_printstate(sc)); - i4b_l1_mph_status_ind(L0IWICUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - iwic_next_state(sc, EV_INFO410); - break; - case CIR_CD: - NDBGL1(L1_I_CICO, "rx DIS in state %s", iwic_printstate(sc)); - iwic_next_state(sc, EV_DIS); - break; - default: - NDBGL1(L1_I_ERR, "ERROR, unknown indication 0x%x in state %s", stat, iwic_printstate(sc)); - iwic_next_state(sc, EV_INFO0); - break; - } - } - - if (irq_stat & D_EXIR_TEXP) - { - NDBGL1(L1_I_ERR, "TEXP in state %s", iwic_printstate(sc)); - } - - if (irq_stat & D_EXIR_WEXP) - { - NDBGL1(L1_I_ERR, "WEXP in state %s", iwic_printstate(sc)); - } -} - -/*---------------------------------------------------------------------------* - * All receiving and transmitting takes place here. - *---------------------------------------------------------------------------*/ -void -iwic_dchan_xfer_irq(struct iwic_softc *sc, int ista) -{ - NDBGL1(L1_I_MSG, "ISTA = 0x%x", ista); - - if (ista & (ISTA_D_RMR | ISTA_D_RME)) - { - /* Receive message ready */ - dchan_receive(sc, ista); - } - if (ista & ISTA_D_XFR) - { - /* Transmitter ready */ - sc->sc_dchan.tx_ready = 1; - - iwic_dchan_transmit(sc); - } -} - -/*---------------------------------------------------------------------------* - * disable D-channel - *---------------------------------------------------------------------------*/ -void -iwic_dchan_disable(struct iwic_softc *sc) -{ - int s; - - s = SPLI4B(); - - if (sc->sc_dchan.obuf) - { - if (sc->sc_dchan.free_obuf) - i4b_Dfreembuf(sc->sc_dchan.obuf); - sc->sc_dchan.obuf = NULL; - } - - if (sc->sc_dchan.obuf2) - { - if (sc->sc_dchan.free_obuf2) - i4b_Dfreembuf(sc->sc_dchan.obuf2); - sc->sc_dchan.obuf2 = NULL; - } - - splx(s); - - IWIC_WRITE(sc, CIX, CIX_DRC); -} - -/*---------------------------------------------------------------------------* - * queue D-channel message for transmission - *---------------------------------------------------------------------------*/ -int -iwic_dchan_data_req(struct iwic_softc *sc, struct mbuf *m, int freeflag) -{ - int s; - - if (!m) - return 0; - - s = SPLI4B(); - - /* Queue message */ - - if (sc->sc_dchan.obuf) - { - if (sc->sc_dchan.obuf2) - { - NDBGL1(L1_I_ERR, "no buffer space!"); - } - else - { - sc->sc_dchan.obuf2 = m; - sc->sc_dchan.free_obuf2 = freeflag; - } - } - else - { - sc->sc_dchan.obuf = m; - sc->sc_dchan.obuf_ptr = m->m_data; - sc->sc_dchan.obuf_len = m->m_len; - sc->sc_dchan.free_obuf = freeflag; - } - - iwic_dchan_transmit(sc); - - splx(s); - - return (0); -} - -/*---------------------------------------------------------------------------* - * allocate an mbuf - *---------------------------------------------------------------------------*/ -static void -dchan_get_mbuf(struct iwic_softc *sc, int len) -{ - sc->sc_dchan.ibuf = i4b_Dgetmbuf(len); - - if (!sc->sc_dchan.ibuf) - panic("dchan_get_mbuf: unable to allocate %d bytes for mbuf!\n", len); - - sc->sc_dchan.ibuf_ptr = sc->sc_dchan.ibuf->m_data; - sc->sc_dchan.ibuf_max_len = sc->sc_dchan.ibuf->m_len; - sc->sc_dchan.ibuf_len = 0; -} - -/*---------------------------------------------------------------------------* - * D-channel receive data interrupt - *---------------------------------------------------------------------------*/ -static void -dchan_receive(struct iwic_softc *sc, int ista) -{ - int command = D_CMDR_RACK; - - if (ista & ISTA_D_RMR) - { - /* Got 64 bytes in FIFO */ - - if (!sc->sc_dchan.ibuf) - { - dchan_get_mbuf(sc, MAX_DFRAME_LEN); - - } - else if ((sc->sc_dchan.ibuf_len + MAX_DFRAME_LEN) > - sc->sc_dchan.ibuf_max_len) - { - panic("dchan_receive: not enough space in buffer!\n"); - } - - IWIC_RDDFIFO(sc, sc->sc_dchan.ibuf_ptr, 64); - - sc->sc_dchan.ibuf_ptr += 64; - sc->sc_dchan.ibuf_len += 64; - sc->sc_dchan.rx_count += 64; - } - if (ista & ISTA_D_RME) - { - /* Got end of frame */ - int status; - - status = IWIC_READ(sc, D_RSTA); - - if (status & (D_RSTA_RDOV | D_RSTA_CRCE | D_RSTA_RMB)) - { - if (status & D_RSTA_RDOV) - NDBGL1(L1_I_ERR, "iwic%d: D-channel Receive Data Overflow", sc->sc_unit); - if (status & D_RSTA_CRCE) - NDBGL1(L1_I_ERR, "iwic%d: D-channel CRC Error", sc->sc_unit); - if (status & D_RSTA_RMB) - NDBGL1(L1_I_ERR, "iwic%d: D-channel Receive Message Aborted", sc->sc_unit); - command |= D_CMDR_RRST; - } - else - { - int hi, lo; - int total_frame_len; - - lo = IWIC_READ(sc, D_RBCL); - hi = IWIC_READ(sc, D_RBCH); - total_frame_len = D_RBC(hi, lo); - lo = lo & 0x3f; - - if (lo == 0) - lo = IWIC_DCHAN_FIFO_LEN; - - if (!sc->sc_dchan.ibuf) - { - dchan_get_mbuf(sc, lo); - } - else if ((sc->sc_dchan.ibuf_len + lo) > - sc->sc_dchan.ibuf_max_len) - { - panic("dchan_receive: buffer not long enough"); - } - - IWIC_RDDFIFO(sc, sc->sc_dchan.ibuf_ptr, lo); - sc->sc_dchan.ibuf_len += lo; - sc->sc_dchan.rx_count += lo; - - sc->sc_dchan.ibuf->m_len = sc->sc_dchan.ibuf_len; - - if(sc->sc_trace & TRACE_D_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IWICUNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_dchan.trace_count; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, sc->sc_dchan.ibuf->m_len, sc->sc_dchan.ibuf->m_data); - } - i4b_l1_ph_data_ind(L0IWICUNIT(sc->sc_unit), sc->sc_dchan.ibuf); - - sc->sc_dchan.ibuf = NULL; - } - } - IWIC_WRITE(sc, D_CMDR, command); -} - -/*---------------------------------------------------------------------------* - * transmit D-channel frame - *---------------------------------------------------------------------------*/ -void -iwic_dchan_transmit(struct iwic_softc *sc) -{ - int cmd; - u_char *ptr; - int len; - - if (!sc->sc_dchan.tx_ready) - return; - - if (!sc->sc_dchan.obuf) - return; - - if (sc->sc_I430state != ST_F7) - return; - - ptr = sc->sc_dchan.obuf_ptr; - len = min(sc->sc_dchan.obuf_len, IWIC_DCHAN_FIFO_LEN); - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IWICUNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_dchan.trace_count; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, len, ptr); - } - - IWIC_WRDFIFO(sc, ptr, len); - - sc->sc_dchan.tx_count += len; - - if (len < sc->sc_dchan.obuf_len) - { - sc->sc_dchan.obuf_ptr += len; - sc->sc_dchan.obuf_len -= len; - - cmd = D_CMDR_XMS; - - } - else - { - if (sc->sc_dchan.free_obuf) - i4b_Dfreembuf(sc->sc_dchan.obuf); - - sc->sc_dchan.obuf = NULL; - sc->sc_dchan.obuf_ptr = NULL; - sc->sc_dchan.obuf_len = 0; - - if (sc->sc_dchan.obuf2) - { - sc->sc_dchan.obuf = sc->sc_dchan.obuf2; - sc->sc_dchan.obuf_ptr = sc->sc_dchan.obuf->m_data; - sc->sc_dchan.obuf_len = sc->sc_dchan.obuf->m_len; - sc->sc_dchan.free_obuf = sc->sc_dchan.free_obuf2; - - sc->sc_dchan.obuf2 = NULL; - } - cmd = D_CMDR_XMS | D_CMDR_XME; - } - sc->sc_dchan.tx_ready = 0; - IWIC_WRITE(sc, D_CMDR, cmd); -} diff --git a/sys/i4b/layer1/iwic/i4b_iwic_ext.h b/sys/i4b/layer1/iwic/i4b_iwic_ext.h deleted file mode 100644 index 0b4389b5982e..000000000000 --- a/sys/i4b/layer1/iwic/i4b_iwic_ext.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iwic - isdn4bsd Winbond W6692 driver - * ---------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Jan 21 11:09:14 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IWIC_EXT_H_ -#define _I4B_IWIC_EXT_H_ - -#include - -void iwic_set_linktab(int unit, int channel, drvr_link_t * dlt); -isdn_link_t *iwic_ret_linktab(int unit, int channel); - -int iwic_ph_data_req(int unit, struct mbuf *m, int freeflag); -int iwic_ph_activate_req(int unit); -int iwic_mph_command_req(int unit, int command, void *parm); - -#endif /* _I4B_IWIC_EXT_H_ */ diff --git a/sys/i4b/layer1/iwic/i4b_iwic_fsm.c b/sys/i4b/layer1/iwic/i4b_iwic_fsm.c deleted file mode 100644 index 983535445a3c..000000000000 --- a/sys/i4b/layer1/iwic/i4b_iwic_fsm.c +++ /dev/null @@ -1,223 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Dave Boyce. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iwic - isdn4bsd Winbond W6692 driver - * ---------------------------------------- - * last edit-date: [Sun Jan 21 11:09:24 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - - -#include -#include -#include - -#include - -#include - -#include -#include - -#if DO_I4B_DEBUG -static char *state_names[] = { - "F3N", - "F3", - "F4", - "F5", - "F6", - "F7", - "F8", - "ILLEGAL", -}; - -static char *event_names[] = { - "PHAR", - "CE", - "T3", - "INFO0", - "RSY", - "INFO2", - "INFO48", - "INFO410", - "DR", - "PU", - "DIS", - "EI", - "ILLEGAL" -}; -#endif - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_NULL(struct iwic_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_NULL executing"); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_AR(struct iwic_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR executing"); - IWIC_WRITE(sc, CIX, CIX_ECK); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_AR3(struct iwic_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR3 executing"); - IWIC_WRITE(sc, CIX, CIX_AR8); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_I0I(struct iwic_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_IOI executing"); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_I0A(struct iwic_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_IOA executing"); - iwic_dchan_disable(sc); - i4b_l1_ph_deactivate_ind(L0IWICUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_AI8(struct iwic_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AI8 executing"); - iwic_dchan_transmit(sc); - i4b_l1_ph_activate_ind(L0IWICUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_AI10(struct iwic_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AI10 executing"); - iwic_dchan_transmit(sc); - i4b_l1_ph_activate_ind(L0IWICUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -struct iwic_state_tab { - void (*func) (struct iwic_softc *sc); /* function to execute */ - int newstate; /* next state */ -} iwic_state_tab[N_EVENTS][N_STATES] = { - -/* STATE: F3N F3 F4 F5 F6 F7 F8 ILLEGAL STATE */ -/* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */ -/* EV_PHAR */ {{F_AR, ST_F3 }, {F_AR3, ST_F4 }, {F_NULL, ST_F4 }, {F_NULL, ST_F5 }, {F_NULL, ST_F6 }, {F_NULL, ST_F7 }, {F_NULL, ST_F8 }, {F_NULL, ST_ILL }}, -/* EV_CE */ {{F_NULL, ST_F3 }, {F_AR3, ST_F4 }, {F_NULL, ST_F4 }, {F_NULL, ST_F4 }, {F_NULL, ST_F4 }, {F_NULL, ST_F4 }, {F_NULL, ST_F4 }, {F_NULL, ST_ILL }}, -/* EV_T3 */ {{F_NULL, ST_F3N }, {F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F7 }, {F_NULL, ST_F8 }, {F_NULL, ST_ILL }}, -/* EV_INFO0 */ {{F_I0I, ST_F3 }, {F_I0I, ST_F3 }, {F_I0I, ST_F3 }, {F_I0I, ST_F3 }, {F_I0A, ST_F3 }, {F_I0A, ST_F3 }, {F_I0A, ST_F3 }, {F_NULL, ST_ILL }}, -/* EV_RSY */ {{F_NULL, ST_F3 }, {F_NULL, ST_F5 }, {F_NULL, ST_F5 }, {F_NULL, ST_F5 }, {F_NULL, ST_F8 }, {F_NULL, ST_F8 }, {F_NULL, ST_F8 }, {F_NULL, ST_ILL }}, -/* EV_INFO2 */ {{F_NULL, ST_F6 }, {F_NULL, ST_F6 }, {F_NULL, ST_F6 }, {F_NULL, ST_F6 }, {F_NULL, ST_F6 }, {F_NULL, ST_F6 }, {F_NULL, ST_F6 }, {F_NULL, ST_ILL }}, -/* EV_INFO48 */ {{F_AI8 , ST_F7 }, {F_AI8, ST_F7 }, {F_AI8, ST_F7 }, {F_AI8, ST_F7 }, {F_AI8, ST_F7 }, {F_AI8, ST_F7 }, {F_AI8, ST_F7 }, {F_NULL, ST_ILL }}, -/* EV_INFO410*/ {{F_AI10, ST_F7 }, {F_AI10, ST_F7 }, {F_AI10, ST_F7 }, {F_AI10, ST_F7 }, {F_AI10, ST_F7 }, {F_AI10, ST_F7 }, {F_AI10, ST_F7 }, {F_NULL, ST_ILL }}, -/* EV_DR */ {{F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F4 }, {F_NULL, ST_F5 }, {F_NULL, ST_F6 }, {F_NULL, ST_F7 }, {F_NULL, ST_F8 }, {F_NULL, ST_ILL }}, -/* EV_PU */ {{F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F4 }, {F_NULL, ST_F5 }, {F_NULL, ST_F6 }, {F_NULL, ST_F7 }, {F_NULL, ST_F8 }, {F_NULL, ST_ILL }}, -/* EV_DIS */ {{F_NULL, ST_F3N }, {F_NULL, ST_F3N }, {F_NULL, ST_F3N }, {F_NULL, ST_F3N }, {F_NULL, ST_F3N }, {F_I0A, ST_F3N }, {F_I0A, ST_F3N }, {F_NULL, ST_ILL }}, -/* EV_EI */ {{F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_F3 }, {F_NULL, ST_ILL }}, -/* EV_ILL */ {{F_NULL, ST_ILL }, {F_NULL, ST_ILL }, {F_NULL, ST_ILL }, {F_NULL, ST_ILL }, {F_NULL, ST_ILL }, {F_NULL, ST_ILL }, {F_NULL, ST_ILL }, {F_NULL, ST_ILL }}, -}; - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -void -iwic_next_state(struct iwic_softc *sc, int event) -{ - int currstate, newstate; - - NDBGL1(L1_F_MSG, "event %s", event_names[event]); - - if (event >= N_EVENTS) - { - printf("iwic_next_state: event >= N_EVENTS\n"); - return; - } - - currstate = sc->sc_I430state; - - newstate = iwic_state_tab[event][currstate].newstate; - if (newstate >= N_STATES) - { - printf("iwic_next_state: newstate >= N_STATES\n"); - return; - } - - NDBGL1(L1_F_MSG, "state %s -> %s", - state_names[currstate], state_names[newstate]); - - sc->sc_I430state = newstate; - - (*iwic_state_tab[event][currstate].func) (sc); -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -iwic_printstate(struct iwic_softc *sc) -{ - return((char *)state_names[sc->sc_I430state]); -} -#endif diff --git a/sys/i4b/layer1/iwic/i4b_iwic_l1if.c b/sys/i4b/layer1/iwic/i4b_iwic_l1if.c deleted file mode 100644 index fbea743ecb99..000000000000 --- a/sys/i4b/layer1/iwic/i4b_iwic_l1if.c +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Dave Boyce. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iwic - isdn4bsd Winbond W6692 driver - * ---------------------------------------- - * last edit-date: [Sun Jan 21 11:09:33 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -/* jump table for multiplex routines */ - -struct i4b_l1mux_func iwic_l1mux_func = { - iwic_ret_linktab, - iwic_set_linktab, - iwic_mph_command_req, - iwic_ph_data_req, - iwic_ph_activate_req, -}; - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -iwic_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - struct iwic_softc *sc = iwic_find_sc(unit); - - return iwic_dchan_data_req(sc, m, freeflag); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -iwic_ph_activate_req(int unit) -{ - struct iwic_softc *sc = iwic_find_sc(unit); - - iwic_next_state(sc, EV_PHAR); - - return 0; -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -iwic_mph_command_req(int unit, int command, void *parm) -{ - struct iwic_softc *sc = iwic_find_sc(unit); - - switch (command) - { - case CMR_DOPEN: /* Daemon running */ - NDBGL1(L1_PRIM, "CMR_DOPEN"); - sc->enabled = TRUE; - break; - - case CMR_DCLOSE: /* Daemon not running */ - NDBGL1(L1_PRIM, "CMR_DCLOSE"); - sc->enabled = FALSE; - break; - - case CMR_SETTRACE: - NDBGL1(L1_PRIM, "CMR_SETTRACE, parm = %d", (unsigned int)parm); - sc->sc_trace = (unsigned int)parm; - break; - - default: - NDBGL1(L1_PRIM, "unknown command = %d", command); - break; - } - - return 0; -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -isdn_link_t * -iwic_ret_linktab(int unit, int channel) -{ - struct iwic_softc *sc = iwic_find_sc(unit); - struct iwic_bchan *bchan = &sc->sc_bchan[channel]; - - return &bchan->iwic_isdn_linktab; -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -void -iwic_set_linktab (int unit, int channel, drvr_link_t *dlt) -{ - struct iwic_softc *sc = iwic_find_sc(unit); - struct iwic_bchan *bchan = &sc->sc_bchan[channel]; - - bchan->iwic_drvr_linktab = dlt; -} diff --git a/sys/i4b/layer1/iwic/i4b_iwic_pci.c b/sys/i4b/layer1/iwic/i4b_iwic_pci.c deleted file mode 100644 index e1e2076ee0c4..000000000000 --- a/sys/i4b/layer1/iwic/i4b_iwic_pci.c +++ /dev/null @@ -1,310 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Dave Boyce. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iwic - isdn4bsd Winbond W6692 driver - * ---------------------------------------- - * last edit-date: [Tue Jan 16 10:53:03 2001] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include - -#include -#include - -extern struct i4b_l1mux_func iwic_l1mux_func; - -/* Winbond PCI Configuration Space */ - -#define BADDR0 PCIR_BAR(0) -#define BADDR1 PCIR_BAR(1) - - -static void iwic_pci_intr(struct iwic_softc *sc); -static int iwic_pci_probe(device_t dev); -static int iwic_pci_attach(device_t dev); - -static device_method_t iwic_pci_methods[] = -{ - DEVMETHOD(device_probe, iwic_pci_probe), - DEVMETHOD(device_attach, iwic_pci_attach), - { 0, 0 } -}; - -static driver_t iwic_pci_driver = -{ - "iwic", - iwic_pci_methods, - 0 -}; - -static devclass_t iwic_pci_devclass; - -DRIVER_MODULE(iwic, pci, iwic_pci_driver, iwic_pci_devclass, 0, 0); - -#define IWIC_MAXUNIT 4 - -struct iwic_softc iwic_sc[IWIC_MAXUNIT]; - -/*---------------------------------------------------------------------------* - * PCI ID list for ASUSCOM card got from Asuscom in March 2000: - * - * Vendor ID: 0675 Device ID: 1702 - * Vendor ID: 0675 Device ID: 1703 - * Vendor ID: 0675 Device ID: 1707 - * Vendor ID: 10CF Device ID: 105E - * Vendor ID: 1043 Device ID: 0675 SubVendor: 144F SubDevice ID: 2000 - * Vendor ID: 1043 Device ID: 0675 SubVendor: 144F SubDevice ID: 1702 - * Vendor ID: 1043 Device ID: 0675 SubVendor: 144F SubDevice ID: 1707 - * Vendor ID: 1043 Device ID: 0675 SubVendor: 1043 SubDevice ID: 1702 - * Vendor ID: 1043 Device ID: 0675 SubVendor: 1043 SubDevice ID: 1707 - * Vendor ID: 1050 Device ID: 6692 SubVendor: 0675 SubDevice ID: 1702 - * Vendor ID: 1043 Device ID: 0675 SubVendor: 0675 SubDevice ID: 1704 - *---------------------------------------------------------------------------*/ - -static struct winids { - u_int32_t type; - int sv; - int sd; - const char *desc; -} win_ids[] = { - { 0x66921050, -1, -1, "Generic Winbond W6692 ISDN PCI (0x66921050)" }, - { 0x06751043, 0x0675, 0x1704, "Planet PCI ISDN Adapter (IA128P-STD) ASUS-HCF675" }, - { 0x66921050, 0x144F, 0x1707, "Planet PCI ISDN Adapter (Model IA128P-STDV)" }, - { 0x17020675, -1, -1, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x17020675)" }, - { 0x17030675, -1, -1, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x17030675)" }, - { 0x17070675, -1, -1, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x17070675)" }, - { 0x105e10cf, -1, -1, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x105e10cf)" }, - { 0x06751043, 0x144F, 0x2000, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x06751043)" }, - { 0x06751043, 0x144F, 0x1702, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x06751043)" }, - { 0x06751043, 0x144F, 0x1707, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x06751043)" }, - { 0x06751043, 0x1443, 0x1702, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x06751043)" }, - { 0x06751043, 0x1443, 0x1707, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x06751043)" }, - { 0x06751043, 0x144F, 0x2000, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x06751043)" }, - { 0x06751043, 0x144F, 0x2000, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x06751043)" }, - { 0x06751043, 0x144F, 0x2000, "ASUSCOM P-IN100-ST-D (Winbond W6692, 0x06751043)" }, - { 0x00000000, 0, 0, NULL } -}; - -/*---------------------------------------------------------------------------* - * iwic PCI probe - *---------------------------------------------------------------------------*/ -static int -iwic_pci_probe(device_t dev) -{ - u_int32_t type = pci_get_devid(dev); - u_int32_t sv = pci_get_subvendor(dev); - u_int32_t sd = pci_get_subdevice(dev); - - struct winids *wip = win_ids; - - while(wip->type) - { - if(wip->type == type) - { - if(((wip->sv == -1) && (wip->sd == -1)) || - ((wip->sv == sv) && (wip->sd == sd))) - break; - } - ++wip; - } - - if(wip->desc) - { - if(bootverbose) - { - printf("iwic_pci_probe: vendor = 0x%x, device = 0x%x\n", pci_get_vendor(dev), pci_get_device(dev)); - printf("iwic_pci_probe: subvendor = 0x%x, subdevice = 0x%x\n", sv, sd); - } - device_set_desc(dev, wip->desc); - return(0); - } - else - { - return(ENXIO); - } -} - -/*---------------------------------------------------------------------------* - * PCI attach - *---------------------------------------------------------------------------*/ -static int -iwic_pci_attach(device_t dev) -{ - unsigned short iobase; - struct iwic_softc *sc; - void *ih = 0; - int unit = device_get_unit(dev); - struct iwic_bchan *bchan; - - /* check max unit range */ - - if(unit >= IWIC_MAXUNIT) - { - printf("iwic%d: Error, unit %d >= IWIC_MAXUNIT!\n", unit, unit); - return(ENXIO); - } - - sc = iwic_find_sc(unit); /* get softc */ - - sc->sc_unit = unit; - - /* use the i/o mapped base address */ - - sc->sc_resources.io_rid[0] = BADDR1; - - if(!(sc->sc_resources.io_base[0] = - bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->sc_resources.io_rid[0], - RF_ACTIVE))) - { - printf("iwic%d: Couldn't alloc io port!\n", unit); - return(ENXIO); - } - - iobase = rman_get_start(sc->sc_resources.io_base[0]); - - if(!(sc->sc_resources.irq = - bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_resources.irq_rid, - RF_SHAREABLE|RF_ACTIVE))) - { - printf("iwic%d: Couldn't alloc irq!\n",unit); - return(ENXIO); - } - - /* setup card type */ - - sc->sc_cardtyp = CARD_TYPEP_WINB6692; - sc->sc_iobase = (u_int32_t) iobase; - sc->sc_trace = TRACE_OFF; - sc->sc_I430state = ST_F3N; /* Deactivated */ - sc->enabled = FALSE; - - if(bus_setup_intr(dev, sc->sc_resources.irq, INTR_TYPE_NET, - NULL, (void(*)(void*))iwic_pci_intr, - sc, &ih)) - { - printf("iwic%d: Couldn't set up irq!\n", unit); - return(ENXIO); - } - - /* disable interrupts */ - IWIC_WRITE(sc, IMASK, 0xff); - - iwic_dchan_init(sc); - - bchan = &sc->sc_bchan[IWIC_BCH_A]; - bchan->unit = unit; - bchan->offset = B1_CHAN_OFFSET; - bchan->channel = IWIC_BCH_A; - bchan->state = ST_IDLE; - - iwic_bchannel_setup(unit, IWIC_BCH_A, BPROT_NONE, 0); - - bchan = &sc->sc_bchan[IWIC_BCH_B]; - bchan->unit = unit; - bchan->offset = B2_CHAN_OFFSET; - bchan->channel = IWIC_BCH_B; - bchan->state = ST_IDLE; - - iwic_bchannel_setup(unit, IWIC_BCH_B, BPROT_NONE, 0); - - iwic_init_linktab(sc); - - if(bootverbose) - { - int ver = IWIC_READ(sc, D_RBCH); - printf("iwic%d: W6692 chip version = %d\n", unit, D_RBCH_VN(ver)); - } - - i4b_l1_mph_status_ind(L0IWICUNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &iwic_l1mux_func); - - IWIC_READ(sc, ISTA); - - /* Enable interrupts */ - IWIC_WRITE(sc, IMASK, IMASK_XINT0 | IMASK_XINT1); - - return(0); -} - -/*---------------------------------------------------------------------------* - * IRQ handler - *---------------------------------------------------------------------------*/ -static void -iwic_pci_intr(struct iwic_softc *sc) -{ - while (1) - { - int irq_stat = IWIC_READ(sc, ISTA); - - if (irq_stat == 0) - break; - - if (irq_stat & (ISTA_D_RME | ISTA_D_RMR | ISTA_D_XFR)) - { - iwic_dchan_xfer_irq(sc, irq_stat); - } - if (irq_stat & ISTA_D_EXI) - { - iwic_dchan_xirq(sc); - } - if (irq_stat & ISTA_B1_EXI) - { - iwic_bchan_xirq(sc, 0); - } - if (irq_stat & ISTA_B2_EXI) - { - iwic_bchan_xirq(sc, 1); - } - } -} diff --git a/sys/i4b/layer1/iwic/i4b_w6692.h b/sys/i4b/layer1/iwic/i4b_w6692.h deleted file mode 100644 index 46e21631857d..000000000000 --- a/sys/i4b/layer1/iwic/i4b_w6692.h +++ /dev/null @@ -1,263 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Dave Boyce. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iwic - isdn4bsd Winbond W6692 driver - * ---------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Jan 21 11:09:46 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_W6692_H_ -#define _I4B_W6692_H_ - -#define IWIC_BCH_A 0 /* channel A */ -#define IWIC_BCH_B 1 /* channel B */ - -/*---------------------------------------------------------------------------* - * FIFO depths - *---------------------------------------------------------------------------*/ -#define IWIC_DCHAN_FIFO_LEN 64 -#define IWIC_BCHAN_FIFO_LEN 64 - -/*---------------------------------------------------------------------------* - * D-Channel register offsets - *---------------------------------------------------------------------------*/ -#define D_RFIFO 0x00 /* D channel receive FIFO */ -#define D_XFIFO 0x04 /* D channel transmit FIFO */ -#define D_CMDR 0x08 /* D channel command register */ -#define D_MODE 0x0c /* D channel mode control */ -#define D_TIMR 0x10 /* D channel timer control */ -#define D_EXIR 0x1c /* D channel extended interrupt */ -#define D_EXIM 0x20 /* D channel extended interrupt mask */ -#define D_STAR 0x24 /* D channel status register */ -#define D_RSTA 0x28 /* D channel receive status */ -#define D_SAM 0x2c /* D channel address mask 1 */ -#define D_SAP1 0x30 /* D channel individual SAPI 1 */ -#define D_SAP2 0x34 /* D channel individual SAPI 2 */ -#define D_TAM 0x38 /* D channel address mask 2 */ -#define D_TEI1 0x3c /* D channel individual TEI 1 */ -#define D_TEI2 0x40 /* D channel individual TEI 2 */ -#define D_RBCH 0x44 /* D channel receive frame byte count high */ -#define D_RBCL 0x48 /* D channel receive frame byte count low */ -#define D_CTL 0x54 /* D channel control register */ - -/*---------------------------------------------------------------------------* - * B-channel base offsets - *---------------------------------------------------------------------------*/ -#define B1_CHAN_OFFSET 0x80 /* B1 channel offset */ -#define B2_CHAN_OFFSET 0xc0 /* B2 channel offset */ - -/*---------------------------------------------------------------------------* - * B-channel register offsets, from base - *---------------------------------------------------------------------------*/ -#define B_RFIFO 0x00 /* B channel receive FIFO */ -#define B_XFIFO 0x04 /* B channel transmit FIFO */ -#define B_CMDR 0x08 /* B channel command register */ -#define B_MODE 0x0c /* B channel mode control */ -#define B_EXIR 0x10 /* B channel extended interrupt */ -#define B_EXIM 0x14 /* B channel extended interrupt mask */ -#define B_STAR 0x18 /* B channel status register */ -#define B_ADM1 0x1c /* B channel address mask 1 */ -#define B_ADM2 0x20 /* B channel address mask 2 */ -#define B_ADR1 0x24 /* B channel address 1 */ -#define B_ADR2 0x28 /* B channel address 2 */ -#define B_RBCL 0x2c /* B channel receive frame byte count high */ -#define B_RBCH 0x30 /* B channel receive frame byte count low */ - -/*---------------------------------------------------------------------------* - * Remaining control register offsets. - *---------------------------------------------------------------------------*/ -#define ISTA 0x14 /* Interrupt status register */ -#define IMASK 0x18 /* Interrupt mask register */ -#define TIMR2 0x4c /* Timer 2 */ -#define L1_RC 0x50 /* GCI layer 1 ready code */ -#define CIR 0x58 /* Command/Indication receive */ -#define CIX 0x5c /* Command/Indication transmit */ -#define SQR 0x60 /* S/Q channel receive register */ -#define SQX 0x64 /* S/Q channel transmit register */ -#define PCTL 0x68 /* Peripheral control register */ -#define MOR 0x6c /* Monitor receive channel */ -#define MOX 0x70 /* Monitor transmit channel */ -#define MOSR 0x74 /* Monitor channel status register */ -#define MOCR 0x78 /* Monitor channel control register */ -#define GCR 0x7c /* GCI mode control register */ -#define XADDR 0xf4 /* Peripheral address register */ -#define XDATA 0xf8 /* Peripheral data register */ -#define EPCTL 0xfc /* Serial EEPROM control */ - -/*---------------------------------------------------------------------------* - * register bits - *---------------------------------------------------------------------------*/ -#define D_CMDR_RACK 0x80 -#define D_CMDR_RRST 0x40 -#define D_CMDR_STT 0x10 -#define D_CMDR_XMS 0x08 -#define D_CMDR_XME 0x02 -#define D_CMDR_XRST 0x01 - -#define D_MODE_MMS 0x80 -#define D_MODE_RACT 0x40 -#define D_MODE_TMS 0x10 -#define D_MODE_TEE 0x08 -#define D_MODE_MFD 0x04 -#define D_MODE_DLP 0x02 -#define D_MODE_RLP 0x01 - -#define D_TIMR_CNT(i) (((i) >> 5) & 0x07) -#define D_TIMR_VAL(i) ((i) & 0x1f) - -#define ISTA_D_RMR 0x80 -#define ISTA_D_RME 0x40 -#define ISTA_D_XFR 0x20 -#define ISTA_XINT1 0x10 -#define ISTA_XINT0 0x08 -#define ISTA_D_EXI 0x04 -#define ISTA_B1_EXI 0x02 -#define ISTA_B2_EXI 0x01 - -#define IMASK_D_RMR 0x80 -#define IMASK_D_RME 0x40 -#define IMASK_D_XFR 0x20 -#define IMASK_XINT1 0x10 -#define IMASK_XINT0 0x08 -#define IMASK_D_EXI 0x04 -#define IMASK_B1_EXI 0x02 -#define IMASK_B2_EXI 0x01 - -#define D_EXIR_RDOV 0x80 -#define D_EXIR_XDUN 0x40 -#define D_EXIR_XCOL 0x20 -#define D_EXIR_TIN2 0x10 -#define D_EXIR_MOC 0x08 -#define D_EXIR_ISC 0x04 -#define D_EXIR_TEXP 0x02 -#define D_EXIR_WEXP 0x01 - -#define D_EXIM_RDOV 0x80 -#define D_EXIM_XDUN 0x40 -#define D_EXIM_XCOL 0x20 -#define D_EXIM_TIM2 0x10 -#define D_EXIM_MOC 0x08 -#define D_EXIM_ISC 0x04 -#define D_EXIM_TEXP 0x02 -#define D_EXIM_WEXP 0x01 - -#define D_STAR_XDOW 0x80 -#define D_STAR_XBZ 0x20 -#define D_STAR_DRDY 0x10 - -#define D_RSTA_RDOV 0x40 -#define D_RSTA_CRCE 0x20 -#define D_RSTA_RMB 0x10 - -#define D_RBCH_VN(i) (((i) >> 6) & 0x03) -#define D_RBCH_LOV 0x20 -#define D_RBC(h,l) (((((h) & 0x1f)) << 8) + (l)) - -#define D_TIMR2_TMD 0x80 -#define D_TIMR2_TBCN(i) ((i) & 0x3f) - -#define L1_RC_RC(i) ((i) & 0x0f) - -#define D_CTL_WTT(i) (((i) > 6) & 0x03) -#define D_CTL_SRST 0x20 -#define D_CTL_TPS 0x04 -#define D_CTL_OPS(i) ((i) & 0x03) - -#define CIR_SCC 0x80 -#define CIR_ICC 0x40 -#define CIR_CODR(i) ((i) & 0x0f) - -#define CIX_ECK 0x00 -#define CIX_RST 0x01 -#define CIX_SCP 0x04 -#define CIX_SSP 0x02 -#define CIX_AR8 0x08 -#define CIX_AR10 0x09 -#define CIX_EAL 0x0a -#define CIX_DRC 0x0f - -#define CIR_CE 0x07 -#define CIR_DRD 0x00 -#define CIR_LD 0x04 -#define CIR_ARD 0x08 -#define CIR_TI 0x0a -#define CIR_ATI 0x0b -#define CIR_AI8 0x0c -#define CIR_AI10 0x0d -#define CIR_CD 0x0f - -#define SQR_XIND1 0x80 -#define SQR_XIND0 0x40 -#define SQR_MSYN 0x20 -#define SQR_SCIE 0x10 -#define SQR_S(i) ((i) & 0x0f) - -#define SQX_SCIE 0x10 -#define SQX_Q(i) ((i) & 0x0f) - - -#define B_CMDR_RACK 0x80 -#define B_CMDR_RRST 0x40 -#define B_CMDR_RACT 0x20 -#define B_CMDR_XMS 0x04 -#define B_CMDR_XME 0x02 -#define B_CMDR_XRST 0x01 - -#define B_MODE_MMS 0x80 -#define B_MODE_ITF 0x40 -#define B_MODE_EPCM 0x20 -#define B_MODE_BSW1 0x10 -#define B_MODE_BSW0 0x08 -#define B_MODE_SW56 0x04 -#define B_MODE_FTS1 0x02 -#define B_MODE_FTS0 0x01 - -#define B_EXIR_RMR 0x40 -#define B_EXIR_RME 0x20 -#define B_EXIR_RDOV 0x10 -#define B_EXIR_XFR 0x02 -#define B_EXIR_XDUN 0x01 - -#define B_EXIM_RMR 0x40 -#define B_EXIM_RME 0x20 -#define B_EXIM_RDOV 0x10 -#define B_EXIM_XFR 0x02 -#define B_EXIM_XDUN 0x01 - -#define B_STAR_RDOV 0x40 -#define B_STAR_CRCE 0x20 -#define B_STAR_RMB 0x10 -#define B_STAR_XDOW 0x04 -#define B_STAR_XBZ 0x01 - -#define B_RBC(h,l) (((((h) & 0x1f)) << 8) + (l)) - -#endif /* _I4B_W6692_H_ */ diff --git a/sys/i4b/layer2/i4b_iframe.c b/sys/i4b/layer2/i4b_iframe.c deleted file mode 100644 index a670582e4f6a..000000000000 --- a/sys/i4b/layer2/i4b_iframe.c +++ /dev/null @@ -1,270 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_iframe.c - i frame handling routines - * ------------------------------------------ - * last edit-date: [Sat Mar 9 16:07:21 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * process i frame - * implements the routine "I COMMAND" Q.921 03/93 pp 68 and pp 77 - *---------------------------------------------------------------------------*/ -void -i4b_rxd_i_frame(int unit, struct mbuf *m) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - u_char *ptr = m->m_data; - int nr; - int ns; - int p; - CRIT_VAR; - - if(!((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI))))) - { - i4b_Dfreembuf(m); - return; - } - - if((l2sc->Q921_state != ST_MULTIFR) && (l2sc->Q921_state != ST_TIMREC)) - { - i4b_Dfreembuf(m); - NDBGL2(L2_I_ERR, "ERROR, state != (MF || TR)!"); - return; - } - - CRIT_BEG; - - l2sc->stat.rx_i++; /* update frame count */ - - nr = GETINR(*(ptr + OFF_INR)); - ns = GETINS(*(ptr + OFF_INS)); - p = GETIP(*(ptr + OFF_INR)); - - i4b_rxd_ack(l2sc, nr); /* last packet ack */ - - if(l2sc->own_busy) /* own receiver busy ? */ - { - i4b_Dfreembuf(m); /* yes, discard information */ - - if(p == 1) /* P bit == 1 ? */ - { - i4b_tx_rnr_response(l2sc, p); /* yes, tx RNR */ - l2sc->ack_pend = 0; /* clear ACK pending */ - } - } - else /* own receiver ready */ - { - if(ns == l2sc->vr) /* expected sequence number ? */ - { - M128INC(l2sc->vr); /* yes, update */ - - l2sc->rej_excpt = 0; /* clr reject exception */ - - m_adj(m, I_HDR_LEN); /* strip i frame header */ - - l2sc->iframe_sent = 0; /* reset i acked already */ - - DL_Data_Ind(l2sc->unit, m); /* pass data up */ - - if(!l2sc->iframe_sent) - { - i4b_tx_rr_response(l2sc, p); /* yes, tx RR */ - l2sc->ack_pend = 0; /* clr ACK pending */ - } - } - else /* ERROR, sequence number NOT expected */ - { - i4b_Dfreembuf(m); /* discard information */ - - if(l2sc->rej_excpt == 1) /* already exception ? */ - { - if(p == 1) /* immediate response ? */ - { - i4b_tx_rr_response(l2sc, p); /* yes, tx RR */ - l2sc->ack_pend = 0; /* clr ack pend */ - } - } - else /* not in exception cond */ - { - l2sc->rej_excpt = 1; /* set exception */ - i4b_tx_rej_response(l2sc, p); /* tx REJ */ - l2sc->ack_pend = 0; /* clr ack pending */ - } - } - } - - /* sequence number ranges as expected ? */ - - if(i4b_l2_nr_ok(nr, l2sc->va, l2sc->vs)) - { - if(l2sc->Q921_state == ST_TIMREC) - { - l2sc->va = nr; - - CRIT_END; - - return; - } - - if(l2sc->peer_busy) /* yes, other side busy ? */ - { - l2sc->va = nr; /* yes, update ack count */ - } - else /* other side ready */ - { - if(nr == l2sc->vs) /* count expected ? */ - { - l2sc->va = nr; /* update ack */ - i4b_T200_stop(l2sc); - i4b_T203_restart(l2sc); - } - else - { - if(nr != l2sc->va) - { - l2sc->va = nr; - i4b_T200_restart(l2sc); - } - } - } - } - else - { - i4b_nr_error_recovery(l2sc); /* sequence error */ - l2sc->Q921_state = ST_AW_EST; - } - - CRIT_END; -} - -/*---------------------------------------------------------------------------* - * internal I FRAME QUEUED UP routine (Q.921 03/93 p 61) - *---------------------------------------------------------------------------*/ -void -i4b_i_frame_queued_up(l2_softc_t *l2sc) -{ - struct mbuf *m; - u_char *ptr; - CRIT_VAR; - - CRIT_BEG; - - if((l2sc->peer_busy) || (l2sc->vs == ((l2sc->va + MAX_K_VALUE) & 127))) - { - if(l2sc->peer_busy) - { - NDBGL2(L2_I_MSG, "regen IFQUP, cause: peer busy!"); - } - - if(l2sc->vs == ((l2sc->va + MAX_K_VALUE) & 127)) - { - NDBGL2(L2_I_MSG, "regen IFQUP, cause: vs=va+k!"); - } - - /* - * XXX see: Q.921, page 36, 5.6.1 ".. may retransmit an I - * frame ...", shall we retransmit the last i frame ? - */ - - if(!(IF_QEMPTY(&l2sc->i_queue))) - { - NDBGL2(L2_I_MSG, "re-scheduling IFQU call!"); - START_TIMER(l2sc->IFQU_callout, i4b_i_frame_queued_up, l2sc, IFQU_DLY); - } - CRIT_END; - return; - } - - IF_DEQUEUE(&l2sc->i_queue, m); /* fetch next frame to tx */ - - if(!m) - { - NDBGL2(L2_I_ERR, "ERROR, mbuf NULL after IF_DEQUEUE"); - CRIT_END; - return; - } - - ptr = m->m_data; - - PUTSAPI(SAPI_CCP, CR_CMD_TO_NT, *(ptr + OFF_SAPI)); - PUTTEI(l2sc->tei, *(ptr + OFF_TEI)); - - *(ptr + OFF_INS) = (l2sc->vs << 1) & 0xfe; /* bit 0 = 0 */ - *(ptr + OFF_INR) = (l2sc->vr << 1) & 0xfe; /* P bit = 0 */ - - l2sc->stat.tx_i++; /* update frame counter */ - - PH_Data_Req(l2sc->unit, m, MBUF_DONTFREE); /* free'd when ack'd ! */ - - l2sc->iframe_sent = 1; /* in case we ack an I frame with another I frame */ - - if(l2sc->ua_num != UA_EMPTY) /* failsafe */ - { - NDBGL2(L2_I_ERR, "ERROR, l2sc->ua_num: %d != UA_EMPTY", l2sc->ua_num); - i4b_print_l2var(l2sc); - i4b_Dfreembuf(l2sc->ua_frame); - } - - l2sc->ua_frame = m; /* save unacked frame */ - l2sc->ua_num = l2sc->vs; /* save frame number */ - - M128INC(l2sc->vs); - - l2sc->ack_pend = 0; - - CRIT_END; - - if(l2sc->T200 == TIMER_IDLE) - { - i4b_T203_stop(l2sc); - i4b_T200_start(l2sc); - } -} diff --git a/sys/i4b/layer2/i4b_l2.c b/sys/i4b/layer2/i4b_l2.c deleted file mode 100644 index f752ba6ad964..000000000000 --- a/sys/i4b/layer2/i4b_l2.c +++ /dev/null @@ -1,385 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l2.c - ISDN layer 2 (Q.921) - * ------------------------------- - * last edit-date: [Sat Mar 9 16:11:14 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include - -int i4b_dl_establish_ind(int); -int i4b_dl_establish_cnf(int); -int i4b_dl_release_ind(int); -int i4b_dl_release_cnf(int); -int i4b_dl_data_ind(int, struct mbuf *); -int i4b_dl_unit_data_ind(int, struct mbuf *); - -static int i4b_mdl_command_req(int, int, void *); - -/* from layer 2 */ - -extern int i4b_mdl_status_ind(int, int, int); - -/* this layers debug level */ - -unsigned int i4b_l2_debug = L2_DEBUG_DEFAULT; - -struct i4b_l2l3_func i4b_l2l3_func = { - - /* Layer 2 --> Layer 3 */ - - (int (*)(int)) i4b_dl_establish_ind, - (int (*)(int)) i4b_dl_establish_cnf, - (int (*)(int)) i4b_dl_release_ind, - (int (*)(int)) i4b_dl_release_cnf, - (int (*)(int, struct mbuf *)) i4b_dl_data_ind, - (int (*)(int, struct mbuf *)) i4b_dl_unit_data_ind, - - /* Layer 3 --> Layer 2 */ - - (int (*)(int)) i4b_dl_establish_req, - (int (*)(int)) i4b_dl_release_req, - (int (*)(int, struct mbuf *)) i4b_dl_data_req, - (int (*)(int, struct mbuf *)) i4b_dl_unit_data_req, - - /* Layer 2 --> Layer 3 management */ - - (int (*)(int, int, int)) i4b_mdl_status_ind, - - /* Layer 3 --> Layer 2 management */ - - (int (*)(int, int, void *)) i4b_mdl_command_req -}; - -/*---------------------------------------------------------------------------* - * DL_ESTABLISH_REQ from layer 3 - *---------------------------------------------------------------------------*/ -int i4b_dl_establish_req(int unit) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - - NDBGL2(L2_PRIM, "unit %d",unit); - i4b_l1_activate(l2sc); - i4b_next_l2state(l2sc, EV_DLESTRQ); - return(0); -} - -/*---------------------------------------------------------------------------* - * DL_RELEASE_REQ from layer 3 - *---------------------------------------------------------------------------*/ -int i4b_dl_release_req(int unit) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - - NDBGL2(L2_PRIM, "unit %d",unit); - i4b_next_l2state(l2sc, EV_DLRELRQ); - return(0); -} - -/*---------------------------------------------------------------------------* - * DL UNIT DATA REQUEST from Layer 3 - *---------------------------------------------------------------------------*/ -int i4b_dl_unit_data_req(int unit, struct mbuf *m) -{ -#ifdef NOTDEF - NDBGL2(L2_PRIM, "unit %d",unit); -#endif - return(0); -} - -/*---------------------------------------------------------------------------* - * DL DATA REQUEST from Layer 3 - *---------------------------------------------------------------------------*/ -int i4b_dl_data_req(int unit, struct mbuf *m) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - -#ifdef NOTDEF - NDBGL2(L2_PRIM, "unit %d",unit); -#endif - switch(l2sc->Q921_state) - { - case ST_AW_EST: - case ST_MULTIFR: - case ST_TIMREC: - - if(_IF_QFULL(&l2sc->i_queue)) - { - NDBGL2(L2_ERROR, "i_queue full!!"); - i4b_Dfreembuf(m); - } - else - { - CRIT_VAR; - - CRIT_BEG; - IF_ENQUEUE(&l2sc->i_queue, m); - CRIT_END; - - i4b_i_frame_queued_up(l2sc); - } - break; - - default: - NDBGL2(L2_ERROR, "unit %d ERROR in state [%s], freeing mbuf", unit, i4b_print_l2state(l2sc)); - i4b_Dfreembuf(m); - break; - } - return(0); -} - -/*---------------------------------------------------------------------------* - * i4b_ph_activate_ind - link activation indication from layer 1 - *---------------------------------------------------------------------------*/ -int -i4b_ph_activate_ind(int unit) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - - NDBGL1(L1_PRIM, "unit %d",unit); - l2sc->ph_active = PH_ACTIVE; - return(0); -} - -/*---------------------------------------------------------------------------* - * i4b_ph_deactivate_ind - link deactivation indication from layer 1 - *---------------------------------------------------------------------------*/ -int -i4b_ph_deactivate_ind(int unit) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - - NDBGL1(L1_PRIM, "unit %d",unit); - l2sc->ph_active = PH_INACTIVE; - return(0); -} - - -/*---------------------------------------------------------------------------* - * i4b_l2_unit_init - place layer 2 unit into known state - *---------------------------------------------------------------------------*/ -static void -i4b_l2_unit_init(int unit) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - CRIT_VAR; - - CRIT_BEG; - l2sc->Q921_state = ST_TEI_UNAS; - l2sc->tei_valid = TEI_INVALID; - l2sc->vr = 0; - l2sc->vs = 0; - l2sc->va = 0; - l2sc->ack_pend = 0; - l2sc->rej_excpt = 0; - l2sc->peer_busy = 0; - l2sc->own_busy = 0; - l2sc->l3initiated = 0; - - l2sc->rxd_CR = 0; - l2sc->rxd_PF = 0; - l2sc->rxd_NR = 0; - l2sc->RC = 0; - l2sc->iframe_sent = 0; - - l2sc->postfsmfunc = NULL; - - if(l2sc->ua_num != UA_EMPTY) - { - i4b_Dfreembuf(l2sc->ua_frame); - l2sc->ua_num = UA_EMPTY; - l2sc->ua_frame = NULL; - } - - i4b_T200_stop(l2sc); - i4b_T202_stop(l2sc); - i4b_T203_stop(l2sc); - - CRIT_END; -} - -/*---------------------------------------------------------------------------* - * i4b_mph_status_ind - status indication upward - *---------------------------------------------------------------------------*/ -int -i4b_mph_status_ind(int unit, int status, int parm) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - CRIT_VAR; - int sendup = 1; - - CRIT_BEG; - - NDBGL1(L1_PRIM, "unit %d, status=%d, parm=%d", unit, status, parm); - - switch(status) - { - case STI_ATTACH: - l2sc->unit = unit; - l2sc->i_queue.ifq_maxlen = IQUEUE_MAXLEN; - - if(!mtx_initialized(&l2sc->i_queue.ifq_mtx)) - mtx_init(&l2sc->i_queue.ifq_mtx, "i4b_l2sc", NULL, MTX_DEF); - - l2sc->ua_frame = NULL; - bzero(&l2sc->stat, sizeof(lapdstat_t)); - i4b_l2_unit_init(unit); - - /* initialize the callout handles for timeout routines */ - callout_handle_init(&l2sc->T200_callout); - callout_handle_init(&l2sc->T202_callout); - callout_handle_init(&l2sc->T203_callout); - callout_handle_init(&l2sc->IFQU_callout); - break; - - case STI_L1STAT: /* state of layer 1 */ - break; - - case STI_PDEACT: /* Timer 4 expired */ -/*XXX*/ if((l2sc->Q921_state >= ST_AW_EST) && - (l2sc->Q921_state <= ST_TIMREC)) - { - NDBGL2(L2_ERROR, "unit %d, persistent deactivation!", unit); - i4b_l2_unit_init(unit); - } - else - { - sendup = 0; - } - break; - - case STI_NOL1ACC: - i4b_l2_unit_init(unit); - NDBGL2(L2_ERROR, "unit %d, cannot access S0 bus!", unit); - break; - - default: - NDBGL2(L2_ERROR, "ERROR, unit %d, unknown status message!", unit); - break; - } - - if(sendup) - MDL_Status_Ind(unit, status, parm); /* send up to layer 3 */ - - CRIT_END; - - return(0); -} - -/*---------------------------------------------------------------------------* - * MDL_COMMAND_REQ from layer 3 - *---------------------------------------------------------------------------*/ -static int -i4b_mdl_command_req(int unit, int command, void * parm) -{ - NDBGL2(L2_PRIM, "unit %d, command=%d, parm=%d", unit, command, (unsigned int)parm); - - switch(command) - { - case CMR_DOPEN: - i4b_l2_unit_init(unit); - break; - } - - MPH_Command_Req(unit, command, parm); - - return(0); -} - -/*---------------------------------------------------------------------------* - * i4b_ph_data_ind - process a rx'd frame got from layer 1 - *---------------------------------------------------------------------------*/ -int -i4b_ph_data_ind(int unit, struct mbuf *m) -{ - l2_softc_t *l2sc = &l2_softc[unit]; -#ifdef NOTDEF - NDBGL1(L1_PRIM, "unit %d", unit); -#endif - u_char *ptr = m->m_data; - - if ( (*(ptr + OFF_CNTL) & 0x01) == 0 ) - { - if(m->m_len < 4) /* 6 oct - 2 chksum oct */ - { - l2sc->stat.err_rx_len++; - NDBGL2(L2_ERROR, "ERROR, I-frame < 6 octetts!"); - i4b_Dfreembuf(m); - return(0); - } - i4b_rxd_i_frame(unit, m); - } - else if ( (*(ptr + OFF_CNTL) & 0x03) == 0x01 ) - { - if(m->m_len < 4) /* 6 oct - 2 chksum oct */ - { - l2sc->stat.err_rx_len++; - NDBGL2(L2_ERROR, "ERROR, S-frame < 6 octetts!"); - i4b_Dfreembuf(m); - return(0); - } - i4b_rxd_s_frame(unit, m); - } - else if ( (*(ptr + OFF_CNTL) & 0x03) == 0x03 ) - { - if(m->m_len < 3) /* 5 oct - 2 chksum oct */ - { - l2sc->stat.err_rx_len++; - NDBGL2(L2_ERROR, "ERROR, U-frame < 5 octetts!"); - i4b_Dfreembuf(m); - return(0); - } - i4b_rxd_u_frame(unit, m); - } - else - { - l2sc->stat.err_rx_badf++; - NDBGL2(L2_ERROR, "ERROR, bad frame rx'd - "); - i4b_print_frame(m->m_len, m->m_data); - i4b_Dfreembuf(m); - } - return(0); -} diff --git a/sys/i4b/layer2/i4b_l2.h b/sys/i4b/layer2/i4b_l2.h deleted file mode 100644 index cb44c9304137..000000000000 --- a/sys/i4b/layer2/i4b_l2.h +++ /dev/null @@ -1,351 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l2.h - ISDN layer 2 (Q.921) definitions - * --------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 9 16:12:20 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L2_H_ -#define _I4B_L2_H_ - -typedef struct { - int unit; /* unit number this entry is for */ - - int Q921_state; /* state according to Q.921 */ - - u_char last_ril; /* last reference number from TEI management */ - u_char last_rih; - - int tei_valid; /* tei is valid flag */ -#define TEI_INVALID 0 -#define TEI_VALID 1 - int tei; /* tei, if tei flag valid */ - - int ph_active; /* Layer 1 active flag */ -#define PH_INACTIVE 0 /* layer 1 inactive */ -#define PH_ACTIVEPEND 1 /* already tried to activate */ -#define PH_ACTIVE 2 /* layer 1 active */ - - int T200; /* Multiframe timeout timer */ - int T201; /* min time between TEI ID check */ - int T202; /* min time between TEI ID Req messages */ - int N202; /* TEI ID Req tx counter */ - void(*T202func)(void *);/* function to be called when T202 expires */ - int T203; /* max line idle time */ - - struct callout_handle T200_callout; - struct callout_handle T202_callout; - struct callout_handle T203_callout; - struct callout_handle IFQU_callout; - -/* - * i4b_iframe.c, i4b_i_frame_queued_up(): value of IFQU_DLY - * some experimentation Gary did showed a minimal value of (hz/20) was - * possible to let this work, Gary suggested using (hz/10) but i settled - * down to using (hz/5) for now (-hm). - */ -#define IFQU_DLY (hz/5) /* reschedule I-FRAME-QUEUED-UP 0.2 sec */ - - int vr; /* receive sequence frame counter */ - int vs; /* transmit sequence frame counter */ - int va; /* acknowledge sequence frame counter */ - - int ack_pend; /* acknowledge pending */ - int rej_excpt; /* reject exception */ - int peer_busy; /* peer receiver busy */ - int own_busy; /* own receiver busy */ - int l3initiated; /* layer 3 initiated */ - - struct ifqueue i_queue; /* queue of outgoing i frames */ -#define IQUEUE_MAXLEN 20 - - /* this implementation only supports a k-value of 1 !!! */ - struct mbuf *ua_frame; /* last unacked frame */ - int ua_num; /* last unacked frame number */ -#define UA_EMPTY (-1) /* ua_frame is unused */ - - int rxd_CR; /* received Command Response bit */ - int rxd_PF; /* received Poll/Final bit */ - int rxd_NR; /* received N(R) field */ - int RC; /* Retry Counter */ - - int iframe_sent; /* check if i frame acked by another i frame */ - - int (*postfsmfunc)(int);/* function to be called at fsm exit */ - int postfsmarg; /* argument for above function */ - - /* statistics */ - - lapdstat_t stat; /* lapd protocol statistics */ - -} l2_softc_t; - -extern l2_softc_t l2_softc[]; - -/* Q.912 system parameters (Q.921 03/93 pp 43) */ - -#define MAX_K_VALUE 1 /* BRI - # of outstanding frames */ - -#define N200 3 /* max no of retransmissions */ -#define N201DEF 260 /* max no of octetts in information field */ -#define N202DEF 3 /* max no of TEI ID Request message transmissions */ - -#define T200DEF (hz*1) /* default T200 timer value = 1 second */ -#define T201DEF T200DEF /* default T201 timer value = T200DEF */ -#define T202DEF (hz*2) /* default T202 timer value = 2 seconds */ -#define T203DEF (hz*10) /* default T203 timer value = 10 seconds*/ - -/* modulo 128 operations */ - -#define M128INC(v) (v)++; \ - if((v)>127) \ - { \ - v = 0; \ - } - -#define M128DEC(v) (v)--; \ - if((v)<0) \ - { \ - v = 127;\ - } - -/* P-bit values */ - -typedef enum { - P0, - P1 -} pbit_t; - -/* F-bit values */ - -typedef enum { - F0, - F1 -} fbit_t; - -/* CR-bit values to NT */ - -typedef enum { - CR_CMD_TO_NT, - CR_RSP_TO_NT -} crbit_to_nt_t; - -/* CR-bit values from NT */ - -typedef enum { - CR_RSP_FROM_NT, - CR_CMD_FROM_NT -} crbit_from_nt_t; - -/* address field - octett 2 */ - -#define OFF_SAPI 0 /* SAPI offset, HDLC flag is eaten by L1 */ -#define SAPI_CCP 0 /* SAPI = 0 - call control procedures */ -#define SAPI_X25 16 /* SAPI = 16 - X.25 packet procedures */ -#define SAPI_L2M 63 /* SAPI = 63 - Layer 2 management procedures */ - -/* extract and insert macros for SAPI octett */ - -#define GETSAPI(octett) (((octett) >> 2) & 0x3f) -#define PUTSAPI(sapi,cr,octett) ((octett) = (((sapi << 2) & 0xfc) | ((cr & 0x01) << 1))) -#define GETCR(octett) (((octett) >> 1) & 0x01) -#define GETEA(octett) ((octett) & 0x01) - -/* address field - octett 3 */ - -#define OFF_TEI 1 /* TEI offset */ -#define GETTEI(octett) (((octett) >> 1) & 0x7f) -#define PUTTEI(tei, octett) ((octett) = ((((tei) << 1) & 0xfe)) | 0x01) -#define GROUP_TEI 127 /* broadcast TEI for LME */ - -/* control field - octett 4 */ - -#define OFF_CNTL 2 /* 1st byte of control field */ - -/* S frames */ - -#define S_FRAME_LEN 4 /* lenght of a U-frame */ -#define OFF_SRCR 2 /* 1st byte of control field, */ - /* R-commands and R-responses */ -#define OFF_SNR 3 /* 2nd byte of control field, N(R) and PF */ -#define SPFBIT 0x01 /* poll/final bit mask */ -#define SPBITSET SPFBIT -#define SFBITSET SPFBIT -#define GETSNR(octett) (((octett) >> 1) & 0x7f) -#define GETSPF(octett) ((octett) & SPFBIT) -#define RR 0x01 /* RR and bit 0 set */ -#define RNR 0x05 /* RNR and bit 0 set */ -#define REJ 0x09 /* REJ and bit 0 set */ - -/* U frames */ - -#define UI_HDR_LEN 3 /* length of UI header in front of L3 frame */ -#define U_FRAME_LEN 3 /* lenght of a U-frame */ -#define UPFBIT 0x10 /* poll/final bit mask */ -#define UPBITSET UPFBIT -#define UFBITSET UPFBIT -#define GETUPF(octett) (((octett) >> 4) & 0x01) - -/* commands/responses with pf bit set to 0 */ - -#define SABME 0x6f -#define DM 0x0f -#define UI 0x03 -#define DISC 0x43 -#define UA 0x63 -#define FRMR 0x87 -#define XID 0xaf - -/* control field - octett 3 */ - -#define OFF_MEI 3 /* 2nd byte of control field */ - -/* control field - octett 4,5 */ - -#define OFF_RIL 4 /* Ri low byte */ -#define OFF_RIH 5 /* Ri high byte */ - -/* control field - octett 6 */ - -#define OFF_MT 6 /* Message Type */ -#define OFF_AI 7 /* Action Indicator */ -#define GET_TEIFROMAI(octett) (((octett) >> 1) & 0x7f) - -/* I frame */ - -#define I_HDR_LEN 4 /* length of I header in front of L3 frame */ -#define OFF_INS 2 /* transmit sequence number */ -#define OFF_INR 3 /* receive sequence number */ -#define IPFBIT 0x01 /* poll/final bit mask */ -#define IPBITSET 0x01 -#define GETINR(octett) (((octett) >> 1) & 0x7f) -#define GETINS(octett) (((octett) >> 1) & 0x7f) -#define GETIP(octett) ((octett) & IPFBIT) - -/* structure of a TEI management frame */ - -#define TEI_MGMT_FRM_LEN 8 /* frame length */ -#define TEIM_SAPIO 0x00 /* SAPI, CR, EA */ -#define TEIM_TEIO 0x01 /* TEI, EA */ -#define TEIM_UIO 0x02 /* frame type = UI = 0x03 */ -#define TEIM_MEIO 0x03 /* management entity id = 0x0f */ -#define MEI 0x0f -#define TEIM_RILO 0x04 /* reference number, low */ -#define TEIM_RIHO 0x05 /* reference number, high */ -#define TEIM_MTO 0x06 /* message type */ -#define MT_ID_REQEST 0x01 -#define MT_ID_ASSIGN 0x02 -#define MT_ID_DENY 0x03 -#define MT_ID_CHK_REQ 0x04 -#define MT_ID_CHK_RSP 0x05 -#define MT_ID_REMOVE 0x06 -#define MT_ID_VERIFY 0x07 -#define TEIM_AIO 0x07 /* action indicator */ - -/* i4b_mdl_error_ind codes */ - -enum MDL_ERROR_CODES { - MDL_ERR_A, - MDL_ERR_B, - MDL_ERR_C, - MDL_ERR_D, - MDL_ERR_E, - MDL_ERR_F, - MDL_ERR_G, - MDL_ERR_H, - MDL_ERR_I, - MDL_ERR_J, - MDL_ERR_K, - MDL_ERR_L, - MDL_ERR_M, - MDL_ERR_N, - MDL_ERR_O, - MDL_ERR_MAX -}; - -/* forward decl */ - -extern void i4b_acknowledge_pending ( l2_softc_t *l2sc ); -extern struct mbuf * i4b_build_s_frame ( l2_softc_t *l2sc, crbit_to_nt_t crbit, pbit_t pbit, u_char type ); -extern struct mbuf * i4b_build_u_frame ( l2_softc_t *l2sc, crbit_to_nt_t crbit, pbit_t pbit, u_char type ); -extern void i4b_clear_exception_conditions ( l2_softc_t *l2sc ); -extern int i4b_dl_data_req ( int unit, struct mbuf *m ); -extern int i4b_dl_establish_req ( int unit ); -extern int i4b_dl_release_req ( int unit ); -extern int i4b_dl_unit_data_req ( int unit, struct mbuf *m ); -extern void i4b_enquiry_response ( l2_softc_t *l2sc ); -extern void i4b_establish_data_link ( l2_softc_t *l2sc ); -extern void i4b_invoke_retransmission ( l2_softc_t *l2sc, int nr ); -extern void i4b_i_frame_queued_up ( l2_softc_t *l2sc ); -extern void i4b_l1_activate ( l2_softc_t *l2sc ); -extern int i4b_l2_nr_ok ( int nr, int va, int vs ); -extern void i4b_make_rand_ri ( l2_softc_t *l2sc ); -extern void i4b_mdl_assign_ind ( l2_softc_t *l2sc ); -extern void i4b_mdl_error_ind ( l2_softc_t *l2sc, char *where, int errorcode ); -extern int i4b_mph_status_ind ( int unit, int status, int parm ); -extern void i4b_next_l2state ( l2_softc_t *l2sc, int event ); -extern void i4b_nr_error_recovery ( l2_softc_t *l2sc ); -extern int i4b_ph_activate_ind ( int unit ); -extern int i4b_ph_deactivate_ind ( int unit ); -extern int i4b_ph_data_ind ( int unit, struct mbuf *m ); -extern void i4b_print_frame ( int len, u_char *buf ); -extern char *i4b_print_l2state ( l2_softc_t *l2sc ); -extern void i4b_print_l2var ( l2_softc_t *l2sc ); -extern void i4b_rxd_ack(l2_softc_t *l2sc, int nr); -extern void i4b_rxd_i_frame ( int unit, struct mbuf *m ); -extern void i4b_rxd_s_frame ( int unit, struct mbuf *m ); -extern void i4b_rxd_u_frame ( int unit, struct mbuf *m ); -extern void i4b_T200_restart ( l2_softc_t *l2sc ); -extern void i4b_T200_start ( l2_softc_t *l2sc ); -extern void i4b_T200_stop ( l2_softc_t *l2sc ); -extern void i4b_T202_start ( l2_softc_t *l2sc ); -extern void i4b_T202_stop ( l2_softc_t *l2sc ); -extern void i4b_T203_restart ( l2_softc_t *l2sc ); -extern void i4b_T203_start ( l2_softc_t *l2sc ); -extern void i4b_T203_stop ( l2_softc_t *l2sc ); -extern void i4b_tei_assign ( l2_softc_t *l2sc ); -extern void i4b_tei_chkresp ( l2_softc_t *l2sc ); -extern void i4b_tei_rxframe ( int unit, struct mbuf *m ); -extern void i4b_tei_verify ( l2_softc_t *l2sc ); -extern void i4b_transmit_enquire ( l2_softc_t *l2sc ); -extern void i4b_tx_disc ( l2_softc_t *l2sc, pbit_t pbit ); -extern void i4b_tx_dm ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_frmr ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_rej_response ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_rnr_command ( l2_softc_t *l2sc, pbit_t pbit ); -extern void i4b_tx_rnr_response ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_rr_command ( l2_softc_t *l2sc, pbit_t pbit ); -extern void i4b_tx_rr_response ( l2_softc_t *l2sc, fbit_t fbit ); -extern void i4b_tx_sabme ( l2_softc_t *l2sc, pbit_t pbit ); -extern void i4b_tx_ua ( l2_softc_t *l2sc, fbit_t fbit ); - -#endif /* _I4B_L2_H_ */ diff --git a/sys/i4b/layer2/i4b_l2fsm.c b/sys/i4b/layer2/i4b_l2fsm.c deleted file mode 100644 index 8e2721b5ada4..000000000000 --- a/sys/i4b/layer2/i4b_l2fsm.c +++ /dev/null @@ -1,1578 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l2fsm.c - layer 2 FSM - * ------------------------- - * last edit-date: [Sat Mar 9 16:14:07 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -l2_softc_t l2_softc[MAXL1UNITS]; - -#if DO_I4B_DEBUG -static char *l2state_text[N_STATES] = { - "ST_TEI_UNAS", - "ST_ASG_AW_TEI", - "ST_EST_AW_TEI", - "ST_TEI_ASGD", - - "ST_AW_EST", - "ST_AW_REL", - "ST_MULTIFR", - "ST_TIMREC", - - "ST_SUBSET", - "Illegal State" -}; - -static char *l2event_text[N_EVENTS] = { - "EV_DLESTRQ", - "EV_DLUDTRQ", - "EV_MDASGRQ", - "EV_MDERRRS", - "EV_PSDEACT", - "EV_MDREMRQ", - "EV_RXSABME", - "EV_RXDISC", - "EV_RXUA", - "EV_RXDM", - "EV_T200EXP", - "EV_DLDATRQ", - "EV_DLRELRQ", - "EV_T203EXP", - "EV_OWNBUSY", - "EV_OWNRDY", - "EV_RXRR", - "EV_RXREJ", - "EV_RXRNR", - "EV_RXFRMR", - "Illegal Event" -}; -#endif - -static void F_TU01(l2_softc_t *); -static void F_TU03(l2_softc_t *); - -static void F_TA03(l2_softc_t *); -static void F_TA04(l2_softc_t *); -static void F_TA05(l2_softc_t *); - -static void F_TE03(l2_softc_t *); -static void F_TE04(l2_softc_t *); -static void F_TE05(l2_softc_t *); - -static void F_T01(l2_softc_t *); -static void F_T05(l2_softc_t *); -static void F_T06(l2_softc_t *); -static void F_T07(l2_softc_t *); -static void F_T08(l2_softc_t *); -static void F_T09(l2_softc_t *); -static void F_T10(l2_softc_t *); -static void F_T13(l2_softc_t *); - -static void F_AE01(l2_softc_t *); -static void F_AE05(l2_softc_t *); -static void F_AE06(l2_softc_t *); -static void F_AE07(l2_softc_t *); -static void F_AE08(l2_softc_t *); -static void F_AE09(l2_softc_t *); -static void F_AE10(l2_softc_t *); -static void F_AE11(l2_softc_t *); -static void F_AE12(l2_softc_t *); - -static void F_AR05(l2_softc_t *); -static void F_AR06(l2_softc_t *); -static void F_AR07(l2_softc_t *); -static void F_AR08(l2_softc_t *); -static void F_AR09(l2_softc_t *); -static void F_AR10(l2_softc_t *); -static void F_AR11(l2_softc_t *); - -static void F_MF01(l2_softc_t *); -static void F_MF05(l2_softc_t *); -static void F_MF06(l2_softc_t *); -static void F_MF07(l2_softc_t *); -static void F_MF08(l2_softc_t *); -static void F_MF09(l2_softc_t *); -static void F_MF10(l2_softc_t *); -static void F_MF11(l2_softc_t *); -static void F_MF12(l2_softc_t *); -static void F_MF13(l2_softc_t *); -static void F_MF14(l2_softc_t *); -static void F_MF15(l2_softc_t *); -static void F_MF16(l2_softc_t *); -static void F_MF17(l2_softc_t *); -static void F_MF18(l2_softc_t *); -static void F_MF19(l2_softc_t *); -static void F_MF20(l2_softc_t *); - -static void F_TR01(l2_softc_t *); -static void F_TR05(l2_softc_t *); -static void F_TR06(l2_softc_t *); -static void F_TR07(l2_softc_t *); -static void F_TR08(l2_softc_t *); -static void F_TR09(l2_softc_t *); -static void F_TR10(l2_softc_t *); -static void F_TR11(l2_softc_t *); -static void F_TR12(l2_softc_t *); -static void F_TR13(l2_softc_t *); -static void F_TR15(l2_softc_t *); -static void F_TR16(l2_softc_t *); -static void F_TR17(l2_softc_t *); -static void F_TR18(l2_softc_t *); -static void F_TR19(l2_softc_t *); -static void F_TR20(l2_softc_t *); -static void F_ILL(l2_softc_t *); -static void F_NCNA(l2_softc_t *); - -/*---------------------------------------------------------------------------* - * FSM illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ILL(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_ERR, "FSM function F_ILL executing"); -} - -/*---------------------------------------------------------------------------* - * FSM No change, No action - *---------------------------------------------------------------------------*/ -static void -F_NCNA(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_NCNA executing"); -} - -/*---------------------------------------------------------------------------* - * layer 2 state transition table - *---------------------------------------------------------------------------*/ -struct l2state_tab { - void (*func)(l2_softc_t *); /* function to execute */ - int newstate; /* next state */ -} l2state_tab[N_EVENTS][N_STATES] = { - -/* STATE: ST_TEI_UNAS, ST_ASG_AW_TEI, ST_EST_AW_TEI, ST_TEI_ASGD, ST_AW_EST, ST_AW_REL, ST_MULTIFR, ST_TIMREC, ST_SUBSET, ILLEGAL STATE */ -/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_DLESTRQ*/{ {F_TU01, ST_EST_AW_TEI}, {F_NCNA, ST_EST_AW_TEI}, {F_ILL, ST_ILL}, {F_T01, ST_AW_EST}, {F_AE01, ST_AW_EST}, {F_ILL, ST_ILL}, {F_MF01, ST_AW_EST}, {F_TR01, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_DLUDTRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_MDASGRQ*/{ {F_TU03, ST_TEI_ASGD}, {F_TA03, ST_TEI_ASGD}, {F_TE03, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_MDERRRS*/{ {F_ILL, ST_ILL}, {F_TA04, ST_TEI_UNAS}, {F_TE04, ST_TEI_UNAS}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_PSDEACT*/{ {F_ILL, ST_ILL}, {F_TA05, ST_TEI_UNAS}, {F_TE05, ST_TEI_UNAS}, {F_T05, ST_TEI_ASGD}, {F_AE05, ST_TEI_ASGD}, {F_AR05, ST_TEI_ASGD}, {F_MF05, ST_TEI_ASGD}, {F_TR05, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_MDREMRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T06, ST_TEI_UNAS}, {F_AE06, ST_TEI_UNAS}, {F_AR06, ST_TEI_UNAS}, {F_MF06, ST_TEI_UNAS}, {F_TR06, ST_TEI_UNAS}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXSABME*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T07, ST_SUBSET}, {F_AE07, ST_AW_EST}, {F_AR07, ST_AW_REL}, {F_MF07, ST_MULTIFR}, {F_TR07, ST_MULTIFR}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXDISC */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T08, ST_TEI_ASGD}, {F_AE08, ST_AW_EST}, {F_AR08, ST_AW_REL}, {F_MF08, ST_TEI_ASGD}, {F_TR08, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXUA */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T09, ST_TEI_ASGD}, {F_AE09, ST_SUBSET}, {F_AR09, ST_SUBSET}, {F_MF09, ST_MULTIFR}, {F_TR09, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXDM */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T10, ST_SUBSET}, {F_AE10, ST_SUBSET}, {F_AR10, ST_SUBSET}, {F_MF10, ST_SUBSET}, {F_TR10, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_T200EXP*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_AE11, ST_SUBSET}, {F_AR11, ST_SUBSET}, {F_MF11, ST_TIMREC}, {F_TR11, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_DLDATRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_AE12, ST_AW_EST}, {F_ILL, ST_ILL}, {F_MF12, ST_MULTIFR}, {F_TR12, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_DLRELRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T13, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF13, ST_AW_REL}, {F_TR13, ST_AW_REL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_T203EXP*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF14, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_OWNBUSY*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF15, ST_MULTIFR}, {F_TR15, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_OWNRDY */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF16, ST_MULTIFR}, {F_TR16, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXRR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF17, ST_SUBSET}, {F_TR17, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXREJ */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF18, ST_SUBSET}, {F_TR18, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXRNR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF19, ST_SUBSET}, {F_TR19, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_RXFRMR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF20, ST_AW_EST}, {F_TR20, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }, -/*EV_ILL */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} } -}; - -/*---------------------------------------------------------------------------* - * event handler, executes function and sets new state - *---------------------------------------------------------------------------*/ -void i4b_next_l2state(l2_softc_t *l2sc, int event) -{ - int currstate, newstate; - int (*savpostfsmfunc)(int) = NULL; - - /* check event number */ - if(event >= N_EVENTS) - panic("i4b_l2fsm.c: event >= N_EVENTS\n"); - - /* get current state and check it */ - if((currstate = l2sc->Q921_state) >= N_STATES) /* failsafe */ - panic("i4b_l2fsm.c: currstate >= N_STATES\n"); - - /* get new state and check it */ - if((newstate = l2state_tab[event][currstate].newstate) >= N_STATES) - panic("i4b_l2fsm.c: newstate >= N_STATES\n"); - - - if(newstate != ST_SUBSET) - { /* state function does NOT set new state */ - NDBGL2(L2_F_MSG, "FSM event [%s]: [%s/%d => %s/%d]", - l2event_text[event], - l2state_text[currstate], currstate, - l2state_text[newstate], newstate); - } - - /* execute state transition function */ - (*l2state_tab[event][currstate].func)(l2sc); - - if(newstate == ST_SUBSET) - { /* state function DOES set new state */ - NDBGL2(L2_F_MSG, "FSM S-event [%s]: [%s => %s]", l2event_text[event], - l2state_text[currstate], - l2state_text[l2sc->Q921_state]); - } - - /* check for illegal new state */ - - if(newstate == ST_ILL) - { - newstate = currstate; - NDBGL2(L2_F_ERR, "FSM illegal state, state = %s, event = %s!", - l2state_text[currstate], - l2event_text[event]); - } - - /* check if state machine function has to set new state */ - - if(newstate != ST_SUBSET) - l2sc->Q921_state = newstate; /* no, we set new state */ - - if(l2sc->postfsmfunc != NULL) - { - NDBGL2(L2_F_MSG, "FSM executing postfsmfunc!"); - /* try to avoid an endless loop */ - savpostfsmfunc = l2sc->postfsmfunc; - l2sc->postfsmfunc = NULL; - (*savpostfsmfunc)(l2sc->postfsmarg); - } -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char *i4b_print_l2state(l2_softc_t *l2sc) -{ - return((char *) l2state_text[l2sc->Q921_state]); -} -#endif - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_UNAS event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_TU01(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TU01 executing"); - i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_UNAS event mdl assign request - *---------------------------------------------------------------------------*/ -static void -F_TU03(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TU03 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_ASG_AW_TEI event mdl assign request - *---------------------------------------------------------------------------*/ -static void -F_TA03(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TA03 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_ASG_AW_TEI event mdl error response - *---------------------------------------------------------------------------*/ -static void -F_TA04(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TA04 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_ASG_AW_TEI event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_TA05(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TA05 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_EST_AW_TEI event mdl assign request - *---------------------------------------------------------------------------*/ -static void -F_TE03(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TE03 executing"); - i4b_establish_data_link(l2sc); - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_EST_AW_TEI event mdl error response - *---------------------------------------------------------------------------*/ -static void -F_TE04(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TE04 executing"); - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_EST_AW_TEI event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_TE05(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TE05 executing"); - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_T01(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_T01 executing"); - i4b_establish_data_link(l2sc); - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_T05(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_T05 executing"); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_T06(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_T06 executing"); -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_T07(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_T07 executing"); - -/* XXX */ -#ifdef NOTDEF - if(NOT able to establish) - { - i4b_tx_dm(l2sc, l2sc->rxd_PF); - l2sc->Q921_state = ST_TEI_ASGD; - return; - } -#endif - - i4b_clear_exception_conditions(l2sc); - - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE); - - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - l2sc->vs = 0; - l2sc->va = 0; - l2sc->vr = 0; - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Est_Ind_A; - - i4b_T203_start(l2sc); - - l2sc->Q921_state = ST_MULTIFR; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_T08(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_T08 executing"); - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_T09(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_T09 executing"); - i4b_mdl_error_ind(l2sc, "F_T09", MDL_ERR_C); - i4b_mdl_error_ind(l2sc, "F_T09", MDL_ERR_D); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_T10(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_T10 executing"); - - if(l2sc->rxd_PF) - { - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { -#ifdef NOTDEF - if(NOT able_to_etablish) - { - l2sc->Q921_state = ST_TEI_ASGD; - return; - } -#endif - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 1; - - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TEI_ASGD event dl release request - *---------------------------------------------------------------------------*/ -static void -F_T13(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_T13 executing"); - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Cnf_A; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_AE01(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE01 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_AE05(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE05 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_AE06(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE06 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); - -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_AE07(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE07 executing"); - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_AE08(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE08 executing"); - i4b_tx_dm(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_AE09(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE09 executing"); - - if(l2sc->rxd_PF == 0) - { - i4b_mdl_error_ind(l2sc, "F_AE09", MDL_ERR_D); - l2sc->Q921_state = ST_AW_EST; - } - else - { - if(l2sc->l3initiated) - { - l2sc->l3initiated = 0; - l2sc->vr = 0; - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Est_Cnf_A; - } - else - { - if(l2sc->vs != l2sc->va) - { - i4b_Dcleanifq(&l2sc->i_queue); - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Est_Ind_A; - } - } - - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE); - - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - - l2sc->vs = 0; - l2sc->va = 0; - - l2sc->Q921_state = ST_MULTIFR; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_AE10(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE10 executing"); - - if(l2sc->rxd_PF == 0) - { - l2sc->Q921_state = ST_AW_EST; - } - else - { - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); - - l2sc->Q921_state = ST_TEI_ASGD; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event T200 expiry - *---------------------------------------------------------------------------*/ -static void -F_AE11(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE11 executing"); - - if(l2sc->RC >= N200) - { - i4b_Dcleanifq(&l2sc->i_queue); - - i4b_mdl_error_ind(l2sc, "F_AE11", MDL_ERR_G); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { - l2sc->RC++; - - i4b_tx_sabme(l2sc, P1); - - i4b_T200_start(l2sc); - - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_EST event dl data request - *---------------------------------------------------------------------------*/ -static void -F_AE12(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AE12 executing"); - - if(l2sc->l3initiated == 0) - { - i4b_i_frame_queued_up(l2sc); - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_AR05(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR05 executing"); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Cnf_A; - - i4b_T200_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_AR06(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR06 executing"); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Cnf_A; - - i4b_T200_stop(l2sc); - -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_AR07(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR07 executing"); - i4b_tx_dm(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_AR08(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR08 executing"); - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_AR09(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR09 executing"); - - if(l2sc->rxd_PF) - { - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Cnf_A; - - i4b_T200_stop(l2sc); - - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { - i4b_mdl_error_ind(l2sc, "F_AR09", MDL_ERR_D); - - l2sc->Q921_state = ST_AW_REL; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_AR10(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR10 executing"); - - if(l2sc->rxd_PF) - { - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Cnf_A; - - i4b_T200_stop(l2sc); - - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { - l2sc->Q921_state = ST_AW_REL; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_AW_REL event T200 expiry - *---------------------------------------------------------------------------*/ -static void -F_AR11(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_AR11 executing"); - - if(l2sc->RC >= N200) - { - i4b_mdl_error_ind(l2sc, "F_AR11", MDL_ERR_H); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Cnf_A; - - l2sc->Q921_state = ST_TEI_ASGD; - } - else - { - l2sc->RC++; - - i4b_tx_disc(l2sc, P1); - - i4b_T200_start(l2sc); - - l2sc->Q921_state = ST_AW_REL; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_MF01(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF01 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_MF05(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF05 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); - i4b_T203_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_MF06(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF06 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); - i4b_T203_stop(l2sc); - -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_MF07(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF07 executing"); - - i4b_clear_exception_conditions(l2sc); - - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE); - - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - i4b_mdl_error_ind(l2sc, "F_MF07", MDL_ERR_F); - - if(l2sc->vs != l2sc->va) - { - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Est_Ind_A; - } - - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - - l2sc->vs = 0; - l2sc->va = 0; - l2sc->vr = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_MF08(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF08 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); - i4b_T203_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_MF09(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF09 executing"); - if(l2sc->rxd_PF) - i4b_mdl_error_ind(l2sc, "F_MF09", MDL_ERR_C); - else - i4b_mdl_error_ind(l2sc, "F_MF09", MDL_ERR_D); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_MF10(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF10 executing"); - - if(l2sc->rxd_PF) - { - i4b_mdl_error_ind(l2sc, "F_MF10", MDL_ERR_B); - - l2sc->Q921_state = ST_MULTIFR; - } - else - { - i4b_mdl_error_ind(l2sc, "F_MF10", MDL_ERR_E); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; - - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event T200 expiry - *---------------------------------------------------------------------------*/ -static void -F_MF11(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF11 executing"); - - l2sc->RC = 0; - - i4b_transmit_enquire(l2sc); - - l2sc->RC++; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event dl data request - *---------------------------------------------------------------------------*/ -static void -F_MF12(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF12 executing"); - - i4b_i_frame_queued_up(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event dl release request - *---------------------------------------------------------------------------*/ -static void -F_MF13(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF13 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->RC = 0; - - i4b_tx_disc(l2sc, P1); - - i4b_T203_stop(l2sc); - i4b_T200_restart(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event T203 expiry - *---------------------------------------------------------------------------*/ -static void -F_MF14(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF14 executing"); - - i4b_transmit_enquire(l2sc); - - l2sc->RC = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event set own rx busy - *---------------------------------------------------------------------------*/ -static void -F_MF15(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF15 executing"); - - if(l2sc->own_busy == 0) - { - l2sc->own_busy = 1; - - i4b_tx_rnr_response(l2sc, F0); /* wrong in Q.921 03/93 p 64 */ - - l2sc->ack_pend = 0; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event clear own rx busy - *---------------------------------------------------------------------------*/ -static void -F_MF16(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF16 executing"); - - if(l2sc->own_busy != 0) - { - l2sc->own_busy = 0; - - i4b_tx_rr_response(l2sc, F0); /* wrong in Q.921 03/93 p 64 */ - - l2sc->ack_pend = 0; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd RR - *---------------------------------------------------------------------------*/ -static void -F_MF17(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF17 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - i4b_mdl_error_ind(l2sc, "F_MF17", MDL_ERR_A); - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - if(l2sc->rxd_NR == l2sc->vs) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_stop(l2sc); - i4b_T203_restart(l2sc); - } - else if(l2sc->rxd_NR != l2sc->va) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_restart(l2sc); - } - l2sc->Q921_state = ST_MULTIFR; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd REJ - *---------------------------------------------------------------------------*/ -static void -F_MF18(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF18 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - i4b_mdl_error_ind(l2sc, "F_MF18", MDL_ERR_A); - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - i4b_invoke_retransmission(l2sc, l2sc->rxd_NR); - l2sc->Q921_state = ST_MULTIFR; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd RNR - *---------------------------------------------------------------------------*/ -static void -F_MF19(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF19 executing"); - - l2sc->peer_busy = 1; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - i4b_mdl_error_ind(l2sc, "F_MF19", MDL_ERR_A); - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T203_stop(l2sc); - i4b_T200_restart(l2sc); - l2sc->Q921_state = ST_MULTIFR; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_MULTIFR event rx'd FRMR - *---------------------------------------------------------------------------*/ -static void -F_MF20(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_MF20 executing"); - - i4b_mdl_error_ind(l2sc, "F_MF20", MDL_ERR_K); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event dl establish request - *---------------------------------------------------------------------------*/ -static void -F_TR01(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR01 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 1; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event persistent deactivation - *---------------------------------------------------------------------------*/ -static void -F_TR05(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR05 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event mdl remove request - *---------------------------------------------------------------------------*/ -static void -F_TR06(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR06 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); - -/*XXX*/ i4b_mdl_assign_ind(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd SABME - *---------------------------------------------------------------------------*/ -static void -F_TR07(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR07 executing"); - - i4b_clear_exception_conditions(l2sc); - - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE); - - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - i4b_mdl_error_ind(l2sc, "F_TR07", MDL_ERR_F); - - if(l2sc->vs != l2sc->va) - { - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Est_Ind_A; - } - - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - - l2sc->vs = 0; - l2sc->va = 0; - l2sc->vr = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd DISC - *---------------------------------------------------------------------------*/ -static void -F_TR08(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR08 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE); - i4b_tx_ua(l2sc, l2sc->rxd_PF); - - l2sc->postfsmarg = l2sc->unit; - l2sc->postfsmfunc = DL_Rel_Ind_A; - - i4b_T200_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd UA - *---------------------------------------------------------------------------*/ -static void -F_TR09(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR09 executing"); - if(l2sc->rxd_PF) - i4b_mdl_error_ind(l2sc, "F_TR09", MDL_ERR_C); - else - i4b_mdl_error_ind(l2sc, "F_TR09", MDL_ERR_D); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd DM - *---------------------------------------------------------------------------*/ -static void -F_TR10(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR10 executing"); - - if(l2sc->rxd_PF) - { - i4b_mdl_error_ind(l2sc, "F_TR10", MDL_ERR_B); - } - else - { - i4b_mdl_error_ind(l2sc, "F_TR10", MDL_ERR_E); - } - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event T200 expiry - *---------------------------------------------------------------------------*/ -static void -F_TR11(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR11 executing"); - - if(l2sc->RC >= N200) - { - i4b_mdl_error_ind(l2sc, "F_TR11", MDL_ERR_I); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; - - l2sc->Q921_state = ST_AW_EST; - } - else - { - i4b_transmit_enquire(l2sc); - - l2sc->RC++; - - l2sc->Q921_state = ST_TIMREC; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event dl data request - *---------------------------------------------------------------------------*/ -static void -F_TR12(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR12 executing"); - - i4b_i_frame_queued_up(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event dl release request - *---------------------------------------------------------------------------*/ -static void -F_TR13(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR13 executing"); - - i4b_Dcleanifq(&l2sc->i_queue); - - l2sc->RC = 0; - - i4b_tx_disc(l2sc, P1); - - i4b_T200_restart(l2sc); -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event set own rx busy - *---------------------------------------------------------------------------*/ -static void -F_TR15(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR15 executing"); - - if(l2sc->own_busy == 0) - { - l2sc->own_busy = 1; - - i4b_tx_rnr_response(l2sc, F0); - - l2sc->ack_pend = 0; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event clear own rx busy - *---------------------------------------------------------------------------*/ -static void -F_TR16(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR16 executing"); - - if(l2sc->own_busy != 0) - { - l2sc->own_busy = 0; - - i4b_tx_rr_response(l2sc, F0); /* this is wrong */ - /* in Q.921 03/93 p 74 ! */ - l2sc->ack_pend = 0; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd RR - *---------------------------------------------------------------------------*/ -static void -F_TR17(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR17 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - i4b_invoke_retransmission(l2sc, l2sc->rxd_NR); - l2sc->Q921_state = ST_MULTIFR; - return; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - return; - } - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - l2sc->Q921_state = ST_TIMREC; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event - *---------------------------------------------------------------------------*/ -static void -F_TR18(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR18 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_stop(l2sc); - i4b_T203_start(l2sc); - i4b_invoke_retransmission(l2sc, l2sc->rxd_NR); - l2sc->Q921_state = ST_MULTIFR; - return; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - return; - } - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - l2sc->Q921_state = ST_TIMREC; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd RNR - *---------------------------------------------------------------------------*/ -static void -F_TR19(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR19 executing"); - - l2sc->peer_busy = 0; - - if(l2sc->rxd_CR == CR_CMD_FROM_NT) - { - if(l2sc->rxd_PF == 1) - { - i4b_enquiry_response(l2sc); - } - } - else - { - if(l2sc->rxd_PF == 1) - { - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - i4b_T200_restart(l2sc); - i4b_invoke_retransmission(l2sc, l2sc->rxd_NR); - l2sc->Q921_state = ST_MULTIFR; - return; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - return; - } - } - } - - if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs)) - { - l2sc->va = l2sc->rxd_NR; - l2sc->Q921_state = ST_TIMREC; - } - else - { - i4b_nr_error_recovery(l2sc); - l2sc->Q921_state = ST_AW_EST; - } -} - -/*---------------------------------------------------------------------------* - * FSM state ST_TIMREC event rx'd FRMR - *---------------------------------------------------------------------------*/ -static void -F_TR20(l2_softc_t *l2sc) -{ - NDBGL2(L2_F_MSG, "FSM function F_TR20 executing"); - - i4b_mdl_error_ind(l2sc, "F_TR20", MDL_ERR_K); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; -} diff --git a/sys/i4b/layer2/i4b_l2fsm.h b/sys/i4b/layer2/i4b_l2fsm.h deleted file mode 100644 index fe47089f2a19..000000000000 --- a/sys/i4b/layer2/i4b_l2fsm.h +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l2fsm.h - layer 2 FSM - * ------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 9 17:47:53 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L2FSM_H_ -#define _I4B_L2FSM_H_ - -enum Q921_states { - ST_TEI_UNAS, /* TEI unassigned */ - ST_ASG_AW_TEI, /* assign awaiting TEI */ - ST_EST_AW_TEI, /* establish awaiting TEI */ - ST_TEI_ASGD, /* TEI assigned */ - - ST_AW_EST, /* awaiting establishment */ - ST_AW_REL, /* awaiting release */ - ST_MULTIFR, /* multiple frame established */ - ST_TIMREC, /* timer recovery */ - - ST_SUBSET, /* SUBroutine SETs new state */ - ST_ILL, /* illegal state */ - N_STATES /* number of states */ -}; - -enum Q921_events { - EV_DLESTRQ, /* dl establish req */ - EV_DLUDTRQ, /* dl unit data req */ - EV_MDASGRQ, /* mdl assign req */ - EV_MDERRRS, /* mdl error response */ - EV_PSDEACT, /* persistent deactivation */ - EV_MDREMRQ, /* mdl remove req */ - EV_RXSABME, /* rx'd SABME */ - EV_RXDISC, /* rx'd DISC */ - EV_RXUA, /* rx'd UA */ - EV_RXDM, /* rx'd DM */ - EV_T200EXP, /* T200 expired */ - EV_DLDATRQ, /* dl data req */ - EV_DLRELRQ, /* dl release req */ - EV_T203EXP, /* T203 expired */ - EV_OWNBUSY, /* set own rx busy */ - EV_OWNRDY, /* clear own rx busy */ - EV_RXRR, /* rx'd RR */ - EV_RXREJ, /* rx'd REJ */ - EV_RXRNR, /* rx'd RNR */ - EV_RXFRMR, /* rx'd FRMR */ - - EV_ILL, /* Illegal */ - N_EVENTS -}; - -#endif /* _I4B_L2FSM_H_ */ diff --git a/sys/i4b/layer2/i4b_l2timer.c b/sys/i4b/layer2/i4b_l2timer.c deleted file mode 100644 index b12961997738..000000000000 --- a/sys/i4b/layer2/i4b_l2timer.c +++ /dev/null @@ -1,232 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l2timer.c - layer 2 timer handling - * -------------------------------------- - * last edit-date: [Sat Mar 9 17:48:58 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * Q.921 timer T200 timeout function - *---------------------------------------------------------------------------*/ -static void -i4b_T200_timeout(l2_softc_t *l2sc) -{ - NDBGL2(L2_T_ERR, "unit %d, RC = %d", l2sc->unit, l2sc->RC); - i4b_next_l2state(l2sc, EV_T200EXP); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T200 start - *---------------------------------------------------------------------------*/ -void -i4b_T200_start(l2_softc_t *l2sc) -{ - if(l2sc->T200 == TIMER_ACTIVE) - return; - - NDBGL2(L2_T_MSG, "unit %d", l2sc->unit); - l2sc->T200 = TIMER_ACTIVE; - - START_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc, T200DEF); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T200 stop - *---------------------------------------------------------------------------*/ -void -i4b_T200_stop(l2_softc_t *l2sc) -{ - CRIT_VAR; - CRIT_BEG; - if(l2sc->T200 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc); - l2sc->T200 = TIMER_IDLE; - } - CRIT_END; - NDBGL2(L2_T_MSG, "unit %d", l2sc->unit); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T200 restart - *---------------------------------------------------------------------------*/ -void -i4b_T200_restart(l2_softc_t *l2sc) -{ - CRIT_VAR; - CRIT_BEG; - if(l2sc->T200 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc); - } - else - { - l2sc->T200 = TIMER_ACTIVE; - } - - START_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc, T200DEF); - CRIT_END; - NDBGL2(L2_T_MSG, "unit %d", l2sc->unit); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T202 timeout function - *---------------------------------------------------------------------------*/ -static void -i4b_T202_timeout(l2_softc_t *l2sc) -{ - NDBGL2(L2_T_ERR, "unit %d, N202 = %d", l2sc->unit, l2sc->N202); - - if(--(l2sc->N202)) - { - (*l2sc->T202func)(l2sc); - } -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T202 start - *---------------------------------------------------------------------------*/ -void -i4b_T202_start(l2_softc_t *l2sc) -{ - if (l2sc->N202 == TIMER_ACTIVE) - return; - - NDBGL2(L2_T_MSG, "unit %d", l2sc->unit); - l2sc->N202 = N202DEF; - l2sc->T202 = TIMER_ACTIVE; - - START_TIMER(l2sc->T202_callout, i4b_T202_timeout, l2sc, T202DEF); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T202 stop - *---------------------------------------------------------------------------*/ -void -i4b_T202_stop(l2_softc_t *l2sc) -{ - CRIT_VAR; - CRIT_BEG; - if(l2sc->T202 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T202_callout, i4b_T202_timeout, l2sc); - l2sc->T202 = TIMER_IDLE; - } - CRIT_END; - NDBGL2(L2_T_MSG, "unit %d", l2sc->unit); -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T203 timeout function - *---------------------------------------------------------------------------*/ -#if defined(I4B_T203_ACTIVE) && I4B_T203_ACTIVE -static void -i4b_T203_timeout(l2_softc_t *l2sc) -{ - NDBGL2(L2_T_ERR, "unit %d", l2sc->unit); - i4b_next_l2state(l2sc, EV_T203EXP); -} -#endif - -/*---------------------------------------------------------------------------* - * Q.921 timer T203 start - *---------------------------------------------------------------------------*/ -void -i4b_T203_start(l2_softc_t *l2sc) -{ -#if defined(I4B_T203_ACTIVE) && I4B_T203_ACTIVE - if (l2sc->T203 == TIMER_ACTIVE) - return; - - NDBGL2(L2_T_MSG, "unit %d", l2sc->unit); - l2sc->T203 = TIMER_ACTIVE; - - START_TIMER(l2sc->T203_callout, i4b_T203_timeout, l2sc, T203DEF); -#endif -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T203 stop - *---------------------------------------------------------------------------*/ -void -i4b_T203_stop(l2_softc_t *l2sc) -{ -#if defined(I4B_T203_ACTIVE) && I4B_T203_ACTIVE - CRIT_VAR; - CRIT_BEG; - if(l2sc->T203 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T203_callout, i4b_T203_timeout, l2sc); - l2sc->T203 = TIMER_IDLE; - } - CRIT_END; - NDBGL2(L2_T_MSG, "unit %d", l2sc->unit); -#endif -} - -/*---------------------------------------------------------------------------* - * Q.921 timer T203 restart - *---------------------------------------------------------------------------*/ -void -i4b_T203_restart(l2_softc_t *l2sc) -{ -#if defined(I4B_T203_ACTIVE) && I4B_T203_ACTIVE - CRIT_VAR; - CRIT_BEG; - - if(l2sc->T203 != TIMER_IDLE) - { - STOP_TIMER(l2sc->T203_callout, i4b_T203_timerout, l2sc); - } - else - { - l2sc->T203 = TIMER_ACTIVE; - } - - START_TIMER(l2sc->T203_callout, i4b_T203_timerout, l2sc, T203DEF); - CRIT_END; - NDBGL2(L2_T_MSG, "unit %d", l2sc->unit); -#endif -} diff --git a/sys/i4b/layer2/i4b_lme.c b/sys/i4b/layer2/i4b_lme.c deleted file mode 100644 index 19d45ea750ec..000000000000 --- a/sys/i4b/layer2/i4b_lme.c +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_lme.c - layer management entity - * ------------------------------------- - * last edit-date: [Sat Mar 9 17:49:42 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include - -#include - -/*---------------------------------------------------------------------------* - * mdl assign indication handler - *---------------------------------------------------------------------------*/ -void -i4b_mdl_assign_ind(l2_softc_t *l2sc) -{ - NDBGL2(L2_PRIM, "unit %d", l2sc->unit); - - i4b_l1_activate(l2sc); - - if(l2sc->tei_valid == TEI_VALID) - { - l2sc->T202func = (void(*)(void*))i4b_tei_verify; - l2sc->N202 = N202DEF; - i4b_tei_verify(l2sc); - } - else - { - l2sc->T202func = (void(*)(void*))i4b_tei_assign; - l2sc->N202 = N202DEF; - i4b_tei_assign(l2sc); - } -} - -/*---------------------------------------------------------------------------* - * i4b_mdl_error_ind handler (Q.921 01/94 pp 156) - *---------------------------------------------------------------------------*/ -void -i4b_mdl_error_ind(l2_softc_t *l2sc, char *where, int errorcode) -{ -#if DO_I4B_DEBUG - static char *error_text[] = { - "MDL_ERR_A: rx'd unsolicited response - supervisory (F=1)", - "MDL_ERR_B: rx'd unsolicited response - DM (F=1)", - "MDL_ERR_C: rx'd unsolicited response - UA (F=1)", - "MDL_ERR_D: rx'd unsolicited response - UA (F=0)", - "MDL_ERR_E: rx'd unsolicited response - DM (F=0)", - "MDL_ERR_F: peer initiated re-establishment - SABME", - "MDL_ERR_G: unsuccessful transmission N200times - SABME", - "MDL_ERR_H: unsuccessful transmission N200times - DIS", - "MDL_ERR_I: unsuccessful transmission N200times - Status ENQ", - "MDL_ERR_J: other error - N(R) error", - "MDL_ERR_K: other error - rx'd FRMR response", - "MDL_ERR_L: other error - rx'd undefined frame", - "MDL_ERR_M: other error - receipt of I field not permitted", - "MDL_ERR_N: other error - rx'd frame with wrong size", - "MDL_ERR_O: other error - N201 error", - "MDL_ERR_MAX: i4b_mdl_error_ind called with wrong parameter!!!" - }; -#endif - - if(errorcode > MDL_ERR_MAX) - errorcode = MDL_ERR_MAX; - - NDBGL2(L2_ERROR, "unit = %d, location = %s", l2sc->unit, where); - NDBGL2(L2_ERROR, "error = %s", error_text[errorcode]); - - switch(errorcode) - { - case MDL_ERR_A: - case MDL_ERR_B: - break; - - case MDL_ERR_C: - case MDL_ERR_D: - i4b_tei_verify(l2sc); - break; - - case MDL_ERR_E: - case MDL_ERR_F: - break; - - case MDL_ERR_G: - case MDL_ERR_H: - i4b_tei_verify(l2sc); - break; - - case MDL_ERR_I: - case MDL_ERR_J: - case MDL_ERR_K: - case MDL_ERR_L: - case MDL_ERR_M: - case MDL_ERR_N: - case MDL_ERR_O: - break; - - default: - break; - } -} diff --git a/sys/i4b/layer2/i4b_mbuf.c b/sys/i4b/layer2/i4b_mbuf.c deleted file mode 100644 index 9bc0b686090e..000000000000 --- a/sys/i4b/layer2/i4b_mbuf.c +++ /dev/null @@ -1,217 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b - mbuf handling support routines - * ------------------------------------ - * last edit-date: [Sat Mar 9 17:51:22 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#define I4B_MBUF_DEBUG -#undef I4B_MBUF_TYPE_DEBUG - -#ifdef I4B_MBUF_TYPE_DEBUG - -#define MT_DCHAN 42 -#define MT_BCHAN 43 - -#define MT_I4B_D MT_DCHAN -#define MT_I4B_B MT_BCHAN - -#else /* ! I4B_MBUF_TYPE_DEBUG */ - -#define MT_I4B_D MT_DATA -#define MT_I4B_B MT_DATA - -#endif /* I4B_MBUF_TYPE_DEBUG */ - -/*---------------------------------------------------------------------------* - * allocate D-channel mbuf space - *---------------------------------------------------------------------------*/ -struct mbuf* -i4b_Dgetmbuf(int len) -{ - struct mbuf *m; - - if(len > MCLBYTES) /* if length > max extension size */ - { - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getmbuf: error - len(%d) > MCLBYTES(%d)\n", - len, MCLBYTES); -#endif - - return(NULL); - } - - MGETHDR(m, M_DONTWAIT, MT_I4B_D); /* get mbuf with pkthdr */ - - /* did we actually get the mbuf ? */ - - if(!m) - { - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getbuf: error - MGETHDR failed!\n"); -#endif - - return(NULL); - } - - if(len >= MHLEN) - { - MCLGET(m, M_DONTWAIT); - - if(!(m->m_flags & M_EXT)) - { - m_freem(m); - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getbuf: error - MCLGET failed, len(%d)\n", len); -#endif - - return (NULL); - } - } - - m->m_len = len; - - return(m); -} - -/*---------------------------------------------------------------------------* - * free a D-channel mbuf - *---------------------------------------------------------------------------*/ -void -i4b_Dfreembuf(struct mbuf *m) -{ - if(m) - m_freem(m); -} - -/*---------------------------------------------------------------------------* - * clear a D-channel ifqueue from data - *---------------------------------------------------------------------------*/ -void -i4b_Dcleanifq(struct ifqueue *ifq) -{ - int x = splimp(); - - IF_DRAIN(ifq); - - splx(x); -} - -/*---------------------------------------------------------------------------* - * allocate B-channel mbuf space - *---------------------------------------------------------------------------*/ -struct mbuf* -i4b_Bgetmbuf(int len) -{ - struct mbuf *m; - - if(len > MCLBYTES) /* if length > max extension size */ - { - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getmbuf: error - len(%d) > MCLBYTES(%d)\n", - len, MCLBYTES); -#endif - - return(NULL); - } - - MGETHDR(m, M_DONTWAIT, MT_I4B_B); /* get mbuf with pkthdr */ - - /* did we actually get the mbuf ? */ - - if(!m) - { - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getbuf: error - MGETHDR failed!\n"); -#endif - - return(NULL); - } - - if(len >= MHLEN) - { - MCLGET(m, M_DONTWAIT); - - if(!(m->m_flags & M_EXT)) - { - m_freem(m); - -#ifdef I4B_MBUF_DEBUG - printf("i4b_getbuf: error - MCLGET failed, len(%d)\n", len); -#endif - - return (NULL); - } - } - - m->m_len = len; - - return(m); -} - -/*---------------------------------------------------------------------------* - * free a B-channel mbuf - *---------------------------------------------------------------------------*/ -void -i4b_Bfreembuf(struct mbuf *m) -{ - if(m) - m_freem(m); -} - -/*---------------------------------------------------------------------------* - * clear a B-channel ifqueue from data - *---------------------------------------------------------------------------*/ -void -i4b_Bcleanifq(struct ifqueue *ifq) -{ - int x = splimp(); - - IF_DRAIN(ifq); - - splx(x); -} - -/* EOF */ diff --git a/sys/i4b/layer2/i4b_sframe.c b/sys/i4b/layer2/i4b_sframe.c deleted file mode 100644 index afe59eb7d275..000000000000 --- a/sys/i4b/layer2/i4b_sframe.c +++ /dev/null @@ -1,207 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_sframe.c - s frame handling routines - * ---------------------------------------- - * last edit-date: [Sat Mar 9 17:52:06 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * process s frame - *---------------------------------------------------------------------------*/ -void -i4b_rxd_s_frame(int unit, struct mbuf *m) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - u_char *ptr = m->m_data; - - if(!((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI))))) - { - i4b_Dfreembuf(m); - return; - } - - l2sc->rxd_CR = GETCR(*(ptr + OFF_SAPI)); - l2sc->rxd_PF = GETSPF(*(ptr + OFF_SNR)); - l2sc->rxd_NR = GETSNR(*(ptr + OFF_SNR)); - - i4b_rxd_ack(l2sc, l2sc->rxd_NR); - - switch(*(ptr + OFF_SRCR)) - { - case RR: - l2sc->stat.rx_rr++; /* update statistics */ - NDBGL2(L2_S_MSG, "rx'd RR, N(R) = %d", l2sc->rxd_NR); - i4b_next_l2state(l2sc, EV_RXRR); - break; - - case RNR: - l2sc->stat.rx_rnr++; /* update statistics */ - NDBGL2(L2_S_MSG, "rx'd RNR, N(R) = %d", l2sc->rxd_NR); - i4b_next_l2state(l2sc, EV_RXRNR); - break; - - case REJ: - l2sc->stat.rx_rej++; /* update statistics */ - NDBGL2(L2_S_MSG, "rx'd REJ, N(R) = %d", l2sc->rxd_NR); - i4b_next_l2state(l2sc, EV_RXREJ); - break; - - default: - l2sc->stat.err_rx_bads++; /* update statistics */ - NDBGL2(L2_S_ERR, "ERROR, unknown code, frame = "); - i4b_print_frame(m->m_len, m->m_data); - break; - } - i4b_Dfreembuf(m); -} - -/*---------------------------------------------------------------------------* - * transmit RR command - *---------------------------------------------------------------------------*/ -void -i4b_tx_rr_command(l2_softc_t *l2sc, pbit_t pbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx RR, unit = %d", l2sc->unit); - - m = i4b_build_s_frame(l2sc, CR_CMD_TO_NT, pbit, RR); - - PH_Data_Req(l2sc->unit, m, MBUF_FREE); - - l2sc->stat.tx_rr++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * transmit RR response - *---------------------------------------------------------------------------*/ -void -i4b_tx_rr_response(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx RR, unit = %d", l2sc->unit); - - m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, RR); - - PH_Data_Req(l2sc->unit, m, MBUF_FREE); - - l2sc->stat.tx_rr++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * transmit RNR command - *---------------------------------------------------------------------------*/ -void -i4b_tx_rnr_command(l2_softc_t *l2sc, pbit_t pbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx RNR, unit = %d", l2sc->unit); - - m = i4b_build_s_frame(l2sc, CR_CMD_TO_NT, pbit, RNR); - - PH_Data_Req(l2sc->unit, m, MBUF_FREE); - - l2sc->stat.tx_rnr++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * transmit RNR response - *---------------------------------------------------------------------------*/ -void -i4b_tx_rnr_response(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx RNR, unit = %d", l2sc->unit); - - m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, RNR); - - PH_Data_Req(l2sc->unit, m, MBUF_FREE); - - l2sc->stat.tx_rnr++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * transmit REJ response - *---------------------------------------------------------------------------*/ -void -i4b_tx_rej_response(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - NDBGL2(L2_S_MSG, "tx REJ, unit = %d", l2sc->unit); - - m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, REJ); - - PH_Data_Req(l2sc->unit, m, MBUF_FREE); - - l2sc->stat.tx_rej++; /* update statistics */ -} - -/*---------------------------------------------------------------------------* - * build S-frame for sending - *---------------------------------------------------------------------------*/ -struct mbuf * -i4b_build_s_frame(l2_softc_t *l2sc, crbit_to_nt_t crbit, pbit_t pbit, u_char type) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(S_FRAME_LEN)) == NULL) - return(NULL); - - PUTSAPI(SAPI_CCP, crbit, m->m_data[OFF_SAPI]); - - PUTTEI(l2sc->tei, m->m_data[OFF_TEI]); - - m->m_data[OFF_SRCR] = type; - - m->m_data[OFF_SNR] = (l2sc->vr << 1) | (pbit & 0x01); - - return(m); -} diff --git a/sys/i4b/layer2/i4b_tei.c b/sys/i4b/layer2/i4b_tei.c deleted file mode 100644 index 0e55bc244547..000000000000 --- a/sys/i4b/layer2/i4b_tei.c +++ /dev/null @@ -1,278 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_tei.c - tei handling procedures - * ----------------------------------- - * last edit-date: [Sat Mar 9 17:53:27 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * handle a received TEI management frame - *---------------------------------------------------------------------------*/ -void -i4b_tei_rxframe(int unit, struct mbuf *m) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - u_char *ptr = m->m_data; - - switch(*(ptr + OFF_MT)) - { - case MT_ID_ASSIGN: - if( (*(ptr + OFF_RIL) == l2sc->last_ril) && - (*(ptr + OFF_RIH) == l2sc->last_rih)) - { - l2sc->tei = GET_TEIFROMAI(*(ptr+OFF_AI)); - l2sc->tei_valid = TEI_VALID; - - if(l2sc->T202 == TIMER_ACTIVE) - i4b_T202_stop(l2sc); - - MDL_Status_Ind(l2sc->unit, STI_TEIASG, l2sc->tei); - - log(LOG_INFO, "i4b: unit %d, assigned TEI = %d = 0x%02x\n", l2sc->unit, l2sc->tei, l2sc->tei); - - NDBGL2(L2_TEI_MSG, "TEI ID Assign - TEI = %d", l2sc->tei); - - i4b_next_l2state(l2sc, EV_MDASGRQ); - } - break; - - case MT_ID_DENY: - if( (*(ptr + OFF_RIL) == l2sc->last_ril) && - (*(ptr + OFF_RIH) == l2sc->last_rih)) - { - l2sc->tei_valid = TEI_INVALID; - l2sc->tei = GET_TEIFROMAI(*(ptr+OFF_AI)); - - if(l2sc->tei == GROUP_TEI) - { - log(LOG_WARNING, "i4b: unit %d, denied TEI, no TEI values available from exchange!\n", l2sc->unit); - NDBGL2(L2_TEI_ERR, "TEI ID Denied, No TEI values available from exchange!"); - } - else - { - log(LOG_WARNING, "i4b: unit %d, denied TEI = %d = 0x%02x\n", l2sc->unit, l2sc->tei, l2sc->tei); - NDBGL2(L2_TEI_ERR, "TEI ID Denied - TEI = %d", l2sc->tei); - } - MDL_Status_Ind(l2sc->unit, STI_TEIASG, -1); - i4b_next_l2state(l2sc, EV_MDERRRS); - } - break; - - case MT_ID_CHK_REQ: - if( (l2sc->tei_valid == TEI_VALID) && - ( (l2sc->tei == GET_TEIFROMAI(*(ptr+OFF_AI))) || - (GROUP_TEI == GET_TEIFROMAI(*(ptr+OFF_AI))) )) - { - static int lasttei = -1; - - if(l2sc->tei != lasttei) - { - NDBGL2(L2_TEI_MSG, "TEI ID Check Req - TEI = %d", l2sc->tei); - lasttei = l2sc->tei; - } - - if(l2sc->T202 == TIMER_ACTIVE) - i4b_T202_stop(l2sc); - i4b_tei_chkresp(l2sc); - } - break; - - case MT_ID_REMOVE: - if( (l2sc->tei_valid == TEI_VALID) && - ( (l2sc->tei == GET_TEIFROMAI(*(ptr+OFF_AI))) || - (l2sc->tei == GET_TEIFROMAI(*(ptr+OFF_AI))))) - { - l2sc->tei_valid = TEI_INVALID; - l2sc->tei = GET_TEIFROMAI(*(ptr+OFF_AI)); - - log(LOG_INFO, "i4b: unit %d, removed TEI = %d = 0x%02x\n", l2sc->unit, l2sc->tei, l2sc->tei); - NDBGL2(L2_TEI_MSG, "TEI ID Remove - TEI = %d", l2sc->tei); - MDL_Status_Ind(l2sc->unit, STI_TEIASG, -1); - i4b_next_l2state(l2sc, EV_MDREMRQ); - } - break; - - default: - NDBGL2(L2_TEI_ERR, "UNKNOWN TEI MGMT Frame, type = 0x%x", *(ptr + OFF_MT)); - i4b_print_frame(m->m_len, m->m_data); - break; - } - i4b_Dfreembuf(m); -} - -/*---------------------------------------------------------------------------* - * allocate and fill up a TEI management frame for sending - *---------------------------------------------------------------------------*/ -static struct mbuf * -build_tei_mgmt_frame(l2_softc_t *l2sc, unsigned char type) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(TEI_MGMT_FRM_LEN)) == NULL) - return(NULL); - - m->m_data[TEIM_SAPIO] = 0xfc; /* SAPI = 63, CR = 0, EA = 0 */ - m->m_data[TEIM_TEIO] = 0xff; /* TEI = 127, EA = 1 */ - m->m_data[TEIM_UIO] = UI; /* UI */ - m->m_data[TEIM_MEIO] = MEI; /* MEI */ - m->m_data[TEIM_MTO] = type; /* message type */ - - switch(type) - { - case MT_ID_REQEST: - i4b_make_rand_ri(l2sc); - m->m_data[TEIM_RILO] = l2sc->last_ril; - m->m_data[TEIM_RIHO] = l2sc->last_rih; - m->m_data[TEIM_AIO] = (GROUP_TEI << 1) | 0x01; - break; - - case MT_ID_CHK_RSP: - i4b_make_rand_ri(l2sc); - m->m_data[TEIM_RILO] = l2sc->last_ril; - m->m_data[TEIM_RIHO] = l2sc->last_rih; - m->m_data[TEIM_AIO] = (l2sc->tei << 1) | 0x01; - break; - - case MT_ID_VERIFY: - m->m_data[TEIM_RILO] = 0; - m->m_data[TEIM_RIHO] = 0; - m->m_data[TEIM_AIO] = (l2sc->tei << 1) | 0x01; - break; - - default: - i4b_Dfreembuf(m); - panic("build_tei_mgmt_frame: invalid type"); - break; - } - l2sc->stat.tx_tei++; - return(m); -} - -/*---------------------------------------------------------------------------* - * i4b_tei_assign - TEI assignment procedure (Q.921, 5.3.2, pp 24) - * T202func and N202 _MUST_ be set prior to calling this function ! - *---------------------------------------------------------------------------*/ -void -i4b_tei_assign(l2_softc_t *l2sc) -{ - struct mbuf *m; - - NDBGL2(L2_TEI_MSG, "tx TEI ID_Request"); - - m = build_tei_mgmt_frame(l2sc, MT_ID_REQEST); - - if(m == NULL) - panic("i4b_tei_assign: no mbuf"); - - i4b_T202_start(l2sc); - - PH_Data_Req(l2sc->unit, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * i4b_tei_assign - TEI verify procedure (Q.921, 5.3.5, pp 29) - * T202func and N202 _MUST_ be set prior to calling this function ! - *---------------------------------------------------------------------------*/ -void -i4b_tei_verify(l2_softc_t *l2sc) -{ - struct mbuf *m; - - NDBGL2(L2_TEI_MSG, "tx TEI ID_Verify"); - - m = build_tei_mgmt_frame(l2sc, MT_ID_VERIFY); - - if(m == NULL) - panic("i4b_tei_verify: no mbuf"); - - i4b_T202_start(l2sc); - - PH_Data_Req(l2sc->unit, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * i4b_tei_chkresp - TEI check response procedure (Q.921, 5.3.5, pp 29) - *---------------------------------------------------------------------------*/ -void -i4b_tei_chkresp(l2_softc_t *l2sc) -{ - struct mbuf *m; - static int lasttei = 0; - - if(l2sc->tei != lasttei) - { - lasttei = l2sc->tei; - NDBGL2(L2_TEI_MSG, "tx TEI ID_Check_Response"); - } - - m = build_tei_mgmt_frame(l2sc, MT_ID_CHK_RSP); - - if(m == NULL) - panic("i4b_tei_chkresp: no mbuf"); - - PH_Data_Req(l2sc->unit, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * generate some 16 bit "random" number used for TEI mgmt Ri field - *---------------------------------------------------------------------------*/ -void -i4b_make_rand_ri(l2_softc_t *l2sc) -{ - u_short val; - -#ifdef RANDOMDEV - read_random((char *)&val, sizeof(val)); -#else - val = (u_short)random(); -#endif /* RANDOMDEV */ - - l2sc->last_rih = (val >> 8) & 0x00ff; - l2sc->last_ril = val & 0x00ff; -} diff --git a/sys/i4b/layer2/i4b_uframe.c b/sys/i4b/layer2/i4b_uframe.c deleted file mode 100644 index 55331a0cabfb..000000000000 --- a/sys/i4b/layer2/i4b_uframe.c +++ /dev/null @@ -1,277 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_uframe.c - routines for handling U-frames - * ----------------------------------------------- - * last edit-date: [Sat Mar 9 17:54:08 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * process a received U-frame - *---------------------------------------------------------------------------*/ -void -i4b_rxd_u_frame(int unit, struct mbuf *m) -{ - l2_softc_t *l2sc = &l2_softc[unit]; - u_char *ptr = m->m_data; - - int sapi = GETSAPI(*(ptr + OFF_SAPI)); - int tei = GETTEI(*(ptr + OFF_TEI)); - int pfbit = GETUPF(*(ptr + OFF_CNTL)); - - switch(*(ptr + OFF_CNTL) & ~UPFBIT) - { - /* commands */ - - case SABME: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_sabme++; - NDBGL2(L2_U_MSG, "SABME, sapi = %d, tei = %d", sapi, tei); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, EV_RXSABME); - } - i4b_Dfreembuf(m); - break; - - case UI: - if(sapi == SAPI_L2M && - tei == GROUP_TEI && - *(ptr + OFF_MEI) == MEI) - { - /* layer 2 management (SAPI = 63) */ - l2sc->stat.rx_tei++; - i4b_tei_rxframe(unit, m); - } - else if(sapi == SAPI_CCP && tei == GROUP_TEI) - { - /* call control (SAPI = 0) */ - l2sc->stat.rx_ui++; - /* strip ui header */ - m_adj(m, UI_HDR_LEN); - /* to upper layer */ - DL_Unit_Data_Ind(unit, m); - } - else - { - l2sc->stat.err_rx_badui++; - NDBGL2(L2_U_ERR, "unknown UI frame!"); - i4b_Dfreembuf(m); - } - break; - - case DISC: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_disc++; - NDBGL2(L2_U_MSG, "DISC, sapi = %d, tei = %d", sapi, tei); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, EV_RXDISC); - } - i4b_Dfreembuf(m); - break; - - case XID: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_xid++; - NDBGL2(L2_U_MSG, "XID, sapi = %d, tei = %d", sapi, tei); - } - i4b_Dfreembuf(m); - break; - - /* responses */ - - case DM: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_dm++; - NDBGL2(L2_U_MSG, "DM, sapi = %d, tei = %d", sapi, tei); - i4b_print_frame(m->m_len, m->m_data); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, EV_RXDM); - } - i4b_Dfreembuf(m); - break; - - case UA: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_ua++; - NDBGL2(L2_U_MSG, "UA, sapi = %d, tei = %d", sapi, tei); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, EV_RXUA); - } - i4b_Dfreembuf(m); - break; - - case FRMR: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - l2sc->stat.rx_frmr++; - NDBGL2(L2_U_MSG, "FRMR, sapi = %d, tei = %d", sapi, tei); - l2sc->rxd_PF = pfbit; - i4b_next_l2state(l2sc, EV_RXFRMR); - } - i4b_Dfreembuf(m); - break; - - default: - if((l2sc->tei_valid == TEI_VALID) && - (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) - { - NDBGL2(L2_U_ERR, "UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei); - i4b_print_frame(m->m_len, m->m_data); - } - else - { - NDBGL2(L2_U_ERR, "not mine - UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei); - i4b_print_frame(m->m_len, m->m_data); - } - l2sc->stat.err_rx_badui++; - i4b_Dfreembuf(m); - break; - } -} - -/*---------------------------------------------------------------------------* - * build U-frame for sending - *---------------------------------------------------------------------------*/ -struct mbuf * -i4b_build_u_frame(l2_softc_t *l2sc, crbit_to_nt_t crbit, pbit_t pbit, u_char type) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(U_FRAME_LEN)) == NULL) - return(NULL); - - PUTSAPI(SAPI_CCP, crbit, m->m_data[OFF_SAPI]); - - PUTTEI(l2sc->tei, m->m_data[OFF_TEI]); - - if(pbit) - m->m_data[OFF_CNTL] = type | UPBITSET; - else - m->m_data[OFF_CNTL] = type & ~UPBITSET; - - return(m); -} - -/*---------------------------------------------------------------------------* - * transmit SABME command - *---------------------------------------------------------------------------*/ -void -i4b_tx_sabme(l2_softc_t *l2sc, pbit_t pbit) -{ - struct mbuf *m; - - l2sc->stat.tx_sabme++; - NDBGL2(L2_U_MSG, "tx SABME, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_CMD_TO_NT, pbit, SABME); - PH_Data_Req(l2sc->unit, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * transmit DM response - *---------------------------------------------------------------------------*/ -void -i4b_tx_dm(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - l2sc->stat.tx_dm++; - NDBGL2(L2_U_MSG, "tx DM, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, DM); - PH_Data_Req(l2sc->unit, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * transmit DISC command - *---------------------------------------------------------------------------*/ -void -i4b_tx_disc(l2_softc_t *l2sc, pbit_t pbit) -{ - struct mbuf *m; - - l2sc->stat.tx_disc++; - NDBGL2(L2_U_MSG, "tx DISC, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_CMD_TO_NT, pbit, DISC); - PH_Data_Req(l2sc->unit, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * transmit UA response - *---------------------------------------------------------------------------*/ -void -i4b_tx_ua(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - l2sc->stat.tx_ua++; - NDBGL2(L2_U_MSG, "tx UA, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, UA); - PH_Data_Req(l2sc->unit, m, MBUF_FREE); -} - -/*---------------------------------------------------------------------------* - * transmit FRMR response - *---------------------------------------------------------------------------*/ -void -i4b_tx_frmr(l2_softc_t *l2sc, fbit_t fbit) -{ - struct mbuf *m; - - l2sc->stat.tx_frmr++; - NDBGL2(L2_U_MSG, "tx FRMR, tei = %d", l2sc->tei); - m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, FRMR); - PH_Data_Req(l2sc->unit, m, MBUF_FREE); -} diff --git a/sys/i4b/layer2/i4b_util.c b/sys/i4b/layer2/i4b_util.c deleted file mode 100644 index 9121648defbc..000000000000 --- a/sys/i4b/layer2/i4b_util.c +++ /dev/null @@ -1,305 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_util.c - layer 2 utility routines - * ------------------------------------- - * last edit-date: [Sat Mar 9 17:55:03 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -/*---------------------------------------------------------------------------* - * routine ESTABLISH DATA LINK (Q.921 03/93 page 83) - *---------------------------------------------------------------------------*/ -void -i4b_establish_data_link(l2_softc_t *l2sc) -{ - i4b_l1_activate(l2sc); - - i4b_clear_exception_conditions(l2sc); - - l2sc->RC = 0; - - i4b_tx_sabme(l2sc, P1); - - i4b_T200_restart(l2sc); - - i4b_T203_stop(l2sc); -} - -/*---------------------------------------------------------------------------* - * routine CLEAR EXCEPTION CONDITIONS (Q.921 03/93 page 83) - *---------------------------------------------------------------------------*/ -void -i4b_clear_exception_conditions(l2_softc_t *l2sc) -{ - CRIT_VAR; - - CRIT_BEG; - -/*XXX -------------------------------------------------------------- */ -/*XXX is this really appropriate here or should it moved elsewhere ? */ - - i4b_Dcleanifq(&l2sc->i_queue); - - if(l2sc->ua_num != UA_EMPTY) - { - i4b_Dfreembuf(l2sc->ua_frame); - l2sc->ua_num = UA_EMPTY; - } -/*XXX -------------------------------------------------------------- */ - - l2sc->peer_busy = 0; - - l2sc->rej_excpt = 0; - - l2sc->own_busy = 0; - - l2sc->ack_pend = 0; - - CRIT_END; -} - -/*---------------------------------------------------------------------------* - * routine TRANSMIT ENQUIRE (Q.921 03/93 page 83) - *---------------------------------------------------------------------------*/ -void -i4b_transmit_enquire(l2_softc_t *l2sc) -{ - if(l2sc->own_busy) - i4b_tx_rnr_command(l2sc, P1); - else - i4b_tx_rr_command(l2sc, P1); - - l2sc->ack_pend = 0; - - i4b_T200_start(l2sc); -} - -/*---------------------------------------------------------------------------* - * routine NR ERROR RECOVERY (Q.921 03/93 page 83) - *---------------------------------------------------------------------------*/ -void -i4b_nr_error_recovery(l2_softc_t *l2sc) -{ - i4b_mdl_error_ind(l2sc, "i4b_nr_error_recovery", MDL_ERR_J); - - i4b_establish_data_link(l2sc); - - l2sc->l3initiated = 0; -} - -/*---------------------------------------------------------------------------* - * routine ENQUIRY RESPONSE (Q.921 03/93 page 84) - *---------------------------------------------------------------------------*/ -void -i4b_enquiry_response(l2_softc_t *l2sc) -{ - if(l2sc->own_busy) - i4b_tx_rnr_response(l2sc, F1); - else - i4b_tx_rr_response(l2sc, F1); - - l2sc->ack_pend = 0; -} - -/*---------------------------------------------------------------------------* - * routine INVOKE RETRANSMISSION (Q.921 03/93 page 84) - *---------------------------------------------------------------------------*/ -void -i4b_invoke_retransmission(l2_softc_t *l2sc, int nr) -{ - CRIT_VAR; - - CRIT_BEG; - - NDBGL2(L2_ERROR, "nr = %d", nr ); - - while(l2sc->vs != nr) - { - NDBGL2(L2_ERROR, "nr(%d) != vs(%d)", nr, l2sc->vs); - - M128DEC(l2sc->vs); - -/* XXXXXXXXXXXXXXXXX */ - - if((l2sc->ua_num != UA_EMPTY) && (l2sc->vs == l2sc->ua_num)) - { - if(_IF_QFULL(&l2sc->i_queue)) - { - NDBGL2(L2_ERROR, "ERROR, I-queue full!"); - } - else - { - IF_ENQUEUE(&l2sc->i_queue, l2sc->ua_frame); - l2sc->ua_num = UA_EMPTY; - } - } - else - { - NDBGL2(L2_ERROR, "ERROR, l2sc->vs = %d, l2sc->ua_num = %d ",l2sc->vs, l2sc->ua_num); - } - -/* XXXXXXXXXXXXXXXXX */ - - i4b_i_frame_queued_up(l2sc); - } - - CRIT_END; -} - -/*---------------------------------------------------------------------------* - * routine ACKNOWLEDGE PENDING (Q.921 03/93 p 70) - *---------------------------------------------------------------------------*/ -void -i4b_acknowledge_pending(l2_softc_t *l2sc) -{ - if(l2sc->ack_pend) - { - l2sc->ack_pend = 0; - i4b_tx_rr_response(l2sc, F0); - } -} - -/*---------------------------------------------------------------------------* - * i4b_print_frame - just print the hex contents of a frame - *---------------------------------------------------------------------------*/ -void -i4b_print_frame(int len, u_char *buf) -{ -#if DO_I4B_DEBUG - int i; - - if (!(i4b_l2_debug & L2_ERROR)) /* XXXXXXXXXXXXXXXXXXXXX */ - return; - - for(i = 0; i < len; i++) - printf(" 0x%x", buf[i]); - printf("\n"); -#endif -} - -/*---------------------------------------------------------------------------* - * i4b_print_l2var - print some l2softc vars - *---------------------------------------------------------------------------*/ -void -i4b_print_l2var(l2_softc_t *l2sc) -{ - NDBGL2(L2_ERROR, "unit%d V(R)=%d, V(S)=%d, V(A)=%d,ACKP=%d,PBSY=%d,OBSY=%d", - l2sc->unit, - l2sc->vr, - l2sc->vs, - l2sc->va, - l2sc->ack_pend, - l2sc->peer_busy, - l2sc->own_busy); -} - -/*---------------------------------------------------------------------------* - * got s or i frame, check if valid ack for last sent frame - *---------------------------------------------------------------------------*/ -void -i4b_rxd_ack(l2_softc_t *l2sc, int nr) -{ - -#ifdef NOTDEF - NDBGL2(L2_ERROR, "N(R)=%d, UA=%d, V(R)=%d, V(S)=%d, V(A)=%d", - nr, - l2sc->ua_num, - l2sc->vr, - l2sc->vs, - l2sc->va); -#endif - - if(l2sc->ua_num != UA_EMPTY) - { - CRIT_VAR; - - CRIT_BEG; - - M128DEC(nr); - - if(l2sc->ua_num != nr) - NDBGL2(L2_ERROR, "((N(R)-1)=%d) != (UA=%d) !!!", nr, l2sc->ua_num); - - i4b_Dfreembuf(l2sc->ua_frame); - l2sc->ua_num = UA_EMPTY; - - CRIT_END; - } -} - -/*---------------------------------------------------------------------------* - * if not already active, activate layer 1 - *---------------------------------------------------------------------------*/ -void -i4b_l1_activate(l2_softc_t *l2sc) -{ - if(l2sc->ph_active == PH_INACTIVE) - { - l2sc->ph_active = PH_ACTIVEPEND; - PH_Act_Req(l2sc->unit); - } -}; - -/*---------------------------------------------------------------------------* - * check for v(a) <= n(r) <= v(s) - * nr = receive sequence frame counter, va = acknowledge sequence frame - * counter and vs = transmit sequence frame counter - *---------------------------------------------------------------------------*/ -int -i4b_l2_nr_ok(int nr, int va, int vs) -{ - if((va > nr) && ((nr != 0) || (va != 127))) - { - NDBGL2(L2_ERROR, "ERROR, va = %d, nr = %d, vs = %d [1]", va, nr, vs); - return 0; /* fail */ - } - - if((nr > vs) && ((vs != 0) || (nr != 127))) - { - NDBGL2(L2_ERROR, "ERROR, va = %d, nr = %d, vs = %d [2]", va, nr, vs); - return 0; /* fail */ - } - return 1; /* good */ -} diff --git a/sys/i4b/layer3/i4b_l2if.c b/sys/i4b/layer3/i4b_l2if.c deleted file mode 100644 index 4c23dbdaa995..000000000000 --- a/sys/i4b/layer3/i4b_l2if.c +++ /dev/null @@ -1,680 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l2if.c - Layer 3 interface to Layer 2 - * ------------------------------------------- - * last edit-date: [Sun Aug 11 12:48:41 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - - -static unsigned char make_q931_cause(cause_t cause); - -/*---------------------------------------------------------------------------* - * this converts our internal state (number) to the number specified - * in Q.931 and is used for reporting our state in STATUS messages. - *---------------------------------------------------------------------------*/ -int i4b_status_tab[] = { - 0, /* ST_U0, */ - 1, /* ST_U1, */ - 3, /* ST_U3, */ - 4, /* ST_U4, */ - 6, /* ST_U6, */ - 7, /* ST_U7, */ - 8, /* ST_U8, */ - 9, /* ST_U9, */ - 10, /* ST_U10, */ - 11, /* ST_U11, */ - 12, /* ST_U12, */ - 19, /* ST_U19, */ - 6, /* ST_IWA, */ - 6, /* ST_IWR, */ - 1, /* ST_OW, */ - 6, /* ST_IWL, */ -}; - -/*---------------------------------------------------------------------------* - * return a valid q.931/q.850 cause from any of the internal causes - *---------------------------------------------------------------------------*/ -static unsigned char -make_q931_cause(cause_t cause) -{ - register unsigned char ret; - - switch(GET_CAUSE_TYPE(cause)) - { - case CAUSET_Q850: - ret = GET_CAUSE_VAL(cause); - break; - case CAUSET_I4B: - ret = cause_tab_q931[GET_CAUSE_VAL(cause)]; - break; - default: - panic("make_q931_cause: unknown cause type!"); - break; - } - ret |= EXT_LAST; - return(ret); -} - -/*---------------------------------------------------------------------------* - * return status of data link - *---------------------------------------------------------------------------*/ -int -i4b_get_dl_stat(call_desc_t *cd) -{ - return(ctrl_desc[cd->controller].dl_est); -} - -/*---------------------------------------------------------------------------* - * DL ESTABLISH INDICATION from Layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_establish_ind(int unit) -{ - int i; - int found = 0; - - NDBGL2(L2_PRIM, "DL-ESTABLISH-IND unit %d",unit); - - /* first set DL up in controller descriptor */ - - for(i=0; i < nctrl; i++) - { - if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[i].unit == unit)) - { - NDBGL3(L3_MSG, "unit=%d DL established!",unit); - ctrl_desc[i].dl_est = DL_UP; - found = 1; - } - } - - if(found == 0) - { - NDBGL3(L3_ERR, "ERROR, controller not found for unit=%d!",unit); - return(-1); - } - - found = 0; - - /* second, inform all (!) active call of the event */ - - for(i=0; i < N_CALL_DESC; i++) - { - if( (call_desc[i].cdid != 0) && - (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[call_desc[i].controller].unit == unit)) - { - NDBGL3(L3_MSG, "unit=%d, index=%d cdid=%u cr=%d", - unit, i, call_desc[i].cdid, call_desc[i].cr); - next_l3state(&call_desc[i], EV_DLESTIN); - found++; - } - } - - if(found == 0) - { - NDBGL3(L3_ERR, "ERROR, no cdid for unit %d found!", unit); - return(-1); - } - else - { - return(0); - } -} - -/*---------------------------------------------------------------------------* - * DL ESTABLISH CONFIRM from Layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_establish_cnf(int unit) -{ - int i; - int found = 0; - - NDBGL2(L2_PRIM, "DL-ESTABLISH-CONF unit %d",unit); - - for(i=0; i < N_CALL_DESC; i++) - { - if( (call_desc[i].cdid != 0) && - (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[call_desc[i].controller].unit == unit)) - { - ctrl_desc[call_desc[i].controller].dl_est = DL_UP; - - NDBGL3(L3_MSG, "unit=%d, index=%d cdid=%u cr=%d", - unit, i, call_desc[i].cdid, call_desc[i].cr); - - next_l3state(&call_desc[i], EV_DLESTCF); - found++; - } - } - - if(found == 0) - { - NDBGL3(L3_ERR, "ERROR, no cdid for unit %d found!", unit); - return(-1); - } - else - { - return(0); - } -} - -/*---------------------------------------------------------------------------* - * DL RELEASE INDICATION from Layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_release_ind(int unit) -{ - int i; - int found = 0; - - NDBGL2(L2_PRIM, "DL-RELEASE-IND unit %d",unit); - - /* first set controller to down */ - - for(i=0; i < nctrl; i++) - { - if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[i].unit == unit)) - { - NDBGL3(L3_MSG, "unit=%d DL released!",unit); - ctrl_desc[i].dl_est = DL_DOWN; - found = 1; - } - } - - if(found == 0) - { - NDBGL3(L3_ERR, "ERROR, controller not found for unit=%d!",unit); - return(-1); - } - - found = 0; - - /* second, inform all (!) active calls of the event */ - - for(i=0; i < N_CALL_DESC; i++) - { - if( (call_desc[i].cdid != 0) && - (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[call_desc[i].controller].unit == unit)) - { - NDBGL3(L3_MSG, "unit=%d, index=%d cdid=%u cr=%d", - unit, i, call_desc[i].cdid, call_desc[i].cr); - next_l3state(&call_desc[i], EV_DLRELIN); - found++; - } - } - - if(found == 0) - { - /* this is not an error since it might be a normal call end */ - NDBGL3(L3_MSG, "no cdid for unit %d found", unit); - } - return(0); -} - -/*---------------------------------------------------------------------------* - * DL RELEASE CONFIRM from Layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_release_cnf(int unit) -{ - int i; - - NDBGL2(L2_PRIM, "DL-RELEASE-CONF unit %d",unit); - - for(i=0; i < nctrl; i++) - { - if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[i].unit == unit)) - { - NDBGL3(L3_MSG, "unit=%d DL released!",unit); - ctrl_desc[i].dl_est = DL_DOWN; - return(0); - } - } - NDBGL3(L3_ERR, "ERROR, controller not found for unit=%d!",unit); - return(-1); -} - -/*---------------------------------------------------------------------------* - * i4b_dl_data_ind - process a rx'd I-frame got from layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_data_ind(int unit, struct mbuf *m) -{ -#ifdef NOTDEF - NDBGL2(L2_PRIM, "DL-DATA-IND unit %d",unit); -#endif - i4b_decode_q931(unit, m->m_len, m->m_data); - i4b_Dfreembuf(m); - return(0); -} - -/*---------------------------------------------------------------------------* - * dl_unit_data_ind - process a rx'd U-frame got from layer 2 - *---------------------------------------------------------------------------*/ -int -i4b_dl_unit_data_ind(int unit, struct mbuf *m) -{ -#ifdef NOTDEF - NDBGL2(L2_PRIM, "DL-UNIT-DATA-IND unit %d",unit); -#endif - i4b_decode_q931(unit, m->m_len, m->m_data); - i4b_Dfreembuf(m); - return(0); -} - -/*---------------------------------------------------------------------------* - * send CONNECT message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_connect(call_desc_t *cd) -{ - struct mbuf *m; - u_char *ptr; - - NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr); - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_CONNECT_LEN)) == NULL) - panic("i4b_l3_tx_connect: can't allocate mbuf\n"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = CONNECT; /* message type = connect */ - - DL_Data_Req(ctrl_desc[cd->controller].unit, m); -} - -/*---------------------------------------------------------------------------* - * send RELEASE COMPLETE message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_release_complete(call_desc_t *cd, int send_cause_flag) -{ - struct mbuf *m; - u_char *ptr; - int len = I_FRAME_HDRLEN + MSG_RELEASE_COMPLETE_LEN; - - if(send_cause_flag == 0) - { - len -= 4; - NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", - ctrl_desc[cd->controller].unit, cd->cr); - } - else - { - NDBGL3(L3_PRIM, "unit=%d, cr=0x%02x, cause=0x%x", - ctrl_desc[cd->controller].unit, cd->cr, cd->cause_out); - } - - if((m = i4b_Dgetmbuf(len)) == NULL) - panic("i4b_l3_tx_release_complete: can't allocate mbuf\n"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = RELEASE_COMPLETE; /* message type = release complete */ - - if(send_cause_flag) - { - *ptr++ = IEI_CAUSE; /* cause ie */ - *ptr++ = CAUSE_LEN; - *ptr++ = CAUSE_STD_LOC_OUT; - *ptr++ = make_q931_cause(cd->cause_out); - } - - DL_Data_Req(ctrl_desc[cd->controller].unit, m); -} - -/*---------------------------------------------------------------------------* - * send DISCONNECT message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_disconnect(call_desc_t *cd) -{ - struct mbuf *m; - u_char *ptr; - - NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr); - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_DISCONNECT_LEN)) == NULL) - panic("i4b_l3_tx_disconnect: can't allocate mbuf\n"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call ref length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = DISCONNECT; /* message type = disconnect */ - - *ptr++ = IEI_CAUSE; /* cause ie */ - *ptr++ = CAUSE_LEN; - *ptr++ = CAUSE_STD_LOC_OUT; - *ptr++ = make_q931_cause(cd->cause_out); - - DL_Data_Req(ctrl_desc[cd->controller].unit, m); -} - -/*---------------------------------------------------------------------------* - * send SETUP message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_setup(call_desc_t *cd) -{ - struct mbuf *m; - u_char *ptr; - int len; - int slen = strlen(cd->src_telno); - int sslen = strlen(cd->src_subaddr); - int dlen = strlen(cd->dst_telno); - int dslen = strlen(cd->dst_subaddr); - int klen = strlen(cd->keypad); - - /* - * there is one additional octet if cd->bprot == BPROT_NONE - * NOTE: the selection of a bearer capability by a B L1 - * protocol is highly questionable and a better - * mechanism should be used in future. (-hm) - */ - - NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr); - - len = I_FRAME_HDRLEN + - MSG_SETUP_LEN + - (slen ? (3+slen) : 0) + - (sslen ? (3+sslen) : 0) + - (dlen ? (3+dlen) : 0) + - (dslen ? (3+dslen) : 0) + - (klen ? (2+klen) : 0) + - (cd->bprot == BPROT_NONE ? 1 : 0); - - if((m = i4b_Dgetmbuf(len)) == NULL) - { - panic("i4b_l3_tx_setup: can't allocate mbuf\n"); - } - - cd->crflag = CRF_ORIG; /* we are the originating side */ - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call ref length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = SETUP; /* message type = setup */ - - *ptr++ = IEI_SENDCOMPL; /* sending complete */ - - *ptr++ = IEI_BEARERCAP; /* bearer capability */ - - /* XXX - * currently i have no idea if this should be switched by - * the choosen B channel protocol or if there should be a - * separate configuration item for the bearer capability. - * For now, it is switched by the choosen b protocol (-hm) - */ - - switch(cd->bprot) - { - case BPROT_NONE: /* telephony */ - *ptr++ = IEI_BEARERCAP_LEN+1; - *ptr++ = IT_CAP_SPEECH; - *ptr++ = IT_RATE_64K; - *ptr++ = IT_UL1_G711A; - break; - - case BPROT_RHDLC: /* raw HDLC */ - if (cd->bcap == BCAP_DOV) /* Data over Voice */ - { - *ptr++ = IEI_BEARERCAP_LEN+1; - *ptr++ = IT_CAP_SPEECH; - *ptr++ = IT_RATE_64K; - *ptr++ = IT_UL1_G711A; - } - else - { - *ptr++ = IEI_BEARERCAP_LEN; - *ptr++ = IT_CAP_UNR_DIG_INFO; - *ptr++ = IT_RATE_64K; - } - break; - - default: - *ptr++ = IEI_BEARERCAP_LEN; - *ptr++ = IT_CAP_UNR_DIG_INFO; - *ptr++ = IT_RATE_64K; - break; - } - - *ptr++ = IEI_CHANNELID; /* channel id */ - *ptr++ = IEI_CHANNELID_LEN; /* channel id length */ - - switch(cd->channelid) - { - case CHAN_B1: - *ptr++ = CHANNELID_B1; - break; - case CHAN_B2: - *ptr++ = CHANNELID_B2; - break; - default: - *ptr++ = CHANNELID_ANY; - break; - } - - if(klen) - { - *ptr++ = IEI_KEYPAD; /* keypad facility */ - *ptr++ = klen; /* keypad facility length */ - strncpy(ptr, cd->keypad, klen); - ptr += klen; - } - - if(slen) - { - *ptr++ = IEI_CALLINGPN; /* calling party no */ - *ptr++ = IEI_CALLINGPN_LEN+slen;/* calling party no length */ - *ptr++ = NUMBER_TYPEPLAN; /* type of number, number plan id */ - strncpy(ptr, cd->src_telno, slen); - ptr += slen; - } - - if(sslen) - { - *ptr++ = IEI_CALLINGPS; /* calling subaddr */ - *ptr++ = IEI_CALLINGPS_LEN+sslen; /* calling subaddr len */ - *ptr++ = SUBADDR_TYPE_NSAP; /* type = NSAP */ - strncpy(ptr, cd->src_subaddr, sslen); - ptr += sslen; - } - - if(dlen) - { - *ptr++ = IEI_CALLEDPN; /* called party no */ - *ptr++ = IEI_CALLEDPN_LEN+dlen; /* called party no length */ - *ptr++ = NUMBER_TYPEPLAN; /* type of number, number plan id */ - strncpy(ptr, cd->dst_telno, dlen); - ptr += dlen; - } - - if(dslen) - { - *ptr++ = IEI_CALLEDPS; /* calling party subaddr */ - *ptr++ = IEI_CALLEDPS_LEN+dslen;/* calling party subaddr len */ - *ptr++ = SUBADDR_TYPE_NSAP; /* type = NSAP */ - strncpy(ptr, cd->dst_subaddr, dslen); - ptr += dslen; - } - - DL_Data_Req(ctrl_desc[cd->controller].unit, m); -} - -/*---------------------------------------------------------------------------* - * send CONNECT ACKNOWLEDGE message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_connect_ack(call_desc_t *cd) -{ - struct mbuf *m; - u_char *ptr; - - NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr); - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_CONNECT_ACK_LEN)) == NULL) - panic("i4b_l3_tx_connect_ack: can't allocate mbuf\n"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = CONNECT_ACKNOWLEDGE; /* message type = connect ack */ - - DL_Data_Req(ctrl_desc[cd->controller].unit, m); -} - -/*---------------------------------------------------------------------------* - * send STATUS message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_status(call_desc_t *cd, u_char q850cause) -{ - struct mbuf *m; - u_char *ptr; - - NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr); - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_STATUS_LEN)) == NULL) - panic("i4b_l3_tx_status: can't allocate mbuf\n"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = STATUS; /* message type = connect ack */ - - *ptr++ = IEI_CAUSE; /* cause ie */ - *ptr++ = CAUSE_LEN; - *ptr++ = CAUSE_STD_LOC_OUT; - *ptr++ = q850cause | EXT_LAST; - - *ptr++ = IEI_CALLSTATE; /* call state ie */ - *ptr++ = CALLSTATE_LEN; - *ptr++ = i4b_status_tab[cd->Q931state]; - - DL_Data_Req(ctrl_desc[cd->controller].unit, m); -} - -/*---------------------------------------------------------------------------* - * send RELEASE message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_release(call_desc_t *cd, int send_cause_flag) -{ - struct mbuf *m; - u_char *ptr; - int len = I_FRAME_HDRLEN + MSG_RELEASE_LEN; - - NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr); - - if(send_cause_flag == 0) - len -= 4; - - if((m = i4b_Dgetmbuf(len)) == NULL) - panic("i4b_l3_tx_release: can't allocate mbuf\n"); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = RELEASE; /* message type = release complete */ - - if(send_cause_flag) - { - *ptr++ = IEI_CAUSE; /* cause ie */ - *ptr++ = CAUSE_LEN; - *ptr++ = CAUSE_STD_LOC_OUT; - *ptr++ = make_q931_cause(cd->cause_out); - } - - DL_Data_Req(ctrl_desc[cd->controller].unit, m); -} - -/*---------------------------------------------------------------------------* - * send ALERTING message - *---------------------------------------------------------------------------*/ -void -i4b_l3_tx_alert(call_desc_t *cd) -{ - struct mbuf *m; - u_char *ptr; - - if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_ALERT_LEN)) == NULL) - panic("i4b_l3_tx_alert: can't allocate mbuf\n"); - - NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr); - - ptr = m->m_data + I_FRAME_HDRLEN; - - *ptr++ = PD_Q931; /* protocol discriminator */ - *ptr++ = 0x01; /* call reference length */ - *ptr++ = setup_cr(cd, cd->cr); /* call reference value */ - *ptr++ = ALERT; /* message type = alert */ - - DL_Data_Req(ctrl_desc[cd->controller].unit, m); -} diff --git a/sys/i4b/layer3/i4b_l3.h b/sys/i4b/layer3/i4b_l3.h deleted file mode 100644 index 22029934efd6..000000000000 --- a/sys/i4b/layer3/i4b_l3.h +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l3.h - layer 3 header file - * ------------------------------ - * - * $Id: i4b_l3.h,v 1.11 2000/04/27 09:25:21 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Apr 27 11:07:01 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L3_H_ -#define _I4B_L3_H_ - -extern int utoc_tab[]; -extern unsigned char cause_tab_q931[]; - -extern int i4b_aoc ( unsigned char *, call_desc_t *cd ); -extern void i4b_decode_q931 ( int unit, int msg_len, u_char *msg_ptr ); -extern int i4b_decode_q931_cs0_ie ( int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr ); -extern void i4b_decode_q931_message ( int unit, call_desc_t *cd, u_char message_type ); -extern void i4b_l3_stop_all_timers ( call_desc_t *cd ); -extern void i4b_l3_tx_alert ( call_desc_t *cd ); -extern void i4b_l3_tx_connect ( call_desc_t *cd ); -extern void i4b_l3_tx_connect_ack ( call_desc_t *cd ); -extern void i4b_l3_tx_disconnect ( call_desc_t *cd ); -extern void i4b_l3_tx_release ( call_desc_t *cd, int send_cause_flag ); -extern void i4b_l3_tx_release_complete ( call_desc_t *cd, int send_cause_flag ); -extern void i4b_l3_tx_setup ( call_desc_t *cd ); -extern void i4b_l3_tx_status ( call_desc_t *cd, u_char q850cause ); -extern int i4b_dl_data_ind ( int unit, struct mbuf *m ); -extern int i4b_dl_establish_cnf ( int unit ); -extern int i4b_dl_establish_ind ( int unit ); -extern int i4b_dl_release_cnf ( int unit ); -extern int i4b_dl_release_ind ( int unit ); -extern int i4b_dl_unit_data_ind ( int unit, struct mbuf *m ); -extern int i4b_get_dl_stat( call_desc_t *cd ); -extern int i4b_mdl_status_ind ( int unit, int status, int parm); -extern void i4b_print_frame ( int len, u_char *buf ); -extern void next_l3state ( call_desc_t *cd, int event ); -extern char *print_l3state ( call_desc_t *cd ); -extern unsigned char setup_cr ( call_desc_t *cd, unsigned char cr ); -extern void T303_start ( call_desc_t *cd ); -extern void T303_stop ( call_desc_t *cd ); -extern void T305_start ( call_desc_t *cd ); -extern void T305_stop ( call_desc_t *cd ); -extern void T308_start ( call_desc_t *cd ); -extern void T308_stop ( call_desc_t *cd ); -extern void T309_start ( call_desc_t *cd ); -extern void T309_stop ( call_desc_t *cd ); -extern void T310_start ( call_desc_t *cd ); -extern void T310_stop ( call_desc_t *cd ); -extern void T313_start ( call_desc_t *cd ); -extern void T313_stop ( call_desc_t *cd ); - -#endif /* _I4B_L3_H_ */ diff --git a/sys/i4b/layer3/i4b_l3fsm.c b/sys/i4b/layer3/i4b_l3fsm.c deleted file mode 100644 index 1ec06787ba0e..000000000000 --- a/sys/i4b/layer3/i4b_l3fsm.c +++ /dev/null @@ -1,1037 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l3fsm.c - layer 3 FSM - * ------------------------- - * last edit-date: [Sat Mar 9 19:34:39 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -static void F_00A(call_desc_t *cd), F_00H(call_desc_t *cd), F_00I(call_desc_t *cd); -static void F_00J(call_desc_t *cd); - -static void F_01B(call_desc_t *cd), F_01K(call_desc_t *cd), F_01L(call_desc_t *cd); -static void F_01M(call_desc_t *cd), F_01N(call_desc_t *cd), F_01U(call_desc_t *cd); -static void F_01O(call_desc_t *cd); - -static void F_03C(call_desc_t *cd), F_03N(call_desc_t *cd), F_03O(call_desc_t *cd); -static void F_03P(call_desc_t *cd), F_03Y(call_desc_t *cd); - -static void F_04O(call_desc_t *cd); - -static void F_06D(call_desc_t *cd), F_06E(call_desc_t *cd), F_06F(call_desc_t *cd); -static void F_06G(call_desc_t *cd), F_06J(call_desc_t *cd), F_06Q(call_desc_t *cd); - -static void F_07E(call_desc_t *cd), F_07F(call_desc_t *cd), F_07G(call_desc_t *cd); - -static void F_08R(call_desc_t *cd), F_08Z(call_desc_t *cd); - -static void F_09D(call_desc_t *cd), F_09E(call_desc_t *cd), F_09F(call_desc_t *cd); -static void F_09G(call_desc_t *cd); - -static void F_11J(call_desc_t *cd), F_11Q(call_desc_t *cd), F_11V(call_desc_t *cd); - -static void F_12C(call_desc_t *cd), F_12J(call_desc_t *cd); - -static void F_19I(call_desc_t *cd), F_19J(call_desc_t *cd), F_19K(call_desc_t *cd); -static void F_19W(call_desc_t *cd); - -static void F_NCNA(call_desc_t *cd), F_STENQ(call_desc_t *cd), F_STAT(call_desc_t *cd); -static void F_INFO(call_desc_t *cd), F_RELCP(call_desc_t *cd), F_REL(call_desc_t *cd); -static void F_DISC(call_desc_t *cd), F_DCRQ(call_desc_t *cd), F_UEM(call_desc_t *cd); -static void F_SIGN(call_desc_t *cd), F_DLEI(call_desc_t *cd), F_ILL(call_desc_t *cd); -static void F_309TO(call_desc_t *cd), F_DECF(call_desc_t *cd), F_FCTY(call_desc_t *cd); -static void F_DECF1(call_desc_t *cd), F_DECF2(call_desc_t *cd), F_DECF3(call_desc_t *cd); -static void F_DLRI(call_desc_t *cd), F_DLRIA(call_desc_t *cd), F_DECF4(call_desc_t *cd); - -static void F_308TO(call_desc_t *cd); - -#if DO_I4B_DEBUG -static char *l3state_text[N_STATES] = { - "ST_U0 - Null", - "ST_U1 - Out Init", - "ST_U3 - Out Proc", - "ST_U4 - Out Delv", - "ST_U6 - In Pres", - "ST_U7 - In Rxd", - "ST_U8 - In ConReq", - "ST_U9 - In Proc", - "ST_U10 - Active", - "ST_U11 - Disc Req", - "ST_U12 - Disc Ind", - "ST_U19 - Rel Req", - - "ST_IWA - In Wait EST-Accept", - "ST_IWR - In Wait EST-Reject", - "ST_OW - Out Wait EST", - "ST_IWL - In Wait EST-Alert", - - "ST_SUSE - Subroutine sets state", - - "Illegal State" -}; - -static char *l3event_text[N_EVENTS] = { - "EV_SETUPRQ - L4 SETUP REQ", /* setup request from L4 */ - "EV_DISCRQ - L4 DISC REQ", /* disconnect request from L4 */ - "EV_RELRQ - L4 REL REQ", /* release request from L4 */ - "EV_ALERTRQ - L4 ALERT REQ", /* alerting request from L4 */ - "EV_SETACRS - L4 accept RSP", /* setup response accept from l4 */ - "EV_SETRJRS - L4 reject RSP", /* setup response reject from l4 */ - "EV_SETDCRS - L4 ignore RSP", /* setup response dontcare from l4 */ - - "EV_SETUP - rxd SETUP", /* incoming SETUP message from L2 */ - "EV_STATUS - rxd STATUS", /* incoming STATUS message from L2 */ - "EV_RELEASE - rxd REL", /* incoming RELEASE message from L2 */ - "EV_RELCOMP - rxd REL COMPL", /* incoming RELEASE COMPLETE from L2 */ - "EV_SETUPAK - rxd SETUP ACK", /* incoming SETUP ACK message from L2 */ - "EV_CALLPRC - rxd CALL PROC", /* incoming CALL PROCEEDING from L2 */ - "EV_ALERT - rxd ALERT", /* incoming ALERT message from L2 */ - "EV_CONNECT - rxd CONNECT", /* incoming CONNECT message from L2 */ - "EV_PROGIND - rxd PROG IND", /* incoming Progress IND from L2 */ - "EV_DISCONN - rxd DISC", /* incoming DISCONNECT message from L2 */ - "EV_CONACK - rxd CONN ACK", /* incoming CONNECT ACK message from L2 */ - "EV_STATENQ - rxd STAT ENQ", /* incoming STATUS ENQ message from L2 */ - "EV_INFO - rxd INFO", /* incoming INFO message from L2 */ - "EV_FACILITY - rxd FACILITY", /* incoming FACILITY message */ - - "EV_T303EXP - T303 timeout", /* Timer T303 expired */ - "EV_T305EXP - T305 timeout", /* Timer T305 expired */ - "EV_T308EXP - T308 timeout", /* Timer T308 expired */ - "EV_T309EXP - T309 timeout", /* Timer T309 expired */ - "EV_T310EXP - T310 timeout", /* Timer T310 expired */ - "EV_T313EXP - T313 timeout", /* Timer T313 expired */ - - "EV_DLESTIN - L2 DL_Est_Ind", /* dl establish indication from l2 */ - "EV_DLRELIN - L2 DL_Rel_Ind", /* dl release indication from l2 */ - "EV_DLESTCF - L2 DL_Est_Cnf", /* dl establish confirm from l2 */ - "EV_DLRELCF - L2 DL_Rel_Cnf", /* dl release confirm from l2 */ - - "EV_ILL - Illegal event!!" /* Illegal */ -}; -#endif - -/*---------------------------------------------------------------------------* - * layer 3 state transition table - *---------------------------------------------------------------------------*/ -struct l3state_tab { - void (*func) (call_desc_t *); /* function to execute */ - int newstate; /* next state */ -} l3state_tab[N_EVENTS][N_STATES] = { - -/* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ -/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_SETUPRQ*/ {{F_00A, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DISCRQ */ {{F_ILL, ST_ILL}, {F_01B, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_NCNA, ST_U12}, {F_ILL, ST_ILL}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_DCRQ, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_RELRQ */ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_03C, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_12C, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_ALERTRQ*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06D, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_09D, ST_U7}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_SETACRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06E, ST_SUSE}, {F_07E, ST_U8}, {F_ILL, ST_ILL}, {F_09E, ST_U8}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_SETRJRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06F, ST_SUSE}, {F_07F, ST_U0}, {F_ILL, ST_ILL}, {F_09F, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_SETDCRS*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_06G, ST_U0}, {F_07G, ST_U0}, {F_ILL, ST_ILL}, {F_09G, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ -/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_SETUP */ {{F_00H, ST_U6}, {F_SIGN, ST_U1}, {F_SIGN, ST_U3}, {F_SIGN, ST_U4}, {F_SIGN, ST_U6}, {F_SIGN, ST_U7}, {F_SIGN, ST_U8}, {F_SIGN, ST_U9}, {F_SIGN, ST_U10}, {F_SIGN, ST_U11}, {F_SIGN, ST_U12}, {F_SIGN, ST_U19}, {F_SIGN, ST_IWA}, {F_SIGN, ST_IWR}, {F_SIGN, ST_OW}, {F_SIGN, ST_IWL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_STATUS */ {{F_00I, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_19I, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_STAT, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_RELEASE*/ {{F_00J, ST_U0}, {F_UEM, ST_SUSE}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_06J, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_11J, ST_U0}, {F_12J, ST_U0}, {F_19J, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_REL, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_RELCOMP*/ {{F_NCNA, ST_U0}, {F_01K, ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_19K, ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_RELCP,ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_SETUPAK*/ {{F_UEM, ST_SUSE}, {F_01L, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_CALLPRC*/ {{F_UEM, ST_SUSE}, {F_01M, ST_U3}, {F_NCNA, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_ALERT */ {{F_UEM, ST_SUSE}, {F_01N, ST_U4}, {F_03N, ST_U4}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_CONNECT*/ {{F_UEM, ST_SUSE}, {F_01O, ST_U10}, {F_03O, ST_U10}, {F_04O, ST_U10}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_PROGIND*/ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_03P, ST_U3}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DISCONN*/ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_06Q, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_11Q, ST_U19}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_DISC, ST_U12}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_CONACK */ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_08R, ST_U10}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_STATENQ*/ {{F_STENQ,ST_U0}, {F_STENQ,ST_U1}, {F_STENQ,ST_U3}, {F_STENQ,ST_U4}, {F_STENQ,ST_U6}, {F_STENQ,ST_U7}, {F_STENQ,ST_U8}, {F_STENQ,ST_U9}, {F_STENQ,ST_U10}, {F_STENQ,ST_U11}, {F_STENQ,ST_U12}, {F_STENQ,ST_U19}, {F_STENQ,ST_IWA}, {F_STENQ,ST_IWR}, {F_STENQ,ST_OW}, {F_STENQ,ST_OW}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_INFO */ {{F_UEM, ST_SUSE}, {F_UEM, ST_SUSE}, {F_INFO, ST_U3}, {F_INFO, ST_U4}, {F_UEM, ST_SUSE}, {F_INFO, ST_U7}, {F_INFO, ST_U8}, {F_INFO, ST_U9}, {F_INFO, ST_U10}, {F_INFO, ST_U11}, {F_INFO, ST_U12}, {F_UEM, ST_SUSE}, {F_INFO, ST_IWA}, {F_INFO, ST_IWR}, {F_INFO, ST_OW}, {F_INFO, ST_OW}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_FACILITY*/ {{F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_FCTY, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ -/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_T303EXP*/ {{F_ILL, ST_ILL}, {F_01U, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T305EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_11V, ST_U19}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T308EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_308TO,ST_ILL}, {F_19W, ST_SUSE}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T309EXP*/ {{F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_309TO,ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T310EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_03Y, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_T313EXP*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_08Z, ST_U11}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */ -/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*EV_DLESTIN*/ {{F_ILL, ST_ILL}, {F_DLEI, ST_U1}, {F_DLEI, ST_U3}, {F_DLEI, ST_U4}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_DLEI, ST_U1}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DLRELIN*/ {{F_NCNA, ST_U0}, {F_DLRIA, ST_OW}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRIA,ST_U10}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_DLRI, ST_U0}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DLESTCF*/ {{F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF, ST_SUSE}, {F_DECF2,ST_U8}, {F_DECF3,ST_U0}, {F_DECF1,ST_U1}, {F_DECF4,ST_U7}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_DLRELCF*/ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}}, -/*EV_ILL */ {{F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void next_l3state(call_desc_t *cd, int event) -{ - int currstate, newstate; - - if(event >= N_EVENTS) - panic("i4b_l3fsm.c: event >= N_EVENTS\n"); - - currstate = cd->Q931state; - - if(currstate >= N_STATES) - panic("i4b_l3fsm.c: currstate >= N_STATES\n"); - - newstate = l3state_tab[event][currstate].newstate; - - if(newstate > N_STATES) - panic("i4b_l3fsm.c: newstate > N_STATES\n"); - - NDBGL3(L3_F_MSG, "L3 FSM event [%s]: [%s => %s]", - l3event_text[event], - l3state_text[currstate], - l3state_text[newstate]); - - /* execute function */ - - (*l3state_tab[event][currstate].func)(cd); - - if(newstate == ST_ILL) - { - newstate = currstate; - NDBGL3(L3_F_ERR, "FSM illegal state, state = %s, event = %s!", - l3state_text[newstate], - l3event_text[event]); - } - - if(newstate != ST_SUSE) - cd->Q931state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char *print_l3state(call_desc_t *cd) -{ - return((char *) l3state_text[cd->Q931state]); -} -#endif - -/*---------------------------------------------------------------------------* - * L3 FSM state U0 event L4 setup req - *---------------------------------------------------------------------------*/ -static void F_00A(call_desc_t *cd) -{ - int s; - NDBGL3(L3_F_MSG, "FSM function F_00A executing"); - - cd->T303_first_to = 1; - T303_start(cd); - - s = SPLI4B(); - if(i4b_get_dl_stat(cd) == DL_DOWN) - { - splx(s); - DL_Est_Req(ctrl_desc[cd->controller].unit); - cd->Q931state = ST_OW; - } - else - { - cd->Q931state = ST_U1; - splx(s); - i4b_l3_tx_setup(cd); - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U0 event SETUP from L2 - *---------------------------------------------------------------------------*/ -static void F_00H(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_00H executing"); - i4b_l4_connect_ind(cd); /* tell l4 we have an incoming setup */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U0 event STATUS from L2 - *---------------------------------------------------------------------------*/ -static void F_00I(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_00I executing"); - - if(cd->call_state != 0) - { - cd->cause_out = 101; - i4b_l3_tx_release_complete(cd, 1); /* 1 = send cause */ - } - cd->Q931state = ST_U0; -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U0 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_00J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_00J executing"); - i4b_l3_tx_release_complete(cd, 0); /* 0 = don't send cause */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event disconnect req from L4 - *---------------------------------------------------------------------------*/ -static void F_01B(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01B executing"); - /* cause from L4 */ - i4b_l3_tx_disconnect(cd); - T303_stop(cd); - T305_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event RELEASE COMPLETE from L2 - *---------------------------------------------------------------------------*/ -static void F_01K(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01K executing"); - T303_stop(cd); - i4b_l4_disconnect_ind(cd); /* tell l4 we were rejected */ - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event SETUP ACK from L2 - *---------------------------------------------------------------------------*/ -static void F_01L(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01L executing"); - T303_stop(cd); - - /* - * since this implementation does NOT support overlap sending, - * we react here as if we received a CALL PROCEEDING because - * several PBX's react with a SETUP ACK even if the called - * number is complete AND we sent a SENDING COMPLETE in the - * preceding SETUP message. (-hm) - */ - - T310_start(cd); - i4b_l4_proceeding_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event CALL PROCEEDING from L2 - *---------------------------------------------------------------------------*/ -static void F_01M(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01M executing"); - T303_stop(cd); - T310_start(cd); - i4b_l4_proceeding_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event ALERT from L2 (XXX !) - *---------------------------------------------------------------------------*/ -static void F_01N(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01N executing"); - T303_stop(cd); - i4b_l4_alert_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event CONNECT from L2 (XXX !) - *---------------------------------------------------------------------------*/ -static void F_01O(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01O executing"); - T303_stop(cd); - i4b_l3_tx_connect_ack(cd); - i4b_l4_connect_active_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U1 event T303 timeout - *---------------------------------------------------------------------------*/ -static void F_01U(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_01U executing"); - if(cd->T303_first_to == 1) - { - cd->T303_first_to = 0; - i4b_l3_tx_setup(cd); - T303_start(cd); - cd->Q931state = ST_U1; - } - else - { - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - cd->Q931state = ST_U0; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event release req from L4 - *---------------------------------------------------------------------------*/ -static void F_03C(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03C executing"); - T310_stop(cd); - cd->cause_out = 6; - i4b_l3_tx_release(cd, 1); /* 0 = don't send cause */ - cd->T308_first_to = 1; - T308_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event ALERT from L2 - *---------------------------------------------------------------------------*/ -static void F_03N(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03N executing"); - T310_stop(cd); - i4b_l4_alert_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event CONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_03O(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03O executing"); - T310_stop(cd); - i4b_l3_tx_connect_ack(cd); /* CONNECT ACK to network */ - i4b_l4_connect_active_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event PROGESS IND from L2 - *---------------------------------------------------------------------------*/ -static void F_03P(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03P executing"); - T310_stop(cd); -#ifdef NOTDEF - i4b_l4_progress_ind(cd); -#endif -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U3 event T310 timeout - *---------------------------------------------------------------------------*/ -static void F_03Y(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_03Y executing"); - cd->cause_out = 102; /* recovery on timer expiry */ - i4b_l3_tx_disconnect(cd); - T305_start(cd); - i4b_l4_disconnect_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U4 event CONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_04O(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_04O executing"); - i4b_l3_tx_connect_ack(cd); /* CONNECT ACK to network */ - i4b_l4_connect_active_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event alert req from L4 - *---------------------------------------------------------------------------*/ -static void F_06D(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06D executing"); - - if(i4b_get_dl_stat(cd) == DL_DOWN) - { - DL_Est_Req(ctrl_desc[cd->controller].unit); - cd->Q931state = ST_IWL; - } - else - { - i4b_l3_tx_alert(cd); - cd->Q931state = ST_U7; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event incoming setup accept from L4 - *---------------------------------------------------------------------------*/ -static void F_06E(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06E executing"); - - if(i4b_get_dl_stat(cd) == DL_DOWN) - { - DL_Est_Req(ctrl_desc[cd->controller].unit); - cd->Q931state = ST_IWA; - } - else - { - i4b_l3_tx_connect(cd); - cd->Q931state = ST_U8; - } - T313_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event incoming setup reject from L4 - *---------------------------------------------------------------------------*/ -static void F_06F(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06F executing"); - - if(i4b_get_dl_stat(cd) == DL_DOWN) - { - DL_Est_Req(ctrl_desc[cd->controller].unit); - cd->Q931state = ST_IWR; - } - else - { - int s = SPLI4B(); - i4b_l3_tx_release_complete(cd, 1); - cd->Q931state = ST_U0; - freecd_by_cd(cd); - splx(s); - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event incoming setup ignore from L4 - *---------------------------------------------------------------------------*/ -static void F_06G(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06G executing"); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_06J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06J executing"); - i4b_l3_tx_release_complete(cd, 0); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U6 event DISCONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_06Q(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_06Q executing"); - i4b_l4_disconnect_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U7 event setup response accept from L4 - *---------------------------------------------------------------------------*/ -static void F_07E(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_07E executing"); - i4b_l3_tx_connect(cd); - T313_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U7 event setup response reject from L4 - *---------------------------------------------------------------------------*/ -static void F_07F(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_07F executing"); - i4b_l3_tx_release_complete(cd, 1); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U7 event setup response ignore from L4 - *---------------------------------------------------------------------------*/ -static void F_07G(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_07G executing"); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U8 event CONNECT ACK from L2 - *---------------------------------------------------------------------------*/ -static void F_08R(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_08R executing"); - T313_stop(cd); - i4b_l4_connect_active_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U8 event T313 timeout - *---------------------------------------------------------------------------*/ -static void F_08Z(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_08Z executing"); - cd->cause_out = 102; /* recovery on timer expiry */ - i4b_l3_tx_disconnect(cd); - T305_start(cd); - i4b_l4_disconnect_ind(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U9 event alert req from L4 - *---------------------------------------------------------------------------*/ -static void F_09D(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_09D executing"); - i4b_l3_tx_alert(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U9 event setup response accept from L4 - *---------------------------------------------------------------------------*/ -static void F_09E(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_09E executing"); - i4b_l3_tx_connect(cd); - T313_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U9 event setup response reject from L4 - *---------------------------------------------------------------------------*/ -static void F_09F(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_09F executing"); - i4b_l3_tx_release_complete(cd, 1); - freecd_by_cd(cd); -} -/*---------------------------------------------------------------------------* - * L3 FSM state U9 event setup response ignore from L4 - *---------------------------------------------------------------------------*/ -static void F_09G(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_09G executing"); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U11 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_11J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_11J executing"); - T305_stop(cd); - i4b_l3_tx_release_complete(cd, 0); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U11 event DISCONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_11Q(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_11Q executing"); - T305_stop(cd); - i4b_l3_tx_release(cd, 0); - cd->T308_first_to = 1; - T308_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U11 event T305 timeout - *---------------------------------------------------------------------------*/ -static void F_11V(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_11V executing"); - cd->cause_out = 102; - i4b_l3_tx_release(cd, 1); - cd->T308_first_to = 1; - T308_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U12 event release req from L4 - *---------------------------------------------------------------------------*/ -static void F_12C(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_12C executing"); - i4b_l3_tx_release(cd, 1); - cd->T308_first_to = 1; - T308_start(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U12 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_12J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_12J executing"); - i4b_l3_tx_release_complete(cd, 0); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U19 event STATUS from L2 - *---------------------------------------------------------------------------*/ -static void F_19I(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_19I executing"); - - if(cd->call_state == 0) - { - i4b_l4_status_ind(cd); - freecd_by_cd(cd); - cd->Q931state = ST_U0; - } - else - { - cd->Q931state = ST_U19; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U19 event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_19J(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_19J executing"); - T308_stop(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U19 event RELEASE COMPLETE from L2 - *---------------------------------------------------------------------------*/ -static void F_19K(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_19K executing"); - T308_stop(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U19 event T308 timeout - *---------------------------------------------------------------------------*/ -static void F_19W(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_19W executing"); - if(cd->T308_first_to == 0) - { - cd->T308_first_to = 1; - i4b_l3_tx_release(cd, 0); - T308_start(cd); - cd->Q931state = ST_U19; - } - else - { - cd->T308_first_to = 0; - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - cd->Q931state = ST_U0; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM routine no change no action - *---------------------------------------------------------------------------*/ -static void F_NCNA(call_desc_t *cd) -{ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state event STATUS ENQ from L2 - *---------------------------------------------------------------------------*/ -static void F_STENQ(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_STENQ executing"); - i4b_l3_tx_status(cd, CAUSE_Q850_STENQRSP); /* 30, resonse to stat enq */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state except 0 & 19 event STATUS from L2 - *---------------------------------------------------------------------------*/ -static void F_STAT(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_STAT executing"); - if(cd->call_state == 0) - { - i4b_l4_status_ind(cd); - cd->Q931state = ST_U0; - freecd_by_cd(cd); - } - else - { - /* XXX !!!!!!!!!!!!!!!!!! */ - - i4b_l4_status_ind(cd); - cd->cause_out = 101; /* message not compatible with call state */ - i4b_l3_tx_disconnect(cd); - T305_start(cd); - cd->Q931state = ST_U11; - } -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event INFORMATION from L2 - *---------------------------------------------------------------------------*/ -static void F_INFO(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_INFO executing"); - i4b_l4_info_ind(cd); - /* remain in current state */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM T308 timeout while expecting RELEASE COMPLETE - *---------------------------------------------------------------------------*/ -static void F_308TO(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_308TO executing"); - i4b_l3_stop_all_timers(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event RELEASE COMPLETE from L2 - *---------------------------------------------------------------------------*/ -static void F_RELCP(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_RELCP executing"); - i4b_l3_stop_all_timers(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event RELEASE from L2 - *---------------------------------------------------------------------------*/ -static void F_REL(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_REL executing"); - i4b_l3_stop_all_timers(cd); - i4b_l3_tx_release_complete(cd, 0); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event DISCONNECT from L2 - *---------------------------------------------------------------------------*/ -static void F_DISC(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DISC executing"); - i4b_l3_stop_all_timers(cd); - - /* - * no disconnect ind to L4, no jump to state U12 - * instead we issue a RELEASE and jump to U19 - */ - - i4b_l3_tx_release(cd, 0); - cd->T308_first_to = 1; - T308_start(cd); - cd->Q931state = ST_U19; -} - -/*---------------------------------------------------------------------------* - * L3 FSM some states event disconnect request from L4 - *---------------------------------------------------------------------------*/ -static void F_DCRQ(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DCRQ executing"); - - /* stop T310 in case this is the result of an incoming call for a */ - /* calledback connection */ - - if(cd->T310 == TIMER_ACTIVE) - T310_stop(cd); - - /* cause from L4 */ - i4b_l3_tx_disconnect(cd); - T305_start(cd); - cd->Q931state = ST_U11; -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state except 0 event unexpected message from L2 - *---------------------------------------------------------------------------*/ -static void F_UEM(call_desc_t *cd) -{ - NDBGL3(L3_F_ERR, "FSM function F_UEM executing, state = %s", print_l3state(cd)); - i4b_l3_tx_status(cd, CAUSE_Q850_MSGNCWCS); /* 101, message not compatible with call state */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state except 0 event SETUP from L2 - *---------------------------------------------------------------------------*/ -static void F_SIGN(call_desc_t *cd) -{ - NDBGL3(L3_F_ERR, "FSM function F_SIGN executing"); - -/* XXX */ /* freecd_by_cd(cd); ?????????? XXX */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM relevant states event DL ESTABLISH IND from L2 - *---------------------------------------------------------------------------*/ -static void F_DLEI(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DLEI executing"); - -/* XXX */ - - /* remain in current state */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state event illegal event occured - *---------------------------------------------------------------------------*/ -static void F_ILL(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_ILL executing"); -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state event T309 timeout - *---------------------------------------------------------------------------*/ -static void F_309TO(call_desc_t *cd) -{ - NDBGL3(L3_F_ERR, "FSM function F_309TO executing"); - -/* XXX */ - -#ifdef NOTDEF - i4b_l4_dl_fail_ind(cd); -#endif - - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state event FACILITY message received - *---------------------------------------------------------------------------*/ -static void F_FCTY(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_FCTY executing"); - /* ST_SUSE, no change in state ! */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM state ST_OW event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF1(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF1 executing"); - i4b_l3_tx_setup(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state ST_IWA event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF2(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF2 executing"); - i4b_l3_tx_connect(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state ST_IWR event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF3(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF3 executing"); - i4b_l3_tx_release_complete(cd, 1); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state ST_IWL event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF4(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF4 executing"); - i4b_l3_tx_alert(cd); -} - - -/*---------------------------------------------------------------------------* - * L3 FSM any state event DL ESTABLISH CONF from L2 - *---------------------------------------------------------------------------*/ -static void F_DECF(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DECF executing"); - T309_stop(cd); - i4b_l3_tx_status(cd, CAUSE_Q850_NORMUNSP); /* 31, normal unspecified */ -} - -/*---------------------------------------------------------------------------* - * L3 FSM any state except U10 event DL RELEASE IND from L2 - *---------------------------------------------------------------------------*/ -static void F_DLRI(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DLRI executing"); - i4b_l3_stop_all_timers(cd); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); -} - -/*---------------------------------------------------------------------------* - * L3 FSM state U10 event DL RELEASE IND from L2 - *---------------------------------------------------------------------------*/ -static void F_DLRIA(call_desc_t *cd) -{ - NDBGL3(L3_F_MSG, "FSM function F_DLRIA executing"); - - if(cd->T309 == TIMER_IDLE) - T309_start(cd); - - DL_Est_Req(ctrl_desc[cd->controller].unit); -} diff --git a/sys/i4b/layer3/i4b_l3fsm.h b/sys/i4b/layer3/i4b_l3fsm.h deleted file mode 100644 index b2a510212b0a..000000000000 --- a/sys/i4b/layer3/i4b_l3fsm.h +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l3fsm.c - layer 3 FSM - * ------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 9 19:34:51 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L3FSM_H_ -#define _I4B_L3FSM_H_ - -enum Q931_states { - ST_U0, - ST_U1, - ST_U3, - ST_U4, - ST_U6, - ST_U7, - ST_U8, - ST_U9, - ST_U10, - ST_U11, - ST_U12, - ST_U19, - - ST_IWA, /* incoming call, wait establish, then accept */ - ST_IWR, /* incoming call, wait establish, then reject */ - ST_OW, /* outgoing call, wait establish */ - ST_IWL, /* incoming call, wait establish, then alert */ - - ST_SUSE, /* SUBroutine SETs new state on exit */ - ST_ILL, /* Illegal */ - - N_STATES /* number of states */ -}; - -enum Q931_events { - - EV_SETUPRQ, /* setup request from L4 */ - EV_DISCRQ, /* disconnect request from L4 */ - EV_RELRQ, /* release request from L4 */ - EV_ALERTRQ, /* alerting request from L4 */ - EV_SETACRS, /* setup response accept from l4 */ - EV_SETRJRS, /* setup response reject from l4 */ - EV_SETDCRS, /* setup response dontcare from l4 */ - - EV_SETUP, /* incoming SETUP message from L2 */ - EV_STATUS, /* incoming STATUS message from L2 */ - EV_RELEASE, /* incoming RELEASE message from L2 */ - EV_RELCOMP, /* incoming RELEASE COMPLETE from L2 */ - EV_SETUPAK, /* incoming SETUP ACK message from L2 */ - EV_CALLPRC, /* incoming CALL PROCEEDING from L2 */ - EV_ALERT, /* incoming ALERT message from L2 */ - EV_CONNECT, /* incoming CONNECT message from L2 */ - EV_PROGIND, /* incoming Progress IND from L2 */ - EV_DISCONN, /* incoming DISCONNECT message from L2 */ - EV_CONACK, /* incoming CONNECT ACK message from L2 */ - EV_STATENQ, /* incoming STATUS ENQ message from L2 */ - EV_INFO, /* incoming INFO message from L2 */ - EV_FACILITY, /* FACILITY message */ - - EV_T303EXP, /* Timer T303 expired */ - EV_T305EXP, /* Timer T305 expired */ - EV_T308EXP, /* Timer T308 expired */ - EV_T309EXP, /* Timer T309 expired */ - EV_T310EXP, /* Timer T310 expired */ - EV_T313EXP, /* Timer T313 expired */ - - EV_DLESTIN, /* dl establish indication from l2 */ - EV_DLRELIN, /* dl release indication from l2 */ - EV_DLESTCF, /* dl establish confirm from l2 */ - EV_DLRELCF, /* dl release indication from l2 */ - - EV_ILL, /* Illegal */ - N_EVENTS -}; - -#endif /* _I4B_L3FSM_H_ */ diff --git a/sys/i4b/layer3/i4b_l3timer.c b/sys/i4b/layer3/i4b_l3timer.c deleted file mode 100644 index 33abab414039..000000000000 --- a/sys/i4b/layer3/i4b_l3timer.c +++ /dev/null @@ -1,325 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l3timer.c - timer and timeout handling for layer 3 - * ------------------------------------------------------ - * last edit-date: [Sat Mar 9 19:35:31 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -/*---------------------------------------------------------------------------* - * stop all layer 3 timers - *---------------------------------------------------------------------------*/ -void i4b_l3_stop_all_timers(call_desc_t *cd) -{ - T303_stop(cd); - T305_stop(cd); - T308_stop(cd); - T309_stop(cd); - T310_stop(cd); - T313_stop(cd); -} - -/*---------------------------------------------------------------------------* - * timer T303 timeout function - *---------------------------------------------------------------------------*/ -static void -T303_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "SETUP not answered, cr = %d", cd->cr); - next_l3state(cd, EV_T303EXP); -} - -/*---------------------------------------------------------------------------* - * timer T303 start - *---------------------------------------------------------------------------*/ -void -T303_start(call_desc_t *cd) -{ - if (cd->T303 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T303 = TIMER_ACTIVE; - - START_TIMER(cd->T303_callout, T303_timeout, cd, T303VAL); -} - -/*---------------------------------------------------------------------------* - * timer T303 stop - *---------------------------------------------------------------------------*/ -void -T303_stop(call_desc_t *cd) -{ - CRIT_VAR; - CRIT_BEG; - - if(cd->T303 != TIMER_IDLE) - { - STOP_TIMER(cd->T303_callout, T303_timeout, cd); - cd->T303 = TIMER_IDLE; - } - CRIT_END; - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T305 timeout function - *---------------------------------------------------------------------------*/ -static void -T305_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "DISC not answered, cr = %d", cd->cr); - next_l3state(cd, EV_T305EXP); -} - -/*---------------------------------------------------------------------------* - * timer T305 start - *---------------------------------------------------------------------------*/ -void -T305_start(call_desc_t *cd) -{ - if (cd->T305 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T305 = TIMER_ACTIVE; - - START_TIMER(cd->T305_callout, T305_timeout, cd, T305VAL); -} - -/*---------------------------------------------------------------------------* - * timer T305 stop - *---------------------------------------------------------------------------*/ -void -T305_stop(call_desc_t *cd) -{ - CRIT_VAR; - CRIT_BEG; - - if(cd->T305 != TIMER_IDLE) - { - STOP_TIMER(cd->T305_callout, T305_timeout, cd); - cd->T305 = TIMER_IDLE; - } - CRIT_END; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T308 timeout function - *---------------------------------------------------------------------------*/ -static void -T308_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "REL not answered, cr = %d", cd->cr); - next_l3state(cd, EV_T308EXP); -} - -/*---------------------------------------------------------------------------* - * timer T308 start - *---------------------------------------------------------------------------*/ -void -T308_start(call_desc_t *cd) -{ - if(cd->T308 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T308 = TIMER_ACTIVE; - - START_TIMER(cd->T308_callout, T308_timeout, cd, T308VAL); -} - -/*---------------------------------------------------------------------------* - * timer T308 stop - *---------------------------------------------------------------------------*/ -void -T308_stop(call_desc_t *cd) -{ - CRIT_VAR; - CRIT_BEG; - - if(cd->T308 != TIMER_IDLE) - { - STOP_TIMER(cd->T308_callout, T308_timeout, cd); - cd->T308 = TIMER_IDLE; - } - CRIT_END; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T309 timeout function - *---------------------------------------------------------------------------*/ -static void -T309_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "datalink not reconnected, cr = %d", cd->cr); - next_l3state(cd, EV_T309EXP); -} - -/*---------------------------------------------------------------------------* - * timer T309 start - *---------------------------------------------------------------------------*/ -void -T309_start(call_desc_t *cd) -{ - if (cd->T309 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T309 = TIMER_ACTIVE; - - START_TIMER(cd->T309_callout, T309_timeout, cd, T309VAL); -} - -/*---------------------------------------------------------------------------* - * timer T309 stop - *---------------------------------------------------------------------------*/ -void -T309_stop(call_desc_t *cd) -{ - CRIT_VAR; - CRIT_BEG; - - if(cd->T309 != TIMER_IDLE) - { - STOP_TIMER(cd->T309_callout, T309_timeout, cd); - cd->T309 = TIMER_IDLE; - } - CRIT_END; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T310 timeout function - *---------------------------------------------------------------------------*/ -static void -T310_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "CALL PROC timeout, cr = %d", cd->cr); - next_l3state(cd, EV_T310EXP); -} - -/*---------------------------------------------------------------------------* - * timer T310 start - *---------------------------------------------------------------------------*/ -void -T310_start(call_desc_t *cd) -{ - if (cd->T310 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T310 = TIMER_ACTIVE; - - START_TIMER(cd->T310_callout, T310_timeout, cd, T310VAL); -} - -/*---------------------------------------------------------------------------* - * timer T310 stop - *---------------------------------------------------------------------------*/ -void -T310_stop(call_desc_t *cd) -{ - CRIT_VAR; - CRIT_BEG; - - if(cd->T310 != TIMER_IDLE) - { - STOP_TIMER(cd->T310_callout, T310_timeout, cd); - cd->T310 = TIMER_IDLE; - } - CRIT_END; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T313 timeout function - *---------------------------------------------------------------------------*/ -static void -T313_timeout(call_desc_t *cd) -{ - NDBGL3(L3_T_ERR, "CONN ACK not received, cr = %d", cd->cr); - next_l3state(cd, EV_T313EXP); -} - -/*---------------------------------------------------------------------------* - * timer T313 start - *---------------------------------------------------------------------------*/ -void -T313_start(call_desc_t *cd) -{ - if (cd->T313 == TIMER_ACTIVE) - return; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); - cd->T313 = TIMER_ACTIVE; - - START_TIMER(cd->T313_callout, T313_timeout, cd, T313VAL); -} - -/*---------------------------------------------------------------------------* - * timer T313 stop - *---------------------------------------------------------------------------*/ -void -T313_stop(call_desc_t *cd) -{ - CRIT_VAR; - CRIT_BEG; - - if(cd->T313 != TIMER_IDLE) - { - cd->T313 = TIMER_IDLE; - STOP_TIMER(cd->T313_callout, T313_timeout, cd); - } - CRIT_END; - - NDBGL3(L3_T_MSG, "cr = %d", cd->cr); -} diff --git a/sys/i4b/layer3/i4b_l4if.c b/sys/i4b/layer3/i4b_l4if.c deleted file mode 100644 index e2acee36085d..000000000000 --- a/sys/i4b/layer3/i4b_l4if.c +++ /dev/null @@ -1,322 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l4if.c - Layer 3 interface to Layer 4 - * ------------------------------------------- - * last edit-date: [Sat Mar 9 19:36:08 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -extern void isic_settrace(int unit, int val); /*XXX*/ -extern int isic_gettrace(int unit); /*XXX*/ - -static void n_connect_request(u_int cdid); -static void n_connect_response(u_int cdid, int response, int cause); -static void n_disconnect_request(u_int cdid, int cause); -static void n_alert_request(u_int cdid); -static void n_mgmt_command(int unit, int cmd, void *parm); - -/*---------------------------------------------------------------------------* - * i4b_mdl_status_ind - status indication from lower layers - *---------------------------------------------------------------------------*/ -int -i4b_mdl_status_ind(int unit, int status, int parm) -{ - int sendup; - int i; - - NDBGL3(L3_MSG, "unit = %d, status = %d, parm = %d", unit, status, parm); - - switch(status) - { - case STI_ATTACH: - NDBGL3(L3_MSG, "STI_ATTACH: attaching unit %d to controller %d", unit, nctrl); - - /* init function pointers */ - - ctrl_desc[nctrl].N_CONNECT_REQUEST = n_connect_request; - ctrl_desc[nctrl].N_CONNECT_RESPONSE = n_connect_response; - ctrl_desc[nctrl].N_DISCONNECT_REQUEST = n_disconnect_request; - ctrl_desc[nctrl].N_ALERT_REQUEST = n_alert_request; - ctrl_desc[nctrl].N_DOWNLOAD = NULL; /* only used by active cards */ - ctrl_desc[nctrl].N_DIAGNOSTICS = NULL; /* only used by active cards */ - ctrl_desc[nctrl].N_MGMT_COMMAND = n_mgmt_command; - - /* init type and unit */ - - ctrl_desc[nctrl].unit = unit; - ctrl_desc[nctrl].ctrl_type = CTRL_PASSIVE; - ctrl_desc[nctrl].card_type = parm; - - /* state fields */ - - ctrl_desc[nctrl].dl_est = DL_DOWN; - ctrl_desc[nctrl].nbch = 2; /* XXX extra param? */ - for (i = 0; i < ctrl_desc[nctrl].nbch; i++) - ctrl_desc[nctrl].bch_state[i] = BCH_ST_FREE; - - ctrl_desc[nctrl].tei = -1; - - /* init unit to controller table */ - - utoc_tab[unit] = nctrl; - - /* increment no. of controllers */ - - nctrl++; - - break; - - case STI_L1STAT: - i4b_l4_l12stat(unit, 1, parm); - NDBGL3(L3_MSG, "STI_L1STAT: unit %d layer 1 = %s", unit, status ? "up" : "down"); - break; - - case STI_L2STAT: - i4b_l4_l12stat(unit, 2, parm); - NDBGL3(L3_MSG, "STI_L2STAT: unit %d layer 2 = %s", unit, status ? "up" : "down"); - break; - - case STI_TEIASG: - ctrl_desc[unit].tei = parm; - i4b_l4_teiasg(unit, parm); - NDBGL3(L3_MSG, "STI_TEIASG: unit %d TEI = %d = 0x%02x", unit, parm, parm); - break; - - case STI_PDEACT: /* L1 T4 timeout */ - NDBGL3(L3_ERR, "STI_PDEACT: unit %d TEI = %d = 0x%02x", unit, parm, parm); - - sendup = 0; - - for(i=0; i < N_CALL_DESC; i++) - { - if( (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[call_desc[i].controller].unit == unit)) - { - i4b_l3_stop_all_timers(&(call_desc[i])); - if(call_desc[i].cdid != CDID_UNUSED) - sendup++; - } - } - - ctrl_desc[utoc_tab[unit]].dl_est = DL_DOWN; - for (i = 0; i < ctrl_desc[utoc_tab[unit]].nbch; i++) - ctrl_desc[utoc_tab[unit]].bch_state[i] = BCH_ST_FREE; - ctrl_desc[utoc_tab[unit]].tei = -1; - - if(sendup) - { - i4b_l4_pdeact(unit, sendup); - call_desc[i].cdid = CDID_UNUSED; - } - break; - - case STI_NOL1ACC: /* no outgoing access to S0 */ - NDBGL3(L3_ERR, "STI_NOL1ACC: unit %d no outgoing access to S0", unit); - - for(i=0; i < N_CALL_DESC; i++) - { - if( (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[call_desc[i].controller].unit == unit)) - { - if(call_desc[i].cdid != CDID_UNUSED) - { - SET_CAUSE_TYPE(call_desc[i].cause_in, CAUSET_I4B); - SET_CAUSE_VAL(call_desc[i].cause_in, CAUSE_I4B_L1ERROR); - i4b_l4_disconnect_ind(&(call_desc[i])); - } - } - } - - ctrl_desc[utoc_tab[unit]].dl_est = DL_DOWN; - for (i = 0; i < ctrl_desc[utoc_tab[unit]].nbch; i++) - ctrl_desc[utoc_tab[unit]].bch_state[i] = BCH_ST_FREE; - ctrl_desc[utoc_tab[unit]].tei = -1; - break; - - default: - NDBGL3(L3_ERR, "ERROR, unit %d, unknown status value %d!", unit, status); - break; - } - return(0); -} - -/*---------------------------------------------------------------------------* - * send command to the lower layers - *---------------------------------------------------------------------------*/ -static void -n_mgmt_command(int unit, int cmd, void *parm) -{ - int i; - - switch(cmd) - { - case CMR_DOPEN: - NDBGL3(L3_MSG, "CMR_DOPEN for unit %d", unit); - - for(i=0; i < N_CALL_DESC; i++) - { - if( (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[call_desc[i].controller].unit == unit)) - { - call_desc[i].cdid = CDID_UNUSED; - } - } - - ctrl_desc[utoc_tab[unit]].dl_est = DL_DOWN; - for (i = 0; i < ctrl_desc[utoc_tab[unit]].nbch; i++) - ctrl_desc[utoc_tab[unit]].bch_state[i] = BCH_ST_FREE; - ctrl_desc[utoc_tab[unit]].tei = -1; - break; - - case CMR_DCLOSE: - NDBGL3(L3_MSG, "CMR_DCLOSE for unit %d", unit); - break; - - case CMR_SETTRACE: - NDBGL3(L3_MSG, "CMR_SETTRACE for unit %d", unit); - break; - - default: - NDBGL3(L3_MSG, "unknown cmd %d for unit %d", cmd, unit); - break; - } - - MDL_Command_Req(unit, cmd, parm); - -} - -/*---------------------------------------------------------------------------* - * handle connect request message from userland - *---------------------------------------------------------------------------*/ -static void -n_connect_request(u_int cdid) -{ - call_desc_t *cd; - - cd = cd_by_cdid(cdid); - - next_l3state(cd, EV_SETUPRQ); -} - -/*---------------------------------------------------------------------------* - * handle setup response message from userland - *---------------------------------------------------------------------------*/ -static void -n_connect_response(u_int cdid, int response, int cause) -{ - call_desc_t *cd; - int chstate; - - cd = cd_by_cdid(cdid); - - T400_stop(cd); - - cd->response = response; - cd->cause_out = cause; - - switch(response) - { - case SETUP_RESP_ACCEPT: - next_l3state(cd, EV_SETACRS); - chstate = BCH_ST_USED; - break; - - case SETUP_RESP_REJECT: - next_l3state(cd, EV_SETRJRS); - chstate = BCH_ST_FREE; - break; - - case SETUP_RESP_DNTCRE: - next_l3state(cd, EV_SETDCRS); - chstate = BCH_ST_FREE; - break; - - default: /* failsafe */ - next_l3state(cd, EV_SETDCRS); - chstate = BCH_ST_FREE; - NDBGL3(L3_ERR, "unknown response, doing SETUP_RESP_DNTCRE"); - break; - } - - if((cd->channelid >= 0) && (cd->channelid < ctrl_desc[cd->controller].nbch)) - { - ctrl_desc[cd->controller].bch_state[cd->channelid] = chstate; - } - else - { - NDBGL3(L3_MSG, "Warning, invalid channelid %d, response = %d\n", cd->channelid, response); - } -} - -/*---------------------------------------------------------------------------* - * handle disconnect request message from userland - *---------------------------------------------------------------------------*/ -static void -n_disconnect_request(u_int cdid, int cause) -{ - call_desc_t *cd; - - cd = cd_by_cdid(cdid); - - cd->cause_out = cause; - - next_l3state(cd, EV_DISCRQ); -} - -/*---------------------------------------------------------------------------* - * handle alert request message from userland - *---------------------------------------------------------------------------*/ -static void -n_alert_request(u_int cdid) -{ - call_desc_t *cd; - - cd = cd_by_cdid(cdid); - - next_l3state(cd, EV_ALERTRQ); -} diff --git a/sys/i4b/layer3/i4b_q931.c b/sys/i4b/layer3/i4b_q931.c deleted file mode 100644 index 3f1eb2b9d8a7..000000000000 --- a/sys/i4b/layer3/i4b_q931.c +++ /dev/null @@ -1,714 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_q931.c - Q931 received messages handling - * -------------------------------------------- - * last edit-date: [Sun Aug 11 19:18:08 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -unsigned int i4b_l3_debug = L3_DEBUG_DEFAULT; - -ctrl_desc_t ctrl_desc[MAX_CONTROLLERS]; /* controller description array */ -int utoc_tab[MAX_CONTROLLERS]; /* unit to controller conversion */ - -/* protocol independent causes -> Q.931 causes */ - -unsigned char cause_tab_q931[CAUSE_I4B_MAX] = { - CAUSE_Q850_NCCLR, /* CAUSE_I4B_NORMAL -> normal call clearing */ - CAUSE_Q850_USRBSY, /* CAUSE_I4B_BUSY -> user busy */ - CAUSE_Q850_NOCAVAIL, /* CAUSE_I4B_NOCHAN -> no circuit/channel available*/ - CAUSE_Q850_INCDEST, /* CAUSE_I4B_INCOMP -> incompatible destination */ - CAUSE_Q850_CALLREJ, /* CAUSE_I4B_REJECT -> call rejected */ - CAUSE_Q850_DSTOOORDR, /* CAUSE_I4B_OOO -> destination out of order */ - CAUSE_Q850_TMPFAIL, /* CAUSE_I4B_TMPFAIL -> temporary failure */ - CAUSE_Q850_USRBSY, /* CAUSE_I4B_L1ERROR -> L1 error / persistent deact XXX */ - CAUSE_Q850_USRBSY, /* CAUSE_I4B_LLDIAL -> no dialout on leased line XXX */ -}; - -/*---------------------------------------------------------------------------* - * setup cr ref flag according to direction - *---------------------------------------------------------------------------*/ -unsigned char -setup_cr(call_desc_t *cd, unsigned char cr) -{ - if(cd->crflag == CRF_ORIG) - return(cr & 0x7f); /* clear cr ref flag */ - else if(cd->crflag == CRF_DEST) - return(cr | 0x80); /* set cr ref flag */ - else - panic("setup_cr: invalid crflag!\n"); -} - -/*---------------------------------------------------------------------------* - * decode and process a Q.931 message - *---------------------------------------------------------------------------*/ -void -i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr) -{ - call_desc_t *cd; - int codeset = CODESET_0; - int old_codeset = CODESET_0; - int shift_flag = UNSHIFTED; - int crlen = 0; - int crval = 0; - int crflag = 0; - int i; - int offset; - int s; - - /* check protocol discriminator */ - - if(*msg_ptr != PD_Q931) - { - static int protoflag = -1; /* print only once .. */ - - if(*msg_ptr != protoflag) - { - NDBGL3(L3_P_ERR, "unknown protocol discriminator 0x%x!", *msg_ptr); - protoflag = *msg_ptr; - } - return; - } - - msg_ptr++; - msg_len--; - - s = SPLI4B(); /* this has to be protected ! */ - - /* extract call reference */ - - crlen = *msg_ptr & CRLENGTH_MASK; - msg_ptr++; - msg_len--; - - if(crlen != 0) - { - crval += *msg_ptr & 0x7f; - crflag = (*msg_ptr >> 7) & 0x01; - msg_ptr++; - msg_len--; - - for(i=1; i < crlen; i++) - { - crval += *msg_ptr; - msg_ptr++; - msg_len--; - } - } - else - { - crval = 0; - crflag = 0; - } - - NDBGL3(L3_P_MSG, "Call Ref, len %d, val %d, flag %d", crlen, crval, crflag); - - /* find or allocate calldescriptor */ - - if((cd = cd_by_unitcr(unit, crval, - crflag == CRF_DEST ? CRF_ORIG : CRF_DEST)) == NULL) - { - if(*msg_ptr == SETUP) - { - /* get and init new calldescriptor */ - - cd = reserve_cd(); /* cdid filled in */ - cd->controller = utoc_tab[unit]; - cd->cr = crval; - cd->crflag = CRF_DEST; /* we are the dest side */ - cd->ilt = NULL; /* reset link tab ptrs */ - cd->dlt = NULL; - } - else - { -/*XXX*/ if(crval != 0) /* ignore global call references */ - { - NDBGL3(L3_P_ERR, "cannot find calldescriptor for cr = 0x%x, crflag = 0x%x, msg = 0x%x, frame = ", crval, crflag, *msg_ptr); - i4b_print_frame(msg_len, msg_ptr); - } - splx(s); - return; - } - } - - splx(s); - - /* decode and handle message type */ - - i4b_decode_q931_message(unit, cd, *msg_ptr); - msg_ptr++; - msg_len--; - - /* process information elements */ - - while(msg_len > 0) - { - /* check for shift codeset IE */ - - if((*msg_ptr & 0x80) && ((*msg_ptr & 0xf0) == SOIE_SHIFT)) - { - if(!(*msg_ptr & SHIFT_LOCK)) - shift_flag = SHIFTED; - - old_codeset = codeset; - codeset = *msg_ptr & CODESET_MASK; - - if((shift_flag != SHIFTED) && - (codeset <= old_codeset)) - { - NDBGL3(L3_P_ERR, "Q.931 lockingshift proc violation, shift %d -> %d", old_codeset, codeset); - codeset = old_codeset; - } - msg_len--; - msg_ptr++; - } - - /* process one IE for selected codeset */ - - switch(codeset) - { - case CODESET_0: - offset = i4b_decode_q931_cs0_ie(unit, cd, msg_len, msg_ptr); - msg_len -= offset; - msg_ptr += offset; - break; - - default: - NDBGL3(L3_P_ERR, "unknown codeset %d, ", codeset); - i4b_print_frame(msg_len, msg_ptr); - msg_len = 0; - break; - } - - /* check for non-locking shifts */ - - if(shift_flag == SHIFTED) - { - shift_flag = UNSHIFTED; - codeset = old_codeset; - } - } - next_l3state(cd, cd->event); -} - -/*---------------------------------------------------------------------------* - * decode and process one Q.931 codeset 0 information element - *---------------------------------------------------------------------------*/ -int -i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr) -{ - int i, j; - char *p; - - switch(*msg_ptr) - { - -/*********/ -/* Q.931 */ -/*********/ - /* single byte IE's */ - - case IEI_SENDCOMPL: - NDBGL3(L3_P_MSG, "IEI_SENDCOMPL"); - return(1); - break; - - /* multi byte IE's */ - - case IEI_SEGMMSG: /* segmented message */ - NDBGL3(L3_P_MSG, "IEI_SEGMENTED_MESSAGE"); - break; - - case IEI_BEARERCAP: /* bearer capability */ - switch(msg_ptr[2]) - { - case 0x80: /* speech */ - case 0x89: /* restricted digital info */ - case 0x90: /* 3.1KHz audio */ -/* XXX */ cd->bprot = BPROT_NONE; - NDBGL3(L3_P_MSG, "IEI_BEARERCAP - Telephony"); - break; - - case 0x88: /* unrestricted digital info */ -/* XXX */ cd->bprot = BPROT_RHDLC; - NDBGL3(L3_P_MSG, "IEI_BEARERCAP - Raw HDLC"); - break; - - default: -/* XXX */ cd->bprot = BPROT_NONE; - NDBGL3(L3_P_ERR, "IEI_BEARERCAP - Unsupported B-Protocol 0x%x", msg_ptr[2]); - break; - } - break; - - case IEI_CAUSE: /* cause */ - if(msg_ptr[2] & 0x80) - { - cd->cause_in = msg_ptr[3] & 0x7f; - NDBGL3(L3_P_MSG, "IEI_CAUSE = %d", msg_ptr[3] & 0x7f); - } - else - { - cd->cause_in = msg_ptr[4] & 0x7f; - NDBGL3(L3_P_MSG, "IEI_CAUSE = %d", msg_ptr[4] & 0x7f); - } - break; - - case IEI_CALLID: /* call identity */ - NDBGL3(L3_P_MSG, "IEI_CALL_IDENTITY"); - break; - - case IEI_CALLSTATE: /* call state */ - cd->call_state = msg_ptr[2] & 0x3f; - NDBGL3(L3_P_MSG, "IEI_CALLSTATE = %d", cd->call_state); - break; - - case IEI_CHANNELID: /* channel id */ - if((msg_ptr[2] & 0xf4) != 0x80) - { - cd->channelid = CHAN_NO; - NDBGL3(L3_P_ERR, "IEI_CHANNELID, unsupported value 0x%x", msg_ptr[2]); - } - else - { - switch(msg_ptr[2] & 0x03) - { - case IE_CHAN_ID_NO: - cd->channelid = CHAN_NO; - break; - case IE_CHAN_ID_B1: - cd->channelid = CHAN_B1; - break; - case IE_CHAN_ID_B2: - cd->channelid = CHAN_B2; - break; - case IE_CHAN_ID_ANY: - cd->channelid = CHAN_ANY; - break; - } - cd->channelexcl = (msg_ptr[2] & 0x08) >> 3; - - NDBGL3(L3_P_MSG, "IEI_CHANNELID - channel %d, exclusive = %d", cd->channelid, cd->channelexcl); - - /* if this is a setup message, reserve channel */ - - if(cd->event == EV_SETUP) - { - if((cd->channelid == CHAN_B1) || (cd->channelid == CHAN_B2)) - { - if(ctrl_desc[cd->controller].bch_state[cd->channelid] == BCH_ST_FREE) - ctrl_desc[cd->controller].bch_state[cd->channelid] = BCH_ST_RSVD; - else - NDBGL3(L3_P_ERR, "IE ChannelID, Channel NOT free!!"); - } - else if(cd->channelid == CHAN_NO) - { - NDBGL3(L3_P_MSG, "IE ChannelID, SETUP with channel = No channel (CW)"); - } - else /* cd->channelid == CHAN_ANY */ - { - NDBGL3(L3_P_ERR, "ERROR: IE ChannelID, SETUP with channel = Any channel!"); - } - } - } - break; - - case IEI_PROGRESSI: /* progress indicator */ - NDBGL3(L3_P_MSG, "IEI_PROGRESSINDICATOR"); - break; - - case IEI_NETSPCFAC: /* network specific fac */ - NDBGL3(L3_P_MSG, "IEI_NETSPCFAC"); - break; - - case IEI_NOTIFIND: /* notification indicator */ - NDBGL3(L3_P_MSG, "IEI_NOTIFICATION_INDICATOR"); - break; - - case IEI_DISPLAY: /* display */ - memcpy(cd->display, &msg_ptr[2], min(DISPLAY_MAX, msg_ptr[1])); - cd->display[min(DISPLAY_MAX, msg_ptr[1])] = '\0'; - NDBGL3(L3_P_MSG, "IEI_DISPLAY = %s", cd->display); - break; - - case IEI_DATETIME: /* date/time */ - i = 2; - j = msg_ptr[1]; - p = &(cd->datetime[0]); - *p = '\0'; - - for(j = msg_ptr[1]; j > 0; j--, i++) - sprintf(p+strlen(p), "%02d", msg_ptr[i]); - - NDBGL3(L3_P_MSG, "IEI_DATETIME = %s", cd->datetime); - break; - - case IEI_KEYPAD: /* keypad facility */ - NDBGL3(L3_P_MSG, "IEI_KEYPAD_FACILITY"); - break; - - case IEI_SIGNAL: /* signal type */ - NDBGL3(L3_P_MSG, "IEI_SIGNAL = %d", msg_ptr[2]); - break; - - case IEI_INFRATE: /* information rate */ - NDBGL3(L3_P_MSG, "IEI_INFORMATION_RATE"); - break; - - case IEI_ETETDEL: /* end to end transit delay */ - NDBGL3(L3_P_MSG, "IEI_END_TO_END_TRANSIT_DELAY"); - break; - - case IEI_CUG: /* closed user group */ - NDBGL3(L3_P_MSG, "IEI_CLOSED_USER_GROUP"); - break; - - case IEI_CALLINGPN: /* calling party no */ - if(msg_ptr[2] & 0x80) /* no presentation/screening indicator ? */ - { - memcpy(cd->src_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1)); - cd->src_telno[min(TELNO_MAX, msg_ptr[1] - 1)] = '\0'; - cd->scr_ind = SCR_NONE; - cd->prs_ind = PRS_NONE; - } - else - { - memcpy(cd->src_telno, &msg_ptr[4], min(TELNO_MAX, msg_ptr[1]-2)); - cd->src_telno[min(TELNO_MAX, msg_ptr[1] - 2)] = '\0'; - cd->scr_ind = (msg_ptr[3] & 0x03) + SCR_USR_NOSC; - cd->prs_ind = ((msg_ptr[3] >> 5) & 0x03) + PRS_ALLOWED; - } - - /* type of number (source) */ - switch ((msg_ptr[2] & 0x70) >> 4) - { - case 1: - cd->src_ton = TON_INTERNAT; - break; - case 2: - cd->src_ton = TON_NATIONAL; - break; - default: - cd->src_ton = TON_OTHER; - break; - } - NDBGL3(L3_P_MSG, "IEI_CALLINGPN = %s", cd->src_telno); - break; - - case IEI_CALLINGPS: /* calling party subaddress */ - memcpy(cd->src_subaddr, &msg_ptr[3], min(SUBADDR_MAX, msg_ptr[1]-1)); - cd->src_subaddr[min(SUBADDR_MAX, msg_ptr[1] - 1)] = '\0'; - NDBGL3(L3_P_MSG, "IEI_CALLINGPS = %s", cd->src_subaddr); - break; - - case IEI_CALLEDPN: /* called party number */ - memcpy(cd->dst_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1)); - cd->dst_telno[min(TELNO_MAX, msg_ptr[1] - 1)] = '\0'; - - /* type of number (destination) */ - switch ((msg_ptr[2] & 0x70) >> 4) - { - case 1: - cd->dst_ton = TON_INTERNAT; - break; - case 2: - cd->dst_ton = TON_NATIONAL; - break; - default: - cd->dst_ton = TON_OTHER; - break; - } - - NDBGL3(L3_P_MSG, "IEI_CALLED = %s", cd->dst_telno); - break; - - case IEI_CALLEDPS: /* called party subaddress */ - memcpy(cd->dst_subaddr, &msg_ptr[3], min(SUBADDR_MAX, msg_ptr[1]-1)); - cd->dst_subaddr[min(SUBADDR_MAX, msg_ptr[1] - 1)] = '\0'; - NDBGL3(L3_P_MSG, "IEI_CALLEDPS = %s", cd->dst_subaddr); - break; - - case IEI_REDIRNO: /* redirecting number */ - NDBGL3(L3_P_MSG, "IEI_REDIRECTING_NUMBER"); - break; - - case IEI_TRNSEL: /* transit network selection */ - NDBGL3(L3_P_MSG, "IEI_TRANSIT_NETWORK_SELECTION"); - break; - - case IEI_RESTARTI: /* restart indicator */ - NDBGL3(L3_P_MSG, "IEI_RESTART_INDICATOR"); - break; - - case IEI_LLCOMPAT: /* low layer compat */ - NDBGL3(L3_P_MSG, "IEI_LLCOMPAT"); - break; - - case IEI_HLCOMPAT: /* high layer compat */ - NDBGL3(L3_P_MSG, "IEI_HLCOMPAT"); - break; - - case IEI_USERUSER: /* user-user */ - NDBGL3(L3_P_MSG, "IEI_USER_USER"); - break; - - case IEI_ESCAPE: /* escape for extension */ - NDBGL3(L3_P_MSG, "IEI_ESCAPE"); - break; - -/*********/ -/* Q.932 */ -/*********/ - case IEI_FACILITY: /* facility */ - NDBGL3(L3_P_MSG, "IEI_FACILITY"); - if(i4b_aoc(msg_ptr, cd) > -1) - i4b_l4_charging_ind(cd); - break; - -/*********/ -/* Q.95x */ -/*********/ - case IEI_CONCTDNO: /* connected number */ - NDBGL3(L3_P_MSG, "IEI_CONCTDNO"); - break; - - - default: - NDBGL3(L3_P_ERR, "Unknown IE %d - ", *msg_ptr); - i4b_print_frame(msg_ptr[1]+2, msg_ptr); - break; - } - return(msg_ptr[1] + 2); -} - -/*---------------------------------------------------------------------------* - * decode and process one Q.931 codeset 0 information element - *---------------------------------------------------------------------------*/ -void -i4b_decode_q931_message(int unit, call_desc_t *cd, u_char message_type) -{ - char *m = NULL; - - cd->event = EV_ILL; - - switch(message_type) - { - /* call establishment */ - - case ALERT: - cd->event = EV_ALERT; - m = "ALERT"; - break; - - case CALL_PROCEEDING: - cd->event = EV_CALLPRC; - m = "CALL_PROCEEDING"; - break; - - case PROGRESS: - cd->event = EV_PROGIND; - m = "PROGRESS"; - break; - - case SETUP: - m = "SETUP"; - cd->bprot = BPROT_NONE; - cd->cause_in = 0; - cd->cause_out = 0; - cd->dst_telno[0] = '\0'; - cd->src_telno[0] = '\0'; - cd->channelid = CHAN_NO; - cd->channelexcl = 0; - cd->display[0] = '\0'; - cd->datetime[0] = '\0'; - cd->event = EV_SETUP; - break; - - case CONNECT: - m = "CONNECT"; - cd->datetime[0] = '\0'; - cd->event = EV_CONNECT; - break; - - case SETUP_ACKNOWLEDGE: - m = "SETUP_ACKNOWLEDGE"; - cd->event = EV_SETUPAK; - break; - - case CONNECT_ACKNOWLEDGE: - m = "CONNECT_ACKNOWLEDGE"; - cd->event = EV_CONACK; - break; - - /* call information */ - - case USER_INFORMATION: - m = "USER_INFORMATION"; - break; - - case SUSPEND_REJECT: - m = "SUSPEND_REJECT"; - break; - - case RESUME_REJECT: - m = "RESUME_REJECT"; - break; - - case HOLD: - m = "HOLD"; - break; - - case SUSPEND: - m = "SUSPEND"; - break; - - case RESUME: - m = "RESUME"; - break; - - case HOLD_ACKNOWLEDGE: - m = "HOLD_ACKNOWLEDGE"; - break; - - case SUSPEND_ACKNOWLEDGE: - m = "SUSPEND_ACKNOWLEDGE"; - break; - - case RESUME_ACKNOWLEDGE: - m = "RESUME_ACKNOWLEDGE"; - break; - - case HOLD_REJECT: - m = "HOLD_REJECT"; - break; - - case RETRIEVE: - m = "RETRIEVE"; - break; - - case RETRIEVE_ACKNOWLEDGE: - m = "RETRIEVE_ACKNOWLEDGE"; - break; - - case RETRIEVE_REJECT: - m = "RETRIEVE_REJECT"; - break; - - /* call clearing */ - - case DISCONNECT: - m = "DISCONNECT"; - cd->event = EV_DISCONN; - break; - - case RESTART: - m = "RESTART"; - break; - - case RELEASE: - m = "RELEASE"; - cd->event = EV_RELEASE; - break; - - case RESTART_ACKNOWLEDGE: - m = "RESTART_ACKNOWLEDGE"; - break; - - case RELEASE_COMPLETE: - m = "RELEASE_COMPLETE"; - cd->event = EV_RELCOMP; - break; - - /* misc messages */ - - case SEGMENT: - m = "SEGMENT"; - break; - - case FACILITY: - m = "FACILITY"; - cd->event = EV_FACILITY; - break; - - case REGISTER: - m = "REGISTER"; - break; - - case NOTIFY: - m = "NOTIFY"; - break; - - case STATUS_ENQUIRY: - m = "STATUS_ENQUIRY"; - cd->event = EV_STATENQ; - break; - - case CONGESTION_CONTROL: - m = "CONGESTION_CONTROL"; - break; - - case INFORMATION: - m = "INFORMATION"; - cd->event = EV_INFO; - break; - - case STATUS: - m = "STATUS"; - cd->event = EV_STATUS; - break; - - default: - NDBGL3(L3_P_ERR, "unit %d, cr = 0x%02x, msg = 0x%02x", unit, cd->cr, message_type); - break; - } - if(m) - { - NDBGL3(L3_PRIM, "%s: unit %d, cr = 0x%02x\n", m, unit, cd->cr); - } -} diff --git a/sys/i4b/layer3/i4b_q931.h b/sys/i4b/layer3/i4b_q931.h deleted file mode 100644 index 99dc6efaffb3..000000000000 --- a/sys/i4b/layer3/i4b_q931.h +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_q931.h - Q931 handling header file - * -------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Tue Mar 26 15:04:33 2002] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_Q931_H_ -#define _I4B_Q931_H_ - -/* extension bit */ - -#define EXT_LAST 0x80 /* last octett */ - -/* reserve space in mbuf */ - -#define I_FRAME_HDRLEN 4 /* to be added by layer 2 */ - -/* SHIFT */ - -#define CODESET_MASK 0x07 -#define UNSHIFTED 0 -#define SHIFTED 1 -#define CRLENGTH_MASK 0x0f - -/* CONNECT */ - -#define MSG_CONNECT_LEN 4 /* length of a connect message */ - -/* DISCONNECT */ - -#define MSG_DISCONNECT_LEN 8 /* length of a disconnect message */ - -/* RELEASE COMPLETE */ - -#define MSG_RELEASE_COMPLETE_LEN 8 /* length of release complete msg */ - -/* for outgoing causes */ - -#define CAUSE_LEN 2 -#define CAUSE_STD_LOC_OUT 0x80 /* std = CCITT, loc = user */ - -/* SETUP */ - -#define MSG_SETUP_LEN 12 /* without called party, */ - /* calling party and */ - /* keypad facility ! */ - -#define IEI_BEARERCAP_LEN 2 /* 2 octetts length */ - -#define IT_CAP_SPEECH 0x80 /* BC: information xfer capability */ -#define IT_CAP_UNR_DIG_INFO 0x88 /* BC: information xfer capability */ - -#define IT_RATE_64K 0x90 /* BC: information xfer rate */ -#define IT_UL1_G711A 0xa3 /* layer1 proto G.711 A-law */ - -#define IEI_CHANNELID_LEN 0x01 /* length of channel id */ -#define CHANNELID_B1 0x81 /* channel = B1 (outgoing) */ -#define CHANNELID_B2 0x82 /* channel = B2 (outgoing) */ -#define CHANNELID_ANY 0x83 /* channel = any channel (outgoing) */ - -#define IE_CHAN_ID_NO 0x00 /* no channel (incoming) */ -#define IE_CHAN_ID_B1 0x01 /* B1 channel (incoming) */ -#define IE_CHAN_ID_B2 0x02 /* B2 channel (incoming) */ -#define IE_CHAN_ID_ANY 0x03 /* ANY channel (incoming) */ - -#define NUMBER_TYPEPLAN 0x81 /* type of number/numbering plan */ - -#define IEI_CALLINGPN_LEN 1 /* without number string ! */ -#define IEI_CALLEDPN_LEN 1 /* without number string ! */ - -#define IEI_CALLINGPS_LEN 1 -#define IEI_CALLEDPS_LEN 1 - -#define SUBADDR_TYPE_NSAP 0x80 /* subaddr: type=NSAP */ - -/* CONNECT_ACK */ - -#define MSG_CONNECT_ACK_LEN 4 /* length of a connect ack message */ - -/* STATUS */ - -#define MSG_STATUS_LEN 11 -#define CALLSTATE_LEN 1 - -/* RELEASE */ - -#define MSG_RELEASE_LEN 8 /* length of release msg */ - -/* ALERT */ - -#define MSG_ALERT_LEN 4 /* length of an alert message */ - -#endif /* _I4B_Q931_H_ */ - -/* EOF */ diff --git a/sys/i4b/layer3/i4b_q932fac.c b/sys/i4b/layer3/i4b_q932fac.c deleted file mode 100644 index 22a2f9f16f13..000000000000 --- a/sys/i4b/layer3/i4b_q932fac.c +++ /dev/null @@ -1,541 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_q932fac.c - Q932 facility handling - * -------------------------------------- - * last edit-date: [Sat Mar 9 19:37:29 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -static int do_component(int length); -static void next_state(int class, int form, int code, int val); - -static int byte_len; -static unsigned char *byte_buf; -static int state; - -static int units; -static int operation_value; - -/*---------------------------------------------------------------------------* - * decode Q.931/Q.932 facility info element - *---------------------------------------------------------------------------*/ -int -i4b_aoc(unsigned char *buf, call_desc_t *cd) -{ - int len; - - cd->units_type = CHARGE_INVALID; - cd->units = -1; - - buf++; /* length */ - - len = *buf; - - buf++; /* protocol profile */ - - switch(*buf & 0x1f) - { - case FAC_PROTO_ROP: - break; - - case FAC_PROTO_CMIP: - NDBGL3(L3_A_MSG, "CMIP Protocol (Q.941), UNSUPPORTED"); - return(-1); - break; - - case FAC_PROTO_ACSE: - NDBGL3(L3_A_MSG, "ACSE Protocol (X.217/X.227), UNSUPPORTED!"); - return(-1); - break; - - default: - NDBGL3(L3_A_ERR, "Unknown Protocol, UNSUPPORTED!"); - return(-1); - break; - } - - NDBGL3(L3_A_MSG, "Remote Operations Protocol"); - - /* next byte */ - - buf++; - len--; - - /* initialize variables for do_component */ - - byte_len = 0; - byte_buf = buf; - state = ST_EXP_COMP_TYP; - - /* decode facility */ - - do_component(len); - - switch(operation_value) - { - case FAC_OPVAL_AOC_D_CUR: - cd->units_type = CHARGE_AOCD; - cd->units = 0; - return(0); - break; - - case FAC_OPVAL_AOC_D_UNIT: - cd->units_type = CHARGE_AOCD; - cd->units = units; - return(0); - break; - - case FAC_OPVAL_AOC_E_CUR: - cd->units_type = CHARGE_AOCE; - cd->units = 0; - return(0); - break; - - case FAC_OPVAL_AOC_E_UNIT: - cd->units_type = CHARGE_AOCE; - cd->units = units; - return(0); - break; - - default: - cd->units_type = CHARGE_INVALID; - cd->units = -1; - return(-1); - break; - } - return(-1); -} - -/*---------------------------------------------------------------------------* - * handle a component recursively - *---------------------------------------------------------------------------*/ -static int -do_component(int length) -{ - int comp_tag_class; /* component tag class */ - int comp_tag_form; /* component form: constructor or primitive */ - int comp_tag_code; /* component code depending on class */ - int comp_length = 0; /* component length */ - -again: - - /*----------------------------------------*/ - /* first component element: component tag */ - /*----------------------------------------*/ - - /* tag class bits */ - - comp_tag_class = (*byte_buf & 0xc0) >> 6; - - switch(comp_tag_class) - { - case FAC_TAGCLASS_UNI: - break; - case FAC_TAGCLASS_APW: - break; - case FAC_TAGCLASS_COS: - break; - case FAC_TAGCLASS_PRU: - break; - } - - /* tag form bit */ - - comp_tag_form = (*byte_buf & 0x20) > 5; - - /* tag code bits */ - - comp_tag_code = *byte_buf & 0x1f; - - if(comp_tag_code == 0x1f) - { - comp_tag_code = 0; - - byte_buf++; - byte_len++; - - while(*byte_buf & 0x80) - { - comp_tag_code += (*byte_buf & 0x7f); - byte_buf++; - byte_len++; - } - comp_tag_code += (*byte_buf & 0x7f); - } - else - { - comp_tag_code = (*byte_buf & 0x1f); - } - - byte_buf++; - byte_len++; - - /*--------------------------------------------*/ - /* second component element: component length */ - /*--------------------------------------------*/ - - comp_length = 0; - - if(*byte_buf & 0x80) - { - int i = *byte_buf & 0x7f; - - byte_len += i; - - for(;i > 0;i++) - { - byte_buf++; - comp_length += (*byte_buf * (i*256)); - } - } - else - { - comp_length = *byte_buf & 0x7f; - } - - next_state(comp_tag_class, comp_tag_form, comp_tag_code, -1); - - byte_len++; - byte_buf++; - - /*---------------------------------------------*/ - /* third component element: component contents */ - /*---------------------------------------------*/ - - if(comp_tag_form) /* == constructor */ - { - do_component(comp_length); - } - else - { - int val = 0; - if(comp_tag_class == FAC_TAGCLASS_UNI) - { - switch(comp_tag_code) - { - case FAC_CODEUNI_INT: - case FAC_CODEUNI_ENUM: - case FAC_CODEUNI_BOOL: - if(comp_length) - { - int i; - - for(i = comp_length-1; i >= 0; i--) - { - val += (*byte_buf + (i*255)); - byte_buf++; - byte_len++; - } - } - break; - default: - if(comp_length) - { - int i; - - for(i = comp_length-1; i >= 0; i--) - { - byte_buf++; - byte_len++; - } - } - break; - } - } - - else /* comp_tag_class != FAC_TAGCLASS_UNI */ - { - if(comp_length) - { - int i; - - for(i = comp_length-1; i >= 0; i--) - { - val += (*byte_buf + (i*255)); - byte_buf++; - byte_len++; - } - } - } - next_state(comp_tag_class, comp_tag_form, comp_tag_code, val); - } - - if(byte_len < length) - goto again; - - return(byte_len); -} - -/*---------------------------------------------------------------------------* - * invoke component - *---------------------------------------------------------------------------*/ -static void -F_1_1(int val) -{ - if(val == -1) - { - state = ST_EXP_INV_ID; - } -} - -/*---------------------------------------------------------------------------* - * return result - *---------------------------------------------------------------------------*/ -static void -F_1_2(int val) -{ - if(val == -1) - state = ST_EXP_NIX; -} -/*---------------------------------------------------------------------------* - * return error - *---------------------------------------------------------------------------*/ -static void -F_1_3(int val) -{ - if(val == -1) - state = ST_EXP_NIX; -} -/*---------------------------------------------------------------------------* - * reject - *---------------------------------------------------------------------------*/ -static void -F_1_4(int val) -{ - if(val == -1) - state = ST_EXP_NIX; -} - -/*---------------------------------------------------------------------------* - * invoke id - *---------------------------------------------------------------------------*/ -static void -F_2(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Invoke ID = %d", val); - state = ST_EXP_OP_VAL; - } -} - -/*---------------------------------------------------------------------------* - * operation value - *---------------------------------------------------------------------------*/ -static void -F_3(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Operation Value = %d", val); - - operation_value = val; - - if((val == FAC_OPVAL_AOC_D_UNIT) || (val == FAC_OPVAL_AOC_E_UNIT)) - { - units = 0; - state = ST_EXP_INFO; - } - else - { - state = ST_EXP_NIX; - } - } -} - -/*---------------------------------------------------------------------------* - * specific charging units - *---------------------------------------------------------------------------*/ -static void -F_4(int val) -{ - if(val == -1) - state = ST_EXP_RUL; -} - -/*---------------------------------------------------------------------------* - * free of charge - *---------------------------------------------------------------------------*/ -static void -F_4_1(int val) -{ - if(val == -1) - { - NDBGL3(L3_A_MSG, "Free of Charge"); - /* units = 0; XXXX */ - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * charge not available - *---------------------------------------------------------------------------*/ -static void -F_4_2(int val) -{ - if(val == -1) - { - NDBGL3(L3_A_MSG, "Charge not available"); - /* units = -1; XXXXXX ??? */ - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * recorded units list - *---------------------------------------------------------------------------*/ -static void -F_5(int val) -{ - if(val == -1) - state = ST_EXP_RU; -} - -/*---------------------------------------------------------------------------* - * recorded units - *---------------------------------------------------------------------------*/ -static void -F_6(int val) -{ - if(val == -1) - state = ST_EXP_RNOU; -} - -/*---------------------------------------------------------------------------* - * number of units - *---------------------------------------------------------------------------*/ -static void -F_7(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Number of Units = %d", val); - units = val; - state = ST_EXP_TOCI; - } -} - -/*---------------------------------------------------------------------------* - * subtotal/total - *---------------------------------------------------------------------------*/ -static void -F_8(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Subtotal/Total = %d", val); - /* type_of_charge = val; */ - state = ST_EXP_DBID; - } -} - -/*---------------------------------------------------------------------------* - * billing_id - *---------------------------------------------------------------------------*/ -static void -F_9(int val) -{ - if(val != -1) - { - NDBGL3(L3_A_MSG, "Billing ID = %d", val); - /* billing_id = val; */ - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static struct statetab { - int currstate; /* input: current state we are in */ - int form; /* input: current tag form */ - int class; /* input: current tag class */ - int code; /* input: current tag code */ - void (*func)(int); /* output: func to exec */ -} statetab[] = { - -/* current state tag form tag class tag code function */ -/* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/ - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_1_1 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 2, F_1_2 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 3, F_1_3 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 4, F_1_4 }, - {ST_EXP_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_2 }, - {ST_EXP_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_3 }, - {ST_EXP_INFO, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_4 }, - {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_NULL, F_4_1 }, - {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_4_2 }, - {ST_EXP_RUL, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_5 }, - {ST_EXP_RU, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_6 }, - {ST_EXP_RNOU, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_7 }, - {ST_EXP_TOCI, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_8 }, - {ST_EXP_DBID, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_9 }, - {-1, -1, -1, -1, NULL } -}; - -/*---------------------------------------------------------------------------* - * state decode for do_component - *---------------------------------------------------------------------------*/ -static void -next_state(int class, int form, int code, int val) -{ - int i; - - for(i=0; ; i++) - { - if((statetab[i].currstate > state) || - (statetab[i].currstate == -1)) - { - break; - } - - if((statetab[i].currstate == state) && - (statetab[i].form == form) && - (statetab[i].class == class) && - (statetab[i].code == code)) - { - (*statetab[i].func)(val); - break; - } - } -} diff --git a/sys/i4b/layer3/i4b_q932fac.h b/sys/i4b/layer3/i4b_q932fac.h deleted file mode 100644 index ae7915530800..000000000000 --- a/sys/i4b/layer3/i4b_q932fac.h +++ /dev/null @@ -1,168 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_q932fac.h - Q932 facility handling header file - * -------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat Mar 9 19:37:46 2002] - * - *--------------------------------------------------------------------------- - * - * - Q.932 (03/93) Generic Procedures for the Control of - * ISDN Supplementaty Services - * - Q.950 (03/93) Supplementary Services Protocols, Structure and - * General Principles - * - ETS 300 179 (10/92) Advice Of Charge: charging information during - * the call (AOC-D) supplementary service Service description - * - ETS 300 180 (10/92) Advice Of Charge: charging information at the - * end of call (AOC-E) supplementary service Service description - * - ETS 300 181 (04/93) Advice Of Charge (AOC) supplementary service - * Functional capabilities and information flows - * - ETS 300 182 (04/93) Advice Of Charge (AOC) supplementary service - * Digital Subscriber Signalling System No. one (DSS1) protocol - * - X.208 Specification of Abstract Syntax Notation One (ASN.1) - * - X.209 Specification of Basic Encoding Rules for - * Abstract Syntax Notation One (ASN.1) - * - "ASN.1 Abstract Syntax Notation One", Walter Gora, DATACOM-Verlag - * 1992, 3rd Edition (ISBN 3-89238-062-7) (german !) - * - *---------------------------------------------------------------------------*/ - -/* protocols */ -#define FAC_PROTO_ROP 0x11 -#define FAC_PROTO_CMIP 0x12 -#define FAC_PROTO_ACSE 0x13 - -/* tag classes */ -#define FAC_TAGCLASS_UNI 0x00 -#define FAC_TAGCLASS_APW 0x01 -#define FAC_TAGCLASS_COS 0x02 -#define FAC_TAGCLASS_PRU 0x03 - -/* tag forms */ -#define FAC_TAGFORM_PRI 0x00 -#define FAC_TAGFORM_CON 0x01 - -/* class UNIVERSAL values */ -#define FAC_CODEUNI_BOOL 1 -#define FAC_CODEUNI_INT 2 -#define FAC_CODEUNI_BITS 3 -#define FAC_CODEUNI_OCTS 4 -#define FAC_CODEUNI_NULL 5 -#define FAC_CODEUNI_OBJI 6 -#define FAC_CODEUNI_OBJD 7 -#define FAC_CODEUNI_EXT 8 -#define FAC_CODEUNI_REAL 9 -#define FAC_CODEUNI_ENUM 10 -#define FAC_CODEUNI_R11 11 -#define FAC_CODEUNI_R12 12 -#define FAC_CODEUNI_R13 13 -#define FAC_CODEUNI_R14 14 -#define FAC_CODEUNI_R15 15 -#define FAC_CODEUNI_SEQ 16 -#define FAC_CODEUNI_SET 17 -#define FAC_CODEUNI_NSTR 18 -#define FAC_CODEUNI_PSTR 19 -#define FAC_CODEUNI_TSTR 20 -#define FAC_CODEUNI_VSTR 21 -#define FAC_CODEUNI_ISTR 22 -#define FAC_CODEUNI_UTIME 23 -#define FAC_CODEUNI_GTIME 24 -#define FAC_CODEUNI_GSTR 25 -#define FAC_CODEUNI_VISTR 26 -#define FAC_CODEUNI_GNSTR 27 - -/* operation values */ -#define FAC_OPVAL_UUS 1 -#define FAC_OPVAL_CUG 2 -#define FAC_OPVAL_MCID 3 -#define FAC_OPVAL_BTPY 4 -#define FAC_OPVAL_ETPY 5 -#define FAC_OPVAL_ECT 6 - -#define FAC_OPVAL_DIV_ACT 7 -#define FAC_OPVAL_DIV_DEACT 8 -#define FAC_OPVAL_DIV_ACTSN 9 -#define FAC_OPVAL_DIV_DEACTSN 10 -#define FAC_OPVAL_DIV_INTER 11 -#define FAC_OPVAL_DIV_INFO 12 -#define FAC_OPVAL_DIV_CALLDEF 13 -#define FAC_OPVAL_DIV_CALLRER 14 -#define FAC_OPVAL_DIV_LINF2 15 -#define FAC_OPVAL_DIV_INVS 16 -#define FAC_OPVAL_DIV_INTER1 17 -#define FAC_OPVAL_DIV_LINF1 18 -#define FAC_OPVAL_DIV_LINF3 19 - -#define FAC_OPVAL_ER_CRCO 20 -#define FAC_OPVAL_ER_MGMT 21 -#define FAC_OPVAL_ER_CANC 22 - -#define FAC_OPVAL_MLPP_QUERY 24 -#define FAC_OPVAL_MLPP_CALLR 25 -#define FAC_OPVAL_MLPP_CALLP 26 - -#define FAC_OPVAL_AOC_REQ 30 -#define FAC_OPVAL_AOC_S_CUR 31 -#define FAC_OPVAL_AOC_S_SPC 32 -#define FAC_OPVAL_AOC_D_CUR 33 -#define FAC_OPVAL_AOC_D_UNIT 34 -#define FAC_OPVAL_AOC_E_CUR 35 -#define FAC_OPVAL_AOC_E_UNIT 36 -#define FAC_OPVAL_AOC_IDOFCRG 37 - -#define FAC_OPVAL_CONF_BEG 40 -#define FAC_OPVAL_CONF_ADD 41 -#define FAC_OPVAL_CONF_SPLIT 42 -#define FAC_OPVAL_CONF_DROP 43 -#define FAC_OPVAL_CONF_ISOLATE 44 -#define FAC_OPVAL_CONF_REATT 45 -#define FAC_OPVAL_CONF_PDISC 46 -#define FAC_OPVAL_CONF_FCONF 47 -#define FAC_OPVAL_CONF_END 48 -#define FAC_OPVAL_CONF_IDCFE 49 - -#define FAC_OPVAL_REVC_REQ 60 - -enum states { - ST_EXP_COMP_TYP, - ST_EXP_INV_ID, - ST_EXP_OP_VAL, - ST_EXP_INFO, - ST_EXP_RUL, - ST_EXP_RU, - ST_EXP_RNOU, - ST_EXP_TOCI, - ST_EXP_DBID, - - ST_EXP_NIX -}; - -/* EOF */ - diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c deleted file mode 100644 index ef73ce162be1..000000000000 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ /dev/null @@ -1,865 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_i4bdrv.c - i4b userland interface driver - * -------------------------------------------- - * last edit-date: [Sun Aug 11 12:42:46 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include - -struct selinfo select_rd_info; - -static struct ifqueue i4b_rdqueue; -static int openflag = 0; -static int selflag = 0; -static int readflag = 0; - -static d_open_t i4bopen; -static d_close_t i4bclose; -static d_read_t i4bread; -static d_ioctl_t i4bioctl; -static d_poll_t i4bpoll; - - -static struct cdevsw i4b_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = i4bopen, - .d_close = i4bclose, - .d_read = i4bread, - .d_ioctl = i4bioctl, - .d_poll = i4bpoll, - .d_name = "i4b", -}; - -static void i4battach(void *); -PSEUDO_SET(i4battach, i4b_i4bdrv); - -/*---------------------------------------------------------------------------* - * interface attach routine - *---------------------------------------------------------------------------*/ -static void -i4battach(void *dummy) -{ - printf("i4b: ISDN call control device attached\n"); - - i4b_rdqueue.ifq_maxlen = IFQ_MAXLEN; - - if(!mtx_initialized(&i4b_rdqueue.ifq_mtx)) - mtx_init(&i4b_rdqueue.ifq_mtx, "i4b_rdqueue", NULL, MTX_DEF); - - make_dev(&i4b_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4b"); -} - -/*---------------------------------------------------------------------------* - * i4bopen - device driver open routine - *---------------------------------------------------------------------------*/ -static int -i4bopen(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - int x; - - if(minor(dev)) - return(ENXIO); - - if(openflag) - return(EBUSY); - - x = splimp(); - openflag = 1; - i4b_l4_daemon_attached(); - splx(x); - - return(0); -} - -/*---------------------------------------------------------------------------* - * i4bclose - device driver close routine - *---------------------------------------------------------------------------*/ -static int -i4bclose(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - int x = splimp(); - openflag = 0; - i4b_l4_daemon_detached(); - i4b_Dcleanifq(&i4b_rdqueue); - splx(x); - return(0); -} - -/*---------------------------------------------------------------------------* - * i4bread - device driver read routine - *---------------------------------------------------------------------------*/ -static int -i4bread(struct cdev *dev, struct uio *uio, int ioflag) -{ - struct mbuf *m; - int x; - int error = 0; - - if(minor(dev)) - return(ENODEV); - - x = splimp(); - IF_LOCK(&i4b_rdqueue); - while(IF_QEMPTY(&i4b_rdqueue)) - { - readflag = 1; - - error = msleep( &i4b_rdqueue, &i4b_rdqueue.ifq_mtx, - (PZERO + 1) | PCATCH, "bird", 0); - - if (error != 0) { - IF_UNLOCK(&i4b_rdqueue); - splx(x); - return error; - } - } - - _IF_DEQUEUE(&i4b_rdqueue, m); - IF_UNLOCK(&i4b_rdqueue); - - splx(x); - - if(m && m->m_len) - error = uiomove(m->m_data, m->m_len, uio); - else - error = EIO; - - if(m) - i4b_Dfreembuf(m); - - return(error); -} - -/*---------------------------------------------------------------------------* - * i4bioctl - device driver ioctl routine - *---------------------------------------------------------------------------*/ -static int -i4bioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) -{ - call_desc_t *cd; - int error = 0; - - if(minor(dev)) - return(ENODEV); - - switch(cmd) - { - /* cdid request, reserve cd and return cdid */ - - case I4B_CDID_REQ: - { - msg_cdid_req_t *mir; - mir = (msg_cdid_req_t *)data; - cd = reserve_cd(); - mir->cdid = cd->cdid; - break; - } - - /* connect request, dial out to remote */ - - case I4B_CONNECT_REQ: - { - msg_connect_req_t *mcr; - mcr = (msg_connect_req_t *)data; /* setup ptr */ - - if((cd = cd_by_cdid(mcr->cdid)) == NULL)/* get cd */ - { - NDBGL4(L4_ERR, "I4B_CONNECT_REQ ioctl, cdid not found!"); - error = EINVAL; - break; - } - - /* prevent dialling on leased lines */ - if(ctrl_desc[mcr->controller].protocol == PROTOCOL_D64S) - { - SET_CAUSE_TYPE(cd->cause_in, CAUSET_I4B); - SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_LLDIAL); - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - break; - } - - cd->controller = mcr->controller; /* fill cd */ - cd->bprot = mcr->bprot; - cd->bcap = mcr->bcap; - cd->driver = mcr->driver; - cd->driver_unit = mcr->driver_unit; - cd->cr = get_rand_cr(ctrl_desc[cd->controller].unit); - - cd->shorthold_data.shorthold_algorithm = mcr->shorthold_data.shorthold_algorithm; - cd->shorthold_data.unitlen_time = mcr->shorthold_data.unitlen_time; - cd->shorthold_data.idle_time = mcr->shorthold_data.idle_time; - cd->shorthold_data.earlyhup_time = mcr->shorthold_data.earlyhup_time; - - cd->last_aocd_time = 0; - if(mcr->unitlen_method == ULEN_METHOD_DYNAMIC) - cd->aocd_flag = 1; - else - cd->aocd_flag = 0; - - cd->cunits = 0; - - cd->max_idle_time = 0; /* this is outgoing */ - - cd->dir = DIR_OUTGOING; - - NDBGL4(L4_TIMO, "I4B_CONNECT_REQ times, algorithm=%ld unitlen=%ld idle=%ld earlyhup=%ld", - (long)cd->shorthold_data.shorthold_algorithm, (long)cd->shorthold_data.unitlen_time, - (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time); - - strcpy(cd->dst_telno, mcr->dst_telno); - strcpy(cd->src_telno, mcr->src_telno); - - strcpy(cd->dst_subaddr, mcr->dst_subaddr); - strcpy(cd->src_subaddr, mcr->src_subaddr); - - if(mcr->keypad[0] != '\0') - strcpy(cd->keypad, mcr->keypad); - else - cd->keypad[0] = '\0'; - - cd->display[0] = '\0'; - - SET_CAUSE_TYPE(cd->cause_in, CAUSET_I4B); - SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NORMAL); - - switch(mcr->channel) - { - case CHAN_B1: - case CHAN_B2: - if(ctrl_desc[mcr->controller].bch_state[mcr->channel] != BCH_ST_FREE) - SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); - break; - - case CHAN_ANY: - { - int i; - for (i = 0; - i < ctrl_desc[mcr->controller].nbch && - ctrl_desc[mcr->controller].bch_state[i] != BCH_ST_FREE; - i++); - if (i == ctrl_desc[mcr->controller].nbch) - SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); - /* else mcr->channel = i; XXX */ - } - break; - - default: - SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); - break; - } - - cd->channelid = mcr->channel; - - cd->isdntxdelay = mcr->txdelay; - - /* check whether we have a pointer. Seems like */ - /* this should be adequate. GJ 19.09.97 */ - if(ctrl_desc[cd->controller].N_CONNECT_REQUEST == NULL) -/*XXX*/ SET_CAUSE_VAL(cd->cause_in, CAUSE_I4B_NOCHAN); - - if((GET_CAUSE_VAL(cd->cause_in)) != CAUSE_I4B_NORMAL) - { - i4b_l4_disconnect_ind(cd); - freecd_by_cd(cd); - } - else - { - (*ctrl_desc[cd->controller].N_CONNECT_REQUEST)(mcr->cdid); - } - break; - } - - /* connect response, accept/reject/ignore incoming call */ - - case I4B_CONNECT_RESP: - { - msg_connect_resp_t *mcrsp; - - mcrsp = (msg_connect_resp_t *)data; - - if((cd = cd_by_cdid(mcrsp->cdid)) == NULL)/* get cd */ - { - NDBGL4(L4_ERR, "I4B_CONNECT_RESP ioctl, cdid not found!"); - error = EINVAL; - break; - } - - T400_stop(cd); - - cd->driver = mcrsp->driver; - cd->driver_unit = mcrsp->driver_unit; - cd->max_idle_time = mcrsp->max_idle_time; - - cd->shorthold_data.shorthold_algorithm = SHA_FIXU; - cd->shorthold_data.unitlen_time = 0; /* this is incoming */ - cd->shorthold_data.idle_time = 0; - cd->shorthold_data.earlyhup_time = 0; - - cd->isdntxdelay = mcrsp->txdelay; - - NDBGL4(L4_TIMO, "I4B_CONNECT_RESP max_idle_time set to %ld seconds", (long)cd->max_idle_time); - - (*ctrl_desc[cd->controller].N_CONNECT_RESPONSE)(mcrsp->cdid, mcrsp->response, mcrsp->cause); - break; - } - - /* disconnect request, actively terminate connection */ - - case I4B_DISCONNECT_REQ: - { - msg_discon_req_t *mdr; - - mdr = (msg_discon_req_t *)data; - - if((cd = cd_by_cdid(mdr->cdid)) == NULL)/* get cd */ - { - NDBGL4(L4_ERR, "I4B_DISCONNECT_REQ ioctl, cdid not found!"); - error = EINVAL; - break; - } - - /* preset causes with our cause */ - cd->cause_in = cd->cause_out = mdr->cause; - - (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(mdr->cdid, mdr->cause); - break; - } - - /* controller info request */ - - case I4B_CTRL_INFO_REQ: - { - msg_ctrl_info_req_t *mcir; - - mcir = (msg_ctrl_info_req_t *)data; - mcir->ncontroller = nctrl; - - if(mcir->controller > nctrl) - { - mcir->ctrl_type = -1; - mcir->card_type = -1; - } - else - { - mcir->ctrl_type = - ctrl_desc[mcir->controller].ctrl_type; - mcir->card_type = - ctrl_desc[mcir->controller].card_type; - mcir->nbch = - ctrl_desc[mcir->controller].nbch; - - if(ctrl_desc[mcir->controller].ctrl_type == CTRL_PASSIVE) - mcir->tei = ctrl_desc[mcir->controller].tei; - else - mcir->tei = -1; - } - break; - } - - /* dial response */ - - case I4B_DIALOUT_RESP: - { - drvr_link_t *dlt = NULL; - msg_dialout_resp_t *mdrsp; - - mdrsp = (msg_dialout_resp_t *)data; - - switch(mdrsp->driver) - { -#if defined(NI4BIPR) && (NI4BIPR > 0) - case BDRV_IPR: - dlt = ipr_ret_linktab(mdrsp->driver_unit); - break; -#endif - -#if defined(NI4BISPPP) && (NI4BISPPP > 0) - case BDRV_ISPPP: - dlt = i4bisppp_ret_linktab(mdrsp->driver_unit); - break; -#endif - -#if defined(NI4BTEL) && (NI4BTEL > 0) - case BDRV_TEL: - dlt = tel_ret_linktab(mdrsp->driver_unit); - break; -#endif - -#if defined(NIBC) && NIBC > 0 - case BDRV_IBC: - dlt = ibc_ret_linktab(mdrsp->driver_unit); - break; -#endif - -#if defined(NI4BING) && (NI4BING > 0) - case BDRV_ING: - dlt = ing_ret_linktab(mdrsp->driver_unit); - break; -#endif - } - - if(dlt != NULL) - (*dlt->dial_response)(mdrsp->driver_unit, mdrsp->stat, mdrsp->cause); - break; - } - - /* update timeout value */ - - case I4B_TIMEOUT_UPD: - { - msg_timeout_upd_t *mtu; - int x; - - mtu = (msg_timeout_upd_t *)data; - - NDBGL4(L4_TIMO, "I4B_TIMEOUT_UPD ioctl, alg %d, unit %d, idle %d, early %d!", - mtu->shorthold_data.shorthold_algorithm, mtu->shorthold_data.unitlen_time, - mtu->shorthold_data.idle_time, mtu->shorthold_data.earlyhup_time); - - if((cd = cd_by_cdid(mtu->cdid)) == NULL)/* get cd */ - { - NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, cdid not found!"); - error = EINVAL; - break; - } - - switch( mtu->shorthold_data.shorthold_algorithm ) - { - case SHA_FIXU: - /* - * For this algorithm unitlen_time, - * idle_time and earlyhup_time are used. - */ - - if(!(mtu->shorthold_data.unitlen_time >= 0 && - mtu->shorthold_data.idle_time >= 0 && - mtu->shorthold_data.earlyhup_time >= 0)) - { - NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid args for fix unit algorithm!"); - error = EINVAL; - } - break; - - case SHA_VARU: - /* - * For this algorithm unitlen_time and - * idle_time are used. both must be - * positive integers. earlyhup_time is - * not used and must be 0. - */ - - if(!(mtu->shorthold_data.unitlen_time > 0 && - mtu->shorthold_data.idle_time >= 0 && - mtu->shorthold_data.earlyhup_time == 0)) - { - NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid args for var unit algorithm!"); - error = EINVAL; - } - break; - - default: - NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid algorithm!"); - error = EINVAL; - break; - } - - /* - * any error set above requires us to break - * out of the outer switch - */ - if(error != 0) - break; - - x = SPLI4B(); - cd->shorthold_data.shorthold_algorithm = mtu->shorthold_data.shorthold_algorithm; - cd->shorthold_data.unitlen_time = mtu->shorthold_data.unitlen_time; - cd->shorthold_data.idle_time = mtu->shorthold_data.idle_time; - cd->shorthold_data.earlyhup_time = mtu->shorthold_data.earlyhup_time; - splx(x); - break; - } - - /* soft enable/disable interface */ - - case I4B_UPDOWN_IND: - { - msg_updown_ind_t *mui; - - mui = (msg_updown_ind_t *)data; - -#if defined(NI4BIPR) && (NI4BIPR > 0) - if(mui->driver == BDRV_IPR) - { - drvr_link_t *dlt; - dlt = ipr_ret_linktab(mui->driver_unit); - (*dlt->updown_ind)(mui->driver_unit, mui->updown); - } -#endif - break; - } - - /* send ALERT request */ - - case I4B_ALERT_REQ: - { - msg_alert_req_t *mar; - - mar = (msg_alert_req_t *)data; - - if((cd = cd_by_cdid(mar->cdid)) == NULL) - { - NDBGL4(L4_ERR, "I4B_ALERT_REQ ioctl, cdid not found!"); - error = EINVAL; - break; - } - - T400_stop(cd); - - (*ctrl_desc[cd->controller].N_ALERT_REQUEST)(mar->cdid); - - break; - } - - /* version/release number request */ - - case I4B_VR_REQ: - { - msg_vr_req_t *mvr; - - mvr = (msg_vr_req_t *)data; - - mvr->version = VERSION; - mvr->release = REL; - mvr->step = STEP; - break; - } - - /* set D-channel protocol for a controller */ - - case I4B_PROT_IND: - { - msg_prot_ind_t *mpi; - - mpi = (msg_prot_ind_t *)data; - - ctrl_desc[mpi->controller].protocol = mpi->protocol; - - break; - } - - /* Download request */ - - case I4B_CTRL_DOWNLOAD: - { - struct isdn_dr_prot *prots = NULL, *prots2 = NULL; - struct isdn_download_request *r = - (struct isdn_download_request*)data; - int i; - - if (r->controller < 0 || r->controller >= nctrl) - { - error = ENODEV; - goto download_done; - } - - if(!ctrl_desc[r->controller].N_DOWNLOAD) - { - error = ENODEV; - goto download_done; - } - - prots = malloc(r->numprotos * sizeof(struct isdn_dr_prot), - M_DEVBUF, M_WAITOK); - - prots2 = malloc(r->numprotos * sizeof(struct isdn_dr_prot), - M_DEVBUF, M_WAITOK); - - if(!prots || !prots2) - { - error = ENOMEM; - goto download_done; - } - - copyin(r->protocols, prots, r->numprotos * sizeof(struct isdn_dr_prot)); - - for(i = 0; i < r->numprotos; i++) - { - prots2[i].microcode = malloc(prots[i].bytecount, M_DEVBUF, M_WAITOK); - copyin(prots[i].microcode, prots2[i].microcode, prots[i].bytecount); - prots2[i].bytecount = prots[i].bytecount; - } - - error = ctrl_desc[r->controller].N_DOWNLOAD( - ctrl_desc[r->controller].unit, - r->numprotos, prots2); - -download_done: - if(prots2) - { - for(i = 0; i < r->numprotos; i++) - { - if(prots2[i].microcode) - { - free(prots2[i].microcode, M_DEVBUF); - } - } - free(prots2, M_DEVBUF); - } - - if(prots) - { - free(prots, M_DEVBUF); - } - break; - } - - /* Diagnostic request */ - - case I4B_ACTIVE_DIAGNOSTIC: - { - struct isdn_diagnostic_request req, *r = - (struct isdn_diagnostic_request*)data; - - req.in_param = req.out_param = NULL; - if (r->controller < 0 || r->controller >= nctrl) - { - error = ENODEV; - goto diag_done; - } - - if(!ctrl_desc[r->controller].N_DIAGNOSTICS) - { - error = ENODEV; - goto diag_done; - } - - memcpy(&req, r, sizeof(req)); - - if(req.in_param_len) - { - /* XXX arbitrary limit */ - if (req.in_param_len > - I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN) { - error = EINVAL; - goto diag_done; - } - - req.in_param = malloc(r->in_param_len, M_DEVBUF, M_WAITOK); - - if(!req.in_param) - { - error = ENOMEM; - goto diag_done; - } - error = copyin(r->in_param, req.in_param, req.in_param_len); - if (error) - goto diag_done; - } - - if(req.out_param_len) - { - req.out_param = malloc(r->out_param_len, M_DEVBUF, M_WAITOK); - - if(!req.out_param) - { - error = ENOMEM; - goto diag_done; - } - } - - error = ctrl_desc[r->controller].N_DIAGNOSTICS(r->controller, &req); - - if(!error && req.out_param_len) - error = copyout(req.out_param, r->out_param, req.out_param_len); - -diag_done: - if(req.in_param) - free(req.in_param, M_DEVBUF); - - if(req.out_param) - free(req.out_param, M_DEVBUF); - - break; - } - - /* default */ - - default: - error = ENOTTY; - break; - } - - return(error); -} - -/*---------------------------------------------------------------------------* - * i4bpoll - device driver poll routine - *---------------------------------------------------------------------------*/ -static int -i4bpoll(struct cdev *dev, int events, struct thread *td) -{ - int x; - - if(minor(dev)) - return(ENODEV); - - if((events & POLLIN) || (events & POLLRDNORM)) - { - if(!IF_QEMPTY(&i4b_rdqueue)) - return(1); - - x = splimp(); - selrecord(td, &select_rd_info); - selflag = 1; - splx(x); - return(0); - } - else if((events & POLLOUT) || (events & POLLWRNORM)) - { - return(1); - } - - return(0); -} - -/*---------------------------------------------------------------------------* - * i4bputqueue - put message into queue to userland - *---------------------------------------------------------------------------*/ -void -i4bputqueue(struct mbuf *m) -{ - int x; - - if(!openflag) - { - i4b_Dfreembuf(m); - return; - } - - x = splimp(); - - IF_LOCK(&i4b_rdqueue); - if(_IF_QFULL(&i4b_rdqueue)) - { - struct mbuf *m1; - _IF_DEQUEUE(&i4b_rdqueue, m1); - i4b_Dfreembuf(m1); - NDBGL4(L4_ERR, "ERROR, queue full, removing entry!"); - } - - _IF_ENQUEUE(&i4b_rdqueue, m); - IF_UNLOCK(&i4b_rdqueue); - - splx(x); - - if(readflag) - { - readflag = 0; - wakeup( &i4b_rdqueue); - } - - if(selflag) - { - selflag = 0; - selwakeuppri(&select_rd_info, I4BPRI); - } -} - -/*---------------------------------------------------------------------------* - * i4bputqueue_hipri - put message into front of queue to userland - *---------------------------------------------------------------------------*/ -void -i4bputqueue_hipri(struct mbuf *m) -{ - int x; - - if(!openflag) - { - i4b_Dfreembuf(m); - return; - } - - x = splimp(); - - IF_LOCK(&i4b_rdqueue); - if(_IF_QFULL(&i4b_rdqueue)) - { - struct mbuf *m1; - _IF_DEQUEUE(&i4b_rdqueue, m1); - i4b_Dfreembuf(m1); - NDBGL4(L4_ERR, "ERROR, queue full, removing entry!"); - } - - _IF_PREPEND(&i4b_rdqueue, m); - IF_UNLOCK(&i4b_rdqueue); - - splx(x); - - if(readflag) - { - readflag = 0; - wakeup( &i4b_rdqueue); - } - - if(selflag) - { - selflag = 0; - selwakeuppri(&select_rd_info, I4BPRI); - } -} diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c deleted file mode 100644 index 9ca64e2a845c..000000000000 --- a/sys/i4b/layer4/i4b_l4.c +++ /dev/null @@ -1,1097 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l4.c - kernel interface to userland - * ----------------------------------------- - * last edit-date: [Sun Aug 11 12:43:14 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_i4b.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -unsigned int i4b_l4_debug = L4_DEBUG_DEFAULT; - -struct ctrl_type_desc ctrl_types[CTRL_NUMTYPES] = { { NULL, NULL} }; - -static int i4b_link_bchandrvr(call_desc_t *cd); -static void i4b_unlink_bchandrvr(call_desc_t *cd); -static void i4b_l4_setup_timeout(call_desc_t *cd); -static void i4b_idle_check_fix_unit(call_desc_t *cd); -static void i4b_idle_check_var_unit(call_desc_t *cd); -static void i4b_l4_setup_timeout_fix_unit(call_desc_t *cd); -static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd); -static time_t i4b_get_idletime(call_desc_t *cd); - -#if defined(NI4BISPPP) && (NI4BISPPP > 0) -extern time_t i4bisppp_idletime(int); -#endif - -/*---------------------------------------------------------------------------* - * send MSG_PDEACT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_pdeact(int controller, int numactive) -{ - struct mbuf *m; - int i; - call_desc_t *cd; - - for(i=0; i < N_CALL_DESC; i++) - { - if((call_desc[i].cdid != CDID_UNUSED) && - (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[call_desc[i].controller].unit == controller)) - { - cd = &call_desc[i]; - - if(cd->timeout_active) - { - STOP_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd); - } - - if(cd->dlt != NULL) - { - (*cd->dlt->line_disconnected)(cd->driver_unit, (void *)cd); - i4b_unlink_bchandrvr(cd); - } - - if((cd->channelid >= 0) & (cd->channelid < ctrl_desc[cd->controller].nbch)) - { - ctrl_desc[cd->controller].bch_state[cd->channelid] = BCH_ST_FREE; - } - - cd->cdid = CDID_UNUSED; - } - } - - if((m = i4b_Dgetmbuf(sizeof(msg_pdeact_ind_t))) != NULL) - { - msg_pdeact_ind_t *md = (msg_pdeact_ind_t *)m->m_data; - - md->header.type = MSG_PDEACT_IND; - md->header.cdid = -1; - - md->controller = controller; - md->numactive = numactive; - - i4bputqueue_hipri(m); /* URGENT !!! */ - } -} - -/*---------------------------------------------------------------------------* - * send MSG_L12STAT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_l12stat(int controller, int layer, int state) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_l12stat_ind_t))) != NULL) - { - msg_l12stat_ind_t *md = (msg_l12stat_ind_t *)m->m_data; - - md->header.type = MSG_L12STAT_IND; - md->header.cdid = -1; - - md->controller = controller; - md->layer = layer; - md->state = state; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_TEIASG_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_teiasg(int controller, int tei) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_teiasg_ind_t))) != NULL) - { - msg_teiasg_ind_t *md = (msg_teiasg_ind_t *)m->m_data; - - md->header.type = MSG_TEIASG_IND; - md->header.cdid = -1; - - md->controller = controller; - md->tei = ctrl_desc[controller].tei; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_DIALOUT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_dialout(int driver, int driver_unit) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_dialout_ind_t))) != NULL) - { - msg_dialout_ind_t *md = (msg_dialout_ind_t *)m->m_data; - - md->header.type = MSG_DIALOUT_IND; - md->header.cdid = -1; - - md->driver = driver; - md->driver_unit = driver_unit; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_DIALOUTNUMBER_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_dialoutnumber_ind_t))) != NULL) - { - msg_dialoutnumber_ind_t *md = (msg_dialoutnumber_ind_t *)m->m_data; - int i; - - md->header.type = MSG_DIALOUTNUMBER_IND; - md->header.cdid = -1; - - md->driver = driver; - md->driver_unit = driver_unit; - - for (i = 0; i < cmdlen; i++) - if (cmd[i] == '*') - break; - - /* XXX: TELNO_MAX is _with_ tailing '\0', so max is actually TELNO_MAX - 1 */ - md->cmdlen = (i < TELNO_MAX - 1 ? i : TELNO_MAX - 1); - /* skip the (first) '*' */ - md->subaddrlen = (cmdlen - i - 1 < SUBADDR_MAX - 1 ? cmdlen - i - 1 : SUBADDR_MAX - 1); - - bcopy(cmd, md->cmd, md->cmdlen); - if (md->subaddrlen != -1) - bcopy(cmd+i+1, md->subaddr, md->subaddrlen); - - NDBGL4(L4_TIMO, "cmd[%d]=%s, subaddr[%d]=%s", md->cmdlen, md->cmd, md->subaddrlen, md->subaddr); - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_KEYPAD_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_keypad(int driver, int driver_unit, int cmdlen, char *cmd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_keypad_ind_t))) != NULL) - { - msg_keypad_ind_t *md = (msg_keypad_ind_t *)m->m_data; - - md->header.type = MSG_KEYPAD_IND; - md->header.cdid = -1; - - md->driver = driver; - md->driver_unit = driver_unit; - - if(cmdlen > KEYPAD_MAX) - cmdlen = KEYPAD_MAX; - - md->cmdlen = cmdlen; - bcopy(cmd, md->cmd, cmdlen); - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_NEGOTIATION_COMPL message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_negcomplete(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_negcomplete_ind_t))) != NULL) - { - msg_negcomplete_ind_t *md = (msg_negcomplete_ind_t *)m->m_data; - - md->header.type = MSG_NEGCOMP_IND; - md->header.cdid = cd->cdid; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_IFSTATE_CHANGED_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_ifstate_changed(call_desc_t *cd, int new_state) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_ifstatechg_ind_t))) != NULL) - { - msg_ifstatechg_ind_t *md = (msg_ifstatechg_ind_t *)m->m_data; - - md->header.type = MSG_IFSTATE_CHANGED_IND; - md->header.cdid = cd->cdid; - md->state = new_state; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_DRVRDISC_REQ message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_drvrdisc(int driver, int driver_unit) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_drvrdisc_req_t))) != NULL) - { - msg_drvrdisc_req_t *md = (msg_drvrdisc_req_t *)m->m_data; - - md->header.type = MSG_DRVRDISC_REQ; - md->header.cdid = -1; - - md->driver = driver; - md->driver_unit = driver_unit; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_ACCT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_accounting(int driver, int driver_unit, int accttype, int ioutbytes, - int iinbytes, int ro, int ri, int outbytes, int inbytes) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_accounting_ind_t))) != NULL) - { - msg_accounting_ind_t *md = (msg_accounting_ind_t *)m->m_data; - - md->header.type = MSG_ACCT_IND; - md->header.cdid = -1; - - md->driver = driver; - md->driver_unit = driver_unit; - - md->accttype = accttype; - md->ioutbytes = ioutbytes; - md->iinbytes = iinbytes; - md->outbps = ro; - md->inbps = ri; - md->outbytes = outbytes; - md->inbytes = inbytes; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_CONNECT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_connect_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_connect_ind_t))) != NULL) - { - msg_connect_ind_t *mp = (msg_connect_ind_t *)m->m_data; - - mp->header.type = MSG_CONNECT_IND; - mp->header.cdid = cd->cdid; - - mp->controller = cd->controller; - mp->channel = cd->channelid; - mp->bprot = cd->bprot; - mp->bcap = cd->bcap; - - cd->dir = DIR_INCOMING; - - if(strlen(cd->dst_telno) > 0) - strcpy(mp->dst_telno, cd->dst_telno); - else - strcpy(mp->dst_telno, TELNO_EMPTY); - - if(strlen(cd->dst_subaddr) > 0) - strcpy(mp->dst_subaddr, cd->dst_subaddr); - else - strcpy(mp->dst_subaddr, TELNO_EMPTY); - - if(strlen(cd->src_telno) > 0) - strcpy(mp->src_telno, cd->src_telno); - else - strcpy(mp->src_telno, TELNO_EMPTY); - - if(strlen(cd->src_subaddr) > 0) - strcpy(mp->src_subaddr, cd->src_subaddr); - else - strcpy(mp->src_subaddr, TELNO_EMPTY); - - mp->src_ton = cd->src_ton; - mp->dst_ton = cd->dst_ton; - - strcpy(mp->display, cd->display); - - mp->scr_ind = cd->scr_ind; - mp->prs_ind = cd->prs_ind; - - T400_start(cd); - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_CONNECT_ACTIVE_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_connect_active_ind(call_desc_t *cd) -{ - int s; - struct mbuf *m; - - s = SPLI4B(); - - cd->last_active_time = cd->connect_time = SECOND; - - NDBGL4(L4_TIMO, "last_active/connect_time=%ld", (long)cd->connect_time); - - i4b_link_bchandrvr(cd); - - (*cd->dlt->line_connected)(cd->driver_unit, (void *)cd); - - i4b_l4_setup_timeout(cd); - - splx(s); - - if((m = i4b_Dgetmbuf(sizeof(msg_connect_active_ind_t))) != NULL) - { - msg_connect_active_ind_t *mp = (msg_connect_active_ind_t *)m->m_data; - - mp->header.type = MSG_CONNECT_ACTIVE_IND; - mp->header.cdid = cd->cdid; - mp->controller = cd->controller; - mp->channel = cd->channelid; - if(cd->datetime[0] != '\0') - strcpy(mp->datetime, cd->datetime); - else - mp->datetime[0] = '\0'; - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_DISCONNECT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_disconnect_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if(cd->timeout_active) - STOP_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd); - - if(cd->dlt != NULL) - { - (*cd->dlt->line_disconnected)(cd->driver_unit, (void *)cd); - i4b_unlink_bchandrvr(cd); - } - - if((cd->channelid >= 0) && (cd->channelid < ctrl_desc[cd->controller].nbch)) - { - ctrl_desc[cd->controller].bch_state[cd->channelid] = BCH_ST_FREE; - } - else - { - /* no error, might be hunting call for callback */ - NDBGL4(L4_MSG, "channel free not valid but %d!", cd->channelid); - } - - if((m = i4b_Dgetmbuf(sizeof(msg_disconnect_ind_t))) != NULL) - { - msg_disconnect_ind_t *mp = (msg_disconnect_ind_t *)m->m_data; - - mp->header.type = MSG_DISCONNECT_IND; - mp->header.cdid = cd->cdid; - mp->cause = cd->cause_in; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_IDLE_TIMEOUT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_idle_timeout_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_idle_timeout_ind_t))) != NULL) - { - msg_idle_timeout_ind_t *mp = (msg_idle_timeout_ind_t *)m->m_data; - - mp->header.type = MSG_IDLE_TIMEOUT_IND; - mp->header.cdid = cd->cdid; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_CHARGING_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_charging_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_charging_ind_t))) != NULL) - { - msg_charging_ind_t *mp = (msg_charging_ind_t *)m->m_data; - - mp->header.type = MSG_CHARGING_IND; - mp->header.cdid = cd->cdid; - mp->units_type = cd->units_type; - -/*XXX*/ if(mp->units_type == CHARGE_CALC) - mp->units = cd->cunits; - else - mp->units = cd->units; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_STATUS_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_status_ind(call_desc_t *cd) -{ -} - -/*---------------------------------------------------------------------------* - * send MSG_ALERT_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_alert_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_alert_ind_t))) != NULL) - { - msg_alert_ind_t *mp = (msg_alert_ind_t *)m->m_data; - - mp->header.type = MSG_ALERT_IND; - mp->header.cdid = cd->cdid; - - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_INFO_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_info_ind(call_desc_t *cd) -{ -} - -/*---------------------------------------------------------------------------* - * send MSG_INFO_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_proceeding_ind(call_desc_t *cd) -{ - struct mbuf *m; - - if((m = i4b_Dgetmbuf(sizeof(msg_proceeding_ind_t))) != NULL) - { - msg_proceeding_ind_t *mp = (msg_proceeding_ind_t *)m->m_data; - - mp->header.type = MSG_PROCEEDING_IND; - mp->header.cdid = cd->cdid; - mp->controller = cd->controller; - mp->channel = cd->channelid; - i4bputqueue(m); - } -} - -/*---------------------------------------------------------------------------* - * send MSG_PACKET_IND message to userland - *---------------------------------------------------------------------------*/ -void -i4b_l4_packet_ind(int driver, int driver_unit, int dir, struct mbuf *pkt) -{ - struct mbuf *m; - int len = pkt->m_pkthdr.len; - unsigned char *ip = pkt->m_data; - - if((m = i4b_Dgetmbuf(sizeof(msg_packet_ind_t))) != NULL) - { - msg_packet_ind_t *mp = (msg_packet_ind_t *)m->m_data; - - mp->header.type = MSG_PACKET_IND; - mp->header.cdid = -1; - mp->driver = driver; - mp->driver_unit = driver_unit; - mp->direction = dir; - memcpy(mp->pktdata, ip, - len controller].ctrl_type; - - if(t < 0 || t >= CTRL_NUMTYPES || ctrl_types[t].get_linktab == NULL) - { - cd->ilt = NULL; - } - else - { - cd->ilt = ctrl_types[t].get_linktab( - ctrl_desc[cd->controller].unit, - cd->channelid); - } - - switch(cd->driver) - { -#if defined(NI4BRBCH) && (NI4BRBCH > 0) - case BDRV_RBCH: - cd->dlt = rbch_ret_linktab(cd->driver_unit); - break; -#endif - -#if defined(NI4BTEL) && (NI4BTEL > 0) - case BDRV_TEL: - cd->dlt = tel_ret_linktab(cd->driver_unit); - break; -#endif - -#if defined(NI4BIPR) && (NI4BIPR > 0) - case BDRV_IPR: - cd->dlt = ipr_ret_linktab(cd->driver_unit); - break; -#endif - -#if defined(NI4BISPPP) && (NI4BISPPP > 0) - case BDRV_ISPPP: - cd->dlt = i4bisppp_ret_linktab(cd->driver_unit); - break; -#endif - -#if defined(NIBC) && NIBC > 0 - case BDRV_IBC: - cd->dlt = ibc_ret_linktab(cd->driver_unit); - break; -#endif - -#if defined(NI4BING) && (NI4BING > 0) - case BDRV_ING: - cd->dlt = ing_ret_linktab(cd->driver_unit); - break; -#endif - - default: - cd->dlt = NULL; - break; - } - - if(cd->dlt == NULL || cd->ilt == NULL) - return(-1); - - if(t >= 0 && t < CTRL_NUMTYPES && ctrl_types[t].set_linktab != NULL) - { - ctrl_types[t].set_linktab( - ctrl_desc[cd->controller].unit, - cd->channelid, - cd->dlt); - } - - switch(cd->driver) - { -#if defined(NI4BRBCH) && (NI4BRBCH > 0) - case BDRV_RBCH: - rbch_set_linktab(cd->driver_unit, cd->ilt); - break; -#endif - -#if defined(NI4BTEL) && (NI4BTEL > 0) - case BDRV_TEL: - tel_set_linktab(cd->driver_unit, cd->ilt); - break; -#endif - -#if defined(NI4BIPR) && (NI4BIPR > 0) - case BDRV_IPR: - ipr_set_linktab(cd->driver_unit, cd->ilt); - break; -#endif - -#if defined(NI4BISPPP) && (NI4BISPPP > 0) - case BDRV_ISPPP: - i4bisppp_set_linktab(cd->driver_unit, cd->ilt); - break; -#endif - -#if defined(NIBC) && NIBC > 0 - case BDRV_IBC: - ibc_set_linktab(cd->driver_unit, cd->ilt); - break; -#endif - -#if defined(NI4BING) && (NI4BING > 0) - case BDRV_ING: - ing_set_linktab(cd->driver_unit, cd->ilt); - break; -#endif - - default: - return(0); - break; - } - - /* activate B channel */ - - (*cd->ilt->bch_config)(cd->ilt->unit, cd->ilt->channel, cd->bprot, 1); - - return(0); -} - -/*---------------------------------------------------------------------------* - * unlink a driver(unit) from a B-channel(controller,unit,channel) - *---------------------------------------------------------------------------*/ -static void -i4b_unlink_bchandrvr(call_desc_t *cd) -{ - int t = ctrl_desc[cd->controller].ctrl_type; - - if(t < 0 || t >= CTRL_NUMTYPES || ctrl_types[t].get_linktab == NULL) - { - cd->ilt = NULL; - return; - } - else - { - cd->ilt = ctrl_types[t].get_linktab( - ctrl_desc[cd->controller].unit, - cd->channelid); - } - - /* deactivate B channel */ - - (*cd->ilt->bch_config)(cd->ilt->unit, cd->ilt->channel, cd->bprot, 0); -} - -/*--------------------------------------------------------------------------- - - How shorthold mode works for OUTGOING connections - ================================================= - - |<---- unchecked-window ------->|<-checkwindow->|<-safetywindow>| - -idletime_state: IST_NONCHK IST_CHECK IST_SAFE - - | | | | - time>>+-------------------------------+---------------+---------------+-... - | | | | - | |<--idle_time-->|<--earlyhup--->| - |<-----------------------unitlen------------------------------->| - - - unitlen - specifies the time a charging unit lasts - idle_time - specifies the thime the line must be idle at the - end of the unit to be elected for hangup - earlyhup - is the beginning of a timing safety zone before the - next charging unit starts - - The algorithm works as follows: lets assume the unitlen is 100 - secons, idle_time is 40 seconds and earlyhup is 10 seconds. - The line then must be idle 50 seconds after the begin of the - current unit and it must then be quiet for 40 seconds. if it - has been quiet for this 40 seconds, the line is closed 10 - seconds before the next charging unit starts. In case there was - any traffic within the idle_time, the line is not closed. - It does not matter whether there was any traffic between second - 0 and second 50 or not. - - - How shorthold mode works for INCOMING connections - ================================================= - - it is just possible to specify a maximum idle time for incoming - connections, after this time of no activity on the line the line - is closed. - ----------------------------------------------------------------------------*/ - -static time_t -i4b_get_idletime(call_desc_t *cd) -{ - switch (cd->driver) { -#if defined(NI4BISPPP) && (NI4BISPPP > 0) - case BDRV_ISPPP: - return i4bisppp_idletime(cd->driver_unit); - break; -#endif - default: - return cd->last_active_time; - break; - } -} -/*---------------------------------------------------------------------------* - * B channel idle check timeout setup - *---------------------------------------------------------------------------*/ -static void -i4b_l4_setup_timeout(call_desc_t *cd) -{ - NDBGL4(L4_TIMO, "%ld: direction %d, shorthold algorithm %d", - (long)SECOND, cd->dir, cd->shorthold_data.shorthold_algorithm); - - cd->timeout_active = 0; - cd->idletime_state = IST_IDLE; - - if((cd->dir == DIR_INCOMING) && (cd->max_idle_time > 0)) - { - /* incoming call: simple max idletime check */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); - cd->timeout_active = 1; - NDBGL4(L4_TIMO, "%ld: incoming-call, setup max_idle_time to %ld", (long)SECOND, (long)cd->max_idle_time); - } - else if((cd->dir == DIR_OUTGOING) && (cd->shorthold_data.idle_time > 0)) - { - switch( cd->shorthold_data.shorthold_algorithm ) - { - default: /* fall into the old fix algorithm */ - case SHA_FIXU: - i4b_l4_setup_timeout_fix_unit( cd ); - break; - - case SHA_VARU: - i4b_l4_setup_timeout_var_unit( cd ); - break; - } - } - else - { - NDBGL4(L4_TIMO, "no idle_timeout configured"); - } -} - -/*---------------------------------------------------------------------------* - * fixed unit algorithm B channel idle check timeout setup - *---------------------------------------------------------------------------*/ -static void -i4b_l4_setup_timeout_fix_unit(call_desc_t *cd) -{ - /* outgoing call */ - - if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0)) - { - /* outgoing call: simple max idletime check */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); - cd->timeout_active = 1; - NDBGL4(L4_TIMO, "%ld: outgoing-call, setup idle_time to %ld", - (long)SECOND, (long)cd->shorthold_data.idle_time); - } - else if((cd->shorthold_data.unitlen_time > 0) && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))) - { - /* outgoing call: full shorthold mode check */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))); - cd->timeout_active = 1; - cd->idletime_state = IST_NONCHK; - NDBGL4(L4_TIMO, "%ld: outgoing-call, start %ld sec nocheck window", - (long)SECOND, (long)(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))); - - if(cd->aocd_flag == 0) - { - cd->units_type = CHARGE_CALC; - cd->cunits++; - i4b_l4_charging_ind(cd); - } - } - else - { - /* parms somehow got wrong .. */ - - NDBGL4(L4_ERR, "%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!", - (long)SECOND, (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time, (long)cd->shorthold_data.unitlen_time); - } -} - -/*---------------------------------------------------------------------------* - * variable unit algorithm B channel idle check timeout setup - *---------------------------------------------------------------------------*/ -static void -i4b_l4_setup_timeout_var_unit(call_desc_t *cd) -{ - /* outgoing call: variable unit idletime check */ - - /* - * start checking for an idle connect one second before the end of the unit. - * The one second takes into account of rounding due to the driver only - * using the seconds and not the uSeconds of the current time - */ - cd->idletime_state = IST_CHECK; /* move directly to the checking state */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz * (cd->shorthold_data.unitlen_time - 1) ); - cd->timeout_active = 1; - NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle time - setup to %ld", - (long)SECOND, (long)cd->shorthold_data.unitlen_time); -} - - -/*---------------------------------------------------------------------------* - * B channel idle check timeout function - *---------------------------------------------------------------------------*/ -void -i4b_idle_check(call_desc_t *cd) -{ - int s; - - if(cd->cdid == CDID_UNUSED) - return; - - s = SPLI4B(); - - /* failsafe */ - - if(cd->timeout_active == 0) - { - NDBGL4(L4_ERR, "ERROR: timeout_active == 0 !!!"); - } - else - { - cd->timeout_active = 0; - } - - /* incoming connections, simple idletime check */ - - if(cd->dir == DIR_INCOMING) - { - if((i4b_get_idletime(cd) + cd->max_idle_time) <= SECOND) - { - NDBGL4(L4_TIMO, "%ld: incoming-call, line idle timeout, disconnecting!", (long)SECOND); - (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, - (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - i4b_l4_idle_timeout_ind(cd); - } - else - { - NDBGL4(L4_TIMO, "%ld: incoming-call, activity, last_active=%ld, max_idle=%ld", (long)SECOND, (long)i4b_get_idletime(cd), (long)cd->max_idle_time); - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); - cd->timeout_active = 1; - } - } - - /* outgoing connections */ - - else if(cd->dir == DIR_OUTGOING) - { - switch( cd->shorthold_data.shorthold_algorithm ) - { - case SHA_FIXU: - i4b_idle_check_fix_unit( cd ); - break; - case SHA_VARU: - i4b_idle_check_var_unit( cd ); - break; - default: - NDBGL4(L4_TIMO, "%ld: bad value for shorthold_algorithm of %d", - (long)SECOND, cd->shorthold_data.shorthold_algorithm); - i4b_idle_check_fix_unit( cd ); - break; - } - } - splx(s); -} - -/*---------------------------------------------------------------------------* - * fixed unit algorithm B channel idle check timeout function - *---------------------------------------------------------------------------*/ -static void -i4b_idle_check_fix_unit(call_desc_t *cd) -{ - - /* simple idletime calculation */ - - if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0)) - { - if((i4b_get_idletime(cd) + cd->shorthold_data.idle_time) <= SECOND) - { - NDBGL4(L4_TIMO, "%ld: outgoing-call-st, idle timeout, disconnecting!", (long)SECOND); - (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - i4b_l4_idle_timeout_ind(cd); - } - else - { - NDBGL4(L4_TIMO, "%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld", - (long)SECOND, (long)i4b_get_idletime(cd), (long)cd->shorthold_data.idle_time); - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2); - cd->timeout_active = 1; - } - } - - /* full shorthold mode calculation */ - - else if((cd->shorthold_data.unitlen_time > 0) - && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))) - { - switch(cd->idletime_state) - { - - case IST_NONCHK: /* end of non-check time */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.idle_time)); - cd->idletimechk_start = SECOND; - cd->idletime_state = IST_CHECK; - cd->timeout_active = 1; - NDBGL4(L4_TIMO, "%ld: outgoing-call, idletime check window reached!", (long)SECOND); - break; - - case IST_CHECK: /* end of idletime chk */ - if((i4b_get_idletime(cd) > cd->idletimechk_start) && - (i4b_get_idletime(cd) <= SECOND)) - { /* activity detected */ - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.earlyhup_time)); - cd->timeout_active = 1; - cd->idletime_state = IST_SAFE; - NDBGL4(L4_TIMO, "%ld: outgoing-call, activity at %ld, wait earlyhup-end", (long)SECOND, (long)i4b_get_idletime(cd)); - } - else - { /* no activity, hangup */ - NDBGL4(L4_TIMO, "%ld: outgoing-call, idle timeout, last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd)); - (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - i4b_l4_idle_timeout_ind(cd); - cd->idletime_state = IST_IDLE; - } - break; - - case IST_SAFE: /* end of earlyhup time */ - - START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time+cd->shorthold_data.earlyhup_time))); - cd->timeout_active = 1; - cd->idletime_state = IST_NONCHK; - - if(cd->aocd_flag == 0) - { - cd->units_type = CHARGE_CALC; - cd->cunits++; - i4b_l4_charging_ind(cd); - } - - NDBGL4(L4_TIMO, "%ld: outgoing-call, earlyhup end, wait for idletime start", (long)SECOND); - break; - - default: - NDBGL4(L4_ERR, "outgoing-call: invalid idletime_state value!"); - cd->idletime_state = IST_IDLE; - break; - } - } -} - -/*---------------------------------------------------------------------------* - * variable unit algorithm B channel idle check timeout function - *---------------------------------------------------------------------------*/ -static void -i4b_idle_check_var_unit(call_desc_t *cd) -{ - switch(cd->idletime_state) - { - - /* see if there has been any activity within the last idle_time seconds */ - case IST_CHECK: - if( i4b_get_idletime(cd) > (SECOND - cd->shorthold_data.idle_time)) - { /* activity detected */ - /* check again in one second */ - cd->idle_timeout_handle = - START_TIMER (cd->idle_timeout_handle, i4b_idle_check, cd, hz); - cd->timeout_active = 1; - cd->idletime_state = IST_CHECK; - NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - activity at %ld, continuing", (long)SECOND, (long)i4b_get_idletime(cd)); - } - else - { /* no activity, hangup */ - NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd)); - (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - i4b_l4_idle_timeout_ind(cd); - cd->idletime_state = IST_IDLE; - } - break; - - default: - NDBGL4(L4_ERR, "outgoing-call: var idle timeout invalid idletime_state value!"); - cd->idletime_state = IST_IDLE; - break; - } -} diff --git a/sys/i4b/layer4/i4b_l4.h b/sys/i4b/layer4/i4b_l4.h deleted file mode 100644 index b02d9ac7c97a..000000000000 --- a/sys/i4b/layer4/i4b_l4.h +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l4.h - kernel interface to userland header file - * --------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Thu Oct 18 10:11:51 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_L4_H_ -#define _I4B_L4_H_ - -extern void i4bputqueue ( struct mbuf *m ); -extern void i4bputqueue_hipri(struct mbuf *m); -extern void i4b_l4_accounting(int, int, int, int, int, int, int, int, int); -extern void i4b_l4_alert_ind ( call_desc_t *cd ); -extern void i4b_l4_charging_ind( call_desc_t *cd ); -extern void i4b_l4_connect_active_ind ( call_desc_t *cd ); -extern void i4b_l4_connect_ind ( call_desc_t *cd ); -extern void i4b_l4_daemon_attached(void); -extern void i4b_l4_daemon_detached(void); -extern void i4b_l4_dialout( int driver, int driver_unit ); -extern void i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd); -extern void i4b_l4_keypad(int driver, int driver_unit, int cmdlen, char *cmd); -extern void i4b_l4_disconnect_ind ( call_desc_t *cd ); -extern void i4b_l4_drvrdisc (int driver, int driver_unit ); -extern void i4b_l4_negcomplete( call_desc_t *cd ); -extern void i4b_l4_ifstate_changed( call_desc_t *cd, int new_state ); -extern void i4b_l4_idle_timeout_ind( call_desc_t *cd ); -extern void i4b_l4_info_ind ( call_desc_t *cd ); -extern void i4b_l4_packet_ind(int, int, int, struct mbuf *pkt); -extern void i4b_l4_l12stat(int controller, int layer, int state); -extern void i4b_l4_pdeact(int controller, int numactive); -extern void i4b_l4_teiasg(int controller, int tei); -extern void i4b_l4_status_ind ( call_desc_t *cd ); -extern void i4b_l4_proceeding_ind ( call_desc_t *cd ); -extern void i4b_idle_check(call_desc_t *cdp); -extern call_desc_t * cd_by_cdid ( unsigned int cdid ); -extern call_desc_t * cd_by_unitcr ( int unit, int cr, int crf ); -extern void freecd_by_cd ( call_desc_t *cd ); -extern unsigned char get_rand_cr ( int unit ); -extern call_desc_t * reserve_cd ( void ); -extern void T400_start ( call_desc_t *cd ); -extern void T400_stop ( call_desc_t *cd ); - -#endif /* _I4B_L4_H_ */ diff --git a/sys/i4b/layer4/i4b_l4mgmt.c b/sys/i4b/layer4/i4b_l4mgmt.c deleted file mode 100644 index 1f3e9e3ca94d..000000000000 --- a/sys/i4b/layer4/i4b_l4mgmt.c +++ /dev/null @@ -1,436 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*--------------------------------------------------------------------------- - * - * i4b_l4mgmt.c - layer 4 calldescriptor management utilites - * ----------------------------------------------------------- - * last edit-date: [Sun Aug 11 12:42:01 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include - -#include -#include - -#include - -call_desc_t call_desc[N_CALL_DESC]; /* call descriptor array */ - -static unsigned int get_cdid(void); - -int nctrl; /* number of attached controllers */ - -void i4b_init_callout(call_desc_t *); - -/*---------------------------------------------------------------------------* - * return a new unique call descriptor id - * -------------------------------------- - * returns a new calldescriptor id which is used to uniquely identyfy - * a single call in the communication between kernel and userland. - * this cdid is then used to associate a calldescriptor with an id. - *---------------------------------------------------------------------------*/ -static unsigned int -get_cdid(void) -{ - static unsigned int cdid_count = 0; - int i; - int x; - - x = SPLI4B(); - - /* get next id */ - - cdid_count++; - -again: - if(cdid_count == CDID_UNUSED) /* zero is invalid */ - cdid_count++; - else if(cdid_count > CDID_MAX) /* wraparound ? */ - cdid_count = 1; - - /* check if id already in use */ - - for(i=0; i < N_CALL_DESC; i++) - { - if(call_desc[i].cdid == cdid_count) - { - cdid_count++; - goto again; - } - } - - splx(x); - - return(cdid_count); -} - -/*---------------------------------------------------------------------------* - * reserve a calldescriptor for later usage - * ---------------------------------------- - * searches the calldescriptor array until an unused - * descriptor is found, gets a new calldescriptor id - * and reserves it by putting the id into the cdid field. - * returns pointer to the calldescriptor. - *---------------------------------------------------------------------------*/ -call_desc_t * -reserve_cd(void) -{ - call_desc_t *cd; - int x; - int i; - - x = SPLI4B(); - - cd = NULL; - - for(i=0; i < N_CALL_DESC; i++) - { - if(call_desc[i].cdid == CDID_UNUSED) - { - bzero(&call_desc[i], sizeof(call_desc_t)); /* clear it */ - call_desc[i].cdid = get_cdid(); /* fill in new cdid */ - cd = &(call_desc[i]); /* get pointer to descriptor */ - NDBGL4(L4_MSG, "found free cd - index=%d cdid=%u", - i, call_desc[i].cdid); - break; - } - } - - splx(x); - - if(cd == NULL) - panic("reserve_cd: no free call descriptor available!"); - - i4b_init_callout(cd); - - return(cd); -} - -/*---------------------------------------------------------------------------* - * free a calldescriptor - * --------------------- - * free an unused calldescriptor by giving address of calldescriptor - * and writing a 0 into the cdid field marking it as unused. - *---------------------------------------------------------------------------*/ -void -freecd_by_cd(call_desc_t *cd) -{ - int i; - int x = SPLI4B(); - - for(i=0; i < N_CALL_DESC; i++) - { - if( (call_desc[i].cdid != CDID_UNUSED) && - (&(call_desc[i]) == cd) ) - { - NDBGL4(L4_MSG, "releasing cd - index=%d cdid=%u cr=%d", - i, call_desc[i].cdid, cd->cr); - call_desc[i].cdid = CDID_UNUSED; - break; - } - } - - if(i == N_CALL_DESC) - panic("freecd_by_cd: ERROR, cd not found, cr = %d\n", cd->cr); - - splx(x); -} - -/*---------------------------------------------------------------------------* - * return pointer to calldescriptor by giving the calldescriptor id - * ---------------------------------------------------------------- - * lookup a calldescriptor in the calldescriptor array by looking - * at the cdid field. return pointer to calldescriptor if found, - * else return NULL if not found. - *---------------------------------------------------------------------------*/ -call_desc_t * -cd_by_cdid(unsigned int cdid) -{ - int i; - - for(i=0; i < N_CALL_DESC; i++) - { - if(call_desc[i].cdid == cdid) - { - NDBGL4(L4_MSG, "found cdid - index=%d cdid=%u cr=%d", - i, call_desc[i].cdid, call_desc[i].cr); - - i4b_init_callout(&call_desc[i]); - - return(&(call_desc[i])); - } - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * search calldescriptor - * --------------------- - * This routine searches for the calldescriptor for a passive controller - * given by unit number, callreference and callreference flag. - * It returns a pointer to the calldescriptor if found, else a NULL. - *---------------------------------------------------------------------------*/ -call_desc_t * -cd_by_unitcr(int unit, int cr, int crf) -{ - int i; - - for(i=0; i < N_CALL_DESC; i++) - { - if((call_desc[i].cdid != CDID_UNUSED) && - (ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) && - (ctrl_desc[call_desc[i].controller].unit == unit) && - (call_desc[i].cr == cr) && - (call_desc[i].crflag == crf) ) - { - NDBGL4(L4_MSG, "found cd, index=%d cdid=%u cr=%d", - i, call_desc[i].cdid, call_desc[i].cr); - - i4b_init_callout(&call_desc[i]); - - return(&(call_desc[i])); - } - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * generate 7 bit "random" number used for outgoing Call Reference - *---------------------------------------------------------------------------*/ -unsigned char -get_rand_cr(int unit) -{ - register int i, j; - static u_char val, retval; - static int called = 42; - - val += ++called; - - for(i=0; i < 50 ; i++, val++) - { - int found = 1; - -#ifdef RANDOMDEV - read_random((char *)&val, sizeof(val)); -#else - val = (u_char)random(); -#endif /* RANDOMDEV */ - - retval = val & 0x7f; - - if(retval == 0 || retval == 0x7f) - continue; - - for(j=0; j < N_CALL_DESC; j++) - { - if( (call_desc[j].cdid != CDID_UNUSED) && - (call_desc[j].cr == retval) ) - { - found = 0; - break; - } - } - - if(found) - return(retval); - } - return(0); /* XXX */ -} - -/*---------------------------------------------------------------------------* - * initialize the callout handles for FreeBSD - *---------------------------------------------------------------------------*/ -void -i4b_init_callout(call_desc_t *cd) -{ - if(cd->callouts_inited == 0) - { - callout_handle_init(&cd->idle_timeout_handle); - callout_handle_init(&cd->T303_callout); - callout_handle_init(&cd->T305_callout); - callout_handle_init(&cd->T308_callout); - callout_handle_init(&cd->T309_callout); - callout_handle_init(&cd->T310_callout); - callout_handle_init(&cd->T313_callout); - callout_handle_init(&cd->T400_callout); - cd->callouts_inited = 1; - } -} - -/*---------------------------------------------------------------------------* - * daemon is attached - *---------------------------------------------------------------------------*/ -void -i4b_l4_daemon_attached(void) -{ - int i; - - int x = SPLI4B(); - - for(i=0; i < nctrl; i++) - { -/*XXX*/ if(*ctrl_desc[i].N_MGMT_COMMAND && - (ctrl_desc[i].ctrl_type == CTRL_PASSIVE || - ctrl_desc[i].ctrl_type == CTRL_CAPIMGR)) - { - NDBGL4(L4_MSG, "CMR_DOPEN sent to unit %d", ctrl_desc[i].unit); - (*ctrl_desc[i].N_MGMT_COMMAND)(ctrl_desc[i].unit, CMR_DOPEN, 0); - } - } - splx(x); -} - -/*---------------------------------------------------------------------------* - * daemon is detached - *---------------------------------------------------------------------------*/ -void -i4b_l4_daemon_detached(void) -{ - int i; - - int x = SPLI4B(); - - for(i=0; i < nctrl; i++) - { -/*XXX*/ if(*ctrl_desc[i].N_MGMT_COMMAND && - (ctrl_desc[i].ctrl_type == CTRL_PASSIVE || - ctrl_desc[i].ctrl_type == CTRL_CAPIMGR)) - { - NDBGL4(L4_MSG, "CMR_DCLOSE sent to unit %d", ctrl_desc[i].unit); - (*ctrl_desc[i].N_MGMT_COMMAND)(ctrl_desc[i].unit, CMR_DCLOSE, 0); - } - } - splx(x); -} - -#ifdef I4B_CD_DEBUG_PRINT - -extern char *print_l3state(call_desc_t *cd); - -void i4b_print_cdp(call_desc_t *cdp); -void i4b_print_cdx(int index); -void i4b_print_cda(void); -void i4b_print_cdaa(void); - -/*---------------------------------------------------------------------------* - * print a call descriptor by cd-pointer - *---------------------------------------------------------------------------*/ -void -i4b_print_cdp(call_desc_t *cdp) -{ - if((cdp > &(call_desc[N_CALL_DESC])) || (cdp < &(call_desc[0]))) - { - printf("i4b_print_cd: cdp out of range!\n"); - return; - } - - printf("i4b_print_cd: printing call descriptor %d at 0x%lx:\n", cdp - (&(call_desc[0])), (unsigned long)cdp); - - printf(" cdid = %d\n", cdp->cdid); - printf(" controller = %d (u=%d, dl=%d, b1=%d, b2=%d)\n", - cdp->controller, - ctrl_desc[cdp->controller].unit, - ctrl_desc[cdp->controller].dl_est, - ctrl_desc[cdp->controller].bch_state[CHAN_B1], - ctrl_desc[cdp->controller].bch_state[CHAN_B2]); - printf(" cr = 0x%02x\n", cdp->cr); - printf(" crflag = %d\n", cdp->crflag); - printf(" channelid = %d\n", cdp->channelid); - printf(" bprot = %d\n", cdp->bprot); - printf(" bcap = %d\n", cdp->bcap); - printf(" driver = %d\n", cdp->driver); - printf(" driver_unit = %d\n", cdp->driver_unit); - printf(" call_state = %d\n", cdp->call_state); - printf(" Q931state = %s\n", print_l3state(cdp)); - printf(" event = %d\n", cdp->event); - printf(" response = %d\n", cdp->response); - printf(" T303 = %d\n", cdp->T303); - printf("T303_first_to = %d\n", cdp->T303_first_to); - printf(" T305 = %d\n", cdp->T305); - printf(" T308 = %d\n", cdp->T308); - printf("T308_first_to = %d\n", cdp->T308_first_to); - printf(" T309 = %d\n", cdp->T309); - printf(" T310 = %d\n", cdp->T310); - printf(" T313 = %d\n", cdp->T313); - printf(" T400 = %d\n", cdp->T400); - printf(" dir = %s\n", cdp->dir == DIR_OUTGOING ? "out" : "in"); -} - -/*---------------------------------------------------------------------------* - * print a call descriptor by index - *---------------------------------------------------------------------------*/ -void -i4b_print_cdx(int index) -{ - if(index >= N_CALL_DESC) - { - printf("i4b_print_cdx: index %d >= N_CALL_DESC %d\n", index, N_CALL_DESC); - return; - } - i4b_print_cdp(&(call_desc[index])); -} - -/*---------------------------------------------------------------------------* - * print all call descriptors - *---------------------------------------------------------------------------*/ -void -i4b_print_cda(void) -{ - int i; - - for(i=0; i < N_CALL_DESC; i++) - { - i4b_print_cdp(&(call_desc[i])); - } -} - -/*---------------------------------------------------------------------------* - * print all active call descriptors - *---------------------------------------------------------------------------*/ -void -i4b_print_cdaa(void) -{ - int i; - - for(i=0; i < N_CALL_DESC; i++) - { - if(call_desc[i].cdid != CDID_UNUSED) - { - i4b_print_cdp(&(call_desc[i])); - } - } -} - -#endif /* I4B_CD_DEBUG_PRINT */ diff --git a/sys/i4b/layer4/i4b_l4timer.c b/sys/i4b/layer4/i4b_l4timer.c deleted file mode 100644 index 90d564db5b02..000000000000 --- a/sys/i4b/layer4/i4b_l4timer.c +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l4timer.c - timer and timeout handling for layer 4 - * -------------------------------------------------------- - * last edit-date: [Sat Mar 9 19:49:13 2002] - * - *---------------------------------------------------------------------------*/ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include - -#include -#include - -#include - -/*---------------------------------------------------------------------------* - * timer T400 timeout function - *---------------------------------------------------------------------------*/ -static void -T400_timeout(call_desc_t *cd) -{ - NDBGL4(L4_ERR, "cr = %d", cd->cr); -} - -/*---------------------------------------------------------------------------* - * timer T400 start - *---------------------------------------------------------------------------*/ -void -T400_start(call_desc_t *cd) -{ - if (cd->T400 == TIMER_ACTIVE) - return; - - NDBGL4(L4_MSG, "cr = %d", cd->cr); - cd->T400 = TIMER_ACTIVE; - - START_TIMER(cd->T400_callout, T400_timeout, cd, T400DEF); -} - -/*---------------------------------------------------------------------------* - * timer T400 stop - *---------------------------------------------------------------------------*/ -void -T400_stop(call_desc_t *cd) -{ - CRIT_VAR; - CRIT_BEG; - - if(cd->T400 == TIMER_ACTIVE) - { - STOP_TIMER(cd->T400_callout, T400_timeout, cd); - cd->T400 = TIMER_IDLE; - } - CRIT_END; - NDBGL4(L4_MSG, "cr = %d", cd->cr); -} diff --git a/sys/pc98/conf/NOTES b/sys/pc98/conf/NOTES index 6f50f50f55da..cc7a4c7a6bca 100644 --- a/sys/pc98/conf/NOTES +++ b/sys/pc98/conf/NOTES @@ -500,143 +500,6 @@ device pmtimer # Adjust system timer at wakeup time options POWERFAIL_NMI # make it beep instead of panicing -#--------------------------------------------------------------------------- -# ISDN4BSD -# -# See /usr/share/examples/isdn/ROADMAP for an introduction to isdn4bsd. -# -# i4b passive ISDN cards support contains the following hardware drivers: -# -# isic - Siemens/Infineon ISDN ISAC/HSCX/IPAC chipset driver -# iwic - Winbond W6692 PCI bus ISDN S/T interface controller -# ifpi - AVM Fritz!Card PCI driver -# ifpi2 - AVM Fritz!Card PCI version 2 driver -# ihfc - Cologne Chip HFC ISA/ISA-PnP chipset driver -# ifpnp - AVM Fritz!Card PnP driver -# itjc - Siemens ISAC / TJNet Tiger300/320 chipset -# -# i4b active ISDN cards support contains the following hardware drivers: -# -# iavc - AVM B1 PCI, AVM B1 ISA, AVM T1 -# -# Note that the ``options'' (if given) and ``device'' lines must BOTH -# be uncommented to enable support for a given card ! -# -# In addition to a hardware driver (and probably an option) the mandatory -# ISDN protocol stack devices and the mandatory support device must be -# enabled as well as one or more devices from the optional devices section. -# -#--------------------------------------------------------------------------- -# isic driver (Siemens/Infineon chipsets) -# -device isic -# -# PCI bus Cards: -# -------------- -# -# ELSA MicroLink ISDN/PCI (same as ELSA QuickStep 1000pro PCI) -options ELSA_QS1PCI -# -#--------------------------------------------------------------------------- -# ifpnp driver for AVM Fritz!Card PnP -# -# AVM Fritz!Card PnP -device ifpnp -# -#--------------------------------------------------------------------------- -# ihfc driver for Cologne Chip ISA chipsets (experimental!) -# -# Teles 16.3c ISA PnP -# AcerISDN P10 ISA PnP -# TELEINT ISDN SPEED No.1 -device ihfc -# -#--------------------------------------------------------------------------- -# ifpi driver for AVM Fritz!Card PCI -# -# AVM Fritz!Card PCI -device ifpi -# -#--------------------------------------------------------------------------- -# ifpi2 driver for AVM Fritz!Card PCI version 2 -# -# AVM Fritz!Card PCI version 2 -device ifpi2 -# -#--------------------------------------------------------------------------- -# iwic driver for Winbond W6692 chipset -# -# ASUSCOM P-IN100-ST-D (and other Winbond W6692 based cards) -device iwic -# -#--------------------------------------------------------------------------- -# itjc driver for Siemens ISAC / TJNet Tiger300/320 chipset -# -# Traverse Technologies NETjet-S -# Teles PCI-TJ -device itjc -# -#--------------------------------------------------------------------------- -# iavc driver (AVM active cards, needs i4bcapi driver!) -# -device iavc -# -#--------------------------------------------------------------------------- -# ISDN Protocol Stack - mandatory for all hardware drivers -# -# Q.921 / layer 2 - i4b passive cards D channel handling -device i4bq921 -# -# Q.931 / layer 3 - i4b passive cards D channel handling -device i4bq931 -# -# layer 4 - i4b common passive and active card handling -device i4b -# -#--------------------------------------------------------------------------- -# ISDN devices - mandatory for all hardware drivers -# -# userland driver to do ISDN tracing (for passive cards only) -device i4btrc -options NI4BTRC=4 -# -# userland driver to control the whole thing -device i4bctl -# -#--------------------------------------------------------------------------- -# ISDN devices - optional -# -# userland driver for access to raw B channel -device i4brbch -options NI4BRBCH=4 -# -# userland driver for telephony -device i4btel -options NI4BTEL=2 -# -#XXXBZ# IPR and ISPPP are not usable until I4B is locked. -# network driver for IP over raw HDLC ISDN -#XXXBZ#device i4bipr -#XXXBZ#options NI4BIPR=4 -# enable VJ header compression detection for ipr i/f -#XXXBZ#options IPR_VJ -# enable logging of the first n IP packets to isdnd (n=32 here) -#XXXBZ#options IPR_LOG=32 -# -# network driver for sync PPP over ISDN; requires an equivalent -# number of sppp device to be configured -#XXXBZ#device i4bisppp -#XXXBZ#options NI4BISPPP=4 -# -# B-channel interface to the netgraph subsystem -#XXXBZ#device i4bing -#XXXBZ#options NI4BING=2 -# -# CAPI driver needed for active ISDN cards (see iavc driver above) -device i4bcapi -# -#--------------------------------------------------------------------------- - # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can @@ -739,7 +602,6 @@ options FB_INSTALL_CDEV # install a CDEV entry in /dev options PECOFF_SUPPORT options PECOFF_DEBUG -options I4B_SMP_WORKAROUND options I586_PMC_GUPROF=0x70000 options KBDIO_DEBUG=2 options KBD_MAXRETRY=4 diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 3c42819528e8..023f7f384a74 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -410,63 +410,6 @@ OLD_FILES+=usr/share/man/man1/gcov.1.gz # to be filled in #.endif -.if ${MK_I4B} == no -OLD_FILES+=usr/sbin/dtmfdecode -OLD_FILES+=usr/sbin/g711conv -OLD_FILES+=usr/sbin/isdnd -OLD_FILES+=usr/sbin/isdndebug -OLD_FILES+=usr/sbin/isdndecode -OLD_FILES+=usr/sbin/isdnmonitor -OLD_FILES+=usr/sbin/isdnphone -OLD_FILES+=usr/sbin/isdntel -OLD_FILES+=usr/sbin/isdntelctl -OLD_FILES+=usr/sbin/isdntrace -OLD_FILES+=usr/share/isdn/0.al -OLD_FILES+=usr/share/isdn/1.al -OLD_FILES+=usr/share/isdn/2.al -OLD_FILES+=usr/share/isdn/3.al -OLD_FILES+=usr/share/isdn/4.al -OLD_FILES+=usr/share/isdn/5.al -OLD_FILES+=usr/share/isdn/6.al -OLD_FILES+=usr/share/isdn/7.al -OLD_FILES+=usr/share/isdn/8.al -OLD_FILES+=usr/share/isdn/9.al -OLD_FILES+=usr/share/isdn/beep.al -OLD_FILES+=usr/share/isdn/msg.al -OLD_FILES+=usr/share/man/man1/dtmfdecode.1.gz -OLD_FILES+=usr/share/man/man1/g711conv.1.gz -OLD_FILES+=usr/share/man/man4/i4b.4.gz -OLD_FILES+=usr/share/man/man4/i4bcapi.4.gz -OLD_FILES+=usr/share/man/man4/i4bctl.4.gz -OLD_FILES+=usr/share/man/man4/i4bing.4.gz -OLD_FILES+=usr/share/man/man4/i4bipr.4.gz -OLD_FILES+=usr/share/man/man4/i4bisppp.4.gz -OLD_FILES+=usr/share/man/man4/i4bq921.4.gz -OLD_FILES+=usr/share/man/man4/i4bq931.4.gz -OLD_FILES+=usr/share/man/man4/i4brbch.4.gz -OLD_FILES+=usr/share/man/man4/i4btel.4.gz -OLD_FILES+=usr/share/man/man4/i4btrc.4.gz -OLD_FILES+=usr/share/man/man4/iavc.4.gz -OLD_FILES+=usr/share/man/man4/isic.4.gz -OLD_FILES+=usr/share/man/man4/ifpi.4.gz -OLD_FILES+=usr/share/man/man4/ifpi2.4.gz -OLD_FILES+=usr/share/man/man4/ifpnp.4.gz -OLD_FILES+=usr/share/man/man4/ihfc.4.gz -OLD_FILES+=usr/share/man/man4/itjc.4.gz -OLD_FILES+=usr/share/man/man4/iwic.4.gz -OLD_FILES+=usr/share/man/man5/isdnd.rc.5.gz -OLD_FILES+=usr/share/man/man5/isdnd.rates.5.gz -OLD_FILES+=usr/share/man/man5/isdnd.acct.5.gz -OLD_FILES+=usr/share/man/man8/isdnd.8.gz -OLD_FILES+=usr/share/man/man8/isdndebug.8.gz -OLD_FILES+=usr/share/man/man8/isdndecode.8.gz -OLD_FILES+=usr/share/man/man8/isdnmonitor.8.gz -OLD_FILES+=usr/share/man/man8/isdnphone.8.gz -OLD_FILES+=usr/share/man/man8/isdntel.8.gz -OLD_FILES+=usr/share/man/man8/isdntelctl.8.gz -OLD_FILES+=usr/share/man/man8/isdntrace.8.gz -.endif - .if ${MK_INET6} == no OLD_FILES+=rescue/ping6 OLD_FILES+=sbin/ping6 diff --git a/tools/build/options/WITHOUT_I4B b/tools/build/options/WITHOUT_I4B deleted file mode 100644 index 51da618cbb7b..000000000000 --- a/tools/build/options/WITHOUT_I4B +++ /dev/null @@ -1,2 +0,0 @@ -.\" $FreeBSD$ -Set to not build isdn4bsd package. diff --git a/tools/kerneldoc/subsys/Dependencies b/tools/kerneldoc/subsys/Dependencies index 2eda312d2085..6307b485b488 100644 --- a/tools/kerneldoc/subsys/Dependencies +++ b/tools/kerneldoc/subsys/Dependencies @@ -18,5 +18,3 @@ $(.OBJDIR)/dev_pci/dev_pci.tag: $(.OBJDIR)/pci_if.h \ $(.OBJDIR)/pcib_if.h \ $(.OBJDIR)/bus_if.h -$(.OBJDIR)/i4b/i4b.tag: $(.OBJDIR)/dev_pci/dev_pci.tag - diff --git a/tools/kerneldoc/subsys/Doxyfile-i4b b/tools/kerneldoc/subsys/Doxyfile-i4b deleted file mode 100644 index 5573e840a9d1..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-i4b +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.4.1 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel ISDN code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/i4b/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#-------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/i4b/ $(NOTREVIEWED) - -GENERATE_TAGFILE = i4b/i4b.tag -TAGFILES = dev_pci/dev_pci.tag=../../dev_pci/html - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 1467b74528f5..d6a7fee393d7 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -62,7 +62,6 @@ SUBDIR= ac \ getfmac \ getpmac \ gstat \ - ${_i4b} \ ifmcstat \ inetd \ iostat \ @@ -301,9 +300,6 @@ _apm= apm _apmd= apmd _asf= asf _btxld= btxld -.if ${MK_I4B} != "no" -_i4b= i4b -.endif _kgmon= kgmon _kgzip= kgzip _lptcontrol= lptcontrol diff --git a/usr.sbin/i4b/Makefile b/usr.sbin/i4b/Makefile deleted file mode 100644 index 01f76421a1fa..000000000000 --- a/usr.sbin/i4b/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -SUBDIR= dtmfdecode g711conv isdnd isdndebug isdndecode isdnmonitor isdnphone \ - isdntel isdntelctl isdntest isdntrace man - -.include - diff --git a/usr.sbin/i4b/Makefile.inc b/usr.sbin/i4b/Makefile.inc deleted file mode 100644 index 11954191e2ea..000000000000 --- a/usr.sbin/i4b/Makefile.inc +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD$ - -# if you don't like curses stuff in the daemon (i.e. don't intend -# to ever run it in the foreground but are using the monitoring -# utilities instead) define this to compile it without. -#I4B_WITHOUT_CURSES = 1 - -# if you would like monitoring support, define this -I4B_EXTERNAL_MONITOR = 1 - -# for the security conscious type: restrict monitoring to the -# local machine by not compiling any tcp/ip support for monitoring -# at all -#I4B_NOTCPIP_MONITOR = 1 - -.include "${.CURDIR}/../../Makefile.inc" diff --git a/usr.sbin/i4b/dtmfdecode/Makefile b/usr.sbin/i4b/dtmfdecode/Makefile deleted file mode 100644 index 74a9df7cde9d..000000000000 --- a/usr.sbin/i4b/dtmfdecode/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -#--------------------------------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Tue Dec 14 21:17:46 1999] -# -#--------------------------------------------------------------------------- - -PROG= dtmfdecode - -CFLAGS+= -DDEBUG - -# libm is only necessary if USE_COS is defined in the source -#LDADD= -lm - -test: ${PROG} - uudecode -p < dtmfsounds.al.uu | ./${PROG} - -.include diff --git a/usr.sbin/i4b/dtmfdecode/dtmfdecode.1 b/usr.sbin/i4b/dtmfdecode/dtmfdecode.1 deleted file mode 100644 index 53f673af6e9c..000000000000 --- a/usr.sbin/i4b/dtmfdecode/dtmfdecode.1 +++ /dev/null @@ -1,70 +0,0 @@ -.\" -.\" Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: dtmfdecode.1,v 1.6 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 22:53:13 1999] -.\" -.\" -.Dd February 15, 1999 -.Dt DTMFDECODE 1 -.Os -.Sh NAME -.Nm dtmfdecode -.Nd decodes DTMF tones from A-law audio data -.Sh SYNOPSIS -.Nm -.Sh DESCRIPTION -The -.Nm -utility -is part of the isdn4bsd package and is used to detect DTMF tones in the -audio stream. -.Pp -It reads audio G.711 A-Law coded data from stdin and outputs the detected -numbers values as ASCII characters to stdout. -.Pp -The detector is implemented as 8 narrow band-pass filters realized with -an integer double-cross recursive algorithm. -Various ad-hoc methods are -employed to provide hysteresis and anti-bounce for the detected signals. -.Sh EXAMPLES -The command: -.Bd -literal -offset indent -dtmfdecode < beep.al -.Ed -.Pp -will print a "1" to stdout. -.Sh STANDARDS -ITU Recommendations G.711 -.Sh AUTHORS -.An -nosplit -The -.Nm -utility was written by -.An Poul-Henning Kamp Aq phk@FreeBSD.org . -This man page was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/dtmfdecode/dtmfdecode.c b/usr.sbin/i4b/dtmfdecode/dtmfdecode.c deleted file mode 100644 index 16c68e62e022..000000000000 --- a/usr.sbin/i4b/dtmfdecode/dtmfdecode.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - * - * $Id: dtmfdecode.c,v 1.6 1999/12/13 21:25:24 hm Exp $ - * - * $FreeBSD$ - * - * Extract DTMF signalling from ISDN4BSD A-law coded audio data - * - * A-Law to linear conversion from the sox package. - * - */ - -#include -#include - -/* Integer math scaling factor */ -#define FSC (1<<12) - -/* Alaw parameters */ -#define SIGN_BIT (0x80) /* Sign bit for an A-law byte. */ -#define QUANT_MASK (0xf) /* Quantization field mask. */ -#define SEG_SHIFT (4) /* Left shift for segment number. */ -#define SEG_MASK (0x70) /* Segment field mask. */ - -static int -alaw2linear(a_val) - unsigned char a_val; -{ - int t; - int seg; - - a_val ^= 0x55; - - t = (a_val & QUANT_MASK) << 4; - seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT; - switch (seg) { - case 0: - t += 8; - break; - case 1: - t += 0x108; - break; - default: - t += 0x108; - t <<= seg - 1; - } - return ((a_val & SIGN_BIT) ? t : -t); -} - -#ifdef USE_COS -/* The frequencies we're trying to detect */ -static int dtmf[8] = {697, 770, 852, 941, 1209, 1336, 1477, 1633}; -#else -/* precalculated: p1[kk] = (-cos(2 * 3.141592 * dtmf[kk] / 8000.0) * FSC) */ -static int p1[8] = {-3497, -3369, -3212, -3027, -2384, -2040, -1635, -1164}; -#endif - -/* This is the Q of the filter (pole radius) */ -#define POLRAD .99 - -#define P2 ((int)(POLRAD*POLRAD*FSC)) - -int -main(int argc, char **argv) -{ - int i, kk, t, nn, s, so, ia; - int x, c, d, f, h[8], k[8], n, y[8]; -#ifdef USE_COS - int p1[8]; -#endif - int alaw[256]; - char key[256]; - - for (kk = 0; kk < 8; kk++) { - y[kk] = h[kk] = k[kk] = 0; -#ifdef USE_COS - p1[kk] = (-cos(2 * 3.141592 * dtmf[kk] / 8000.0) * FSC); -#endif - } - - for (i = 0; i < 256; i++) { - key[i] = '?'; - alaw[i] = alaw2linear(i) / (32768/FSC); - } - - /* We encode the tones in 8 bits, translate those to symbol */ - key[0x00] = '\0'; - - key[0x11] = '1'; key[0x12] = '4'; key[0x14] = '7'; key[0x18] = '*'; - key[0x21] = '2'; key[0x22] = '5'; key[0x24] = '8'; key[0x28] = '0'; - key[0x41] = '3'; key[0x42] = '6'; key[0x44] = '9'; key[0x48] = '#'; - key[0x81] = 'A'; key[0x82] = 'B'; key[0x84] = 'C'; key[0x88] = 'D'; - - nn = 0; - ia = 0; - so = 0; - t = 0; - while ((i = getchar()) != EOF) - { - t++; - - /* Convert to our format */ - x = alaw[i]; - - /* Input amplitude */ - if (x > 0) - ia += (x - ia) / 128; - else - ia += (-x - ia) / 128; - - /* For each tone */ - s = 0; - for(kk = 0; kk < 8; kk++) { - - /* Turn the crank */ - c = (P2 * (x - k[kk])) / FSC; - d = x + c; - f = (p1[kk] * (d - h[kk])) / FSC; - n = x - k[kk] - c; - k[kk] = h[kk] + f; - h[kk] = f + d; - - /* Detect and Average */ - if (n > 0) - y[kk] += (n - y[kk]) / 64; - else - y[kk] += (-n - y[kk]) / 64; - - /* Threshold */ - if (y[kk] > FSC/10 && y[kk] > ia) - s |= 1 << kk; - } - - /* Hysteresis and noise supressor */ - if (s != so) { -/* printf("x %d %x -> %x\n",t,so, s); */ - nn = 0; - so = s; - } else if (nn++ == 520 && key[s]) { - putchar(key[s]); -/* printf(" %d %x\n",t,s); */ - } - } - putchar('\n'); - return (0); -} diff --git a/usr.sbin/i4b/dtmfdecode/dtmfsounds.al.uu b/usr.sbin/i4b/dtmfdecode/dtmfsounds.al.uu deleted file mode 100644 index f4e0c07c5763..000000000000 --- a/usr.sbin/i4b/dtmfdecode/dtmfsounds.al.uu +++ /dev/null @@ -1,2098 +0,0 @@ -$FreeBSD$ -begin 666 dtmfsounds.al -M5555U=74U-564-34UU%5U-?1UM'7UM37U=5555145%545%155%555%555=75 -M5575U=75U-15U5555575U575U=75U=75U=34U-35U-35U=75U=55U=5555%0 -MU-374535U-;7T=?6U]?4U-75U555551555555555555555555%5555145=75 -MU-34U-34U-35U=75U=75U=55U=75U=55555555755=5545/4U-=15-37T=;1 -MU];7U]34U=5555555%145%145%555555U555U=55U=34U=75U=75U-75U=35 -MU-74U=74U-75U=75U=75U=55U=75U=564-34UU!4U-36U]'6UM?7U-35U555 -M55555555555455155555555555545%55U-74U-34U-34U=74U-35U=35U=75 -MU=75U=75U=75U=75U590U-374534U-'6T=;6U]?5U-555%145%155%545555 -M5555U555U=75U=74U-5555755=75U=74U=75U=75U=35U=34U=74U-35U=75 -M555545/4U-=15-34T=;1U];7U]34U=55555555555%555%545%555=555575 -M5535U=34U-34U-34U-34U-75U=555555555555555555U=75U=514]34UU%4 -MU-?1UM'6UM?6U-15U51555155514551455555=75U=75U=75U=35U=75U=75 -MU=75U-34U-34U-75U=75U=75U=74U=75U=5555%0U-374535U-'6T=;1UM;4 -MU-75555555145%555555555555555575U5555=75U-34U-34U-74U=75U-74 -MU=75U=5555555=55U=75U=755E#4U-=15-34T=;1UM;7U]34U=5555555514 -M5%555%5555155575U=74U=74U55555555=75U-35U-34U-75U=75U-75U=75 -M5555555555104]74UU%5U-;0UM#6UM?7U=35U-755554551455155%155575 -MU=75U=155U755=75U-34U-34U-34U-75U575U555U=55U5555575U=75U5%3 -MU-375E74U]'6T=?6U]?4U-755=5555145%5555555555U=55U555U575U-55 -MU=75U=75U=34U=35U=75U=75U-75U=74U-75U=75U=7545/4U-=15-74UM36 -MU];7U]34U=75U5555%5455555555555555555%5555=4U=74U-34U]34U-35 -MU=75U=75U555555555555555U555U5564]34UU94U-?1U]'7UM37U-35U=75 -M555555145%5455155575U=75U=75U=?4U=75U=75U=75U=75U=75U-35U-75 -MU=75U=35U=75U=7555%3U-?74534U-;7UM?6U]?7U-35U555555555545%14 -M55555575U=75U5545%55U=74U]?7U-34U-35U=75U=75U=75U=75U=75U=75 -MU=5545/5U-965=?7T=;1U];4U]75U5555555555555155%5555555=75U=35 -MU=74U-75U=75U-74U=75U=75U=35U=35U-74U=75U=75555555514]37UE95 -MU-31UM'7UM?7U-35U-5555555%545%145%155575U575U=345%75U=34U-34 -MU-34U=75U=75U=75U=75555555555=55U575U5%3U-374534U]'6T=;1U]?4 -MU-755554551555555555555555555=75U575U-35U=75U=35U-75U-75U-34 -MU=75U=75U=75U=75U=75U55545/5U-=15-74UM;6U];4U]34U=5555555555 -M55555%1555555=55U=75U5145575U=77U-?7U]34U-35U=75U=75U=55U=55 -MU=75U=75U=564]34UU%4U=36U];7U]37U=35U=75555555555%555%555%55 -M5=75U=75U=34U=55U=75U=75U-75U=74U=74U-35U=75U-34U-75U57555%3 -MU=774534U-'6T=;6U];4U-74U555551555545514555555555=75U=155-75 -MU-34U-34U-35U=75U=75U=755=5555555=75U=755=5545#5U-=15=37T=;1 -MU];7U]74U=5555155%555%155%145575U=75U=75U=74U-35U=75U=35U=75 -MU=74U=75U=75U=74U=75U=55U555U5514]75UU%4U=31U]'7UM?7U-35U555 -M5%1455155%55555555555=75U=355515U=75U-34U-37U-35U=75U=35U-75 -M555555555575U=75U590U-375E77U]'6T=;1U]?4U-755555555555555514 -M555455155555U=55U-35U=75U-74U-74U-74U=75U=75U=35U=75U=75U=55 -MU55545+5U=115-37T=;0UM;7UM37U-15U5555%5455555%555%555=75U575 -MU%54U=75U-75U-34U-35U=75U=74U=74U=75U575U=75U=75U=514-34UU%4 -MU-?1UM'6UM?7U-35U5755555551555145515555555755=75U=34U=75U575 -MU555U=55U=75U=75U=75U=34U-75U=75U=75U590U-?65E37U-'6T=?6U];4 -MU]3555545%145U145%1455555575U=55U=555-75U-34U-37U-34U-34U=35 -MU=75U=75U555555555555=755E#4U]965=37T-;1UM;4U]745=55U5555514 -M5%1455155=755=75U=75U=74U]75U=75U=75U=75U=75U=75U=74U-35U-35 -MU=75U555U5514]75UU%4U-31UM'7UM?7U-?4U-7555555%145%=455555575 -MU=755=755%15U=74U-34U-34U-34U-75U=75U=55U=55U=55U=75U=75U590 -MU]365E77U];6T=?7U=35U5755555555555555%5555555=55U555U=75U-?5 -MU=75U-75U-35U-34U=75U=75U=75U=75U=555=55U=7545/5U-=65=37T=;1 -MU]'7UM34U=7555555%1455555%555555U=755=75U5545=75U-34U-34U-75 -MU=75U=75U=755=75U=55U=75U=75U=564-37UE95U-31UM'6UM?7U-35U=75 -M55555%155%14551555555555U=75U=37U]35U=35U=755=75U=74U-35U-75 -MU=75U=75U=75U=75U5%3U=374534U-;7UM?6U-?4U]345=5555545%545555 -M55555555U555U=555%55U=74U-34U]34U-35U=75U=75U=75U=75U=75U=75 -MU=7545/5U-=15-37T='0UM'7U]34U=35U5555%145%14555455555555U=74 -MU-74U]35U5755555U575U=74U-34U-75U=75U=74U=74U=74U-164]34UU%4 -MU-31U]'6T=?7U-35U=755=75555555545%15551555555575U515U-34U-34 -MU-35U-34U-34U-75U55555555555U=75U=75U590U-364534U-;6T=;1U];7 -MU-7555555555555555555%5555755555U555U=34U=75U-74U-35U=35U-74 -MU-74U-35U=75U=75U=75U=755E#4U-=15-34UM?1U]'7UM?7U-3555555%55 -M55555%155%1555555575U=545=34U-?7U-34U-35U=755=75U=75U=35U=75 -MU=75U=74U=564-37UE94U-31UM'7UM37U-35U%5555545%145%555%555575 -MU=75U=75U=74U]75U=75U-74U=74U=75U=75U=75U=75U=35U=75U=75U5%3 -MU=374534U-'6T=?6U-?4U-7555555%145%145%145%55U575U-75U=355%75 -MU=75U=35U=34U-35U-35U=75U-75U=75U=75U=75U=755E/4U-965=37T=;1 -MUM;7U]74U=75555555545%=45%145%155575U=75U=75U-?5U=75U=34U=75 -MU-?5U-15U]=5U=55U-?4U=355=555%534-54UM57U]'4UM#4U]37U577UE+4 -MU432V5?%4U]40-!5U]I4U%-0U=77UE;3UU/64-'24M'45]W55]'1UU574%'5 -MUM34TU14UU!75E'7UM%5U=!77E=4T=+3W];65%]15U70T=S15%105U16UE!6 -MT]7655Q55%?1U-957UU7VVNJ6]CXFTM)(6$H6RLUP^)C]FB)D/.SLW!`$*"Q&2 -MZ@PX.P6VN[4&/#;DM[:%4N:'AW0`&X"XNX0W.0F/N++D#@]ME_X1%)RTCQX\ -M/QVQNXH#/C!XCXSD$7V1Z!HT#I*\OY`P.C6!O['.#@UFE=,=:H6VB!T\/Q"S -MNK4&/#9TC(+_%<69E`0V")*_OI$P.C6'O+;9#`-Y[WX:%(>QBAP_/A.PNK4& -M/3=*@H;`;N:$E@8Q"YV^OI,P.C6'LK?=`@=/X&X&%H&SM1P_/A*PNK4',C1) -M@85<8I6`D0`S-9V^N9,P.S6%L[37`1O?Y!$#$8.RM!P^/AVPN[4$,S5-AYQQ -M9Y.-DP(R-)VYN9(Q.PJ:L(I1!Q+S^1\,$X*]MQP^.1RQNXH%,0M$FI1F>)B. -MG0T]-)VYN9TQ.`N8L8E>!6KA\`4)'8R_MQPY.1RVN(L:-@Y2GN!I<(2+GP\\ -M-YVYN9PV.0B>MXQ`'F7KRP8*'(^^MATY.1^VN8@8-PW5D\P72H"TF0X_-I*Y -MN9PV/@F7(^VA0@Y,9.YN9\W/`^0 -MB85_;^F;UPXV!8BXL!,Y/AZTO(P=#AKWYQ<%5XBPA`LX,9"YN9\T/0V1C)]E -M9)"$5@LQ!8N[L!,^/AZUO8(2#1S_]AP'T+6SAPHX,9&^N9\U,@*7@)%F=)B! -M7C4P!(J[L!`^/AZ*LX`0`!?DTP4!W+2RA@H[,):^OI\U,`"4A^]B58>"7C0R -M!XJZLQ$^/QZ(L(81!V+@308"V+>\@34[,)2_OIP+,0;JFO)I]8.,63<]!HJZ -MLQ8_/!Z.MH06&W?O?@(,V[:_@34[,)6_OYT)-@3HG5!J^HR)6#8\`8JZLQ<\ -M/!^/MYH4'<&58`\.V+&^@#4Z,.J\O)T.-!KNEG@7XHF+63$_`(JZLQ0\/1R- -MM9\5%.:7:0@+WK"^@S4Z,.F]O9,,"A_L[&D1Z[6U7C`_`XJZLVH],AV#B)!K -M8Y20%#4UW;"Y@C4Z,.RRLI`""1#M_Q`2E[2T73`^`HJZLV@R,Q*!CY5H<9V= -M$30TT+.XC0H[,.*SLY$`#!7BT1DQL94'!WW@8P$:G["QTC(X#(B[L&TQ-A>:FMQM[X*$&3`Q1;*[C`@X -M,>6VM^@%&%'@%0T$F;*PV#(X#(FXL6,V-!6>G71BEX^'&S,P0+VZCP@X,?ZW -MM.P8$_#@$PX'F[VSPS([#XFXL6$W-6F=E&9BG8B!!3(P3KVZCPDY-OVTBN$< -M:N/@'@L!A;RRR#T[#XZYMF8T"&*0X6IBF+6#!3TS=KVZCPX^-_&*B?L3993C -M!34`A;^]]ST[#XR^MV<*#V>7PA!MA+>-!#PR(C?867)+B!S<" -MA+^]\CT[#XV_MV4(`GSK2AYMAK:,!#\]>+VZCPP\-/6/@-IJ_9OM`38-A+Z\ -M_C([#X*\M&4/`4[M8`5M@[".!SX]9;*[CPT]-GQV2$!?U=_$P\[*]/?W -M]_?W]/3UR,[-P,?:V=S3T=155U%04U)=7%Q?7U]?7%Q=4E-345%65U=45575 -MU-37UM;6UM;6UM;6UM;6UM;6UM?7U]355U34UM;7UM?7U-35U=75U=75U=75 -MU=75U=75U=74U=34U-34U-34U-74U-34U-34U-34U=34U-35U-34U-34U-35 -MU-34U-34U-34U-34U5565-76UM?7U]?4U-75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U-34U=35U=75U=75U=75U-75U-75U=75U=75U-34U=75 -MU=755594U=;6U]?4U-35U=75U=75U=75U=75U=75U=75U=74U=75U=75U=75 -MU=74U-75U=75U575U=55U=75U=75U5555=75U=75U=75U=75U=545E?5UM?7 -MU]34U=75U=755=75U5755=5555555575U=75U=75U=75U=75U=34U-35U-75 -MU=75U=75U=75U=755575U=75U=75U=75U=55U5165]76U]?7U-35U=75U=75 -MU=75U575555555555=75U=75U=755=75U=75U=75U=75U555U=75U=75U=75 -MU=75U575U=75U=755=755=555%%75=;7U]?4U-75U=75U=75U=75U5755=55 -MU=75U=75U=75U575U=75U=74U=35U=55U575U=75U=75U=75U=755=75U=75 -MU=75U=555=545E?5UM?7U]34U=35U=75U=55U555555555555=3ED.GF^<71 -M271^>65E9V1D97A_5]?2WMK&P\W.RW-/6 -MU]555E914%-34U)24E)24U)34U!045%65E=75%555=75U-74U-37UM?4U535 -MU=35U-34U575U=74U=75U5555555555555555%145%155%15U=155=75U-74 -MU=75U=755=75U=74U-55U55555545555U=75U=37U]545E155=75U=75U-?7 -MU-75U=7555545555U=75U=75U=75U=555=75U575U-34U-34U]35U=555555 -M5=75U-34U-74U=7555555=55U=37U5575%755=75U=545=75U=75U=74U=75 -MU=75U575U=75U=75U554U=745=75U=34U-34U-34U-75U=75U555U5555555 -MU575U=75U=75U]?55%=55=75U-34U-36U]755555U5755=75U=75U=755=75 -M55755535U-35U=55U=75U-35U=755555U=75U=75U=7555555555U=75U=37 -MU]155%155=75U=755=34U-?4U-35U5555555U=74U-34U=755=555%75U575 -M5=75U=75U=755555U575U=75U=75U=75U=55U5555555U=36U%54U=555=55 -M5555U-34U=34U=755555U=75U=75U=75U=75U515U=745=74U=75U=755=75 -MU=74U=75U5555555U=75U=35U-555555U=555%?5U=34U-37U%35U-74U-34 -MU-34U-755=75U=34U=75U5555U945=55U=74U]34U-34U=75U=74U-34U=34 -MU5555%555575U-34U]37U]545E155=34U-35U-?4U=55U=75U=74U=555%15 -M5=75U-34U-355=75U515U=74U-?7U]?7U-75U555U=55U=34U-5555555515 -M5=74U=37U%145%15U=75U-15U=35U=55U=34U=34U]?4U-75U5545%55U555 -MU-3455555=55U=75U=34U-34U=75U=75U=75U=75U=7555555=75U]?55515 -M55555=75U=77U]34U=7555155-75U=34U-34U=5555555%35U=35U=34U]34 -MU=55U=74U=75U=75555555755=75U=75U5555%75U-545%55U=55U=555%15 -MU=74U]?7U]34U55555555=75U=75U=555=75U5755=74U=34U=34U=75U555 -MU5555=5555555575U=555575U=75551755155=74U-75U-?5U=555555U=75 -MU-75U-75U=75U=75U555U-745575U=75U=74U=75U=755=755=755=755=75 -MU555U555U555U-?4U5155=75U=75U555U=75U-34U-75U57555555575U=55 -M55555%=45=555=75U=74U-35U=755=755=75U55555155%555575U=755574 -MU]155U555=75U=75U=?4U555U55555555=7555555%555574U-755=75U555 -M5=75U=55U=75U=555=75U=75U=74U-55U555U=75U=75U=37U%545%155=55 -MU=555-75U=75U=74U=75U=34U=35U=555575U554U=755=74U-75U-34U-74 -MU-34U=75U555U=75U=755=75U=75U=75U]?555145555U=75U=74UM34U-75 -MU=555=755555U=75U=75U5555575U=15U=35U-34U-34U-74U-75U=75U=75 -MU=75U=5555555=555=74U]155%55U=5555755%35U-37U]34U-75U=34U=75 -MU=34U-7555555%55U575U=74U-34U-75U=35U=75U=35U=55555555555=75 -MU=75U-?7U%545=75U-34U]35U-34U=7555755=75U=75U=75U=555=75U=55 -MU-345575U-34U-34U-75U-75U-75U=75U=75U=34U=75U=74U=75U]?45514 -M5=75U=75U-55U-74U-35U-55U=35U575U=75U55555555515U=55U=75U-34 -MU-34U=34U=74U=75U5555575U5555=75U=75U=74U-545U55U555U=34U=37 -MU-74U=55U=75U=75U=75U=34U-34U=755=74U-75U=74U-75U=75U-35U=75 -MU=555=75U=7555555575U=75U=34U5175575U=75U=155%75U-34U=75U=34 -MU-75U=75U=75U575U554U=345=75U-?4U-74U=75U-75U-75U=75U555U=75 -MU=34U=35U=75U-355%=55575U=75U=75U]35U-75U=75U5755=555555U=75 -MU=755574U-155=75U-35U=74U=75U=75U=75U=74U=75U=75U-75U=75U=37 -MU]155%555=75U=74U555U=74U-34U-34U-34U-74U=74U=75U=555-75U555 -MU=74U-34U-75U=75U-75U=55U=75U575U=755=75U=75U=34U554U575U=74 -MU-35U-?4U=5555755555U=75U=75U=75U-35U555U-355575U=34U-34U=75 -MU=75U=75U=75U=75U=75U=75U-75U=75U-355%=45575U=74U%55U=34U]35 -MU-34U-34U=755=755=755=555%1555545=74U-34U-?4U-35U-75U=755=55 -M5-555=75U575U=74U=77U]545%55U574U-77U=76U=755=15U%75U535U574 -M5%745%75U==4U=17UU55U-75U-?5U-75UU75UU75U-755=74U=355=555=35 -M5=755=3455175515U575U-34U=77U=34U=75U-75UU75U575U%755=755514 -MU=755555U=34U-35U=35U-35U=75U=74U=75U575U=75U5555=75U-755515 -M5=75U=74U-34U]?5U=75U=55U575U=75U-34U=75U=755574U-35U=75U-34 -MU-75U%75U=55U555U555U575U=75U5755=755=74U-545U555=75U=75U515 -MU-74U=75U-75U=755=75U=75U575U5555575U53555755=74U-34U=34U=35 -MU575U=75U=55U5555=555555U=34U5545%75U=75U-35U-?7U=75U575U=74 -MU575U=35U=75U=755=75U-35=V!^5A8V+MKNGOH^! -M@[>SM)Z5AKRDO/8R)#D-_U8$-0D4XFDP)B,Y;(NUE`8,$N'E!#8Q;K&DI8T% -M-0'AAI!B%)RSI;+T,#DTYHJ*DF??AK6%`#X["(:\O809`A/D]@]C@0Y.@J?MK>=;GJ?@ND//SP?M+N\G0`+&O7S&S4/XK.Z -ML60S/PK#AY-F%):TLX$".#L/AK.VDA=NEH?]"3PS;[&ZO>@.-`3`^1P.`)"R -MN[<3/#X(XX.;=6Z6M;&9"#LY`8^]L9$2$>.95`@]-M*SI;/.-38&S>$1`@68 -MO;B(!SX^#Y&.AM5BEXNTE34[/QZUO['J&QG(D'<),S7IO:6Q9#8Q`?/H;@82 -MA+V^@@PX/@.:M8/#8NN.B_$W.SUOMKFQY`8'295Y#C$/G[^EM!`P,`'AD7\: -M%8:RO84*.S\$@+>,]6_@@HUT-C@PT;.XMM0-`V;M>@\W`8>^NX@$/3,&E9[= -M'6&!LK.6-SH\'8ZQCLP4\8:&;#$^-^B]N[1G"`QHX7X"-1N"N;B"#3\R!)*$ -MY1=R@+"V\C$Z/6RULXG1$UB:FQ8Q/PJ9OKN*%C0(%.%U`0D6CKF^A`LY,AF% -M@.IN2(&QM7XS.C#5MKV)2AEDDY,2-CT-@;B[CAHV-1;M500-88NYO)`W.#,1 -M@8^08$R'MXX7/3LV[K._CF$$%>N5'S8S!X^[N(,`,#06ZO`>!D2UOK/^,#LP -M8(^+GV1TA;6`&3TX-9Z\OXP4`!+DXAXW-AV*NKF%#C(T%9'B%AKUM;^V>#(Z -M,=6*M)MG>)Z.A0<\.0Z!OKZ#'P\:R>EVT=Y+6]M1$\ -M.C?BM[::8V*1@Y,`/#\!C[B^AP<+!]7E$@L(4+:ZLOXQ/C1^A)]P%N*ULH\% -M/CLUG;"QFFL4[X?N`CTR'K6ZOYX"-`!%YQ8/#>>PN[!^,CDTTH"$T&OLB[&! -M`SDX#H>RL)L1'?*9^`TR,&ZVI;V4"#8"1>UI`P:4L[BW$3PY"N&/@/!OXHZW -MF0\X.0&,O[.<'AI%D,<-,S=0LZ6R\S0P#52590<8G;.YBP0^.0F1BHWD;>>- -MBI0+.#\9M;FSE@0&9^I3#3$*XKVEL7XQ,PW(DUP8$YBSOX(".#D-A;>)X6GD -MI:*DLHF23QP`"34P,C\^.3\_,C`W"@T$$&3(Z)R$@(V.B(JUM;6*BXF/C8.& -MA)F2E^_ESE)V9&)H%1<1$!,3$Q,3$!$6%Q5K;F)A9'ES=$)84=;>Q,+.RO3T -M]_?W]_3URLG/PL'$V][=T];45U)24U%04E)=75Q<7%Q<75U34U!15E=75%55 -MU=74U]?6UM;6T='1UM;6UM;6UM;6U]?7U-34U=75U=74U-75U=55U555U=75 -MU=74U=34U-155U34T=;6UM?7U-?4U-74U=74U-34U=35U=75U=74U=34U-34 -MU-35U=75U-74U-34U-34U=74U-34U-34U-34U-75U-75U=34U-35U-74U556 -M5]76UM?6U]?4U-75U=755=75U=75U=755575U=75U=35U-74U=75U=75U-34 -MU-35U=75U=75U=75U=75U=5555555575U=75U=75U=755597U=;6U]?4U-35 -MU=75U575U=75U=755555U=75U=75U=75U=75U=75U=75U=75U=75U575U=75 -MU=75U=75U=555575U575U=75U=75U55445?5UM;6UM?7U-35U-75U=75U=75 -MU=5555555555U=75U57555555575U=75U=75U=55U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U5115U76UM?7U-35U575U555U=55U555555555555=75 -MU=75U=75U=75U=75U=35U=75U575U=55U=75U=75U=555575U=75U=75U=75 -MU=755%97U='6U]?4U]34U=75U=75U=555555555555555=75U=75U'ES<4I)1D535M'=V\3#SYI+8=,S=AAIAE%)BROH`( -M.#(4AH1W%I&VL)0Q)3)RCH_E:96UM-\S)3'HMK>6;.:/CV(R.S6$O;"0$7:% -MA!(R.0V.N;.5!1/HD1DS/1NTN[/R#0%>XAXV,6&PI;%E-0EMYQ$U"_B]I;0< -M,#07[&0"`)"\NXD#/#$4D/T;&9B]OH8*.3!CA))N%(6RLI0Q.C'>D@<]/!^WN+'; -M`![A[`.\NK4>-@AAX1$(`I^_NX\",C1BE'D!&X>_ -MOH0U/C=XF.8=%(&\O>@Q.#?-@YYA88:SMG8].C27BH/6986WBQ,_.PF'L8CS -M;):)@0<^.0&.O+3V$_6&G0,_/!*WN;=:!V^0[`(],$ZSN[1N#QK^_``P->N_ -MNHL8-`)!_04T#9JYNX(",PA][18/&H"YN9LU/#5/DW4$%(V^O>,P.37QA^X6 -M9(V\L6<].`N6CIIZ<8"PBAX^.`^'MX)<>X6T@`$Y.0>.LHE4:I2,G`PY/!:W -MOXIQ&=":X@X_,%2RN(MJ`Q25RP\R-):_NXX;"@7VV@,V#(>XN(`",0)1_`4+ -M!8V[OI\U,@[7ZA0#%(FXO?LP/PCYF%89?XB^L6T\.0Z6@Y1J7XZRBAH^.0*$ -MM85Y6X.V@`(X/@6/L8-W99J+G`@X/&JWO8]Z$>B!X0HY,,ZROH\5!$^=W0H\ -M-)._N((;#Q'M0@DP#(&XN8<"-`3W5P,T!8Z[OI,U,`/(^QL/%;6[O?4Q/0WD -MD6D'=;2YL6H]/P*6A,\3PK6\B@0Y/@&$CI%L](FP@`P[/AF,MX5E4(.TG34[ -M/&VTLX%F8)F,Y#0X,/RSO(,4'>"%03<^-)^_OH$8`7F7934R#(.XOIH#"!/G -M>`DV!8NZOY0*-@3\5@`+:+2ZLM8Q,P'FX1X`7[:[L18]/0&7G6$9^+:^B@8^ -M/P2:@/\4X+2R@`D[/!*-BY!C^XFVDC0Z/62TMIIC4H"(_#8[,.:PLH05;IV& -M?S$Y-)B_O(4>&/^=;S8\#(*XOYP``F'N:#0P&K6ZO.P(-1/D9@DU;[:ELTPV -M-AOFU`$-VK"ZMA`R,P64[A(%[;"YBP$^/1F8FWT0E+&\@0L[/1:#C>=NE;2P -MD#VQL9]J0X:"83,X-9J\LI\=%Y:8%C`_#8RXO98& -M!,:4$S8S&+2ZLN0.#V+A%S4W8[&EL'PW-!#F9@\.\+.ZMQTS,1SKQP<&E+*X -MB`,_,Q*F[V^AS4Y,6.$DVD5 -MA;*RE3$[,=V/@5%CF+&W1S(Z-Y6TB>5BD;6)%CP["X2SM.(4^8.'&SPY`(Z_ -MMN<99YZ3!ST]'+>DKJ&XMH'@:00,"C/\V$9\9FQJ%!80$Q,3$Q,0$!$7%!5I;&-F97]Q -M24=<5=+;P'YQ==)='YY9&5G965Z>7QR=DM"1UE1U=#>VL;#S,[)R,C( -MR,G.S,+#PQG&R4M8(#.S]N -MBHCE9X>PC@([/&V-A&1]B;R+`C@S9H3F'W6TN8H#/S9_D6H#3K&ZM0$R"%CR -M!@MUL[J*!S8&]GH*-W"RNH@%"13L$3$P>;*XC!\$_)`:/3UEL[^!$&^;F@8^ -M/&>QLYAJYXZ!`C@_9[2TZ&&;MH(,.SQDB8-;VMI9LD[6!#SL]=K6.]7Z`L((. -M.S)WC)IB1(J\CPXX,4B$\![?MKF.#S\T6)<6`,FSNXX-,@_8SP`(]+VZCP`V -M!/]B-33*O+N-!PYO[!PP,<*\N(`:!>&6!SPSV[*\A!)FA9X".3+1L+"3%>Z) -MA`X[/52WM>=GA+:!"#LR4(B!<$.)LH(+.S!3@)41Q[>^C0@Y-U>?9P3RL+B, -M#CP(V^8%#/J]NXP,,`'Q?`D*Y+R[@@,U$.80-C?EO[B`!P#5ZP0R,?F\OH09 -M%I*0`CXS\K*RG!'*@ID..#+WL;?N;9ZUA`L[,\BTC-1TC;"&-3LPP(R?:<2T -MO(`U.#;$A-P9^;"Y@PL_-8&VA34Z,/Z+AV73B[*'-#LV\(#M$/BVOX$U.37VG&\$[;*X@0H\#_#X!P+J -MO+N!"3$'_F$+")2^NX8-"A3G'S$TE+ZYA0$!R.\!/3:5O[^>&A6N] -MLY80Y8*3"CLP[K"TY&.%M)XT.C#BM()-7HZPFC<[-N:/DVO^M[R$-S@T^H5` -M&>^SOHX,/S:1O+*1'T2'E`HX,9>RMN-JDXB0-#LQE;:)W':#MIPW.C;I -MBX5A]K6RF#8[-..`^A#LL+^:-SX+YY(4!9:]N84T/0+E]`$#DKZXF@HQ&N5I -M"@ZV-E30[ -M-I"PM?1GA[21-CHVEK2`<]J(L)(Q.S3JC)<5XK:]G#8X"NR%?QZ6LKZ>-S\, -MX>P;!IR_N9XT,P?D?P\-F;FYGPLT$>4<-PB;N+Z2#`);Y``R-9NYO)8&$I?A -M"3\TF+^S[A_;ANPT.#>>LK?_:9^(ZS8[-YVVC$5$C+:4,3LTD8N98N2TLY$Q -M.#65@?40E[.\DS$^#N^0$1J`V.S28LXO1>8&U -M[#`[-)^TAGKSBK'H,#LUD(SI%96QO94P.0F4FV$?G+V_ES$]B*^FOK2$_A4$ -M#`LQ,S\_/C\\,C`W"@P''6#3[).%@8*/B8N*BHJ+B(F/C8.&A)B=E^[D]%1U -M>F-N%1<6$!`3$Q,3$!$6%Q5K;FUA9'AR=$Q;4]?7MD9&=E -M9'AX?7-T2T%%4U?1TMO$P,+/SLC(RLO(R<[,PL''Q=C>W]+0UM?555=14%!2 -M4E)=4E%27UU24U!04%%65E=75%555=35U=?6U]?4U-35U-35U=34U-75U=75 -MU555555555555%155%5555555555555555755=755=75U=75U=74UM175575 -MU=75U=75U575U575U=555%75U=75U=55U=75U=75U575U555555555555575 -MU=75U=75U=75U=75U=75U=75U=555575U5555=76U5155=75U=35U=75U=35 -MU=75U=75U-75U55555555%755=75U=755=75U=75U=74U=75U=755=755=75 -MU=74U=75U=75U=75U=55U=75U=?55U14U575U=75U=75U-75U=75U5155575 -MU=75U=75U=355=75U=75U575U=355=75U=75U=75U=75U=55U=75U=755=75 -MU575U575U=74UM57U5155=75U=74U-34U-75U-75U=?4U57555555=755=75 -M5=755=75U=55U=35U=74U-75U=75U=75U=75U=75U=75U5555=555=55U=36 -MU5=55%55U575U=74U-75U]34U=545=74U-34U-35U=34U=34U=5555555=75 -MU=555=755=555=75U=75U=75U=75U=75U=75U575U=75U-;55U145575U=75 -M5=35U-75U-35U=77U-75U=55U=75U=55U=75U=75U=75U=75U=34U-35U=75 -MU555U575U=75U=555=755=75U575U=75U-75U=34U=75U=755=75U=55U=75 -M5%75U=35U=75U=35U=75U=75U=555555U5555=75U=75U=755575U575U=75 -MU575U555U=75U=75U=36U5=55=75U=35U-35U=75U=74U-75U]?5U=55U=75 -MU=75U=74U-34U-34U=74U=75U55555555=75U=75U-75U=75U=74U=75U-35 -MU-34U-;45-55U=75U=35U=555555555555=4U=75U-74U-75U=55U575U=75 -MU=75U=55U5555555U575U=74U=75U=55U=75U=35U=35U=35U=74UM145535 -MU=75U-75U-74U=755555U=345555551555555575U=75U=74U=75U=35U-75 -MU=555575U=555555557555555555U=75U=355=77U5=55=75U=34U=75U=75 -MU=75U=545=75U-34U-35U=5555555555U5555555555555755=55U=755=75 -MU-35U=75U=75U=74U=75U=55U=?55U55U=75U=74U=75U=74U=35U=74U-75 -M55555=555=55U5555575U575U=74U=34U=75U=755=75U=75U=75U5555555 -M55555=75U=74UM5755755=75U=74U=75U=55U=755%75U=75U-75U=75U=75 -MU575U575U=755=555555U=75U=75U=75U=75U=34U=75U=755555U=555=77 -MU5=55=75U=75U=75U=75U=74U=75U-35U555555555555=75U555U5555555 -M5=75U=75U=75U=55U=75U=75U=75U=75U=75U=75U=55U=?55%545555U575 -MU=75U-74U=75U555U=74U-34U-35U=74U=75U=74U=75U=55U=55U=35U-75 -MU=755=75U575U=75U=75U=555=75U-75UM575535U=74U=75U=75U=35U-75 -MU=77U=75U=75U=75U=75U=74U=35U=75U=75U=75U-75U-75U=75U-34U-34 -MU-34U=75U=75U-34U=36U%355=75U=75U=75U=34U=75U=155=75U=34U-34 -MU-34U=75U=75U=555=75U=55U=75U=75U-34U-34U-34U-75U=55U=55U575 -MU=75U=?55U15U=74U=74U=75U-35U=75U=74U-35U=755=55U=55U=75U-75 -MU=75U-75U-74U=75U=75U=75U-75U=75U=75U=74U-75U-75U-74UM175575 -M5=75U=35U-34U-75U=34U575U-34U-34U-35U=55U=75U=75U-75U-74U-75 -MU=75U575U=75U=75U-75U=755575U=74U=755=7755=55-75U=75U=35U=75 -MU=75U=75U-15U=555575U555U=75U=75U575U=74U-34U-35U=75U=74U=74 -MU=34U=75U=75U=75U-35U=75U-;55U175=74U=74U-35U=74U-75U-545=75 -MU-35U-34U-75U=75U=75U575U=7555555555U=75U-75U-355=75U5555=75 -M5575U=75U=74UM5655155=75U-35U=35U=75U=75U=37U]35U=75U575U=74 -MU-75U-75U=75U=75U=75U=75U=75U=75U=75U-35U555U-75U=75U-75U=76 -MU5=55-75U=75U=75U=35U-75U=355=75U-?5U=74U=34U=74U=75U=34U=75 -MU-75U=35U=75U=55U=755=75U-35U=74U-75U-35U=75U=35U=75U=75U=75 -M5575U=755=75U575U-35U=75U=35U=75U=555=755555U=75U=74U=75U=75 -MU=75U-35U=34U-75U-34U=75U-75U=74U575U=75U=75U-15U-34U-75U-35 -M5535U-75U=34U555U-355575U5555=7555555=555=75U=755=75U=75U575 -MU-75U5555555U575U=75U5555=75U575U=34U=75U-75U=75U-34U-75U575 -MU=555=75U=34U=35U=755575U-34U=75U5555=75U=75U=75U=75U=75U=75 -MU=75U=34U=75U=755=75U=55U=75U555U=54555"9F5P=D=;U-#%:BQ8N\L4@R)3#ZL;*"%``=\_P8 -M-#1BM+NRVC,[-MZ)B9%B39N-E`T\,A6QI;WB-3,/VY[F%!2=M["9"SL^'K2Y -ML.`##13F4P<(&H:_OH$(.S\:C;:/QQ98F9X7-S(-@+B[C0(\,!V9A.1H78&W -MC1\\.PJ'OKF"!34->>U^!@;EM[ZT$C\Z-9RPL)L1'EZ0]``Q-?FRI;%I/3X( -M[H^&R6SCC8[V-#DS5[*ZL7PT-@3GE6<;;X&SL.\V.CUDMK^U3P$%5NQN#C40 -MB;B_DC<[,VZ/M85[8I6`G00S/02+NKZ8"#(U89Z19!;CB[&!`#DX`X^YO9X& -M"1OU_AT/!I*RN8D!.3D-A[&U[A!LE)E\"S,(G;^ZM1H],@&0@)!G99FUB6

6QLH)N!&GIX!@T-&>WNK+V,#DWT(^, -MZVS5A(^4#S\R%K:EO>,U,`W?D\,2%Y^VLY@+.SX9M;ZQX0$`;>-/``H%@;ZY -M@`@X/!N#MX+6%,J$FQ$V/0V`N+N-`STQ$IR;P!30@K:/'#PX"H2^OH,:"@!T -MXV(``.2VN;<0/SLUD[&VGA83]YS*`C`U_;*EL6\R/P[M@H57;>N.B/(T.3-: -ML[JQAI$.^ULX,`.3D"C;ZRGP<,'?_W&`D!DK*XB`8Y -M.0V$MHOB%GN2FGDU,@N2O[JU&#(S!I&&ZVUXA;2+9#`X-NJ\N(L6-0YJXE,% -M`'2*O[%$,CHQ_+:S@&\8>I?C!3<%!3@F,H,,S3WLJ6Q8S,\#^.`GG5MEHB*^30X,TJSN[9W-349Y.00!FB" -MO;*5-CH]8K2]B$X$$>;K%C4W'(B[OI\T.3!K@XZ29G.9CY@'/3P&B+N^FPXP -M"&60Y!82Z+2R@@`Y.`*"O[.#4] -M-9"_NK4>,C,'EX7G:G^'MXI[,SLV[[VYBQ<+#&WC<08"<;6^L%8R.C'TM["& -M;1Q%DNT$-C9LMJ6]Y3$^-%V#AOQO^8**D0X^/1*WNK+M"#MD!1.;L+V$ -M"SL_&XB\M^<$&ECK90PW!X&^N(,..3T:AHJ'36WH@X<0,#P.AKBXC0$S-Q&0 -MEF02S8ZSB!T\.S68O+R`'@\%V>00#@WZL;BV%SPX-9>WM),5;Y6%]`\R-\.R -MI;!F,#T,YH:096V3M;3D-S@S?;"[MDD+"QWD]A\#%8*\LI8V.C)NM;*.3AMI -MZ)43-#8>B+N^GC4^,6N`C9=@0X6(F@8]/P&)N[Z;##$.>9?.'!^5M[V-`3DX -M#8.\LYT%`6GBW@8U`I*]NXH$/CX-F+6,_FK&A(9X-#PUEK^ZM1PS,`25FTMH=B$/69[P8Q'ZBBI;./ -MDW4<``DT,#T^/SD\/S,P-`L`!!5E^NJ9A(.-B8B*BK6*BXB.C(*`AH6>D)7B -M^<1;TM#6U51645!24EU<7%]?7U]<75U24U!145975U15U=74U]?6 -MUM;6UM;6UM;6UM;6UM?7U]?4U-34U-34U-34U-35U=75U=75U=34U=75U-75 -MU=34U-34U-34U-34U=34U-34U-34U-34U=74U-75U-34U-34U-75U-75U=75 -MU-34U-74U=75U=34U-34U-74U=75U=75U=74U-34U-75U=75U=75U-34U-34 -MU-75U-34U-34U-34U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=35U-75U=75U=75U=75 -MU=75U=755=75U=75U=75U=555=75U=75U=35U=75U=75U=75U=75U=75U=55 -M5575U=75U=75U=75U=75U=75U=34U-75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=55U=75U=75U=75U=755=75U575U=75U=7555555=75U=75U=75 -MU=75U=75U=75U=75U=5555555555U=75U=75U=55U=75U=75U=75U=75U=75 -M5=75U=75U=75555555555=75U=75U=555=75U=75U-35U-75U=75U=75U=75 -MU=75U55555755=75U=75U=755555U=75U=75U=75U=55U=/BD.WA\\1727=Y -M>&1E9V5D>WA\$U/`V.NKZ: -M!P-A[V((-6>QNK8^WLYTW)3+4M[:>:G^;AVDP/P*(N[SK#PD4 -MX&<,#O>SNK0$/S(WL>\Q)3#KL+"?$&F1GA`P/02TNK+&-340X'(# -M`^^RN(X,.3(4@(#\;)>UM-4S.C>8O;.3&1/MD1TQ,Q:QI;!A-C<3[M4$!)"R -MOH$U.S-[CH_C;>N(B6(R.PN#OK.5!QOWZ1PV-G"SI;82,S80E_X>'Y^RO)PV -M.C#+M8ON;^",@Q`].0*(N+/E`@9$X!TT-?B]NK4'/3$7G.@7%INSL^`P.C:5 -MMK7I%?>!A!@]/P6TN[!>"0)YYQ,*#Y>\NXP,/S%MA))C:9JQMDP].C2;L[?L -M$$":G`0R,A2QNK9L-0YAYA0/`9F_N88U.39W@)IV8)NVM14\.PF`O;?D&6"3 -ME`8S,4.RNK0<-@MC[&T#&X>_OY(V.#?PCH%49IFTCQX_.`")O[?-!Q;HXP8P -M-."\NH@&,S5FE'$'$(&\LN0S.S25M8W!8)*(@0<_/ABTN;=V`Q[[^`8V")*^ -MNX(,/35\G<$>:8.]L7T].PN9MX[,;I2,F0,_/6NPN+1H#@3&\@0T`H2YN(0U -M/S53A>`69(*RM!$_.`R`L(C8%^&!EPP\,U>RNXH<-0!0_1L+!(.YOI$V/C7_ -M@99OBX1S=H>U -MF@\Y/&VQOHEK`6CKTPPP#(&XN9L*,@_!EF8%?HN_MQ(^.0.&M(%Q>YN)E@LY -M,\>RN8\=#!/F4PTW!XR[OY4W/0_EGEL<7(N]BPVO8-J'/V>=S4]#X.[OIP(-@;R -M_!L#=+>XMQ\_/P:$CI!CR8RTD30[,_>SO(`3!$26934P!HFZO^PT,`;G[1,' -MSK>^B@$Y/QB"M9]ATH"(Y3\ -MC0X[/!>(MYMC3H2-6S8Y-86^OY@!#!7A9@XU;[:ZL&DR,@20GG(0[[>RA#4[ -M,G^TL9IH9YZ&83$_#X*XO)8/"Q#D>`T)1;&[MQD\/1N;A]H5Z+2QD38Z,/ZQ -ML)L6%9>9%3$]!HNZO>0*-!SF30$"^K"XBP`^/1*&@^1OZ8JT_C$[-I&RLYX? -M'>:0%C8S'[>ELT\W-Q_LP`4'ZK.^@@DX,FB,CNYMXHF(<3,X-82_LI`$!=KK -M$#6WM)<5WX:'$C(_!HJ[L_<.#&'F%PL.XKV[ -MB`,_,!2%G&=JGK&Q]C,Z-Y"PMY40&#,]'+:ZL'TU"6[A:0\#D+RX@@@Y -M,6&!A$%MG[>T93T["H2]MNX>;I&6!3,P8["EMA4$$^WO!#$WP+VZM1LP-&F46@0*C/-B -MEHB#&SP^!XJYMM`#&_#G!38*ZKRZC@,]-&.2\Q\4AKVPP#([-)"WB?]I[HV% -M!CP\$K:[MV4&I:"ZL8*59Q@""#0R,CX_.3P\,S$U"`$::G#DE)B'@XR)B(J* -MM8J+B(Z,@H"'FI^0E>/\VD1]9FQK%!81$!,3$Q,0$187%&IH;&-F97]Q2$9< -M5-/8QLW)]?3W]_?W]_3UR\[-P\;%V-_=T-;55%904U)=7%]?7UQ?7%Q=75)3 -M4%!15E=45=75U-34U]?6U];6T='1T=;6UM?7U]?7U]?7U-34U-35U=74U=74 -MU=75U=75U=75U-35U-34U-34U-75U-34U-34U-34U-34U-34U-34U-34U-34 -MU=75U=75U-34U-34U-74U=75U-34U-34U-34U-34U=35U-34U-35U=75U=75 -MU=75U-75U=75U=75U=75U=75U=75U=75U=75U=74U-35U=75U=75U=75U=35 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U575U=75U=75U=75U575 -MU=75U=75U=75U=75U=75U=75U=75U=75U=555=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=555=55U=75U=75U=75U=75U=75U=34U-35 -MU-75U=75U-75U-75U=75U=55U=75U=75U=75U=75U=75U=75U=75U=755=55 -MU=75U=75U=75U=75U=75U=35U-75U=75U=75U=75U=755=55555555555=75 -MU575U5555=75U=74U=75U=75U=75U=75U=75U=75555555555=75U=55U555 -M5555U=75U=75U=755=75U=75U=74U=75U=55U=75U=75U=75U=755=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U-75U=75U=75U=75U=35U=75 -MU=7WEI3FY\#90TM\>65E9&=D97AYW]+0UM355%914%-275U=75U=4E)34U!145%145975%555=75U=34 -MU-74U];45-55U-74U-34U-35U5755=555%755515U-1555155%1455555=55 -MU=75U=555=555=755=75U5755575U575U=75U-75U-75U=75U=74U]575%35 -M5575U=75U=75U=55U=75U=55U5145=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U-75U=75U=75U575U5555=76U5=55%555=75U=755=75 -MU=34U=75U-75U=34U=555555U=55U=755=75U=75U=75U=74U=75U=75U=75 -MU=55U555U=75U5555=755575U=?55U145575U=35U=75U-35U-75U-35U=55 -M5U75U=75U=74U-35U=75U=5555555555U=55U=74U-35U=74U-34U=74U-35 -MU=75U=75U=75UM1755755=75U=75U=75U=75U=75U=75U=74U-75U5555575 -MU=755=7555555=75U575U575U-755575U=75U=755=75U=755=75U=75U=36 -MU%155=55U=75U-74U-35U=755=75U5755%15U=75U=75U-35U575U=555575 -MU=75U=75U575U=745=75U=755=75U-75U=75U=555555U==55U145=75U=74 -MU-74U-74U-34U-34U-35U-?5U=7555755575U=75U=75U555U555U575U=75 -MU=75U=755=5555555=75U=75U=75U575UM565575U=35U=75U=75U=75U=74 -MU=74U-55U=35U=74U-34U-75U-75U=75U=75555555755=75U=75U=75U=55 -MU=55U=75U=75U575U=76U5355575U=75U=75U=75U=74U=35U=75U=37U-75 -MU=55U575U=75U=75U=75U=75U=35U=35U-75U=75U=74U-34U=75U=75U=75 -MU=75U=;55U545575U=75U=75U-34U-75U555U=545-75U=35U=75U=75U=75 -M5=55U=75U=55U=555=75U-75U-75U-74U=75U=74U=74U=74U=74UM575515 -M5=75U=34U=75U=75U=75U=75U=74U]35U555555555555=55U575U=75U=55 -M5=75U=75U=55U=75U575U575U555U=75U=75U=34U574U=75U=75U=75U=75 -MU=75U=55U=34U555U=55U=75U=75U=75U555U55555555555555555555555 -M55755=75U=75U=5555555555U=955U545=55U=75U=75U=75U=75U=74U-75 -MU-?55554555455545575U=75U=75U=75U=74U=75U575U=75U555U=755=75 -MU=74U=34U=74UM5755355=555=55U=75U=75U=755555U=555=75U-74U-35 -MU=75U=55U5555555U=55U=55U=75U=75U=755=55U=75U555U555U5555=77 -M55=45-75U=75U=35U=75U=55U=55U=75U=37U%55555455555=55U=74U=75 -MU=75U=75U=74U=555=75U=755=755=75U=75U=75U=55U=?55U55U=75U-35 -MU=75U=75U=75U=75U=355=74U-34U-34U-75U-34U=34U-34U=75U=755575 -MU=75U=75U-74U-35U-35U=755=75U=75U]575575U=75U-75U=75U=75U=75 -MU=35U=75U]34U=75U=75U575U=75U=75U=75U=75U-34U=34U-35U=34U=35 -MU=75U575U=75U-75U-36U%155=74U-34U=34U-34U=74U=755=74U515U=74 -MU-35U-74U=35U-75U=75U=75U=74U=75U=74U-75U=75U=35U=35U=755=75 -M5=75U=?55U545575U-75U-35U=75U=75U575U=75U=?7U=75U575U=75U=75 -MU=55U=55U=75U=75U=35U=75U=35U=75U=75U=75U=75U=34U-34UM145575 -MU=75U=75U=75U=75U=75U=75U-15U=34U-34U-35U=5555555575U=75U=75 -M555555555=75U=35U=35U=75555555555575U=76U5=55555U=75U=75U=75 -MU575U=75U=75U=74U-7555555=555=75U=34U-34U-34U=74U=75U=35U=74 -MU-75U=75U=75U=75U=75U=75U-;45U55U=74U=34U-35U-75U=75U5555=75 -M5%75U=75U=75U=74U=75U=75U=34U-34U-75U=55U=555=75U575U=75U=74 -MU-75U=75U=74UM5755155=75U=75U=74U=35U=34U-34U-74U]?5U=75U=55 -M5=75U=755=75U=75U=74U-34U-75U=75U575U=75U=555=755=75U=75U=36 -MU5355=75U=35U-34U-34U-34U=35U=75U555U=74U-34U-35U=75U=75U=75 -MU=75U=75U5555=75U5755575U=75U=75U=7555755=75U=;55E1455755=75 -MU=75U=75U=75U=75U=35U=?4U=555575U=75U=75U=75U=75U575U=75U=75 -MU-755=75U=75U=34U=75U=75U=75U=74UM14U575U=55U=75U=75U=75U-74 -MU-35U=355575U=75U-34U-35U-74U-75U=75U=74U=74U=74U=75U=74U-34 -MU-34U-75U=755=55557755?55=75U-75U=75U=75U-34U-35U=35U=74U%55 -M5575U=75U=75U=75U575U=75U=34U=35U=35U=75U=355=555575U=75U=55 -MU=55U=35U=75U-75U=74U=74U=74U-34U-34U=755535U=74U=34U=75U=74 -MU=75U=34U=74U-75U=75U-35U=74U-35U=35U=75U=75U=75U=74UM545575 -MU=75U=75U=75U=75U=755=75U=74U]?4U=7555555555U=75U=75U-35U=35 -MU=74U-35U=75U=75U-75U575U=55U=75U=75U=31U5355-75U=34U-34U-75 -MU=555=75U=75U-545=55U=75U=75U=75U=75U=75U=75U=75U-75U-75U-75 -MU=75U-34U=75U=75U=75U=75U=?55U145=75U=34U=75U=75U=75U-75U=75 -MU=?7U=55555555555=55U=75U=75U=75U=75U=75555>969SPIZRGA1]FFI@<#G:VL_H\)S\#`S`R!8.-!B4G,6!A -M``:>LK80/SUIC(#YX+>XMA@]-)&VB>SJM+V&-3@UA;:"0,2/M4D].@^,L(9I -M8&WF#0Z,9"QB-9EAXC#,SL.C+V) -M96Z9@1$]/ARVOX(1$)>2!SPS^[R_FP<:Y^`",@J&N+WE#@;-Q@PQ!+6EL10T -M`]]1#35^L[J(`S`"]]X`#9>_N)@T,@'L^00;AKZ]33(]&)SH$FF/OK<$.3)M -M@9)K1XN]@#4[,>&)FF?WBK'L,SL+A[>$9/^)BQ4_.02*L(5N]8V&`3D]2;"S -MG!-:AY8(.3:9O[/@!&&=VC0\#8B[MF<-%^AF-#`7L+J+&@L=YVHT-.*_NX<. -M-QSD%0L#AKB_^38V$.]L#1*+N[$2/3%MDWP'2[>XC@XY-\&%V1WBL;R=,3@( -MDX+G:I"QL7L_.0:#B.YCG+:)!S@_;+6U[F*_T'-P>+NK-O -M-@M]_@0(8[&ZM0$R"-'B'@#BLKB$-#\/[9$6'IB\O/3@"@[2>8.R*CALY/A:TL9UKX8R%#S@SX[*PZA++AN`T.36` -MOK'3!'2[M!<";>L4-C%TO;N-`0@4YA,W"YRYN9,*-!?D$PH'C+N] -M>3`W:>\7#&BWN[0'/#1WD&T'\+"Y@#4^"N&%=1*1L[WF,CD-F(#,:)BPMQ,^ -M/A^,COMFA;:"##LRU[>*_F&:M9`W.S>8L[76:)^-3C,Y`HB_B&,3E)H3,CUJ -ML+Z"'AKEE`HR$946.LX0T -M.S:5M8%]WHZW]S([#H.Q@6?7@HP3/SX?M+*'%7>'F@`^,O>RO9T9;9_O"3\U -MA[FR^0`1ZEN(=#'&Q -MNX@,/`K%EA0$Z+*^GC8^#Y289Q"8O;-V/#X'A(%;;8:SM0.W7F&M>8P.PJ!LHEP8YJ":3T^!;2_C147DYD%/#):O:"LI[R*F=$3 -M`0XU,#(_/CX^/STP-@H,!QUAW.^2A8&-CXB+BK6UBHN)CXV#AH28G9;NY/54 -M=7IC:147$1`3$Q,3$Q`1%A<5:VYM861X7ID -M9&=E9'AX?7-T2D%%4E;1W=O$P\S.SLO(R\C(R<[-PL'&Q=O9W]+0UM155U91 -M4%)=4EU=4E)24U)34%!04%%15E975U=55575U=35U-34U-?4U-34U-34U=35 -MU=75U=555555555455145%55555555755555U=75U575U5755574U5155554 -M55555=75U=555=75U=75U575U=555=5555555=75U=75U5755575U=75U-36 -MU%155=75U=75U-7555555555U=75U-75U=555%75U=75U=74U=75U=755=75 -M55555=755=55U=75U=55U=75U=75U-75U=75U555U555U=75U=75U=75U=75 -MU=75U=75U=75U=75U575U=74U]35U=755=755=755=75U=75U=75U=75U=75 -MU-75U-35U=75U=75U=75U=75U=75U=75U-75U=75U=74U=75U=75U=75U=75 -MU=755=755%=55=74U=34U=35U=55U=15U=35U=75U5555575U=75U=75U=75 -MU-75U=75U=34U=74U-7555555%555575U=74U-34U=74U=75U=75U=55U=?5 -MU=55555555755555U=55U555U=75U=55U=75U=75U=74U=755=75U=75U555 -M5575U=755=75U575U=75U=75U=34U-35U=75555555175555U=75U=35U-35 -MU=75U=75U575U575U575U575U=75U=75U=34U=34U=75U=755575U=555575 -MU5755575U=35U=34U-?4U-35U=755=74U-5555555=755555U575U=75U-74 -MU-74U=74U=75U=75U=75U=34U=75U=75U=75U=34U-75U=35U=75U=75U=34 -MU=75U=75U-75U=345=75U=34U-74U-74U=74U=74U=75U55555555=75U=55 -MU=75U=75U=75U=75U=75U=35U=555555U=75U=34U-34U=75U=55U=75U=74 -MU=74U]35U5755=75U-74U-35U-75U=75U=35U=74U=34U=75U=755=555=75 -MU=75U-74U-35U-55U575U=75U=74U=75U575U=75U=35U=74U555U=74U=34 -MU=75U=755=5555555555555555555=5555555=75U=75U555U55555755575 -MU575U=75U=75U=75U=75U=75U=75U575U-75U=34U=75U575U=75U=75U=34 -MU=75U=75U=75U=75U555555555555575U=75U=755=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=545-75U-34U=75U=75U=75U=75U=75U=75U575 -MU=75U575U=75U=55555555555=555555U554555555555555555555755=75 -MU=75U=75U=74U%5555555575U=75U=5555555555U=75U=74U=75U=75U=75 -M5=75U=75U=75U=75U575U575U=75U=75U=75U=75U=75U=75U=75U=755%75 -MU=75U-75U=75U=75U=75U5755555555555555=75U=75U=75U=55U=75U=75 -MU=555=755=75U575U575U=75U575U555U=75U=75U=75U-15U55555555555 -MU=74U=75U-75U=75U=75U=755=75U=75U=75U=35U=75U=75U=75U-55U555 -M5=75U=74U=75U=75U=75U=755575U515U=74U-34U-34U=75U=35U=34U-75 -MU=75U=75U=75U-34U-75U=75U-35U-74U-75U=74U575U=35U=75U=75U=75 -MU=75U=75U=75U=75U=?7U-75U=75U=75U=75U=75U=75U=75U=35U=75U=55 -MU575U-74U-34U-35U=75U=75U-35U=75U=35U-75U=75U=74U-34U-34U=75 -MU=545=75U=75U=75U=75U5555575U=75U-75U=75U575U=75U=75U=74U-34 -MU=74U=75U=75U]575%155=55U=35U=75U=35U=75U=75U=34U=74U-75U=55 -MU=75U575U555U=75U=75U=74U-34U=34U=75U=75U=75U=75U=755=75U=36 -MU%355=55U=34U-34U=75U=75U=35U-35U-35U575U-34U-34U-74U-75U%75 -M555555555=755=75U=35U=74U=75U=34U=35U=55U=75U-?55U1455555=75 -MU-34U-35U-75U=75U=75U575U]?5U=74U=75U575U=75U=34U-34U=35U=75 -MU=75U=75555555555=55U5755=75U=74UM14U575U=75U=75U=75U=75U-34 -MU-34U=75U554U=74U-75U=74U-74U-75U=75U=75U=55U=55U=75U-35U-35 -MU=75U575U575U-75U=76U5=55%55U=75U=75U=75U=75U=75U575U=555=37 -MU5755575U575U=755=75U=55U5555=55U=35U=75U=55U=755=755=75U=75 -MU-75U=;45U55U=74U-34U-35U-74U=75U=74U=755=555-55U=35U-35U-34 -MU-35U=75U=55U=75U=55U575U5555555U=75U=75U=75U=75U=74UM145575 -M5=75U=75U=74U=35U-75U=35U=75U=74U]55U=55557555545=55U=55U=75 -MU=75U=75U=75U=75U=75U575U57555555=55U=71U%=55-55U=75U=74U-34 -MU-35U=75U575U=755575U=35U=75U-35U=75U=75U=75U555555555155575 -MU-34U-34U=34U=74U=35U=34U-;55U545575U=35U=75U=75U=75U-34U=75 -MU=55U-?5U5555515U555U5755=55U5555=75U=74U=75U=75U=75U=75U=55 -M5555U=75U=74T=175%155=75U=75U=75U=75U=75U=755W-@?W-*1%S6W=H" -M+2%%1]PE?,%-0V7L[F.`CLY!XN_L?H-#A+GY1<$ -M88"PM'TS.S>>OKB-`3,T:IF:]VG%AHF3`CTS8K&ELV4R/@F1M8GB%F/KDGH. -M-P:!OKZ:-#H]8+>]B6`"!W3C>@<&]+6]BQH^.`R/N+R2#C8-T)SM;VF6BXKR -M-#XV[K^ZM04\,@6%B81+:>6%DQ\W,1"UN[WP,SLV[+:QA1,':N;S'@X'G;.\ -M@0D[/ARWN;%7"S49X.IE''V!MHAJ,CD+AKBX@0\]-VV'@>QM1YB#[@TS-M>S -MNK80/SD,FK:*XAP0]Y1[#34>@KZ]ES$Z,].POXX7"0-G[U8>&^6ULX(!/CX& -MM;N][C4S#_>$DW!MZXR,1S0\-9R^NHX#/C(9@+2!=!%;DY4<-31AM[NP>ST[ -M-)VSLYH;`ASP^Q8`'IFPLI@U.SQLL;NV9C0W&^B=Q!1TA[2"$C(_#8R[N9@U -M/S=\C8^6;&26A/@",37CLKJU!#DY`X"SM.<%&G;L<0$.%(R\L_,S.C'OO;Z, -M&30.8Y3E%!/AB+:$`CX\'+>ZLLPV/0_@@X70;.2&AF4T,@^$N;B`"#@R$8ZV -M@WX9;>SM$P@)7+>YMQ$_.PN'O+*?!@@%S>)C!1&8L;&5-#@SU+*ZM!$Q,1J0 -MA.UM<9B)AQ@S/02+NK^4-CDWWXB*DFL5Y)S.`#T_38Y,>R\NHH:,C`8F8.09&60@Y\%,#`2M+J]\S,X-."TM)P1'$>4VP8U -M`9Z]OH`).S\L. -M/#%6LJ6V$3P_#9ZUC/T19)23;P@W&(RYO)8Q.C!4MKV-%`(%7.!C`0?BM[V, -M`3DY!HNXLNP+-@#PG.=K8IR*B$TV/C2=OKN.`SPS'(:)F'EOXH27!38W8K>Z -MLWX].#60L;:<'P1MX\$:#AJ%LKR:-3L\;K&YM&8*"Q+O[F,<68*VCQP]/@R, -MN[Z9"STT<8&&Y&_2A8/X#C(TX+VZM`4^/P"&MHCP'A?XE6T/"A:)OK+_,SHQ -MXK.\@AP(`''O21@9Z+2SA@PY/Q^WNK/,-S`"YH26>V"6CX)A-CP)A+FX@PD^ -M,Q:-M81E%M^2[QHT-5^QN[86/S@(A;*PDP0"$/CS$@,2A+.SES<[,ERSN+46 -M-S0AI?9.$V@\P")&\NXD#.#\$C+.* -MP`086.QD``]@B+^Q<#(Z-Y*\OX`$-`Q^E_,6$.N*MIX)/CUHL:6P>#$R`I6# -MF$9M[8"':S"P_YL;FU&CDX#(*_L)<#"1CS -MX6D$%82QMO@V.S'CO+N+&#`V'9V%YV]'A8F;!S(R'+2EO?\P/C7GBHB7%&GC -MG%T--P*8O+F#"3L_'(J]M40#`6?C2`0`=8B]M!4\.PJ'OKZ'`C8)?)WJ817N -MCK65"S\P1+*EMA8R/0.=B8;3:\N;GA0T,06/N+^1-CLP6;>P@14'$?GE$P\` -M[K&_C@`Y.0:(N;/B#C4$_Y1U'6*%M[5#,3DWDKZ[CP$],1.%@)1ATEA,=T)1:`#4'A+R_A34[/6BWO[5G#@QH[<\=!=:)LX@? -M/#D/C;B_F0DS"TB%GUENYH*.Y0L\-^:]NK0:/SP!A+6"V!%REI$7"C<3B+B] -MY#,Z,>>PLH$2`AO9YF@!!9>VO8`,.#\9M+NPSC4V!N><_!5GF+6.8S$^"X2X -MN(,//S$4@(Z<9F+HA.@&,31#L;JQ%#\X"9NPMY&+HJ2RB9U!'0`)-3`R/SX^ -M/SPR,3<(#043>\+JG82`C8Z(BXJ*BHN(B8^-@X:%F9*4[/K.779D8F@5%Q$0 -M$Q,3$Q,0$184%6AO8F%D>7-U0EA1T=[$PL[*]?3W]_?W]/7*R<_"P<3;WMW3 -MUM155U%04U)=7%]?7U]<7UQ=4E-04%%65E145=75U-?7U];6UM;6UM;6UM;6 -MUM;7U]?7U]34U-34U-34U-34U=75U=75U=75U-34U-34U=74U-34U-37U-34 -MU-34U-34U-34U-34U-34U-35U-35U-34U-75U=75U=74U=34U-34U-35U=35 -MU-34U-34U-35U=75U=74U-34U-34U-75U=75U=74U-34U=75U=75U=75U=75 -MU=75U=75U=75U=74U-35U=75U=75U=75U-35U-75U=75U=75U=75U-75U=75 -M5=75U=75U=75U=755=55U=75U=75U=75U55555555575U=75U=755=75U=75 -MU=75U=35U=75U=75U=34U-34U=75U=75U=75U=75U=755=555555U=75U=75 -MU5755=55U=75U=75U=75U=75U=75U=35U-75U=75U=75U=75U=75U=75U=75 -M5=55U=75U=75U555U=75U=75U=75U=555=75U=75U-75U=75U=75U=75U=75 -MU=75U55555755=75U=75U575U5755=75U=75U=75U=55U575U=75U=75U=55 -M55555=75U=75U=75U575U=75U=75U=75U=75U=75U=75U=35U=75U5555=55 -MU=75U=75U=75U=75U=75U=75U=755=75U=75U=75U=75U=55U=75U=74U=75 -MU=75U=75U=75U=35U=35U=55U=75U=GID./A]\5<2W%Y>V1D9V5D>'A]IZ!!6#O;%L/SL-C[RT7082Y?X$-`"&OK^5 -M,#LUD+2,P17GAY4",C>5OKN#"3PUTX>087Z'M(``/CQNL[NU'S0,2.EB!VB- -MO;<0/CL`B+RU?0$0Y_<&-`:#N;SD,S@+GK2-56KMA^\//32=N;B&"CP*]H:7 -M8G:&M(<-.3USLKB)!30"7>]I!V..O+09.3@$M;R+8`$6X<$!-`6,N+W2/3@. -MA;2#0FOHA^<)/36:N+B;-3P)Y(:5;$&`M(4..3+'O;B,!S<#V>T5!WB(O(H' -M.#D>M+R.:0$5X]0#-!F)N+)^/#D"A[2!FR6A]TU/0^"N[[K-CT-E8?C:<:,M)`U.#&4O[F'`C0'\N80!].TO(\,.SQL -MMKV#$`9B['$,-1>TN[$3/SX$@[2$9F.0ATPT/0*/NKS[,3T`EH?D:/"/M.HW -M.#:VO88U.C+;L+*$ -M&0=Y[V`."GZQN[0'.3P3C[2>;WN?A&TV,@2UNK)X,S(%G(3(:..(M?4Q.#6! -MN+R4"34>X/8>!>FQO84T.C/GL[*8&P1W[VD("E*PNXH#.3T5B;62:7.9A14Q -M,AFWI;!H,S,9GH7?:>F+M44P.0B"N+W@"S42XL(8&I>QO9PV.C'JLK.=!01& -M[!0+"/&SN(D/.#)AB+61:DF;FA`Q,Q"VI;$0,C`2FYI2;I2*BV4S.0^.N[+T -M"C41[-,:&)*PLI.RN(T(.#!TBHJ5%5^:F1\P,&BP -MI;<9/3$6A9M";Y"UB&@R.0.+N[!;-0H4[EX%'IFSL^,S.C28O;'N!QO;XQ(* -M#I2]N(`U.#'9M8OO%=V%GQHS,'JSNK0$/39HA9EV;9VUCA$]/@:UN[%E-0AI -M[D@$'86RL\LR.S6'O;;G!AG(X1XU#)*\N80T.#;XM8CF%,Z$D@0S,5.]NHL! -M/3=FA)]_8)FTC!X\/QJWN[9N-`E@Z7T$$X>RL$X].PB`O+?U!A_PY!LU`IB_ -MOIXV.#?LM([_%/*$D0$R-OR\NHX-/#1PAYUE9YJTC04_/QVVN[06-`YEZ64' -M%H"]L6`\.`R-O+16!AWY^04U`(2^OY8Q.#67M(_)%>6'E`,R-^^_NX(./#5? -MAY!F>X2T@`8^/!6PN[4<-`QQ[F`':H*]MA<_.`..O+5V`1/D\`"'Z`TR-)&^NX$(/`K"AY9CSNX@;-`U![V\';(^\ -MM!P^.0>+O(MD`1'FS@$T!(VYO?0R.0Z9M()::N^'X`XR-9ZYN(4U/`C^AI1M -M28&TA`PY,EBRN(\$-P/4[&H'9XF\M04Y/ANUO(EO`13@W``T&XZXLDP].0R% -MM(!T:.J'^0@]"X2XN9PT/0[@ANAO7H.TF`DY,_*\N((!-P#'XA<'<(N\BP8X -M/A*TO(\5`6KB70(U'(NXLV,\/@.&M(9^;Y>'S`H]#H&[OI\@`L[,D"QLH2A/%HYXFU^#8X-(2YOY`.-!CF\A\%X[:]AS4[,_2PLH48 -M!WWO;0D*=+&[M0$Y/1&.M9QN?IZ%:38R!;2ZLV$S,QJ?A,-H[(BUV3`Y"H"X -MO.@(-1_C]1D%ZK&]F#EL!0R,!^9A=%IZHJ*=S,Y"8VXLN4+-1/MQ1L;D;"RDS8Z,9>RLY,%!5CM -M%PL(^;*XCPXX,V6+M9=J0YN;$C$S%K&EMATR,!.;FEYOE[6+8#(Y#8F[L\0U -M"A;OU1H9G;.RZC`Z-YRRL+.BI+*.DW4?``DU,#T_/CX^/#(Q-P@-!1-YS96= -MA(",CHB+M8JUBXN)CXV#AH69DI3L^LY==F1B:!47$1`3$Q,3$Q`1%A05:&]B -M861YW-/6U%1645-375U<7%]? -M7UQ?7%U=4E-045975%555=74U-?7UM;6T=;1T=;6UM;6UM?7U]?4U-34U=74 -MU=75U-35U=75U=75U=75U=34U-74U-34U=34U-34U-34U-34U=75U=35U-34 -MU-34U=35U=75U=74U-34U-35U=75U=75U=34U-75U=75U=75U=74U=74U=75 -MU=75U=35U-34U=74U=75U=75U=74U=35U-35U=75U=75U=75U=75U=75U=75 -MU=35U=75U=75U=75U=74U-35U-75U575U575U=75U=755555U575U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=555=55U=75U=75U=555555 -MU=75U=75U=75U=755=75U=75U=75U=755555U=55U=75U=75U=75U=75U=74 -MU-34U-35U=75U-75U-35U-75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -M5555U555U=75U=75U555U=75U=75U-75U=755=55U=75U=75U57555555555 -MU=75U=75U=75U=75U=75U-35U=75U=75U=75U=75U=75U55555555575U=75 -MU5755575U=75U=75U=75U=75U=75U=75U=75U=755=55U=75U=75U=75U575 -MU=75U=75U=75U=7:ZY'@X?3$7DAP>7MD9&=E9'AX?7-T2T%%4E;1TMO%P\+. -MR*M+:SO+:TN:"F@`P(T+2TRQMO[QXY(#IL -MCI$U/C$##ST_!;2RE#$^#Y292GB"O[!I/3#NO;*'QIN(GP\R![>EL&`(&^10 -M`@_NO+Z6,#X"DII_%)NVC`TZ//2PMN`?U)C6-#T$MKJT&S!"3LPD[RQ_P5DD78T,Q&PNH@#,`/X^!H%FKRS9S\^'HR.YF"? -MBI\U.S>&OK%=`!3O>34V<+VZ@@@R`^SK$!*'O;8=.3]JM;7B;Y&,Z#0Y"X^X -MMF,/'^5Y"#7ZO+B%-SP`D9UL%8:RM08[/$:VM.(7XH'Q-S\#M+NW$S4%\G$, -M#Y:_OI4P/P:8A'1BA[&,##LR[;.VY!S#F$`W/1BQNK4$-P;]4`$!F;^\TCT_ -M!8&#QV:$MX<*.S&>O+;#!7Z1>S0P:+.ZCPTP`.?S!1N$O[-K/C\3CX_^89B* -MDS0X-("^MG$`%>YF-3=7O;N!"C(`Z>X2$(:]MQLY/&"UBN=ODXSC-SD.B;BW -M:P\=YV8+"NR_N)\V/0:0DFYH@;*+`SL]QK:TY!?N@=XV/P:WN[0?-1K^?@\, -MG;Z^XS,\!)J%8 -M@(#69(>WA34[-H6\MU`%<9%A-S!GLKJ-#S`&X?0%&8:_L!$^/!2.C_=GFHJ7 -M-S@U@KZW9`!IZ6TT-_:\NX0U,P;J[1T6@+RT!#@]?+6+_VV=C/@V.0V*N+07 -M#Q/G8@L+E+ZYD3$]!Y*0:V^#LHD-.S+YL;7S%.J!138_!+:[BALU&/MG#PV9 -MOK_S,CP:A9IX9("P@`L[,9"RM,0=_)AG-C(6L[J.`#<%Y74#!X>^LF$\/!*` -M@5YXAK>9-#LWA[RW2P5/D6\W,7>]NX`),0?CP`0?@+^Q'SD];HZ,P&6%BN@V -M.`B/N;1M`&WI:S0TYK^XF#0S!)3@'!2"O+4!.#);M(CT8I^,R#$^`[6XM1,/ -M$>9I"@B3OK[J,3(%G9$58X*RCPX[,^*QMW=!!V"OK8:.3UFB8W2>(2*XS$X -M#HFYM6L`8.D4-#3IOKB=-S,%E^TB<1@F8S5,#X&M+B*'`\7 -MYA4U#I^YON$P,AB;LK5,$N:9:S$S9K*[@PTW&.9[`@6#N;`1/SUJ@H=T -M=H.WD38["H._M6<%U)$7-C;QO[B%"C$;[U$'$XR^MPYN98W,!B6^AYNC[R(##LS_[2/UV:;C$@P/@2WN(@9#Q7A -M%S4/FKF_\3,R'YZ4%WJ/LH,*.S&1L8A<:I"&;3`]$;"[C`8*$^1K"0&!N+)A -M/3(1AY]C=(RPFS<[-(2RBG`2XYD7,#-VO;N!#S5,3L(C;^*8AK;D1`Q-N:_N)DU,1GN1P<6CKZT`3@S6(B#1'&!B\XP.0.U -MN8@1`7GN$S<*DKF^Z#8P'Y;\&6*)O(X..S#@MXQ>9)J->#,_&[:XCAL,:.81 -M-0R$N+S4,S,2GNL6Q/OGA`P,%6\N(0.-!WA8PT>C[BQ&SXS9(V$?T6- -MM^TP.`Z/OXAI&LZ6'3$WZ;ZYDC4V'.E*!A2)OK4#.##%BX!)2H&+43,Y`;2^ -MB1(!<.\<-@N9N+[A,3`=D?<99HB\C`@[,>FWC4UZA8U@,C\,326N;F6-#83Z',&:XN^B@PX,/.+@79&@(AU,CD'M[Z/ -M'`%*[!XV"(6XO_`Q,1"0S1AXBKR""CLVE[>"=WZ$@F@R/Q"PN8($#&/F'#0" -M@[N]9S(P%)CM$5J+LH4W.S2:L(Q^;)R'$S(R?;VXAP((%><0";6IH+NQ@^YC -M&@(+,3,_/SD^/STS-C4.`1EI0>&1FX:"C(F(BHJ*BHN)CHR"@8>;G)'KX?#2 -M3'YA;VH4%A$0$Q,3$Q`1%A<5:VYM8&=[?79.1%+5W=K!S,C*]/?W]_?T]/7( -MSLW`Q]K8W-+1U]545E%34EU<7%]?7UQ<75U24E-04%%65U15U=34U-?7UM;6 -MUM;6T='1T=;6UM;7U]?7U]37U-34U-34U=75U=75U=75U=75U=75U=75U=74 -MU-34U-35U-74U-34U-34U-34U-75U=34U-34U-74U-35U=75U=35U-34U-35 -MU-74U-34U-34U-34U-35U=75U=34U-34U-35U=75U=75U=74U=75U=75U=75 -MU=74U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=755=75U=75U=75 -MU=75U=755=75U=75U=75U=555=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=5555555575U=75U=75U575U=75U=74U=74U=75U=75U=75 -MU=74U=75U=75U=75U=34U=75U=75U=75U=75U=75U=75555555755=75U555 -MU55555555575U=75U=7555755575U=75U=75U=75U=75U=74U=75U=75U=75 -MU=75U=75U=75555555755=75U=75U=55U575U=75U=75U=755=755=55U=75 -MU=75U5555555U575U=75U=755=75U=75U=75U=75U=75U=75U=74U-75U=75 -MU=75U=75U=75U=7555555555U=75U=75U=55U=75U=7#E);AYLG:6DAS>7ID -M9&=E97YY?'-T2T9:4U?0W=O$P\+.SLO(R\C+R<[,PL#&Q=O9W-/3T-=55%91 -M4%-24EU=75U=4E)34U!045%65E=45%155=75U=34U-?4U-?4U-?7T-=4U575 -MU=75U=75555555155514551455155=555=755%=5U=75U=75U=75U=75U=75 -MU575555555555555U=75U=75U=75U=55U575U=36U5945%555=75U=74U=34 -MU=75U=75U=75U55555555555U=?5555555755=555=75U=75U=75U=75U=55 -MU=55551555555555U555U=75U=;55U54U575U-74U=75U=74U=75U=75U=35 -MU-34U=75U554U575U-34U-35U=75U=75U=75U=75U=75U5555555U575U=74 -MU-75U-75U575U=55U=75U=74U=755=75U=75U555U575U-75U-75U=755=74 -MU-755=5555555555U575U575U=75U-75U-35U-75U=75U=75U=75U=755=74 -MU5755=75U=755=75U=75U=35U=75U=75U555U555U5555535U=75U=75U=75 -MU=75U=5555555555U555U574U=74U=74U=75U=75U=34U=?45=55U=75U=75 -MU=75U=75U=75U575U=75U=75U=75U575U]75U57555555555U=55U5555=75 -M5=75U=34U=35U=75U=75U=55U5555=75U-55U555U=75U=75U=75U=75U=75 -MU=74U=75U-75U=755515U=75U=75U=75U-34U-34U-34U=75U=75U-75U=35 -MU=755=75U=55U=75U=74U5555=55U=75U=75U=75U-75U=75U=75U=75U=74 -MU=35U-?4U=75U555U=55U=75U-75U=75U=75U=35U-34U-74U-35U=75U=75 -MU=75U=355=75U-74U-74U-75U=74U=75U=74U=75U=35U-7555545=55U=75 -MU-34U=75U=35U-75U-35U-75U=75U=75U-74U=75U=75U555U=75U-75U=75 -MU=75U=75U=75U=75U-34U=74U=35U=75U=755574U-5555555=555=555555 -MU575U=75U-74U=75U=75U=75U-35U=75U=755=74U5755=74U-34U=75U=55 -MU=755=75U=35U=55U55555555%55U=75U=34U-75U=75U=75U=75U=75U=75 -M5=75U=74U=75U=75U=75U=75U=35U=55U=755=7555555=75U=74U-75U=75 -MU=55U=75U575U]35U575555555155575U=75U=75U575U=75U-75U=75U=35 -MU=755=755=75U-75U=75U=75U-75U=75U55555555555557555555575U514 -M5575U=74U-74U-35U=34U=755=75U=755=75U=75U=75U=75U=75U-35U=34 -MU5555%55555555755555U555U=75U=75U-75U=75U=75U=?4U5555%155555 -M5575U=75U=34U-75U=555=555%555555555555555575U=755555U555U=75 -MU=75U=75U=75U=74U=75U575555555545-75U=34U-35U=35U=35U=755=75 -MU=75U=75U=75U=75U=75U=55U555U575U-55U=75U=75U=75U=75U=75U=75 -MU=755=75U=555=755=74U-75U=55U=555=55U=75U=75U=75U=75U=34U=75 -MU=75U=75U=75U575U=75U5755=75U=75U=35U=75U=74U=75U=75U=75U-74 -MU=355=75U-34U-34U-34U=75U-35U=75U55555555575U=74U=75U-34U-34 -MU=75U-34U=34U-35U=75U=75U=75U=34U=75U=75U=75U=74U=74U]?5U=75 -MU=75U=75U=75U=34U-34U-74U=75U575U555U=75U5755=555=75UM575%35 -MU=35U=75U-75U=75U-75U=35U-75U=35U=75U555U=74U-34U-75U=74U=75 -MU=75U=75U=7555555=75U=75U=74U=755575U=75U555U555U=55U=75U=35 -MU=75U=75U=74U-35U-75U-75U=34U=5555555=75U=74U=34U=34U-34U=75 -MU=35U=555555U=55U=555=55U=555%55U=75U-75U=75U575U=75U=755=75 -MU=755=75U=545=74U=34U-35U=75U=75U=75U=75U=75U=75U=75U=74U=75 -MU=75U=55U575U555U=75U575U=75U=75U=35U=75U=75U=74U=75U=555=75 -MU-7555755=75U=555575U=75U=75U=75U=35U555U575U=75U=75U555U=74 -MU575U=74U=35U=7555555=75U=35U=34U-34U-35U=7555=4U=74U=34U-74 -MU-35U-35U=75U=75U=75U555U5555575U=75U=75U=75U=355=755=75U=75 -MU=75U=75U=555=75U=75U=75U-35U=75U-?4U=75555555555=55U=55U555 -M5575U=75U=75U=75U=34U=75U=755575U-555=75U=35U=35U=75U=75U=35 -MU=75U=75U-75U575U554U=34U-34U-34U=34U=35U=75U575555555555=75 -MU=75U=75U=75U=74U-74U5755=75U=55U=55U=75U-74U=75U=75U=74U=75 -MU=755=37U=75U575U=75U=75U-755=75U-35U=75U=75U=74U=75U5755=55 -MU=75U=35U=55U-75U=75U=75U575U-75U=75U=75U=75U=74U-355=34U=75 -MU=75U=155555U55555555=75U575U=75U=35U=75U=74U-35U575U-35U=75 -M5555U=75U5555=75U=75U=75U=75U=34U=345=75U]75U=75U=75U=75U=35 -M6F=G<'!!1531V'P[(#@P#!;SGH"TM;>WL+*]M[>]IZ>W&S4;B;NQ'3@E-VAX -M`#0*&@4V)24(@;:=,2QGQH$3)WM:FV&O;^:-3T&MZ2Y[C4T:8"-E7SF -M@8<6-C%CL+N)"3H]0;>VE@6L;#G,SL+C[NR6#8V$YN$]V/B@H80 -M,3!FL[J+##@SW+>VD!L;1.-I`@:3L[/@,SH*C+BS1C"LK48/CX6L+N(!C`*5H>2?F6- -M=A]]E<0!"A*)OK<8.3X0L;F.!30"VI#2%D2#M)P(/S>9N+F0,3X/GK6`>N+F0-C\,G(N'?Q7DG%`/ -M-Q^+N+89.3X2M[^-&0L$].UN&=*)L9@*.3:?N;F0-SP-DHZ;>FV5FUL)-AF* -MN+$>.3X2M+V"'@\8\OH1!<2+L)LU.#:!\VULX4U.#&=N;Z0-#,`D8"48$.:@4@U,`6UNK$UNK`2/SP2B;:%$1E! -M[F0-#/>QO(8T.S&1O[R0"#<%ZI)!%>&/CG8Q/`>UNK`3/ST2C[29%Q/TZFP. -M#O:QOX8T.C"6O+V1#C09Z)1G%^Z(BW8Q/`:UNK`1/#(3C+6=%!7BEQ4+"/:P -MOH$T.C"4O+V6#`H=[N,5$92UM78P/P&UNK`6/3,0@HB6:F:7D!8U"O>SN8`U -M.C&5O;.7#0X6[/<2$Y&WM'0S/@"UNK`7,C,1@(SH:$^?G1,W-?6RN(,U.S'K -MLK"4`PUHXE\8')*VMW4R.0.UNK`4,S$6AH/F;L*%GAPV-,ZRN(,U.S'NL['J -M`0!FX'@''I^QMDXR.0.UNK$5,#84A(?W;.>!FQDQ-\"]NX(U.S'ML;;I!P1T -MX6\`&YBSL4`].`**N[%K,3<5FIM18NN"A1LP-MN]NX(*.#;CMK?M!1GIC8)^+A@0],%6]NXT+.3?DM(OZ'&[LYA@+!H2\LE0] -M.PV)N;=L-`EFD.458)JU@`<\,UR]NHT(/C?ZBH[S$WR7X00U`(>_LM(].PV. -MOK=B"@QXE-P38(>W@@<_,T2]NHT)/S3XB(+"%]*=X08W`X:^O=H].`R/O[1C -M"`-WZ'(>8(&QC08_,DZ]NXT./#7_CX'7:^6:X`,V`H:YO,(].`R,O+5A#P9> -MXFP%8X*PCP$^/7>]NXT,/0K]@H5`8NN'X@TP#(:YO/4].`V"O8MF`AK8Y!8& -M8HRSC@$Y/7*]NXT-,@CS@)]R9).`[`\S#X&XO/$R.`V#LXEF`!WQ\A\#;(Z] -MB0$Y/'ZRN(T",P[PAY9G.Z`@]"(:XO_DR/@*&MHUG&F#LT`8.:8J_B@$X/&>S -MN8(`-@+SG_%J5H"+Z@H\"X:[O^4S/@*'MX!G'TR56`,+:K6^M0$X//VNK*>\ -MBIO%$`8.-3`R/C\Y/S\R,S7-T0EA1UM[$PL[*]/3W]_?W -M]/7*R<_"P;EQM]-2WQY -M965D9&5E>'YS=W5*05I35-/?VL?"S,G)R\O*R,C.S\W#P`]$;KFY47`1.$L+#J-S@VD;ZX@`H[/6VTLX,?"@UF -ME.-A%?Z!@LH.,`^;O[Z%-#HR_[R[B`8R-FF"BYMM'7GL^Q,#&9VVMNLT.3:6 -MOKN-"#L]8+>]CQ,*#V"3D5EIPX6`_0TQ#)^]OX4T.CW`O;N+!CTP%X*UA&T; -M:OCG:P8>EK2WE34^-I6_NX\..SQNMK^($#0+:)V9\VQ$G(?Z`#<,D[*_A#4Z -M/56]NHH'/#,3C;>`8P02QN-E&ASKBK27"#PV[KR[C@\[/Q6VOHH6-S46GX3L -M8WB4A><'-`V6L[R'"SL]0KVZM00_,AR,MHUF`1I#[%D=$N..M98./3?@O;N) -M##L_%K:YM!>?X!L+`I6QO8<).#UPLKJT!3\\&(RPCGH#!F7I -M\!40_H**D0TR-^6RNXD-.SX3MKBW%3$V&9B-GG@5WI'C'0X`[+:RA@\Y/7JR -MI;<:/C\%C[.+<@T";NOB9A;"@8F0`S`T\+.XB`,[/ARVN[9H,3`%FXZ$<1!_ -MZ>T7`@'FM+.XR8;.EMQ@^/P>/LK5(#P\6ZI=;%5V%C)`&,33-L+B+`#@^ -M&;>[L6TP,P>;BX%''&CE[6T!!O^*L($#/S)LL*6V'SX^`8^\MUT)"QV5G?)O -M=IR#D`4W-="QN8L&.#X;M[JP9C,]`9NUC=`8$][M?`4$R8FQ@0$\,FBQNK8= -M/CD`C[^VV0LU&Y6;[F9EE(>0&30*6;:^B@.RP4;<>)1 -M'!K0C+>!!S(S%;:ZL1`^.`*,O['W"C<$ZH>0?6+FFY$3"@M)M+^*!3XY!+2Z -MLW*AADP,!:TN[!J/SL/ -MC;FRX#4P`NF"A]H4(B]BA\\/@:UNKW3,CD(F;"WZ`$,'.>50Q9^ -MF(F''38Q$+6XL&P_.PZ"N;WI-#,/[X^#_1%OYY5[`0UGC[.*$ST^`8NZO,@S -M.`J>L[&7``@:^Y#Q:623C806-S83BKBP83P["(.XO)0T/0GBB8S@$Q'9Z4,% -M`&&"L(L6,C\`B+J\_S,X-9RRLY,#-0;SG.QG8.N!A6HU-Q*(N;!X/3L+@+B_ -MD30\"N&+B.H='G+MVQ\&8H&VB&HS/`".N[SF,SLTG;VRGP(T`\N;D75MY82; -M8@@T'8Z_L'0].PJ!N+Z=-#\UY;6UD1P$;N?]%P5LA+>);#$\`XR[O^TS.S>3 -MO;V;`C8,WH29WF[9GYEZ#S4<'@$0_^%C&6^8 -MM8YG-CT#C;B_ZS`Z-I&\O(0",0E`AG)Z4X3;I*(CWTT,@.#N;^4,#HQE+R^A@(P"DJ`@.QK8N&04`8) -M'(:SLPA!D/!-64]!5IE(R-3C4S`H&^OY$Q.C'KO+F` -M`C(T?H.,EFH7QI3!&@P&,B^H/ -M,C7HO;B,#CL\:[&YM1(Q-A*%C9UG%VRN(\/.S\4L;BT$#`Q'H6.FG@0=NO@$0T&Z;>S -MA0X^,TVRNK0'/CP;B;*+9`X/%9643A7=A(R4`#$UY[.YC@TX/Q&QN[<6,S,% -MA(N&<1QOY^-H`0?@M;"$##\SXZZLI[^UF\81!@XU,#(^/CD_/S(S-S4-!Q!C -MR>RW-/1U]5745!375Q< -M7U]?7%Q=75U24U!045975U15U=34U-?7U]?6UM;6UM;1T=;6UM;7U]?7U]?4 -MU-34U-35U=75U=75U=75U=75U=75U=75U=34U-34U-34U-74U-34U-34U-34 -MU-75U-74U-34U-35U-75U=75U=34U-34U-75U=75U=75U-34U-34U=75U=75 -MU=74U-75U=75U=75U=75U=35U-75U=75U=75U=34U-34U-35U=75U=75U-75 -MU=75U=75U=75U=75U=75U=75U=75U=75U-75U=75U=75U=75U=75U=75U555 -M5555U=75U=75U=755=55U575U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU-75U=75U=75U=75U=75U=75U=555=75U=75U=75U=75U=75U=75U=75U=75 -MU=55U=75U=75U=75U=5555555555U=75U=55555555555=75U575U=555555 -MU=75U=75U=75U=75U=75U=75U=35U=75U=75U=75U=75U=7555755575U=75 -MU=75U555U=75U=75U=75U=75U=75U=75U=75U=75U55555555=55U=555=55 -M5555U=75U=75U=75U=75U=75U-74U=35U=75U=75U=75U=75U=755555U575 -MU=75U=75U=75U=75U=?ZD.CA^\333G5^>61E9V1E>GA_4=33WL7& -MPLS.R,O(R\O+R)B["] -ML+6WL*:MO(: -M`)>^I8(U/1^TO8S6_H:9!3<$M:6P!3\V^X^89DZ'AAD\,O"_ON\Q,!R=ZQ5R -M@K?I,3@"M+N*!#0%X_`8$(&]M0`[,I2\L/0#'_E0`P_BLK_A/3@$B[&>$F^7 -MY0TQ&K2ZM0\Y-)>+FF=;AX4%/3:PDQD5Z,H--Q>QNXPU.`J8M9IB -M3X6H&=9M&"B&;:W.9EP,S#X^ZL!D\-MR" -MGV??@XT1/3+1O[F=-#$=D^P7<(RQDC8[#HJXM1DU&N75!!F&O;0'.#W[LK'X -M`1+D10T(_;*^EC,X`8^VGA9EDN(-,`:UNK<`/C?CCIEFWX"!&#TPE;F^YC$Q -M%YGJ:UB/M^8P.0:WN(X!-!O@VAH1@[V(##LPD[RQ6P(<^TX"#)2]O,\\.1FU -ML9(=8I;R##$;HVR@PH[-X>^MV(/'OY(`P"?O+-L/CYKM[&4&&CJW@\W;["[@#0Y -M"86UF6]>A)(#,@N#NK,6/39+@9-@PXV):#T\9;VXF@HV')?[$GJ/L)HW.PJ/ -MN;03"!G[3`$%A+RV&3@\7["QX`07[5H/-5&RN9DP.0*#M)\52ICJ#3,"B+JV -M!#\W\(*=82$7^=YP\P!+2ZM0T^-.B.G&'/@(8$/3:3 -MN+_),39KF.EJT(ZW]#,Y!;&XC0`T&>+5!1>-O8\).S&9O+9R`A+ERN(8.-QSKPQECC[*!-#LT@+ZT:@\<^G,#!IJ\L!8Y/V:VMNX;;Y52#C=E -ML[B'-CD,A[6<;M>$D0(R#HRZL!P]-U6!EF+VC(X6/3U&O+F<-3<3EO(2L+B#`C0<[5D%:HR]C0L[-H6_MV8"$.1[ -M#`*?O[)G/S\4M+:5'&61W`DV%;"[@C0Y"9F+DFWU@9\#/0J`N[(5,C=VA.MN -M\(Z*;#T\;;*YA0DT$NK=&62.LH0W.S6-OK46#Q+E>P('A+^Q'3D\=[:VX1MC -ME4P)-$^RN(4Q.0*&M9-HQ827##(,B;JQ&CPTS(&4;?Z/CQ(\,LR_OI$U-Q:1 -M]1U,B+"0,3@,BKF(&`@=Y'X`&("_M`8X,N>SML@':.]\"0KDO;Z5,CD'C+21 -M%%&;X`XS!K2ZM`,_->V-D6/XC(`%/#&7N;_^-C=HG?@1WHBV^C,Y![>YC`8* -M'>%P!A&,O(@/.S&2O;=T`13@90X/D;^\TSP^'(NWE!!,G/0(,!RVNHD(/@N0 -MCI!B^8*%`#PWA;N]>#`W9)O@%?&(M'`]/A.SN88--1+O3P5OCKV#-3LTAK^T -M;P(6YV<,`YN_LV@^/V^TM^P,@0<\,9*XO-LV-V*<\Q'(B[;,,CD: -MMKF#``H3X'D&%X^\C@@[-IF]M'@!:N-A"0R=O[UW/S\0BK3H$%B?V@LQ$;&Z -MC`H^"9V/EF+D@IH#/#2&N[)M,#1RF^04^8NU9CT_%;.YA`\U$>]V!&.(O8$T -M.S6`O[45`A?F8P\`A+ZS$3D\9+>WX1]VD$\+-GBRNX51!ATB[.?,3L.B;Z('`\6YV,-!8"^ -MM@0X,O:QM_0:EJVAN;>&X6D$#0LW,CT^/SD\/#`Q-0X&&&Q,XY::AH*,B8B* -MBK6*BXF.C(*!AYNOA\--,>6%O:A06$1`3$Q,3$!$6%Q1J:6U@9WI\=DE$ -M7=7=VL#,R/7T]_?W]_3URLC.S<#&Q=C?TM'7U51645!24EU<7U]?7UQ<75)3 -M4U!15E975%55U=34U];6UM;6UM;6UM;6UM;6UM;7U]?4U-34U-34U-34U-75 -MU=75U=75U=35U=35U-75U=34U-34U-34U-34U-34U-34U-34U-34U-35U-74 -MU=34U-34U-74U=75U=74U-34U-74U=75U-35U=34U-74U=75U=75U=75U-75 -MU=75U=75U=75U=34U-75U=75U=75U=74U=75U=75U=75U=75U=74U=75U=75 -MU=75U-74U-75U=75U=75U=75U=75U=75U555U=75U=75U=75U=55U=75U=75 -MU=75U=755=75U=75U=35U=75U=75U=75U=74U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=555=755=75U=75U=75U=75U=75U=34U-35U-75U=75 -MU=74U-75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=555555U=55U=75 -MU=7555755=75U=75U=75U=75U=75U=75U=75U=75555555555=755=55U555 -MU575U=75U=75U=75U=75U=75U=75U=75U5555555U=75U=75U=55U=75U=75 -MU=75U=75U=75U=75U=34U=35U=55U=75U=75U=75U=755575U=75U=75U=75 -MU=75U=;FD^[A_L77271Y>&1D9V1D>GA\V-C8V=G?W]+2T]S>45C81%#&6]907515 -M1E344=9`T-13UE-7WUE6TE_?T%/25]#04]?65MW75=95UM965-15U]76T]54 -MUU96TE35UU'6U5=45=745%#7U%165M?5U=?5U-!6T]57TU/7UU+25%?15M'6 -M4M?7U=96U]74U=54UM75U5;45]?7U==7U57545365-=6U=17U5775=;45=55 -MU%=5U5365%755M95U-16UE755%575==1UN2AHZ4J*BXA.30%6Y*#B[>QL+.S -ML["VM[6(C(&%G97DW'-B%!`<&!H%!`0$!`0%&A@>'1,6%&EB9W]T1%39S/?R -M_OOEY.?GY^3DY?KY__+P]\H)(*NFL)P=-3T[)"8F(28F)R4[/S(V"P,;%4+G -MD9N&@H^(B[6UM;6*BXB.C(*!AYJ>DY3LY/?307-E86UN:VH5%106$1`0$184 -M%6EM87IR2%O4V\_W\O[[Y>3DY^?DY.7[^?SR\?3(PL39T]=74U];149`0TU- -M34Q-34)#0$%'1%I;6%Y?75-045975%75U=34U-34U-35U=5555555%145U=7 -M5E965E965E9645965E9645965E975E975U=75U=75%145%145%145%145%14 -M5%145%145%145%145%145%=45%175%145%155%1455155%55555555555555 -M5%555555555455555%555555555555555555555555555555555555555555 -M55555%5555555555555555555555555555755=55U=75U=75U=75U=755=75 -M55755=555=5555555=75U=75U=75U=55U=75U=75U=75U=75U=75U=75U575 -MU=75U=75U=75U=75U=75U=75U=55U55555755575U555U=75U=75U=55U575 -MU=75U575U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=74U-75U-35U-34U-75U-75U=75U=75U5755=555=555555 -M5555555555555575U555U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=55U=75U=75U=75U=75U=75U=75U=75U=75U=75U=55U=75U575U=755=75 -MU=755=75U5755=75U=755=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U-75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U-75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=31T=?45=755%165E=45%15 -M5=75U=74U-74U-34U-34U=34U-75U=55U=74U-745%74U%;5E[2U@(25Y'9@ -M%A(9&P4%!1H8&1P2%A5O87YU4M[U_>7FX^WO[NGIZ>[O[.WCX>?E^?WVRL+: -MW==67%M'0TU.24A+2TA(3D],0D!&1%M97UU345=5U=36UM'0T]/3T]/3T-#0 -MT=;6U]?7U-7555545%145U=75E=75E=75U=75U=75U175%145%1555555555 -M55555555555555555555555555555555555555555555555555555555U555 -M5=555=55555555555555U5555555557555755555557555555555U575U=75 -M5=75U=75U=75U=75U=75U=75U=55U=75U575U555U5755=55U555U575U=55 -MU=75U575U=75U=755555U555U575U=75U=75U=55U5755=555=755=55U=75 -MU=55U=75U575U575U=755=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U555U555U555U575U=55U575U=75U575U=75U=755=75 -M5=55U=55U575U=75U=75U=75U=75U=75U=35U-75U-75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=74U=35U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=35U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U575U=75U=755=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=755=755=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=55U=75U5755=55U=55U=75U=75U575 -MU=75U=55U=55U575U=75U=55U=75U=55U=75U=75U=75U=75U=75U=75U=75 -M5=75U=75U=75U=75U575U5755=75U=75U=75U=75U=75U=75U575U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=35U=75U=75U=55U=55U=755=75U=75U=75U=75U=55U=75U=75U=75U=75 -MU=75U=75U=75U=55U575U57555755=55U555U5755=55U555U555U575U575 -M557555755=555=555=555=55U57555755555U5755=555=5555555=555575 -M5555U555555555555=555=55U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=755=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=755=755=75U575U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=55U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U575U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U575U=75U575U=75U=755=75U=75U575U=75U575U=75 -MU=75U=75U=75U=75U=75U=75U=75U=7_____________________________ -M__________________________________________________________]5 -M555555555555555555555555555555555555555555555555555555555555 -M55555555555555555555555553HX,@L1DHJ]N+JXO8J2$0LR.#HX/34%9@PP.3H[/S<'_HVPN;J[O[:&=`(Q -M/CH[/C8!V8.QOKJZOK&#W`$V/CLZ/C$"2H:VO[NZN;"-_P(LKBZN[RTF6L),SDZ.SPT&^R.L[FZN[RWA6$/,SDZ.S\W!/B- -ML+FZN[^VAG<",#XZ.S\V`=J#L;ZZNKZQ@-,`,3X[.CXQ`DF&MK^[NKZPC?T' -M-S\[.CDP#&2$M[^[NKFSC^(:-#P[.CDS"6F8M+R[NKBRB)0?-3TX.C@R"Q:2 -MM;VXNKB]BI,0"C(X.C@]-1R7B+*XNKN\M9YJ"3(X.CL\-!OOCK.YNKN\MX5A -M#S,Y.CL_-P3ZC+"YNKN_MH9Q`C`^.CL_-@''@[&^NKJ^L8#6`#$^.CH^,0-, -MAK:_N[J^L(WR!S8_.SHY,`QDA+>_N[JYLX_C!30\.SHY,PYNF+2\N[JXLHB5 -M'S4].#HX,@L6G;6]N+JXO8J0$`H].#HX/34=EXNRN+J[O;6>%0DR.#H[/#08 -M[HZSN;J[O+>%8`\S.3H[/S<$Y8RPN;J[O[:'<`(P/CH[/S8!P(.QOKJZOK&` -MU0`Q/CHZ/C$#0(&VO[NZOK""\`!MK^[NKZP@O$&-C\[.CDP#'J$M[^[NKFS -MC^$%-SP[.CDS#F^;M+R[NKBRB>H>-3P[.C@R"!>_N[JYLX_A!3<\.SHY,PYLF[2\N[JYLXGK&30\.SHX,@@7G+6]N+JX -MLHN1$PH].#HX/342D8NRN+JXO;6?%`@R.#H[/#09Z(FSN;J[O+2:;0\S.3H[ -M/#<$YXRPN;J[O[>'?PTP.3H[/S8&RH*QOKJ[OK:!7`,Q/CHZ/C$#68&VOKNZ -MOK&"]`8V/SLZ.3`-?H>WO[NZN;",Y@4W/#LZ.3,.;9JTO+NZN;.)ZQDT/#LZ -M.#((%)RUO;BZN+*+D1(*/3@Z.#T*$I&+LKBZN+VUG!0(,C@Z.SPT&>N)L[FZ -MN[RTFFT.,SDZ.SPW!>:,L+FZN[^WAWX-,#DZ.S\V!O2"L;ZZN[ZV@5D#,3XZ -M.CXQ`UR!MKZ[NKZQ@LH&-C\[.CDP#7^'M[^[NKFPC.<$-SP[.CDS#VV:M+R[ -MNKFSB>@9-#P[.C@R"!2?M;VXNKBRBY$2-3TX.C@]"A.1B[*XNKB]M9P7"#(X -M.CL\-!GKB;.YNKN\M)ML#C,Y.CL\-P7AC[.YNKN_MX1X#3`Y.CL_-@;W@K"^ -MNKN_MH%:`S$^.CH^,0!3@+&^N[J^L8+)!C8_.SH^,`U]A[>_N[JYL(SD!#<_ -M.SHY,P]BFK2\N[JYLXGI�\.SHX,@@4G[6]N+JXLHN6$C4].#HX/0H3D(JR -MN+JXO;6<%P@R.#H[/#4>ZHFRN+J[O+2;;PXS.3H[/#<%X8^SN;J[O[>$>@PP -M.3H[/S8&\8*POKJ[NU555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -755555555555555555555555555555555 -` -end diff --git a/usr.sbin/i4b/g711conv/Makefile b/usr.sbin/i4b/g711conv/Makefile deleted file mode 100644 index f24d6e8d568b..000000000000 --- a/usr.sbin/i4b/g711conv/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -#--------------------------------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Thu May 20 11:58:43 1999] -# -#--------------------------------------------------------------------------- - -PROG= g711conv - -.include diff --git a/usr.sbin/i4b/g711conv/g711conv.1 b/usr.sbin/i4b/g711conv/g711conv.1 deleted file mode 100644 index 1a7b32813805..000000000000 --- a/usr.sbin/i4b/g711conv/g711conv.1 +++ /dev/null @@ -1,93 +0,0 @@ -.\" -.\" Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: g711conv.1,v 1.3 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 22:54:33 1999] -.\" -.Dd March 15, 1999 -.Dt G711CONV 1 -.Os -.Sh NAME -.Nm g711conv -.Nd conversions according to G.711 -.Sh SYNOPSIS -.Nm -.Op Fl a -.Op Fl u -.Op Fl P -.Op Fl A -.Op Fl R -.Sh DESCRIPTION -The -.Nm -utility -is part of the isdn4bsd package and is used to convert between the A-Law and -u-law formats as specified in ITU G.711. -It is based on a freely available -and freely usable reference implementation done by Sun Microsystems, Inc. -.Pp -The following options are available: -.Bl -tag -width Ds -.It Fl a -Convert A-law to u-law -.It Fl u -Convert u-law to A-law -.It Fl r -Reverse bits before conversion -.It Fl R -Reverse bits after conversion -.It Fl P -Print the resulting conversion tables (as C-source) to stdout instead of -doing the actual conversion. -.El -.Sh EXAMPLES -The command: -.Bd -literal -offset indent -g711conv -P -a -.Ed -.Pp -prints out the A-law to u-law conversion table as C-source to stdout. -.Pp -The command: -.Bd -literal -offset indent -cat max_headroom.ul | g711conv -u -R > /dev/i4btel0 -.Ed -.Pp -converts the u-law coded voice of Max Headroom to A-law, reverses the -bits of the result and moves that to an active isdn4bsd telephone connection. -.Sh STANDARDS -A-Law and u-Law conversions are specified in ITU Recommendation G.711. -.Pp -The reference implementation done by Sun Microsystems, Inc.\& is available -from http://www.itu.int/itudoc/itu-t/rec/g/g700-799/refimpl.txt -.Sh AUTHORS -The -.Nm -utility and this manpage were written by -.An Hellmuth Michaelis Aq hm@kts.org -based on the G.711 conversion reference code written by Sun Microsystems, -Inc.\& and code contributed to isdn4bsd by Stefan Bethke. diff --git a/usr.sbin/i4b/g711conv/g711conv.c b/usr.sbin/i4b/g711conv/g711conv.c deleted file mode 100644 index f158a9d2e34c..000000000000 --- a/usr.sbin/i4b/g711conv/g711conv.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * --- - * - * The A-law to u-law and u-law to A-law conversion routines and tables - * were taken from the G.711 reference implementation from Sun and freely - * available as http://www.itu.int/itudoc/itu-t/rec/g/g700-799/refimpl.txt. - * - * Therefore for that part of the code, the following restrictions apply: - * - * - * This source code is a product of Sun Microsystems, Inc. and is provided - * for unrestricted use. Users may copy or modify this source code without - * charge. - * - * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING - * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun source code is provided with no support and without any obligation on - * the part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - * - * --- - * - * The bitreverse table was contributed by Stefan Bethke. - * - *--------------------------------------------------------------------------- - * - * A-law / u-law conversions as specified in G.711 - * ----------------------------------------------- - * - * last edit-date: [Mon Dec 13 21:44:01 1999] - * - * $Id: g711conv.c,v 1.5 1999/12/13 21:25:24 hm Exp $ - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include - -/* copy from CCITT G.711 specifications */ - -/* u- to A-law conversions */ - -unsigned char _u2a[128] = { - 1, 1, 2, 2, 3, 3, 4, 4, - 5, 5, 6, 6, 7, 7, 8, 8, - 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, - 25, 27, 29, 31, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, - 46, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, - 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, - 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 -}; - -/* A- to u-law conversions */ - -unsigned char _a2u[128] = { - 1, 3, 5, 7, 9, 11, 13, 15, - 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, - 32, 32, 33, 33, 34, 34, 35, 35, - 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 48, 49, 49, - 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 64, - 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 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 -}; - -/* reverse bits (7->0, 6->1, 5->2 etc) for tx to / rx from ISDN */ - -unsigned char bitreverse[256] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -/* A-law to u-law conversion */ - -unsigned char alaw2ulaw(unsigned char aval) -{ - aval &= 0xff; - return ((aval & 0x80) ? (0xFF ^ _a2u[aval ^ 0xD5]) : - (0x7F ^ _a2u[aval ^ 0x55])); -} - -/* u-law to A-law conversion */ - -unsigned char ulaw2alaw(unsigned char uval) -{ - uval &= 0xff; - return ((uval & 0x80) ? (0xD5 ^ (_u2a[0xFF ^ uval] - 1)) : - (0x55 ^ (_u2a[0x7F ^ uval] - 1))); -} - -void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "g711conv - do conversions according to ITU G.711, (version %d.%d.%d)\n",VERSION, REL, STEP); - fprintf(stderr, "usage: g711conv -a -r -R -u -P\n"); - fprintf(stderr, " -a A-law to u-law conversion\n"); - fprintf(stderr, " -r reverse bits before conversion\n"); - fprintf(stderr, " -R reverse bits after conversion\n"); - fprintf(stderr, " -u u-law to A-law conversion\n"); - fprintf(stderr, " -P print conversion table as C source\n"); - fprintf(stderr, "\n"); - exit(1); -} - -int -main(int argc, char **argv) -{ - int i; - int c; - int opt_a = 0; - int opt_u = 0; - int opt_r = 0; - int opt_P = 0; - int opt_R = 0; - unsigned char uc; - - while ((c = getopt(argc, argv, "aurPR")) != -1) - { - switch(c) - { - case 'a': - opt_a = 1; - break; - - case 'u': - opt_u = 1; - break; - - case 'r': - opt_r = 1; - break; - - case 'R': - opt_R = 1; - break; - - case 'P': - opt_P = 1; - break; - - case '?': - default: - usage(); - break; - } - } - - if((opt_a + opt_u) > 1) - usage(); - - if(opt_P) - { - printf("\n/* "); - - if((opt_a + opt_u) == 0) - printf("No Conversion"); - - if(opt_a) - printf("A-law to u-law conversion"); - - if(opt_u) - printf("u-law to A-law conversion"); - - if(opt_r) - printf(", reverse bits BEFORE conversion"); - - if(opt_R) - printf(", reverse bits AFTER conversion"); - - if(opt_a) - { - printf(" */\n\nunsigned char a2u_tab[256] = {"); - } - else if(opt_u) - { - printf(" */\n\nunsigned char u2a_tab[256] = {"); - } - else - { - printf(" */\n\nunsigned char table[256] = {"); - } - - for(i=0; i < 256; i++) - { - uc = i; - - if(!(i % 8)) - printf("\n/* %02x */\t", i); - - if(opt_r) - uc = bitreverse[uc]; - - if(opt_u) - uc = ulaw2alaw(uc); - - if(opt_a) - uc = alaw2ulaw(uc); - - if(opt_R) - uc = bitreverse[uc]; - - if(i == 255) - printf("0x%02x", uc); - else - printf("0x%02x, ", uc); - } - printf("\n};\n"); - } - else - { - unsigned char ib[1]; - - while(fread(ib, 1, 1, stdin) == 1) - { - if(opt_r) - ib[0] = bitreverse[ib[0]]; - - if(opt_u) - ib[0] = ulaw2alaw(ib[0]); - - if(opt_a) - ib[0] = alaw2ulaw(ib[0]); - - if(opt_R) - ib[0] = bitreverse[ib[0]]; - - fwrite(ib, 1, 1, stdout); - } - } - return(0); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/Makefile b/usr.sbin/i4b/isdnd/Makefile deleted file mode 100644 index ce6c51c464e6..000000000000 --- a/usr.sbin/i4b/isdnd/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# $FreeBSD$ - -PROG= isdnd -MAN= isdnd.rc.5 isdnd.rates.5 isdnd.acct.5 isdnd.8 -SRCS= rc_parse.y rc_scan.l main.c rc_config.c log.c curses.c \ - process.c rates.c msghdl.c fsm.c support.c timer.c \ - exec.c dial.c monitor.c pcause.c controller.c alias.c \ - y.tab.h holiday.c - -# compile debug support -CFLAGS+= -DDEBUG - -# avoid wacky merging of string constants from -# source code with compile-time timestamp -CFLAGS+= -fno-merge-constants - -# enable rtprio usage -CFLAGS+= -DUSE_RTPRIO - -CFLAGS+= -I. -I${.CURDIR}/../isdnmonitor -I${.CURDIR}/../isdntel -I${.CURDIR} - -.include "${.CURDIR}/../Makefile.inc" - -.if !defined(I4B_WITHOUT_CURSES) -CFLAGS+= -DUSE_CURSES -DPADD= ${LIBCURSES} -LDADD= -lcurses -.endif - -.if defined(I4B_EXTERNAL_MONITOR) -CFLAGS+= -DI4B_EXTERNAL_MONITOR -.if defined(I4B_NOTCPIP_MONITOR) -CFLAGS+= -DI4B_NOTCPIP_MONITOR -.endif -.endif - -.include diff --git a/usr.sbin/i4b/isdnd/alias.c b/usr.sbin/i4b/isdnd/alias.c deleted file mode 100644 index f91a0a17b44e..000000000000 --- a/usr.sbin/i4b/isdnd/alias.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnd - common aliasfile handling - * ================================= - * - * NOTE: this has to stay in sync with isdntel/alias.c to be able - * to share a common aliasfile! - * - * $Id: alias.c,v 1.8 1999/12/13 21:25:24 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:04:40 2006] - * - *----------------------------------------------------------------------------*/ - -#include "isdnd.h" - -static struct alias *firsta = NULL; - -#define MAXBUFSZ 256 - -static void free_alias(struct alias *ptr); - -/*---------------------------------------------------------------------------* - * read in and init aliases - *---------------------------------------------------------------------------*/ -void -init_alias(char *filename) -{ - FILE *fp; - unsigned char buffer[MAXBUFSZ + 1]; - unsigned char number[MAXBUFSZ + 1]; - unsigned char name[MAXBUFSZ + 1]; - unsigned char *s, *d; - struct alias *newa = NULL; - struct alias *lasta = NULL; - - firsta = NULL; - - if((fp = fopen(filename, "r")) == NULL) - { - llog(LL_ERR, "init_alias: error opening aliasfile %s: %s!", filename, strerror(errno)); - exit(1); - } - - while((fgets(buffer, MAXBUFSZ, fp)) != NULL) - { - if(buffer[0] == '#' || buffer[0] == ' ' || - buffer[0] == '\t' || buffer[0] == '\n') - { - continue; - } - - s = buffer; - d = number; - - while(*s && (isdigit(*s))) - *d++ = *s++; - - *d = '\0'; - - while(*s && (isspace(*s))) - s++; - - d = name; - - while(*s && (isprint(*s))) - *d++ = *s++; - - *d = '\0'; - - if((strlen(number) > 1) && (strlen(name) > 1)) - { - if((newa = (struct alias *) malloc(sizeof(struct alias))) == NULL) - { - llog(LL_ERR, "init_alias: malloc failed for struct alias!\n"); - exit(1); - } - - if((newa->number = (char *) malloc(strlen(number)+1)) == NULL) - { - llog(LL_ERR, "init_alias: malloc failed for number alias!\n"); - exit(1); - } - - if((newa->name = (char *) malloc(strlen(name)+1)) == NULL) - { - llog(LL_ERR, "init_alias: malloc failed for name alias!\n"); - exit(1); - } - - strcpy(newa->name, name); - strcpy(newa->number, number); - newa->next = NULL; - - if(firsta == NULL) - { - firsta = newa; - } - else - { - lasta->next = newa; - } - lasta = newa; - } - } - fclose(fp); -} - -/*---------------------------------------------------------------------------* - * free all aliases - *---------------------------------------------------------------------------*/ -void -free_aliases(void) -{ - free_alias(firsta); -} - -/*---------------------------------------------------------------------------* - * free aliases - *---------------------------------------------------------------------------*/ -static void -free_alias(struct alias *ptr) -{ - - if(ptr == NULL) - return; - - if(ptr->next != NULL) - free_alias(ptr->next); - - if(ptr->number != NULL) - free(ptr->number); - - if(ptr->name != NULL) - free(ptr->name); - - free(ptr); -} - -/*---------------------------------------------------------------------------* - * try to find alias for number. if no alias found, return number. - *---------------------------------------------------------------------------*/ -char * -get_alias(char *number) -{ - struct alias *ca = NULL; - - if(firsta == NULL) - return(number); - - ca = firsta; - - for(;;) - { - if(strlen(number) == strlen(ca->number)) - { - if(!(strcmp(number, ca->number))) - return(ca->name); - } - if(ca->next == NULL) - break; - ca = ca->next; - } - return(number); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/config.h b/usr.sbin/i4b/isdnd/config.h deleted file mode 100644 index a4b05f171bc8..000000000000 --- a/usr.sbin/i4b/isdnd/config.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - compile time configuration header file - * --------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Mon May 21 11:21:15 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -/* general values */ - -#define UMASK 022 /* file creation perm mask */ -#define CFG_ENTRY_MAX 60 /* max no of config entries */ -#define ISDN_CTRL_MAX 4 /* max no of controllers */ -#define MAX_RE 8 /* max regular expression entries */ - -/* monitor max values */ - -#define MAX_MHOSTS 8 /* max allowed monitor hosts */ - -/* timouts */ - -#define TIMEOUT_CONNECT_ACTIVE 30 /* seconds to wait for MSG_CONN_ACT */ - -/* utility programs forked */ - -#define REGPROG_DEF "program" /* default program to use for regexpr */ -#define ANSWERPROG_DEF "answer" /* default telephone answer program */ - -#endif /* _CONFIG_H_ */ - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/controller.c b/usr.sbin/i4b/isdnd/controller.c deleted file mode 100644 index bdaa3c4bde8c..000000000000 --- a/usr.sbin/i4b/isdnd/controller.c +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - controller state support routines - * ---------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:24:05 2006] - * - *---------------------------------------------------------------------------*/ - -#include -#include - -#include "isdnd.h" - -static int -init_controller_state(int controller, int ctrl_type, int card_type, int tei, int nbch); - -/*---------------------------------------------------------------------------* - * get name of a controller - *---------------------------------------------------------------------------*/ -const char * -name_of_controller(int ctrl_type, int card_type) -{ - static char *passive_card[] = { - "Teles S0/8", - "Teles S0/16", - "Teles S0/16.3", - "AVM A1 or Fritz!Card", - "Teles S0/16.3 PnP", - "Creatix S0 PnP", - "USRobotics Sportster ISDN TA", - "Dr. Neuhaus NICCY Go@", - "Sedlbauer win speed", - "Dynalink IS64PH", - "ISDN Master, MasterII or Blaster", - "AVM PCMCIA Fritz!Card", - "ELSA QuickStep 1000pro/ISA", - "ELSA QuickStep 1000pro/PCI", - "Siemens I-Talk", - "ELSA MicroLink ISDN/MC", - "ELSA MicroLink MCall", - "ITK ix1 micro", - "AVM Fritz!Card PCI", - "ELSA PCC-16", - "AVM Fritz!Card PnP", - "Siemens I-Surf 2.0 PnP", - "Asuscom ISDNlink 128K PnP", - "ASUSCOM P-IN100-ST-D (Winbond W6692)", - "Teles S0/16.3c PnP", - "AcerISDN P10 PnP", - "TELEINT ISDN SPEED No. 1", - "Cologne Chip HFC-S PCI based", - "Traverse Tech NETjet-S / Teles PCI-TJ", - "Eicon.Diehl DIVA 2.0 / 2.02 ISA PnP", - "Compaq Microcom 610", - "AVM Fritz!Card PCI Version 2", - }; - - static char *daic_card[] = { - "EICON.Diehl S", - "EICON.Diehl SX/SXn", - "EICON.Diehl SCOM", - "EICON.Diehl QUADRO", - }; - - static char *capi_card[] = { - "AVM T1 PCI", - "AVM B1 PCI", - "AVM B1 ISA", - }; - - static char *capimgr_card[] = { - "CAPI manager driven board" - }; - - if(ctrl_type == CTRL_PASSIVE) - { - int index = card_type - CARD_TYPEP_8; - if (index >= 0 && index < (sizeof passive_card / sizeof passive_card[0])) - return passive_card[index]; - } - else if(ctrl_type == CTRL_DAIC) - { - int index = card_type - CARD_TYPEA_DAIC_S; - if (index >= 0 && index < (sizeof daic_card / sizeof daic_card[0] )) - return daic_card[index]; - } - else if(ctrl_type == CTRL_TINADD) - { - return "Stollmann tina-dd"; - } - else if(ctrl_type == CTRL_CAPI) - { - int index = card_type - CARD_TYPEC_AVM_T1_PCI; - if (index >= 0 && index < (sizeof capi_card / sizeof capi_card[0] )) - return capi_card[index]; - } - else if(ctrl_type == CTRL_CAPIMGR) - { - return capimgr_card[0]; - } - - return "unknown card type"; -} - -/*---------------------------------------------------------------------------* - * init controller state array - *---------------------------------------------------------------------------*/ -void -init_controller(void) -{ - int i; - int max = 1; - msg_ctrl_info_req_t mcir; - - for(i=0; i < max; i++) - { - mcir.controller = i; - - if((ioctl(isdnfd, I4B_CTRL_INFO_REQ, &mcir)) < 0) - { - llog(LL_ERR, "init_controller: ioctl I4B_CTRL_INFO_REQ failed: %s", strerror(errno)); - do_exit(1); - } - - if((ncontroller = max = mcir.ncontroller) == 0) - { - llog(LL_ERR, "init_controller: no ISDN controller found!"); - do_exit(1); - } - - if(mcir.ctrl_type == -1 || mcir.card_type == -1) - { - llog(LL_ERR, "init_controller: ctrl/card is invalid!"); - do_exit(1); - } - - /* init controller tab */ - - if((init_controller_state(i, mcir.ctrl_type, mcir.card_type, mcir.tei, mcir.nbch)) == ERROR) - { - llog(LL_ERR, "init_controller: init_controller_state for controller %d failed", i); - do_exit(1); - } - } - DBGL(DL_RCCF, (llog(LL_DBG, "init_controller: found %d ISDN controller(s)", max))); -} - -/*--------------------------------------------------------------------------* - * init controller state table entry - *--------------------------------------------------------------------------*/ -static int -init_controller_state(int controller, int ctrl_type, int card_type, int tei, - int nbch) -{ - int i; - - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "init_controller_state: invalid controller number [%d]!", controller); - return(ERROR); - } - - /* init controller tab */ - - switch (ctrl_type) { - case CTRL_PASSIVE: - if((card_type > CARD_TYPEP_UNK) && - (card_type <= CARD_TYPEP_MAX)) - { - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = card_type; - isdn_ctrl_tab[controller].state = CTRL_UP; - } - else - { - llog(LL_ERR, "init_controller_state: unknown card type %d", card_type); - return(ERROR); - } - break; - - case CTRL_DAIC: - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = card_type; - isdn_ctrl_tab[controller].state = CTRL_DOWN; - break; - - case CTRL_TINADD: - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = 0; - isdn_ctrl_tab[controller].state = CTRL_DOWN; - break; - - case CTRL_CAPI: - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = card_type; - isdn_ctrl_tab[controller].state = CTRL_UP; - break; - - case CTRL_CAPIMGR: - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = card_type; - isdn_ctrl_tab[controller].state = CTRL_UP; - break; - - default: - llog(LL_ERR, "init_controller_state: unknown controller type %d", ctrl_type); - return(ERROR); - } - - isdn_ctrl_tab[controller].nbch = nbch; - isdn_ctrl_tab[controller].freechans = nbch; - for (i = 0; i < nbch; i++) - isdn_ctrl_tab[controller].stateb[i] = CHAN_IDLE; - isdn_ctrl_tab[controller].tei = tei; - isdn_ctrl_tab[controller].l1stat = LAYER_IDLE; - isdn_ctrl_tab[controller].l2stat = LAYER_IDLE; - - llog(LL_DMN, "init_controller_state: controller %d is %s", - controller, - name_of_controller(isdn_ctrl_tab[controller].ctrl_type, - isdn_ctrl_tab[controller].card_type)); - - return(GOOD); -} - -/*--------------------------------------------------------------------------* - * init active or capi controller - *--------------------------------------------------------------------------*/ -void -init_active_controller(void) -{ - int ret; - int unit = 0; - int controller; - char cmdbuf[MAXPATHLEN+128]; - - for(controller = 0; controller < ncontroller; controller++) - { - if(isdn_ctrl_tab[controller].ctrl_type == CTRL_TINADD) - { - DBGL(DL_RCCF, (llog(LL_DBG, "init_active_controller, tina-dd %d: executing [%s %d]", unit, tinainitprog, unit))); - - snprintf(cmdbuf, sizeof(cmdbuf), "%s %d", tinainitprog, unit); - - if((ret = system(cmdbuf)) != 0) - { - llog(LL_ERR, "init_active_controller, tina-dd %d: %s returned %d!", unit, tinainitprog, ret); - do_exit(1); - } - } - - /* - * Generic microcode loading. If a controller has - * defined a microcode file, load it using the - * I4B_CTRL_DOWNLOAD ioctl. - */ - - if(isdn_ctrl_tab[controller].firmware != NULL) - { - int fd, ret; - struct isdn_dr_prot idp; - struct isdn_download_request idr; - - fd = open(isdn_ctrl_tab[controller].firmware, O_RDONLY); - if (fd < 0) { - llog(LL_ERR, "init_active_controller %d: open %s: %s!", - controller, isdn_ctrl_tab[controller].firmware, - strerror(errno)); - do_exit(1); - } - - idp.bytecount = lseek(fd, 0, SEEK_END); - idp.microcode = mmap(0, idp.bytecount, PROT_READ, - MAP_SHARED, fd, 0); - if (idp.microcode == MAP_FAILED) { - llog(LL_ERR, "init_active_controller %d: mmap %s: %s!", - controller, isdn_ctrl_tab[controller].firmware, - strerror(errno)); - do_exit(1); - } - - DBGL(DL_RCCF, (llog(LL_DBG, "init_active_controller %d: loading firmware from [%s]", controller, isdn_ctrl_tab[controller].firmware))); - - idr.controller = controller; - idr.numprotos = 1; - idr.protocols = &idp; - - ret = ioctl(isdnfd, I4B_CTRL_DOWNLOAD, &idr, sizeof(idr)); - if (ret) { - llog(LL_ERR, "init_active_controller %d: load %s: %s!", - controller, isdn_ctrl_tab[controller].firmware, - strerror(errno)); - do_exit(1); - } - - munmap(idp.microcode, idp.bytecount); - close(fd); - } - } -} - -/*--------------------------------------------------------------------------* - * init controller D-channel ISDN protocol - *--------------------------------------------------------------------------*/ -void -init_controller_protocol(void) -{ - int controller; - msg_prot_ind_t mpi; - - for(controller = 0; controller < ncontroller; controller++) - { - mpi.controller = controller; - mpi.protocol = isdn_ctrl_tab[controller].protocol; - - if((ioctl(isdnfd, I4B_PROT_IND, &mpi)) < 0) - { - llog(LL_ERR, "init_controller_protocol: ioctl I4B_PROT_IND failed: %s", strerror(errno)); - do_exit(1); - } - } -} - -/*--------------------------------------------------------------------------* - * set controller state to UP/DOWN - *--------------------------------------------------------------------------*/ -int -set_controller_state(int controller, int state) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "set_controller_state: invalid controller number [%d]!", controller); - return(ERROR); - } - - if(state == CTRL_UP) - { - isdn_ctrl_tab[controller].state = CTRL_UP; - DBGL(DL_CNST, (llog(LL_DBG, "set_controller_state: controller [%d] set UP!", controller))); - } - else if (state == CTRL_DOWN) - { - isdn_ctrl_tab[controller].state = CTRL_DOWN; - DBGL(DL_CNST, (llog(LL_DBG, "set_controller_state: controller [%d] set DOWN!", controller))); - } - else - { - llog(LL_ERR, "set_controller_state: invalid controller state [%d]!", state); - return(ERROR); - } - return(GOOD); -} - -/*--------------------------------------------------------------------------* - * get controller state - *--------------------------------------------------------------------------*/ -int -get_controller_state(int controller) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "set_controller_state: invalid controller number [%d]!", controller); - return(ERROR); - } - return(isdn_ctrl_tab[controller].state); -} - -/*--------------------------------------------------------------------------* - * decrement number of free channels for controller - *--------------------------------------------------------------------------*/ -int -decr_free_channels(int controller) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "decr_free_channels: invalid controller number [%d]!", controller); - return(ERROR); - } - if(isdn_ctrl_tab[controller].freechans > 0) - { - (isdn_ctrl_tab[controller].freechans)--; - DBGL(DL_CNST, (llog(LL_DBG, "decr_free_channels: ctrl %d, now %d chan free", controller, isdn_ctrl_tab[controller].freechans))); - return(GOOD); - } - else - { - llog(LL_ERR, "decr_free_channels: controller [%d] already 0 free chans!", controller); - return(ERROR); - } -} - -/*--------------------------------------------------------------------------* - * increment number of free channels for controller - *--------------------------------------------------------------------------*/ -int -incr_free_channels(int controller) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "incr_free_channels: invalid controller number [%d]!", controller); - return(ERROR); - } - if(isdn_ctrl_tab[controller].freechans < isdn_ctrl_tab[controller].nbch) - { - (isdn_ctrl_tab[controller].freechans)++; - DBGL(DL_CNST, (llog(LL_DBG, "incr_free_channels: ctrl %d, now %d chan free", controller, isdn_ctrl_tab[controller].freechans))); - return(GOOD); - } - else - { - llog(LL_ERR, "incr_free_channels: controller [%d] already %d free chans!", controller, isdn_ctrl_tab[controller].nbch); - return(ERROR); - } -} - -/*--------------------------------------------------------------------------* - * get number of free channels for controller - *--------------------------------------------------------------------------*/ -int -get_free_channels(int controller) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "get_free_channels: invalid controller number [%d]!", controller); - return(ERROR); - } - DBGL(DL_CNST, (llog(LL_DBG, "get_free_channels: ctrl %d, %d chan free", controller, isdn_ctrl_tab[controller].freechans))); - return(isdn_ctrl_tab[controller].freechans); -} - -/*--------------------------------------------------------------------------* - * set channel state to busy - *--------------------------------------------------------------------------*/ -int -set_channel_busy(int controller, int channel) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "set_channel_busy: invalid controller number [%d]!", controller); - return(ERROR); - } - - if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) - { - llog(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); - return(ERROR); - } - - if(isdn_ctrl_tab[controller].stateb[channel] == CHAN_RUN) - { - DBGL(DL_CNST, (llog(LL_DBG, "set_channel_busy: controller [%d] channel B%d already busy!", controller, channel+1))); - } - else - { - isdn_ctrl_tab[controller].stateb[channel] = CHAN_RUN; - DBGL(DL_CNST, (llog(LL_DBG, "set_channel_busy: controller [%d] channel B%d set to BUSY!", controller, channel+1))); - } - return(GOOD); -} - -/*--------------------------------------------------------------------------* - * set channel state to idle - *--------------------------------------------------------------------------*/ -int -set_channel_idle(int controller, int channel) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "set_channel_idle: invalid controller number [%d]!", controller); - return(ERROR); - } - - if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) - { - llog(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); - return(ERROR); - } - - if (isdn_ctrl_tab[controller].stateb[channel] == CHAN_IDLE) - { - DBGL(DL_CNST, (llog(LL_DBG, "set_channel_idle: controller [%d] channel B%d already idle!", controller, channel+1))); - } - else - { - isdn_ctrl_tab[controller].stateb[channel] = CHAN_IDLE; - DBGL(DL_CNST, (llog(LL_DBG, "set_channel_idle: controller [%d] channel B%d set to IDLE!", controller, channel+1))); - } - return(GOOD); -} - -/*--------------------------------------------------------------------------* - * return channel state - *--------------------------------------------------------------------------*/ -int -ret_channel_state(int controller, int channel) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "ret_channel_state: invalid controller number [%d]!", controller); - return(ERROR); - } - - if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) - { - llog(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); - return(ERROR); - } - - return(isdn_ctrl_tab[controller].stateb[channel]); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/curses.c b/usr.sbin/i4b/isdnd/curses.c deleted file mode 100644 index a086b23c129c..000000000000 --- a/usr.sbin/i4b/isdnd/curses.c +++ /dev/null @@ -1,891 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - curses fullscreen output - * ------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:05:36 2006] - * - *---------------------------------------------------------------------------*/ - -#ifdef USE_CURSES - -#include "isdnd.h" - -#define CHPOS(cfgp) (((cfgp)->isdncontrollerused*2) + (cfgp)->isdnchannelused) - -static void display_budget(void); -static void display_cards(void); -static void menuexit(WINDOW *menu_w); - -/*---------------------------------------------------------------------------* - * init curses fullscreen display - *---------------------------------------------------------------------------*/ -void -init_screen(void) -{ - char buffer[512]; - int uheight, lheight; - int i, j; - cfg_entry_t *p; - - initscr(); /* curses init */ - - if((COLS < 80) || (LINES < 24)) - { - llog(LL_ERR, "ERROR, minimal screensize must be 80x24, is %dx%d, terminating!",COLS, LINES); - do_exit(1); - } - - noecho(); - raw(); - - uheight = ncontroller * 2; /* cards * b-channels */ - lheight = LINES - uheight - 6 + 1; /* rest of display */ - - if((upper_w = newwin(uheight, COLS, UPPER_B, 0)) == NULL) - { - llog(LL_ERR, "ERROR, curses init upper window, terminating!"); - exit(1); - } - - if((mid_w = newwin(1, COLS, UPPER_B+uheight+1, 0)) == NULL) - { - llog(LL_ERR, "ERROR, curses init mid window, terminating!"); - exit(1); - } - - if((lower_w = newwin(lheight, COLS, UPPER_B+uheight+3, 0)) == NULL) - { - llog(LL_ERR, "ERROR, curses init lower window, LINES = %d, lheight = %d, uheight = %d, terminating!", LINES, lheight, uheight); - exit(1); - } - - scrollok(lower_w, 1); - - snprintf(buffer, sizeof(buffer), "----- isdn controller channel state ------------- isdnd %02d.%02d.%d [pid %d] -", VERSION, REL, STEP, (int)getpid()); - - while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1) - strcat(buffer, "-"); - - move(0, 0); - standout(); - addstr(buffer); - standend(); - - move(1, 0); - /* 01234567890123456789012345678901234567890123456789012345678901234567890123456789 */ - addstr("c tei b remote iface dir outbytes obps inbytes ibps units"); - - snprintf(buffer, sizeof(buffer), "----- isdn userland interface state ------------------------------------------"); - while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1) - strcat(buffer, "-"); - - move(uheight+2, 0); - standout(); - addstr(buffer); - standend(); - - snprintf(buffer, sizeof(buffer), "----- isdnd logfile display --------------------------------------------------"); - while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1) - strcat(buffer, "-"); - - move(uheight+4, 0); - standout(); - addstr(buffer); - standend(); - - refresh(); - - for(i=0, j=0; i <= ncontroller; i++, j+=2) - { - if(isdn_ctrl_tab[i].tei == -1) - mvwprintw(upper_w, j, H_CNTL, "%d --- 1 ", i); - else - mvwprintw(upper_w, j, H_CNTL, "%d %3d 1 ", i, isdn_ctrl_tab[i].tei); - mvwprintw(upper_w, j+1, H_CNTL, " L12 2 "); - } - wrefresh(upper_w); - - for(i=0, j=0; i < nentries; i++) /* walk thru all entries */ - { - p = &cfg_entry_tab[i]; /* get ptr to enry */ - - mvwprintw(mid_w, 0, j, "%s%d ", bdrivername(p->usrdevicename), p->usrdeviceunit); - - p->fs_position = j; - - j += ((strlen(bdrivername(p->usrdevicename)) + (p->usrdeviceunit > 9 ? 2 : 1) + 1)); - } - wrefresh(mid_w); - - wmove(lower_w, 0, 0); - wrefresh(lower_w); - - curses_ready = 1; -} - -/*---------------------------------------------------------------------------* - * curses menu for fullscreen command mode - *---------------------------------------------------------------------------*/ -void -do_menu(void) -{ - static char *menu[WMITEMS] = - { - "1 - (D)isplay refresh", - "2 - (H)angup (choose a channel)", - "3 - (R)eread config file", - "4 - (S)how card types", - "5 - (B)udget information", - "6 - (Q)uit the program", - }; - - WINDOW *menu_w; - int c; - int mpos; - fd_set set; - struct timeval timeout; - - /* create a new window in the lower screen area */ - - if((menu_w = newwin(WMENU_HGT, WMENU_LEN, WMENU_POSLN, WMENU_POSCO )) == NULL) - { - llog(LL_WRN, "ERROR, curses init menu window!"); - return; - } - - /* create a border around the window */ - - box(menu_w, '|', '-'); - - /* add a title */ - - wstandout(menu_w); - mvwaddstr(menu_w, 0, (WMENU_LEN / 2) - (strlen(WMENU_TITLE) / 2), WMENU_TITLE); - wstandend(menu_w); - - /* fill the window with the menu options */ - - for(mpos=0; mpos <= (WMITEMS-1); mpos++) - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - - /* highlight the first menu option */ - - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - - /* input loop */ - - for(;;) - { - wrefresh(menu_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT; - timeout.tv_usec = 0; - - /* if no char is available within timeout, exit menu*/ - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - goto mexit; - - c = wgetch(menu_w); - - switch(c) - { - case ' ': - case '\t': /* hilite next option */ - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - mpos++; - if(mpos >= WMITEMS) - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case ('0'+WBUDGET+1): /* display budget info */ - case 'B': - case 'b': - display_budget(); - goto mexit; - - case ('0'+WREFRESH+1): /* display refresh */ - case 'D': - case 'd': - wrefresh(curscr); - goto mexit; - - case ('0'+WQUIT+1): /* quit program */ - case 'Q': - case 'q': - menuexit(menu_w); - do_exit(0); - goto mexit; - - case ('0'+WHANGUP+1): /* hangup connection */ - case 'H': - case 'h': - display_chans(); - goto mexit; - - case ('0'+WREREAD+1): /* reread config file */ - case 'R': - case 'r': - rereadconfig(42); - goto mexit; - - case ('0'+WSHOW+1): /* reread config file */ - case 'S': - case 's': - display_cards(); - goto mexit; - - case '\n': - case '\r': /* exec highlighted option */ - switch(mpos) - { - case WREFRESH: - wrefresh(curscr); - break; - - case WQUIT: - menuexit(menu_w); - do_exit(0); - break; - - case WHANGUP: - display_chans(); - break; - - case WREREAD: - rereadconfig(42); - break; - - case WBUDGET: - display_budget(); - break; - - case WSHOW: - display_cards(); - break; - } - goto mexit; - break; - - default: - goto mexit; - break; - } - } - -mexit: - menuexit(menu_w); -} - -static void -menuexit(WINDOW *menu_w) -{ - int uheight = ncontroller * 2; /* cards * b-channels */ - char buffer[512]; - - /* delete the menu window */ - - delwin(menu_w); - - /* re-display the original lower window contents */ - - touchwin(mid_w); - wrefresh(mid_w); - - touchwin(lower_w); - wrefresh(lower_w); - - touchwin(upper_w); - wrefresh(upper_w); - - move(1, 0); - /* 01234567890123456789012345678901234567890123456789012345678901234567890123456789 */ - addstr("c tei b remote iface dir outbytes obps inbytes ibps units"); - - sprintf(buffer, "----- isdn userland interface state ------------------------------------------"); - while(strlen(buffer) < COLS) - strcat(buffer, "-"); - - move(uheight+2, 0); - standout(); - addstr(buffer); - standend(); - - sprintf(buffer, "----- isdnd logfile display --------------------------------------------------"); - while(strlen(buffer) < COLS) - strcat(buffer, "-"); - - move(uheight+4, 0); - standout(); - addstr(buffer); - standend(); - - refresh(); -} - -/*---------------------------------------------------------------------------* - * display the charge in units - *---------------------------------------------------------------------------*/ -void -display_charge(cfg_entry_t *cep) -{ - mvwprintw(upper_w, CHPOS(cep), H_UNITS, "%d", cep->charge); - wclrtoeol(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display the calculated charge in units - *---------------------------------------------------------------------------*/ -void -display_ccharge(cfg_entry_t *cep, int units) -{ - mvwprintw(upper_w, CHPOS(cep), H_UNITS, "(%d)", units); - wclrtoeol(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display accounting information - *---------------------------------------------------------------------------*/ -void -display_acct(cfg_entry_t *cep) -{ - mvwprintw(upper_w, CHPOS(cep), H_OUT, "%-10d", cep->outbytes); - mvwprintw(upper_w, CHPOS(cep), H_OUTBPS, "%-4d", cep->outbps); - mvwprintw(upper_w, CHPOS(cep), H_IN, "%-10d", cep->inbytes); - mvwprintw(upper_w, CHPOS(cep), H_INBPS, "%-4d", cep->inbps); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display connect information - *---------------------------------------------------------------------------*/ -void -display_connect(cfg_entry_t *cep) -{ - char buffer[256]; - - /* remote telephone number */ - - if(aliasing) - { - if(cep->direction == DIR_IN) - snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->real_phone_incoming.number)); - else - snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->remote_phone_dialout.number)); - } - else - { - if(cep->direction == DIR_IN) - snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->real_phone_incoming.number); - else - snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->remote_phone_dialout.number); - } - - buffer[H_IFN - H_TELN - 1] = '\0'; - - mvwprintw(upper_w, CHPOS(cep), H_TELN, "%s", buffer); - - /* interface */ - - mvwprintw(upper_w, CHPOS(cep), H_IFN, "%s%d ", - bdrivername(cep->usrdevicename), cep->usrdeviceunit); - - mvwprintw(upper_w, CHPOS(cep), H_IO, - cep->direction == DIR_OUT ? "out" : "in"); - - mvwprintw(upper_w, CHPOS(cep), H_OUT, "-"); - mvwprintw(upper_w, CHPOS(cep), H_OUTBPS, "-"); - mvwprintw(upper_w, CHPOS(cep), H_IN, "-"); - mvwprintw(upper_w, CHPOS(cep), H_INBPS, "-"); - - if(do_bell) - display_bell(); - - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * erase line at disconnect time - *---------------------------------------------------------------------------*/ -void -display_disconnect(cfg_entry_t *cep) -{ - wmove(upper_w, CHPOS(cep), - H_TELN); - wclrtoeol(upper_w); - wrefresh(upper_w); - - if(do_bell) - display_bell(); - -} - -/*---------------------------------------------------------------------------* - * display interface up/down information - *---------------------------------------------------------------------------*/ -void -display_updown(cfg_entry_t *cep, int updown) -{ - if(updown) - wstandend(mid_w); - else - wstandout(mid_w); - - mvwprintw(mid_w, 0, cep->fs_position, "%s%d ", - bdrivername(cep->usrdevicename), cep->usrdeviceunit); - - wstandend(mid_w); - wrefresh(mid_w); -} - -/*---------------------------------------------------------------------------* - * display interface up/down information - *---------------------------------------------------------------------------*/ -void -display_l12stat(int controller, int layer, int state) -{ - if(controller > ncontroller) - return; - if(!(layer == 1 || layer == 2)) - return; - - if(state) - wstandout(upper_w); - else - wstandend(upper_w); - - if(layer == 1) - { - mvwprintw(upper_w, (controller*2)+1, H_TEI+1, "1"); - if(!state) - mvwprintw(upper_w, (controller*2)+1, H_TEI+2, "2"); - } - else if(layer == 2) - { - mvwprintw(upper_w, (controller*2)+1, H_TEI+2, "2"); - if(state) - mvwprintw(upper_w, (controller*2)+1, H_TEI+1, "1"); - } - - wstandend(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display TEI - *---------------------------------------------------------------------------*/ -void -display_tei(int controller, int tei) -{ - if(controller > ncontroller) - return; - - if(tei == -1) - mvwprintw(upper_w, controller*2, H_TEI, "---"); - else - mvwprintw(upper_w, controller*2, H_TEI, "%3d", tei); - - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display bell :-) - *---------------------------------------------------------------------------*/ -void -display_bell(void) -{ - static char bell[1] = { 0x07 }; - write(STDOUT_FILENO, &bell[0], 1); -} - -/*---------------------------------------------------------------------------* - * display channel information for shutdown - *---------------------------------------------------------------------------*/ -void -display_chans(void) -{ - char buffer[80]; - int i; - int cnt = 0; - WINDOW *chan_w; - int nlines, ncols, pos_x, pos_y; - fd_set set; - struct timeval timeout; - cfg_entry_t *cep = NULL; - - /* need this later to close the connection */ - struct ctlr_chan { - int cntl; - int chn; - } *cc = NULL; - - for (i = 0; i < ncontroller; i++) - { - if((get_controller_state(i)) != CTRL_UP) - continue; - if((ret_channel_state(i, CHAN_B1)) == CHAN_RUN) - cnt++; - if((ret_channel_state(i, CHAN_B2)) == CHAN_RUN) - cnt++; - } - - if(cnt > 0) - { - if ((cc = (struct ctlr_chan *)malloc (cnt * - sizeof (struct ctlr_chan))) == NULL) - { - return; - } - nlines = cnt + 4; - ncols = 60; - } - else - { - nlines = 5; - ncols = 22; - } - - pos_y = WMENU_POSLN + 4; - pos_x = WMENU_POSCO + 10; - - /* create a new window in the lower screen area */ - - if((chan_w = newwin(nlines, ncols, pos_y, pos_x )) == NULL) - { - llog(LL_WRN, "ERROR, curses init channel window!"); - if (cnt > 0) - free(cc); - return; - } - - /* create a border around the window */ - - box(chan_w, '|', '-'); - - /* add a title */ - - wstandout(chan_w); - mvwaddstr(chan_w, 0, (ncols / 2) - (strlen("Channels") / 2), "Channels"); - wstandend(chan_w); - - /* no active channels */ - if (cnt == 0) - { - mvwaddstr(chan_w, 2, 2, "No active channels"); - wrefresh(chan_w); - sleep(1); - - /* delete the channels window */ - - delwin(chan_w); - return; - } - - nlines = 2; - ncols = 1; - - for (i = 0; i < ncontroller; i++) - { - if((get_controller_state(i)) != CTRL_UP) - continue; - - if((ret_channel_state(i, CHAN_B1)) == CHAN_RUN) - { - snprintf(buffer, sizeof(buffer), "%d - Controller %d channel %s", ncols, i, "B1"); - mvwaddstr(chan_w, nlines, 2, buffer); - cc[ncols - 1].cntl = i; - cc[ncols - 1].chn = CHAN_B1; - nlines++; - ncols++; - } - if((ret_channel_state(i, CHAN_B2)) == CHAN_RUN) - { - snprintf(buffer, sizeof(buffer), "%d - Controller %d channel %s", ncols, i, "B2"); - mvwaddstr(chan_w, nlines, 2, buffer); - cc[ncols - 1].cntl = i; - cc[ncols - 1].chn = CHAN_B2; - nlines++; - ncols++; - } - } - - for(;;) - { - wrefresh(chan_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT; - timeout.tv_usec = 0; - - /* if no char is available within timeout, exit menu*/ - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - break; - - ncols = wgetch(chan_w); - - if (!(isdigit(ncols))) - { - display_bell(); - continue; - } - - nlines = ncols - '0'; - - if ((nlines == 0) || (nlines > cnt)) - { - display_bell(); - continue; - } - - if((cep = get_cep_by_cc(cc[nlines-1].cntl, cc[nlines-1].chn)) - != NULL) - { - llog(LL_CHD, "%05d %s manual disconnect (fullscreen menu)", cep->cdid, cep->name); - cep->hangup = 1; - break; - } - } - - free(cc); - - /* delete the channels window */ - - delwin(chan_w); -} - -/*---------------------------------------------------------------------------* - * display card type information - *---------------------------------------------------------------------------*/ -static void -display_cards(void) -{ - WINDOW *chan_w; - int nlines, ncols, pos_x, pos_y; - fd_set set; - struct timeval timeout; - int i; - - nlines = 6+ncontroller; - ncols = 60; - pos_y = WMENU_POSLN; - pos_x = WMENU_POSCO; - - /* create a new window in the lower screen area */ - - if((chan_w = newwin(nlines, ncols, pos_y, pos_x )) == NULL) - { - llog(LL_WRN, "ERROR, curses init channel window!"); - return; - } - - /* create a border around the window */ - - box(chan_w, '|', '-'); - - /* add a title */ - - wstandout(chan_w); - mvwaddstr(chan_w, 0, (ncols / 2) - (strlen("Cards") / 2), "Cards"); - wstandend(chan_w); - - mvwprintw(chan_w, 2, 2, "ctrl description"); - mvwprintw(chan_w, 3, 2, "---- ----------------------------------------------"); - for (i = 0; i < ncontroller; i++) - { - mvwprintw(chan_w, 4+i, 2, " #%d %s", i, - name_of_controller(isdn_ctrl_tab[i].ctrl_type, - isdn_ctrl_tab[i].card_type)); - } - - wrefresh(chan_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT*2; - timeout.tv_usec = 0; - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - { - delwin(chan_w); - return; - } - - wgetch(chan_w); - delwin(chan_w); -} - -/*---------------------------------------------------------------------------* - * display budget info - *---------------------------------------------------------------------------*/ -static void -display_budget(void) -{ - WINDOW *bud_w; - int nlines, ncols, pos_x, pos_y; - fd_set set; - struct timeval timeout; - int i, j; - cfg_entry_t *cep; - time_t now; - double uptime; - int minutes; - int hours; - int days; - - nlines = 0; - ncols = 73; - pos_y = WMENU_POSLN; - pos_x = WMENU_POSCO-3; - - for(i=0, j=0; i < nentries; i++) /* walk thru all entries */ - { - cep = &cfg_entry_tab[i]; /* get ptr to entry */ - - if(cep->budget_callbackperiod && cep->budget_callbackncalls) - nlines++; - if(cep->budget_calloutperiod && cep->budget_calloutncalls) - nlines++; - } - - if(nlines == 0) - return; - - nlines += 6; - - /* create a new window in the lower screen area */ - - if((bud_w = newwin(nlines, ncols, pos_y, pos_x )) == NULL) - { - llog(LL_WRN, "ERROR, curses init budget window!"); - return; - } - - now = time(NULL); - uptime = difftime(now, starttime); - - minutes = (time_t) (uptime / 60) % 60; - hours = (time_t) (uptime / (60*60)) % (60*60); - days = (time_t) (uptime / (60*60*24)) % (60*60*24); - - uptime = uptime / (60*60); - - /* create a border around the window */ - - box(bud_w, '|', '-'); - - /* add a title */ - - wstandout(bud_w); - mvwaddstr(bud_w, 0, (ncols / 2) - (strlen("Budget") / 2), "Budget"); - wstandend(bud_w); - - mvwprintw(bud_w, 1, 2, "isdnd uptime: %d %s - %d %s - %d %s", - days, - days == 1 ? "day" : "days", - hours, - hours == 1 ? "hour" : "hours", - minutes, - minutes == 1 ? "minute" : "minutes"); - - mvwprintw(bud_w, 2, 2, "name t period rest ncall rest rqsts /hr rdone /hr rrjct /hr "); - mvwprintw(bud_w, 3, 2, "-------- - ------ ------ ----- ----- ----- ---- ----- ---- ----- ----"); - - for(i=0, j=4; i < nentries; i++) /* walk thru all entries */ - { - cep = &cfg_entry_tab[i]; /* get ptr to enry */ - - if(cep->budget_calloutperiod && cep->budget_calloutncalls) - { - mvwprintw(bud_w, j, 2, "%-8s %c %-6d %-6ld %-5d %-5d %-5d %-4.1f %-5d %-4.1f %-5d %-4.1f", - cep->name, - 'o', - cep->budget_calloutperiod, - (long)(cep->budget_calloutperiod_time - now), - cep->budget_calloutncalls, - cep->budget_calloutncalls_cnt, - cep->budget_callout_req, - (double)cep->budget_callout_req / uptime, - cep->budget_callout_done, - (double)cep->budget_callout_done / uptime, - cep->budget_callout_rej, - (double)cep->budget_callout_rej / uptime); - j++; - } - if(cep->budget_callbackperiod && cep->budget_callbackncalls) - { - mvwprintw(bud_w, j, 2, "%-8s %c %-6d %-6ld %-5d %-5d %-5d %-4.1f %-5d %-4.1f %-5d %-4.1f", - (cep->budget_calloutperiod && cep->budget_calloutncalls) ? "" : cep->name, - 'b', - cep->budget_callbackperiod, - (long)(cep->budget_callbackperiod_time - now), - cep->budget_callbackncalls, - cep->budget_callbackncalls_cnt, - cep->budget_callback_req, - (double)cep->budget_callback_req / uptime, - cep->budget_callback_done, - (double)cep->budget_callback_done / uptime, - cep->budget_callback_rej, - (double)cep->budget_callback_rej / uptime); - j++; - } - } - - wrefresh(bud_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT*3; - timeout.tv_usec = 0; - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - { - delwin(bud_w); - return; - } - - wgetch(bud_w); - delwin(bud_w); -} - -#endif - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/dial.c b/usr.sbin/i4b/isdnd/dial.c deleted file mode 100644 index 158e1c0ed087..000000000000 --- a/usr.sbin/i4b/isdnd/dial.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - dial handling routines - * ----------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:05:52 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -/*---------------------------------------------------------------------------* - * select the first remote number to dial according to the - * dial strategy - *---------------------------------------------------------------------------*/ -void -select_first_dialno(cfg_entry_t *cep) -{ - int i, j; - - if(cep->keypad[0] != '\0') - return; - - if(cep->remote_numbers_count < 1) - { - llog(LL_ERR, "select_first_dialno: remote_numbers_count < 1!"); - return; - } - - if(cep->remote_numbers_count == 1) - { - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: only one no, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = 0; - return; - } - - if(cep->remote_numbers_handling == RNH_FIRST) - { - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: use first, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = 0; - return; - } - - i = cep->last_remote_number; - - for(j = cep->remote_numbers_count; j > 0; j--) - { - if(cep->remote_numbers[i].flag == RNF_SUCC) - { - if(cep->remote_numbers_handling == RNH_LAST) - { - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[i].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[i].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: use last, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = i; - return; - } - else - { - if(++i >= cep->remote_numbers_count) - i = 0; - - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[i].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[i].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: use next, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = i; - return; - } - } - - if(++i >= cep->remote_numbers_count) - i = 0; - } - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: no last found (use 0), no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = 0; -} - -/*---------------------------------------------------------------------------* - * select next remote number to dial (last was unsuccesfull) - *---------------------------------------------------------------------------*/ -void -select_next_dialno(cfg_entry_t *cep) -{ - if(cep->remote_numbers_count < 1) - { - llog(LL_ERR, "select_next_dialno: remote_numbers_count < 1!"); - return; - } - - if(cep->remote_numbers_count == 1) - { - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_next_dialno: only one no, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = 0; - return; - } - - /* mark last try as bad */ - - cep->remote_numbers[cep->last_remote_number].flag = RNF_IDLE; - - /* next one to try */ - - cep->last_remote_number++; - - if(cep->last_remote_number >= cep->remote_numbers_count) - cep->last_remote_number = 0; - - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[cep->last_remote_number].number); - - DBGL(DL_DIAL, (llog(LL_DBG, "select_next_dialno: index=%d, no=%s", - cep->last_remote_number, - cep->remote_numbers[cep->last_remote_number].number))); -} - -/*---------------------------------------------------------------------------* - * dial succeded, store this number as the last successful - *---------------------------------------------------------------------------*/ -void -select_this_dialno(cfg_entry_t *cep) -{ - cep->remote_numbers[cep->last_remote_number].flag = RNF_SUCC; - - DBGL(DL_DIAL, (llog(LL_DBG, "select_this_dialno: index = %d, no = %s", - cep->last_remote_number, - cep->remote_numbers[cep->last_remote_number].number))); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/exec.c b/usr.sbin/i4b/isdnd/exec.c deleted file mode 100644 index 2f24384eb370..000000000000 --- a/usr.sbin/i4b/isdnd/exec.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * exec.h - supplemental program/script execution - * ---------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 16:55:23 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -#include -#include -#include -#include -#include -#include - -#define MAX_PIDS 32 - -static struct pid_tab { - pid_t pid; - cfg_entry_t *cep; -} pid_tab[MAX_PIDS]; - -/*---------------------------------------------------------------------------* - * SIGCHLD signal handler - *---------------------------------------------------------------------------*/ -void -sigchild_handler(int sig) -{ - int retstat; - register int i; - pid_t pid; - - if((pid = waitpid(-1, &retstat, WNOHANG)) <= 0) - { - llog(LL_ERR, "ERROR, sigchild_handler, waitpid: %s", strerror(errno)); - error_exit(1, "ERROR, sigchild_handler, waitpid: %s", strerror(errno)); - } - else - { - if(WIFEXITED(retstat)) - { - DBGL(DL_PROC, (llog(LL_DBG, "normal child (pid=%d) termination, exitstat = %d", - pid, WEXITSTATUS(retstat)))); - } - else if(WIFSIGNALED(retstat)) - { - if(WCOREDUMP(retstat)) - llog(LL_WRN, "child (pid=%d) termination due to signal %d (coredump)", - pid, WTERMSIG(retstat)); - else - llog(LL_WRN, "child (pid=%d) termination due to signal %d", - pid, WTERMSIG(retstat)); - } - } - - /* check if hangup required */ - - for(i=0; i < MAX_PIDS; i++) - { - if(pid_tab[i].pid == pid) - { - if(pid_tab[i].cep->cdid != CDID_UNUSED) - { - DBGL(DL_PROC, (llog(LL_DBG, "sigchild_handler: scheduling hangup for cdid %d, pid %d", - pid_tab[i].cep->cdid, pid_tab[i].pid))); - pid_tab[i].cep->hangup = 1; - } - pid_tab[i].pid = 0; - break; - } - } -} - -/*---------------------------------------------------------------------------* - * execute prog as a subprocess and pass an argumentlist - *---------------------------------------------------------------------------*/ -pid_t -exec_prog(char *prog, char **arglist) -{ - char tmp[MAXPATHLEN]; - char path[MAXPATHLEN]; - pid_t pid; - int a; - - snprintf(path, sizeof(path), "%s/%s", ETCPATH, prog); - - arglist[0] = path; - - tmp[0] = '\0'; - - for(a=1; arglist[a] != NULL; ++a ) - { - strcat(tmp, " " ); - strcat(tmp, arglist[a]); - } - - DBGL(DL_PROC, (llog(LL_DBG, "exec_prog: %s, args:%s", path, tmp))); - - switch(pid = fork()) - { - case -1: /* error */ - llog(LL_ERR, "ERROR, exec_prog/fork: %s", strerror(errno)); - error_exit(1, "ERROR, exec_prog/fork: %s", strerror(errno)); - case 0: /* child */ - break; - default: /* parent */ - return(pid); - } - - /* this is the child now */ - - /* - * close files used only by isdnd, e.g. - * 1. /dev/i4b - * 2. /var/log/isdnd.acct (or similar, when used) - * 3. /var/log/isdnd.log (or similar, when used) - */ - close(isdnfd); - - if(useacctfile && acctfp) - fclose(acctfp); - - if(uselogfile && logfp) - fclose(logfp); - - if(execvp(path,arglist) < 0 ) - _exit(127); - - return(-1); -} - -/*---------------------------------------------------------------------------* - * run interface up/down script - *---------------------------------------------------------------------------*/ -int -exec_connect_prog(cfg_entry_t *cep, const char *prog, int link_down) -{ - char *argv[32], **av = argv; - char devicename[MAXPATHLEN], addr[100]; - char *device; - int s; - struct ifreq ifr; - - /* the obvious things */ - device = bdrivername(cep->usrdevicename); - snprintf(devicename, sizeof(devicename), "%s%d", device, cep->usrdeviceunit); - *av++ = (char*)prog; - *av++ = "-d"; - *av++ = devicename; - *av++ = "-f"; - *av++ = link_down ? "down" : "up"; - - /* try to figure AF_INET address of interface */ - addr[0] = '\0'; - memset(&ifr, 0, sizeof ifr); - ifr.ifr_addr.sa_family = AF_INET; - strncpy(ifr.ifr_name, devicename, sizeof(ifr.ifr_name)); - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s >= 0) { - if (ioctl(s, SIOCGIFADDR, (caddr_t)&ifr) >= 0) { - struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; - strcpy(addr, inet_ntoa(sin->sin_addr)); - *av++ = "-a"; - *av++ = addr; - } - close(s); - } - - /* terminate argv */ - *av++ = NULL; - - return exec_prog((char*)prog, argv); -} - -/*---------------------------------------------------------------------------* - * run answeringmachine application - *---------------------------------------------------------------------------*/ -int -exec_answer(cfg_entry_t *cep) -{ - char *argv[32]; - u_char devicename[MAXPATHLEN]; - int pid; - char *device; - - device = bdrivername(cep->usrdevicename); - - snprintf(devicename, sizeof(devicename), "%si4b%s%d", _PATH_DEV, device, - cep->usrdeviceunit); - - argv[0] = cep->answerprog; - argv[1] = "-D"; - argv[2] = devicename; - argv[3] = "-d"; - argv[4] = "unknown"; - argv[5] = "-s"; - argv[6] = "unknown"; - argv[7] = NULL; - - /* if destination telephone number avail, add it as argument */ - - if(*cep->local_phone_incoming.number) - argv[4] = cep->local_phone_incoming.number; - - /* if source telephone number avail, add it as argument */ - - if(*cep->real_phone_incoming.number) - argv[6] = cep->real_phone_incoming.number; - - if(*cep->display) - { - argv[7] = "-t"; - argv[8] = cep->display; - argv[9] = NULL; - } - - /* exec program */ - - DBGL(DL_PROC, (llog(LL_DBG, "exec_answer: prog=[%s]", cep->answerprog))); - - pid = exec_prog(cep->answerprog, argv); - - /* enter pid and conf ptr entry addr into table */ - - if(pid != -1) - { - int i; - - for(i=0; i < MAX_PIDS; i++) - { - if(pid_tab[i].pid == 0) - { - pid_tab[i].pid = pid; - pid_tab[i].cep = cep; - break; - } - } - return(GOOD); - } - return(ERROR); -} - -/*---------------------------------------------------------------------------* - * check if a connection has an outstanding process, if yes, kill it - *---------------------------------------------------------------------------*/ -void -check_and_kill(cfg_entry_t *cep) -{ - int i; - - for(i=0; i < MAX_PIDS; i++) - { - if(pid_tab[i].cep == cep) - { - pid_t kp; - - DBGL(DL_PROC, (llog(LL_DBG, "check_and_kill: killing pid %d", pid_tab[i].pid))); - - kp = pid_tab[i].pid; - pid_tab[i].pid = 0; - kill(kp, SIGHUP); - break; - } - } -} - -/*---------------------------------------------------------------------------* - * update budget callout/callback statistics counter file - *---------------------------------------------------------------------------*/ -void -upd_callstat_file(char *filename, int rotateflag) -{ - FILE *fp; - time_t s, l, now; - int n; - int ret; - - now = time(NULL); - - fp = fopen(filename, "r+"); - - if(fp == NULL) - { - /* file not there, create it and exit */ - - llog(LL_WRN, "upd_callstat_file: creating %s", filename); - - fp = fopen(filename, "w"); - if(fp == NULL) - { - llog(LL_ERR, "ERROR, upd_callstat_file: cannot create %s, %s", filename, strerror(errno)); - return; - } - - ret = fprintf(fp, "%d %d 1", now, now); - if(ret <= 0) - llog(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno)); - - fclose(fp); - return; - } - - /* get contents */ - - ret = fscanf(fp, "%d %d %d", &s, &l, &n); - - /* reset fp */ - - rewind(fp); - - if(ret != 3) - { - /* file corrupt ? anyway, initialize */ - - llog(LL_WRN, "upd_callstat_file: initializing %s", filename); - - s = l = now; - n = 0; - } - - if(rotateflag) - { - struct tm *stmp; - int dom; - - /* get day of month for last timestamp */ - stmp = localtime(&l); - dom = stmp->tm_mday; - - /* get day of month for just now */ - stmp = localtime(&now); - - if(dom != stmp->tm_mday) - { - FILE *nfp; - char buf[MAXPATHLEN]; - - /* new day, write last days stats */ - - sprintf(buf, "%s-%02d", filename, stmp->tm_mday); - - nfp = fopen(buf, "w"); - if(nfp == NULL) - { - llog(LL_ERR, "ERROR, upd_callstat_file: cannot open for write %s, %s", buf, strerror(errno)); - return; - } - - ret = fprintf(nfp, "%d %d %d", s, l, n); - if(ret <= 0) - llog(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno)); - - fclose(nfp); - - /* init new days stats */ - n = 0; - s = now; - - llog(LL_WRN, "upd_callstat_file: rotate %s, new s=%ld l=%ld n=%d", filename, s, l, n); - } - } - - n++; /* increment call count */ - - /* - * the "%-3d" is necessary to overwrite any - * leftovers from previous contents! - */ - - ret = fprintf(fp, "%d %d %-3d", s, now, n); - - if(ret <= 0) - llog(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno)); - - fclose(fp); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/fsm.c b/usr.sbin/i4b/isdnd/fsm.c deleted file mode 100644 index b87b17e1c113..000000000000 --- a/usr.sbin/i4b/isdnd/fsm.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * FSM for isdnd - * ------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:06:40 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -/* table of state descriptions */ - -static char *state_text[N_STATES] = { - "idle", - "dialing", - "waitdialretry", - "dialretry", - - "pcb-dialing", - "pcb-dialfail", - "pcb-waitcall", - - "acb-waitdisc", - "acb-waitdial", - "acb-dialing", - "acb-dialfail", - - "accepted", - "connected", - "waitdisconnect", - "down", - "alert", - - "Illegal State" -}; - -/* table of event descriptions */ - -static char *event_text[N_EVENTS] = { - - /* incoming messages */ - - "msg-con-ind", - "msg-con-act-ind", - "msg-disc-ind", - "msg-dialout", - - /* local events */ - - "timeout", - "disconnect-req", - "callback-req", - "alert-req", - - /* illegal */ - - "Illegal Event" -}; - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_ill: Illegal State reached !!!"))); -} - -/*---------------------------------------------------------------------------* - * No change, No action - *---------------------------------------------------------------------------*/ -static void -F_NcNa(cfg_entry_t *cep) -{ -} - -/*---------------------------------------------------------------------------* - * incoming CONNECT, accepting call - *---------------------------------------------------------------------------*/ -static void -F_MCI(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_MCI: tx SETUP_RESP_ACCEPT"))); - sendm_connect_resp(cep, cep->cdid, SETUP_RESP_ACCEPT, 0); - start_timer(cep, TIMEOUT_CONNECT_ACTIVE); -} - -/*---------------------------------------------------------------------------* - * incoming connect active, call is now active - *---------------------------------------------------------------------------*/ -static void -F_MCAI(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_MCAI: Connection active!"))); - - stop_timer(cep); - - if((cep->dialin_reaction == REACT_ANSWER) && - (cep->b1protocol == BPROT_NONE)) - { - exec_answer(cep); - } -} - -/*---------------------------------------------------------------------------* - * timeout - *---------------------------------------------------------------------------*/ -static void -F_TIMO(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_TIMO: Timout occured!"))); - sendm_disconnect_req(cep, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - cep->cdid = CDID_UNUSED; -} - -/*---------------------------------------------------------------------------* - * incoming disconnect indication - *---------------------------------------------------------------------------*/ -static void -F_IDIS(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_IDIS: disconnect indication"))); - cep->cdid = CDID_UNUSED; -} - -/*---------------------------------------------------------------------------* - * local disconnect request - *---------------------------------------------------------------------------*/ -static void -F_DRQ(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_DRQ: local disconnect request"))); - sendm_disconnect_req(cep, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); -} - -/*---------------------------------------------------------------------------* - * disconnect indication after local disconnect req - *---------------------------------------------------------------------------*/ -static void -F_MDI(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_MDI: disconnect indication, local disconnected"))); - cep->cdid = CDID_UNUSED; -} - -/*---------------------------------------------------------------------------* - * local requested outgoing dial - *---------------------------------------------------------------------------*/ -static void -F_DIAL(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_DIAL: local dial out request"))); - - if(cep->dialrandincr) - cep->randomtime = (random() & RANDOM_MASK) + cep->recoverytime; - - cep->dial_count = 0; - - select_first_dialno(cep); - - sendm_connect_req(cep); -} - -/*---------------------------------------------------------------------------* - * outgoing dial successfull - *---------------------------------------------------------------------------*/ -static void -F_DOK(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_DOK: dial out ok"))); - select_this_dialno(cep); -} - -/*---------------------------------------------------------------------------* - * outgoing dial fail (ST_SUSE !!!) - *---------------------------------------------------------------------------*/ -static void -F_DFL(cfg_entry_t *cep) -{ - cep->last_release_time = time(NULL); - - if(cep->dialouttype == DIALOUT_NORMAL) - { - cep->dial_count++; - - if(cep->dial_count < cep->dialretries || cep->dialretries == -1) - { - /* inside normal retry cycle */ - - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: dial fail, dial retry"))); - select_next_dialno(cep); - cep->cdid = CDID_RESERVED; - cep->state = ST_DIALRTMRCHD; - return; - } - - /* retries exhausted */ - - if(!cep->usedown) - { - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: dial retry fail, dial retries exhausted"))); - dialresponse(cep, DSTAT_TFAIL); - cep->cdid = CDID_UNUSED; - cep->dial_count = 0; - cep->state = ST_IDLE; - return; - } - - /* interface up/down active */ - - cep->down_retry_count++; - - if(cep->down_retry_count > cep->downtries) - { - /* set interface down */ - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: dial retry cycle fail, setting interface down!"))); - dialresponse(cep, DSTAT_PFAIL); - if_down(cep); - cep->state = ST_DOWN; - } - else - { - /* enter new dial retry cycle */ - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: dial retry cycle fail, enter new retry cycle!"))); - select_next_dialno(cep); - cep->state = ST_DIALRTMRCHD; - } - - cep->dial_count = 0; - cep->cdid = CDID_RESERVED; - } - else /* cdp->dialouttype == DIALOUT_CALLEDBACK */ - { - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: calledback dial done, wait for incoming call"))); - cep->cdid = CDID_RESERVED; - cep->state = ST_PCB_WAITCALL; - } -} - -/*---------------------------------------------------------------------------* - * local requested outgoing dial - *---------------------------------------------------------------------------*/ -static void -F_ACBW(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBW: local callback, wait callback recovery time"))); - - if(cep->dialrandincr) - cep->randomtime = (random() & RANDOM_MASK) + cep->recoverytime; - - cep->dial_count = 0; - - cep->cdid = CDID_RESERVED; -} - -/*---------------------------------------------------------------------------* - * active callback dialout retry (ST_SUSE !!!) - *---------------------------------------------------------------------------*/ -static void -F_ACBR(cfg_entry_t *cep) -{ - cep->dial_count++; - - if(cep->dial_count < cep->dialretries || cep->dialretries == -1) - { - /* inside normal retry cycle */ - - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBR: dial fail, dial retry"))); - select_next_dialno(cep); - cep->cdid = CDID_RESERVED; - cep->state = ST_ACB_DIALFAIL; - return; - } - - /* retries exhausted */ - - if(!cep->usedown) - { - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBR: dial retry fail, dial retries exhausted"))); - dialresponse(cep, DSTAT_TFAIL); - cep->cdid = CDID_UNUSED; - cep->dial_count = 0; - cep->state = ST_IDLE; - return; - } - - /* interface up/down active */ - - cep->down_retry_count++; - - if(cep->down_retry_count > cep->downtries) - { - /* set interface down */ - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBR: dial retry cycle fail, setting interface down!"))); - dialresponse(cep, DSTAT_PFAIL); - if_down(cep); - cep->state = ST_DOWN; - } - else - { - /* enter new dial retry cycle */ - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBR: dial retry cycle fail, enter new retry cycle!"))); - select_next_dialno(cep); - cep->state = ST_ACB_DIALFAIL; - } - - cep->dial_count = 0; - cep->cdid = CDID_RESERVED; -} - -/*---------------------------------------------------------------------------* - * local requested to send ALERT message - *---------------------------------------------------------------------------*/ -static void -F_ALRT(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_ALRT: local send alert request"))); - - cep->alert_time = cep->alert; - - sendm_alert_req(cep); -} - -/*---------------------------------------------------------------------------* - * isdn daemon state transition table - *---------------------------------------------------------------------------*/ -struct state_tab { - void(*func)(cfg_entry_t *cep); /* function to execute */ - int newstate; /* next state */ -} state_tab[N_EVENTS][N_STATES] = { - -/* STATE: ST_IDLE ST_DIAL ST_DIALRTMRCHD ST_DIALRETRY ST_PCB_DIAL ST_PCB_DIALFAIL ST_PCB_WAITCALL ST_ACB_WAITDISC ST_ACB_WAITDIAL ST_ACB_DIAL ST_ACB_DIALFAIL ST_ACCEPTED ST_CONNECTED ST_WAITDISCI ST_DOWN ST_ALERT ST_ILLEGAL */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* messages */ -/* EV_MCI */{{F_MCI, ST_ACCEPTED}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_MCI, ST_ACCEPTED}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_MCI, ST_ACCEPTED}, {F_ill, ST_ILL}}, -/* EV_MCAI */{{F_ill, ST_ILL}, {F_DOK, ST_CONNECTED}, {F_ill, ST_ILL}, {F_DOK, ST_CONNECTED}, {F_DOK, ST_CONNECTED}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_DOK, ST_CONNECTED}, {F_ill, ST_ILL}, {F_MCAI,ST_CONNECTED}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_MDI */{{F_ill, ST_ILL}, {F_DFL, ST_SUSE}, {F_ill, ST_ILL}, {F_DFL, ST_SUSE}, {F_DFL, ST_SUSE}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ACBW,ST_ACB_WAITDIAL},{F_ill, ST_ILL}, {F_ACBR, ST_SUSE}, {F_ACBR,ST_SUSE}, {F_IDIS,ST_IDLE}, {F_IDIS,ST_IDLE}, {F_MDI, ST_IDLE}, {F_ill, ST_ILL}, {F_MDI, ST_IDLE}, {F_ill, ST_ILL}}, -/* EV_MDO */{{F_DIAL,ST_DIAL}, {F_NcNa,ST_DIAL}, {F_NcNa,ST_DIALRTMRCHD},{F_NcNa,ST_DIALRETRY}, {F_NcNa,ST_PCB_DIAL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, - -/* local requests */ -/* EV_TIMO */{{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_TIMO,ST_IDLE}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_DRQ */{{F_NcNa, ST_IDLE}, {F_DRQ, ST_WAITDISCI}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_DRQ, ST_WAITDISCI}, {F_NcNa,ST_WAITDISCI}, {F_NcNa, ST_DOWN}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_CBRQ */{{F_NcNa,ST_ACB_WAITDIAL},{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_NcNa,ST_ACB_WAITDIAL},{F_NcNa, ST_ACB_DIAL}, {F_NcNa,ST_ACB_DIALFAIL},{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_ALRT */{{F_ALRT,ST_ALERT}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, - -/* illegal */ - -/* EV_ILL */{{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -next_state(cfg_entry_t *cep, int event) -{ - int currstate, newstate; - - if(event > N_EVENTS) - { - llog(LL_ERR, "next_state: event > N_EVENTS"); - error_exit(1, "next_state: event > N_EVENTS"); - } - - currstate = cep->state; - - if(currstate > N_STATES) - { - llog(LL_ERR, "next_state: currstate > N_STATES"); - error_exit(1, "next_state: currstate > N_STATES"); - } - - newstate = state_tab[event][currstate].newstate; - - if(newstate > N_STATES) - { - llog(LL_ERR, "next_state: newstate > N_STATES"); - error_exit(1, "next_state: newstate > N_STATES"); - } - - if(newstate != ST_SUSE) - { - DBGL(DL_STATE, (llog(LL_DBG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]))); - } - - (*state_tab[event][currstate].func)(cep); - - if(newstate == ST_ILL) - { - llog(LL_ERR, "FSM ILLEGAL STATE, event=%s: oldstate=%s => newstate=%s]", - event_text[event], - state_text[currstate], - state_text[newstate]); - } - - if(newstate == ST_SUSE) - { - DBGL(DL_STATE, (llog(LL_DBG, "FSM (SUSE) event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[cep->state]))); - } - else - { - cep->state = newstate; - } -} - -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -printstate(cfg_entry_t *cep) -{ - return((char *) state_text[cep->state]); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/holiday.c b/usr.sbin/i4b/isdnd/holiday.c deleted file mode 100644 index 714bd066ba34..000000000000 --- a/usr.sbin/i4b/isdnd/holiday.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnd - holiday file handling - * ============================= - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:06:56 2006] - * - * Format: - * - * day.month.year optional comment (different day every year) or - * day.month optional comment (same day every year) - * - * i.e.: - * - * 23.4.2000 Ostersonntag - * 3.10 Tag der deutschen Einheit - * - *----------------------------------------------------------------------------*/ - -#include "isdnd.h" - -struct holiday { - int day; - int month; - int year; - struct holiday *next; -}; - -static struct holiday *firsth = NULL; - -#define MAXBUFSZ 256 - -static void free_holiday(struct holiday *ptr); - -/*---------------------------------------------------------------------------* - * read in and init holidayes - *---------------------------------------------------------------------------*/ -void -init_holidays(char *filename) -{ - FILE *fp; - unsigned char buffer[MAXBUFSZ + 1]; - struct holiday *newh = NULL; - struct holiday *lasth = NULL; - int ret; - int day, month, year; - - firsth = NULL; - - if((fp = fopen(filename, "r")) == NULL) - { - DBGL(DL_VALID, (llog(LL_DBG, "init_holiday: error opening holidayfile %s: %s!", filename, strerror(errno)))); - return; - } - - while((fgets(buffer, MAXBUFSZ, fp)) != NULL) - { - if(buffer[0] == '#' || buffer[0] == ' ' || - buffer[0] == '\t' || buffer[0] == '\n') - { - continue; - } - - ret = sscanf(buffer, "%d.%d.%d", &day, &month, &year); - - if(ret != 3) - { - ret = sscanf(buffer, "%d.%d", &day, &month); - if(ret != 2) - { - llog(LL_ERR, "init_holiday: parse error for string [%s]!", buffer); - exit(1); - } - year = 0; - } - - if((newh = (struct holiday *) malloc(sizeof(struct holiday))) == NULL) - { - llog(LL_ERR, "init_holiday: malloc failed for struct holiday!\n"); - exit(1); - } - - if(year) - { - DBGL(DL_VALID, (llog(LL_DBG, "init_holidays: add %d.%d.%d", day, month, year))); - } - else - { - DBGL(DL_VALID, (llog(LL_DBG, "init_holidays: add %d.%d", day, month))); - } - - newh->day = day; - newh->month = month; - newh->year = year; - newh->next = NULL; - - if(firsth == NULL) - { - firsth = newh; - } - else - { - lasth->next = newh; - } - lasth = newh; - } - fclose(fp); -} - -/*---------------------------------------------------------------------------* - * free all holidays - *---------------------------------------------------------------------------*/ -void -free_holidays(void) -{ - free_holiday(firsth); -} - -/*---------------------------------------------------------------------------* - * free holidayes - *---------------------------------------------------------------------------*/ -static void -free_holiday(struct holiday *ptr) -{ - - if(ptr == NULL) - return; - - if(ptr->next != NULL) - free_holiday(ptr->next); - - free(ptr); -} - -/*---------------------------------------------------------------------------* - * check if date/month/year is a holiday - *---------------------------------------------------------------------------*/ -int -isholiday(int d, int m, int y) -{ - struct holiday *ch = NULL; - - if(firsth == NULL) - return(0); - - ch = firsth; - - for(;;) - { - if(ch->day == d && ch->month == m) - { - if(ch->year == 0) - { - DBGL(DL_VALID, (llog(LL_DBG, "isholiday: %d.%d is a holiday!", d, m))); - return(1); - } - else if(ch->year == y) - { - DBGL(DL_VALID, (llog(LL_DBG, "isholiday: %d.%d.%d is a holiday!", d, m, y))); - return(1); - } - } - - if(ch->next == NULL) - break; - - ch = ch->next; - } - return(0); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/isdnd.8 b/usr.sbin/i4b/isdnd/isdnd.8 deleted file mode 100644 index b3c749a7aed5..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.8 +++ /dev/null @@ -1,428 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnd.8,v 1.29 2000/05/02 11:50:28 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Wed May 2 10:48:30 2001] -.\" -.Dd July 5, 2007 -.Dt ISDND 8 -.Os -.Sh NAME -.Nm isdnd -.Nd isdn4bsd ISDN connection management daemon -.Sh SYNOPSIS -.Nm -.Op Fl c Ar configfile -.Op Fl d Ar debuglevel -.Op Fl f -.Op Fl F -.Op Fl l -.Op Fl L Ar logfile -.Op Fl P -.Op Fl r Ar device -.Op Fl s Ar facility -.Op Fl t Ar terminaltype -.Op Fl u Ar charging unit length -.Op Fl m -.Sh DESCRIPTION -The -.Nm -utility -is the isdn4bsd package daemon which manages all ISDN related connection -and disconnection of ISDN devices supported by the package. -.Pp -The options are as follows: -.Bl -tag -width Ds -.It Fl c -Use -.Ar configfile -as the name of the runtime configuration filename for -.Nm -instead of the default file -.Li /etc/isdn/isdnd.rc . -.It Fl d -If debugging support is compiled into -.Nm -this option is used to specify the debugging level, or better which kind -of debugging messages are displayed. -The debugging level is the sum of the -following values: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar 0x001 -general debugging. -.It Ar 0x002 -rates calculation. -.It Ar 0x004 -timing calculations. -.It Ar 0x008 -state transitions. -.It Ar 0x010 -retry handling. -.It Ar 0x020 -dialing. -.It Ar 0x040 -process handling. -.It Ar 0x080 -isdn4bsd kernel i/o calls. -.It Ar 0x100 -controller and channel busy/free messages. -.It Ar 0x200 -isdnd.rc configuration file processing. -.It Ar 0x400 -outgoing call budget handling. -.It Ar 0x800 -valid keyword and holiday file processing. -.El -.Pp -The value can be specified in any number base supported by the -.Xr sscanf 3 -library routine. -.Pp -In addition, this option accepts also the character 'n' as an argument to -disable displaying debug messages on the full-screen display. -.Pp -.It Fl f -Specifying this option causes -.Nm -to enter the full-screen mode of operation. -When operating in this mode, -entering the control character -.Em Control-L -causes the display to be refreshed and entering -.Em Carriage-Return -or -.Em Enter -will pop-up a command window. -Because the -.Nm -utility will not listen to messages while the command window is active, -this command window will disappear automatically after 5 seconds without -any command key press. -.Pp -While the command window is active, -.Em Tab -or -.Em Space -advances to the next menu item. -To execute a command, press -.Em Return -or -.Em Enter -for the highlighted menu item, or enter the number corresponding to the -item to be executed or enter the capitalized character in the menu item -description. -.It Fl l -If this option is set, logging is not done via the -.Xr syslogd 8 -facility but instead is appended to a file. -.It Fl L -Specifies the name of the logfile which is used when the option -.Em -l -is set. -See also the keyword -.Em rotatesuffix -in the system section of -.Xr isdnd.rc 5 . -.It Fl P -This option prints out the parsed and verified isdnd configuration in the same -format as the isdnd.rc file. -This output can be used as an isdnd.rc file. -This -feature is especially useful when debugging an isdnd.rc file to see, what the -default settings of options are when they are not set in the isdnd.rc input -file. -.Pp -The -.Nm -exits after the printout is done. -.It Fl F -This option prevents -.Nm -to detach from the controlling tty and become a daemon. -.It Fl r -In conjunction with the -.Fl t -option, -.Ar device -specifies a terminal device which becomes the controlling tty for -.Nm -and on which the full-screen mode output is displayed. -.It Fl s -This option may be used to specify the logging facility in case -.Xr syslog 3 -logging is configured and another facility than the default LOCAL0 -facility shall be used. -The facility is to be specified as an integer in -the range 0-11 or 16-23 (see the file /usr/include/syslog.h). -.It Fl t -In conjunction with the -.Fl f -and -.Fl r -options, -.Ar terminaltype -specifies a terminal type or termcap entry name (such as vt220) for the device -used for -.Nm -full-screen output. -This is useful if an unused (no getty running) tty line is -used for full-screen output for which no -.Li TERM -environment variable exists. -.It Fl u -Specifies the length of a charging unit in case the config file entry -keyword -.Em unitlenghtsrc -is set to -.Em cmdl . -.It Fl m -If the isdn daemon is compiled with local or remote monitoring support, -this option disables all monitoring access. -It overrides the config -file option -.Em monitor-allowed . -.El -.Sh INTERACTION WITH THE KERNEL -The -.Nm -utility -communicates with the kernel part of isdn4bsd by receiving status and -event messages -.Xr ( read 2 -from device -.Pa /dev/i4b ) -and by transmitting commands and responses -.Xr ( ioctl 2 -from device -.Pa /dev/i4b ) . -.Pp -The messages and message parameters are documented in the include -file -.Em /usr/include/i4b/i4b_ioctl.h . -.Pp -Supported command and response messages (ioctls) to the kernel are: -.Bl -tag -width Ds -compact -offset indent -.It Ar I4B_CDID_REQ -Request a unique Call Description IDentifier (cdid) which identifies -uniquely a single interaction of the local D channel with the exchange. -.It Ar I4B_CONNECT_REQ -Actively request a call setup to a remote ISDN subscriber. -.It Ar I4B_CONNECT_RESP -Respond to an incoming call, either accept, reject or ignore it. -.It Ar I4B_DISCONNECT_REQ -Actively terminate a connection. -.It Ar I4B_CTRL_INFO_REQ -Request information about an installed ISDN controller card. -.It Ar I4B_DIALOUT_RESP -Give information about call setup to driver who requested dialing out. -.It Ar I4B_TIMEOUT_UPD -Update the kernels timeout value(s) in case of dynamically calculated -shorthold mode timing changes. -.It Ar I4B_UPDOWN_IND -Inform the kernel userland drivers about interface soft up/down status -changes. -.It Ar I4B_CTRL_DOWNLOAD -Download firmware to active card(s). -.It Ar I4B_ACTIVE_DIAGNOSTIC -Return diagnostic information from active cards. -.El -.Pp -.Pp -Supported status and event messages from the kernel are: -.Bl -tag -width Ds -compact -offset indent -.It Ar MSG_CONNECT_IND -An incoming call from a remote ISDN user is indicated. -.It Ar MSG_CONNECT_ACTIVE_IND -After an incoming call has been accepted locally or an outgoing call has -been accepted by a remote, the exchange signaled an active connection -and the corresponding B-channel is switched through. -.It Ar MSG_DISCONNECT_IND -A call was terminated. -.It Ar MSG_DIALOUT_IND -A userland interface driver requests the daemon to dial out (typically a -network interface when a packet arrives in its send queue). -.It Ar MSG_IDLE_TIMEOUT_IND -A call was terminated by the isdn4bsd kernel driver because a B-channel -idle timeout occurred. -.It Ar MSG_ACCT_IND -Accounting information from a network driver. -.It Ar MSG_CHARGING_IND -Charging information from the kernel. -.El -.Pp -.Ss OUTGOING CALLS -Currently the only possibility to trigger an outgoing call is that an -isdn4bsd network driver -.Em (ipr) -sends a -.Em MSG_DIALOUT_IND -to the -.Nm -utility. -.Pp -The daemon requests a new CDID from the kernel by using the -.Em I4B_CDID_REQ -ioctl message, this CDID is now used in all interactions with the kernel -to identify this single call until a disconnect occurs. -.Pp -After getting the CDID, the daemon looks up several additional information -in its entry section of the configuration corresponding to that connection -and issues a -.Em I4B_CONNECT_REQ -ioctl message to the kernel. -The kernel now dials the remote side and -if the remote side accepts the call, the kernel sends a -.Em MSG_CONNECT_ACTIVE_IND -to the daemon. -.Pp -The call is terminated by either the local side timing out or the remote -side hanging up the connection or the local side actively sending a -.Em I4B_DISCONNECT_REQ -ioctl message, both events are signaled to the -.Nm -by the kernel sending the -.Em I4B_DISCONNECT_IND -message and the CDID corresponding to the call is no longer valid. -.Pp -.Ss INCOMING CALLS -Incoming calls are signaled to the -.Nm -by the kernel transmitting the -.Em MSG_CONNECT_IND -message to the daemon. -.Pp -With the information contained in this message, the -.Nm -searches the entry section of its configuration database and if a match is -found, it accepts or rejects the call or, if no match is found, it ignores the -call - all by issuing a -.Em I4B_CONNECT_RESP -ioctl message with the appropriate parameters to the kernel. -.Pp -In case the daemon decided to accept the call, the kernel signals this -by sending a -.Em MSG_CONNECT_ACTIVE_IND -message to the daemon. -.Pp -The call is terminated by either the local side timing out or the remote -side hanging up the connection or the local side actively sending a -.Em I4B_DISCONNECT_REQ -ioctl message, both events are signaled to the -.Nm -by the kernel sending the -.Em I4B_DISCONNECT_IND -message and the CDID corresponding to the call is no longer valid. -.Sh SIGNALS -Sending a HUP signal to -.Nm -causes all open connections to be terminated and the configuration file is -reread. -In case aliasfile handling was enabled, the aliasfile is also -reread. -.Pp -Sending a USR1 signal to -.Nm -causes the accounting file and the logfile (if logging to a file is used -instead of logging via the -.Xr syslog 3 -facility) to be closed and reopened to make logfile rotation possible. -.Sh ENVIRONMENT -The following environment variables affect the execution of -.Nm : -.Bl -tag -width Ds -.It Ev TERM -The terminal type when running in full-screen display mode. -See -.Xr environ 7 -for more information. -.El -.Sh FILES -.Bl -tag -width /etc/isdn/isdnd.rates -.It Pa /dev/i4b -The device-file used to communicate with the kernel ISDN driver subsystem. -.It Pa /var/log/messages -A record of the actions in case of syslogd logging support. -.It Pa /var/log/isdnd.acct -The default accounting information filename (if accounting is configured). -.It Pa /var/log/isdnd.log -The default logging filename (if logging to a file is configured). -.It Pa /var/run/isdnd.pid -The process id of the isdn daemon (also known as "lockfile" to isdnd, preventing multiple invocations of it). -.It Pa /usr/local/lib/isdn -.It Pa /etc/isdn -The directory where isdnd expects some supplementary data files and programs -for telephone answering support. -.It Pa /etc/isdn/isdnd.rc -The default runtime configuration file. -.It Pa /etc/isdn/isdnd.rates -The default unit charging rates specification file. -.It Pa /etc/isdn/isdntel.alias -The default table (if aliasing is enabled) to convert phone number to caller's name. -.El -.Sh EXIT STATUS -Exit status is 0 on success, 1 on error. -.Sh EXAMPLES -For a first try, the following command should be used to start -.Nm -in foreground mode for better debugging the configuration setup: -.Bd -literal -offset indent -isdnd -d0xf9 -F -.Ed -.Pp -This will start isdnd with reasonable debugging settings and produce -output on the current terminal. -The -.Nm -utility can then be terminated by entering Control-C. -.Pp -Another example, the command: -.Bd -literal -offset indent -isdnd -d0xf9 -f -r /dev/ttyv3 -t vt100 -.Ed -.Pp -will start -.Nm -with reasonable debugging messages enabled, full-screen mode of operation, -full-screen display redirected to /dev/ttyv3 and using a termcap entry -for vt100 on this display. -.Sh SEE ALSO -.Xr i4bing 4 , -.Xr i4bipr 4 , -.Xr i4bisppp 4 , -.Xr isdnd.rates 5 , -.Xr isdnd.rc 5 , -.Xr isdntel 8 , -.Xr isdntrace 8 , -.Xr syslogd 8 -.Sh AUTHORS -The -.Nm -utility and this manual page were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Sh BUGS -Still one or more left. diff --git a/usr.sbin/i4b/isdnd/isdnd.acct.5 b/usr.sbin/i4b/isdnd/isdnd.acct.5 deleted file mode 100644 index b2db667db742..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.acct.5 +++ /dev/null @@ -1,108 +0,0 @@ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnd.acct.5,v 1.11 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 22:58:12 1999] -.\" -.Dd September 11, 1998 -.Dt ISDND.ACCT 5 -.Os -.Sh NAME -.Nm isdnd.acct -.Nd isdn4bsd ISDN management daemon accounting file format -.Sh DESCRIPTION -The file -.Pa isdnd.acct -contains accounting information which is written if the variable -.Em useacctfile -in the -.Xr isdnd 8 -configuration file -.Xr isdnd.rc 5 -is set to -.Em on -and charging information transmission has been subscribed for the -ISDN connection (AOCD or AOCE). -.Pp -If the variable -.Em acctall -is set to -.Em on , -accounting information is written even if the local site was not charged -or no charging information is available or is not subscribed. -.Pp -The general format of an accounting line is as follows: -.Pp -.Dl FROM - UNTIL NAME UNITS (SECONDS) (INBYTES/OUTBYTES) -.Pp -.Em FROM -is the time the connection was established in the format -.Dl Day.Month.Year Hour:Minutes:seconds -.Pp -.Em UNTIL -is the time the connection was closed. -The format is the same as -described for -.Em FROM -above. -.Pp -.Em NAME -is the symbolic name got from the -.Em name -entry of the -.Xr isdnd.rc 5 -config file for this connection. -.Pp -.Em UNITS -is the amount of charging units billed for the connection. -.Pp -.Em SECONDS -is the number of seconds the connection lasted. -.Pp -.Em INBYTES -and -.Em OUTBYTES -is the (optional) number of bytes that were transferred. -.Sh FILES -.Bl -tag -width /var/log/isdnd.acct -compact -.It Pa /var/log/isdnd.acct -The default accounting information file for the -.Nm isdnd -ISDN daemon. -.El -.Sh EXAMPLES -This is a typical accounting line: -.Pp -.Dl 12.06.97 10:41:37 - 12.06.97 10:45:18 GROGGY 2 (65) (4711/1147) -.Sh SEE ALSO -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -The -.Xr isdnd 8 -daemon and this manual page were written by -.An Hellmuth Michaelis Aq hm@kts.org . diff --git a/usr.sbin/i4b/isdnd/isdnd.h b/usr.sbin/i4b/isdnd/isdnd.h deleted file mode 100644 index 4e65bfe6efec..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.h +++ /dev/null @@ -1,907 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - main header file - * ----------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:18:48 2006] - * - *---------------------------------------------------------------------------*/ - -#ifndef _ISDND_H_ -#define _ISDND_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef USE_CURSES -#include -#endif - -#include -#include -#include - -#include /* TAILQ_ macros */ -#include -#include -#include -#include -#include - -#ifdef USE_RTPRIO -#include -#endif - -#include - -#include -#include - -#include "config.h" /* compile time configuration */ -#include "pathnames.h" /* location of files */ -#include "alias.h" /* alias file processing */ - -/*---------------------------------------------------------------------------* - * some general definitions - *---------------------------------------------------------------------------*/ -#define GOOD 0 /* general "good" or "ok" return*/ -#define ERROR (-1) /* general error return */ -#define WARNING (-2) /* warning return */ -#define INVALID (-1) /* an invalid integer */ - -/*---------------------------------------------------------------------------* - * misc - *---------------------------------------------------------------------------*/ -#define RTPRIO_NOTUSED (-1) /* rtprio is not used for isdnd */ - -/*---------------------------------------------------------------------------* - * debug flag bits - *---------------------------------------------------------------------------*/ -#define DL_MSG 0x0001 /* general debug messages */ -#define DL_RATES 0x0002 /* messages related to rates */ -#define DL_TIME 0x0004 /* messages related to timing */ -#define DL_STATE 0x0008 /* messages related to states changes */ -#define DL_RCVRY 0x0010 /* messages related to dial recovery */ -#define DL_DIAL 0x0020 /* messages related to dial recovery */ -#define DL_PROC 0x0040 /* messages related to process handling */ -#define DL_DRVR 0x0080 /* messages related to kernel i4b msg i/o*/ -#define DL_CNST 0x0100 /* messages related to controller state */ -#define DL_RCCF 0x0200 /* messages related to isdnd.rc at boot */ -#define DL_BDGT 0x0400 /* messages related to budgets */ -#define DL_VALID 0x0800 /* messages related to valid keyword */ - -#ifdef DEBUG -#define DBGL(cond, dolog) if(cond & debug_flags) dolog -#else -#define DBGL(cond, dolog) -#endif - -/*---------------------------------------------------------------------------* - * curses fullscreen display definitions - *---------------------------------------------------------------------------*/ - -/* window dimensions */ -#define UPPER_B 2 /* upper window start */ - -/* horizontal positions for upper window */ -#define H_CNTL 0 /* controller */ -#define H_TEI 2 /* TEI */ -#define H_CHAN (H_TEI+4) /* channel */ -#define H_TELN (H_CHAN+2) /* telephone number */ -#define H_IFN (H_TELN+23) /* interfacename */ -#define H_IO (H_IFN+7) /* incoming or outgoing */ -#define H_OUT (H_IO+4) /* # of bytes out */ -#define H_OUTBPS (H_OUT+11) /* bytes per second out */ -#define H_IN (H_OUTBPS+5) /* # of bytes in */ -#define H_INBPS (H_IN+11) /* bytes per second in */ -#define H_UNITS (H_INBPS+6) /* # of charging units */ - -/* fullscreen mode menu window */ -#define WMENU_LEN 35 /* width of menu window */ -#define WMENU_TITLE "Command" /* title string */ -#define WMENU_POSLN 10 /* menu position, line */ -#define WMENU_POSCO 5 /* menu position, col */ -#define WMITEMS 6 /* no of menu items */ -#define WMENU_HGT (WMITEMS + 4) /* menu window height */ - -#define WREFRESH 0 -#define WHANGUP 1 -#define WREREAD 2 -#define WSHOW 3 -#define WBUDGET 4 -#define WQUIT 5 - -#define WMTIMEOUT 5 /* timeout in seconds */ - -/*---------------------------------------------------------------------------* - * charging rates - *---------------------------------------------------------------------------*/ -#define NDAYS 7 /* number of days in a week */ -#define NRATES 4 /* number of rate structures supported */ - -/* struct for rates - each day has one or more */ -struct rates -{ - int start_time; /* hour and min at which this rate starts, e.g. 12:20 12*60+20*/ - int end_time; /* hour and min at which this rate ends, e.g. 19:10 19*60+10*/ - int rate; /* how long can I telephone at this price, seconds */ - struct rates *next; -}; - -/*---------------------------------------------------------------------------* - * the internal identifiers for isdnd log levels. CAUTION: this has to stay - * in sync with the loglevel to text and sysloglevel table in log.c !! - *---------------------------------------------------------------------------*/ -enum logids -{ - LL_ERR, /* error conditions - everything which caused an error */ - LL_WRN, /* warning conditions - nonfatal abnormal conditions */ - LL_DMN, /* normal but significant condition - status of daemon */ - LL_CHD, /* informational - everything regarding call handling */ - LL_DBG, /* debug messages - everything which helps debugging */ - LL_MER, /* monitor error messages - not sent to remote */ - LL_PKT /* packet logging - log the first few packets */ -}; - -/*---------------------------------------------------------------------------* - * state machine events - *---------------------------------------------------------------------------*/ -enum events -{ - /* incoming messages */ - - EV_MCI, /* MSG_CONNECT_IND */ - EV_MCAI, /* MSG_CONNECT_ACTIVE_IND */ - EV_MDI, /* MSG_DISCONNECT_IND */ - EV_MDO, /* MSG_DIALOUT */ - - /* local requests */ - - EV_TIMO, /* timer expired */ - EV_DRQ, /* disconnect request */ - EV_CBRQ, /* callback request */ - EV_ALRT, /* alerting request */ - - /* illegal */ - - EV_ILL /* illegal event */ -}; - -#define N_EVENTS (EV_ILL+1) /* no of possible events */ - -/*---------------------------------------------------------------------------* - * this struct describes the numbers to try to dial out - *---------------------------------------------------------------------------*/ -typedef struct { - char number[TELNO_MAX]; /* number */ - char subaddr[SUBADDR_MAX]; /* subaddr */ -} number_t; - -/*---------------------------------------------------------------------------* - * this struct describes the numbers to try to dial out - *---------------------------------------------------------------------------*/ -typedef struct { - char number[TELNO_MAX]; /* remote number to dial */ - char subaddr[SUBADDR_MAX]; /* remote subaddr */ - int flag; /* usage flag */ -#define RNF_IDLE 0 -#define RNF_SUCC 1 /* last dial was ok */ -} remote_number_t; - -/*---------------------------------------------------------------------------* - * this struct describes numbers allowed to dial in - *---------------------------------------------------------------------------*/ -typedef struct { - char number[TELNO_MAX]; /* calling party number */ - char subaddr[SUBADDR_MAX];/* calling party subaddr */ -} incoming_number_t; - -/*---------------------------------------------------------------------------* - * this structure describes a prematurely aborted called-back dialout - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call handle */ - int controller; /* the controller used to dial out */ - int channel; /* the channel assigned to the outgoing call */ - /* XXX - timeout handling and error recovery? */ -} phantom_t; - -/*---------------------------------------------------------------------------* - * this struct describes one complete configuration entry - *---------------------------------------------------------------------------*/ -typedef struct cfg_entry { - - /* ====== filled in at startup configuration, then static ===========*/ - - char name[32]; /* id for this entry */ - - int isdncontroller; /* controller to use 0 ... n */ - int isdnchannel; /* channel to use */ - - int isdntxdelin; /* tx delay, incoming connections */ - int isdntxdelout; /* tx delay, outgoing connections */ - - int usrdevicename; /* userland device to use */ - int usrdeviceunit; /* userland unit to use */ - - int remote_numbers_count; /* number of remote numbers */ - int remote_subaddr_count; /* number of remote subaddr */ -#define MAXRNUMBERS 8 /* max remote numbers */ - - remote_number_t remote_numbers[MAXRNUMBERS]; /* remote numbers to dial */ - - - int remote_numbers_handling; /* how to handle the remote dialing */ -#define RNH_NEXT 0 /* use next number after last successfull */ -#define RNH_LAST 1 /* use last successfull for next call */ -#define RNH_FIRST 2 /* always use first number for next call */ - - number_t local_phone_dialout; /* our number to tell remote*/ - number_t local_phone_incoming; /* answer calls for this local number */ - -#define MAX_INCOMING 8 - int incoming_numbers_count; /* number of incoming allowed numbers */ - int incoming_subaddr_count; /* number of incoming allowed subaddr */ - incoming_number_t remote_phone_incoming[MAX_INCOMING]; /* answer calls from this remote machine */ - - int dialin_reaction; /* what to do with incoming calls */ -#define REACT_ACCEPT 0 -#define REACT_REJECT 1 -#define REACT_IGNORE 2 -#define REACT_ANSWER 3 -#define REACT_CALLBACK 4 - - int b1protocol; /* hdlc / raw */ - - int bcap; /* special bearer capability (DoV) */ - - int idle_time_in; /* max idle time incoming calls */ - int idle_time_out; /* max idle time outgoing calls */ - - int shorthold_algorithm; /* shorthold algorithm */ - - int unitlength; /* length of a charging unit */ -#define UNITLENGTH_DEFAULT 60 /* last resort unit length */ - - int earlyhangup; /* time in seconds to hangup */ - /* before the next expected */ - /* charging unit */ -#define EARLYHANGUP_DEFAULT 5 - - int ratetype; /* type of rate */ -#define NO_RATE (NRATES+1) -#define INVALID_RATE (-1) - - int unitlengthsrc; /* where we get the unit length from */ -#define ULSRC_NONE 0 /* nowhere specified */ -#define ULSRC_CMDL 1 /* specified on commandline */ -#define ULSRC_CMDLMIN 5 /* minimum value from cmdl */ -#define ULSRC_CMDLMAX 3600 /* minimum value from cmdl */ -#define ULSRC_CONF 2 /* get it from config file */ -#define ULSRC_RATE 3 /* get it dynamic from ratesfile*/ -#define ULSRC_DYN 4 /* dynamic calculated from AOCD */ - - char *answerprog; /* program to use for answering */ - char *connectprog; /* program run after negotiation finished */ - char *disconnectprog; /* program run after shutdown is complete */ - - int callbackwait; /* time to wait before calling back */ -#define CALLBACKWAIT_MIN 1 - - int calledbackwait; /* time to wait for remote callback */ -#define CALLEDBACKWAIT_MIN 2 - - int dialretries; /* no. of dial tries */ -#define DIALRETRIES_DEF 1 - - int recoverytime; /* time between 2 dial tries */ -#define RECOVERYTIME_MIN 1 - - int dialrandincr; /* use random dial time incr */ - - int usedown; /* set interface down yes/no */ - int downtries; /* retries before i/f is set down */ -#define DOWN_TRIES_MIN 2 -#define DOWN_TRIES_MAX 20 - int downtime; /* time i/f is down */ -#define DOWN_TIME_MIN 10 /* 10 seconds */ -#define DOWN_TIME_MAX 3600 /* 1 hour */ - - int dialouttype; /* type of outgoing connection */ -#define DIALOUT_NORMAL 0 /* normal dialout behaviour */ -#define DIALOUT_CALLEDBACK 1 /* remote is expected to callback */ - - int alert; /* alert time in sec if nonzero */ -#define MINALERT 5 /* 5 secs min */ -#define MAXALERT (3*60) /* 3 minutes max */ - - int inout; /* in/out, in-only or out-only */ -#define DIR_INOUT 0 -#define DIR_INONLY 1 -#define DIR_OUTONLY 2 - - int usesubaddr; /* use subaddresses */ - - int budget_callbackperiod; /* length of a budget period (s)*/ - int budget_callbackncalls; /* call budget for a period */ - char *budget_callbacks_file; /* filename to store callback stats */ - char budget_callbacksfile_rotate; - - int budget_calloutperiod; /* length of a budget period (s)*/ - int budget_calloutncalls; /* call budget for a period */ - char *budget_callouts_file; /* filename to store callout stats */ - char budget_calloutsfile_rotate; - - int ppp_expect_auth; - int ppp_send_auth; -#define AUTH_UNDEF 0 -#define AUTH_NONE 1 -#define AUTH_PAP 2 -#define AUTH_CHAP 3 - - int ppp_auth_flags; -#define AUTH_RECHALLENGE 0x01 -#define AUTH_REQUIRED 0x02 - - char ppp_expect_name[AUTHNAMELEN]; /* PPP PAP/CHAP login name */ - char ppp_send_name[AUTHNAMELEN]; - - char ppp_expect_password[AUTHKEYLEN]; - char ppp_send_password[AUTHKEYLEN]; - - int day; /* days valid */ -#define SU 0x01 -#define MO 0x02 -#define TU 0x04 -#define WE 0x08 -#define TH 0x10 -#define FR 0x20 -#define SA 0x40 -#define HD 0x80 /* holiday */ - int fromhr; /* time valid */ - int frommin; - int tohr; - int tomin; - - time_t maxconnecttime; /* maximum connection time */ - -/*===========================================================================*/ -/*============ filled in after start, then dynamic ==========================*/ -/*===========================================================================*/ - - int cdid; /* cdid for call */ -#define CDID_RESERVED (-1) - - int isdncontrollerused; /* the one we are using */ - int isdnchannelused; /* the one we are using */ - - int fs_position; /* fullscreen position */ - - int state; /* state of connection */ -#define ST_IDLE 0 /* connection is idle / disconnected */ - - /* normal dial out to remote */ -#define ST_DIAL 1 /* dialing */ -#define ST_DIALRTMRCHD 2 /* wait for dial retry time reached */ -#define ST_DIALRETRY 3 /* last/first dialing failed, retry */ - - /* PCB: passive callback, i'm being called back */ -#define ST_PCB_DIAL 4 /* dialing, trigger a callback */ -#define ST_PCB_DIALFAIL 5 /* dialing failed triggering a callbk */ -#define ST_PCB_WAITCALL 6 /* waiting for callback from remote */ - - /* ACB: active callback, i'm calling back */ -#define ST_ACB_WAITDISC 7 /* got call, wait for disconnect */ -#define ST_ACB_WAITDIAL 8 /* wait until allowed to callback */ -#define ST_ACB_DIAL 9 /* callback to remote */ -#define ST_ACB_DIALFAIL 10 /* callback to remote failed */ - - /* normal non-dialling states */ -#define ST_ACCEPTED 11 /* remote accepted */ -#define ST_CONNECTED 12 /* connected with remote */ -#define ST_WAITDISCI 13 /* tx disc req, wait for disc ind */ -#define ST_DOWN 14 /* interface is down */ -#define ST_ALERT 15 /* interface is waiting for alert time*/ - - /* illegal and pseudo states */ -#define ST_ILL 16 /* illegal state */ -#define ST_SUSE 17 /* subroutine sets new state */ - -#define N_STATES (ST_ILL+1) /* max number of states */ - - cause_t disc_cause; /* cause from disconnect */ - - int local_disconnect; /* flag, who disconnected */ -#define DISCON_LOC 0 -#define DISCON_REM 1 - - int timerval; /* value for timer, 0 if inactive */ - int timerremain; /* remaining time */ - - int hangup; /* flag, hangup connection asap */ - - number_t real_phone_incoming; /* real remote telno in case of wildcard */ - - int last_remote_number; /* index of last used dialout number*/ - - number_t remote_phone_dialout; /* used remote number to dial */ - - int direction; /* incoming or outgoing */ -#define DIR_IN 0 -#define DIR_OUT 1 - - int charge; /* charge in units */ - int last_charge; /* last charge in units */ - - int inbytes; /* # of bytes from remote */ - int iinbytes; /* # of bytes from remote on the line */ - int inbps; /* bytes/sec from remote */ - int outbytes; /* # of bytes to remote */ - int ioutbytes; /* # of bytes to remote on the line */ - int outbps; /* bytes/sec to remote */ - - time_t connect_time; /* time connection was established */ - - time_t aoc_last; /* last AOCD timestamp */ - time_t aoc_now; /* current AOCD timestamp */ - time_t aoc_diff; /* current unit length */ - time_t aoc_lastdiff; /* last charge unit length */ - int aoc_valid; /* flag: time diff is valid */ -#define AOC_INVALID 0 /* aoc_diff is NOT valid */ -#define AOC_VALID 1 /* aoc_diff is valid */ - - time_t last_dial_time; /* time of last dialing */ - time_t last_release_time; /* time of last hangup */ - - int dial_count; /* number of dialout tries */ - int randomtime; /* random() part of recoverytime*/ -#define RANDOM_MASK 0x04 /* bits used from randomtime */ - - int down_retry_count; /* retry cycle count for usedown*/ - time_t went_down_time; /* time i/f went down */ - phantom_t saved_call; /* outgoing call state if called - back too early */ - - int alert_time; /* count down of alert time */ - char display[DISPLAY_MAX]; - - time_t budget_callbackperiod_time; /* end of current period */ - int budget_callbackncalls_cnt; /* amount of calls left */ - - int budget_callback_req; /* requests */ - int budget_callback_done; /* call done */ - int budget_callback_rej; /* call refused */ - - time_t budget_calloutperiod_time; /* end of current period */ - int budget_calloutncalls_cnt; /* amount of calls left */ - - int budget_callout_req; /* requests */ - int budget_callout_done; /* call done */ - int budget_callout_rej; /* call refused */ - - int budget_calltype; /* type of call */ -#define BUDGET_TYPE_CBACK 1 -#define BUDGET_TYPE_COUT 2 - - char keypad[KEYPAD_MAX]; /* keypad string */ -} cfg_entry_t; - -/*---------------------------------------------------------------------------* - * this struct describes state of controller with MAX_BCHAN b channels - *---------------------------------------------------------------------------*/ -typedef struct isdn_ctrl_state { - int ctrl_type; /* type: active/passive */ - int card_type; /* manufacturer (CARD_XXXX) */ - int protocol; /* ISDN D-channel protocol */ - char* firmware; /* loadable fimrware file name */ - - int state; /* controller state */ -#define CTRL_DOWN 0 /* controller inoparable */ -#define CTRL_UP 1 /* controller may be used */ -#define MAX_BCHAN 30 - int stateb[MAX_BCHAN]; /* b channel state */ -#define CHAN_IDLE 0 /* channel is free for usage */ -#define CHAN_RUN 1 /* channel is occupied */ - int nbch; /* number of b channels */ - int freechans; /* number of unused channels */ - int tei; /* tei or -1 if invalid */ - int l1stat; /* layer 1 state */ - int l2stat; /* layer 2 state */ -} isdn_ctrl_state_t; - -/*---------------------------------------------------------------------------* - * this struct describes a logging regular expression - *---------------------------------------------------------------------------*/ -struct rarr { - int re_flg; /* valid entry flag */ - char *re_expr; /* plain text expression */ - regex_t re; /* compiled expression */ - char *re_prog; /* the program to be executed */ -}; - -#ifdef I4B_EXTERNAL_MONITOR -/* for each rights entry we keep one of this structures around: */ -struct monitor_rights { - TAILQ_ENTRY(monitor_rights) list; /* a list of this structures */ - char name[FILENAME_MAX]; /* net/host spec or filename */ - int rights; /* bitmask of allowed acces rights */ - u_int32_t net; /* net/host address (host byte order!) */ - u_int32_t mask; /* bitmask 1 = network, 0 = host (host byte order!) */ - int local; /* zero if remote access via tcp/ip */ -}; -#endif - -/*---------------------------------------------------------------------------* - * global variables, storage allocation - *---------------------------------------------------------------------------*/ -#ifdef MAIN - -int isdnfd; /* file handle, /dev/i4b */ - -char mailto[MAXPATHLEN] = ""; /* panic mail address */ -char mailer[MAXPATHLEN] = ""; /* panic mail address */ - -char *configfile = CONFIG_FILE_DEF; /* configuration filename */ -int config_error_flag = 0; /* error counter */ - -#ifdef DEBUG -int do_debug = 0; /* debug mode flag */ -int debug_flags = 0; /* debug options */ -int debug_noscreen = 0; /* not on fullscreen */ -#endif - -int do_bell = 0; /* bell on connect/disconnect */ - -int do_fork = 1; /* run as daemon/foreground */ - -int do_ttytype = 0; /* got new terminal type */ -char *ttype = ""; /* termcap entry name string */ - -int do_rdev = 0; /* redirect output */ -char *rdev = ""; /* new device string */ - -int do_print = 0; /* config file printout */ - -int got_unitlen = 0; /* flag, got length of a unit */ -time_t unit_length; /* length of a unit */ - -cfg_entry_t cfg_entry_tab[CFG_ENTRY_MAX]; /* configuration table */ -isdn_ctrl_state_t isdn_ctrl_tab[ISDN_CTRL_MAX]; /* controller states table */ - -int ncontroller = 0; /* # of controllers available */ -int nentries = 0; /* # of entries in config tab */ - -int uselogfile = 0; /* flag, use a logfile */ -char logfile[MAXPATHLEN] = LOG_FILE_DEF; /* log filename */ -FILE *logfp = NULL; /* log file pointer */ -int logfacility = LOG_LOCAL0; /* the syslog facility used */ -int nregex = 0; /* number of reg expr */ -struct rarr rarr[MAX_RE]; /* regexpr & progs table */ - -char ratesfile[MAXPATHLEN] = RATES_FILE_DEF; /* rates filename */ -char *rate_error = NULL; /* errorcase: error string */ -int got_rate = 0; /* flag, ratesfile found */ -struct rates *rates[NRATES][NDAYS]; /* the rates structure */ - -int useacctfile = 0; /* flag, write accounting */ -char acctfile[MAXPATHLEN] = ACCT_FILE_DEF; /* accounting filename */ -FILE *acctfp = NULL; /* accounting file pointer */ -int acct_all = 1; /* account all connections */ - -int aliasing = 0; /* enable alias processing */ -char aliasfile[MAXPATHLEN] = ALIASFILE; /* alias file location */ - -int do_fullscreen = 0; /* fullscreen log */ -int curses_ready = 0; /* curses initialized */ - -#ifdef USE_CURSES -WINDOW *upper_w; /* curses upper window pointer */ -WINDOW *mid_w; /* curses mid window pointer */ -WINDOW *lower_w; /* curses lower window pointer */ -#endif - -int rt_prio = RTPRIO_NOTUSED; /* realtime priority */ - -/* monitor via network */ - -int do_monitor = 0; -int inhibit_monitor = 0; -#ifdef I4B_EXTERNAL_MONITOR -int monitorport = DEF_MONPORT; -#else -int monitorport = -1; -#endif -int accepted = 0; - -int isdntime = 0; /* flag, log time from exchange */ -int extcallattr = 0; /* flag, display extended caller attributes */ - -char tinainitprog[MAXPATHLEN] = TINA_FILE_DEF; - -char rotatesuffix[MAXPATHLEN] = ""; - -time_t starttime = 0; - -char holidayfile[MAXPATHLEN] = HOLIDAY_FILE_DEF; /* holiday filename */ - -int addprefix = 0; -char prefixnational[TELNO_MAX] = ""; -char prefixinternational[TELNO_MAX] = ""; - -#else /* !MAIN */ - -int isdnfd; - -char mailto[MAXPATHLEN]; -char mailer[MAXPATHLEN]; - -char *configfile; -int config_error_flag; - -#ifdef DEBUG -int do_debug; -int debug_flags; -int debug_noscreen; -#endif - -int do_bell; - -int do_fork; - -int do_ttytype; -char *ttype; - -int do_rdev; -char *rdev; - -int do_print; - -int got_unitlen; -time_t unit_length; - -cfg_entry_t cfg_entry_tab[CFG_ENTRY_MAX]; /* configuration table */ -isdn_ctrl_state_t isdn_ctrl_tab[ISDN_CTRL_MAX]; /* controller states table */ - -int ncontroller; -int nentries; - -int uselogfile; -char logfile[MAXPATHLEN]; -FILE *logfp; -int logfacility; -int nregex; -struct rarr rarr[MAX_RE]; - -char ratesfile[MAXPATHLEN]; -char *rate_error; -int got_rate; -struct rates *rates[NRATES][NDAYS]; - -int useacctfile; -char acctfile[MAXPATHLEN]; -FILE *acctfp; -int acct_all; - -int aliasing; -char aliasfile[MAXPATHLEN]; - -int do_fullscreen; -int curses_ready; - -#ifdef USE_CURSES -WINDOW *upper_w; -WINDOW *mid_w; -WINDOW *lower_w; -#endif - -int rt_prio; - -int do_monitor; -int inhibit_monitor; -int monitorport; -int accepted; - -int isdntime; -int extcallattr; - -char tinainitprog[MAXPATHLEN]; - -char rotatesuffix[MAXPATHLEN]; - -time_t starttime; - -char holidayfile[MAXPATHLEN]; - -int addprefix; -char prefixnational[TELNO_MAX]; -char prefixinternational[TELNO_MAX]; - -#endif /* MAIN */ - -int add_number_prefix( char *number, int type_of_number ); -char * bdrivername ( int drivertype ); -void cfg_setval ( int keyword ); -void check_and_kill ( cfg_entry_t *cep ); -void check_pid ( void ); -void close_allactive ( void ); -void configure ( char *filename, int reread ); -void daemonize ( void ); -void dialresponse(cfg_entry_t *cep, int dstat); -void display_acct ( cfg_entry_t *cep ); -void display_bell ( void ); -void display_ccharge ( cfg_entry_t *cep, int units ); -void display_chans ( void ); -void display_charge ( cfg_entry_t *cep ); -void display_connect ( cfg_entry_t *cep ); -void display_disconnect ( cfg_entry_t *cep ); -void display_l12stat(int controller, int layer, int state); -void display_tei(int controller, int tei); -void display_updown ( cfg_entry_t *cep, int updown ); -void do_exit ( int exitval ); -void do_menu ( void ); -int exec_answer ( cfg_entry_t *cep ); -int exec_connect_prog ( cfg_entry_t *cep, const char *prog, int link_down ); -pid_t exec_prog ( char *prog, char **arglist ); -cfg_entry_t * find_by_device_for_dialout ( int drivertype, int driverunit ); -cfg_entry_t *find_by_device_for_dialoutnumber(msg_dialoutnumber_ind_t *mp); -cfg_entry_t *find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd); -cfg_entry_t * find_matching_entry_incoming ( msg_connect_ind_t *mp ); -cfg_entry_t * find_active_entry_by_driver ( int drivertype, int driverunit ); -void finish_log ( void ); -char * getlogdatetime ( void ); -int get_cdid ( void ); -cfg_entry_t * get_cep_by_cc ( int ctrlr, int chan ); -cfg_entry_t * get_cep_by_driver ( int drivertype, int driverunit ); -cfg_entry_t * get_cep_by_cdid ( int cdid ); -int get_current_rate ( cfg_entry_t *cep, int logit ); -void handle_charge ( cfg_entry_t *cep ); -void handle_recovery ( void ); -void handle_scrprs(int cdid, int scr, int prs, char *caller); -void if_up(cfg_entry_t *cep); -void if_down(cfg_entry_t *cep); -void init_controller ( void ); -void init_controller_protocol ( void ); -void init_log ( void ); -void init_screen ( void ); -void llog ( int what, const char *fmt, ... ); -int main ( int argc, char **argv ); -void msg_accounting ( msg_accounting_ind_t *mp ); -void msg_alert_ind ( msg_alert_ind_t *mp ); -void msg_charging_ind ( msg_charging_ind_t *mp ); -void msg_connect_active_ind ( msg_connect_active_ind_t *mp ); -void msg_connect_ind ( msg_connect_ind_t *mp ); -void msg_pdeact_ind(msg_pdeact_ind_t *md); -void msg_negcomplete_ind(msg_negcomplete_ind_t *ind); -void msg_ifstatechg_ind(msg_ifstatechg_ind_t *ind); -void msg_drvrdisc_req(msg_drvrdisc_req_t *mp); -void msg_dialout ( msg_dialout_ind_t *mp ); -void msg_dialoutnumber(msg_dialoutnumber_ind_t *mp); -void msg_disconnect_ind ( msg_disconnect_ind_t *mp ); -void msg_idle_timeout_ind ( msg_idle_timeout_ind_t *mp ); -void msg_l12stat_ind(msg_l12stat_ind_t *ml); -void msg_teiasg_ind(msg_teiasg_ind_t *mt); -void msg_proceeding_ind ( msg_proceeding_ind_t *mp ); -void msg_packet_ind( msg_packet_ind_t *mp ); -void msg_keypad(msg_keypad_ind_t *mp); -const char * name_of_controller(int ctrl_type, int card_type); -void next_state ( cfg_entry_t *cep, int event ); -char * print_i4b_cause( cause_t code ); -char * printstate ( cfg_entry_t *cep ); -int readrates ( char *filename ); -int ret_channel_state(int controller, int channel); -void reopenfiles ( int dummy ); -void rereadconfig ( int dummy ); -void select_first_dialno ( cfg_entry_t *cep ); -void select_next_dialno ( cfg_entry_t *cep ); -void select_this_dialno ( cfg_entry_t *cep ); -int sendm_alert_req ( cfg_entry_t *cep ); -int sendm_connect_req ( cfg_entry_t *cep ); -int sendm_connect_resp ( cfg_entry_t *cep, int cdid, int response, cause_t cause ); -int sendm_disconnect_req ( cfg_entry_t *cep, cause_t cause ); -int set_channel_busy(int controller, int channel); -int set_channel_idle(int controller, int channel); -int setup_dialout(cfg_entry_t *cep); -void sigchild_handler ( int sig ); -void start_timer ( cfg_entry_t *cep, int seconds ); -void stop_timer ( cfg_entry_t *cep ); -void unitlen_chkupd( cfg_entry_t *cep ); -void write_pid ( void ); -void yyerror ( const char *msg ); - -void error_exit(int exitval, const char *fmt, ...); - -/* montior server module */ -void monitor_init(); -void monitor_exit(); -void monitor_clear_rights(); -void monitor_fixup_rights(); -int monitor_start_rights(const char *clientspec); -void monitor_add_rights(int rights); - -/* possible return codes from monitor_start_rights: */ -#define I4BMAR_OK 0 /* rights added successfully */ -#define I4BMAR_LENGTH 1 /* local socket name to long */ -#define I4BMAR_DUP 2 /* entry already exists */ -#define I4BMAR_CIDR 3 /* cidr netmask is invalid */ -#define I4BMAR_NOIP 4 /* host/net could not be resolved */ - -int monitor_create_local_socket(); - -#ifndef I4B_NOTCPIP_MONITOR -int monitor_create_remote_socket(int portno); -#endif - -void monitor_prepselect(fd_set *selset, int *max_fd); -void monitor_handle_input(fd_set *selset); -void monitor_handle_connect(int sockfd, int is_local); -void monitor_evnt_charge(cfg_entry_t *cep, int units, int estimated); -void monitor_evnt_connect(cfg_entry_t *cep); -void monitor_evnt_disconnect(cfg_entry_t *cep); -void monitor_evnt_updown(cfg_entry_t *cep, int up); -void monitor_evnt_log(int prio, const char * what, const char * msg); - -void monitor_evnt_l12stat(int controller, int layer, int state); -void monitor_evnt_tei(int controller, int tei); -void monitor_evnt_acct(cfg_entry_t *cep); - -/* controller.c */ - -void init_active_controller(void); -int set_controller_state(int controller, int state); -int get_controller_state(int controller); -int decr_free_channels(int controller); -int incr_free_channels(int controller); -int get_free_channels(int controller); -int set_channel_busy(int controller, int channel); -int set_channel_idle(int controller, int channel); -int ret_channel_state(int controller, int channel); - -/* alias.c */ - -void init_alias(char *filename); -void free_aliases(void); -char *get_alias(char *number); - -void upd_callstat_file(char *filename, int rotateflag); - -/* holiday.c */ - -void init_holidays(char *filename); -void free_holidays(void); -int isholiday(int d, int m, int y); - -#endif /* _ISDND_H_ */ diff --git a/usr.sbin/i4b/isdnd/isdnd.rates.5 b/usr.sbin/i4b/isdnd/isdnd.rates.5 deleted file mode 100644 index b4542e07591b..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.rates.5 +++ /dev/null @@ -1,117 +0,0 @@ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnd.rates.5,v 1.10 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 22:59:31 1999] -.\" -.Dd September 11, 1998 -.Dt ISDND.RATES 5 -.Os -.Sh NAME -.Nm isdnd.rates -.Nd isdn4bsd ISDN management daemon rates description file -.Sh DESCRIPTION -The file -.Pa isdnd.rates -contains descriptions how long charging units last at a given time of day, -day of week and the distance to the destination. -If this file is available, -this information may be used by the -.Xr isdnd 8 -ISDN connection management daemon to calculate the short hold time for a -connection. -.Pp -The format of a rate entry line is as follows: -.Pp -The first field, the -.Pq Fa rate-code -defines a collection of rates (for each day of the week) which can be -referenced in the -.Xr isdnd 8 -configuration file -.Xr isdnd.rc 5 . -This field must start with the identifier -.Dq ra -followed by a digit in the range of zero to four. -.Pp -The second field, the -.Pq Fa day-number -selects the day of week for which this entry defines the rates, where 0 stands -for Sunday, 1 for Monday and so on until the digit 6 which stands for Saturday. -.Pp -The rest of the line consists of one or more space separated fields which have -the following syntax: -.Bd -ragged -offset indent -start_hour.start_minutes-end_hour.end_minutes:charge_unit_length -.Ed -.Pp -Start_hour and start_minutes define the begin of a time section and end_hour -and end_minutes define the end. -Charge_unit_length define the length of a -charging unit in the previously defined time section. -No spaces or tabs are -allowed inside this field. -The hour and minutes specifications MUST have -exactly 2 digits, in case just one digit is needed, a leading 0 must be used. -.Pp -For example, -.Bd -ragged -offset indent -14.00-18.00:90 -.Ed -.Pp -defines, that between 2:00 PM and 6:00 PM the length of one charging unit -lasts 90 seconds. -.Sh FILES -.Bl -tag -width /etc/isdn/isdnd.rates -compact -.It Pa /etc/isdn/isdnd.rates -The default rates specification file for the -.Nm isdnd -ISDN daemon. -.El -.Sh EXAMPLES -The line: -.Bd -literal -ra0 0 00.00-05.00:240 05.00-21.00:150 21.00-24.00:240 -.Ed -.Pp -defines the unit lengths for a Sunday. -.Sh SEE ALSO -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -.An -nosplit -The rates subsystem for the -.Xr isdnd 8 -daemon to which -.Nm -belongs was designed and written by -.An Gary Jennejohn . -.Pp -The -.Xr isdnd 8 -daemon and this manual page were written by -.An Hellmuth Michaelis Aq hm@kts.org . diff --git a/usr.sbin/i4b/isdnd/isdnd.rc.5 b/usr.sbin/i4b/isdnd/isdnd.rc.5 deleted file mode 100644 index d3d2ed894d0b..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.rc.5 +++ /dev/null @@ -1,1115 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Aug 11 20:07:38 2002] -.\" -.Dd August 11, 2002 -.Dt ISDND.RC 5 -.Os -.Sh NAME -.Nm isdnd.rc -.Nd isdn4bsd ISDN connection management daemon config file format -.Sh DESCRIPTION -The file -.Pa /etc/isdn/isdnd.rc -contains (if not otherwise specified on the command line) the runtime -configuration for the -.Xr isdnd 8 -ISDN connection management daemon which is part of the isdn4bsd package. -.Pp -The configuration file consists of keywords which start in column 1 followed by -one or more spaces or tabs, an equal sign, one or more spaces or tabs -and a keyword dependent parameter value. -.Pp -A line beginning with '#' is treated as a comment line. -.Pp -For keywords requiring the specification of a boolean value, the truth -value can be either -.Em yes -or -.Em on -while the false value can be either -.Em no -or -.Em off . -.Pp -The configuration file consists of one -.Em system -section, one or more optional -.Em controller -sections and one or more -.Em entry -sections. -In the -.Em system -section parameters regarding the daemon operation or parameters -not associated with a single remote connection can be set. -In the -.Em controller -section parameters regarding a particular controller can be set. -In the -.Em entry -section(s) parameters directly associated with a single remote -connection can be set. -.Pp -The following keywords are recognized by -.Nm isdnd : -.Pp -.Bl -tag -width system -.It Li system -This keyword starts the system configuration section. -It must not -have a parameter and may be used only once. -The keyword is mandatory. -The following keywords are valid in the system configuration section: -.Bl -tag -width useacctfile -.It Li acctall -If this parameter is set to -.Em on , -accounting information is written even if the local site was not charged -or no charging information is available or is not subscribed. -(optional) -.It Li acctfile -Specifies the name of the accounting file which is used when the keyword -.Em useacctfile -(see below) is set to -.Em on . -See also system keyword -.Em rotatesuffix . -If this keyword is omitted the system default is used. -(optional) -.It Li add-prefix -If set to -.Em on , -for incoming numbers, have a look at the "type of number" indicator and -adjust the number as specified by the -.Em prefix-national -and -.Em prefix-international -keywords described later. -If this keyword is omitted, the system default (off) is used. -(optional) -.It Li aliasing -If this parameter is set to -.Em on , -alias processing of telephone-number to name is enabled (see also the -.Em aliasfile -keyword below). -The default is off. -(optional) -.It Li aliasfile -Specifies the name of the telephone number-to-name alias database file shared -with the -.Xr isdntel 8 -utility when alias processing is enabled via the -.Em aliasing -keyword. -(optional) -.It Li beepconnect -In full-screen mode, if this parameter is set to -.Em on , -ring the bell when connecting or disconnecting a call. -.It Li extcallattr -If this parameter is set to -.Em on , -the extended caller attributes "screening indicator" and "presentation -indicator" are written to the log-file. -The default is off. -(optional) -.It Li holidayfile -Specifies the name of the holiday file containing the dates of holidays. -This file is used in conjunction with the -.Em valid -keyword to lookup the dates of holidays. -(optional) -.It Li isdntime -If this parameter is set to -.Em on , -date/time information from the exchange (if provided) is written to the -log-file. -The default is off. -(optional) -.It Li mailer -This keyword is used to specify the path/name of a mail program -which is able to use the "-s" flag to specify a subject on its -command line. -In case of a fatal error exit of -.Nm -this program is used to send mail to an administrator specified by -the keyword -.Em mailto . -(optional) -.It Li mailto -This keyword is used to specify the email address of someone to notify -in case of a fatal error exit of -.Nm . -(See also keyword -.Em mailer ) . -(optional) -.It Li monitor-allowed -If this parameter is set to -.Em on -or -.Em yes , -monitoring via a local or remote machine is enabled. -This parameter is optional and is set to -.Em off -by default. -.It Li monitor-port -sets the TCP port number for remote monitoring. -This integer parameter is optional and is set to port 451 by default. -.It Li monitor -This keyword specifies a local socket name or a host or network for remote -monitoring. -The -.Em monitor -specification may either be: -.Pp -.Bl -tag -width Ds -compact -.It Ar the name of a local (UNIX-domain) socket -this MUST start with a "/", example: /var/run/isdn-monitor -.It Ar a dotted-quad host specification -example: 192.168.1.2 -.It Ar a dotted-quad network address with netmask -example: 192.168.1.0/24 -.It Ar a resolvable host name -example: localhost -.It Ar a resolvable network name with netmask -example: up-vision-net/24 -.El -.It Li monitor-access -This keyword specifies the access rights for a previously used -.Em monitor -keyword. -The supported access rights are: -.Pp -.Bl -tag -width Ds -compact -.It Ar fullcmd -.It Ar restrictedcmd -.It Ar channelstate -.It Ar logevents -.It Ar callin -.It Ar callout -.El -.It Li prefix-international -In conjunction with the -.Em add-prefix -switch (see above), specify the prefix number string for incoming numbers -with the international number tag. -If aliases are used, they have to be adjusted accordingly. -(optional) -.It Li prefix-national -In conjunction with the -.Em add-prefix -switch (see above), specify the prefix number string for incoming numbers -with the national number tag. -If aliases are used, they have to be adjusted accordingly. -(optional) -.It Li ratesfile -Specifies the name of the ratesfile. -If this keyword is omitted the system -default is used. -(optional) -.It Li regexpr -This keyword is used to specify regular expressions. -It can be specified -more than once up to a compile time dependent value (currently set to 5 by -the MAX_RE definition in the source). -.Pp -All specified regular expressions are compared to the log strings at runtime -and if a match is found, a program is run with the log text as a parameter -(see also the keyword -.Em regprog -below). -.Pp -For an explanation how regular expressions are specified, please have a -look at -.Xr re_format 7 -and -.Xr regex 3 . -The -.Em extended -regular expression syntax is supported here. -.Pp -Hint: it might be necessary to properly quote the expression to avoid -improper interpretation by the configuration file parser. -(optional) -.It Li regprog -This keyword is used to specify the name of a program which is run in -case a corresponding regular expression is matched by a logging string. -.Nm Isdnd -expects to find the program below the path -.Pa /etc/isdn -which is prepended to the string specified as a parameter to this keyword. -(optional) -.It Li rotatesuffix -Specifies a suffix for renaming the log- and the accounting-filename. -In case -rotatesuffix is used and a USR1 signal is sent to isdnd, the log-file and the -accounting file is not only closed and reopened but the old log-file is also -renamed to the former filename with the rotatesuffix string appended. -If this keyword is omitted, the log-files are just closed and reopened; this -is also the default behavior. -(optional) -.It Li rtprio -Specifies the real-time priority -.Nm isdnd -runs at as an integer value in the range 0...31 with 0 being the highest -priority. -This keyword is optional; if not specified the process priority of -.Nm isdnd -is not touched in any way. -( See also -.Xr rtprio 1 ) . -This keyword is only available if -.Nm -was compiled with -DUSE_RTPRIO. -.It Li useacctfile -If this parameter is set to -.Em on -charging (if available) and accounting information is written to the -accounting file. -(optional) -.El -.It Li controller -This keyword starts the controller configuration section. -It must not -have a parameter and may be used once for every controller. -The keyword -is optional. -The following keywords are valid in a controller -configuration section: -.Bl -tag -width useacctfile -.It Li protocol -This keyword is used to set the D-channel protocol for the S0-bus a -controller is connected to. -The following parameters are currently -supported: -.Pp -.Bl -tag -width calledback -compact -.It Ar dss1 -The DSS1 or so-called "Euro-ISDN" D-channel protocol according to -ITU Recommendations Q.921 and Q.931. -.It Ar d64s -An ISDN leased line with a single B-channel (called D64S in Germany). -.El -.It Li firmware -This keyword is used like -.Li firmware Ns = Ns Ar /path/to/file -to download the -firmware to active controllers supported by the -.Em iavc -driver (AVM B1, T1). -This keyword is supported for all controller types, -and causes -.Dv I4B_CTRL_DOWNLOAD -ioctl to be invoked with the specified file -as an argument. -In systems equipped with both active and passive adapters, -and the passive cards being detected first, dummy -.Ql controller -entries -are required for the passive cards to get the correct firmwares to -correct adapters. -.El -.It Li entry -This keyword starts one configuration entry. -It must not have a parameter. -This keyword must be used at least once. -The following keywords are valid in an entry section: -.Bl -tag -width unitlengthsrc -.It Li answerprog -This keyword is used to specify the name of a program which is run in -case an incoming telephone connection specified -.Em answer -in its configuration entry. -The default name is -.Em answer . -.Nm Isdnd -expects to find this program beneath the path -.Pa /etc/isdn -which is prepended to the string specified as a parameter to this keyword. -(optional) -.It Li alert -is used to specify a time in seconds to wait before accepting a call. -This -keyword is only usable for incoming telephone calls (dialin-reaction = answer). -It is used to have a chance to accept an incoming call on the phone before -the answering machine starts to run. -The minimum value for the alert parameter -is 5 seconds and the maximum parameter allowed is 180 seconds. -(optional) -.It Li b1protocol -The B channel layer 1 protocol used for this connection. -The keyword is mandatory. -The currently configurable values are: -.Pp -.Bl -tag -width Ds -compact -.It Ar hdlc -HDLC framing. -.It Ar raw -No framing at all (used for telephony). -.El -.It Li bcap -Use a special bearer capability for this connection. -The keyword is optional. -.Pp -Any other value than -.Em dov -sets the bearer capability as configured by the -.Em b1protocol -keyword (see above). -The currently configurable values are: -.Pp -.Bl -tag -width Ds -compact -.It Ar dov -This connection is a -.Em Dov (Data over Voice) -connection. -The b1protocol keyword must be set to -.Em hdlc . -This feature is experimental and does work on outgoing calls only. -.El -.It Li budget-calloutperiod -is used to specify a time period in seconds. -Within this period, the number of calls -specified by -.Em budget-calloutncalls -are allowed to succeed, any further attempt to call out will be blocked for the rest -of the time left in the time period. -(optional) -.It Li budget-calloutncalls -The number of outgoing calls allowed within the time period specified by -.Em budget-calloutperiod . -(optional) -.It Li budget-calloutsfile -A path/filename to which the number of successful callouts are written. -The contents of the file is preserved when it exists during startup of isdnd. -The format of this file is: start time, last update time, number of calls. -(optional) -.It Li budget-calloutsfile-rotate -If set to -.Em on -rotate budget-calloutsfile every night when an attempt is made to update -the file on a new day. -The statistics for the previous day are written to -a file with the filename specified by budget-calloutsfile to which a hyphen -and the new day's (!) day of month number is appended. -(optional) -.It Li budget-callbackperiod -.It Li budget-callbackncalls -.It Li budget-callbacksfile -.It Li budget-calloutsfile-rotate -See -.Em budget-calloutperiod , -.Em budget-calloutncalls , -.Em budget-calloutsfile , -and -.Em budget-calloutsfile-rotate -above. -These are used to specify the budgets for calling back a remote site. -.It Li callbackwait -The time in seconds to wait between hanging up the call from a remote site -and calling back the remote site. -(optional) -.It Li calledbackwait -The time in seconds to wait for a remote site calling back the local site -after a call from the local site to the remote site has been made. -(optional) -.It Li clone -This causes the contents of the specified entry to be copied from the -existing named entry to the current one. -When using this feature at least a new entry specific -.Ql name -and -.Ql usrdeviceunit -value should be specified for the current entry. -.It Li connectprog -specifies a program run every time after a connection is established and -address negotiation is complete (i.e.: the connection is usable). -.Nm Isdnd -expects to find the program below the path -.Pa /etc/isdn -which is prepended to the string specified as a parameter to this keyword. -The programs specified by connect and disconnect will get the following -command line arguments: -d (device) -f (flag) [ -a (addr) ] where -.Em device -is the name of device, e.g.\& "isp0", -.Em flag -will be "up" if connection just got up, or "down" if interface changed to down -state and -.Em addr -the address that got assigned to the interface as a dotted-quad ip address -(optional, only if it can be figured out by isdnd). -(optional) -.It Li dialin-reaction -Used to specify what to do when an incoming connection request is received. -The keyword is mandatory. -The currently supported parameters are: -.Pp -.Bl -tag -width calledback -compact -.It Ar accept -Accept an incoming call. -.It Ar reject -Reject an incoming call. -.It Ar ignore -Ignore an incoming call. -.It Ar answer -Start telephone answering for an incoming voice call. -.It Ar callback -When a remote site calls, hang up and call back the remote site. -.El -.It Li dialout-type -This keyword is used to configure what type of dialout mode is used. -The keyword is mandatory. -The currently supported parameters are: -.Pp -.Bl -tag -width Ds -compact -.It Ar normal -Normal behavior, call the remote site which is supposed to accept the call. -.It Ar calledback -Callback behavior, call the remote side which rejects the call and calls -us back. -.El -.It Li dialrandincr -When dialing or re-dialing and this parameter is set to -.Em on , -the dial retry time is added with a random value (currently 0...3 seconds) -to minimize the chance of two sites dialing synchronously so each gets a busy -each time it dials because the other side is also dialing. -.It Li dialretries -The number of dialing retries before giving up. -Setting this to -.Em -1 -gives an unlimited number of retries! -(optional) -.It Li direction -This keyword is used to configure if incoming and outgoing, incoming-only or -outgoing only connections are possible. -The keyword is optional, the default is -.Em inout . -.Pp -The currently supported parameters are: -.Pp -.Bl -tag -width Ds -compact -.It Ar inout -Normal behavior, connection establishment is possible from remote and local. -.It Ar in -Only incoming connections are possible. -.It Ar out -Only outgoing connections are possible. -.El -.It Li disconnectprog -specifies a program run every time after a connection was shut down. -.Nm Isdnd -expects to find the program below the path -.Pa /etc/isdn -which is prepended to the string specified as a parameter to this keyword. -(optional) -.It Li downtries -is used to configure the number of unsuccessful tries (= retry cycles!) before -the interface is disabled (for -.Em downtime -seconds). -(see also the keyword -.Em usedown -further up). -This keyword is optional. -.It Li downtime -is used to configure the time in seconds an interface is disabled -after the configured number of -.Em downtries . -(see also the keyword -.Em usedown -further up). -This keyword is optional and is set to 60 seconds by default. -.It Li earlyhangup -A (safety) time in seconds which specifies the time to hang up before an -expected next charging unit will occur. -(optional) -.It Li idle-algorithm-outgoing -The algorithm used to determine when to hang up an outgoing call when the -line becomes idle. -The current algorithms are: -.Pp -.Bl -tag -width calledback -compact -.It Ar fix-unit-size -idle algorithm which assumes fixed sized charging units during the whole call. -.It Ar var-unit-size -idle algorithm which assumes that the charging is time based after the first -units time has expired. -.El -.It Li idletime-outgoing -The time in seconds an outgoing connection must be idle before hanging up. -An idle timeout of zero disables this functionality. -(optional) -.It Li idletime-incoming -The time in seconds an incoming connection must be idle before hanging up. -An idle timeout of zero disables this functionality. -(optional) -.It Li isdncontroller -The ISDN controller number to be used for connections for this entry. -(mandatory) -.It Li isdnchannel -The ISDN controller channel number to be used for connections for this entry. -In case a channel is explicitly selected here, the SETUP message will request -this channel but mark the request as -.Em preferred -(the indicated channel is preferred) instead of exclusive (only the indicated -channel is acceptable). -Thus the exchange is still free to select another -than the requested channel! -(mandatory) -.It Li isdntxdel-incoming -A delay value suitable for the -.Xr timeout 9 -kernel subroutine to delay the transmission of the first packet after a -successful connection is made by this value for -.Em incoming -ISDN connections. -The specification unit is 1/100 second. -A zero (0) disables -this feature and is the default value. -This feature is implemented (and makes -sense only) for the -.Xr i4bipr 4 -IP over raw HDLC ISDN driver. -(optional) -.It Li isdntxdel-outgoing -A delay value suitable for the -.Xr timeout 9 -kernel subroutine to delay the transmission of the first packet after a -successful connection is made by this value for -.Em outgoing -ISDN connections. -The specification unit is 1/100 second. -A zero (0) disables -this feature and is the default value. -This feature is implemented (and makes -sense only) for the -.Xr i4bipr 4 -IP over raw HDLC ISDN driver. -(optional) -.It Li local-phone-dialout -The local telephone number used when the local site dials out. -When dialing -out to a remote site, the number specified here is put into the -.Em "Calling Party Number Information Element" . -.Pp -This keyword is mandatory for the -.Em ipr -user-land interfaces. -.It Li local-subaddr-dialout -The local subaddress used when the local site dials out. -When dialing -out to a remote site, the subaddress specified here is put into the -.Em "Calling Party Subaddress Information Element" . -.Pp -This keyword is mandatory for the -.Em ipr -user-land interfaces. -.It Li local-phone-incoming -The local telephone number used for verifying the destination of incoming -calls. -When a remote site dials in, this number is used to verify that it -is the local site which the remote site wants to connect to. -It is compared -with the -.Em "Called Party Number Information Element" -got from the telephone exchange. -.Pp -This keyword is mandatory for the -.Em ipr -interfaces. -.It Li local-subaddr-incoming -The local subaddress used for verifying the destination of incoming -calls. -When a remote site dials in, this subaddress is used to verify that it -is the local site which the remote site wants to connect to. -It is compared -with the -.Em "Called Party Subaddress Information Element" -got from the telephone exchange. -.Pp -This keyword is mandatory for the -.Em ipr -interfaces. -.It Li name -Defines a symbolic name for this configuration entry. -Its purpose is to -use this name in the full-screen display for easy identification of a link -to a remote site and for accounting purposes. -(mandatory) -.It Li maxconnecttime -Specify a maximum connection time in seconds. -Use this to define an absolute -upper limit for a connection on the B-channel to last. -.Em CAUTION: -This feature is used to limit the connection time, _not_ number of attempts -to establish a connection: when using this please take care to also enable -the use of budgets to limit the connection establish attempts (otherwise -the line will cycle thru an endless loop of connections and reconnections -which will have an undesired effect on your telco bill)! -.It Li ppp-auth-paranoid -If set to -.Em no , -the remote site is not required to prove its authentity for connections -that are initiated by the local site. -The default is -.Em yes -and requires the remote site to always authenticate. -.Pp -This keyword is only used if -.Em ppp-send-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-auth-rechallenge -Set to -.Em no , -if the other side does not support re-challenging for chap. -The default is -.Em yes , -which causes verification of the remote site's authentity once in a while. -.Pp -This keyword is only used if -.Em ppp-expect-auth -has been set to chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-expect-auth -The local site expects the authentity of the remote site to be proved by -the specified method. -The supported methods are: -.Pp -.Bl -tag -width Ds -compact -.It Ar none -Do not require the other side to authenticate. -Typical uses are dial-out to an ISP -(many ISPs do not authenticate themselves to clients) -or offering anonymous dial-in at the local site. -.It Ar chap -The preferred authentication method, which does not require a password to be sent -in the clear. -.It Ar pap -The unprotected authentication method, which allows anybody watching the wire -to grab name and password. -.El -.Pp -If -.Em ppp-auth-paranoid -is set to -.Em no -(the default is -.Em yes ) -outgoing connections will not require the remote site to authenticate itself. -.Pp -This keyword is only used for the -.Em isp -PPP interfaces. -(optional) -.It Li ppp-expect-name -The name that has to be provided by the remote site to prove its authentity. -.Pp -This keyword is only used if -.Em ppp-expect-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-expect-password -The secret that has to be provided by the remote site to prove its authentity. -.Pp -This keyword is only used if -.Em ppp-expect-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-send-auth -The authentication method required by the remote site. -The currently supported parameters are: -.Pp -.Bl -tag -width Ds -compact -.It Ar none -The remote site does not expect or support authentication. -.It Ar chap -The preferred authentication method, which does not require a password to be sent -in the clear. -.It Ar pap -The unprotected authentication method, which allows anybody watching the wire -to grab name and password. -.El -.Pp -This keyword is only used for the -.Em isp -PPP interfaces. -(optional) -.It Li ppp-send-name -The authentication name sent to the remote site. -.Pp -This keyword is only used if -.Em ppp-send-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-send-password -The secret used to prove the local site's authentity to the remote site. -.Pp -This keyword is only used if -.Em ppp-send-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ratetype -The rate entry used from the rates file. -(optional) -.Pp -For example, ratetype=0 selects lines beginning "ra0" in /etc/isdn/isdnd.rates; -(typically ra0 lines are a set of tables for local call rates on different -days of the week & times per day). -.It Li recoverytime -The time in seconds to wait between dial retries. -(optional) -.It Li remdial-handling -is used to specify the dialout behavior in case more than one outgoing -number is specified. -The currently supported parameters are: -.Pp -.Bl -tag -width Ds -compact -.It Ar first -For every new (non-retry) call setup, start with the first number. -.It Ar last -For every new (non-retry) call setup, start with the last number with -which a successful connection was made. -.It Ar next -For every new (non-retry) call setup, start with the next number which -follows the last one used. -.El -.It Li remote-phone-dialout -The remote telephone number used when the local site dials out. -When dialing -out to a remote site, the number specified here is put into the -.Em "Called Party Number Information Element" . -.Pp -This keyword is mandatory for the -.Em ipr -interfaces. -It may be specified more than once to try to dial to several -numbers until one succeeds. -.It Li remote-subaddr-dialout -The remote subaddress used when the local site dials out. -When dialing -out to a remote site, the subaddress specified here is put into the -.Em "Called Party Subaddress Information Element" . -.Pp -This keyword is mandatory for the -.Em ipr -interfaces. -It may be specified more than once to linked it to the -remote-phone-dialout numbers until one succeeds. -.It Li remote-phone-incoming -The remote telephone number used to verify an incoming call. -When a remote site -dials in, this number is used to verify that it is the correct remote site -which is herewith authorized to connect into the local system. -This parameter -is compared against the -.Em "Calling Party Number Information Element" -got from the telephone exchange. -.Pp -This keyword is mandatory for the ipr interfaces. -.Pp -This keyword may have a wildcard parameter '*' to permit anyone dialing in. -.It Li remote-subaddr-incoming -The remote subaddress used to verify an incoming call. -When a remote site -dials in, this subaddress is used to verify that it is the correct remote site -which is herewith authorized to connect into the local system. -This parameter -is compared against the -.Em "Calling Party Subaddress Information Element" -got from the telephone exchange. -.Pp -This keyword is mandatory for the ipr interfaces. -.Pp -This keyword may have a wildcard parameter '*' to permit anyone dialing in. -.It Li unitlength -The length of a charging unit in seconds. -This is used in conjunction with -the idletime to decide when to hang up a connection. -(optional) -.It Li unitlengthsrc -This keyword is used to specify from which source -.Xr isdnd 8 -takes the unitlength for short-hold mode. -The currently configurable values are: -.Pp -.Bl -tag -width Ds -compact -.It Ar none -Then unitlength is not specified anywhere. -.It Ar cmdl -Use the unitlength specified on the command line. -.It Ar conf -Use the unitlength specified in the configuration file with the keyword -.Em unitlength . -.It Ar rate -Use the unitlength from the ratesfile specified in the configuration -file with the keyword -.Em ratetype . -.It Ar aocd -Use a dynamically calculated unitlength in case AOCD is subscribed on -the ISDN line. -(AOCD is an acronym for ``Advice Of Charge During the call'' -which is a service provided by the telecommunications (ie phone) provider, -to indicate billable units). -.El -.It Li usrdevicename -Specifies the user-land interface which is used for interfacing ISDN B channel -data to the user-land. -The keyword is mandatory. -This keyword accepts the following parameters: -.Pp -.Bl -tag -width Ds -compact -.It Ar ipr -This parameter configures a raw HDLC IP over ISDN interface. -.It Ar isp -This parameter configures a synchronous PPP over ISDN interface. -.It Ar rbch -This specifies a Raw B CHannel access interface. -.It Ar tel -ISDN telephony. -.It Ar ing -configures an ISDN B-channel to NetGraph interface. -.El -.It Li usrdeviceunit -Specifies the unit number for the device which is specified with -usrdevicename. -.It Li usedown -is used to enable the use of the keywords -.Em downtries -and -.Em downtime -in the entries section(s). -It is used in the -.Nm isdnd -daemon to dynamically enable and disable the IP interfaces to avoid excessive -dialing activities in case of transient failures (such as busy lines). -This parameter is optional and is set to -.Em off -by default. -.It Li usesubaddr -is used to enable the use of subaddresses. -This parameter is optional and is set to -.Em off -by default. -.It Li valid -.Em Note : -this feature is considered experimental! -The parameter to this keyword is a string specifying a time range within -which this entry is valid. -The time specification consists of a list of weekdays and/or a holiday -indicator ( see also the -.Em holidayfile -keyword in the system section ) separated by commas followed by an optional -daytime range specification in the form hh:mm-hh:mm. -The weekdays are specified as numbers from 0 to 6 and the number 7 for -holidays: -.Pp -.Bl -tag -width Ds -compact -.It Ar 0 -Sunday -.It Ar 1 -Monday -.It Ar 2 -Tuesday -.It Ar 3 -Wednesday -.It Ar 4 -Thursday -.It Ar 5 -Friday -.It Ar 6 -Saturday -.It Ar 7 -a Holiday -.El -.Pp -The following examples describe the "T-ISDN xxl" tariff of the german Telekom: -.Bl -tag -width Ds -compact -.It Ar 1,2,3,4,5,6,09:00-18:00 -Monday through Saturday, daytime 9:00 to 18:00 -.It Ar 1,2,3,4,5,6,18:00-9:00 -Monday through Saturday, nighttime 18:00 to 9:00 -.It Ar 0,7 -Sunday and on holidays, all 24 hours -.El -.Pp -The use of this keyword is optional. -.El -.El -.Sh IDLETIME CALCULATION AND SHORT-HOLD MODE -.Bl -tag -width "incoming calls -.It Li incoming calls -It is assumed that the calling side knows most about charging structures and -such and as a consequence only the keyword -.Em idletime-incoming -has a function for incoming calls. -.Pp -For incoming calls the line is constantly monitored, and in case there was -not traffic taking place for the time in seconds specified by -.Em idletime-incoming -the call is closed. -.Pp -Typically, -.Em idletime-incoming -is used as a last resort and is therefore set much higher than a charging -unit time: typical values are one to five minutes. -.It Li outgoing calls -Outgoing call disconnect time can be setup in one of three ways: -.Bl -tag -width "shorthold mode -.It Li simple mode -For simple mode, the -.Em idle-algorithm-outgoing -must be -.Em fix-unit-size -and the selected -.Em unitlength -must be 0 (zero) and -.Em idletime-outgoing -greater zero. -.Pp -The outgoing traffic is constantly monitored, and in case there was -not traffic taking place for the time in seconds specified by -.Em idletime-outgoing -the call is closed. -.Pp -Typical values in simple mode are 10 to 30 seconds. -.It Li shorthold mode for fixed unit charging -For shorthold mode, the -.Em idle-algorithm-outgoing -must be -.Em fix-unit-size -and the selected -.Em unitlength -and -.Em idletime-outgoing -must be greater than 0 (zero); -.Em earlyhangup -must be >= 0 (zero). -.Bd -literal -|||| -| | | | -+------------------+-------------+--------------+ -| | | | -| |<-idle-time->|| -|<--------------unitlength--------------------->| -.Ed -.Pp -During the unchecked window which is (unitlength - (idle-time+earlyhangup)) -in length, no idle check is done. -After the unchecked window has ended, -the line is checked for idle-time length if no traffic takes place. -In case -there was traffic detected in the check-window, the same procedure is restarted -at the beginning of the next unit. -In case no traffic was detected during -the check-window, the line is closed at the end of the check window. -.Pp -Notice: -.Em unitlength -must (!) be greater than the sum of -.Em idletime-outgoing -and -.Em earlyhangup ! -.It Li shorthold mode for variable unit charging -For shorthold mode, the -.Em idle-algorithm-outgoing -must be -.Em var-unit-size -and the selected -.Em unitlength -and -.Em idletime-outgoing -must be greater than 0 (zero); -.Pp -This shorthold mode is suitable when your calls are billed on -the elapse time of the call plus a fixed connection charge. -For example British Telecom bill this way. -.Pp -Each call is divided into two periods, the first is the -.Em unchecked -period and the second is the -.Em checked . -The -.Em checked -period starts 1 second before the first units time expires. -.Pp -During the -.Em checked -period if there is no traffic for -.Em idle-time -seconds the call is disconnected. -.Pp -.Bd -literal -|<---unchecked------------------>|<------checked------> -+------------------+-------------+ -| |<-idle-time->| -|<--------------unitlength------->| -.Ed -.Pp -Experience shows that useful values for idle-time are from 15 to 30 seconds. -.Pp -If idle-time is too short an application that is not yet finished with the -network will cause a new call to be placed. -.Pp -.El -.El -.Sh FILES -.Bl -tag -width /etc/isdn/isdnd.rc -compact -.It Pa /etc/isdn/isdnd.rc -The default configuration file for the -.Nm isdnd -ISDN daemon. -.El -.Sh SEE ALSO -.Xr regex 3 , -.Xr re_format 7 , -.Xr isdnd 8 , -.Xr isdnmonitor 8 -.Sh AUTHORS -.An -nosplit -The -.Xr isdnd 8 -daemon and this manual page were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Pp -Additions to this manual page by -.An Barry Scott Aq barry@scottb.demon.co.uk . diff --git a/usr.sbin/i4b/isdnd/log.c b/usr.sbin/i4b/isdnd/log.c deleted file mode 100644 index 41179091d176..000000000000 --- a/usr.sbin/i4b/isdnd/log.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - logging routines - * ----------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:07:18 2006] - * - *---------------------------------------------------------------------------*/ - -#ifdef __FreeBSD__ -#include -#endif - -#include "isdnd.h" - -#define LOGBUFLEN 256 - -extern int do_monitor; -extern int accepted; -extern FILE *logfp; - -static void check_reg(char *logstring); - -struct logtab { - char *text; - int pri; -}; - -/*---------------------------------------------------------------------------* - * table for converting internal log levels into syslog levels - *---------------------------------------------------------------------------*/ -static struct logtab logtab[] = { - {"ERR", LOG_ERR}, /* error conditions */ - {"WRN", LOG_WARNING}, /* warning conditions, nonfatal */ - {"DMN", LOG_NOTICE}, /* significant conditions of the daemon */ - {"CHD", LOG_INFO}, /* informational, call handling */ - {"DBG", LOG_DEBUG}, /* debug messages */ - {"MER", LOG_ERR}, /* monitor error conditions */ - {"PKT", LOG_INFO} /* packet logging */ -}; - -/*---------------------------------------------------------------------------* - * initialize logging - *---------------------------------------------------------------------------*/ -void -init_log(void) -{ - int i; - - if(uselogfile) - { - if((logfp = fopen(logfile, "a")) == NULL) - { - fprintf(stderr, "ERROR, cannot open logfile %s: %s\n", - logfile, strerror(errno)); - exit(1); - } - - /* set unbuffered operation */ - - setvbuf(logfp, (char *)NULL, _IONBF, 0); - } - else - { -#if DEBUG - if(do_debug && do_fork == 0 && do_fullscreen == 0) - (void)openlog("isdnd", - LOG_PID|LOG_CONS|LOG_NDELAY|LOG_PERROR, - logfacility); - else -#endif - (void)openlog("isdnd", LOG_PID|LOG_CONS|LOG_NDELAY, - logfacility); - } - - /* initialize the regexp array */ - - for(i = 0; i < MAX_RE; i++) - { - char *p; - char buf[64]; - - snprintf(buf, sizeof(buf), "%s%d", REGPROG_DEF, i); - - rarr[i].re_flg = 0; - - if((p = malloc(strlen(buf) + 1)) == NULL) - { - llog(LL_DBG, "init_log: malloc failed: %s", strerror(errno)); - do_exit(1); - } - - strcpy(p, buf); - - rarr[i].re_prog = p; - } -} - -/*---------------------------------------------------------------------------* - * finish logging - *---------------------------------------------------------------------------*/ -void -finish_log(void) -{ - if(uselogfile && logfp) - { - fflush(logfp); - fclose(logfp); - } - else - { - (void)closelog(); - } -} - -/*---------------------------------------------------------------------------* - * place entry into logfile - *---------------------------------------------------------------------------*/ -void -llog(int what, const char *fmt, ...) -{ - char buffer[LOGBUFLEN]; - register char *dp; - va_list ap; - - va_start(ap, fmt); - vsnprintf(buffer, LOGBUFLEN-1, fmt, ap); - va_end(ap); - - dp = getlogdatetime(); /* get time string ptr */ - -#ifdef USE_CURSES - - /* put log on screen ? */ - - if((do_fullscreen && curses_ready) && - ((!debug_noscreen) || (debug_noscreen && (what != LL_DBG)))) - { - wprintw(lower_w, "%s %s %-.*s\n", dp, logtab[what].text, - -/* - * FreeBSD-current integrated ncurses. Since then it is no longer possible - * to write to the last column in the logfilewindow without causing an - * automatic newline to occur resulting in a blank line in that window. - */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 400009 -#warning "FreeBSD ncurses is buggy: write to last column = auto newline!" - COLS-((strlen(dp))+(strlen(logtab[what].text))+3), buffer); -#else - (int)(COLS-((strlen(dp))+(strlen(logtab[what].text))+2)), buffer); -#endif - wrefresh(lower_w); - } -#endif - -#ifdef I4B_EXTERNAL_MONITOR - if(what != LL_MER) /* don't send monitor errs, endless loop !!! */ - monitor_evnt_log(logtab[what].pri, logtab[what].text, buffer); -#endif - - if(uselogfile) - { - fprintf(logfp, "%s %s %s\n", dp, logtab[what].text, buffer); - } - else - { - register char *s = buffer; - - /* strip leading spaces from syslog output */ - - while(*s && (*s == ' ')) - s++; - - syslog(logtab[what].pri, "%s %s", logtab[what].text, s); - } - - -#if DEBUG - if(what != LL_DBG) /* don't check debug logs, endless loop !!! */ -#endif - check_reg(buffer); -} - -/*---------------------------------------------------------------------------* - * return ptr to static area containing date/time - *---------------------------------------------------------------------------*/ -char * -getlogdatetime() -{ - static char logdatetime[41]; - time_t tim; - register struct tm *tp; - - tim = time(NULL); - tp = localtime(&tim); - strftime(logdatetime,40,I4B_TIME_FORMAT,tp); - return(logdatetime); -} - -/*---------------------------------------------------------------------------* - * check for a match in the regexp array - *---------------------------------------------------------------------------*/ -static void -check_reg(char *logstring) -{ - register int i; - - for(i = 0; i < MAX_RE; i++) - { - if(rarr[i].re_flg && (!regexec(&(rarr[i].re), logstring, (size_t) 0, NULL, 0))) - { - char* argv[3]; - argv[0] = rarr[i].re_prog; - argv[1] = logstring; - argv[2] = NULL; - - exec_prog(rarr[i].re_prog, argv); - break; - } - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/main.c b/usr.sbin/i4b/isdnd/main.c deleted file mode 100644 index df531b703210..000000000000 --- a/usr.sbin/i4b/isdnd/main.c +++ /dev/null @@ -1,840 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - main program entry - * ------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:03:56 2006] - * - *---------------------------------------------------------------------------*/ - -#include -#include - -#ifdef I4B_EXTERNAL_MONITOR -#include "monitor.h" -#endif - -#define MAIN -#include "isdnd.h" -#undef MAIN - -#ifdef I4B_EXTERNAL_MONITOR - -#ifdef I4B_NOTCPIP_MONITOR -/* monitor via local socket */ -static void mloop(int sockfd); -#else /* I4B_NOTCPIP_MONITOR */ -/* monitor via local and tcp/ip socket */ -static void mloop(int localsock, int remotesock); -#endif /* I4B_NOTCPIP_MONITOR */ - -#else /* I4B_EXTERNAL_MONITOR */ -/* no monitoring at all */ -static void mloop(); -#endif /* I4B_EXTERNAL_MONITOR */ - -#ifdef USE_CURSES -static void kbdrdhdl(void); -#endif - -static void isdnrdhdl(void); -static void usage(void); - -#define MSG_BUF_SIZ 1024 /* message buffer size */ - -/*---------------------------------------------------------------------------* - * usage display and exit - *---------------------------------------------------------------------------*/ -static void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdnd - i4b ISDN manager daemon, version %02d.%02d.%d\n", VERSION, REL, STEP); -#ifdef DEBUG - fprintf(stderr, " usage: isdnd [-c file] [-d level] [-F] [-f [-r dev] [-t termtype]]\n"); -#else - fprintf(stderr, " usage: isdnd [-c file] [-F] [-f [-r dev] [-t termtype]]\n"); -#endif - fprintf(stderr, " [-l] [-L file] [-m] [-s facility] [-u time]\n"); - fprintf(stderr, " -c configuration file name (def: %s)\n", CONFIG_FILE_DEF); -#ifdef DEBUG - fprintf(stderr, " -d set debug flag bits:\n"); - fprintf(stderr, " general = 0x%04x, rates = 0x%04x, timing = 0x%04x\n", DL_MSG, DL_RATES, DL_TIME); - fprintf(stderr, " state = 0x%04x, retry = 0x%04x, dial = 0x%04x\n", DL_STATE, DL_RCVRY, DL_DIAL); - fprintf(stderr, " process = 0x%04x, kernio = 0x%04x, ctrlstat = 0x%04x\n", DL_PROC, DL_DRVR, DL_CNST); - fprintf(stderr, " rc-file = 0x%04x, budget = 0x%04x, valid = 0x%04x\n", DL_RCCF, DL_BDGT, DL_VALID); - fprintf(stderr, " -dn no debug output on fullscreen display\n"); -#endif - fprintf(stderr, " -f fullscreen status display\n"); - fprintf(stderr, " -F do not become a daemon process\n"); - fprintf(stderr, " -l use a logfile instead of syslog\n"); - fprintf(stderr, " -L use file instead of %s for logging\n", LOG_FILE_DEF); - fprintf(stderr, " -P pretty print real config to stdout and exit\n"); - fprintf(stderr, " -r redirect output to other device (for -f)\n"); - fprintf(stderr, " -s use facility instead of %d for syslog logging\n", LOG_LOCAL0 >> 3); - fprintf(stderr, " -t terminal type of redirected screen (for -f)\n"); - fprintf(stderr, " -u