//called by drv_init_phase1
void Dcl_Chr_Det_reg_charger_usb_eint(void)
{

#if !defined (__CHARGER_USB_DETECT_WIHT_ONE_EINT__)
#if defined(PMIC_FIXED_CHR_EINT)
   gCHRDET_EINT_NO = PMIC_CHR_EINT_PIN;
#else
   gCHRDET_EINT_NO = custom_eint_get_channel(chrdet_eint_chann);
#endif

   #if defined(__USB_ENABLE__)
   gUSB_EINT_NO = custom_eint_get_channel(usb_eint_chann);
   #endif
#endif

#ifdef __CHARGER_USB_DETECT_WIHT_ONE_EINT__
#if defined(PMIC_FIXED_CHR_EINT)
   chr_usb_detect.chr_usb_eint = PMIC_CHR_EINT_PIN;
#else
   chr_usb_detect.chr_usb_eint = custom_eint_get_channel(chr_usb_eint_chann);
#endif
#if defined(PMIC_CHR_USB_DETECT_THROUGH_ADC)
{
   DCL_HANDLE adc_handle;
   ADC_CTRL_GET_PHYSICAL_CHANNEL_T adc_ch;

   adc_handle = DclSADC_Open(DCL_ADC, FLAGS_NONE);
   adc_ch.u2AdcName = DCL_CHR_USB_ADC_CHANNEL;
   DclSADC_Control(adc_handle, ADC_CMD_GET_CHANNEL, (DCL_CTRL_DATA_T *)&adc_ch);
   chr_usb_detect.chr_usb_adc = adc_ch.u1AdcPhyCh;
   chr_usb_detect.chr_usb_volt = bmt_get_chr_usb_detect_volt();
}
#endif   
#endif
}
kal_bool ctp_cypress_cy8ctma340_init(void)
{
	if(gpio_ctp_power_enable_pin != 0xFF)
		ctp_gpio_power_handle   = DclGPIO_Open(DCL_GPIO, gpio_ctp_power_enable_pin);

	if(gpio_ctp_eint_pin != 0xFF)
		ctp_gpio_eint_handle    = DclGPIO_Open(DCL_GPIO, gpio_ctp_eint_pin);

	if(gpio_ctp_reset_pin != 0xFF)
		ctp_gpio_reset_handle   = DclGPIO_Open(DCL_GPIO, gpio_ctp_reset_pin);

	if(gpio_ctp_i2c_sda_pin != 0xFF) //SW I2C
		ctp_i2c_configure(CTP_SLAVE_ADDR, CTP_DELAY_TIME);
	else //HW I2C
		ctp_i2c_configure(CTP_SLAVE_ADDR, CTP_HW_I2C_SPEED);
		
	ctp_cypress_cy8ctma340_power(KAL_TRUE);
	
	ctp_cypress_cy8ctma340_enter_system_mode();
	ctp_cypress_cy8ctma340_set_active_timeout(0xFF, 20); //20ms refresh period
	ctp_cypress_cy8ctma340_exit_system_mode();


	CTP_I2C_write_byte(HST_MODE_ADDR, HST_MODE_NORMAL); //normal operation mode
	
	EINT_Set_Sensitivity(custom_eint_get_channel(touch_panel_eint_chann), EDGE_SENSITIVE);
	
	return KAL_TRUE;
}
void Jogball_Init(void)
{
   /*****we will register the EINT interrupt callback functions****************************************/
   
   eint_chans_up=custom_eint_get_channel(jogball_up_eint_chann);
   EINT_Registration(eint_chans_up,KAL_FALSE,0,JogBall_UP_HISR, KAL_TRUE);	
   EINT_Set_Sensitivity(eint_chans_up, EDGE_SENSITIVE);/*******we should set the trigger by EDGE********/
   EINT_Set_Polarity(eint_chans_up, KAL_FALSE); //false -> 0, negative polarity   
   
   eint_chans_down=custom_eint_get_channel(jogball_down_eint_chann);
   EINT_Registration(eint_chans_down,KAL_FALSE,0,JogBall_DOWN_HISR, KAL_TRUE);
   EINT_Set_Sensitivity(eint_chans_down, EDGE_SENSITIVE);
   EINT_Set_Polarity(eint_chans_down, KAL_FALSE); //false -> 0, negative polarity
   
   eint_chans_left=custom_eint_get_channel(jogball_left_eint_chann);
   EINT_Registration(eint_chans_left,KAL_FALSE,0,JogBall_LEFT_HISR, KAL_TRUE);	
   EINT_Set_Sensitivity(eint_chans_left, EDGE_SENSITIVE);
   EINT_Set_Polarity(eint_chans_left, KAL_FALSE); //false -> 0, negative polarity
   
   eint_chans_right=custom_eint_get_channel(jogball_right_eint_chann);
   EINT_Registration(eint_chans_right,KAL_FALSE,0,JogBall_RIGHT_HISR, KAL_TRUE);
   EINT_Set_Sensitivity(eint_chans_right, EDGE_SENSITIVE);
   EINT_Set_Polarity(eint_chans_right, KAL_FALSE); //false -> 0, negative polarity
}