// Sdram and sram exchange buffer const
#define SRAM_DMA_BYTE		512
#define SRAM_DMA_DWORD		128
#define SRAM_DMA_HALF_BYTE	256
#define SRAM_DMA_HALF_DWORD	64

// Sdram load flags
#define SDRAM_CHECK_HI			0x03		// AC97_OUT_SDRAM_HI
#define SDRAM_CHECK_LO			255
#define SDRAM_CHECK_POS			255
#define SDRAM_CHECK_G723_OK		1
#define SDRAM_CHECK_G729_OK		2
#define SDRAM_CHECK_ILBC_OK		4
#define SDRAM_CHECK_RING_OK		8
#define SDRAM_CHECK_MISC_OK		16

// Sdram addresses, see sdram.txt

//
// Overview
//
#define OPTIONS_SDRAM_HI		0x00
#define OPTIONS_SDRAM_POS		0x0000
#define HTTP_SDRAM_HI			0x01
#define AC97_IN_SDRAM_HI		0x02
#define AC97_OUT_SDRAM_HI		0x03
#define DSP_OUTPUT_SDRAM_HI		0x04
#define	DSP_SDRAM_HI			0x05
#define	DSP_INPUT_SDRAM_HI		0x06
#define ILBC_SDRAM_HI2			0x07
#define G723_SDRAM_HI			0x08
#define G723_SDRAM_HI2			0x09
#define G729_SDRAM_HI			0x0a
#define G729_SDRAM_HI2			0x0b
#define FILE_IN_SDRAM_HI		0x0c
#define	PLAY_SDRAM_HI			0x0c
#define RING_G729_SDRAM_HI		0x0d
#define RING_G7231_SDRAM_HI		0x0e
#define RING_G711U_SDRAM_HI		0x0f
#define RING_G711A_SDRAM_HI		0x10
#define RING_GSM610_SDRAM_HI	0x11
#define RING_ILBC_SDRAM_HI		0x12
#define ILBC_SDRAM_HI           0x15
#define FILE_OUT_SDRAM_HI		0x16
#define IVR_SDRAM_HI			0x18
#define IVR_SDRAM_POS			0x1800
#define STRING_SDRAM_HI			0x19
#define CALLREC_SDRAM_HI		0x1a
#define SIP_TRANS_SDRAM_HI		0x1b
#define SIP_TRANS_SDRAM_POS		0x1b00
#define PROTOCOL_SDRAM_HI		0x1c
#define PROTOCOL_SDRAM_POS		0x1c00
#define MODEM_SEND_SDRAM_HI		0x1d
#define MODEM_RECV_SDRAM_HI		0x1e
#define MAP_SDRAM_HI			0x1f

#define OPTIONS_TOTAL_LEN		8192

//
// SDRAM_HI = 0
//

#define OPTIONS_SDRAM_LO		0x00

#define OPTIONS_MAC_ADDR		0x00
#define OPTIONS_IP_ADDR			0x06
#define	OPTIONS_DDA_ADDR		0x0a	// reserved
#define OPTIONS_VLAN_ENABLE		0x0a
#define OPTIONS_VLAN_ID			0x0b	//0x0b-0x0c, 0x0d reserved
#define OPTIONS_USE_GK			0x0e
#define OPTIONS_RING_TYPE		0x0f
#define OPTIONS_PHONE_NUMBER	0x10
#define PHONE_NUMBER_LEN		16
#define FORWARD_NUMBER_LEN		24
#define DIALED_MAX_LEN			32
#define MAX_KEYBUF_LEN			48
#define OPTIONS_SUBNET_MASK		0x20
#define OPTIONS_ROUTER_ADDR		0x24
#define OPTIONS_IP_TYPE			0x28
#define OPTIONS_HANDSET_INPUT	0x29
#define OPTIONS_HANDSET_OUTPUT	0x2a
#define OPTIONS_DSP_OPTION		0x2b
#define OPTIONS_DNS_ADDR		0x2c
#define OPTIONS_JITTER_SIZE		0x30
#define JITTER_SIZE_MAX			33
#define OPTIONS_RING_NUMBER		0x31
#define OPTIONS_LOCAL_ALIAS		0x32
#define OPTIONS_HANDFREE_OUTPUT	0x33
#define OPTIONS_HANDFREE_INPUT	0x34
#define OPTIONS_AUDIO_FRAMES	0x35
#define OPTIONS_Q931_PORT		0x36
#define OPTIONS_HTTPS_PORT		0x38
#define OPTIONS_DTMF_PTYPE		0x3a
#define	MAX_DTMF_PTYPE			255
#define OPTIONS_DNS_ADDR2		0x3b
#define OPTIONS_NAT_TRAVERSAL	0x3f
#define OPTIONS_DIGITMAP_VER	0x40
#define OPTIONS_REALTIME		0x42
#define OPTIONS_CALL_TYPE		0x46
#define OPTIONS_DTMF_TYPE		0x47
#define OPTIONS_PASSWORD		0x48
#define MAX_PASSWORD_LEN		16
#define OPTIONS_COUNTRY_CODE	0x58
#define MAX_COUNTRY_CODE_LEN	4
#define OPTIONS_INTL_PREFIX		0x5c
#define MAX_INTL_PREFIX_LEN		4
#define OPTIONS_AREA_CODE		0x60
#define MAX_AREA_CODE_LEN		4
#define OPTIONS_LONG_PREFIX		0x64
#define MAX_LONG_PREFIX_LEN		3
#define OPTIONS_USE_DIALPLAN	0x67
#define OPTIONS_INNER_LINE		0x68
#define OPTIONS_DUALMODE_PREFIX		0x69
#define MAX_DUALMODE_PREFIX_LEN		2
#define OPTIONS_INNERLINE_PREFIX	0x6b
#define MAX_INNERLINE_PREFIX_LEN	2
#define OPTIONS_SERVICE_TYPE	0x6d
#define OPTIONS_PIN				0x6e
#define MAX_PIN_LEN				32
#define OPTIONS_ACCOUNT			0x8e
#define MAX_ACCOUNT_LEN			32
#define OPTIONS_SETTINGS_VER	0xae
#define OPTIONS_PPP_ID			0xb0
#define PPP_ID_LEN				40
#define OPTIONS_PPP_PASSWORD	0xd8
#define PPP_PASSWORD_LEN		24
#define OPTIONS_RAS_PORT		0xf0
#define OPTIONS_H245_PORT		0xf2
#define OPTIONS_RTP_PORT		0xf4
#define OPTIONS_REGISTER_TTL	0xf6
#define OPTIONS_NAT_TTL			0xf8
#define OPTIONS_TIMEOUT_0		0xf7
#define OPTIONS_TIMEOUT_1		0xf8
#define OPTIONS_TIMEOUT_2		0xf9
#define OPTIONS_NETWORK_RETRY	0xfa
#define OPTIONS_PHONEBOOK_VER	0xfb
#define OPTIONS_PHONE_ATTR		0xfd
#define OPTIONS_OUTPUT_DEBUG	0xfe
#define OPTIONS_USE_DIGITMAP	0xff
#define OPTIONS_CODEC_TYPE		0x120
#define OPTIONS_ILBC_PTYPE		0x12f
#define	MAX_ILBC_PTYPE			255
#define SYS_CODEC_NUM			6
#define OPTIONS_SUPER_PASSWORD	0x130
#define	MAX_SUPERPASSWORD_LEN	16
#define OPTIONS_FWD_NUMBER		0x140
#define OPTIONS_FWD_TYPE		0x158
#define OPTIONS_PROGRAM_BUTTONS	0x159
#define PROGRAM_BUTTONS_NUM		5
#define	OPTIONS_RTP_TOS			0x15e
#define	MAX_RTP_TOS_LEN			255
#define OPTIONS_DUAL_MODE		0x15f
#define	OPTIONS_UPGRADE_TYPE	0x161
#define OPTIONS_TIME_ZONE		0x162
#define OPTIONS_NTS_ADDR		0x163
#define OPTIONS_SYS_TEST		0x167
#define SYS_TEST_NUM			6
#define	OPTIONS_DIAL_NUMBER		0x170
#define	DIAL_NUMBER_LEN			16
#define OPTIONS_SERVICE_ID		0x180
#define MAX_SERVICE_ID_LEN		32
#define OPTIONS_SERVICE_DNS		0x1a0
#define MAX_DNS_ADDR_LEN		32
#define	OPTIONS_UPGRADE_DNS		0x1c0
#define	OPTIONS_NAT_DNS			0x1e0

#define FLAGS_SDRAM_LO			0x01
#define FLAGS_MAX_DWORD			8
#define FLAGS_UPGRADE_MODE		0x00
#define TCPIP_UPGRADE_MODE		1	
#define FLAGS_UPGRADE_PAGE		0x01
#define SERIAL_UPGRADE_PAGE		127
#define OPTIONS_UPGRADE_PAGE	128
#define PROGRAM_UPGRADE_PAGE	129
#define RING_UPGRADE_PAGE		130
#define MAP_UPGRADE_PAGE		132
#define ALTERNATE_SETTING_UPGRADE_PAGE	133
#define FLAGS_PROTOCOL			0x02
#define FLAGS_MAP_NUMBER		0x03
#define FLAGS_PAGE3_LOADED		0x04
#define FLAGS_PAGE3_RUN			0x05
#define FLAGS_RING_SIZE			0x06
#define MAX_PCMRING_SIZE		15360
#define FLAGS_DEVICE_ATTR		0x08
#define FLAGS_PAGE12_ATTR		0x09
#define	PAGE12_PUBLIC_IP		1
#define PAGE12_FIXED_IP			2
#define PAGE12_CHANGED_IP		4
#define FLAGS_PRODUCT_TAG		0x10
#define MAX_TAG_LENGTH			16

// code space address, not sdram address
#define FLAGS_CODE_POS			0xbf00
#define FLAGS_CODE_POS_HIGH		0xbf

#define SPEED_DIAL_BEGIN		0x0200
#define SPEED_DIAL_LEN			32
#define SPEED_DIAL_TOTAL_LEN	3584
#define SPEED_DIAL_NUM			100
#define PROXYIP_DNS_POS			200
#define TIME_DNS_POS			210

#define DIAL_MAP_BEGIN			0x1000
#define DIAL_MAP_LO				0x10
#define OPTIONS_DIGITMAP_LEN	2048

#define ALTERNATE_SETTING_BEGIN	0x1800
#define ALTERNATE_SETTING_LO	0x18
#define ALTERNATE_SETTING_NUM	4


// Temporary variables area
#define SDRAM_DATA_MAX			254
#define SDRAM_DATA_LENGTH		255

#define IVR3_SDRAM_LO			0x40
// IVR3_SDRAM_LO related
#define IVR_UNIT_SDRAM_NUM		3

#define IVR_MSG_0				0
#define IVR_MSG_1				1
#define IVR_MSG_2				2
#define IVR_MSG_3				3
#define IVR_MSG_4				4
#define IVR_MSG_5				5
#define IVR_MSG_6				6
#define IVR_MSG_7				7
#define IVR_MSG_8				8
#define IVR_MSG_9				9
#define IVR_MSG_10				10
#define IVR_MSG_HUNDRED			11
#define IVR_MSG_LOCAL			12
#define IVR_MSG_BLANK			13
#define IVR_MSG_DOT				14
#define IVR_MSG_NUMBER			15
#define IVR_MSG_IP				16
#define IVR_MSG_TWO				17
#define IVR_MSG_GATEWAY			18
#define IVR_MSG_SIGNAL			19
#define IVR_MSG_MASK			20
#define IVR_MSG_ONE				21
#define IVR_MSG_SERVICE			22
#define IVR_MSG_SUBNET			23


#define	KEY_PREVBUF_SDRAM_LO	0x41
#define CALLREC_CURWRITE_SDRAM_LO	0x42
#define DTMF_SENDBUF_SDRAM_LO	0x43	
#define REMOTE_NUMBER_SDRAM_LO	0x44
#define ORIG_SETTING_SDRAM_LO	0x45	// need 2 buffer here     
#define CID_INFO_SDRAM_LO		0x47		// save fxs gateway's CID informations
#define UPGRADE_FILENAME_LO		0x48
#define VMS_NUMBER_LO			0x49
#define RTP_DATA_SDRAM_LO		0x4a	// 4a-4b
#define DEBUG_DMA_SDRAM_LO		0x4c	// 4c-4d
#define DEBUG_UDP_SDRAM_LO		0x4e	// 4e-4f
#define DEBUG_OUTPUT_SDRAM_LO	0x50	// 50-51
#define HTTP_TEMP_SDRAM_LO		0x52
#define DNS_STRING_SDRAM_LO		0x53
#define RTP_PREV_SDRAM_LO		0x54	// need 2 buffer here
#define RTP_PREV2_SDRAM_LO		0x56	// need 2 buffer here
#define RTP_CUR_SDRAM_LO		0x58	// need 2 buffer here
#define RTP_G711_SDRAM_LO		0x5a
#define DESIGN_NAME_SDRAM_LO	0x5b
#define BALANCE_SDRAM_LO		0x5c
#define STUN_TRANSID_SDRAM_LO	0x5d
#define DHCP_OPCODE_SDRAM_LO	0x5e
#define HTTP_INFO_SDRAM_LO		0x5f
#define MSG_HINT_SDRAM_LO		0x60
#define CFG_TEMP_SDRAM_LO		0x61	//0x61-0x62
#define PUBLIC_IP_SDRAM_LO		0x63

// 0x63-0x6c available for more data storage

// page0
#define UDP_TEST_SDRAM_LO		0x6d

// autoprov
#define TFTP_SDRAM_LO			0x6d
#define FTP_CTRL_SDRAM_LO		0x74
#define FTP_DATA_SDRAM_LO		0x7b
#define HTTP_CLIENT_SDRAM_LO	0x82
#define ACTVTCP_SDRAM_LO		0x89
#define PASVTCP_SDRAM_LO		0x90

// MT29F016S5 programer
#define PROGRAM_SDRAM_LO		0x6d

// EPN data
#define EPN_SDRAM_LO			0x6d

// IAX2 data
#define IAX2_SESS0_SDRAM_LO		0x6d
#define IAX2_SESS1_SDRAM_LO		0x74
#define IAX2_SESS2_SDRAM_LO		0x7b
#define IAX2_SESS3_SDRAM_LO		0x82
#define IAX2_SESS4_SDRAM_LO		0x89	

// WP data
#define WP_CALL_SDRAM_LO		0x6d
#define WP_MEDIA_SDRAM_LO		0x74

// MGCP data
#define MGCP_REQ_SDRAM_LO		0x6d
#define MGCP_RESP_SDRAM_LO		0x74

// N2P data
#define N2P_DOORMAN_SDRAM_LO	0x6d	
#define N2P_OPAL_SDRAM_LO		0x74
#define N2P_NAT_SDRAM_LO		0x7b
#define N2P_CALL_SDRAM_LO		0x82

// H323 data
#define RAS_SDRAM_LO			0x6d
#define H2250_SDRAM_LO			0x74
#define H245_SDRAM_LO			0x7b
#define AIVGR_UDP_SDRAM_LO		0x82
#define YIYANG_TCP_SDRAM_LO		0x82
#define ASIASOFT_TCP_SDRAM_LO	0x82
#define AG_COMMON_SDRAM_LO		0x82
#define AG_Q931_SDRAM_LO		0x89
#define AG_H245_SDRAM_LO		0x90

// SIP data
#define SIP_CALL0_REQ_UDP		0x6d
#define SIP_CALL1_REQ_UDP		0x74
#define SIP_RESP_UDP_HEAD		0x7d
#define SIP_REG_UDP_HEAD		0x82
#define SIP_CALL0_RESP_UDP		0x89
#define SIP_CALL1_RESP_UDP		0x90

// tcpip data
#define UDP_INFO_SDRAM_LO		0x97
#define RTP_SDRAM_LO			0x9e
#define RTCP_SDRAM_LO			0xa5
#define SNMP_SDRAM_LO			0xac
#define DEBUG_SDRAM_LO			0xb3
#define DHCP_SDRAM_LO			0xba
#define DNS_SDRAM_LO			0xc1
#define SNTP_SDRAM_LO			0xc8
#define TELNET_SDRAM_LO			0xcf
#define HTTP_SERVER_SDRAM_LO	0xd6
#define HTTP_SERVER2_SDRAM_LO	0xdd
#define UPGRADE_SDRAM_LO		0xe4
#define STUN_SDRAM_LO			0xeb
#define RTP2_SDRAM_LO			0xf2
#define RTCP2_SDRAM_LO			0xf9


//
// SDRAM_HI = 1
//

// HTTP data
#define	HTTP_MESSAGE_SDRAM_LO	0x0		// 0x00-0xaf, 176 blocks
#define HTTP_SERVERBUF_SDRAM_LO		0xb0

#define HTTP_CLIENTBUF_SDRAM_LO		0xb0
#define HTTP_CLIENT_REQUEST_URI		HTTP_CLIENTBUF_SDRAM_LO

#define HTTP_AUTH_SDRAM_LO		0xc0
#define HTTP_AUTH_REALM			HTTP_AUTH_SDRAM_LO
#define HTTP_AUTH_NONCE			(HTTP_AUTH_SDRAM_LO + 1)
#define HTTP_AUTH_OPAQUE		(HTTP_AUTH_SDRAM_LO + 2)
#define HTTP_AUTH_DIGEST		(HTTP_AUTH_SDRAM_LO + 3)
#define HTTP_AUTH_URI			(HTTP_AUTH_SDRAM_LO + 4)
#define HTTP_AUTH_HA1			(HTTP_AUTH_SDRAM_LO + 5)
#define HTTP_AUTH_HA2			(HTTP_AUTH_SDRAM_LO + 6)
#define HTTP_AUTH_CALC_NONCE	(HTTP_AUTH_SDRAM_LO + 7)
#define HTTP_AUTH_ACCOUNT		(HTTP_AUTH_SDRAM_LO + 8)
#define HTTP_AUTH_PASSWORD		(HTTP_AUTH_SDRAM_LO + 9)
#define HTTP_WWW_AUTH_RESP		(HTTP_AUTH_SDRAM_LO + 10)	//2 BLOCKS
#define HTTP_PROXY_AUTH_RESP	(HTTP_AUTH_SDRAM_LO + 12)	//2 BLOCKS

#define MODEM_FRAME_SDRAM_HI	0x01
#define MODEM_FRAME_SDRAM_LO	0xd8

#define PAGE128_SDRAM_HI		0x01
#define PAGE128_SDRAM_LO		0xf0
#define PAGE128_SDRAM_POS		0x01f0


//
// SDRAM_HI = 5
//

#define G711_SDRAM_LO			0x00	// G.711 PMIN code (G711.h)
#define CID_SDRAM_LO			0x10	// CID PMSWAP code

#define GSMENC_SDRAM_LO			0x30	// GSM 6.10 encode PMSWAP code (GSMENC.h)
#define GSMDEC_SDRAM_LO			0x40	// GSM 6.10 decode PMSWAP code (GSMDEC.h)
#define PCM_SDRAM_LO			0x50	// PCM (G.711 and G.721) PMSWAP code (PCM.h)
#define G711_CNG_SDRAM_LO		0x60
//#define G711_CNG_INIT_SDRAM_LO		0x70
#define G711_PLC_SDRAM_LO         0x70
#define GSM_SDRAM_LO			0x90	// GSM 6.10 PMIN code (GSM.h)

#define G711_CNG_DATA_SDRAM_LO		0x9a
#define GSM_DATA_SDRAM_LO		0xb8	// GSM 6.10 DMSWAP data (GSMDATA.h)
#define FILTER8K_DATA_SDRAM_LO	0xd0	// 8k Filter DMSWAP data (F8KDATA.h)
//#define FILTER16K_DATA_SDRAM_LO	0xd2	// 16k Filter DMSWAP data (F16KDATA.h)
#define DTMF_DATA_SDRAM_LO		0xd4	// DTMF DMSWAP data (DTMFDATA.h)
#define DTMFTONE_SDRAM_LO		0xe0	// DTMF tone PWSWAP code
#define USED_IN_DSP_BEGIN		0xf0
#define DTMFDEC_SARAM_LO		0xf0	// 0x9f000
#define NOTCH_DATA_SDRAM_LO		0xc1	// filter_coef.h 0x5c200
/*
#define G711_SDRAM_LO			0x00	// G.711 PMIN code (G711.h)
#define G721_SDRAM_LO			0x10	// G.721 PMIN code (G721.h)
#define G722_SDRAM_LO			0x20	// G.722 PMIN code (G722.h)
#define DTMFMAIN_SDRAM_LO		0x28	// DTMF Test PMIN code (dtmfmain.h)
//#define GSM_SDRAM_LO			0x30	// GSM 6.10 PMIN code (GSM.h)
//#define G711_G729_DEC3_SDRAM_LO	0x30
#define LPC_SDRAM_LO			0x40	// LPC 2.4k PMIN code (LPC_8k.h)

#define PCM_SDRAM_LO			0x50	// PCM (G.711 and G.721) PMSWAP code (PCM.h)
//#define SBADPCM_SDRAM_LO		0x60	// G.722 PMSWAP code (SBADPCM.h)
//#define GSMENC_SDRAM_LO			0x70	// GSM 6.10 encode PMSWAP code (GSMENC.h)
//#define GSMDEC_SDRAM_LO			0x80	// GSM 6.10 decode PMSWAP code (GSMDEC.h)
#define G711_CNG_SDRAM_LO		0x60
#define G711_CNG_INIT_SDRAM_LO		0x70
#define G711_CNG_DATA_SDRAM_LO		0x9a

#define DODLPC_SDRAM_LO			0x90	// LPC 2.4k PMSWAP code (DODLPC.h)
#define DTMF_SDRAM_LO			0xa0	// Filter and DTMF PMSWAP code (DTMF.h)

#define G721_DATA_SDRAM_LO		0xb0	// PCM (G.721) DMSWAP data (G721DATA.h)
#define G722_DATA_SDRAM_LO		0xb8	// G.722 DMSWAP data (G722DATA.h)
#define GSM_DATA_SDRAM_LO		0xc0	// GSM 6.10 DMSWAP data (GSMDATA.h)
#define LPC_DATA_SDRAM_LO		0xc8	// LPC 2.4k DMSWAP data (LPCDATA.h)
#define FILTER8K_DATA_SDRAM_LO	0xd0	// 8k Filter DMSWAP data (F8KDATA.h)
#define FILTER16K_DATA_SDRAM_LO	0xd2	// 16k Filter DMSWAP data (F16KDATA.h)
#define DTMF_DATA_SDRAM_LO		0xd4	// DTMF DMSWAP data (DTMFDATA.h)
*/
//
// SDRAM_HI = 0x08
//
#define	G723_SDRAM_LO			0x00

//
// SDRAM_HI = 0x0a
//
#define	G729_SDRAM_LO			0x00

// 
// SDRAM_HI = 0x15
//
#define iLBC_SDRAM_LO			0x00

//
// SDRAM_HI = 0x0f
//
#define MAP_SDRAM_LO		0x00
#define MAP_SDRAM_NO		128
#define MAP_ENTRY_LEN		32

//
// SDRAM_HI	= 0x19, used by strings loaded to sdram to reduce common bank code size
//
#define LOCAL_TYPE_SDRAM_LO		0		// 5
#define AUDIO_TYPE_SDRAM_LO		8		// 5
#define DUAL_MODE_SDRAM_LO		16		// 3
#define CALL_TYPE_SDRAM_LO		24		// 2
#define DIALPLAN_SDRAM_LO		32		// 4
//#define PROTOCOL_SDRAM_LO		40		// 4
#define UPGRADE_TYPE_SDRAM_LO	40
#define PROXY_SDRAM_LO			48		// 6
#define DTMF_TYPE_SDRAM_LO		64		// 4
#define SERVICE_TYPE_SDRAM_LO	72		// 16
#define DEBUG_LEVEL_SDRAM_LO	120		// 5
#define IP_TYPE_SDRAM_LO		128		// 4
#define INNER_LINE_SDRAM_LO		136		// 3
#define RING_TYPE_SDRAM_LO		144		// 12
#define TIME_ZONE_SDRAM_LO		160		// 74
#define SNTP_DNS_SDRAM_LO		240		// 2

//
// SDRAM_HI	= 0x1a, used by call record
//
#define CALL_RECORD_NUM			80

#define CALL_ANSWERED_LO		0
#define CALL_MISSED_LO			CALL_RECORD_NUM
#define CALL_DIALED_LO			(CALL_RECORD_NUM*2)

#define CALL_FIELD_NUMBER		0
#define CALL_FIELD_TYPE			33
#define CALL_FIELD_STIME		36
#define CALL_FIELD_DURATION		40
#define CALL_FIELD_NAME			44
#define CALL_RECORD_LEN			60
#define CALL_FIELD_DWORD		(CALL_RECORD_LEN/4)

#define CALL_TYPE_ANSWERED		0
#define CALL_TYPE_MISSED		1
#define CALL_TYPE_DIALED		2
#define CALL_TYPE_NONE			255

//
// SDRAM_HI = 0x1c
//
// H323 Data

#define H323_RECV_SDRAM_LO		0x20
#define H323_SEND_SDRAM_LO		0x24
#define H323_DATA_SDRAM_LO		0x28
#define H323_TEMP_SDRAM_LO		0x2c

#define	VIDASYS_DATA_SDRAM_LO	0x40
//specific for VIDASYS_DATA_SDRAM_LO
#define	CDR_DURATION_POS		0
#define	CDR_DURATION_LEN		32
#define	VIDA_BALANCE_POS		224
#define	MAX_BALANCE_LEN			16

#define	VIDADDA_RRQ_SDRAM_LO	0x41
#define	VIDADDA_ARQ_SDRAM_LO	0x42
#define	VIDADDA_COK_SDRAM_LO	0x43
#define	VIDACDR_RETRY_SDRAM_LO	0x48

#define POLYLINK_MAC_SDRAM_LO	0x50
#define SUNTEK_CRYPT_SDRAM_LO	0x51
#define INNOPATH_TUNNELID_SDRAM_LO	0x52

#define GK_ID_SDRAM_LO			0x60
#define ENDPOINT_ID_SDRAM_LO	0x61
#define CONF_ID_SDRAM_LO		0x62
#define CALL_ID_SDRAM_LO		0x63
#define PEER_H323ID_SDRAM_LO	0x64

#define BANDWIDTH_REQ_SDRAM_LO	0x6f	// Vida Proxy Server

#define H4502_NUMBER_SDRAM_LO	0x70

// H450 msg
#define HOLD_SDRAM_LO			0x78
#define CTINITIATE_SDRAM_LO		0x79
#define CTSETUP_SDRAM_LO		0x7a
#define RETURN_RESULT_SDRAM_LO	0x7b

// Characterful value for different audio type, which used in Decode Faststart
//#define FS_AUDIOCAP_LIST_SDRAM_LO	0x7c

// FastStart connect msg
#define FS_G729_CONNECT0_SDRAM_LO	0x80
#define FS_G7231_CONNECT0_SDRAM_LO	0x81
#define FS_G711U_CONNECT0_SDRAM_LO	0x82
#define FS_G711A_CONNECT0_SDRAM_LO	0x83
#define FS_GSM610_CONNECT0_SDRAM_LO	0x84
#define FS_ILBC_CONNECT0_SDRAM_LO	0x85
//#define FS_G729A_CONNECT0_SDRAM_LO	0x84
//#define FS_G729B_CONNECT0_SDRAM_LO	0x85
//#define FS_G729AB_CONNECT0_SDRAM_LO	0x86

#define FS_G729_CONNECT1_SDRAM_LO	0x88
#define FS_G7231_CONNECT1_SDRAM_LO	0x89
#define FS_G711U_CONNECT1_SDRAM_LO	0x8a
#define FS_G711A_CONNECT1_SDRAM_LO	0x8b
#define FS_GSM610_CONNECT1_SDRAM_LO	0x8c
#define FS_ILBC_CONNECT1_SDRAM_LO	0x8d
//#define FS_G729A_CONNECT1_SDRAM_LO	0x8c
//#define FS_G729B_CONNECT1_SDRAM_LO	0x8d
//#define FS_G729AB_CONNECT1_SDRAM_LO	0x8e

// FastStart setup msg
#define FS_G729_SETUP0_SDRAM_LO		0x90
#define FS_G7231_SETUP0_SDRAM_LO	0x91
#define FS_G711U_SETUP0_SDRAM_LO	0x92
#define FS_G711A_SETUP0_SDRAM_LO	0x93
#define FS_GSM610_SETUP0_SDRAM_LO	0x94
#define FS_ILBC_SETUP0_SDRAM_LO		0x95
//#define FS_G729A_SETUP0_SDRAM_LO	0x94
//#define FS_G729B_SETUP0_SDRAM_LO	0x95
//#define FS_G729AB_SETUP0_SDRAM_LO	0x96

// H235 msg
#define H235_MD5_GKREQ_SDRAM_LO		0x98
#define H235_CAT_GKREQ_SDRAM_LO		0x99
#define H235_SHA1_GKREQ_SDRAM_LO	0x9a
#define H235_MD5_REGREQ_SDRAM_LO	0x9b
#define H235_CAT_REGREQ_SDRAM_LO	0x9c
#define H235_SHA1_REGREQ_SDRAM_LO	0x9d
#define H235_GKREQ_SDRAM_LO			0x9e

// RAS msg
#define GK_REQ_SDRAM_LO			0xaa
#define REG_REQ_SDRAM_LO		0xa0
#define REG_ALIVE_SDRAM_LO		0xa2
#define UNREG_REQ_SDRAM_LO		0xa1
#define INFO_REQ_RESP_SDRAM_LO	0xa3
#define DISENGAGE_REQ_SDRAM_LO	0xa4
#define ADM_REQ_CALLEE_SDRAM_LO	0xa5
#define ADM_REQ_CALLER_SDRAM_LO	0xa6

// H245 msg
#define CAP_ACK_SDRAM_LO		0xb0
#define MSD_SDRAM_LO			0xb1
#define MSD_ACK_SDRAM_LO		0xb2
#define OLC_ACK_SDRAM_LO		0xb3
#define OLC_REJECT_SDRAM_LO		0xb4
#define ENDSESSION_SDRAM_LO		0xb5
#define RT_ACK_SDRAM_LO			0xb6
#define USER_INPUT_SDRAM_LO		0xb7
#define RT_REQ_SDRAM_LO			0xb8

#define CAP_G729_SDRAM_LO		0xc0
#define CAP_G7231_SDRAM_LO		0xc1
#define CAP_G711U_SDRAM_LO		0xc2
#define CAP_G711A_SDRAM_LO		0xc3
#define CAP_GSM610_SDRAM_LO		0xc4
#define CAP_ILBC_SDRAM_LO		0xc5
#define CAP_AUTO_SDRAM_LO		0xc6
//#define CAP_G729A_SDRAM_LO		0xc4
//#define CAP_G729B_SDRAM_LO		0xc5
//#define CAP_G729AB_SDRAM_LO		0xc6
//#define CAP_SDRAM_LO			0xc7
#define OLC_CLOSE_SDRAM_LO		0xc7

#define OLC_G729_SDRAM_LO		0xc8
#define OLC_G7231_SDRAM_LO		0xc9
#define OLC_G711U_SDRAM_LO		0xca
#define OLC_G711A_SDRAM_LO		0xcb
#define OLC_GSM610_SDRAM_LO		0xcc
#define OLC_ILBC_SDRAM_LO		0xcd
//#define OLC_G729A_SDRAM_LO		0xcc
//#define OLC_G729B_SDRAM_LO		0xcd
//#define OLC_G729AB_SDRAM_LO		0xce
#define FACILITY_STARTH245_SDRAM_LO 0xce
#define FACILITY_FORWARD_SDRAM_LO	0xcf

// q931 msg
#define ALERTING_SDRAM_LO			0xd0
#define ALERTING_NOH245_SDRAM_LO	0xd1
#define RELEASE_COMPLETE_SDRAM_LO	0xd2
#define CONNECT_SDRAM_LO			0xd3
#define CONNECT_NOH245_SDRAM_LO		0xd9
#define SETUP_SDRAM_LO				0xd4
#define INFO_SDRAM_LO				0xd5
#define STATUS_SDRAM_LO				0xd6
#define FACILITY_SDRAM_LO			0xd7
//#define TUNNEL_UI_SDRAM_LO			0xd8

// N2P data
#define N2P_TOKEN_BUF0			0x70

#define N2P_NAT_ID				0xa0
#define N2P_CALL_ID				0xa1


//
// SDRAM_HI	= 0x1c
//
//MGCP data
#define MGCP_RECV_FIRST_LINE	0x00
#define MGCP_RECV_SDRAM_LO		0x01
#define MGCP_ACCUM_EVENTS		0x02

#define MGCP_REQ_TRANS_NUM			8
#define MGCP_REQ_TRANS_SDRAM_LO		0x08  // 0x08-0x0f are transaction info
#define MGCP_REQ_TRANS_RETRANSMIT	0x10  // 0x10-0x1f 2 blocks for each transaction
#define MGCP_RESP_TRANS_NUM			16
#define MGCP_RESP_TRANS_SDRAM_LO	0x20  // 0x20-0x2f are transaction info
#define MGCP_RESP_TRANS_RETRANSMIT	0x30  // 0x30-0x4f 2 blocks for each transaction

#define MGCP_RECV_B_LO			0x50
#define MGCP_RECV_C_LO			0x51
#define MGCP_RECV_I_LO			0x52
#define MGCP_RECV_M_LO			0x53
#define MGCP_RECV_T_LO			0x54
#define MGCP_RECV_L_LO			0x55
#define MGCP_RECV_N_LO			0x56
#define MGCP_RECV_Q_LO			0x57
#define MGCP_RECV_E_LO			0x58
#define MGCP_RECV_R_LO			0x59
#define MGCP_RECV_F_LO			0x5a
#define MGCP_RECV_X_LO			0x5b
#define MGCP_RECV_K_LO			0x5c
#define MGCP_RECV_S_LO			0x5d
#define MGCP_RECV_RC_LO			0x5e
#define MGCP_RECV_D_LO			0x60 // 0x60-0x63

#define MGCP_RECV_SDP_LO		0x70
#define MGCP_MAX_RECV_SDP		32

#define MGCP_PARAM_B			0x90
#define MGCP_PARAM_C			0x91
#define MGCP_PARAM_A			0x92
#define MGCP_PARAM_I			0x93
#define MGCP_PARAM_M			0x94
#define MGCP_PARAM_P			0x95
#define MGCP_PARAM_T			0x96
#define MGCP_PARAM_ES			0x97
#define MGCP_PARAM_L			0x98
#define MGCP_PARAM_MD			0x99
#define MGCP_PARAM_N			0x9a
#define MGCP_PARAM_O			0x9b
#define MGCP_PARAM_PL			0x9c
#define MGCP_PARAM_Q			0x9d
#define MGCP_PARAM_E			0x9e
#define MGCP_PARAM_R			0x9f
#define MGCP_PARAM_F			0xa0
#define MGCP_PARAM_X			0xa1
#define MGCP_PARAM_K			0xa2
#define MGCP_PARAM_RD			0xa3
#define MGCP_PARAM_RM			0xa4
#define MGCP_PARAM_I2			0xa5
#define MGCP_PARAM_Z2			0xa6
#define MGCP_PARAM_S			0xa7
#define MGCP_PARAM_Z			0xa8
#define MGCP_PARAM_RC			0xa9
#define MGCP_PARAM_LC			0xaa
#define MGCP_PARAM_D			0xab // 0xab-0xaf
#define MGCP_PARAM_C_BACKUP		0xb0
#define MGCP_PARAM_I_BACKUP		0xb1

//
// SDRAM_HI	= 0x1b-0x1c, used by sip
//

#define SIP_MAX_TRANS_NUM	16
#define SIP_CT_INFO		0x00	// 0x00-0x0f are transaction info
#define SIP_CT_BRANCH	0x10	// 0x10-0x1f store via branch related to this transaction
#define SIP_ST_INFO		0x20	// 0x20-0x2f are transaction info
#define SIP_ST_BRANCH	0x30	// 0x30-0x3f store via branch related to this transaction

#define SIP_MAX_RX_NUM	16
#define SIP_RX_INFO		0x40
#define SIP_RX_BASE		0x50	// 0x50-0xaf store retransmission packets, 6 blocks for each packet

#define SIP_TRANS_BRANCH	0xb0

//SIP data, high = 0x11
#define SIP_RECV_BODY			0x00 // 0x00-0x1f	
#define SIP_MAX_BODY_LINE		32
#define SIP_RECV_VIA			0x20 // 0x20-0x27
#define SIP_MAX_RECV_VIA		8
#define SIP_RECV_CONTACT		0x28 
#define SIP_RECV_FROM			0x29
#define SIP_RECV_FROM_TAG		0x2a
#define SIP_RECV_TO				0x2b
#define SIP_RECV_TO_TAG			0x2c
#define SIP_RECV_CALL_ID		0x2d
#define SIP_RECV_CSEQ			0x2e
#define SIP_RECV_WWW_AUTHENTICATE		0x2F	
#define SIP_RECV_PROXY_AUTHENTICATE		0x30
#define SIP_RECV_REFER_TO		0x31
#define SIP_RECV_RECORD_ROUTE	0x32
#define SIP_RECV_REPLACES		0x33
#define SIP_RECV_MIN_EXPIRES	0x34
#define SIP_RECV_EXPIRES		0x35
#define SIP_RECV_REQUIRE		0x36
#define SIP_RECV_RACK			0x37
#define SIP_RECV_RSEQ			0x38
#define SIP_RECV_SUPPORTED		0x39
#define SIP_RECV_EVENT			0x3a
#define SIP_RECV_REQUEST_URI	0x3b
#define SIP_RECV_REFERRED_BY	0x3c
#define SIP_RECV_CONTENT_TYPE	0x3d

#define SIP_TEMP_BUF			0x40
#define SIP_TEMP_BUF2			0x41
#define SIP_CUR_BRANCH			0x42
#define SIP_REG_CALL_ID			0x43
#define SIP_REG_FROM_TAG		0x44
#define SIP_REG_LOCAL_URI		0x45
#define SIP_REG_REQUEST_URI		0x46
#define SIP_CUR_REFER_TO		0x47
#define SIP_REG_WWW_AUTH		0x4a
#define SIP_REG_PROXY_AUTH		0x4b

#define SIP_INV0_VIA		0x60
#define SIP_INV1_VIA		0x70
#define SIP_INV0_FROM		0x80
#define SIP_INV1_FROM		0x81
#define SIP_INV0_TO			0x82
#define SIP_INV1_TO			0x83
#define SIP_INV0_CALL_ID	0x84
#define SIP_INV1_CALL_ID	0x85
#define SIP_INV0_CSEQ		0x86
#define SIP_INV1_CSEQ		0x87

#define SIP_CALL_INFO_BASE0		0x90
#define SIP_CALL_INFO_BASE1		0xb0
#define SIP_CALL_CALL_ID		0
#define SIP_CALL_LOCAL_TAG		1
#define SIP_CALL_REMOTE_TAG		2
#define SIP_CALL_LOCAL_URI		3
#define SIP_CALL_REMOTE_URI		4
#define SIP_CALL_ROUTE_SET		5
#define SIP_CALL_ROUTE_HEADER	6
#define SIP_CALL_REQUEST_URI	7
#define SIP_CALL_INV_BRANCH		8
#define SIP_CALL_SDP_INFO		9
#define SIP_CALL_WWW_AUTH		10
#define SIP_CALL_PROXY_AUTH		11
#define SIP_CALL_100REL_INFO	12
#define SIP_CALL_REPLACES		0x9d
#define SIP_CALL_REFERRED_BY	0xbd
#define SIP_CALL_INFO_NUM		14


//
// SDRAM_HI	= 0x1c
//
//EPN data

#define EPN_RECV_SDRAM_LO	0	// 4 blocks
#define EPN_SEND_SDRAM_LO	4	// 4 blocks

//
// SDRAM_HI	= 0x1c
//
// IAX2 data

#define IAX2_FRAMEINFO_SDRAM_LO		0x00
#define IAX2_FRAMEDATA_SDRAM_LO		0x10	// 0x10 ~ 0x6f, 6 blocks for each packet
#define IAX2_FRAME_NUM		16

#define IAX2_IE_CHALLENGE_SDRAM_LO	0x70
