⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apite1dv.h

📁 Sample driver code for Dallas DS26528 T1/E1 framer chip.
💻 H
字号:
/* 
 * Copyright 1997-2005 NComm, Inc.  All rights reserved.
 * 
 *
 *                     *** Important Notice ***
 * The software contained in this file may only be used within a 
 * valid license agreement between your company and NComm, Inc. 
 * The license agreement includes the definition of a PROJECT which 
 * defines the scope that this software can be used in.  Any use outside of
 * the definition of the PROJECT is prohibited without executing an additional 
 * agreement with NComm, Inc. Please refer to you license agreement for 
 * the definition of the PROJECT.
 *
 * Verification of your company's license agreement and copies of 
 * that agreement also may be obtained from:
 *
 * NComm, Inc.
 * 254 N Broadway
 * Suite 106
 * Salem, NH 03079
 * (603) 893-6186
 * sales@ncomm.com
 *
 */





#ifndef APITE1DV_H
#define APITE1DV_H


/*
 * Contains structure definitions and constants for the Driver API.
 */



#include "nciTMS.h"	/* items common to all NCI TMS packages */
#include "nciTE1.h"	/* items common to only T1/E1/LIU packages */





/*--------------------------------------------------------------------------*/
/* Function Codes and expected parameters for _drvrCTRL()
 */
