Installing Dialogic Boards in Slackware Linux

Diego Betancor, dbetancor@thevoicebox.com

V0.1, May 2001

Doug declared at the linuxtelephony.org mailing list on May 5th, 2001:
"Haven't tried in Slackware (or anything besides RedHat) yet, so I can't say what will happen from there.   You're in untested and most definitely unsupported territory."

Please, take it as a warning: Dialogic only supports Red Hat 6.2. I DO NOT TAKE RESPONSIBILITY FOR WHAT HAPPENS IF YOU FOLLOW THESE INSTRUCTIONS, it is your responsibility and you are suppose to know what you are doing.

Other than that, have fun...

In GNU/Linux system is basically (like Unixes in general) a kernel (Linux), a libc and a bunch of programs like the bash, ls and the gcc (most of these come from the GNU world). All modern distributions have about the same kernel (2.2.x or 2.4.x), the same libc (2) and the same user-space programs. You can always compiled and install the latest. The sure not be any real problem to run in any of the distros.

To follow these instructions I suppose that you know a good deal of Linux, and a good deal of Dialogic. You are comfortable with the linus filesystem, startup scripts, the terminal, etc... You have work with Dialogic cards before: in Unix (not my case), WinNT or DOS; and have a good idea of what is going on (drivers and the like).

I used the steps below to install a D/41E-SC and a DTI/240-SC together. I may change the configuration or go for ISDN or put a D/300-SC. This procedure is as general as I can make it; if there are new items popping up, I will post them.


Pre-installation

1. First you need to have the System Release 5.0 for Linux. It is actually for Red Hat, but well. You have to go to Dialogic and get it. You may have to register.

2. In the documentation for this system release, we need the Software Installation Reference. Read it.

3. As a general rule, I prefer to have all the computer needs compiled in the kernel, not as modules, so when we do lsmod nothing should be there. Of course a compiled kernel is the first thing to do, to have one as tight and nice as possible; but this of course is my personal opinion. The Kernel HOWTO has instructions of how to do it.


Installation

4. First we need to install the LiS 2.8 (> LiS 2.8 may not work) as instructed in pages 9-10. Do not forget to answer yes to be backward compatible in stropts.h. Personally I prefer that it does not install the modules itself.
Now we should have /usr/lib/libLiS.so installed.

5. We do not need to load them now in a script. We just want to know that these modules load fine.
# insmod /usr/src/LiS/streams.o
# insmod /usr/src/LiS/drivers/str/linux/streams-ldl.o
# insmod /usr/src/LiS/drivers/str/linux/streams-sad.o
# insmod /usr/src/LiS/drivers/str/linux/streams-timod.o
# insmod /usr/src/LiS/drivers/str/linux/streams-tirdwr.o

   so:

# lsmod
Module Size Used by
streams-tirdwr 1604 0 (unused)
streams-timod 2712 0 (unused)
streams-sad 3644 0 (unused)
streams-ldl 34204 0 (unused)
streams 282000 0 [streams-tirdwr streams-timod streams-sad streams-ldl]

   Of all these for the Dialogic boards we only need streams.


6. The Dialogic distribution comes as a tarred archived that we open as usual in a subdirectory of our liking. We find:
DLGCdev-5.0-1.i386.rpm DLGCgc-2.01-1.i386.rpm DLGCpri-1.11-1.i386.rpm
DLGCant-5.0-1.i386.rpm DLGCdocs-5.0-1.i386.rpm DLGCparms-5.0-1.i386.rpm
and other files as dlgcinstall.

7. We need to open these files with rpm2cpio, to each one of the ones that we need:
# rpm2cpio DLGCdev-5.0-1.i386.rpm > dev.cpio


8. Now we have a bunch of cpio archives. We have to open them….We create a directory where we copy the cpios:
# mkdir cpio
# cp *.cpio cpio/
# cpio -i < doc.cpio
and we do cpios to the rest of the archives, we have a new subdirectory usr, let's go inside. Sometimes you have to create (mkdir usr) before this directory

# cd usr/

