#include "version.h"

// DMIN addresses, see dsp.txt
#define ENC_INPUT_SDRAM_HI	0	//	{ Input sdram high address (Dsp read only)	}
#define ENC_INPUT_SDRAM_LO	1	//	{ Input sdram low address (Dsp read only)	}	
#define ENC_OUTPUT_SDRAM_HI	2	//	{ Output sdram high address (Dsp read only)	}
#define ENC_OUTPUT_SDRAM_LO	3	//	{ Output sdram low address (Dsp read only)	}
#define DEC_INPUT_SDRAM_HI	4	//	{ Input sdram high address (Dsp read only)	}
#define DEC_INPUT_SDRAM_LO	5	//	{ Input sdram low address (Dsp read only)	}
#define DEC_OUTPUT_SDRAM_HI	6	//	{ Output sdram high address (Dsp read only)	}
#define DEC_OUTPUT_SDRAM_LO	7	//	{ Output sdram low address (Dsp read only)	}
#define ENC_OUTPUT_BYTE		8	//	{ Output data length in byte (Dsp write only)	}
#define PMIN_DONT_USE_FURTHER	10	//	{ cause G729 dtmf dec error			}
#define PMIN_DTMF_AMP		14
#define ENC_USE_VAD			16	//	{ for g.729ab and g.723.1	}
#define ENC_USE_HIGH_RATE   17	//  { for g.723.1 only  1 -- use 6.3k to encode  0 -- use 5.3k to encode  (Dsp read only)	}
#define DEC_USE_POST_FILTER 18  //  { for g.723.1 only  1 -- use post filter  0 -- do not use post filter   (Dsp read only)	}
#define PMIN_AEC_USAGE		21	//	{ sdram high address of far signal (Dsp read only) }
#define PMIN_AGC_USAGE		22	//	{ for g.723 & g.729 (Dsp read only)
								//	0 -- no agc analysis
								//	1 -- do agc analysis without speech modified
								//	2 -- do agc analysis with modify speech modified }
#define	PMIN_AGC_RESULT		23	//	{ the gain of speech (8051 read only)
								//	0 : no gain,	1 - 2
								//	1 : high gain,3 - 4
								//	2 : low gain,	2 - 3	}
#define PMIN_TONE_FREQ1		24
#define PMIN_TONE_FREQ2		25
#define PMIN_TONE_AMP		26

#define PMIN_DTMF_CODE		59	//	{ DTMF code		}

#define PMIN_TEST_0			120
#define PMIN_TEST_1			121
#define PMIN_TEST_2			122
#define PMIN_TEST_3			123
#define PMIN_TEST_4			124
#define PMIN_TEST_5			125

// const to generate DTMF singals
#define DTMF_SIGNAL_0		0
#define DTMF_SIGNAL_1		1
#define DTMF_SIGNAL_2		2
#define DTMF_SIGNAL_3		3
#define DTMF_SIGNAL_4		4
#define DTMF_SIGNAL_5		5
#define DTMF_SIGNAL_6		6
#define DTMF_SIGNAL_7		7
#define DTMF_SIGNAL_8		8
#define DTMF_SIGNAL_9		9
#define DTMF_SIGNAL_STAR	10
#define DTMF_SIGNAL_WELL	11
#define DTMF_SIGNAL_A		12
#define DTMF_SIGNAL_B		13
#define DTMF_SIGNAL_C		14
#define DTMF_SIGNAL_D		15
#define DTMF_SIGNAL_DIAL	16
#define DTMF_SIGNAL_BUSY	17
#define DTMF_SIGNAL_WAITING	18
#define DTMF_SIGNAL_CONGESTION	19
#define DTMF_SIGNAL_RING	20
#define DTMF_SIGNAL_ALL		21
#define DTMF_SIGNAL_QUIET	0xff

//#define DTMF_KEY_TIME		180
#define DTMF_KEY_TIME		90

#define DTMF_VOL_MIN		0
#define DTMF_VOL_MAX		15

#define DTMF_HANDSET_AMP	15
#define DTMF_HANDFREE_AMP	DTMF_VOL_MAX

