Solved

how can I convert the fellow C file to pascal

Posted on 2001-09-10
12
2,253 Views
Last Modified: 2012-06-27
The Fellow is a head file on dialogic,I want to control
D/41es with delphi.


/*********************************************************************
 *        FILE: dxxxlib.h
 * DESCRIPTION: Header File for DIALOGIC D/XXX Windows NT/95 library
 *
 *   Copyright (c) 1991-1996 Dialogic Corp. All Rights Reserved
 *
 *   THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Dialogic Corp.
 *   The copyright notice above does not evidence any actual or
 *   intended publication of such source code.
 ********************************************************************/
//07-07-1999 [cjl] Update The defines for the Feature Table play/record
//                                    fields to match the additional fields in firmware.
//02-24-2000 [cjl] Added FT_IBI #define
//03-08-2000 [cjl] move DM_VADEVTS to dxxxlib.h where the others are.
//04-25-2000 [cjl] add support for dx_callp
//05-19-2000 [cjl] PTR 18000 - Fix dx_callp flags
//05-25-2000 [cjl] PTR 18111 - Add PVD_Id and PAMD_Id parms to dx_callp.
//06-08-2000 [cjl] add CT_BMH100 to bus defines
//06-21-2000 [cjl] change FT_IBI to FT_CSP
//10-05-2000 [cjl] synct the CT_ defs with dtlib.h

#ifndef __DXXXLIB_H__
#define __DXXXLIB_H__

#ifdef __STANDALONE__            /* List of required header files */
#endif


/*
 * Required header files
 */

/* NOTE: srllib.h must be included before here for DV_TPT */

#include "dxdevdef.h"
#include "dxcallp.h"
#include "dxdigit.h"
#include "dxr2mf.h"
#include "dxsync.h"
#include "dxtables.h"
#include "d40low.h"
#include "dxxxlow.h"
#include "dxuio.h"

/*
 * The following equates and structures are D/4x dependent
 */

#ifndef VOXLIB

/*
 * Macros to get at the class and model parts of a device ID
 */
#define dl_devclass(i)  ((i) & 0xFF00)
#define dl_devmodel(i)  ((i) & 0x00FF)

#define DEV_CLASS_VOICE "Voice"

/*
 * Maximum terminator values.
 */
#define MAX_TC_TIMER 6000  /* Max time units for term. conditions */


/*
 * Values for setting hook state
 */
#define DL_ONHOOK             0
#define DL_OFFHOOK            1
#define DX_ONHOOK             0
#define DX_OFFHOOK            1


/**
 ** Define Event Types
 **/
#define TDX_PLAY        0x81     /* Play Completed */
#define TDX_RECORD      0x82     /* Record Completed */
#define TDX_GETDIG      0x83     /* Get Digits Completed */
#define TDX_DIAL        0x84     /* Dial Completed */
#define TDX_CALLP       0x85     /* Call Progress Completed */
#define TDX_CST         0x86     /* CST Event Received */
#define TDX_SETHOOK     0x87     /* SetHook Completed */
#define TDX_WINK        0x88     /* Wink Completed */
#define TDX_ERROR       0x89     /* Error Event */
#define TDX_PLAYTONE    0x8A     /* Play Tone Completed */
#define TDX_GETR2MF     0x8B     /* Get R2MF completed */
#define TDX_BARGEIN     0x8C     /* Barge in completed */
#define TDX_NOSTOP      0x8D     /* No Stop needed to be Issued */

#define TDX_TXDATA      0x90       /* Transmit Data Completed */
#define TDX_RXDATA      0x91       /* Transmit Data Completed */

#define DX_ATOMIC_ERR   0xEE     /* Error event for Atomic Funcs */

/*
 *      Added to handle new sendevt() capability.
 */
#define      TDX_UNKNOWN            1000            /* Yes, Decimal 1000 */


/**
 ** Define sendevt flag values
 **/
#define EVFL_SENDSELF   0x01     /* Send event to self process */
#define EVFL_SENDOTHERS 0x02     /* Send event to other processes */
#define EVFL_SENDALL    0x03     /* Send event to all processes */


/*
 * Error codes returned by ATDV_LASTERR()
 */
#define EDX_NOERROR     0     /* No Errors */
#define EDX_SYSTEM      1     /* System Error */
#define EDX_FWERROR     2     /* Firmware Error */
#define EDX_TIMEOUT     3     /* Function Timed Out */
#define EDX_BADIOTT     4     /* Invalid Entry in the DX_IOTT */
#define EDX_BADTPT      5     /* Invalid Entry in the DX_TPT */
#define EDX_BADPARM     6     /* Invalid Parameter in Function Call */
#define EDX_BADDEV      7     /* Invalid Device Descriptor */
#define EDX_BADPROD     8     /* Func. Not Supported on this Board */
#define EDX_BUSY        9     /* Device is Already Busy */
#define EDX_IDLE        10    /* Device is Idle */
#define EDX_STOPRINGS   11    /* Stop waitrings (MT only) */
#define EDX_WTRINGSTOP  11    /* Wait for Rings stopped by user */
#define EDX_BADWAVEFILE 12    /* Bad/Unsupported WAV file */
#define EDX_XPBPARM     13    /* Bad XPB structure */
#define EDX_NOSUPPORT   14    /* Data format not supported */
#define EDX_NOTIMP      15    /* Function not implemented */

//01142000, WEIHSIN, ADD NEW ERROR CODE
#define EDX_BADSUBCOMMAND              16
#define EDX_BADCHANNELNUMBER           17
#define EDX_BADRESOURCEID              18
#define EDX_NORESOURCE                 19    /* No Resources */
#define EDX_DSPERROR                   20    /* Resource DSP error */
//#define EDX_CHANNEL_BUSY_ERROR         21
#define EDX_INUSE                                                21
//END

/*
 * GTD Error Codes
 */
#define EDX_TONEID      0x41  /* Bad Tone Template ID */
#define EDX_MAXTMPLT    0x42  /* Max number of Templates Exists */
#define EDX_INVSUBCMD   0x43  /* Invalid Sub Command Number */
#define EDX_CHANNUM     0x44  /* Invalid Channel Number Specified */
#define EDX_FREQDET     0x45  /* Invalid Freq Component Values */
                              /* in Tone Template Description */
#define EDX_CADENCE     0x46  /* Invalid Cadence Component Values */
                              /* in Tone Template Description */
#define EDX_ASCII       0x47  /* Invalid Ascii Value */
                              /* in Tone Template Description */
#define EDX_DIGTYPE     0x48  /* Invalid Dig_Type Value */
                              /* in Tone Template Description */
#define EDX_MSGSTATUS   0x49  /* Invalid Message Status Setting */

/*
 * Speed and Volume Control Error Codes
 */
#define EDX_SVADJBLKS   0x4A  /* Invalid Number of Speed/Volume */
                              /* Adjustment Blocks */
#define EDX_SPDVOL      0x4B  /* Must Specify either SV_SPEEDTBL or */
                              /* SV_VOLUMETBL */
#define EDX_SVMTSIZE    0x4C  /* Invalid Table Size Specified */
#define EDX_SVMTRANGE   0x4D  /* An out of Range entry in DX_SVMT */
#define EDX_NONZEROSIZE 0x4E  /* Reset to Default was Requested but */
                              /* size was non-zero */

/*
 * GTG Error Codes
 */
#define EDX_FLAGGEN     0x4F  /* Invalid tg_dflag field in */
                              /* Tone Generation Template */
#define EDX_FREQGEN     0x50  /* Invalid Frequency Component in */
                              /* Tone Generation Template */
#define EDX_AMPLGEN     0x51  /* Invalid Amplitude Value in */
                              /* Tone Generation Template */

/*
 * Switch Handler / SCSA  Error Codes
 */
#define EDX_SH_CMDBLOCK   0x59  /* Blocking Command is in progress */
#define EDX_SH_BADCMD     0x60  /* Command not supported */
#define EDX_SH_LIBBSY     0x61  /* Switching Handler Lib is busy */
#define EDX_SH_BADINDX    0x62  /* Invalid Switching Handler indx # */
#define EDX_SH_LIBNOTINIT 0x63  /* Switching Handler Library has not been initialized */
#define EDX_SH_NOCLK      0x64  /* Switching Handler Clock fallback failed */
#define EDX_SH_MISSING    0x66  /* Switching Handler is not Present */
#define EDX_SH_BADMODE    0x6A  /* Invalid Switching Handler Bus Mode */
#define EDX_SH_BADLCLTS   0x6F  /* Invalid local timeslot (Channel) */
#define EDX_SH_BADTYPE    0x70  /* Invalid local timeslot type */
#define EDX_SH_BADEXTTS   0x71  /* External timeslot not supported at current clock rate */
#define EDX_SH_LCLTSCNCT  0x72  /* Channel is already connected to SCbus */
#define EDX_SH_LCLDSCNCT  0x73  /* Channel is already disconnected from SCbus */


/*
 * Error Codes Specific to caller ID
 */
#define EDX_CLIDINFO 0x80  /* caller ID info/sub-msg not available */
#define EDX_CLIDBLK  0x81  /* caller ID private ('P') or blocked   */
#define EDX_CLIDOOA  0x82  /* caller ID out of area ('O')          */
#define EDX_CLIDPUB  0x83  /* caller ID public phone ('C')         */
#define EDX_CLIDPLAN 0x84  /* caller ID unknown plan ('S')         */

/*
 * Error Codes Specific to PBXpert TSF loading
 */
#define      EDX_BADREGVALUE            0x90
#define      EDX_BADTSFFILE                  0x91
#define      EDX_BADTSFDATA                  0x92
#define      EDX_FEATUREDISABLED      0x93

/*
 * Error Codes Specific to EC TAP
 */
#define      EDX_BADMODE                        0x90
#define      EDX_UNSUPPORTED            0x91

/*
 * Equates for generic caller ID message type IDs
 */
#define  CLIDINFO_CMPLT        0x100   /* complete caller ID message   */
#define  CLIDINFO_GENERAL      0x101   /* date,time,phone #,name       */
#define  CLIDINFO_CALLID       0x102   /* caller ID                    */
#define  CLIDINFO_FRAMETYPE    0x103   /* see frame type equates       */

/*
 * Equates for CLASS
 */
#define  CLASSFRAME_SDM    0x04    /* Single Data Message caller ID frame   */
#define  CLASSFRAME_MDM    0x80    /* Multiple Data Message caller ID frame */
/* CLASS MDM message IDs */
#define  MCLASS_DATETIME   0x01    /* date and time w/o '/" & ':'      */
#define  MCLASS_DN         0x02    /* calling line directory number    */
#define  MCLASS_DDN        0x03    /* dialed number                    */
#define  MCLASS_ABSENCE1   0x04    /* caller ID absence: 'O' or 'P'    */
#define  MCLASS_REDIRECT   0x05    /* call frwd-universal,busy,or unanswered */
#define  MCLASS_QUALIFIER  0x06    /* 'L' for long distance            */
#define  MCLASS_NAME       0x07    /* caller name                      */
#define  MCLASS_ABSENCE2   0x08    /* name absence- 'O' or 'P'         */

/*
 * Equates for CLIP
 */