9. Here a subdirectory dialogic, how nice!, everything should be inside, bin/ data/ demo/, etc, etc, etc. We can move this directory wherever we want: Dialogic uses /usr , so there we put it. I advise to tar it:, and to keep it just in case (so much work already)
# tar cfvz dialogic_tar.gz dialogic/
All the files are copied to /usr so we end up with:
/usr/dialogic/bin
/usr/dialogic/data
.
.
.
We move to our dialogic directory. From now we will work from here unless said otherwise.
# cd /usr/dialogic

10. Read and understand the Dialogic instructions (chapter 4, etc…) to got an idea of what is going on.

11. It is always nice to know the interrupts that we have free:
# cat /proc/interrupts
CPU0
0: 203307 XT-PIC timer 1: 2 XT-PIC keyboard 2: 0 XT-PIC cascade 8: 1 XT-PIC rtc 11: 423 XT-PIC eth0 13: 1 XT-PIC fpu 14: 35960 XT-PIC ide0 15: 10 XT-PIC ide1 NMI: 0

(hey I have 7 free [an old time favorite from DOS times])

12. Run mkcfg in bin
You have to tell it the boards that you are using. In my system it changes
cfg/dialogic.cfg
and keeps the interrupt to be used in cfg/.bltirq (El interrupt)


The file dialogic.cfg is basically where it keeps the boards that it uses, and how they are configured. It is pretty easy to use. Example for a basic system is:
                ###################################
                #                                 #
                #   DIALOGIC CONFIGURATION FILE   #
                #                                 #
                ###################################



[Genload - All Boards]
Dialog/HD=YES
BusType=SCBus
SCBusClockMaster=AUTOMATIC
SCBusClockMasterSource=AUTOMATIC
				

Is we want a D41SC with an E1 (DTI-300SC) in Euro-ISDN:
                ###################################
                #                                 #
                #   DIALOGIC CONFIGURATION FILE   #
                #                                 #
                ###################################






[Genload - All Boards]
BLTAddress = D8000
Dialog/HD=YES
BusType=SCBus
SCBusClockMaster=AUTOMATIC
SCBusClockMasterSource=AUTOMATIC
PCMEncoding=ALAW

[Genload - ID 7] /* T1/E1 Frontend HD */
ISDNProtocol=CTR4
ParameterFile=ctr4.prm

[Genload - ID 1] /* D/41E TYPE */

				

Or for a D41-SC and a DTI-240SC in 5ESS (Lucent).
                ###################################
                #                                 #
                #   DIALOGIC CONFIGURATION FILE   #
                #                                 #
                ###################################






[Genload - All Boards]
BLTAddress = D8000
Dialog/HD=YES
BusType=SCBus
SCBusClockMaster=AUTOMATIC
SCBusClockMasterSource=AUTOMATIC
PCMEncoding=ULAW

[Genload - ID 2] /* T1/E1 Frontend HD */
ISDNProtocol=5ESS
ParameterFile=5ess.prm

[Genload - ID 1] /* D/41E TYPE */


 Stefaan Ponnet uses for his D41/H...

                ###################################
                #                                 #
                #   DIALOGIC CONFIGURATION FILE   #
                #                                 #
                ###################################


[Genload - All Boards]
D41DAddress = D000
BusType=None
For more information of ISDN in T1 see http://support.dialogic.com/appnotes/isdn02.htm

NOTE: If mkcfg complains about not having ncurses:
./mkcfg: error in loading shared libraries: libncurses.so.4: cannot open shared object file: No such file or directory
just go to /lib and do a link -s if you have the ncurses:
/lib# ln -s libncurses.so.5 libncurses.so.4
if not just install the ncurses

13. We install the dialogic and all its drivers. For that we will use the following shell program, based in configure_dialogic. What thisprogram does is to copy the drivers (in object form) to be compiled with the LiS libraries.
#!/bin/sh
#
# Script to install dialogic boards in Linux. Totally based in dlgcinstall


LiS_HOME=/usr/src/LiS
BASEDIR=/usr/dialogic
ORIGDIR=`pwd`


# Check that the LiS STREAMS package has been installed correctly:
if [ ! -f $LiS_HOME/Makefile ]
then
    echo Please install the LiS STREAMS package first...
    exit 1
fi

echo
echo Creating other directories and files as needed...
echo "00200   vox     sram    1       2
00201   ant     an      1       0" > $BASEDIR/cfg/.mastercfg

echo
echo Preparing the driver directories under $LiS_HOME...
cd /usr/dialogic
VER=`uname -r`
mkdir /lib/modules/${VER}/misc
for DRIVER in dlgn gncfd dvbm gpio sctmr
do
   rm -rf $LiS_HOME/pkg/${DRIVER}
   mkdir $LiS_HOME/pkg/${DRIVER}
   cp drivers/${DRIVER}/Config $LiS_HOME/pkg/${DRIVER}
   cp drivers/${DRIVER}/Driver.o /lib/modules/${VER}/misc/streams-${DRIVER}Driver.o
   echo "nothing : " > $LiS_HOME/pkg/${DRIVER}/Makefile
done

PATH=$PATH:/usr/sbin:
# Paranoia...
if [ ! -f /usr/lib/libLiS.so ]
then
   if [ -f /usr/src/LiS/libc/libLiS.so ]
   then
      cp /usr/src/LiS/libc/libLiS.so /usr/lib
   fi
fi
rm -f /usr/dialogic/cfg/.bltirq
rm -f /usr/dialogic/cfg/.veclist > /dev/null 2>&1
echo
echo Will this system use board locator cards e.g., D/XXE, D/240SC-T1 Cards
echo [y,Y,default=n]?
read ans
if [ "$ans" = 'y' -o "$ans" = 'Y' ]
then
    while [ true ]
    do
    echo
    echo What IRQ will be used for the BLT Cards?
    read ans
    if [ "$ans" -gt 1 -a "$ans" -lt 16 ] > /dev/null 2>&1
    then
      break
    fi
    done
    echo $ans > /usr/dialogic/cfg/.bltirq
    echo "sram $ans LOCATOR" > /usr/dialogic/cfg/.veclist
# ant 12 DEFAULT" > /usr/dialogic/cfg/.veclist
#    echo "sram $ans LOCATOR" /usr/dialogic/cfg/.veclist
fi
echo Will this system use D/XXD or D/XXH series boards [y,Y,default=n]?
read ans
if [ "$ans" = 'y' -o "$ans" = 'Y' ]
then
    while [ true ]
    do
    echo
    echo What IRQ will be used for the D/XXD or D/XXH series  boards?
    read ans
    if [ "$ans" -gt 1 -a "$ans" -lt 16 ] > /dev/null 2>&1
    then
      break
    fi
    done
    echo
    echo "sram $ans DEFAULT" >> /usr/dialogic/cfg/.veclist

fi
echo "ant 12 DEFAULT" >> /usr/dialogic/cfg/.veclist
echo

echo
echo Configuration is complete
echo


14. We have to reinstall LiS.
# cd /usr/src/LiS
# make
# make install


Loading the drivers

15. This little shell script (a modified version of drvload), will load the LiS modules with Dialogic support and create the nodes in /dev that latter the Dialogic libraries will open to communicate with the boards.
#!/bin/sh
#
			
BLT_IRQ=0
BLT_ADDR=0
SBA_IRQ=0
SBA_ADDR=0
STAT=0

# Metemos los streams
/sbin/insmod /usr/src/LiS/streams.o


#I do not know
if [ -f /usr/dialogic/cfg/.sbairq ]
then
   SBA_IRQ=`cat /usr/dialogic/cfg/.sbairq`
   SBA_ADDR=`cat /usr/dialogic/cfg/dialogic.cfg | sed 's/#.*$//g' | grep -i D41DAddress | sed 's/ *//g' |  cut -d',' -f1 | cut -d'=' -f2`
   if [ x != x${SBA_ADDR} ]
   then
     SBA_ADDR=0x$SBA_ADDR
     STAT=1
   fi
fi


#Good old cards
if [ -f /usr/dialogic/cfg/.bltirq ]
then
   #Hre it is written the irq number
   BLT_IRQ=`cat /usr/dialogic/cfg/.bltirq`

   #Let's parse to know which is the address
   BLT_ADDR=`cat /usr/dialogic/cfg/dialogic.cfg | sed 's/#.*$//g' | grep -i BLTAddress | sed 's/ *//g' | cut -d',' -f1 | cut -d'=' -f2`
   if [ x != x${BLT_ADDR} ]
   then
     BLT_ADDR=0x$BLT_ADDR
     STAT=1
   fi
fi

#We load the drivers in stream mode
if [ -z $STAT ]
then
   # PCI boards only
   /sbin/insmod -f /lib/modules/2.2.19/misc/streams-dlgnDriver.o
else
   /sbin/insmod -f /lib/modules/2.2.19/misc/streams-dlgnDriver.o blt_irq=$BLT_IRQ blt_address=$BLT_ADDR sba_irq=$SBA_IRQ sba_address=$SBA_ADDR
fi

/sbin/insmod -f /lib/modules/2.2.19/misc/streams-gncfdDriver.o
/sbin/insmod -f /lib/modules/2.2.19/misc/streams-gpioDriver.o
/sbin/insmod -f /lib/modules/2.2.19/misc/streams-sctmrDriver.o
/sbin/insmod -f /lib/modules/2.2.19/misc/streams-dvbmDriver.o



# Make /dev nodes
clone_device=`cat /proc/devices | grep clone`
clone_major=`echo $clone_device | cut -f1 -d" "`
dlgn_device=`cat /proc/devices | grep dlgn`
dlgn_major=`echo $dlgn_device | cut -f1 -d" "`
gncfd_device=`cat /proc/devices | grep gncfd`
gncfd_major=`echo $gncfd_device | cut -f1 -d" "`
gpio_device=`cat /proc/devices | grep gpio`
gpio_major=`echo $gpio_device | cut -f1 -d" "`
mknod /dev/dlgn c $clone_major $dlgn_major
mknod /dev/gncfd c $clone_major $gncfd_major
mknod /dev/d_gn_cnfg c $gncfd_major 255
mknod /dev/gpioDRV c $gpio_major 255
chmod 0666 /dev/dlgn /dev/gncfd /dev/d_gn_cnfg /dev/gpioDRV

				


16. If complains when loading the modules, not worry it is fine, and that is way we are using insmod with -f. You should see something like:
Warning: kernel-module version mismatch
        /lib/modules/2.2.19/misc/streams-dlgnDriver.o was compiled for kernel version 2.2.12-20  while this kernel is version 2.2.19

Warning: kernel-module version mismatch
        /lib/modules/2.2.19/misc/streams-gncfdDriver.o was compiled for kernel version 2.2.12-20   while this kernel is version 2.2.19
And the rest follows with warnings as well…., we

17. Did it work?
# lsmod
Module                  Size  Used by
streams-dvbmDriver     64944   0
streams-sctmrDriver    14016   0  (unused)
streams-gpioDriver      7936   0
streams-gncfdDriver    10912   1
streams-dlgnDriver    263908   0  [streams-dvbmDriver streams-sctmrDriver streams-gpioDriver streams-gncfdDriver]
streams               282128   0  [streams-dvbmDriver streams-sctmrDriver streams-gpioDriver streams-gncfdDriver streams-dlgnDriver]

# ls -l /dev/dlgn
crw-rw-rw-   1 root     root      50, 253 May  4 12:06 /dev/dlgn
# ls -l /dev/gncfd
crw-rw-rw-   1 root     root      50, 252 May  4 12:06 /dev/gncfd
# ls -l /dev/d_gn_cnfg
crw-rw-rw-   1 root     root     252, 255 May  4 12:06 /dev/d_gn_cnfg
# ls -l /dev/gpioDRV
crw-rw-rw-   1 root     root     251, 255 May  4 12:06 /dev/gpioDRV

Yes, it did.

18. The next step is to load bin/genload that loads the firmware into the boards…
# ldd genload

