2007年3月30日 星期五

quadBRI mini PCI ISDN

http://www.voip-info.org/wiki/index.php?page=BRI


http://www.ciscopress.com/articles/article.asp?p=29737&seqNum=3&rl=1


1.quadBRI mini PCI card. http://www.junghanns.net
2.Download driver : bristuff-0.3.0-PRE-1y-d.tar.gz
3.Download zaptel : zaptel-1.2.16.tar.gz
4.Build zaptel

FIX Makefile for platform and target running kernel

cp bristuff-0.3.0-PRE-1y-d/patches/zaptel.patch .
cd zaptel-1.2.16
patch -p1 < ../zaptel.patch

[gigijoe@localhost zaptel-1.2.16]$ CC=mipsel-linux-gcc AR=mipsel-linux-ar LD=mipsel-linux-ld KVERS=2.4.31 KSRC=../../linux_2_4_31 make
mipsel-linux-gcc -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I. -O4 -g -Wall -DZAPTEL_CONFIG=\"/etc/zaptel.conf\" -c -o gendigits.o gendigits.c
mipsel-linux-gcc -o gendigits gendigits.o -lm
./gendigits > tones.h
/bin/sh: ./gendigits: cannot execute binary file
make: *** [tones.h] Error 126
[gigijoe@localhost zaptel-1.2.16]$ gcc -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I. -O2 -g -Wall -DZAPTEL_CONFIG=\"/etc/zaptel.conf\" -c -o gendigits.o gendigits.c
[gigijoe@localhost zaptel-1.2.16]$ gcc -o gendigits gendigits.o -lm
[gigijoe@localhost zaptel-1.2.16]$ CC=mipsel-linux-gcc AR=mipsel-linux-ar LD=mipsel-linux-ld KVERS=2.4.31 KSRC=../../linux_2_4_31 make ./gendigits > tones.h
mipsel-linux-gcc -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I. -O2 -g -Wall -DZAPTEL_CONFIG=\"/etc/zaptel.conf\" makefw.c -o makefw
./makefw tormenta2.rbt tor2fw > tor2fw.h
/bin/sh: ./makefw: cannot execute binary file
make: *** [tor2fw.h] Error 126
[gigijoe@localhost zaptel-1.2.16]$ gcc -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I. -O2 -g -Wall -DZAPTEL_CONFIG=\"/etc/zaptel.conf\" makefw.c -o makefw
[gigijoe@localhost zaptel-1.2.16]$ ./makefw tormenta2.rbt tor2fw > tor2fw.h
Loaded 69900 bytes from file
[gigijoe@localhost zaptel-1.2.16]$ gcc -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I. -O2 -g -Wall -DZAPTEL_CONFIG=\"/etc/zaptel.conf\" makefw.c -o makefw
[gigijoe@localhost zaptel-1.2.16]$ CC=mipsel-linux-gcc AR=mipsel-linux-ar LD=mipsel-linux-ld KVERS=2.4.31 KSRC=../../linux_2_4_31 make

End up with error, but it's ok.
What we need are zaptel.o and zaptel-base.o

5.Build qozap

cd bristuff-0.3.0-PRE-1y-d/qozap

FIX Makefile for platform and target running kernel
[gigijoe@localhost qozap]$ make
mipsel-linux-gcc -c qozap.c -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -DRELAXED_LOCKING -fomit-frame-pointer -O2 -Wall -I/home/gigijoe/ECS040/linux_2_4_31/include -I../../zaptel-1.2.16 -D__LINUX__ -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wparentheses -O2 -G 0 -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-abicalls -fno-pic -pipe -mips2 -Wa,--trap -Wa,--trap -D__linux__ -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 -D_MIPS_SZINT=32 -D__MIPSEL__ -DUTS_MACHINE='mips' -mlong-calls -DMODVERSIONS -include /home/gigijoe/ECS040/linux_2_4_31/include/linux/modversions.h

Now you have qozap.o

6.Insert modules

/tmp # insmod zaptel.o
Using zaptel.o
Zapata Telephony Interface Registered on major 196
Zaptel Version: 1.2.16
Zaptel Echo Canceller: MG2

/tmp # insmod zaptel-base.o
Using zaptel-base.o
Zapata Telephony Interface Registered on major 196
Zaptel Version: 1.2.16
Zaptel Echo Canceller: MG2

/tmp # insmod qozap.o
Using qozap.o
qozap: S/T ports: 2 [ TE TE ]
qozap: 1 multiBRI card(s) in this box, 0 BRI ports total, bloop 0, pcmslave 0.

7.Build ztcfg

[gigijoe@localhost zaptel-1.2.16]$ CC=mipsel-linux-gcc AR=mipsel-linux-ar LD=mipsel-linux-ld KVERS=2.4.31 KSRC=../../linux_2_4_31 make ztcfg mipsel-linux-gcc -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I. -O2 -g -Wall -DZAPTEL_CONFIG=\"/etc/zaptel.conf\" -c -o ztcfg.o ztcfg.c
mipsel-linux-gcc -c -fPIC -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I. -O2 -g -Wall -DBUILDING_TONEZONE -o zonedata.lo zonedata.c
mipsel-linux-gcc -c -fPIC -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I. -O2 -g -Wall -DBUILDING_TONEZONE -o tonezone.lo tonezone.c
ar rcs libtonezone.a zonedata.lo tonezone.lo
mipsel-linux-gcc -o ztcfg ztcfg.o libtonezone.a -lm

8.Create device node
http://lists.digium.com/pipermail/asterisk-bsd/2005-April/000744.html


http://lists.digium.com/pipermail/asterisk-users/2003-February/000638.html



/tmp # mkdir /dev/zap
/tmp # mknod /dev/zap/ctl c 196 0
/tmp # mknod /dev/zap/channel c 196 254


9.Configure zaptel

/tmp # ./ztcfg -c zaptel.conf.quadBRI -vvvv -d 3 -a
Line 1: loadzone=nl
Line 2: defaultzone=nl
Line 5: span=1,1,3,ccs,ami
Line 6: span=2,2,3,ccs,ami
Line 7: span=3,3,3,ccs,ami
Line 8: span=4,4,3,ccs,ami
Line 10: bchan=1,2
Line 11: dchan=3
Line 12: bchan=4,5
Line 13: dchan=6
Line 14: bchan=7,8
Line 15: dchan=9
Line 16: bchan=10,11
Line 17: dchan=12


Zaptel Configuration
======================

SPAN 1: CCS/ AMI Build-out: 399-533 feet (DSX-1)
SPAN 2: CCS/ AMI Build-out: 399-533 feet (DSX-1)
SPAN 3: CCS/ AMI Build-out: 399-533 feet (DSX-1)
SPAN 4: CCS/ AMI Build-out: 399-533 feet (DSX-1)

Channel map:

Channel 01: Clear channel (Default) (Slaves: 01)
Channel 02: Clear channel (Default) (Slaves: 02)
Channel 03: D-channel (Default) (Slaves: 03)
Channel 04: Clear channel (Default) (Slaves: 04)
Channel 05: Clear channel (Default) (Slaves: 05)
Channel 06: D-channel (Default) (Slaves: 06)
Channel 07: Clear channel (Default) (Slaves: 07)
Channel 08: Clear channel (Default) (Slaves: 08)
Channel 09: D-channel (Default) (Slaves: 09)
Channel 10: Clear channel (Default) (Slaves: 10)
Channel 11: Clear channel (Default) (Slaves: 11)
Channel 12: D-channel (Default) (Slaves: 12)

12 channels configured.

Changing signalling on channel 1 from Unused to Clear channel
Changing signalling on channel 2 from Unused to Clear channel
Changing signalling on channel 3 from Unused to HDLC with FCS check
Changing signalling on channel 4 from Unused to Clear channel
Changing signalling on channel 5 from Unused to Clear channel
Changing signalling on channel 6 from Unused to HDLC with FCS check
Changing signalling on channel 7 from Unused to Clear channel
Changing signalling on channel 8 from Unused to Clear channel
Changing signalling on channel 9 from Unused to HDLC with FCS check
Changing signalling on channel 10 from Unused to Clear channel
Changing signalling on channel 11 from Unused to Clear channel
Changing signalling on channel 12 from Unused to HDLC with FCS check
Registered tone zone 3 (Netherlands)



10.Patch and build libpri-1.2.4
cp bristuff-0.3.0-PRE-1y-e/patches/libpri.patch .
cd libpri-1.2.4
patch -p1 < ../libpri.patch


Edit Makefile for mipsel cross compile


make


[gigijoe@localhost libpri-1.2.4]$ make
mipsel-linux-gcc -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -c -o copy_string.o copy_string.c
mipsel-linux-gcc -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -c -o pri.o pri.c
mipsel-linux-gcc -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -c -o q921.o q921.c
q921.c: In function `__q921_receive_qualified':
q921.c:1429: warning: `tei' might be used uninitialized in this function
mipsel-linux-gcc -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -c -o prisched.o prisched.c
mipsel-linux-gcc -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -c -o q931.o q931.c
mipsel-linux-gcc -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -c -o pri_facility.o pri_facility.c
ar rcs libpri.a copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o
ranlib libpri.a
mipsel-linux-gcc -fPIC -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -o copy_string.lo -c copy_string.c
mipsel-linux-gcc -fPIC -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -o pri.lo -c pri.c
mipsel-linux-gcc -fPIC -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -o q921.lo -c q921.c
q921.c: In function `__q921_receive_qualified':
q921.c:1429: warning: `tei' might be used uninitialized in this function
mipsel-linux-gcc -fPIC -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -o prisched.lo -c prisched.c
mipsel-linux-gcc -fPIC -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -o q931.lo -c q931.c
mipsel-linux-gcc -fPIC -G 0 -mips32 -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -DRELAX_TRB -DRELAXED_TIMERS -o pri_facility.lo -c pri_facility.c
mipsel-linux-gcc -shared -Wl,-hlibpri.so.1.0 -o libpri.so.1.0 copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo
/sbin/ldconfig -n .
ln -sf libpri.so.1.0 libpri.so
ln -sf libpri.so.1.0 libpri.so.1


11.Build zapate


Edit Makefile for mipsel cross compile and zaptel.h


[gigijoe@localhost zapata]$ make
mipsel-linux-gcc -Wall -Wstrict-prototypes -G 0 -mips32 -O2 -I../zaptel-1.2.16   -c -o goertzel.o goertzel.c
mipsel-linux-gcc -Wall -Wstrict-prototypes -G 0 -mips32 -O2 -I../zaptel-1.2.16   -c -o filtros.o filtros.c
In file included from filtros.c:33:
coef_in.h:9:8: warning: no newline at end of file
In file included from filtros.c:43:
coef_out.h:3:4: warning: no newline at end of file
mipsel-linux-gcc -Wall -Wstrict-prototypes -G 0 -mips32 -O2 -I../zaptel-1.2.16   -c -o demodulador.o demodulador.c
mipsel-linux-gcc -Wall -Wstrict-prototypes -G 0 -mips32 -O2 -I../zaptel-1.2.16   -c -o serie.o serie.c
mipsel-linux-gcc -Wall -Wstrict-prototypes -G 0 -mips32 -O2 -I../zaptel-1.2.16   -c -o baudot.o baudot.c
mipsel-linux-gcc -Wall -Wstrict-prototypes -G 0 -mips32 -O2 -I../zaptel-1.2.16   -c -o dpll.o dpll.c
mipsel-linux-gcc -Wall -Wstrict-prototypes -G 0 -mips32 -O2 -I../zaptel-1.2.16   -c -o tone_detect.o tone_detect.c
ar rcs libzap.a zap.o goertzel.o filtros.o demodulador.o serie.o baudot.o dpll.o tone_detect.o
ranlib libzap.a
mipsel-linux-gcc -shared -Wl,-soname,libzap.so.1 -o libzap.so.1.0 zap.o goertzel.o filtros.o demodulador.o serie.o baudot.o dpll.o tone_detect.o -lc -lm
/sbin/ldconfig -n .
rm -f libzap.so
ln -sf libzap.so.1 libzap.so




沒有留言:

張貼留言