#define  CLIPFRAME_MDM     0x80    /* Multiple Data Message caller ID frame */
/* CLIP message IDs */
#define  CLIP_DATETIME     0x01    /* date and time (w/o '/" & ':')    */
#define  CLIP_DN           0x02    /* calling line directory number    */
#define  CLIP_DDN          0x03    /* dialed number                    */
#define  CLIP_ABSENCE1     0x04    /* caller ID absence: 'O' or 'P'    */
#define  CLIP_NAME         0x07    /* caller name                      */
#define  CLIP_ABSENCE2     0x08    /* name absence- 'O' or 'P'         */
#define  CLIP_CALLTYPE     0x11    /* voice call,rng-bck-when-free call or msg waiting call */
#define  CLIP_NETMSG       0x13    /* no. of message waiting             */

/*
 * Equates for A-CLIP
 */
#define  ACLIPFRAME_SDM    0x04    /* Single Data Message caller ID frame   */
#define  ACLIPFRAME_MDM    0x80    /* Multiple Data Message caller ID frame */
/* A-CLIP MDM message IDs */
#define  MACLIP_DATETIME   0x01    /* date and time (w/o '/" & ':'     */
#define  MACLIP_DN         0x02    /* calling line directory number    */
#define  MACLIP_DDN        0x03    /* dialed number                    */
#define  MACLIP_ABSENCE1   0x04    /* caller ID absence: 'O' or 'P'    */
#define  MACLIP_REDIRECT   0x05    /* call frwd-universal,busy,or unanswered */
#define  MACLIP_QUALIFIER  0x06    /* 'L' for long distance            */
#define  MACLIP_NAME       0x07    /* caller name                      */
#define  MACLIP_ABSENCE2   0x08    /* name absence- 'O' or 'P'         */

/*
 * Equates for Japan Caller ID  JCLIP
 */
#define  JCLIPFRAME_MDM    0x40    /* Multiple Data Message caller ID frame */
#define  JCLIP_DN          0x02    /* calling line directory number    */
#define  JCLIP_DDN         0x09    /* dialed number                    */
#define  JCLIP_ABSENCE1    0x04    /* caller ID absence: 'O' or 'P'    */
#define  JCLIP_ABSENCE2    0x08    /* name absence- 'O' or 'P'         */


/*
 * Defines for for channel state values
 */
#define CS_IDLE      1     /* Channel is idle */
#define CS_PLAY      2     /* Channel is playing back */
#define CS_RECD      3     /* Channel is recording */
#define CS_DIAL      4     /* Channel is dialing */
#define CS_GTDIG     5     /* Channel is getting digits */
#define CS_TONE      6     /* Channel is generating a tone */
#define CS_STOPD     7     /* Operation has terminated */
#define CS_SENDFAX   8     /* Channel is sending a fax */
#define CS_RECVFAX   9     /* Channel is receiving a fax */
#define CS_CALL      13    /* Channel is Call Progress Mode */
#define CS_GETR2MF   14    /* Channel is Getting R2MF */
#define CS_BLOCKED   16    /* Channel is blocked */

/*
 * This is a complex state composed of one of the
 * above states and faxmode.
 */
#define CS_FAXIO     10    /* Channel is between fax pages */

/*
 * Define a channel state for the remaining blocking commands
 */
#define CS_HOOK      11    /* A change in hookstate is in progress */
#define CS_WINK      12    /* A wink operation is in progress */
#define CS_RINGS     15    /* Call status Rings state */

/*      
 *      Added this to have the behavior if user uses getevt to
 *      wait for rings.
 */
#define      CS_WAITEVT      (CS_RINGS)

/*
 * D/4X Events and masks
 */
#define DE_RINGS     1     /* Rings received */
#define DE_SILON     2     /* Silence on */
#define DE_SILOF     3     /* Silenec off */
#define DE_LCON      4     /* Loop current on */
#define DE_LCOF      5     /* Loop current off */
#define DE_WINK      6     /* Wink received */
#define DE_RNGOFF    7     /* Ring off event */
#define DE_DIGITS    8     /* Digit Received */
#define DE_DIGOFF    9     /* Digit tone off event */
#define DE_LCREV     13    /* Loop current reversal   */
#define DE_TONEON    17    /* Tone ON  Event Received */
#define DE_TONEOFF   18    /* Tone OFF Event Received */
#define DE_STOPRINGS 19    /* Stop ring detect state */
#define DE_VAD                  20            /* Voice Energy detected */


/* Alt. defines for DM_SILOF, DM_LCOF are DM_SILOFF and DM_LCOFF */
/*
 * Event mask values
 */
#define DM_RINGS     ( 1 << (DE_RINGS - 1) )
#define DM_SILON     ( 1 << (DE_SILON - 1) )
#define DM_SILOF     ( 1 << (DE_SILOF - 1) )
#define DM_LCON      ( 1 << (DE_LCON - 1) )
#define DM_LCOF      ( 1 << (DE_LCOF - 1) )
#define DM_LCREV     ( 1 << (DE_LCREV - 1) )
#define DM_WINK      ( 1 << (DE_WINK - 1) )
#define DM_RNGOFF    ( 1 << (DE_RNGOFF - 1) )
#define DM_DIGITS    ( 1 << (DE_DIGITS - 1) )
#define DM_DIGOFF    ( 1 << (DE_DIGOFF - 1) )
#define DM_VADEVTS      ( 1 << (DE_VAD - 1) )


/*
 * Termination reasons
 */
#define T_NORML      0     /* Normal termination */
#define T_MXDIG      1     /* Max. digits received */
#define T_MXSIL      2     /* Max. silence exceeded */
#define T_MXNSIL     3     /* Max. non-silence exceeded */
#define T_LOOP       4     /* Loop current drop */
#define T_IDIG       5     /* Max. inter-digit delay exceeded */
#define T_MXSEC      6     /* Max. time elapsed */
#define T_TDIG       7     /* Terminating digit received */
#define T_PATRN      8     /* Pattern match detected */
#define T_STOP       9     /* Stopped by user */
#define T_EOD        10    /* End of data on playback */
#define T_ERR        13    /* I/O device error */


/*
 * Masked DTMF termination/initiation equates
 */
#define  DM_D        0x0001    /* Mask for DTMF d. */
#define  DM_1        0x0002    /* Mask for DTMF 1. */
#define  DM_2        0x0004    /* Mask for DTMF 2. */
#define  DM_3        0x0008    /* Mask for DTMF 3. */
#define  DM_4        0x0010    /* Mask for DTMF 4. */
#define  DM_5        0x0020    /* Mask for DTMF 5. */
#define  DM_6        0x0040    /* Mask for DTMF 6. */
#define  DM_7        0x0080    /* Mask for DTMF 7. */
#define  DM_8        0x0100    /* Mask for DTMF 8. */
#define  DM_9        0x0200    /* Mask for DTMF 9. */
#define  DM_0        0x0400    /* Mask for DTMF 0. */
#define  DM_S        0x0800    /* Mask for DTMF *. */
#define  DM_P        0x1000    /* Mask for DTMF #. */
#define  DM_A        0x2000    /* Mask for DTMF a. */
#define  DM_B        0x4000    /* Mask for DTMF b. */
#define  DM_C        0x8000    /* Mask for DTMF c. */

/*
 *  Standard DTMF Tone Ids
 */
#define TN_DTMF_1            0x8001
#define TN_DTMF_2            0x8002
#define TN_DTMF_3            0x8003
#define TN_DTMF_4            0x8004
#define TN_DTMF_5            0x8005
#define TN_DTMF_6            0x8006
#define TN_DTMF_7            0x8007
#define TN_DTMF_8            0x8008
#define TN_DTMF_9            0x8009
#define TN_DTMF_STAR            0x800e
#define TN_DTMF_0            0x8000
#define TN_DTMF_POUND            0x800f
#define TN_DTMF_A            0x800a
#define TN_DTMF_B            0x800b
#define TN_DTMF_C            0x800c
#define TN_DTMF_D            0x800d

/*
 * Macros to get the parts out of a parameter ID
 */
#define parmtype(id) (((id) >> 8) & 0xF)   /* High byte, lo nibble */
#define parmnumb(id) (((id) & 0xFF) - 1)   /* Low byte */


/*
 * D/4x Parameter Type Equates
 */
#define PT_BD        0      /* Board parameter */
#define PT_CH        1      /* Channel parameter */


/*
 * Defines used by the parameter functions
 */
#define PM_BD        0x00800000L   /* Board Level Parameter */
#define PM_CH        0x00000000L   /* Channel Level Parameter */

#define PM_DXXX      0x00000000L   /* D/xxx Parameter */
#define PM_D12X      0x01000000L   /* D/12x Parameter */
#define PM_MF40      0x02000000L   /* MF/40 Parameter */
#define PM_D12XDEV   0x04000000L

#define PM_FW        0x00000000L   /* Firmware Parameter */
#define PM_DRV       0x08000000L   /* Driver Parameter */
#define PM_LIB       0x10000000L   /* Library Parameter */

#define PRM_DEST     0x18000000L
#define PRM_DEVTYP   0x07000000L
#define PRM_DATTYP   0xE0000000L
#define PRM_NUM      0x0000FFFFL
#define PRM_TERM     0x007F0000L

#define PM_BYTE      0x00000000L   /* Byte */
#define PM_SHORT     0x20000000L   /* Short */
#define PM_INT       0x40000000L   /* Int */
#define PM_LONG      0x60000000L   /* Long */
#define PM_VLSTR     0x80000000L   /* Variable Length String */
#define PM_FLSTR     0xA0000000L   /* Fixed Length String */

#define PM_VLSTR_MAXLEN 128 /* Max Length for Variable Length Parms */

/*
 * CHANNEL PARAMETERS
 */
/* DTMF anti-talkoff during playback */
#define DXCH_DTMFTLK    ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0101L)

/* DTMF debounce time */
#define DXCH_DTMFDEB    ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0201L)

/* DTMF initiation bitmap */
#define DXCH_DTINITSET  ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0203L)

/* Delay after ring recvd before winking */
#define DXCH_WINKDLY    ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0204L)

/* Duration of wink (off-hook state) */
#define DXCH_WINKLEN    ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0205L)

/* Min LC on to be recognized as wink */
#define DXCH_MINRWINK   ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0206L)

/* Max LC on to be recognized as wink */
#define DXCH_MAXRWINK   ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0207L)

/* Length of DTMF digit for dialing */
#define DXCH_TTDATA     ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0208L)

/* Length of TT inter digit delay */
#define DXCH_T_IDD      ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0209L)

/* Length of ADSI alert tone */
#define DXCH_ADSIALERT_LENGTH ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x020DL)

/* Time to wait for DTMF A */
#define DXCH_ADSIALERT_ACK ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x020EL)

/* Length of DTMF to accept */
#define DXCH_ADSIACK_LENGTH ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x020FL)

/* Pause after end of DTMF */
#define DXCH_ADSIACK_FSK ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0210L)

/* Level to generate CAS tone */
#define DXCH_ADSIALERT_AMPL ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0211L)

/* MF detection mask */
#define DXCH_MFMODE     ((PM_SHORT|PM_FW|PM_MF40|PM_CH) | 0x0201L)

/* Diagnostic mask */
#define DXCH_MFDIAG     ((PM_SHORT|PM_FW|PM_MF40|PM_CH) | 0x0202L)

/* Per channel dig rate: play (D/xxx only) */
#define DXCH_PLAYDRATE  ((PM_SHORT|PM_FW|PM_D12X|PM_CH) | 0x0E01L)

/* Per channel dig rate: rec (D/xxx only)*/
#define DXCH_RECRDRATE  ((PM_SHORT|PM_FW|PM_D12X|PM_CH) | 0x0E02L)