typedef enum {
		/***** Initialization *****/

	TE1DCTRL_RESET = 0x400,
				/* Pre-O/S - Set the default static state */
				/* param1 = (int) line number
				 * param2 = (void *) hdw device base address
				 * param3 = (int) hdw device subchannel
				 * param4 = (void *) ptr to xxx_CONFIG
				 * param5 = (void *) TMS reference
				 * param6 = (void *) ptr to load DRV reference
				 */

	TE1DCTRL_UNRESET,	/* Unbinds and shuts down a Line */
				/* param1 = (void *) ptr to TE1_CONFIG
				 */

	TE1DCTRL_CALLBACK,	/* Register the driver's callback function */
				/* param1 = (void *) ptr to _te1DrvCLBK() API
				 */

	TE1DCTRL_UTILINIT,	/* Enable/Disable NON-alarm processing */
				/* param1 = (int) ENABLE or DISABLE
				 */

	TE1DCTRL_WSTARTEND,	/* Exit Warm Start mode */
				/* No additional parameters required
				 */



		/***** General *****/

	TE1DCTRL_SETSIDE,	/* Set the Line operating mode */
				/* param1 = (int) USR_SIDE or NET_SIDE
				 */

	TE1DCTRL_OSTIC,		/* OS Tic has elapsed */
				/* param1 = (void * or ulong) user-defined
				 */ 

	TE1DCTRL_DEVICE,	/* User-defined call directly from the app */
				/* param1 = (void * or ulong) user-defined
				 * param2 = (void * or ulong) user-defined
				 * param3 = (void * or ulong) user-defined
				 * param4 = (void * or ulong) user-defined
				 */

	TE1DCTRL_TXCLOCK,	/* Select the clock-source for Tx output */
				/* param1 = (int) one of CLOCK_TYPE
				 */

	TE1DCTRL_ONESEC,	/* Enable the One Second interrupt */
				/* param1 = (int) ENABLE or DISABLE
				 *	(default = DISABLED)
				 */



		/***** T1/E1 Alarms and Loopbacks *****/

	TE1DCTRL_ALARMINIT,	/* Driver initializes its alarm handling */
				/* param1 = (int) ENABLE or DISABLE
				 */

	TE1DCTRL_ALARMTX,	/* Enable Alarm Transmission */
				/* param1 = (int) alarm_type
				 * param2 = (int) ENABLE or DISABLE
				 */

	TE1DCTRL_LOOPINIT,	/* Driver initializes its Loop handling */
				/* param1 = (int) ENABLE or DISABLE
				 */

	TE1DCTRL_LOOP,		/* Enable/disable a Loopback function */
				/* param1 = (int) one of LOOP_TYPE
				 * param2 = (int) SET or CLEAR
				 * param3 = (int) code
				 * param4 = (int) bits
				 */



		/********** T1/E1 Signaling *******/

	TE1DCTRL_SIGNLINIT,	/* Driver initializes its Signaling handling */
				/* param1 = (int) ENABLE or DISABLE
				 */

	TE1DCTRL_SIGNLCLEAR,	/* Set Signaling timeslot to CLEAR Channel */
				/* param1 = (int) timeslot
				 */

	TE1DCTRL_SIGNLIDLE,	/* Set Signaling timeslot to IDLE Channel */
				/* param1 = (int) timeslot
				 * param2 = (int) idle pattern
				 */

	TE1DCTRL_SIGNLRBIT,	/* Set Signaling timeslot to Robbed Bit */
				/* param1 = (int) timeslot
				 */

	TE1DCTRL_SIGNLTXBITS,	/* Tx new Signaling Robbed Bits in timeslot */
				/* param1 = (int) timeslot
				 * param2 = DCBA bits (MSbit = D C B A = LSbit)
				 */



	/**************************************************************/
	/********** T1-Specific ***************************************/
	/**************************************************************/

	TE1DCTRL_EXCESSZERO,	/* Enable/disable counting of Excess Zeros */
				/* param1 = ENABLE or DISABLE
				 */


		/********** T1.231 **********/

	TE1DCTRL_T1231INIT,	/* Driver initializes its T1.231 handling */
				/* param1 = (int) ENABLE or DISABLE
				 */


		/********** TR008 **********/

	TE1DCTRL_TR008INIT,	/* Driver initializes its TR008 handling */
				/* param1 = (int) ENABLE or DISABLE
				 */

	TE1DCTRL_TR008CMAS,	/* Enable/disable a CMAS channel */
				/* param1 = (int) bitmap of CMAS channels
				 */


		/********** T1.403 *********/

	TE1DCTRL_T1403INIT,	/* Driver initializes it's T1.403 handling */
				/* param1 = (int) ENABLE or DISABLE
				 */

	TE1DCTRL_T1403TXPKT,	/* Tx a packet over the FDL */
				/* param1 = bytecount of packet
				 * param2 = packet pointer
				 */

	TE1DCTRL_T1403TXBOC,	/* Tx a BOC code */
				/* param1 = ENABLE or DISABLE
				 * param2 = BOC code
				 */


		/********** TR54016 **********/

	TE1DCTRL_TR54016INIT,	/* Driver initializes its TR54016 handling */
				/* param1 = (int) ENABLE or DISABLE
				 */



	/**************************************************************/
	/********** E1-Specific ***************************************/
	/**************************************************************/

	TE1DCTRL_RESYNC,	/* Force a Resync to attempt frame */
				/* no parameters
				 */


		/********** G.826 **********/

	TE1DCTRL_G826INIT,	/* Driver initializes its G.826 handling */
				/* param1 = (int) ENABLE or DISABLE
				 */


		/********** E1 SASI *********/

	TE1DCTRL_E1SASIINIT,	/* Driver initializes its E1 SASI handling */
				/* param1 = (int) ENABLE or DISABLE
				 */

	TE1DCTRL_E1SASISABYTE,	/* Tx new Sa byte - CRC Framing */
				/* param1 = (int) one of E1SABYTE_TYPE
				 * param2 = (int) 8-bit Sa byte value
				 */

	TE1DCTRL_E1SASISABIT,	/* Tx new Sa bits - nonCRC Framing */
				/* param1 = (int) 5-bit Sa bit value
				 */

	TE1DCTRL_E1SASISIBIT,	/* Tx new Si bit */
				/* param1 = (int) SET or CLEAR
				 */

	TE1DCTRL_E1SASIXBIT	/* Tx new Xbits */
				/* param1 = (int) 3-bit Xbit value
				 */
} TE1DCTRL_FC;



/*--------------------------------------------------------------------------*/
/* Function Codes and expected parameters for _drvrCLBK()
 */