#if defined RES_AR
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			300
#define DTMF_BUSY1_OFF_TIME			200
#define DTMF_BUSY2_ON_TIME			300
#define DTMF_BUSY2_OFF_TIME			200
#define DTMF_CONGESTION1_ON_TIME	300
#define DTMF_CONGESTION1_OFF_TIME	400
#define DTMF_CONGESTION2_ON_TIME	300
#define DTMF_CONGESTION2_OFF_TIME	400
#define DTMF_WAITING1_ON_TIME		300
#define DTMF_WAITING1_OFF_TIME		10000
#define DTMF_WAITING2_ON_TIME		300
#define DTMF_WAITING2_OFF_TIME		10000
#elif defined RES_AU
#define DTMF_RING1_ON_TIME			400
#define DTMF_RING1_OFF_TIME			200
#define DTMF_RING2_ON_TIME			400
#define DTMF_RING2_OFF_TIME			200
#define DTMF_BUSY1_ON_TIME			375
#define DTMF_BUSY1_OFF_TIME			375
#define DTMF_BUSY2_ON_TIME			375
#define DTMF_BUSY2_OFF_TIME			375
#define DTMF_CONGESTION1_ON_TIME	375
#define DTMF_CONGESTION1_OFF_TIME	375
#define DTMF_CONGESTION2_ON_TIME	375
#define DTMF_CONGESTION2_OFF_TIME	375
#define DTMF_WAITING1_ON_TIME		200
#define DTMF_WAITING1_OFF_TIME		200
#define DTMF_WAITING2_ON_TIME		200
#define DTMF_WAITING2_OFF_TIME		4400
#elif defined RES_BE_F || defined RES_BE_N
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			3000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			3000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	167
#define DTMF_CONGESTION1_OFF_TIME	167
#define DTMF_CONGESTION2_ON_TIME	167
#define DTMF_CONGESTION2_OFF_TIME	167
#define DTMF_WAITING1_ON_TIME		175
#define DTMF_WAITING1_OFF_TIME		175
#define DTMF_WAITING2_ON_TIME		175
#define DTMF_WAITING2_OFF_TIME		3500
#elif defined RES_BG
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		150
#define DTMF_WAITING1_OFF_TIME		150
#define DTMF_WAITING2_ON_TIME		150
#define DTMF_WAITING2_OFF_TIME		4000
#elif defined RES_BR
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			250
#define DTMF_BUSY1_OFF_TIME			250
#define DTMF_BUSY2_ON_TIME			250
#define DTMF_BUSY2_OFF_TIME			250
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		50
#define DTMF_WAITING1_OFF_TIME		1000
#define DTMF_WAITING2_ON_TIME		50
#define DTMF_WAITING2_OFF_TIME		1000
#elif defined RES_CA_E || defined RES_CA_F
#define DTMF_RING1_ON_TIME			2000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			2000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		300
#define DTMF_WAITING1_OFF_TIME		10000
#define DTMF_WAITING2_ON_TIME		300
#define DTMF_WAITING2_OFF_TIME		10000
#elif defined RES_CN
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			350
#define DTMF_BUSY1_OFF_TIME			350
#define DTMF_BUSY2_ON_TIME			350
#define DTMF_BUSY2_OFF_TIME			350
#define DTMF_CONGESTION1_ON_TIME	700
#define DTMF_CONGESTION1_OFF_TIME	700
#define DTMF_CONGESTION2_ON_TIME	700
#define DTMF_CONGESTION2_OFF_TIME	700
#define DTMF_WAITING1_ON_TIME		400
#define DTMF_WAITING1_OFF_TIME		4000
#define DTMF_WAITING2_ON_TIME		400
#define DTMF_WAITING2_OFF_TIME		4000
#elif defined RES_CL
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			3000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			3000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	200
#define DTMF_CONGESTION1_OFF_TIME	200
#define DTMF_CONGESTION2_ON_TIME	200
#define DTMF_CONGESTION2_OFF_TIME	200
#define DTMF_WAITING1_ON_TIME		500
#define DTMF_WAITING1_OFF_TIME		500
#define DTMF_WAITING2_ON_TIME		500
#define DTMF_WAITING2_OFF_TIME		500
#elif defined RES_CZ
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			330
#define DTMF_BUSY1_OFF_TIME			330
#define DTMF_BUSY2_ON_TIME			330
#define DTMF_BUSY2_OFF_TIME			330
#define DTMF_CONGESTION1_ON_TIME	165
#define DTMF_CONGESTION1_OFF_TIME	165
#define DTMF_CONGESTION2_ON_TIME	165
#define DTMF_CONGESTION2_OFF_TIME	165
#define DTMF_WAITING1_ON_TIME		330
#define DTMF_WAITING1_OFF_TIME		9000
#define DTMF_WAITING2_ON_TIME		330
#define DTMF_WAITING2_OFF_TIME		9000
#elif defined RES_DE
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			480
#define DTMF_BUSY1_OFF_TIME			480
#define DTMF_BUSY2_ON_TIME			480
#define DTMF_BUSY2_OFF_TIME			480
#define DTMF_CONGESTION1_ON_TIME	240
#define DTMF_CONGESTION1_OFF_TIME	240
#define DTMF_CONGESTION2_ON_TIME	240
#define DTMF_CONGESTION2_OFF_TIME	240
#define DTMF_WAITING1_ON_TIME		200
#define DTMF_WAITING1_OFF_TIME		200
#define DTMF_WAITING2_ON_TIME		200
#define DTMF_WAITING2_OFF_TIME		5000
#elif defined RES_EG
#define DTMF_RING1_ON_TIME			2000
#define DTMF_RING1_OFF_TIME			1000
#define DTMF_RING2_ON_TIME			2000
#define DTMF_RING2_OFF_TIME			1000
#define DTMF_BUSY1_ON_TIME			1000
#define DTMF_BUSY1_OFF_TIME			4000
#define DTMF_BUSY2_ON_TIME			1000
#define DTMF_BUSY2_OFF_TIME			4000
#define DTMF_CONGESTION1_ON_TIME	500
#define DTMF_CONGESTION1_OFF_TIME	500
#define DTMF_CONGESTION2_ON_TIME	500
#define DTMF_CONGESTION2_OFF_TIME	500
#define DTMF_WAITING1_ON_TIME		200		// This value is inaccurate
#define DTMF_WAITING1_OFF_TIME		200
#define DTMF_WAITING2_ON_TIME		200
#define DTMF_WAITING2_OFF_TIME		200
#elif defined RES_ES || defined RES_ES_C
#define DTMF_RING1_ON_TIME			1500
#define DTMF_RING1_OFF_TIME			3000
#define DTMF_RING2_ON_TIME			1500
#define DTMF_RING2_OFF_TIME			3000
#define DTMF_BUSY1_ON_TIME			200
#define DTMF_BUSY1_OFF_TIME			200
#define DTMF_BUSY2_ON_TIME			200
#define DTMF_BUSY2_OFF_TIME			200
#define DTMF_CONGESTION1_ON_TIME	200
#define DTMF_CONGESTION1_OFF_TIME	200
#define DTMF_CONGESTION2_ON_TIME	200
#define DTMF_CONGESTION2_OFF_TIME	600
#define DTMF_WAITING1_ON_TIME		175
#define DTMF_WAITING1_OFF_TIME		175
#define DTMF_WAITING2_ON_TIME		175
#define DTMF_WAITING2_OFF_TIME		3500
#elif defined RES_FR
#define DTMF_RING1_ON_TIME			1500
#define DTMF_RING1_OFF_TIME			3500
#define DTMF_RING2_ON_TIME			1500
#define DTMF_RING2_OFF_TIME			3500
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	500
#define DTMF_CONGESTION1_OFF_TIME	500
#define DTMF_CONGESTION2_ON_TIME	500
#define DTMF_CONGESTION2_OFF_TIME	500
#define DTMF_WAITING1_ON_TIME		300
#define DTMF_WAITING1_OFF_TIME		8000
#define DTMF_WAITING2_ON_TIME		400
#define DTMF_WAITING2_OFF_TIME		8000
#elif defined RES_GB
#define DTMF_RING1_ON_TIME			400
#define DTMF_RING1_OFF_TIME			200
#define DTMF_RING2_ON_TIME			400
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			375
#define DTMF_BUSY1_OFF_TIME			375
#define DTMF_BUSY2_ON_TIME			375
#define DTMF_BUSY2_OFF_TIME			375
#define DTMF_CONGESTION1_ON_TIME	400
#define DTMF_CONGESTION1_OFF_TIME	350
#define DTMF_CONGESTION2_ON_TIME	225
#define DTMF_CONGESTION2_OFF_TIME	525
#define DTMF_WAITING1_ON_TIME		250
#define DTMF_WAITING1_OFF_TIME		250
#define DTMF_WAITING2_ON_TIME		250
#define DTMF_WAITING2_OFF_TIME		3250
#elif defined RES_GR
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			300
#define DTMF_BUSY1_OFF_TIME			300
#define DTMF_BUSY2_ON_TIME			300
#define DTMF_BUSY2_OFF_TIME			300
#define DTMF_CONGESTION1_ON_TIME	150
#define DTMF_CONGESTION1_OFF_TIME	150
#define DTMF_CONGESTION2_ON_TIME	150
#define DTMF_CONGESTION2_OFF_TIME	150
#define DTMF_WAITING1_ON_TIME		300
#define DTMF_WAITING1_OFF_TIME		10000
#define DTMF_WAITING2_ON_TIME		300
#define DTMF_WAITING2_OFF_TIME		10000
#elif defined RES_HK
#define DTMF_RING1_ON_TIME			400
#define DTMF_RING1_OFF_TIME			200
#define DTMF_RING2_ON_TIME			400
#define DTMF_RING2_OFF_TIME			3000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		500
#define DTMF_WAITING1_OFF_TIME		500
#define DTMF_WAITING2_ON_TIME		500
#define DTMF_WAITING2_OFF_TIME		500
#elif defined RES_HU
#define DTMF_RING1_ON_TIME			1250
#define DTMF_RING1_OFF_TIME			3750
#define DTMF_RING2_ON_TIME			1250
#define DTMF_RING2_OFF_TIME			3750
#define DTMF_BUSY1_ON_TIME			300
#define DTMF_BUSY1_OFF_TIME			300
#define DTMF_BUSY2_ON_TIME			300
#define DTMF_BUSY2_OFF_TIME			300
#define DTMF_CONGESTION1_ON_TIME	300
#define DTMF_CONGESTION1_OFF_TIME	300
#define DTMF_CONGESTION2_ON_TIME	300
#define DTMF_CONGESTION2_OFF_TIME	300
#define DTMF_WAITING1_ON_TIME		40
#define DTMF_WAITING1_OFF_TIME		1960
#define DTMF_WAITING2_ON_TIME		40
#define DTMF_WAITING2_OFF_TIME		1960
#elif defined RES_IN
#define DTMF_RING1_ON_TIME			400
#define DTMF_RING1_OFF_TIME			200
#define DTMF_RING2_ON_TIME			400
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			750
#define DTMF_BUSY1_OFF_TIME			750
#define DTMF_BUSY2_ON_TIME			750
#define DTMF_BUSY2_OFF_TIME			750
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		200
#define DTMF_WAITING1_OFF_TIME		100
#define DTMF_WAITING2_ON_TIME		200
#define DTMF_WAITING2_OFF_TIME		7500
#elif defined RES_IT
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	200
#define DTMF_CONGESTION1_OFF_TIME	200
#define DTMF_CONGESTION2_ON_TIME	200
#define DTMF_CONGESTION2_OFF_TIME	200
#define DTMF_WAITING1_ON_TIME		400
#define DTMF_WAITING1_OFF_TIME		100
#define DTMF_WAITING2_ON_TIME		250
#define DTMF_WAITING2_OFF_TIME		100
#elif defined RES_JP
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			2000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	500
#define DTMF_CONGESTION1_OFF_TIME	500
#define DTMF_CONGESTION2_ON_TIME	500
#define DTMF_CONGESTION2_OFF_TIME	500
#define DTMF_WAITING1_ON_TIME		100
#define DTMF_WAITING1_OFF_TIME		100
#define DTMF_WAITING2_ON_TIME		100
#define DTMF_WAITING2_OFF_TIME		3000
#elif defined RES_KR
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			2000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	300
#define DTMF_CONGESTION1_OFF_TIME	200
#define DTMF_CONGESTION2_ON_TIME	300
#define DTMF_CONGESTION2_OFF_TIME	200
#define DTMF_WAITING1_ON_TIME		250
#define DTMF_WAITING1_OFF_TIME		250
#define DTMF_WAITING2_ON_TIME		250
#define DTMF_WAITING2_OFF_TIME		3250
#elif defined RES_LK
#define DTMF_RING1_ON_TIME			400
#define DTMF_RING1_OFF_TIME			200
#define DTMF_RING2_ON_TIME			400
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			750
#define DTMF_BUSY1_OFF_TIME			750
#define DTMF_BUSY2_ON_TIME			750
#define DTMF_BUSY2_OFF_TIME			750
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		500
#define DTMF_WAITING1_OFF_TIME		2500
#define DTMF_WAITING2_ON_TIME		500
#define DTMF_WAITING2_OFF_TIME		2500
#elif defined RES_MX
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			250
#define DTMF_BUSY1_OFF_TIME			250
#define DTMF_BUSY2_ON_TIME			250
#define DTMF_BUSY2_OFF_TIME			250
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		200		// This value is inaccurate
#define DTMF_WAITING1_OFF_TIME		200
#define DTMF_WAITING2_ON_TIME		200
#define DTMF_WAITING2_OFF_TIME		200
#elif defined RES_NL
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		500
#define DTMF_WAITING1_OFF_TIME		9500
#define DTMF_WAITING2_ON_TIME		500
#define DTMF_WAITING2_OFF_TIME		9500
#elif defined RES_NO
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	200
#define DTMF_CONGESTION1_OFF_TIME	200
#define DTMF_CONGESTION2_ON_TIME	200
#define DTMF_CONGESTION2_OFF_TIME	200
#define DTMF_WAITING1_ON_TIME		200
#define DTMF_WAITING1_OFF_TIME		600
#define DTMF_WAITING2_ON_TIME		200
#define DTMF_WAITING2_OFF_TIME		1000
#elif defined RES_NZ_E || defined RES_NZ_M
#define DTMF_RING1_ON_TIME			400
#define DTMF_RING1_OFF_TIME			200
#define DTMF_RING2_ON_TIME			400
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	500
#define DTMF_CONGESTION1_OFF_TIME	500
#define DTMF_CONGESTION2_ON_TIME	500
#define DTMF_CONGESTION2_OFF_TIME	500
#define DTMF_WAITING1_ON_TIME		250
#define DTMF_WAITING1_OFF_TIME		250
#define DTMF_WAITING2_ON_TIME		250
#define DTMF_WAITING2_OFF_TIME		3250
#elif defined RES_PL
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	500
#define DTMF_CONGESTION1_OFF_TIME	500
#define DTMF_CONGESTION2_ON_TIME	500
#define DTMF_CONGESTION2_OFF_TIME	500
#define DTMF_WAITING1_ON_TIME		150
#define DTMF_WAITING1_OFF_TIME		150
#define DTMF_WAITING2_ON_TIME		150
#define DTMF_WAITING2_OFF_TIME		4000
#elif defined RES_PT
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			5000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			5000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	200
#define DTMF_CONGESTION1_OFF_TIME	200
#define DTMF_CONGESTION2_ON_TIME	200
#define DTMF_CONGESTION2_OFF_TIME	200
#define DTMF_WAITING1_ON_TIME		200
#define DTMF_WAITING1_OFF_TIME		200
#define DTMF_WAITING2_ON_TIME		200
#define DTMF_WAITING2_OFF_TIME		5000
#elif defined RES_RU
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			350
#define DTMF_BUSY1_OFF_TIME			350
#define DTMF_BUSY2_ON_TIME			350
#define DTMF_BUSY2_OFF_TIME			350
#define DTMF_CONGESTION1_ON_TIME	175
#define DTMF_CONGESTION1_OFF_TIME	175
#define DTMF_CONGESTION2_ON_TIME	175
#define DTMF_CONGESTION2_OFF_TIME	175
#define DTMF_WAITING1_ON_TIME		200
#define DTMF_WAITING1_OFF_TIME		5000
#define DTMF_WAITING2_ON_TIME		200
#define DTMF_WAITING2_OFF_TIME		5000
#elif defined RES_SG
#define DTMF_RING1_ON_TIME			400
#define DTMF_RING1_OFF_TIME			200
#define DTMF_RING2_ON_TIME			400
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			750
#define DTMF_BUSY1_OFF_TIME			750
#define DTMF_BUSY2_ON_TIME			750
#define DTMF_BUSY2_OFF_TIME			750
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		300
#define DTMF_WAITING1_OFF_TIME		200
#define DTMF_WAITING2_ON_TIME		300
#define DTMF_WAITING2_OFF_TIME		3200
#elif defined RES_SK
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			330
#define DTMF_BUSY1_OFF_TIME			330
#define DTMF_BUSY2_ON_TIME			330
#define DTMF_BUSY2_OFF_TIME			330
#define DTMF_CONGESTION1_ON_TIME	165
#define DTMF_CONGESTION1_OFF_TIME	165
#define DTMF_CONGESTION2_ON_TIME	165
#define DTMF_CONGESTION2_OFF_TIME	165
#define DTMF_WAITING1_ON_TIME		330
#define DTMF_WAITING1_OFF_TIME		9000
#define DTMF_WAITING2_ON_TIME		330
#define DTMF_WAITING2_OFF_TIME		9000
#elif defined RES_TW
#define DTMF_RING1_ON_TIME			1000
#define DTMF_RING1_OFF_TIME			2000
#define DTMF_RING2_ON_TIME			1000
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	500
#define DTMF_CONGESTION1_OFF_TIME	500
#define DTMF_CONGESTION2_ON_TIME	500
#define DTMF_CONGESTION2_OFF_TIME	500
#define DTMF_WAITING1_ON_TIME		250
#define DTMF_WAITING1_OFF_TIME		250
#define DTMF_WAITING2_ON_TIME		250
#define DTMF_WAITING2_OFF_TIME		5250
#elif defined RES_ZA_E || defined RES_ZA_N
#define DTMF_RING1_ON_TIME			400
#define DTMF_RING1_OFF_TIME			200
#define DTMF_RING2_ON_TIME			400
#define DTMF_RING2_OFF_TIME			2000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		400
#define DTMF_WAITING1_OFF_TIME		4000
#define DTMF_WAITING2_ON_TIME		400
#define DTMF_WAITING2_OFF_TIME		4000
#else // RES_US and others
#define DTMF_RING1_ON_TIME			2000
#define DTMF_RING1_OFF_TIME			4000
#define DTMF_RING2_ON_TIME			2000
#define DTMF_RING2_OFF_TIME			4000
#define DTMF_BUSY1_ON_TIME			500
#define DTMF_BUSY1_OFF_TIME			500
#define DTMF_BUSY2_ON_TIME			500
#define DTMF_BUSY2_OFF_TIME			500
#define DTMF_CONGESTION1_ON_TIME	250
#define DTMF_CONGESTION1_OFF_TIME	250
#define DTMF_CONGESTION2_ON_TIME	250
#define DTMF_CONGESTION2_OFF_TIME	250
#define DTMF_WAITING1_ON_TIME		300
#define DTMF_WAITING1_OFF_TIME		10000
#define DTMF_WAITING2_ON_TIME		300
#define DTMF_WAITING2_OFF_TIME		10000
#endif

#define G7231_R63_LEN		24
#define G7231_R53_LEN		20
#define G7231_CNG_LEN		4
#define G7231_VAD_LEN		1
#define G7231_VAD_BYTE		0x03
#define G7231_COMPRESSED	24

#define G729_R8_LEN			10
#define G729_CNG_LEN		2
#define G729_VAD_LEN		0
#define G729_COMPRESSED		12

#define G711_LEN			80

#define GSM610_LEN			33

#define ILBC_LEN			50

#define PCM_RAW_LEN			160

#define DTMF_INBAND_TIME	300

#define G7231_FRAME_TIME	30
#define G729_FRAME_TIME		10
#define GSM610_FRAME_TIME	20
#define G711_FRAME_TIME		10
#define ILBC_FRAME_TIME		30

extern CSHORT Dsp_cCodecInit[CODEC_NULL];
extern CSHORT Dsp_c8KEncode[CODEC_NULL];
extern CSHORT Dsp_c8KDecode[CODEC_NULL];
extern CSHORT Dsp_cEntry_4[CODEC_NULL];
extern CSHORT Dsp_cEntry_5[CODEC_NULL];
extern CSHORT Dsp_cEntry_6[CODEC_NULL];
extern CSHORT Dsp_cEntry_7[CODEC_NULL];
extern CSHORT Dsp_cEntry_8[CODEC_NULL];
extern CSHORT Dsp_cEntry_9[CODEC_NULL];
extern CSHORT Dsp_cEntry_10[CODEC_NULL];
extern CSHORT Dsp_cEntry_12[CODEC_NULL];
extern CSHORT Dsp_cEntry_13[CODEC_NULL];
extern CSHORT Dsp_cEntry_16[CODEC_NULL];
extern CSHORT Dsp_cEntry_18[CODEC_NULL];
extern CSHORT Dsp_cEntry_19[CODEC_NULL];
extern CSHORT Dsp_cEntry_20[CODEC_NULL];
extern CSHORT Dsp_cEntry_22[CODEC_NULL];
extern CSHORT Dsp_cEntry_24[CODEC_NULL];
extern CSHORT Dsp_cEntry_25[CODEC_NULL];

extern CCHAR Dsp_cCodeSdramHi[CODEC_NULL];
extern CCHAR Dsp_cCodeSdramLo[CODEC_NULL];
extern CSHORT Dsp_cCodeSize[CODEC_NULL];

extern CCHAR Dsp_iVadLen[CODEC_NULL];
extern CCHAR Dsp_iDecodeLenPos[CODEC_NULL];
extern CCHAR Dsp_iDecodeLenDword[CODEC_NULL];

extern CCHAR Dsp_cFrameLen[CODEC_NULL];
extern CCHAR Dsp_cRecordingLen[CODEC_NULL];