/* DTMF detection edge select */
#define DXCH_DFLAGS     ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0801L)

/* Per channel ring count */
#define DXCH_RINGCNT    ((PM_SHORT|PM_DRV|PM_DXXX|PM_CH) | 0x0001L)

/* Enable/disable Caller ID */
#define DXCH_CALLID     ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0E04L)

/* Enable/disable Caller ID values */
#define DX_CALLIDDISABLE   0x0000   /* Disable Caller ID */
#define DX_CALLIDENABLE    0x0001   /* Enable Caller ID */

/* Enable/disable Audio line-in */
#define DXCH_AUDIOLINEIN ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0E05L)

/* Enable/disable Audio line-in values */
#define DX_LINEINDISABLE   0x0000   /* Disable audio line-in connection */
#define DX_LINEINENABLE    0x0001   /* Enable audio line-in connection */

/* DTMF Digit buffering mode */
#define DXCH_DIGBUFMODE ((PM_SHORT|PM_LIB|PM_DXXX|PM_CH) | 0x0002L)

/* Per channel I/O buffer Parameters */
#define DXCH_XFERBUFSIZE ((PM_SHORT|PM_LIB|PM_DXXX|PM_CH) | 0x0003L)            //sets both
#define DXCH_RXDATABUFSIZE ((PM_SHORT|PM_LIB|PM_DXXX|PM_CH) | 0x0004L)      //record only
#define DXCH_TXDATABUFSIZE ((PM_SHORT|PM_LIB|PM_DXXX|PM_CH) | 0x0005L)      //play only
#define DXCH_NUMRXBUFFERS ((PM_SHORT|PM_LIB|PM_DXXX|PM_CH) | 0x0006L)      //num record
#define DXCH_NUMTXBUFFERS ((PM_SHORT|PM_LIB|PM_DXXX|PM_CH) | 0x0007L)      //num play

//per channel tone trimming
#define DXCH_DONOTTRIMTONES ((PM_SHORT|PM_LIB|PM_DXXX|PM_CH) | 0x0008L)

/* Per channel EC TAP */
#define DXCH_EC_TAP_LENGTH ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x21BL)

/* ASR Barge-in channel parameters */
#define DXCH_BARGEIN_RECFORMAT    ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0212L)
#define DXCH_VADTIMEOUT           ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0213L)
#define DXCH_SPEECHSNR            ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0214L)
#define DXCH_SPEECHTHRESH         ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0215L)
#define DXCH_SPEECHPLAYTHRESH     ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0215L)
#define DXCH_SPEECHPLAYTRIGG      ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0216L)
#define DXCH_SPEECHNONPLAYTRIGG   ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0217L)
#define DXCH_SPEECHPLAYWINDOW     ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0218L)
#define DXCH_SPEECHNONPLAYWINDOW  ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x0219L)
#define DXCH_SPEECHNONPLAYTHRESH  ((PM_SHORT|PM_FW|PM_DXXX|PM_CH) | 0x021AL)

/* DTMF Digit buffering modes */
#define DX_DIGCYCLIC    1    /* Cyclic shift digits once buffer is full */
#define DX_DIGTRUNC     2    /* Truncate digits once buffer is full */

/* Channel I/O transfer buffer identifiers */
#define BUF_4K    0
#define BUF_8K    1
#define BUF_16K   2
#define BUF_2K    4
#define BUF_1K    5
#define BUF_1_5K  6
#define BUF_DFLT  BUF_8K


/*
 * Board Parameters
 */
/* Size of the ping-pong PLAY buffers on board */
#define DXBD_TXBUFSIZE  ((PM_SHORT|PM_FW|PM_D12XDEV|PM_BD) | 0x00F6L)

/* Size of the ping-pong RECORD buffers on board */
#define DXBD_RXBUFSIZE  ((PM_SHORT|PM_FW|PM_D12XDEV|PM_BD) | 0x00F7L)

/* Flash character in dial string */
#define DXBD_FLASHCHR   ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0301L)

/* Init delay time */
#define DXBD_INITDLY    ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0302L)

/* Min time of LC on for LPD */
#define DXBD_MINPDON    ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0303L)

/* Min time of LC off for LPD */
#define DXBD_MINPDOFF   ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0304L)

/* Length of DTMF digit for dialing*/
#define DXBD_TTDATA     ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0305L)

/* Min time of silence on for APD */
#define DXBD_MINSLON    ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0306L)

/* Min time for silence off for APD */
#define DXBD_MINSLOFF   ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0307L)

/* Min time for dti signal on */
#define DXBD_MINTION    ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0308L)

/* Min time for dti signal off*/
#define DXBD_MINTIOFF   ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0309L)

/* Edge of ring detection */
#define DXBD_R_EDGE     ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x030AL)

/* Flash time during dialing */
#define DXBD_FLASHTM    ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0401L)

/* Pause time during dialing */
#define DXBD_PAUSETM    ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0402L)

/* Minimum off-hook time */
#define DXBD_MINOFFHKTM ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0403L)

/* Length of pulse dialing make */
#define DXBD_P_MK       ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0404L)

/* Length of pulse dialing break */
#define DXBD_P_BK       ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0405L)

/* Length of pulse inter digit delay*/
#define DXBD_P_IDD      ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0406L)

/* Length of TT inter digit delay */
#define DXBD_T_IDD      ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0407L)

/* Delay before offhook finished */
#define DXBD_OFFHDLY    ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0408L)

/* Min time for ring detection*/
#define DXBD_R_ON       ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0409L)

/* Min time for for the end of a ring*/
#define DXBD_R_OFF      ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x040AL)

/* Max wait between rings */
#define DXBD_R_IRD      ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x040BL)

/* Silence on and off debounce time */
#define DXBD_S_BNC      ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x040CL)

/* Min interpulse digit time for LPD */
#define DXBD_MINIPD     ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x040DL)

/* Min time of lc off before message*/
#define DXBD_MINLCOFF   ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x040EL)

/* Max time for lc off for LPD */
#define DXBD_MAXPDOFF   ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x040FL)

/* Min time for silence on for APD */
#define DXBD_MINISL     ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0410L)

/* Max time for silence off for  APD */
#define DXBD_MAXSLOFF   ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0411L)

/* Either a D/40 or D/41 */
#define DXBD_HWTYPE     ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0601L)

/* Number of channels on board */
#define DXBD_CHNUM      ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0602L)

/* System configuration */
#define DXBD_SYSCFG     ((PM_SHORT|PM_FW|PM_DXXX|PM_BD) | 0x0604L)

/*
 * NOTE: Must use PM_CH instead of PM_BD on MF40 paramters.
 */
/* Min time for MF detection */
#define DXBD_MFMINON    ((PM_SHORT|PM_FW|PM_MF40|PM_CH) | 0x0101L)

/* Duration of MF tone during dial */
#define DXBD_MFTONE     ((PM_SHORT|PM_FW|PM_MF40|PM_CH) | 0x0102L)

/* Inter-digit delay during MF dialing */
#define DXBD_MFDELAY    ((PM_SHORT|PM_FW|PM_MF40|PM_CH) | 0x0103L)

/* Duration of LKP tone during MF dialing */
#define DXBD_MFLKPTONE  ((PM_SHORT|PM_FW|PM_MF40|PM_CH) | 0x0104L)

/*
 * Board Parameter values
 */

/*
 * When a rings received message is sent (BD_R_EDGE)
 */
#define ET_RON       1   /* At the beginning of the ring */
#define ET_ROFF      2   /* At the end of the ring */


/*
 * Channel Mode values
 */
#define MD_ADPCM     0x0000    /* ADPCM data (the default) */
#define MD_PCM       0x0100    /* Mu-Law PCM data */
#define MD_FFT       0x0200    /* FFT data (debugging) */
#define MD_GAIN      0x0000    /* AGC on */
#define MD_NOGAIN    0x1000    /* AGC off */
#define PM_TONE      0x0001    /* Tone initiated play/record */
#define RM_TONE      PM_TONE
#define PM_SR6       0x2000    /* 6KHz sampling rate (digitization) */
#define PM_SR8       0x4000    /* 8KHz sampling rate (digitization) */
#define RM_SR6       PM_SR6
#define RM_SR8       PM_SR8
#define PM_ALAW      0x0020    /* Play A-Law data         */
#define RM_ALAW      PM_ALAW   /* Record data using A-Law */
#define PM_DTINIT    0x0002    /* Play with DTMF init */
#define RM_DTINIT    PM_DTINIT /* Record with DTMF init */
#define PM_DTINITSET 0x0010 | PM_DTINIT /* Play with DTMF init set */
#define RM_DTINITSET PM_DTINITSET   /* Record with DTMF init set */
#define R2_COMPELDIG 0x0400    /* R2MF Compelled signalling */

/*
 * dx_stopch modes
 */
#define EV_NOSTOP    0x200     /* Have dx_stopch queue an event if channel is idle */

/*
 * Channel modes for ADSI support
 */
#define PM_RAW       0x0200    /* Raw playback mode */
#define PM_ADSI      0x0080    /* ADSI playback mode */
#define PM_ADSIALERT PM_ADSI | PM_DTINITSET | PM_TONE


#define PM_NOREADWRITE  0x0400 /* Don't perform read/writes */
#define PM_BARGEIN      0x0800 /* Enable bargein during playback */

/*
 *
 */
#define PM_BARGEIN_VADOFF       0x1000
#define RM_BARGEIN             0x0800

/*
 * dx_dial modes
 */
#define DX_CNGTONE      2      /* Generate CNG tone after dialing */

#endif


/*
 * Alternate defines for DE_SILOF, DM_SILOF, DE_LCOF, DM_LCOF
 */
#define DE_SILOFF    DE_SILOF
#define DE_LCOFF     DE_LCOF
#define DM_SILOFF    DM_SILOF
#define DM_LCOFF     DM_LCOF


/*
 * Define's for Mode Checking
 */
#define MD_SELECT    (MD_PCM)    

#define EV_ASYNC     0x8000
#define EV_SYNC      0x0000


/*
 * Raw Line Status Defines
 */
#define RLS_SILENCE  0x80  /* Sil Bit in Raw Line Status */
#define RLS_DTMF     0x40  /* DTMF Signal Bit in Raw Line Status */
#define RLS_LCSENSE  0x20  /* Loop Current Sense Bit in Raw Line Status */
#define RLS_RING     0x10  /* Ring Detect Bit in Raw Line Status */
#define RLS_HOOK     0x08  /* Hook Switch Status Bit in Raw Line Status */
#define RLS_RINGBK   0x04  /* Audible Ringback Detect Bit in Raw Line Status */


/*
 * GTD Defines
 */
#define DM_TONEON    0x01  /* Tone ON Mask */
#define DM_TONEOFF   0x02  /* Tone OFF Mask */

#define TONEALL      0xFFFFFFFF   /* Enable/Disable All Tone ID's */

#define TN_SINGLE    0     /* Single Tone */
#define TN_DUAL      1     /* Dual Tone */

/*
 * Template Modes and Frequency for GTD
 */
#define TN_FREQDEV   5     /* Frequency Deviation */

#define TN_CADENCE   0x01  /* Cadence Detection */
#define TN_LEADING   0x02  /* Leading Edge Detection */
#define TN_TRAILING  0x04  /* Trailing Edge Detection */

//defines for Call Progress Analysis function
#define CA_SIT            0x01            // look for a previously defined SIT tone
#define CA_PAMD      0x02            // use a previously defined PAMD template
#define CA_PVD            0x04            // use a previously defined PVD template.


/*
 * Digit Type Values for User-Defined Tone Templates for GTD
 */
#define DG_USER1     5     /* User Defined Tone */
#define DG_USER2     6     /* User Defined Tone */
#define DG_USER3     7     /* User Defined Tone */
#define DG_USER4     8     /* User Defined Tone */
#define DG_USER5     9     /* User Defined Tone */
#define MAKE_DIGTYPE(id,digit) ((((id)<<8))|digit)


/**
 ** Speed and Volume Control Defines
 **/
#define SV_SPEEDTBL     0x01     /* Modify Speed */
#define SV_VOLUMETBL    0x02     /* Modify Volume */

#define SV_ABSPOS       0x00     /* Absolute Position */
#define SV_RELCURPOS    0x10     /* Relative to Current Position */
#define SV_TOGGLE       0x20     /* Toggle */

#define SV_WRAPMOD      0x0010
#define SV_SETDEFAULT   0x0020
#define SV_LEVEL        0x0100
#define SV_BEGINPLAY    0x0200

/*
 * Toggle Modes for Play Adjustment Conditions
 */
#define SV_TOGORIGIN    0x00  /* Toggle Between Origin and Last */
                              /* Modified Position */
#define SV_CURORIGIN    0x01  /* Reset Current Position to Origin */
#define SV_CURLASTMOD   0x02  /* Reset Current Position to Last */
                              /* Modified Position */
#define SV_RESETORIG    0x03  /* Reset Current Position and Last */
                              /* Modified State to Origin */

/*
 * Defines for dx_addspddig()
 */
#define SV_ADD10PCT   1    /* Speed up Play-Back 10 Percent */
#define SV_ADD20PCT   2    /* Speed up Play-Back 20 Percent */
#define SV_ADD30PCT   3    /* Speed up Play-Back 30 Percent */
#define SV_ADD40PCT   4    /* Speed up Play-Back 40 Percent */
#define SV_ADD50PCT   5    /* Speed up Play-Back 50 Percent */
#define SV_SUB10PCT  -1    /* Slow Down Play-Back 10 Percent */
#define SV_SUB20PCT  -2    /* Slow Down Play-Back 20 Percent */
#define SV_SUB30PCT  -3    /* Slow Down Play-Back 30 Percent */
#define SV_SUB40PCT  -4    /* Slow Down Play-Back 40 Percent */

#define SV_NORMAL    0xFF  /* Set Play-Back to Normal Speed/Volume */

/*
 * Defines for dx_addvoldig()
 */
#define SV_ADD2DB     1    /* Increase Play-Back Volume by 2db */
#define SV_ADD4DB     2    /* Increase Play-Back Volume by 4db */
#define SV_ADD6DB     3    /* Increase Play-Back Volume by 6db */
#define SV_ADD8DB     4    /* Increase Play-Back Volume by 8db */
#define SV_SUB2DB    -1    /* Decrease Play-Back Volume by 2db */
#define SV_SUB4DB    -2    /* Decrease Play-Back Volume by 4db */
#define SV_SUB6DB    -3    /* Decrease Play-Back Volume by 6db */
#define SV_SUB8DB    -4    /* Decrease Play-Back Volume by 8db */

#define IGNORESTATE   1

/*
 * Wave file support defines
 */
/*
 * File formats
 */
#define FILE_FORMAT_VOX    1     /* Dialogic VOX format */
#define FILE_FORMAT_WAVE   2     /* Microsoft Wave format */
#define FILE_FORMAT_NONE   3     /* No file being used */

/*
 * Sampling rate
 */
#define DRT_6KHZ           0x30  /* 6KHz */
#define DRT_8KHZ           0x40  /* 8KHz */
#define DRT_11KHZ          0x58  /* 11KHz */

/*
 * Data format
 */
#define DATA_FORMAT_DIALOGIC_ADPCM            0x1            /* OKI ADPCM */
#define DATA_FORMAT_ALAW                        0x3            /* alaw PCM  */
#define DATA_FORMAT_G726                        0x4            /* G.726     */
#define DATA_FORMAT_MULAW                        0x7            /* mulaw PCM */
#define DATA_FORMAT_PCM                              0x8            /* PCM       */
#define DATA_FORMAT_G729A                        0x0C      /* CELP coder */
#define DATA_FORMAT_GSM610                        0x0D      /* Microsoft GSM (backward compatible*/
#define DATA_FORMAT_GSM610_MICROSOFT      0x0D      /* Microsoft GSM */
#define DATA_FORMAT_GSM610_ETSI                  0x0E      /* ETSI standard framing */
#define DATA_FORMAT_GSM610_TIPHON            0x0F      /* ETSI TIPHON bit order */
#define DATA_FORMAT_LC_CELP                  0x10            /* Lucent CELP Coder */
#define DATA_FORMAT_TRUESPEECH                  0x10            /* TRUESPEECH Coder */
#define DATA_FORMAT_FFT             0xFF  /* fft data  */

/*
 * dx_gtsernum() subfunctions
 */
#define GS_SN  0x0000   /* ret. board serial #, 8 bytes ASCIIZ string */
#define GS_SSN 0x0001   /* ret. board silicon serial number, 8 bytes */


/*
 * Channel I/O status defines
 */
#ifndef IN_SERVICE
#define IN_SERVICE  0      /* Put the channel back into service */
#endif
#ifndef OUT_SERVICE
#define OUT_SERVICE 1      /* Take the channel out of service */
#endif


/*
 * DX_EBLK
 *
 * Event block structure
 * [NOTE: All user-accessible structures must be defined so as to be
 *        unaffected by structure packing.]
 */
typedef struct dx_eblk {
   unsigned short  ev_event;     /* Event that occured */
   unsigned short  ev_data;      /* Event-specific data */
   unsigned char   ev_rfu[12];   /* RFU for packing-independence */
} DX_EBLK;


/*
 * DX_CST
 *
 * Call Status Transition Structure
 * [NOTE: All user-accessible structures must be defined so as to be
 *        unaffected by structure packing.]
 */
typedef struct dx_cst {
   unsigned short cst_event;     /* CST Event */
   unsigned short cst_data;      /* Data Associated with the Event */
} DX_CST;


/*
 * Speed and Volume Control typedefs
 */

/*
 * Speed/Volume Condition Block
 */
typedef struct dx_svcb {
   unsigned short type;       /* Bit Mask */
   short          adjsize;    /* Adjustment Size */
   unsigned char  digit;      /* ASCII digit value that causes the action */
   unsigned char  digtype;    /* Digit Type (e.g. 0 = DTMF) */
} DX_SVCB;


/*
 * Speed/Volume Modification Table
 */
typedef struct dx_svmt {
  char decrease[ 10 ];        /* Ten Downward Steps */
  char origin;                /* Regular Speed and Volume */
  char increase[ 10 ];        /* Ten Upward Steps */
} DX_SVMT;


/*
 * Standard Call Progress Signal Definitions
 */
#define CP_DIAL                 dx_get_tngencad ( 1 )  
#define CP_REORDER              dx_get_tngencad ( 2 )  
#define CP_BUSY                 dx_get_tngencad ( 3 )  
#define CP_RINGBACK1            dx_get_tngencad ( 4 )  
#define CP_RINGBACK2            dx_get_tngencad ( 5 )  
#define CP_RINGBACK1_CALLWAIT   dx_get_tngencad ( 6 )  
#define CP_RINGBACK2_CALLWAIT   dx_get_tngencad ( 7 )
#define CP_RECALL_DIAL          dx_get_tngencad ( 8 )
#define CP_INTERCEPT            dx_get_tngencad ( 9 )
#define CP_CALLWAIT1            dx_get_tngencad ( 10 )
#define CP_CALLWAIT2            dx_get_tngencad ( 11 )
#define CP_BUSY_VERIFY_A        dx_get_tngencad ( 12 )
#define CP_BUSY_VERIFY_B        dx_get_tngencad ( 13 )
#define CP_EXEC_OVERRIDE        dx_get_tngencad ( 14 )
#define CP_FEATURE_CONFIRM      dx_get_tngencad ( 15 )
#define CP_MSG_WAIT_DIAL        dx_get_tngencad ( 16 ) // Same as CP_STUTTER_DIAL
#define CP_STUTTER_DIAL         dx_get_tngencad ( 16 ) // Same as CP_MSG_WAIT_DIAL
#define MAX_CP_TONES            16


/*
 * Tone Generation Template
 */
typedef struct {
   unsigned short tg_dflag;   /* Dual Tone - 1, Single Tone - 0 */
   unsigned short tg_freq1;   /* Frequency for Tone 1 (HZ) */
   unsigned short tg_freq2;   /* Frequency for Tone 2 (HZ) */
   short          tg_ampl1;   /* Amplitude for Tone 1 (db) */
   short          tg_ampl2;   /* Amplitude for Tone 2 (db) */
   short          tg_dur;     /* Duration of the Generated Tone */
                              /* Units = 10ms */
} TN_GEN;

/*
 * Cadenced Tone Generation Template
 */
typedef struct {
   unsigned char cycles;      /* Number of cycles */
   unsigned char numsegs;     /* Number of tones */
   short         offtime[4];  /* Array of durations, one for each tone */
   TN_GEN        tone[4];     /* Array of tone templates */
} TN_GENCAD;

/*
 * Transfer parameter block
 */
 typedef struct {
   unsigned short wFileFormat;    /* file format */
   unsigned short wDataFormat;    /* data encoding */
   unsigned long  nSamplesPerSec; /* sampling rate */
   unsigned short wBitsPerSample; /* bits per sample */
} DX_XPB;

/*
 * FEATURE_TABLE structure
 */
typedef struct feature_table {
   unsigned short ft_play;
   unsigned short ft_record;
   unsigned short ft_tone;
   unsigned short ft_e2p_brd_cfg;
   unsigned short ft_fax;
   unsigned short ft_front_end;
   unsigned short ft_misc;
   unsigned short ft_send;
   unsigned short ft_receive;
   unsigned short ft_rfu[6];
} FEATURE_TABLE;

/*
 * Defines for features supported on a device.
 * Use with the feature table obtained from dx_getfeaturelist.
 */
/* Play and Record features */
#define FT_ADPCM           0x0001
#define FT_PCM             0x0002
#define FT_ALAW            0x0004
#define FT_ULAW            0x0008
#define FT_LINEAR          0x0010
#define FT_ITU_G_726       0x0020
#define FT_ADSI            0x0040
#define FT_RAW64KBIT       0x0080
#define FT_DRT6KHZ         0x0100
#define FT_DRT8KHZ         0x0200
#define FT_DRT11KHZ        0x0400
//07-07-1999[cjl] added these defines ******************************************
#define FT_FFT                              0x0800
#define FT_FSK_OH                        0x1000
#define FT_G729A                        0x2000
#define FT_MSGSM                        0x4000
//******************************************************************************

/* GTD and GTD features */
#define FT_GTDENABLED      0x0001
#define FT_GTGENABLED      0x0002
#define FT_CADENCE_TONE    0x0004

/* E2P features */
#define FT_CALLP           0x0002
#define FT_MF_TONE_DETECT  0x0004
#define FT_DPD             0x0020
#define FT_SYNTELLECT      0x0040
#define FT_ECR                              0x0080
#define FT_CSP                              0x0100

/* FAX features */
#define FT_FAX             0x0001
#define FT_VFX40           0x0002
#define FT_VFX40E          0x0004
#define FT_VFX40E_PLUS     0x0008
#define FT_FAX_EXT_TBL         0x10
#define FT_SENDFAX_TXFILE_ASCII      0x02
#define FT_RS_SHARE        0x20
#define RSC_FAX            0x34
#define RSC_ASSIGNED       1
#define RSC_NOTASSIGNED    0

/* FrontEnd features */
#define FT_ANALOG          0x0001
#define FT_EARTH_RECALL    0x0002

/* Feature Options */
#define FT_CALLERID        0x0001

/*
 * Type definition for Channel/Timeslot device info structure and its values
 */
#ifndef __CT_DEVINFO__
#define __CT_DEVINFO__

/*
 * CT_DEVINFO structure
 */
typedef struct ct_devinfo {
   unsigned long  ct_prodid;
   unsigned char  ct_devfamily;
   unsigned char  ct_devmode;
   unsigned char  ct_nettype;
   unsigned char  ct_busmode;
   unsigned char  ct_busencoding;
   unsigned char  ct_rfu[7];
} CT_DEVINFO;

/*
 * Value defines
 */
/* device family */
#define CT_DFD41D                    0x01
#define CT_DFD41E         0x02
#define CT_DFSPAN         0x03
#define CT_DFMSI          0x04
#define CT_DFDM3          0x05

/* device mode */
#define CT_DMNETWORK      0x00
#define CT_DMRESOURCE     0x01

/* network type */
#define CT_NTNONE         0x00
#define CT_NTT1           0x01
#define CT_NTE1           0x02
#define CT_NTANALOG       0x03
#define CT_NTMSI          0x04
#define CT_NTIPT          0x05

/* bus mode */
#define CT_BMPEB          0x00
#define CT_BMSCBUS        0x01
#define CT_BMH100                    0x06

/* bus encoding */
#define CT_BEULAW         0x00
#define CT_BEALAW         0x01

/*
 * DATA TRANSFER API
 */
#define DT_ADSI            0x0001
#define DT_RAWDATA      0x0002

/*
 * ADSI data transfer modes
 */
#define ADSI_ALERT            0x000A
#define ADSI_NOALERT            0x0005
#define ADSI_ONHOOK_SEIZURE      0x0009
#define ADSI_ONHOOK_NOSEIZURE      0x000B

/*
 * ADSI data transfer structure
 */
typedef struct _ADSI_XFERSTRUC {
   UINT            cbSize;
   DWORD      dwTxDataMode;
   DWORD      dwRxDataMode;
} ADSI_XFERSTRUC;
 
/*
 * RAW data transfer modes
 */
#define RAW_64KBIT            0x0006

/*
 * RAW data transfer structure
 */
typedef struct _RAWDATA_XFERSTRUC {
   UINT            cbSize;
   DWORD      dwTxDataMode;
   DWORD      dwRxDataMode;
} RAWDATA_XFERSTRUC;

#endif


/*
 * Type definition for SCBus Timeslots information structure.
 */
#ifndef __SC_TSINFO__
#define __SC_TSINFO__
typedef struct sc_tsinfo {
   unsigned long  sc_numts;
   long          *sc_tsarrayp;
} SC_TSINFO;
#endif

/*
 * Type definition for ECR Characteristic Table structure.
 */
#ifndef __DX_ECRCT__
#define __DX_ECRCT__
typedef struct dx_ecrct {
   int  ct_length;            /* Sizeof this structure */
   unsigned char ct_NLPflag;      /* NLP required during echo-cancellation? */
} DX_ECRCT;

#define SIZE_OF_ECR_CT sizeof(DX_ECRCT)
#define ECR_CT_ENABLE  0
#define ECR_CT_DISABLE 1
#endif

/*
 * Definition for Read/Write Callback Routine
 */
typedef void (*DXRWROUTINE)(DWORD, PCHAR, DWORD);


#ifdef __cplusplus
extern "C" {               // C Plus Plus function bindings
#define extern
#endif

/*
 *      Useful declaration specification.
 */
/*
 *      Module Definition file compatibility.
 */
#ifdef __USING_DEF_FILE__

#ifdef DllExport
#undef DllExport
#endif

#ifdef DllImport
#undef DllImport
#endif

#ifdef DllLinkage
#undef DllLinkage
#endif

#define DllExport
#define DllImport
#define DllLinkage extern

#else      /* __USING_DEF_FILE__      */

#ifndef DllExport
#define DllExport      __declspec( dllexport )
#endif      /*      Dllexport      */

#ifndef DllImport
#define DllImport __declspec( dllimport )
#endif      /*      Dllimport      */

#ifdef _VOX_DLL
#define      DllLinkage      DllExport
#else
#define DllLinkage      DllImport
#endif

#endif      /* __USING_DEF_FILE__      */

#ifdef __CROSS_COMPAT_LIB__
#undef DllLinkage
#define DllLinkage    
#endif

#if (defined (__BORLANDC__) || defined (__cplusplus) || defined( __STDC__ ))

/* Function Prototypes - ANSI C & C++ */

DllLinkage int __cdecl ag_getctinfo( int chDev, CT_DEVINFO *ct_devinfop);
DllLinkage int __cdecl ag_getxmitslot( int chDev, SC_TSINFO *sc_tsinfop);
DllLinkage int __cdecl ag_listen( int chDev, SC_TSINFO *sc_tsinfop );
DllLinkage int __cdecl ag_unlisten( int chDev );
DllLinkage int __cdecl dx_addspddig( int chdev, char digit, short adjval );
DllLinkage int __cdecl dx_addtone( int chdev, unsigned char digit, unsigned char digtype );
DllLinkage int __cdecl dx_addvoldig( int chdev, char digit, short adjval );
DllLinkage int __cdecl dx_adjsv( int chdev, unsigned short tabletype,
                        unsigned short action, unsigned short adjsize );
DllLinkage int __cdecl dx_blddt( unsigned int id,   unsigned freq1, unsigned int fq1dev,
                                        unsigned int freq2, unsigned int fq2dev,
                                        unsigned int mode );
DllLinkage int __cdecl dx_blddtcad( unsigned int ToneID,
                        unsigned int freq1,   unsigned int fq1dev,
                        unsigned int freq2,   unsigned int fq2dev,
                        unsigned int OnTime,  unsigned int OnTimeDev,
                        unsigned int OffTime, unsigned int OffTimeDev,
                        unsigned int repcnt );
DllLinkage int __cdecl dx_bldst( unsigned int ToneID, unsigned int freq, unsigned int fqdev,
                     unsigned int mode );
DllLinkage int __cdecl dx_bldstcad( unsigned int ToneID,
                        unsigned int freq, unsigned int fqdev,
                        unsigned int OnTime,  unsigned int OnTimeDev,
                        unsigned int OffTime, unsigned int OffTimeDev,
                        unsigned int repcnt );
DllLinkage void __cdecl dx_bldtngen( TN_GEN *tngenp,
                        unsigned short freq1, unsigned short freq2,
                        short amplitude1,    short amplitude2, short duration );
DllLinkage int __cdecl dx_chgfreq( int tonetype, int fq1, int dv1, int fq2, int dv2 );
DllLinkage int __cdecl dx_chgdur( int typetype, int on, int ondv, int off, int offdv );
DllLinkage int __cdecl dx_chgrepcnt( int tonetype, int repcount );
DllLinkage int __cdecl dx_chgqualid( int qualid );
DllLinkage int __cdecl dx_close( int dev );
DllLinkage void __cdecl dx_clrcap( DX_CAP *capp );
DllLinkage int __cdecl dx_clrdigbuf( int chdev );
DllLinkage int __cdecl dx_clrsvcond( int chdev );
DllLinkage int __cdecl dx_clrtpt( DV_TPT *tptp, int size );
DllLinkage int __cdecl dx_comtest( int chdev );
DllLinkage int __cdecl dx_deltones( int chdev );
DllLinkage int __cdecl dx_dial( int chdev, const char *dialstrp, const DX_CAP *capp, unsigned short mode );
DllLinkage int __cdecl dx_distone( int chdev, int toneID, int evtMask );
DllLinkage int __cdecl dx_enbtone( int chdev, int ToneID, int evtMask );
DllLinkage int __cdecl dx_getcursv( int chdev, int *curvolp, int *curspeedp );
DllLinkage int __cdecl dx_getctinfo( int chDev, CT_DEVINFO *ct_devinfop);
DllLinkage int __cdecl dx_getdig( int chdev, const DV_TPT *tptp, DV_DIGIT *digitp,
                        unsigned short mode );
DllLinkage int __cdecl dx_getevt( int chdev, DX_EBLK *eblkp, int timeout );
DllLinkage int __cdecl dx_getfeaturelist( int chDev, FEATURE_TABLE *feature_tablep);
DllLinkage int __cdecl dx_getparm( int dev, unsigned long parm, void * valuep );
DllLinkage int __cdecl dx_getsvmt( int ChDev, unsigned short tableType, DX_SVMT *svmtp );
DllLinkage TN_GENCAD * __cdecl dx_get_tngencad( unsigned int toneid );
DllLinkage int __cdecl dx_getuio(DX_UIO *appuiop);
DllLinkage int __cdecl dx_getxmitslot( int chDev, SC_TSINFO *sc_tsinfop);
DllLinkage int __cdecl dx_initcallp( int chdev );
DllLinkage int __cdecl dx_listen( int chDev, SC_TSINFO *sc_tsinfop );
DllLinkage int __cdecl dx_open( const char *namep, int oflags );
DllLinkage int __cdecl dx_pause( int chDev);
DllLinkage int __cdecl dx_play( int ChDev, DX_IOTT *iottp, const DV_TPT *tptp,
                        unsigned short mode );
DllLinkage int __cdecl dx_playf(int ChDev, const char *fNamep, const DV_TPT *tptp, unsigned short mode);
DllLinkage int __cdecl dx_playtone( int ChDev, const TN_GEN *tngenp, const DV_TPT *tptp, int mode );
DllLinkage int __cdecl dx_playtoneEx( int ddd, const TN_GENCAD *tngencadp, const DV_TPT *tptp, int mode );
DllLinkage int __cdecl dx_readsram(int ChDev, PUCHAR pBuffer, int BufferSize, int Offset, PCHAR pFileName );
DllLinkage int __cdecl dx_rec(int ChDev, DX_IOTT *iottp, const DV_TPT *tptp, unsigned short mode);
DllLinkage int __cdecl dx_recf( int ChDev, const char *fNamep, const DV_TPT *tptp, unsigned short mode);
DllLinkage int __cdecl dx_resume( int chDev);
DllLinkage int __cdecl dx_route( int BdDev, int Chan, int TimeSlot );
DllLinkage int __cdecl dx_routerxtx( int ddd, int channel, int rxslot, int txslot );
DllLinkage int __cdecl dx_sendevt( int devd, unsigned long evttype, void *evtdatap, short evtlen, unsigned short flags);
DllLinkage int __cdecl dx_setchxfercnt(int chDev, int bufnum);
DllLinkage int __cdecl dx_setdevuio(int chDev, DX_UIO *devuiop, DX_UIO **retuiop);
DllLinkage int __cdecl dx_setdigtyp( int ChDev, unsigned short DigitMask );
DllLinkage int __cdecl dx_setdigbuf( int ChDev, int Mode );
DllLinkage int __cdecl dx_setevtmsk( int ChDev, unsigned int mask );
DllLinkage void __cdecl dx_setgtdamp( short Min1, short Max1, short Min2, short Max2 );
DllLinkage int __cdecl dx_sethook( int ChDev, int HookState, unsigned short mode );
DllLinkage int __cdecl dx_setiostatus(INT SrlDevice, INT Status);
DllLinkage int __cdecl dx_setparm( int Dev, unsigned long parm, const void * valuep );
DllLinkage int __cdecl dx_setrings( int devd, unsigned int nrings );
//weihsin
DllLinkage int __cdecl dx_GetRscStatus (int Dev, unsigned long resourceid, int *);
DllLinkage int __cdecl dx_assignresource (int Dev, unsigned long resourceid);
DllLinkage int __cdecl dx_unassignresource (int Dev, unsigned long resourceid);
DllLinkage int __cdecl dx_getdsprs (int Dev, unsigned long resourceid, char* ApplicationBuffer, long *lpTotalResources, long *NumDSP);

//end
DllLinkage int __cdecl dx_setsvcond( int ChDev, unsigned short numBlks, const DX_SVCB *svcbp );
DllLinkage int __cdecl dx_setsvmt(int ChDev, unsigned short TableType, const DX_SVMT *svmtp,
                      unsigned short flag  );
DllLinkage int __cdecl dx_settonelen( int tonelength );
DllLinkage int __cdecl dx_setuio( DX_UIO );
DllLinkage int __cdecl dx_stopch( int ChDev, unsigned short mode );
DllLinkage int __cdecl dx_unlisten( int chDev );
DllLinkage int __cdecl dx_wink( int ChDev, unsigned short mode );
DllLinkage int __cdecl dx_wtring( int ChDev, int numRings, int HookState, int timeout );
#if defined (__BORLANDC__) || defined (DLGC_CLIB)
DllLinkage int __cdecl dx_fileopen ( const char * filep, int flags, int pmode);
DllLinkage int __cdecl dx_filesopen ( const char * filep, int oflag, int shflag, int pmode);
#else
DllLinkage int __cdecl dx_fileopen ( const char * filep, int flags, ...);
DllLinkage int __cdecl dx_filesopen ( const char * filep, int oflag, int shflag, ...);
#endif
DllLinkage int __cdecl dx_fileclose ( int handle );
DllLinkage long __cdecl dx_fileseek ( int handle, long offset, int origin );
DllLinkage int __cdecl dx_fileread ( int handle, void * buffer, unsigned int count );
DllLinkage int __cdecl dx_filewrite ( int handle, void * buffer, unsigned int count );
DllLinkage int __cdecl dx_filelocking ( int handle, int mode, long bytes );
DllLinkage int __cdecl dx_filechsize ( int handle, long size );
DllLinkage int __cdecl dx_filecommit ( int handle );
DllLinkage int __cdecl dx_filedup ( int handle );
DllLinkage int __cdecl dx_filedup2 ( int handle1, int handle2 );
DllLinkage int __cdecl dx_fileumask ( int pmode );
DllLinkage long __cdecl dx_filetell ( int handle );
DllLinkage int __cdecl dx_filestat ( const char * path, struct _stat * buffer );
DllLinkage int __cdecl dx_filefstat ( int handle, struct _stat * buffer );
DllLinkage long __cdecl dx_filefilelength( int handle );
DllLinkage int __cdecl dx_fileisatty( int handle );
DllLinkage int __cdecl dx_filesetmode( int handle, int mode );
DllLinkage int __cdecl dx_fileopen_osfhandle( long osfhandle, int flags );
DllLinkage int __cdecl dx_fileerrno( void );
DllLinkage int __cdecl dx_playiottdata( int ChDev,DX_IOTT * iottp,const DV_TPT * tptp,
                                     const DX_XPB * xpbp,unsigned short mode);
DllLinkage int __cdecl dx_playwav( int ChDev, const char * fNamep, const DV_TPT *tptp,
                                                         unsigned short mode);
DllLinkage int __cdecl dx_playvox( int ChDev, const char * fNamep, const DV_TPT *tptp,
                                     const DX_XPB * xpbp,unsigned short mode);
DllLinkage int __cdecl dx_reciottdata( int ChDev,DX_IOTT * iottp, const DV_TPT *tptp,
                                     DX_XPB * xpbp,unsigned short mode);
DllLinkage int __cdecl dx_recwav( int ChDev, const char * fNamep, const DV_TPT *tptp,
                                     DX_XPB * xpbp,unsigned short mode);
DllLinkage int __cdecl dx_recvox( int ChDev, const char * fNamep, const DV_TPT *tptp,
                                     DX_XPB * xpbp,unsigned short mode);
DllLinkage int __cdecl dx_mreciottdata( int ChDev,DX_IOTT * iottp, const DV_TPT *tptp,
                               DX_XPB * xpbp,unsigned short mode, SC_TSINFO *lpTimeSlot);
DllLinkage int __cdecl dx_getr2mf( int Chdev, const char *src1_ptr, unsigned short src1_len,
                        const char *src2_ptr, unsigned short src2_len,
              char *dest_ptr, unsigned short dest_len, unsigned short mode);

DllLinkage int __cdecl dx_set_lasterr(int Chdev, long error);
DllLinkage int __cdecl dx_gtcallid( int Chdev, unsigned char *bufp);
DllLinkage int __cdecl dx_gtextcallid( int Chdev, int infotype, unsigned char *bufp);
DllLinkage int __cdecl dx_gtromsig ( int Chdev, char *bufp );
DllLinkage int __cdecl dx_wtcallid( int Chdev, int nrings, int timeout,unsigned char *bufp);
DllLinkage int __cdecl dx_SendReadRequest( INT SrlDevice, PCHAR Buffer,
                                   DWORD DataLength, DXRWROUTINE ReadCompletionRoutine );
DllLinkage int __cdecl dx_SendWriteRequest( INT SrlDevice, PCHAR Buffer, DWORD DataLength,
                                    DWORD BulkFlags, DXRWROUTINE WriteCompletionRoutine   );
DllLinkage int __cdecl dx_InitializeBargeIn( int Chdev, const DV_TPT * tptp,
                            DX_XPB *xpbp, USHORT RecordMode);
DllLinkage int __cdecl dx_gtsernum( int dev, int subfcn, void *buffp);
DllLinkage int __cdecl dx_TSFStatus( void );
DllLinkage int __cdecl dx_listenecr( int chDev, SC_TSINFO *sc_tsinfop );
DllLinkage int __cdecl dx_listenecrex( int chDev, SC_TSINFO *sc_tsinfop, void *dx_ecrctp );
DllLinkage int __cdecl dx_unlistenecr( int chDev );
DllLinkage int __cdecl dx_getxmitslotecr( int chDev, SC_TSINFO *sc_tsinfop);
DllLinkage int __cdecl r2_creatfsig(int chDev, int toneid);
DllLinkage int __cdecl r2_playbsig(int chDev, int backwardsig, int forwardsig, int mode);
DllLinkage int __cdecl dx_BargeIn( int chDev, DX_IOTT *lpPlayIott,
                  DX_IOTT *lpRecordIott,
                  const DV_TPT *lpPlayTerminations,
                  const DV_TPT *lpRecordTerminations,
                  DX_XPB *lpPlayParams,
                  USHORT Mode);
DllLinkage int __cdecl dx_TxIottData( int chDev, DX_IOTT *iottp, const DV_TPT *lpTerminations, int wType,
LPVOID lpParams, USHORT mode);
DllLinkage int __cdecl dx_RxIottData( int chDev, DX_IOTT *iottp, const DV_TPT *lpTerminations, int wType,
LPVOID lpParams, USHORT mode);
DllLinkage int __cdecl dx_TxRxIottData( int chDev, DX_IOTT *lpTxIott, const DV_TPT *lpTxTerminations, DX_IOTT
*lpRxIott, const DV_TPT *lpRxTerminations, int wType, LPVOID lpParams, USHORT mode);

/*
 * Extended Attributes
 */
DllLinkage char * __cdecl ATDX_BDNAMEP(  INT SrlDevice );
DllLinkage char ** __cdecl ATDX_CHNAMES( INT SrlDevice );
DllLinkage long __cdecl ATDX_BDTYPE(     INT SrlDevice );
DllLinkage long __cdecl ATDX_BUFDIGS(    INT SrlDevice );
DllLinkage long __cdecl ATDX_CHNUM(      INT SrlDevice );
DllLinkage long __cdecl ATDX_DEVTYPE(    INT SrlDevice );
DllLinkage long __cdecl ATDX_DBMASK(     INT SrlDevice );
DllLinkage long __cdecl ATDX_EVTCNT(     INT SrlDevice );
DllLinkage long __cdecl ATDX_FWVER(      INT SrlDevice );
DllLinkage long __cdecl ATDX_HOOKST(     INT SrlDevice );
DllLinkage long __cdecl ATDX_LINEST(     INT SrlDevice );
DllLinkage long __cdecl ATDX_NUMCHAN(    INT SrlDevice );
DllLinkage long __cdecl ATDX_PHYADDR(    INT SrlDevice );
DllLinkage long __cdecl ATDX_PRODUCT(    INT SrlDevice );
DllLinkage long __cdecl ATDX_RINGCNT(    INT SrlDevice );
DllLinkage long __cdecl ATDX_DIGBUFMODE( INT SrlDevice );
DllLinkage long __cdecl ATDX_STATE(      INT SrlDevice );
DllLinkage long __cdecl ATDX_TERMMSK(    INT SrlDevice );
DllLinkage long __cdecl ATDX_TONEID(     INT SrlDevice );
DllLinkage long __cdecl ATDX_TRCOUNT(    INT SrlDevice );
DllLinkage long __cdecl ATDX_XFERBUFSIZE(INT SrlDevice );
DllLinkage long __cdecl ATDX_RXDATABUFSIZE(INT SrlDevice );

/*
 * Call Analysis Extended Attributes
 */
DllLinkage long __cdecl ATDX_ANSRSIZ(  INT SrlDevice );
DllLinkage long __cdecl ATDX_CONNTYPE( INT SrlDevice );
DllLinkage long __cdecl ATDX_CPERROR(  INT SrlDevice );
DllLinkage long __cdecl ATDX_CPTERM(   INT SrlDevice );
DllLinkage long __cdecl ATDX_FRQDUR(   INT SrlDevice );
DllLinkage long __cdecl ATDX_FRQDUR2(  INT SrlDevice );
DllLinkage long __cdecl ATDX_FRQDUR3(  INT SrlDevice );
DllLinkage long __cdecl ATDX_FRQHZ(    INT SrlDevice );
DllLinkage long __cdecl ATDX_FRQHZ2(   INT SrlDevice );
DllLinkage long __cdecl ATDX_FRQHZ3(   INT SrlDevice );
DllLinkage long __cdecl ATDX_FRQOUT(   INT SrlDevice );
DllLinkage long __cdecl ATDX_LONGLOW(  INT SrlDevice );
DllLinkage long __cdecl ATDX_SHORTLOW( INT SrlDevice );
DllLinkage long __cdecl ATDX_SIZEHI(   INT SrlDevice );
DllLinkage long __cdecl ATDX_DTNFAIL( INT SrlDevice );
DllLinkage long __cdecl ATDX_CRTNID( INT SrlDevice );
DllLinkage int  __cdecl dx_callp (int chdev, UINT SignalWaitTime, UINT AnswerWaitTime, UINT PVDWaitTime,
                                                                   UINT PVD_Id, UINT PAMD_Id, USHORT Mode);

/*
 * 'C' language interface functions
 */
DllLinkage long __cdecl dx_libinit( unsigned short flags );
DllLinkage long __cdecl dx_GetDllVersion( LPDWORD fileverp, LPDWORD prodverp );

#else

/* Function Prototypes - Old K&R C */

DllLinkage int __cdecl ag_getctinfo();
DllLinkage int __cdecl ag_getxmitslot();
DllLinkage int __cdecl ag_listen();
DllLinkage int __cdecl ag_unlisten();
DllLinkage int __cdecl dx_addspddig();
DllLinkage int __cdecl dx_addtone();
DllLinkage int __cdecl dx_addvoldig();
DllLinkage int __cdecl dx_adjsv();
DllLinkage int __cdecl dx_blddt();
DllLinkage int __cdecl dx_blddtcad();
DllLinkage int __cdecl dx_bldst();
DllLinkage int __cdecl dx_bldstcad();
DllLinkage void __cdecl dx_bldtngen();
DllLinkage int __cdecl dx_chgfreq();
DllLinkage int __cdecl dx_chgdur();
DllLinkage int __cdecl dx_chgrepcnt();
DllLinkage int __cdecl dx_chgqualid();
DllLinkage int __cdecl dx_close();
DllLinkage void __cdecl dx_clrcap();
DllLinkage int __cdecl dx_clrdigbuf();
DllLinkage int __cdecl dx_clrsvcond();
DllLinkage int __cdecl dx_clrtpt();
DllLinkage int __cdecl dx_comtest();
DllLinkage int __cdecl dx_deltones();
DllLinkage int __cdecl dx_dial();
DllLinkage int __cdecl dx_distone();
DllLinkage int __cdecl dx_enbtone();
DllLinkage int __cdecl dx_getcursv();
DllLinkage int __cdecl dx_getctinfo();
DllLinkage int __cdecl dx_getdig();
DllLinkage int __cdecl dx_getevt();
DllLinkage int __cdecl dx_getfeaturelist();
DllLinkage int __cdecl dx_getparm();
DllLinkage int __cdecl dx_getsvmt();
DllLinkage TN_GENCAD * __cdecl dx_get_tngencad();
DllLinkage int __cdecl dx_getuio();
DllLinkage int __cdecl dx_getxmitslot();
DllLinkage int __cdecl dx_initcallp();
DllLinkage int __cdecl dx_listen();
DllLinkage int __cdecl dx_open();
DllLinkage int __cdecl dx_pause();
DllLinkage int __cdecl dx_play();
DllLinkage int __cdecl dx_playf();
DllLinkage int __cdecl dx_playtone();
DllLinkage int __cdecl dx_playtoneEx();
DllLinkage int __cdecl dx_readsram();
DllLinkage int __cdecl dx_rec();
DllLinkage int __cdecl dx_recf();
DllLinkage int __cdecl dx_resume();
DllLinkage int __cdecl dx_route();
DllLinkage int __cdecl dx_routerxtx();
DllLinkage int __cdecl dx_sendevt();
DllLinkage int __cdecl dx_setchxfercnt();
DllLinkage int __cdecl dx_setdevuio();
DllLinkage int __cdecl dx_setdigtyp();
DllLinkage int __cdecl dx_setdigbuf();
DllLinkage int __cdecl dx_setevtmsk();
DllLinkage void __cdecl dx_setgtdamp();
DllLinkage int __cdecl dx_sethook();
DllLinkage int __cdecl dx_setiostatus();
DllLinkage int __cdecl PBXpertInit();
DllLinkage int __cdecl dx_setparm();
//weishin
DllLinkage int __cdecl dx_GetRscStatus( );
DllLinkage int __cdecl dx_assignresource( );
DllLinkage int __cdecl dx_unassignresource( );
DllLinkage int __cdecl dx_getdsprs( );

//end
DllLinkage int __cdecl dx_setrings();
DllLinkage int __cdecl dx_setsvcond();
DllLinkage int __cdecl dx_setsvmt();
DllLinkage int __cdecl dx_settonelen();
DllLinkage int __cdecl dx_setuio();
DllLinkage int __cdecl dx_stopch();
DllLinkage int __cdecl dx_unlisten();
DllLinkage int __cdecl dx_wink();
DllLinkage int __cdecl dx_wtring();
DllLinkage int __cdecl dx_fileopen();
DllLinkage int __cdecl dx_fileclose();
DllLinkage long __cdecl dx_fileseek();
DllLinkage int __cdecl dx_fileread();
DllLinkage int __cdecl dx_filewrite();
DllLinkage int __cdecl dx_filesopen ();
DllLinkage int __cdecl dx_filelocking();
DllLinkage int __cdecl dx_filechsize();
DllLinkage int __cdecl dx_filecommit();
DllLinkage int __cdecl dx_filedup();
DllLinkage int __cdecl dx_filedup2();
DllLinkage int __cdecl dx_fileumask();
DllLinkage long __cdecl dx_filetell();
DllLinkage int __cdecl dx_filestat();
DllLinkage int __cdecl dx_filefstat();
DllLinkage long __cdecl dx_filefilelength();
DllLinkage int __cdecl dx_fileisatty();
DllLinkage int __cdecl dx_filesetmode();
DllLinkage int __cdecl dx_fileopen_osfhandle();
DllLinkage int __cdecl dx_fileerrno();
DllLinkage int __cdecl dx_playiottdata();
DllLinkage int __cdecl dx_playwav();
DllLinkage int __cdecl dx_playvox();
DllLinkage int __cdecl dx_reciottdata();
DllLinkage int __cdecl dx_recwav();
DllLinkage int __cdecl dx_recvox();
DllLinkage int __cdecl dx_mreciottdata();
DllLinkage int __cdecl dx_getr2mf();
DllLinkage int __cdecl dx_set_lasterr();
DllLinkage int __cdecl dx_gtcallid();
DllLinkage int __cdecl dx_gtextcallid();
DllLinkage int __cdecl dx_gtromsig();
DllLinkage int __cdecl dx_wtcallid();
DllLinkage int __cdecl dx_SendReadRequest();
DllLinkage int __cdecl dx_SendWriteRequest();
DllLinkage int __cdecl dx_InitializeBargeIn();
DllLinkage int __cdecl dx_gtsernum();
DllLinkage int __cdecl dx_TSFStatus();
DllLinkage int __cdecl dx_getxmitslotecr();
DllLinkage int __cdecl dx_listenecr();
DllLinkage int __cdecl dx_listenecrex();
DllLinkage int __cdecl dx_unlistenecr();
DllLinkage int __cdecl r2_creatfsig();
DllLinkage int __cdecl r2_playbsig();
DllLinkage int __cdecl dx_BargeIn();
DllLinkage int __cdecl dx_TxIottData();
DllLinkage int __cdecl dx_RxIottData();
DllLinkage int __cdecl dx_TxRxIottData();

/*
 * Extended Attributes
 */
DllLinkage char * __cdecl ATDX_BDNAMEP();
DllLinkage char ** __cdecl ATDX_CHNAMES();
DllLinkage long __cdecl ATDX_BDTYPE();
DllLinkage long __cdecl ATDX_BUFDIGS();
DllLinkage long __cdecl ATDX_CHNUM();
DllLinkage long __cdecl ATDX_DBMASK();
DllLinkage long __cdecl ATDX_DEVTYPE();
DllLinkage long __cdecl ATDX_EVTCNT();
DllLinkage long __cdecl ATDX_FWVER();
DllLinkage long __cdecl ATDX_HOOKST();
DllLinkage long __cdecl ATDX_LINEST();
DllLinkage long __cdecl ATDX_NUMCHAN();
DllLinkage long __cdecl ATDX_PHYADDR();
DllLinkage long __cdecl ATDX_PRODUCT();
DllLinkage long __cdecl ATDX_RINGCNT();
DllLinkage long __cdecl ATDX_DIGBUFMODE();
DllLinkage long __cdecl ATDX_STATE();
DllLinkage long __cdecl ATDX_TERMMSK();
DllLinkage long __cdecl ATDX_TONEID();
DllLinkage long __cdecl ATDX_TRCOUNT();
DllLinkage long __cdecl ATDX_XFERBUFSIZE();
DllLinkage long __cdecl ATDX_RXDATABUFSIZE();

/*
 * Call Analysis Extended Attributes
 */
DllLinkage long __cdecl ATDX_ANSRSIZ();
DllLinkage long __cdecl ATDX_CONNTYPE();
DllLinkage long __cdecl ATDX_CPERROR();
DllLinkage long __cdecl ATDX_CPTERM();
DllLinkage long __cdecl ATDX_FRQDUR();
DllLinkage long __cdecl ATDX_FRQDUR2();
DllLinkage long __cdecl ATDX_FRQDUR3();
DllLinkage long __cdecl ATDX_FRQHZ();
DllLinkage long __cdecl ATDX_FRQHZ2();
DllLinkage long __cdecl ATDX_FRQHZ3();
DllLinkage long __cdecl ATDX_FRQOUT();
DllLinkage long __cdecl ATDX_LONGLOW();
DllLinkage long __cdecl ATDX_SHORTLOW();
DllLinkage long __cdecl ATDX_SIZEHI();
DllLinkage long __cdecl ATDX_DTNFAIL();
DllLinkage long __cdecl ATDX_CRTNID();
DllLinkage int  __cdecl dx_callp ();

/*
 * 'C' language interface functions
 */
DllLinkage long __cdecl dx_libinit();
DllLinkage long __cdecl dx_GetDllVersion();

#endif

#ifdef __cplusplus
}                          // C Plus Plus function bindings
#undef extern
#endif

