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

📄 fsk.h

📁 基于TB板卡的FSK编程,telcobridges fsk develop
💻 H
📖 第 1 页 / 共 2 页
字号:
/*--------------------------------------------------------------------------------------------------------------------------------
 |
 |	Project:    	VoiceLink TB640 sample (FSK)
 |
 |	Filename:   	fsk.h
 |
 |	Copyright:  	TelcoBridges 2002-2003, All Rights Reserved
 |
 |	Description:	This file contains the internal structure required by the application
 |
 |	Notes:      	Tabs = 4
 |
 *-------------------------------------------------------------------------------------------------------------------------------
 |
 |	Revision:   	$Revision: 1.25 $
 |
 *------------------------------------------------------------------------------------------------------------------------------*/
 

/*--------------------------------------------------------------------------------------------------------------------------------
 |  Define header file
 *------------------------------------------------------------------------------------------------------------------------------*/
#ifndef __FSK_H__
#define __FSK_H__

/*--------------------------------------------------------------------------------------------------------------------------------
 |  C++ support
 *------------------------------------------------------------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */


/*--------------------------------------------------------------------------------------------------------------------------------
 |  Forward declarations
 *------------------------------------------------------------------------------------------------------------------------------*/


/*--------------------------------------------------------------------------------------------------------------------------------
 |  Defines
 *------------------------------------------------------------------------------------------------------------------------------*/

/*#define TB640_FSK_USE_INTERHOST_SIMULATION*/

/* The following defines create the apppropriate function inlining according to the selected OS */
#define INLINE                                          __inline

/* Todo: cleanup in all following "defines" */

/* Maximum FSK message length */
#define TB640_FSK_MAX_MESSAGE_LENGTH_DWORD						63

/* Maximum number of boards (or softadapters) can this application control */
#define TB640_FSK_MAX_SUPPORTED_ADAPTERS						2

/* Maximum number of trunks on an adapter */
#define TB640_FSK_MAX_SUPPORTED_TRUNKS_PER_ADAPTER				64

/* Maximum number of TDM timeslot (full-duplex) in a trunk */
#define TB640_FSK_MAX_TIMESLOT_IN_TRUNK							32

/*
 | Maximum number of trunks controlled by a single operation library (contexts and timers).
 | MUST be a multiple of TB640_FSK_MAX_SUPPORTED_TRUNKS_PER_ADAPTER.
 */
#define TB640_FSK_MAX_TRUNK_PER_OPERATION_LIBRARY				TB640_FSK_MAX_SUPPORTED_TRUNKS_PER_ADAPTER

/* The actual number of operation library to be used */
#define TB640_FSK_NB_OPERATION_LIBRARY_REQUIRED					(TB640_FSK_MAX_SUPPORTED_TRUNKS_PER_ADAPTER/TB640_FSK_MAX_TRUNK_PER_OPERATION_LIBRARY)

/* Default name for configuration file (can be overriden with an argument */
#define TB640_FSK_DEFAULT_CONFIGURATION_FILENAME				"config.txt"

/* Maximum number of characters in log filename */
#define TB640_FSK_MAX_LOG_FILENAME_LENGTH						32

/* Maximum number of characters in adapter name */
#define TB640_FSK_MAX_ADAPTER_NAME_LENGTH						64

/* Maximum number of characters in a configuration line */
#define TB640_FSK_MAX_CONFIGURATION_LINE_LENGTH					132

/* Maximum idle code value */
#define TB640_FSK_MAX_IDLE_CODE_VALUE							127

/* Maximum timeout value (in sec) after which an adapter is considered down if no activity (and heartbeat) is detected */
#define TB640_FSK_ADAPTER_WATCHDOT_TIMEOUT_SEC					10

/* Maximum timeout waiting for adapters to register */
#define TB640_FSK_ADAPTER_DISCOVERY_TIMEOUT_MSEC				(60*1000)

/* Maximum number of adapters being discovered in the network */
#define TB640_FSK_MAX_ADAPTER_DISCOVERED						32

/* Defines the adapter name string to represents any adapter */
#define TB640_FSK_ANY_ADAPTER_STRING							"ANY"

/* Define the maximum number of states remembered for a specific timeslot */
#define TB640_FSK_NB_HISTORY_FOR_TIMESLOT						256

/* Define the maximum number of states remembered for a specific call */
#define TB640_FSK_NB_HISTORY_FOR_CALL							32

/* Operation timeout for state machine's states */
#define TB640_FSK_IDLE_TIMEOUT_SEC								0xFFFFFFFF
#define TB640_FSK_RX_CONFIGURE_TIMEOUT_SEC						10
#define TB640_FSK_WAIT_REMOTE_1_TIMEOUT_SEC						10
#define TB640_FSK_WAIT_REMOTE_2_TIMEOUT_SEC						7
#define TB640_FSK_READY_TIMEOUT_SEC								0xFFFFFFFF
#define TB640_FSK_DEFAULT_TX_TIMEOUT_SEC						15
#define TB640_FSK_STRESS_TX_TIMEOUT_SEC							5
#define TB640_FSK_RX_TIMEOUT_SEC								15

/*--------------------------------------------------------------------------------------------------------------------------------
 |  Types
 *------------------------------------------------------------------------------------------------------------------------------*/
/*
 | The following type is used to match a string to a parsing token
 */
typedef struct _TB640_FSK_PARSING_ENTRY
{
	PTBX_CHAR						pszIdentifier;
	TBX_UINT32						un32Value;

} TB640_FSK_PARSING_ENTRY, *PTB640_FSK_PARSING_ENTRY;

/* This structure represents the statistics for stress testing */
typedef struct _TB640_FSK_STRESS_STATS
{
	TBX_BOOL			fStatsActivated;
	TBX_UINT32			un32StartTimestamp;
	TBX_UINT32			un32CurrentTimestamp;

	TBX_UINT32			un32NbRxPackets;				/* Total number of FSK messages received */
	TBX_UINT32			un32NbTxPackets;				/* Total number of FSK messages sent */
	TBX_UINT32			un32NbRxAck;					/* Total number of FSK ack received */
	TBX_UINT32			un32NbTxAck;					/* Total number of FSK ack sent */

	TBX_UINT32			un32NbUnexpectedRx;				/* Number of FSK messages received while not expecting any (not including un32NbRxWhileTxState and un32NbRxWhileRxState) */
	TBX_UINT32			un32NbUnexpectedAck;			/* Number of FSK ack received while not expecting any */

	TBX_UINT32			un32NbRxWhileTxState;			/* Number of FSK messages received while still in "tx" state */
	TBX_UINT32			un32NbRxWhileRxState;			/* Number of FSK messages received while still in "rx" state */

	TBX_UINT32			un32NbRxSeqCompleted;			/* Number of transmission sequences completed */
	TBX_UINT32			un32NbTxSeqCompleted;			/* Number of transmission sequences completed */

	TBX_UINT32			un32NbRxSeqTimeout;				/* Number of transmission timeout (non-acknowledged) */
	TBX_UINT32			un32NbTxSeqTimeout;				/* Number of transmission timeout (non-acknowledged) */
	TBX_UINT32			un32NbTxRetransmit;				/* Total number of TX retransmissions */

	TBX_UINT32			un32NbCallNoFreeTimeslotToSend;

} TB640_FSK_STRESS_STATS, *PTB640_FSK_STRESS_STATS;


/*
 | Enumeration describing the different states of a call
 */
typedef enum _TB640_FSK_CALL_APP_STATE
{
	TB640_FSK_CALL_APP_STATE_NOT_USED				= 0x00,
	TB640_FSK_CALL_APP_STATE_IDLE					= 0x10,
	TB640_FSK_CALL_APP_STATE_RX_CONFIGURE			= 0x20,
	TB640_FSK_CALL_APP_STATE_READY					= 0x30,

	TB640_FSK_CALL_APP_STATE_TRANSMITTING			= 0x100,

	TB640_FSK_CALL_APP_STATE_RECEIVE_STATE_GENERIC	= 0x200,	/* Ready to receive any type of payload */
	TB640_FSK_CALL_APP_STATE_RECEIVE_STATE_STRESS	= 0x210,	/* Expecting stress stess type of payload */

} TB640_FSK_CALL_APP_STATE, *PTB640_FSK_CALL_APP_STATE;


/*
 | Enumeration describing the different sub states of a call
 */
typedef enum _TB640_FSK_CALL_APP_SUB_STATE
{
	TB640_FSK_CALL_APP_SUB_STATE_ENTRY				= 0,
	TB640_FSK_CALL_APP_SUB_STATE_PROCESS			= 1,

} TB640_FSK_CALL_APP_SUB_STATE, *PTB640_FSK_CALL_APP_SUB_STATE;


/* Define the action that can be triggered after an event processig */
typedef enum _TB640_FSK_STATE_ACTION
{
	TB640_FSK_STATE_ACTION_WAIT						= 1,
	TB640_FSK_STATE_ACTION_CONTINUE					= 2,
	TB640_FSK_STATE_ACTION_DESTROY_CONTEXT			= 3,

} TB640_FSK_STATE_ACTION, *PTB640_FSK_STATE_ACTION;


/*
 | Structure containing state history entry
 */
typedef struct _TB640_FSK_HISTORY_ENTRY
{
	TBX_UINT32							un32Timestamp;
	TB640_FSK_CALL_APP_STATE			CurrentState;
	TBX_UINT32							un32Event;

} TB640_FSK_HISTORY_ENTRY, *PTB640_FSK_HISTORY_ENTRY;


/* Action when entering the "transmit" state machine */
typedef enum _TB640_FSK_TX_ACTION
{
	TB640_FSK_TX_ACTION_NONE	= 0,
	TB640_FSK_TX_ACTION_SEND	= 1,

⌨️ 快捷键说明

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