// see version.txt for details
//
// general version config
//#define VER_PA168F			// 004T, slow
//#define VER_PA168FS			// 004T, fast
//#define VER_PA168P			// 008T, FXS one port GW, use AM79R70 as SLIC chip
//#define VER_PA168Q			// 008T, FXS one port GW, use AG1170 as SLIC chip
#define VER_PA168S			// 008T, fast
//#define VER_PA168T			// phone with MT28F016
//#define VER_PA168V			// 1-port fxs with MT28F016, with PSTN dual mode support
//#define VER_IPH_E00			// Vida - 008B flash
//#define VER_IPH_E00_4T		// Vida - 004T flash, slow
//#define VER_IPH_E00_8B_F		// Vida - 008B flash with fast flash programmer
//#define VER_IPH_E00_8B_NF		// Vida - 008B flash with fast flash programmer and new hardware
//#define VER_IPH_E00_2G		// Vida - 008B flash with fast flash programmer and new housing/hardware
//#define VER_UNISEN_D			// Unisen IP8008
//#define VER_YUXIN				// same as PA168F except F040 flash
//#define VER_TELEHIGH			// KaiYiTianQin's special case
//#define VER_PINGHE			// same as PA168F but uses eTalk as product ID
//#define VER_5111PHONE			// same as PA168S 
//#define VER_WG2201			// 29LV004T, fast TOGO Tech, 2201 phone
//#define VER_WG2202			// 29LV004T, fast TOGO Tech, 2202 phone
//#define VER_WG2203			// MT29F016, fast TOGO Tech, 2203 and 2501 phones
//#define VER_WG3051			// same as PA168V
//#define VER_YWH10				// same as PA168S except different keypad
//#define VER_YWH100			// same as PA168S except different keypad
//#define VER_YWH200			// same as PA168S except different keypad
//#define VER_YWH300			// same as PA168S except different keypad
//#define VER_YWH500			// same as PA168S except different keypad
//#define VER_COSUN				// same as PA168S except different keypad
//#define VER_KINGTEL			// same as PA168S except different keypad
//#define VER_EP668				// GW-EP668/A - same as PA168S
//#define VER_MAXLINK			// same as PA168S except different keypad
//#define VER_YODAO				// same as PA168S except 4-line display
//#define VER_WLINK				// same as PA168T
//#define VER_IPLINK			// same as PA168T, keypad same as 5111phone

// Protocols
//#define CALL_H323
#define CALL_SIP
//#define CALL_MGCP
//#define CALL_N2P
//#define CALL_WP
//#define CALL_IAX2
//#define CALL_EPN

// Country -- Web page, LCD display, IVR voice and DTMF tone
//		   -- All DTMF tone are completely valid
//			- Selections marked *** are completely valid - please use.
//          - Selections marked +++ are complete for IVR - please use.
//          - Selections marked ^^^ are mapped to closest accent - please use.
//          - Unmarked selections have not been done yet  - do not use
//          - according to http://www.iso.ch/iso/en/prods-services/iso3166ma/index.html
//#define RES_AR	// Argentina (Spanish) *** (web, lcd and ivr use Spain)
//#define RES_AU	// Australia (English) *** (web and lcd use English)
//#define RES_BE_F	// Belgium (Walloon French) *** (web, lcd and ivr use French)
//#define RES_BE_N	// Belgium (Flemish Dutch)
//#define RES_BG	// Bulgaria (English) ^^^
//#define RES_BR	// Brazil (Portuguese)	***
//#define RES_CA_E	// Canada (English) ^^^
//#define RES_CA_F	// Canada (French) *** (web, lcd and ivr use French)
//#define RES_CL	// Chile (Spanish) *** (web, lcd and ivr use Spain)
//#define RES_CN		// China (Mandarin) ***
//#define RES_CZ	// Czech Republic *** (ivr use English)
//#define RES_DE	// Germany ***
//#define RES_EG	// Egypt
//#define RES_ES	// Spain ***
//#define RES_ES_C	// Catalonian (Spain) *** (Dtmf Tone use Spain)
//#define RES_FR	// France ***
//#define RES_GB	// United Kingdom (English) ^^^
//#define RES_GR	// Greece
//#define RES_HK	// China HongKong ^^^
//#define RES_HU	// Hungary
//#define RES_IN	// India (Hindi)
//#define RES_IT	// Italy ***
//#define RES_JP	// Japan +++
//#define RES_KR	// Korea
//#define RES_LK	// Sri Lanka (Singhalese) +++
//#define RES_MX	// Mexico
//#define RES_NL	// Netherlands *** (ivr use English)
//#define RES_NO	// Norway
//#define RES_NZ_E	// New Zealand (English) +++ (ivr use Australia)
//#define RES_NZ_M	// New Zealand (Maori)
//#define RES_PL	// Poland	***
//#define RES_PT	// Portugal	***
//#define RES_RU	// Russia
//#define RES_SG	// Singapore
//#define RES_SK	// Slovakia +++
//#define RES_TW	// Taiwan, Province of China, use Traditional Chinese.
#define RES_US	// United States (English) ***
//#define RES_ZA_E	// South Africa (English) ^^^
//#define RES_ZA_N	// South Africa (Afrikaans Dutch)

// OEM defines
//#define OEM_263
//#define OEM_DLINK
//#define OEM_HUAWEI3COM
//#define OEM_IPN
//#define OEM_MEDIARING
//#define OEM_NET2PHONE
//#define OEM_NGTEL
//#define OEM_NONE_IVR
//#define OEM_POLYLINK
//#define OEM_RINGCHAT
//#define OEM_SKYCOM
//#define OEM_VIRTTEL
//#define OEM_SOYO_GROUP
//#define OEM_JR168

/*************************** End of automatic change, DO NOT CHANGE this line! */

// Flag languages where words are reversed e.g. "Adresse Locale" in French
#if defined RES_AR || defined RES_CA_F || defined RES_ES || defined RES_ES_C || defined RES_FR || defined RES_IT || defined RES_PT || defined RES_BR
#define IVR_REVERSED
#endif

#if defined VER_WLINK || defined VER_IPLINK
#define VER_PA168T
#endif

#if defined VER_WG3051
#define VER_PA168V
#endif

#if defined VER_PA168V
#define VER_PA168P
#endif

#if defined VER_WG2201 || defined VER_WG2202
#define VER_PA168FS
#define VER_WG2000
#endif

#if defined VER_WG2203
#define VER_PA168T
#define VER_WG2000
#endif

#if defined VER_5111PHONE || defined VER_PA168T || defined VER_COSUN || defined VER_YWH10 || defined VER_YWH100 || defined VER_PA168P || defined VER_PA168Q || defined VER_KINGTEL || defined VER_YWH200 || defined VER_YWH300 || defined VER_YWH500 || defined VER_EP668 || defined VER_YODAO || defined VER_MAXLINK
#define VER_PA168S
#endif

#if defined VER_IPH_E00_8B_F || defined VER_IPH_E00_8B_NF || defined VER_IPH_E00_2G || defined VER_IPH_E00_4T
#define VER_IPH_E00
#endif

#if defined VER_IPH_E00 || defined VER_YUXIN || defined VER_TELEHIGH || defined VER_PA168S || defined VER_PA168FS || defined VER_PINGHE || defined VER_UNISEN_D
#define VER_PA168F
#endif

#if defined VER_IPH_E00_8B_NF
#define	E00_NEW_HW
#endif

#ifdef VER_IPH_E00
#ifdef VER_IPH_E00_2G
#define KEY_TOTAL	24
#else
#define KEY_TOTAL	34
#endif
#define WOLFSON_MIXER
#define NEWUI			//NewUI for user settings
#endif

// camio config
#define BACKLIGHT_CTRL
#define LM386_CTRL
#ifndef VER_PA168T			// back light control changes after PA168T
#define INVERT_BACKLIGHT
#endif

// ac97 config
#define AC97_PIO_RESET_OR	0x20			// PIO 5
#define AC97_PIO_RESET_AND	0xdf
#define AC97_MIC_INPUT

// ethernet config
#define NE2000_PIO_RESET_OR		0x08		// PIO 3
#define NE2000_PIO_RESET_AND	0xf7

#define NE2000_PIO_INT_OR		0x02		// PIO 9
#define NE2000_PIO_INT_AND		0xfd

// modem config
#define HW_MODEM
#define MODEM_PIO_INT_OR		0x08		// PIO 11
#define MODEM_PIO_INT_AND		0xf7

// display config
#ifdef VER_YODAO
#define LCD_HY1604
#else
#define LCD_HY1602
#endif

#ifdef VER_IPH_E00
#ifdef VER_IPH_E00_2G
#define DISPLAY_MAX_CHAR	16
#else
#define DISPLAY_MAX_CHAR	24
#endif
#else
#define DISPLAY_MAX_CHAR	16
#endif  //VER_IPH_E00

// program flash config
#if defined VER_PA168F
#define AM29LV004T
#endif

// Handset config
#define _HANDSET_INVERT
#define HANDSET_OR_MASK		0x10		// PIO 4
#define HANDSET_AND_MASK	0xef

#ifdef VER_UNISEN_D
#undef VER_PA168F
#undef AC97_MIC_INPUT
#undef AM29LV004T
#define AM29F040
#endif

#ifdef VER_IPH_E00
#undef VER_PA168F
#undef AM29LV004T
#define AM29LV008B
#undef BACKLIGHT_CTRL
#undef _HANDSET_INVERT
#endif

#if defined VER_IPH_E00_8B_F || defined VER_IPH_E00_8B_NF || defined VER_IPH_E00_2G
#undef AM29LV008B
#define MX29LV008B		// 008B Flash with fast program mechanism
#endif

#if defined VER_IPH_E00_4T
#undef AM29LV008B
#define AM29LV004T
#endif

#ifdef VER_YUXIN
#undef VER_PA168F
#undef AM29LV004T
#define AM29F040
#endif

#ifdef VER_TELEHIGH
#undef VER_PA168F
#undef AM29LV004T
#define AM29F040
#undef _HANDSET_INVERT
#define _USE_RS232
#endif

#ifdef VER_PA168S
#undef VER_PA168F
#undef AM29LV004T
#define AM29LV008T
#endif

#ifdef VER_PA168FS
#undef VER_PA168F
#undef AM29LV004T
#define MX29LV004T
#endif

#ifdef VER_WG2201
#undef VER_PA168FS
#define TG_004T
#define IVR_M
//#define GUI_TG_LED
#endif

#ifdef VER_WG2202
#undef VER_PA168FS
#undef LCD_HY1602
#define LCD_GPM227A0
#define TG_004T
#define IVR_M
//#define GUI_TG_LED
#endif

#ifdef VER_PINGHE
#undef VER_PA168F
#endif

#ifdef VER_5111PHONE
#undef VER_PA168S
#endif

#ifdef VER_PA168P
#undef VER_PA168S
#undef _HANDSET_INVERT
#define _USE_FXS_AM79R70
//#define _USE_FAKE_FXO
#endif

#ifdef VER_WG3051
#define _HANDSET_INVERT
#endif

#ifdef VER_PA168Q
#undef VER_PA168S
//#undef AC97_MIC_INPUT
#define _USE_FXS_AG1170
#endif

#ifdef VER_PA168T
#undef VER_PA168S
#undef AM29LV008T
#define MT28F016
#endif

#ifdef VER_WG2203
#undef VER_PA168T
#undef LCD_HY1602
#define LCD_GPM227A0
#define TG_016T
#define IVR_M
#define GUI_TG_LED
#endif

#ifdef VER_PA168V
#undef VER_PA168P
#undef AM29LV008T
#define MT28F016
#define _USE_FAKE_FXO
#endif

// led usage
#if defined _USE_FAKE_FXO && defined OEM_HUAWEI3COM
#undef HW_MODEM
#define	KEYPAD_LIGHT	0x40	// All these lights value is invalid for Led_On, Led_Off and Led_Blink function
#define	NORMAL_LIGHT	0x40	// By this way, we could let PA168V do not light LED as usual way.
#define	SECOND_LIGHT	0x40
#define SERVICE_LIGHT	8		// Give these PIO new name, specially for HUAWEI3COM
#define	IP_LIGHT		7
#define	PSTN_LIGHT		10
#elif defined GUI_TG_LED
#define	NORMAL_LIGHT	0xff
#define SECOND_LIGHT	0xff
#define	KEYPAD_LIGHT	26
#define MISSED_CALL_LIGHT	7
#define RING_DND_LIGHT	8
#else
#define	NORMAL_LIGHT	8
#define SECOND_LIGHT	7
#if defined VER_IPH_E00 || defined VER_PA168Q || defined VER_PA168P || defined VER_PA168V
#define	KEYPAD_LIGHT	10
#else
#define	KEYPAD_LIGHT	26
#endif
#ifdef VER_IPH_E00
// below E00 type, PIO15 is used as flash Busy/Ready indicator
#if defined VER_IPH_E00_8B_F || defined VER_IPH_E00_8B_NF
#define	SPK_LIGHT		12
#define	MUTE_LIGHT		14
#else	// VER_IPH_E00_8B_F || VER_IPH_E00_8B_NF
#define	SPK_LIGHT		15
#define	MUTE_LIGHT		14
#endif	// VER_IPH_E00_8B_F || VER_IPH_E00_8B_NF
#endif	// VER_IPH_E00
#endif

#define AUTO_PROVISIONING

#if defined OEM_HUAWEI3COM || defined OEM_VIRTTEL
#define GUI_WEB
#else
#define GUI_HTTP
#endif

#define GUI_STANDARD

#if defined CALL_H323 || defined CALL_SIP || defined CALL_MGCP || defined CALL_EPN
#define GUI_RTP
#endif

#ifdef CALL_H323
#define SYS_RINGTEC
#define SYS_CITRON
#define SYS_ASIAINFO
#define SYS_AUVTECH
#define SYS_YIYANG
#define SYS_TXTC
#endif

// dialmap, upgrade ring
#if defined AM29LV004T || defined AM29LV008T || defined MX29LV004T || defined MT28F016 || defined MX29LV008B
#define GUI_UPGRADE_RING
#endif

#if defined VER_PINGHE || defined VER_5111PHONE || defined VER_IPLINK
#define GUI_5111
#endif

#ifdef VER_IPH_E00
#undef GUI_STANDARD
#undef SYS_RINGTEC
#undef SYS_ASIAINFO
#undef SYS_AUVTECH
#undef SYS_YIYANG
#undef SYS_TXTC
#endif

// Gateway Configuration

#ifdef _USE_FAKE_FXO
#define OFFHOOK_OR_MASK		0x08		// PIO11
#define OFFHOOK_AND_MASK	0xf7
#define RINGIN_OR_MASK		0x10		// PIO12
#define RINGIN_AND_MASK		0xef
#endif

#ifdef _USE_FXS_AM79R70
#define _USE_FXS
#define SLIC_CTRL_OR_MASK	0x07		// PIO0, PIO1, PIO2
#define SLIC_CTRL_AND_MASK	0xf8
/*
#define DTMF_CODE_OR_MASK	0x0f		// KEYPADIO0 ~ KEYPADIO3
#define DTMF_CODE_AND_MASK	0xf0
#define DTMFDET_OR_MASK		0x10		// KEYPADIO4
#define DTMFDET_AND_MASK	0xef
*/
#endif

#ifdef _USE_FXS_AG1170
#define _USE_FXS
#define SLIC_RING_OR_MASK	0x40
#define SLIC_RING_AND_MASK	0xbf
#define SLIC_FWD_OR_MASK	0x20
#define SLIC_FWD_AND_MASK	0xdf
#endif

#if defined AM29LV002T || defined AM29F040 || defined AM29LV004T || defined MX29LV004T || defined AM29LV008B
#undef AUTO_PROVISIONING
#undef SYS_RINGTEC
#undef SYS_ASIAINFO
#undef SYS_YIYANG
#undef SYS_TXTC
#undef HW_MODEM
#endif

#if defined OEM_SOYO_GROUP || defined OEM_NET2PHONE
#undef HW_MODEM
#endif

/*############################ Begin of automatic find software version, DO NOT CHANGE this line! */

#define SOFT_VER_HIGH		1
#define SOFT_VER_LOW		6
#define SOFT_VER_BUILD		4
#define ENG_BUILD_HIGH		0
#define ENG_BUILD_MID		0
#define ENG_BUILD_LOW		0