#endif

0
Comment
Question by:gutian
  • 7
  • 5
12 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
Better send me the file directly to robert_marquardt@gmx.de
I will give it a try.
0
 

Author Comment

by:gutian
Comment Utility
robert_marquardt,thanks for your help,I have send the file
to you .
0
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
and i have cut it out already and converted as far as possible :-)
0
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
I forgot to mention: i added some "// (rom)" comments where conversion was not possible.
0
 

Author Comment

by:gutian
Comment Utility
thanks robert_marquardt,I wait for your mail.
0
 

Author Comment

by:gutian
Comment Utility
robert_marquardt:
   I am amazing for your quicking.I wanner do you do it by tools.for I have used the tool named h2pas,but it do not work well
                                           chenping
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 11

Accepted Solution

by:
robert_marquardt earned 300 total points
Comment Utility
I will send it again. Maybe it got lost.
I use the DOS editor Brief for most changes.
The search & replace expressions are very powerful.
First convert the comments to Pascal syntax.
The #define constants go with a set of replacement macros.
The records are done by hand.
Exchanging parameter type and parameter name is also done with a set of replacement macros.
The rest of the changes are again done by hand.

I have already converted a megabyte or two so your conversion was an easy one.
0
 

Author Comment

by:gutian
Comment Utility
robert_marquardt:
   I am amazing for your quicking.I wanner do you do it by tools.for I have used the tool named h2pas,but it do not work well
                                           chenping
0
 

Author Comment

by:gutian
Comment Utility
oh, thanks for your kind help.You can send a copy to
mail to chenp@math.zju.edu.cn if possiable.
                                       chenping
0
 

Author Comment