typedef enum {
	TE1DCLBK_HOOKOSTIC = 0x500,
				/* Call a Timer function every N mSecs */
				/* param1 = (int) milliseconds per call
				 * param2 = (void *) load with returned handle
				 * param3 = (void *) function ptr
				 * param4 = (void * or ulong) user-defined
				 * param5 = (void * or ulong) user-defined
				 */

	TE1DCLBK_UNHOOKOSTIC,	/* Unhook a Timer call */
				/* param1 = (void *) handle
				 */

	TE1DCLBK_HOOKINTERRUPT,	/* Hookup/enable the device intrpt */
				/* param1 = (void *) funtion ptr to
				 *      handler function of the form:
				 *
				 *	void (*)(void)
				 */

	TE1DCLBK_UNHOOKINTERRUPT,/* Unhook/disable device intrpt */
				/* no parameters
				 */



		/***** General *****/

	TE1DCLBK_ONESEC,	/* One-second notification */
				/* no parameters
				 */

	TE1DCLBK_DEVICE,	/* User-defined call directly to the app */
				/* param1 = (void * or ulong) user-defined
				 * param2 = (void * or ulong) user-defined
				 * param3 = (void * or ulong) user-defined
				 * param4 = (void * or ulong) user-defined
				 */

	TE1DCLBK_FATALERROR,	/* Fatal error from the Driver */
				/* param1 = (unsigned long) error code
				 */

	TE1DCLBK_CRC,		/* Calculate CRC value across packet */
				/* param1 = (ushort *) load 16-bit CRC
				 * param2 = (int) bytecount of packet
				 * param3 = (void *) ptr to packet
				 */

	TE1DCLBK_AUTOCRC,	/* Enable NCI computation of CRC's */
				/* param1 = (int) ENABLE or DISABLE
				 *	(default = DISABLE)
				 */

	TE1DCLBK_AUTORAI,	/* Enable Drvr/Device autoTx of RAI */
				/* param1 = (int) ENABLE or DISABLE
				 *	(default = DISABLE)
				 */


		/***** Alarms and Loopbacks *****/

	TE1DCLBK_ALARMRX,	/* New Rx Alarm condition */
				/* param1 = (int) alarm_type
				 * param2 = (int) SET or CLEAR
				 */

	TE1DCLBK_LOOP,		/* New state of a LoopBack function */
				/* param1 = (int) one of LOOP_TYPE
				 * param2 = (int) SET or CLEAR
				 * param3 = (int) code
				 * param4 = (int) bits
				 */



		/***** Signaling *****/

	TE1DCLBK_SIGNLDEBOUNCE,	/* Enable Signal Bit debouncing */
				/* param1 = (int) ENABLE or DISABLE
				 */



		/***** T1.403 *****/

	TE1DCLBK_T1403RXBOC,	/* New Rx BOC code */
				/* param1 = BOC code
				 */

	TE1DCLBK_T1403RXPKT,	/* New Rx FDL Packet */
				/* param1 = (int) bytecount
				 * param2 = (void *) ptr to packet
				 */

	TE1DCLBK_T1403TXPKTCOMPLETE,	/* Tx of FDL Packet completed */
				/* no parameters
				 */



		/***** TR008 *****/
	TE1DCLBK_TR008CMASRX,	/* New Rx CMAS bits */
				/* param1 = unsigned long 24-bits
				 * param2 = int (0 or 1) mirrored bits
				 */
	TE1DCLBK_TR008CMASTX,	/* Retrieve Tx CMAS bits */
				/* param1 = unsigned long  *ptr
				 * param2 = int mirror the 24-bits
				 */


		/***** E1 SASI *****/

	TE1DCLBK_E1SASISABYTE,	/* Sa bytes every 100 mSecs - CRC Framing */
				/* param1 = (int *) ptr to int array[5]
				 */

	TE1DCLBK_E1SASISABIT,	/* Sa bits every 100 mSecs - nonCRC Framing */
				/* param1 = (int *) 5-bit Sa value
				 */

	TE1DCLBK_E1SASISIBIT,	/* New Si bit detected */
				/* param1 = (int) SET or CLEAR
				 */

	TE1DCLBK_E1SASIXBIT,	/* New X bit detected */
				/* param1 = (int) 3-bit Xbit value
				 */

	TE1DCLBK_E1SASISAMIRROR, /* Enable Mirroring of Sa values */
				/* param1 = (int) onoff
				 */

	TE1DCLBK_E1SASISADEBOUNCE, /* Enable Debounce of Sa bits */
				/* param1 = (int) onoff
				 */

	TE1DCLBK_E1SASISIDEBOUNCE, /* Enable Debounce of Si bit */
				/* param1 = (int) onoff
				 */

	TE1DCLBK_E1SASIXDEBOUNCE /* Enable Debounce of X bits */
				/* param1 = (int) onoff
				 */
} TE1DCLBK_FC;