libLiS.so => /usr/lib/libLiS.so (0x40019000)
libasi.so => not found
libc.so.6 => /lib/libc.so.6 (0x4001b000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)


so we copy libasi.so from /usr/dialogic/lib to /usr/lib

19. We try it..
/usr/dialogic# ./bin/genload
Dialogic Generic Downloader Version 4.61 (Build 14)
Copyright (c) 1992-2000 by Dialogic Corp.
WARNING: ASI storage for BoardWatch was not created.
Using /usr/dialogic/cfg/dialogic.cfg to configure Dialogic Boards

System Download ............................................

D/41ESC    (ID 1) Download      .. d4x Firmware Version 6.53
DTI/240SC  (ID 2) Download      .. dti5ess Firmware Version 6.52

2 Dialogic Boards Successfully Installed


20. Genstart:
/usr/dialogic# ./bin/genstart

Dialogic NFAS Configuration Program
Version 2.0
Linux 2.2.x
Copyright (c) 2000 Dialogic Corp.
ALL RIGHTS RESERVED


21. And ScBus assigments..
/usr/dialogic# ./bin/sctsassign

Dialogic SCSA Transmit Timeslot Assignment Program
Version 2.0
Linux 2.2.x
Copyright (C) 1997 Dialogic Corp.
ALL RIGHTS RESERVED
22. Remove the following file:
/usr/dialogic# rm ./cfg/.sctscfg
Sometimes it has grown too big and made sctsassign to crash.

23. You are ready to rumble.

24. Before that. Here is a rc.dialogic shell script to load all this
#!/bin/sh
#

BLT_IRQ=0
BLT_ADDR=0
SBA_IRQ=0
SBA_ADDR=0
STAT=0

# Got those streams
/sbin/insmod /usr/src/LiS/streams.o


#I do not know
if [ -f /usr/dialogic/cfg/.sbairq ]
then
   SBA_IRQ=`cat /usr/dialogic/cfg/.sbairq`
   SBA_ADDR=`cat /usr/dialogic/cfg/dialogic.cfg | sed 's/#.*$//g' | grep -i D41DAddress | sed 's/ *//g' |  cut -d',' -f1 | cut -d'=' -f2`
   if [ x != x${SBA_ADDR} ]
   then
     SBA_ADDR=0x$SBA_ADDR
     STAT=1
   fi
fi


#Good old cards
if [ -f /usr/dialogic/cfg/.bltirq ]
then
   #Hre it is written the irq number
   BLT_IRQ=`cat /usr/dialogic/cfg/.bltirq`

   #Let's parse to know which is the address
   BLT_ADDR=`cat /usr/dialogic/cfg/dialogic.cfg | sed 's/#.*$//g' | grep -i BLTAddress | sed 's/ *//g' | cut -d',' -f1 | cut -d'=' -f2`
   if [ x != x${BLT_ADDR} ]
   then
     BLT_ADDR=0x$BLT_ADDR
     STAT=1
   fi
fi

#We load the drivers in stream mode
if [ -z $STAT ]
then
   # PCI boards only
   /sbin/insmod -f /lib/modules/2.2.19/misc/streams-dlgnDriver.o
else
   /sbin/insmod -f /lib/modules/2.2.19/misc/streams-dlgnDriver.o blt_irq=$BLT_IRQ blt_address=$BLT_ADDR sba_irq=$SBA_IRQ sba_address=$SBA_ADDR
fi

/sbin/insmod -f /lib/modules/2.2.19/misc/streams-gncfdDriver.o
/sbin/insmod -f /lib/modules/2.2.19/misc/streams-gpioDriver.o
/sbin/insmod -f /lib/modules/2.2.19/misc/streams-sctmrDriver.o
/sbin/insmod -f /lib/modules/2.2.19/misc/streams-dvbmDriver.o


/usr/dialogic/bin/genload
/usr/dialogic/bin/genstart
/usr/dialogic/bin/sctsassign
rm /usr/dialogic/cfg/.sctscfg


To change the Irq that is being used
from /usr/dialogic/cfg  (to have irq 5, look at: cat /proc/interrupts)
 
echo 5 > .bltirq