by:gutian
Comment Utility
How can I convert the following
/*****************************************************************************
 *        FILE: ntapi.h
 *     VERSION: Windows Nt (Native) Production 1
 * DESCRIPTION: DTI Library Module header file for the veneer library.
 *              This library requires the Generic Driver & SRL Version 2.
 *
 *   Copyright (c) 1993-95 Dialogic Corp. All Rights Reserved
 *
 *   THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Dialogic Corp.
 *   The copyright notice above does not evidence any actual or
 *   intended publication of such source code.
 *****************************************************************************/

#ifndef __NDTAPI_H__
#define __NDTAPI_H__

#ifdef VME_SPAN
#else
#pragma pack(1)
#endif

/*
 * Signaling event mask values to be sent down to the firmware.
 */
#define DTMM_AONMSK   0x0001
#define DTMM_AOFFMSK  0x0002
#define DTMM_BONMSK   0x0004
#define DTMM_BOFFMSK  0x0008
#define DTMM_WINKMSK  0x0010
#define DTMM_CONMSK   0x0100
#define DTMM_COFFMSK  0x0200
#define DTMM_DONMSK   0x0400
#define DTMM_DOFFMSK  0x0800


/*
 * Structure to hold device descriptor and device tag identifying type of device
 */
typedef struct {
   int ddd;
   int tag;
   int next;
} DESC_TAG;


/*
 * Structure to hold pointers to library functions for all supported devices.
 */
typedef struct {

#ifdef __cplusplus
extern "C" {   // C++ func bindings to enable C funcs to be called from C++
#define extern
#endif

#if (defined(__STDC__) || defined(__cplusplus))
   char *((*ATDT_BDSGBIT)(int));
   long   (*ATDT_BDMODE)(int);
   long   (*ATDT_DNLDVER)(int);
   long   (*ATDT_IDLEST)(int);
   long   (*ATDT_ROMVER)(int);
   long   (*ATDT_STATUS)(int);
   long   (*ATDT_TSMODE)(int);
   long   (*ATDT_TSSGBIT)(int);
   int    (*dt_assignxmitslot)(int, SC_TSINFO *, USHORT);
   int    (*dt_close)(int);
   int    (*dt_dial)(int, char *, int);
   int    (*dt_getctinfo)(int, CT_DEVINFO *);
   int    (*dt_getevtmsk)(int, int, USHORT *);
   int    (*dt_getparm)(int, ULONG, void *);
   int    (*dt_getxmitslot)(int, SC_TSINFO *);
   int    (*dt_listen)(int, SC_TSINFO *);
   int    (*dt_mtfcn)(int, UCHAR, int);
   int    (*dt_open)(char *, int);
   int    (*dt_rundiag)(int, UINT, char *);
   int    (*dt_setalrm)(int, UINT);
   int    (*dt_setevtmsk)(int, int, USHORT, int);
   int    (*dt_setidle)(int, UINT);
   int    (*dt_setparm)(int, ULONG, void *);
   int    (*dt_setsigmod)(int, UINT);
   int    (*dt_settssig)(int, USHORT, int);
   int    (*dt_settssigsim)(int, USHORT);
   int    (*dt_strtdn)(int);
   int    (*dt_tstcom)(int, int);
   int    (*dt_tstdat)(int, int);
   int    (*dt_unassignxmitslot)(int, USHORT);
   int    (*dt_unlisten)(int);
   int    (*dt_xmitalrm)(int, BYTE, UINT);
   int    (*dt_xmittone)(int, UINT);
   int    (*dt_xmitwink)(int, int);
#ifdef NT_MLTITHRD
   int    (*dt_getevt)(int, EV_EBLK *, int);
#endif
   void   (*dt_set_lasterr(int, int);
#else
   char *((*ATDT_BDSGBIT)());
   long   (*ATDT_BDMODE)();
   long   (*ATDT_DNLDVER)();
   long   (*ATDT_IDLEST)();
   long   (*ATDT_ROMVER)();
   long   (*ATDT_STATUS)();
   long   (*ATDT_TSMODE)();
   long   (*ATDT_TSSGBIT)();
   int    (*dt_assignxmitslot)();
   int    (*dt_close)();
   int    (*dt_dial)();
   int    (*dt_getctinfo)();
   int    (*dt_getevtmsk)();
   int    (*dt_getparm)();
   int    (*dt_getxmitslot)();
   int    (*dt_listen)();
   int    (*dt_mtfcn)();
   int    (*dt_open)();
   int    (*dt_rundiag)();
   int    (*dt_setalrm)();
   int    (*dt_setevtmsk)();
   int    (*dt_setidle)();
   int    (*dt_setparm)();
   int    (*dt_setsigmod)();
   int    (*dt_settssig)();
   int    (*dt_settssigsim)();
   int    (*dt_strtdn)();
   int    (*dt_tstcom)();
   int    (*dt_tstdat)();
   int    (*dt_unassignxmitslot)();
   int    (*dt_unlisten)();
   int    (*dt_xmitalrm)();
   int    (*dt_xmittone)();
   int    (*dt_xmitwink)();
#ifdef NT_MLTITHRD
   int    (*dt_getevt)();
#endif
   void   (*dt_set_lasterr)();
#endif

#ifdef __cplusplus
}
#undef extern
#endif

} LIB_FUNC, *LIB_FUNC_PTR;


/*
 * Prototypes for DTI card library functions.
 */
#ifdef __cplusplus
extern "C" {   // C++ func bindings to enable C funcs to be called from C++
#define extern
#endif

#if (defined(__STDC__) || defined(__cplusplus))
char *oATDT_BDSGBIT(int);
long  oATDT_BDMODE(int),
      oATDT_DNLDVER(int),
      oATDT_IDLEST(int),
      oATDT_ROMVER(int),
      oATDT_STATUS(int),
      oATDT_TSMODE(int),
      oATDT_TSSGBIT(int);
int   odt_assignxmitslot(int, SC_TSINFO *, USHORT),
      odt_close(int),
      odt_dial(int, char *, int),
      odt_getctinfo(int, CT_DEVINFO *),
      odt_getevtmsk(int, int, USHORT *),
      odt_getparm(int, ULONG, void *),
      odt_getxmitslot(int, SC_TSINFO *),
      odt_listen(int, SC_TSINFO *),
      odt_mtfcn(int, UCHAR, int),
      odt_open(char *, int),
      odt_rundiag(int, UINT, char *),
      odt_setalrm(int, UINT),
      odt_setevtmsk(int, int, USHORT, int),
      odt_setidle(int, UINT),
      odt_setparm(int, ULONG, void *),
      odt_setsigmod(int, UINT),
      odt_settssig(int, USHORT, int),
      odt_settssigsim(int, USHORT),
      odt_strtdn(int),
      odt_tstcom(int, int),
      odt_tstdat(int, int),
      odt_unassignxmitslot(int, USHORT),
      odt_unlisten(int),
      odt_xmitalrm(int, BYTE, UINT),
      odt_xmittone(int, UINT),
      odt_xmitwink(int, int);
#ifdef NT_MLTITHRD
      odt_getevt(int, EV_EBLK *, int);
#endif
      odt_set_lasterr(int, int);
#else
char *oATDT_BDSGBIT();
long  oATDT_BDMODE(),
      oATDT_DNLDVER(),
      oATDT_IDLEST(),
      oATDT_ROMVER(),
      oATDT_STATUS(),
      oATDT_TSMODE(),
      oATDT_TSSGBIT();
int   odt_assignxmitslot(),
      odt_close(),
      odt_dial(),
      odt_getctinfo(),
      odt_getevtmsk(),
      odt_getparm(),
      odt_getxmitslot(),
      odt_listen(),
      odt_mtfcn(),
      odt_open(),
      odt_rundiag(),
      odt_setalrm(),
      odt_setevtmsk(),
      odt_setidle(),
      odt_setparm(),
      odt_setsigmod(),
      odt_settssig(),
      odt_settssigsim(),
      odt_strtdn(),
      odt_tstcom(),
      odt_tstdat(),
      odt_unassignxmitslot(),
      odt_unlisten(),
      odt_xmitalrm(),
      odt_xmittone(),
      odt_xmitwink();
#ifdef NT_MLTITHRD
      odt_getevt();
#endif
      odt_set_lasterr();
#endif

/*
 * Prototypes for SPAN-DTI card library functions.
 */
#if (defined(__STDC__) || defined(__cplusplus))
char *nATDT_BDSGBIT(int);
long  nATDT_BDMODE(int),
      nATDT_DNLDVER(int),
      nATDT_IDLEST(int),
      nATDT_ROMVER(int),
      nATDT_STATUS(int),
      nATDT_TSMODE(int),
      nATDT_TSSGBIT(int);
int   ndt_assignxmitslot(int, SC_TSINFO *, USHORT),
      ndt_close(int),
      ndt_dial(int, char *, int),
      ndt_getctinfo(int, CT_DEVINFO *),
      ndt_getevtmsk(int, int, USHORT *),
      ndt_getparm(int, ULONG, void *),
      ndt_getxmitslot(int, SC_TSINFO *),
      ndt_listen(int, SC_TSINFO *),
      ndt_mtfcn(int, UCHAR, int),
      ndt_open(char *, int),
      ndt_rundiag(int, UINT, char *),
      ndt_setalrm(int, UINT),
      ndt_setevtmsk(int, int, USHORT, int),
      ndt_setidle(int, UINT),
      ndt_setparm(int, ULONG, void *),
      ndt_setsigmod(int, UINT),
      ndt_settssig(int, USHORT, int),
      ndt_settssigsim(int, USHORT),
      ndt_strtdn(int),
      ndt_tstcom(int, int),
      ndt_tstdat(int, int),
      ndt_unassignxmitslot(int, USHORT),
      ndt_unlisten(int),
      ndt_xmitalrm(int, BYTE, UINT),
      ndt_xmittone(int, UINT),
      ndt_xmitwink(int, int);
#ifdef NT_MLTITHRD
      ndt_getevt(int, EV_EBLK *, int);
#endif
      ndt_set_lasterr(int, long);
#else
char *nATDT_BDSGBIT();
long  nATDT_BDMODE(),
      nATDT_DNLDVER(),
      nATDT_IDLEST(),
      nATDT_ROMVER(),
      nATDT_STATUS(),
      nATDT_TSMODE(),
      nATDT_TSSGBIT();
int   ndt_assignxmitslot(),
      ndt_close(),
      ndt_dial(),
      ndt_getctinfo(),
      ndt_getevtmsk(),
      ndt_getparm(),
      ndt_getxmitslot(),
      ndt_listen(),
      ndt_mtfcn(),
      ndt_open(),
      ndt_rundiag(),
      ndt_setalrm(),
      ndt_setevtmsk(),
      ndt_setidle(),
      ndt_setparm(),
      ndt_setsigmod(),
      ndt_settssig(),
      ndt_settssigsim(),
      ndt_strtdn(),
      ndt_tstcom(),
      ndt_tstdat(),
      ndt_unassignxmitslot(),
      ndt_unlisten(),
      ndt_xmitalrm(),
      ndt_xmittone(),
      ndt_xmitwink();
#ifdef NT_MLTITHRD
      ndt_getevt();
#endif
     ndt_set_lasterr();
#endif

#ifdef __cplusplus
}
#undef extern
#endif

#ifdef VME_SPAN
#else
#pragma pack()
#endif

#endif
0
 

Author Comment

by:gutian
Comment Utility
thanks
0
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now