/*--------------------------------------------------------------------------*/
/* Function Codes and expected pointer-types for _drvrPOLL()
 */
typedef enum {

		/***** General *****/

	TE1DPOLL_DEVICE = 0x600,/* User-defined poll directly from the app */
				/* param1 = (void * or ulong) user-defined
				 * param2 = (void * or ulong) user-defined
				 * param3 = (void * or ulong) user-defined
				 * param4 = (void * or ulong) user-defined
				 */



		/***** T1/E1 Alarms and Loopbacks *****/

	TE1DPOLL_ALARMRX,	/* Return current Rx Alarm condition */
				/* param1 = (int) alarm_type
				 * param2 = (int *) load SET or CLEAR
				 */

	TE1DPOLL_LOOP,		/* Return current LoopBack/LoopCode state */
				/* param1 = (int) one of LOOP_TYPE
				 * param2 = (int *) load SET or CLEAR
				 */



		/***** Signaling *****/

	TE1DPOLL_SIGNLALLBITS,	/* Return all tslot Signal bits in an array */
				/* param1 = (int *) ptr to int array[32]
				 */
	



		/***** Performance Monitor *****/

	TE1DPOLL_PERFINFO,	/* Return current performance parameters */
				/* param1 = (void *) ptr to
				 *	T1_PERFINFO or E1_PERFINFO
				 */


	/**************************************************************/
	/********** T1-Specific ***************************************/
	/**************************************************************/



	/**************************************************************/
	/********** E1-Specific ***************************************/
	/**************************************************************/

		/***** E1 SASI *****/

	TE1DPOLL_E1SASISABYTE,	/* Return Sa byte - CRC Framing */
				/* param1 = (int) one of E1SABYTE_TYPE
				 * param2 = (int *) load 8-bit Sa byte value
				 */

	TE1DPOLL_E1SASISABIT,	/* Return 5-bit Sa bits - nonCRC Framing */
				/* param1 = (int *) load 5-bit Sa value
				 */

	TE1DPOLL_E1SASISIBIT,	/* Return Si bit detected on Rx-side */
				/* param1 = (int *) load SET or CLEAR
				 */

	TE1DPOLL_E1SASIXBIT	/* Return X bit detected on Rx-side */
				/* param1 = (int *) load 3-bit Xbit value
				 */
} TE1DPOLL_FC;



/*--------------------------------------------------------------------------*/
/* Prototypes for the NCI Independent Framer Interface
 */

/* Permits the NCI application software to asynchronously control the
 * device driver.  This lives outside of the NCI package, in the driver.
 */
extern int _te1DrvCTRLstub(void *refPtr, TE1DCTRL_FC fcode, ...);



/* Permits the device driver software to asynchronously notify the NCI
 * application software of events and occurrences on the Span.  This
 * lives inside of the NCI package.
 */
extern int _te1DrvCLBK(void *refPtr, TE1DCLBK_FC fcode, ...);



/* Permits the NCI application software to asynchronously poll status of
 * the device driver.  This lives outside of the NCI package, in the driver.
 */
extern int _te1DrvPOLLstub(void *refPtr, TE1DPOLL_FC fcode, ...);


#endif	/* APITE1DV_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -