Esempio n. 1
0
void drv_idc_init_gpio(void)
{
	EINT_Mask(TDM_REQ_HI_EINT_NO); // disable TDM_REQ_HI interrupt
	EINT_Mask(TDM_REQ_LO_EINT_NO); // disable TDM_REQ_LO interrupt

	// Level trigger
	EINT_Set_Sensitivity(TDM_REQ_HI_EINT_NO, KAL_FALSE);
	EINT_Set_Sensitivity(TDM_REQ_LO_EINT_NO, KAL_FALSE);

	EINT_Set_HW_Debounce(TDM_REQ_HI_EINT_NO, 0);
	EINT_Set_HW_Debounce(TDM_REQ_LO_EINT_NO, 0);

#if !defined(ATEST_DRV_ENABLE)
	dhl_trace(TRACE_INFO, 0, IDC_TDM_INIT_MSG);
#else
	kal_sprintf(idc_dbg_str, "drv_idc: TDM_REQ Init\n\r");
	DT_IDC_PRINTF(idc_dbg_str);
#endif

	EINT_Registration_and_mask(TDM_REQ_HI_EINT_NO, KAL_TRUE, 1, TDM_REQ_HI_Entry, KAL_FALSE);
	EINT_Registration_and_mask(TDM_REQ_LO_EINT_NO, KAL_TRUE, 0, TDM_REQ_LO_Entry, KAL_FALSE);

	EINT_UnMask(TDM_REQ_HI_EINT_NO); // enable TDM_REQ_HI interrupt
	EINT_UnMask(TDM_REQ_LO_EINT_NO); // enable TDM_REQ_LO interrupt
	
	return;
}
PRAGMA_END_COMPILER_OPTIMIZE_TIME 
#endif
#endif

#if !defined(AST_HIF_HW_REG_EINT_BY_PROJECT)
AST_HIF_HW_RESULT ast_hif_hw_reg_eint(AST_HIF_HW_EINT_T* pEintParam)
{
    DCL_HANDLE gpio_handle;
    // register interrupt

    EINT_Set_Sensitivity(AST_EINT_NO, LEVEL_SENSITIVE);
    EINT_Set_Polarity(AST_EINT_NO, KAL_FALSE);
    EINT_Registration(AST_EINT_NO, KAL_FALSE, KAL_FALSE, pEintParam->fINTCB/*ast_hif_hw_eint_isr*/, KAL_TRUE);

    EINT_Set_Sensitivity(AST_WAKEUP_EINT_NO, EDGE_SENSITIVE);
    EINT_Set_Polarity(AST_WAKEUP_EINT_NO, KAL_TRUE);
    EINT_Registration(AST_WAKEUP_EINT_NO, KAL_FALSE, KAL_TRUE, pEintParam->fWakeUpCB, KAL_TRUE);

    EINT_Set_Sensitivity(AST_RFCONF_EINT_NO, LEVEL_SENSITIVE);
    EINT_Set_Polarity(AST_RFCONF_EINT_NO, KAL_TRUE);
	/* clear original debounce value */
	EINTaddr(AST_RFCONF_EINT_NO) &= ~EINT_CON_DEBOUNCE;
	/* set new debounce value */
	EINTaddr(AST_RFCONF_EINT_NO) |= (1 | EINT_CON_DEBOUNCE_EN);
    EINT_Registration(AST_RFCONF_EINT_NO, KAL_TRUE, KAL_TRUE, pEintParam->fRFConfCB, KAL_TRUE);
    return AST_HIF_HW_RESULT_OK;
}
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;
}
Esempio n. 4
0
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
}