Option Explicit ' * DTI - application parameter block 'struct dtparm { ' unsigned short int brdnum; /* board number */ ' unsigned short int tmslot; /* timeslot number */ ' unsigned short int parm1; /* parameter 1 */ ' unsigned short int parm2; /* parameter 2 */ ' unsigned char far *pntr; /* buffer pointer */ ' unsigned short int rfu[2]; /* reserved */ ' }; Type dtparm brdnum As Integer 'board number tmslot As Integer 'timelsot number parm1 As Integer 'parameter 1 parm2 As Integer 'parameter 2 pntr As Long 'buffer pointer rfu(1) As Integer 'reserved (VB starts with index 0) End Type Global Const PARM_SIZE = 16 'size of dtparm 'Dim prmblk As dtparm Dim dtiact As Integer Dim dtirc As Integer 'return code of route functions ' Dim ral As String * 1 ' Dim rbx As Integer Dim rcx As Integer '--------------------------------------------------------------------------- 'static unsigned char ral; 'static unsigned int rbx; 'static unsigned int rcx; 'static unsigned char *ralp = &ral; 'static unsigned int *rbxp = &rbx; 'static unsigned int *rcxp = &rcx; '--------------------------------------------------------------------------- Global Const DMXCON_FULLDUP = &H0 'full duplex Global Const DMXCON_HALFDUP = &H4 'half duplex Global Const DMXCON_MAKE = &H20 'make connection Global Const DMXCON_BREAK = &H40 'break connection 'Global Const DV_DTI = 3 'DTI driver type Global Const PEB1 = &H0 'peb connector 1 Global Const PEB2 = &H40 'peb connector 2 Global Const PEB3 = &H80 'peb connector 3 Global Const PEB4 = &HC0 'peb connector 4 Global Const F_DTSTRT = &H1 ' /* start dti execution, init board */ Global Const F_DTSTOP = &H2 ' /* stop dti execution */ Global Const F_DTCSTP = &H3 ' /* chan stop, abort mult-task func */ Global Const F_DTDIAL = &H4 ' /* dial pulse digit string */ Global Const F_DTPDIG = &H5 ' /* enb/dis pulse digit reception */ Global Const F_DTCDIG = &H6 ' /* clear pulse digit buffer */ Global Const F_DTDIGS = &H7 ' /* read/wait for pulse digit string */ Global Const F_DTGLBL = &H8 ' /* set global parameter */ Global Const F_DTDCHN = &H9 ' /* disable timeslot to chan mapping */ Global Const F_DTECHN = &HA ' /* assign a timeslot to a dev chan */ Global Const F_DTEMSK = &HB ' /* enable notification of err msgs */ Global Const F_DTDMSK = &HC ' /* disable error messages */ Global Const F_DTXMIT = &HD ' /* set xmit type (trans,sigins) */ Global Const F_DTIDLE = &HE ' /* set/clr chan output to/from idle */ Global Const F_DTSBIT = &HF ' /* set A/B signal bit */ Global Const F_DTCBIT = &H10 ' /* clear A/B signal bit */ Global Const F_DTTONE = &H11 ' /* enable/disable the test tone */ Global Const F_DTGETV = &H12 ' /* get dti driver version */ Global Const F_DTTAB = &H13 ' /* read timeslot attribute block */ Global Const F_DTBAB = &H14 ' /* read board attribute block */ Global Const F_DTCTST = &H15 ' /* perform comm test (multi-tasking) */ Global Const F_DTDTST = &H16 ' /* perform data test (multi-tasking) */ Global Const F_DTDIAG = &H17 ' /* run diagnostics (multi-tasking) */ Global Const F_DTWDOG = &H18 ' /* enable/disable watch dog timer */ Global Const F_DTGTSG = &H19 ' /* get board signaling bits */ Global Const F_DTALMD = &H20 ' /* set the alarm handling mode */ Global Const F_DTALMS = &H21 ' /* xmit or stop xmit blu or yel alrm */ Global Const f_DMMKBRK = &H50 Function dtimsg (ByVal cmd As Integer, ByVal brd As Integer, ByVal tslot As Integer, ByVal data1 As Integer) As Integer Dim prmblk As dtparm Dim cmd2 As String * 1 ral = Chr$(cmd) rbx = DV_DTI rcx = 0 prmblk.brdnum = brd prmblk.tmslot = tslot prmblk.parm1 = data1 prmblk.parm2 = 0 dtirc = caldxxint(F_DEVCOM, ral, rbx, rcx, prmblk, PARM_SIZE) Debug.Print "caldxxint Return = " + Str$(dtirc) dtimsg = Asc(ral) End Function Function stpch (ByVal ch As Integer) Dim prmblk As dtparm ral = Chr$(ch) rbx = 0 rcx = 0 rc = caldxxint(F_CHSTOP, ral, rbx, rcx, prmblk, PARM_SIZE) End Function Function VBcommtest (ByVal brd As Integer) dtirc = dtimsg(F_DTCTST, brd, 0, 0) Debug.Print "Board = " + Str$(brd) + " COMMTEST =" + Str$(dtirc) VBcommtest = dtirc End Function Function VBdm_route (ByVal devhndl As Integer, ByVal source As Integer, ByVal dest As Integer, ByVal contype As Integer) Dim prmblk As dtparm ral = Chr$(f_DMMKBRK) rbx = DV_DTI rcx = 0 prmblk.pntr = 0 prmblk.brdnum = devhndl prmblk.tmslot = source prmblk.parm1 = dest prmblk.parm2 = contype dtirc = caldxxint(F_DEVCOM, ral, rbx, rcx, prmblk, PARM_SIZE) Debug.Print "caldxxint return " + Str$(dtirc) VBdm_route = Asc(ral) 'return ? End Function Function VBstart_dti (brd As Integer, tslot As Integer) As Integer Dim prmblk As dtparm ral = Chr$(F_DTSTRT) rbx = DV_DTI rcx = 0 prmblk.pntr = 0 dtirc = caldxxint(F_DEVCOM, ral, rbx, rcx, prmblk, PARM_SIZE) brd = rbx tslot = rcx Debug.Print "BOARD = " + Str$(brd) VBstart_dti = Asc(ral) End Function Function VBstopdti () As Integer dtirc = dtimsg(F_DTSTOP, 0, 0, 0) If Not dtirc Then dtiact = 0 End If VBstopdti = dtirc End Function