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; }
void DclPW_reg_usb(kal_bool ACT_Polarity, void (reg_hisr)(void)) { #if defined(__MAUI_BASIC__) || defined(PMIC_CHR_DETECT_NONE) return; #elif defined(__DRV_EXT_CHARGER_DETECTION__) if (ext_charger_det->support_usb_det() == KAL_TRUE) { ext_charger_det->reg_usb_hisr(reg_hisr); } else { #if !defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) EINT_Registration(g_usb_eint_no, KAL_TRUE, ACT_Polarity, reg_hisr, KAL_TRUE); #endif // #if !defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) } return; #elif defined(PMIC_PMIC_SERIES) #if defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) dcl_pmic6326_ChrDet_Registration(USB_CHR_CALLBACK, reg_hisr); #else // #if defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) EINT_Registration(g_usb_eint_no, KAL_TRUE, ACT_Polarity, reg_hisr, KAL_TRUE); #endif // #if !defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) #endif // #if defined(__MAUI_BASIC__) || defined(PMIC_CHR_DETECT_NONE) }
/************************************************************************* * FUNCTION * EXTRA_EINT_Registration * * DESCRIPTION * This function implements registration of external interrupts * * CALLS * * PARAMETERS * eintno - External interrupt vector number * ACT_Polarity - Interrupt polarity * reg_hisr - Registered hisr * auto_umask - A flag instruct the systerm to do unmask after * invoking the registered HISR * * RETURNS * No return * * GLOBALS AFFECTED * *************************************************************************/ void EXTRA_EINT_Registration(kal_uint8 eintno, kal_bool ACT_Polarity, void (reg_hisr)(void), \ kal_bool auto_umask) { ASSERT((eintno < EINT_TOTAL_CHANNEL) && (eintno >= EINT_MAX_CHANNEL)); EINT_Registration(eintno, KAL_FALSE, ACT_Polarity, reg_hisr, auto_umask); }
/************************************************************************* * FUNCTION * EXTRA_EINT_Registration * * DESCRIPTION * This function implements registration of external interrupts * * CALLS * * PARAMETERS * eintno - External interrupt vector number * ACT_Polarity - Interrupt polarity * reg_hisr - Registered hisr * auto_umask - A flag instruct the systerm to do unmask after * invoking the registered HISR * * RETURNS * No return * * GLOBALS AFFECTED * *************************************************************************/ void EXTRA_EINT_Registration(kal_uint8 eintno, kal_bool ACT_Polarity, void (reg_hisr)(void), \ kal_bool auto_umask) { ASSERT((eintno < EINT_TOTAL_CHANNEL) && EINT_CheckNotHWDebounce(eintno) ); EINT_Registration(eintno, KAL_FALSE, ACT_Polarity, reg_hisr, auto_umask); }
void EINT_Motion_Sensor_Registration() { if( gMotionSensor_EINT_NO1 !=EINT_CHANNEL_NOT_EXIST ) { DIRECTION_SENSOR_V_EINT_NO = gMotionSensor_EINT_NO1; }else{ DIRECTION_SENSOR_V_EINT_NO = MOTION_SENSOR_EINT_NO1; } if( gMotionSensor_EINT_NO2 !=EINT_CHANNEL_NOT_EXIST ) DIRECTION_SENSOR_H_EINT_NO = gMotionSensor_EINT_NO2; else DIRECTION_SENSOR_H_EINT_NO = MOTION_SENSOR_EINT_NO2; EINT_Registration(DIRECTION_SENSOR_H_EINT_NO,KAL_TRUE,direct_sensor_h_inturrupt_priority,Direct_Sensor_H_EINT_HISR, KAL_TRUE); EINT_Registration(DIRECTION_SENSOR_V_EINT_NO,KAL_TRUE,direct_sensor_v_inturrupt_priority,Direct_Sensor_V_EINT_HISR, 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 }
/****************************************************************************** * Function: * GPSLocateVibSensorInit * * Usage: * Init vibration sensor monitor * * Parameters: * None * * Return: * None ******************************************************************************/ void GPSLocateVibSensorInit(void) { #if 0 /* Configurate GPIO: input, pull-up/down disable */ GPIO_ModeSetup(GPS_VIBRATION_SENSOR_GPIO, 0); GPIO_InitIO(INPUT, GPS_VIBRATION_SENSOR_GPIO); GPIO_PullenSetup(GPS_VIBRATION_SENSOR_GPIO, KAL_FALSE); // config gpio 31 as above because of eint 1 is connect to gpio 31 as a temp solution #endif EINT_Set_HW_Debounce(GPS_VIBSENSOR_EINT_NO, 1); gbCurrentPolarity = KAL_FALSE; EINT_Registration(GPS_VIBSENSOR_EINT_NO, KAL_TRUE, gbCurrentPolarity, GPSLocateVibSensorHISR, KAL_TRUE ); //Mask this EINT after registration, unmask it before using it EINT_Mask(GPS_VIBSENSOR_EINT_NO); }
void Dcl_chr_det_reg_chr_usb(void) { #if defined(__MAUI_BASIC__) || defined(PMIC_CHR_DETECT_NONE) // In Basic load, we do NOT perform cable detection, just return return; #elif defined(__DRV_EXT_CHARGER_DETECTION__) #ifndef IC_MODULE_TEST // When module test, we don't want to perform cable detection (For saving module time) #if defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) #if defined(__USB_ENABLE__) ext_charger_det->reg_usb_hisr(chr_usb_det_mgr.usb_det_hisr); #endif // #if defined(__USB_ENABLE__) #endif // #if defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) ext_charger_det->reg_chr_hisr(CHRDET_HISR); ext_charger_det->set_chr_deb_time(40); ext_charger_det->enable_intr(); #endif // #ifndef IC_MODULE_TEST // When module test, we don't want to perform cable detection (For saving module time) return; // Return immediately here to avoid running to original PMU setting, which may make confusion #elif defined(PMIC_PMU_SERIES) #if !defined (__CHARGER_USB_DETECT_WIHT_ONE_EINT__) // Register gCHRDET_EINT_NO with CHRDET_HISR directly EINT_SW_Debounce_Modify(gCHRDET_EINT_NO, 40); // Set de-bounce time #if defined(PMIC_CHR_USB_DET_EINT_LEVEL_ACTIVE_HIGH) EINT_Registration(gCHRDET_EINT_NO, KAL_TRUE, LEVEL_HIGH, CHRDET_HISR, KAL_FALSE); #endif //defined(PMIC_CHR_USB_DET_EINT_LEVEL_ACTIVE_HIGH) #if defined(PMIC_CHR_USB_DET_EINT_LEVEL_ACTIVE_LOW) EINT_Registration(gCHRDET_EINT_NO, KAL_TRUE, LEVEL_LOW, CHRDET_HISR, KAL_FALSE); #endif //defined(PMIC_CHR_USB_DET_EINT_LEVEL_ACTIVE_LOW) #endif // #if !defined (__CHARGER_USB_DETECT_WIHT_ONE_EINT__) #if defined (__CHARGER_USB_DETECT_WIHT_ONE_EINT__) #ifndef IC_MODULE_TEST // When module test, we don't want to perform cable detection (For saving module time) EINT_SW_Debounce_Modify(chr_usb_detect.chr_usb_eint, 40); // Set de-bounce time #if defined(PMIC_CHR_USB_DET_EINT_LEVEL_ACTIVE_HIGH) EINT_Registration(chr_usb_detect.chr_usb_eint, KAL_TRUE, LEVEL_HIGH, CHR_USB_EINT_HISR, KAL_FALSE); #endif //defined(PMIC_CHR_USB_DET_EINT_LEVEL_ACTIVE_HIGH) #if defined(PMIC_CHR_USB_DET_EINT_LEVEL_ACTIVE_LOW) EINT_Registration(chr_usb_detect.chr_usb_eint, KAL_TRUE, LEVEL_LOW, CHR_USB_EINT_HISR, KAL_FALSE); #endif //defined(PMIC_CHR_USB_DET_EINT_LEVEL_ACTIVE_LOW) #endif // #ifndef IC_MODULE_TEST #endif // #if defined (__CHARGER_USB_DETECT_WIHT_ONE_EINT__) { #ifndef IC_MODULE_TEST // When module test, we don't want to perform cable detection (For saving module time) PMU_CTRL_CHR_GET_CHR_DET_STATUS chrStatus; DclPMU_Control(chrDet_PmuHandler, CHR_GET_CHR_DET_STATUS, (DCL_CTRL_DATA_T *)&chrStatus); if (chrStatus.enable==DCL_TRUE) { #if !defined (__CHARGER_USB_DETECT_WIHT_ONE_EINT__) CHRDET_HISR(); #else chr_usb_detect.chr_usb_state = KAL_FALSE; CHR_USB_EINT_HISR(); #endif //#if !defined (__CHARGER_USB_DETECT_WIHT_ONE_EINT__) } #endif } #elif defined(PMIC_PMIC_SERIES) /*PMIC uses charger's interrupt*/ #if defined(PMIC_6326_REG_API) #if !defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) // TTTTTTTTT dcl_pmic6326_ChrDet_Registration(AC_CHR, CHRDET_HISR); EINT_SW_Debounce_Modify(gCHRDET_EINT_NO, 40); /*lint -e64*/ EINT_Registration(gCHRDET_EINT_NO,KAL_TRUE,LEVEL_HIGH,dcl_pmic6326_HISR, KAL_FALSE); /*lint +e64*/ #endif // #if !defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) #if defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) dcl_pmic6326_ChrDet_Registration(AC_CHR_CALLBACK, CHR_USB_EINT_HISR); // PMIC6326 can only detect chr in, can NOT distinguish Charger or USB //if (pmic_is_chr_det(AC_CHR)){ // TTTTTTTTTTTTTTTTTTTTTTTTT chr_usb_detect.chr_usb_state = KAL_FALSE; // If we nsert USB cable and serviced the intr, then re-boot device // PMIC6326 won't assert intr because the cable status is NOT changed // Then we need to check the cable status at boot time // If cable is inserted, we manually call HISR to handle if (dcl_pmic6326_chrdet_status()){ //PMIC_CHRDET.pmic_ac_det(); dcl_pmic6326_HISR(); } EINT_SW_Debounce_Modify(chr_usb_detect.chr_usb_eint, 40); //EINT_SW_Debounce_Modify(chr_usb_detect.chr_usb_eint, gDebounceTime); /*lint -e64*/ EINT_Registration(chr_usb_detect.chr_usb_eint,KAL_TRUE,LEVEL_HIGH,dcl_pmic6326_HISR, KAL_FALSE); /*lint +e64*/ #endif // #if !defined(__CHARGER_USB_DETECT_WIHT_ONE_EINT__) #endif //defined(PMIC_6326_REG_API) #endif //#if defined(__MAUI_BASIC__) || defined(PMIC_CHR_DETECT_NONE) }