Пример #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;
}
Пример #2
0
/*************************************************************************
* FUNCTION
*   EINT_LISR
*
* DESCRIPTION
*   Entry function of External Interrupt Service Routine
*
* CALLS
*
* PARAMETERS
*
* RETURNS
*  No return
*
* GLOBALS AFFECTE
*
*************************************************************************/
void EINT_LISR(void)
{
   kal_uint8 index;
   kal_uint16 status;

   status = *EINT_STATUS;

   // for conventional external interrupt!
   for(index=0;index<EINT_MAX_CHANNEL;index++)
   {
      if (status & EINT_STATUS_EINT(index)) 
      {
         GPTI_StopItem(eint_sw_debounce[index].eint_sw_debounce_handle);
         if ( (eint_sw_debounce[index].eint_intr_allow == KAL_FALSE) && 
              (eint_sw_debounce_time_delay[index] > 0) 
            )
         {
            GPTI_StartItem(eint_sw_debounce[index].eint_sw_debounce_handle,
                  eint_sw_debounce_time_delay[index],
                  EINT_TIMER_CALLBACK,
                  &eint_sw_debounce[index]);
            EINT_Mask(index);
         }
         else
         {
            eint_sw_debounce[index].eint_intr_allow = KAL_FALSE;
            // disable interrupt
            EINT_Mask(index);
            ASSERT(EINT_FUNC.eint_func[index]!=NULL);
            if ( EINT_FUNC.eint_func[index] )
            {
               EINT_FUNC.eint_active[index] = KAL_TRUE;

               drv_active_hisr(DRV_EINT_HISR_ID);
            }
         }
         *EINT_INTACK = EINT_INTACK_EINT(index);
      }
   }
   
   // for external interrupt without hardware debounce and always edge sensitive
   for (index=EINT_MAX_CHANNEL; index<EINT_TOTAL_CHANNEL; index++)
   {
   	if (status & EINT_STATUS_EINT(index)) 
   	{
         EINT_Mask(index);
         ASSERT(EINT_FUNC.eint_func[index]!=NULL);
         if ( EINT_FUNC.eint_func[index] )
         { 
            EINT_FUNC.eint_active[index] = KAL_TRUE;

            drv_active_hisr(DRV_EINT_HISR_ID);
         }
         *EINT_INTACK = EINT_INTACK_EINT(index);
      }
   }
}
Пример #3
0
void DEINT_Process(kal_uint8 deintno)
{
	kal_uint8 eintno;

	eintno = gpio_get_l1_eint_src(deintno);

	if ( EINT_CheckHWDebounce(eintno) )
	{
	  if(eint_sw_debounce[eintno].eint_sw_debounce_handle != 0x7f)
	  {
	     DclSGPT_Control(eint_sw_debounce[eintno].eint_sw_debounce_handle,SGPT_CMD_STOP,0);
	     DclSGPT_Close(&(eint_sw_debounce[eintno].eint_sw_debounce_handle));
	  }
	  if ( (eint_sw_debounce[eintno].eint_intr_allow == KAL_FALSE) && 
	       (eint_sw_debounce_time_delay[eintno] > 0) 
	     )
	  {
	     SGPT_CTRL_START_T start;
		 //EINT_PRINT("\tDEINT start timer, eint_sw_debounce_time_delay[index] = %d",eint_sw_debounce_time_delay[deintno]);
	     eint_sw_debounce[eintno].eint_sw_debounce_handle=DclSGPT_Open(DCL_GPT_CB,0);

	     start.u2Tick=eint_sw_debounce_time_delay[eintno];
	     start.pfCallback=DEINT_TIMER_CALLBACK;
	     start.vPara=&eint_sw_debounce[eintno];
	     DclSGPT_Control(eint_sw_debounce[eintno].eint_sw_debounce_handle,SGPT_CMD_START,(DCL_CTRL_DATA_T*)&start);

	     EINT_Mask(eintno);
	  }
	  else
	  {
	     eint_sw_debounce[eintno].eint_intr_allow = KAL_FALSE;
	     // disable interrupt
	     //EINT_PRINT("\tDEINT trigger HISR");
	     EINT_Mask(eintno);
	     ASSERT(EINT_FUNC.eint_func[eintno]!=NULL);
	     if ( EINT_FUNC.eint_func[eintno] )
	     {
	        EINT_FUNC.eint_active[eintno] = KAL_TRUE;

	        drv_active_hisr(DRV_DEINT_HISR_ID);
	     }
	  }
	}
	else
	{
	    EINT_Mask(eintno);
	    ASSERT(EINT_FUNC.eint_func[eintno]!=NULL);
	    if ( EINT_FUNC.eint_func[eintno] )
	    { 
	       EINT_FUNC.eint_active[eintno] = KAL_TRUE;

	       drv_active_hisr(DRV_DEINT_HISR_ID);
	    }
	}
}
Пример #4
0
/*************************************************************************
* FUNCTION
*  EINT_TIMER_CALLBACK
*
* DESCRIPTION
*   This function implements main external interrupt LISR registered in
*  global ISR jump table.
*
* CALLS
*
* PARAMETERS
*
* RETURNS
*  No return
*
* GLOBALS AFFECTED
*
*************************************************************************/
void DEINT_TIMER_CALLBACK(void *data)
{
   EINT_SW_DEBOUNCE_STRUCT *sw_debounce = (EINT_SW_DEBOUNCE_STRUCT *)data;

   EINT_Mask(sw_debounce->eint_no);

   if(sw_debounce->eint_sw_debounce_handle != 0x7f)
   {
      DclSGPT_Control(sw_debounce->eint_sw_debounce_handle,SGPT_CMD_STOP,0);
      DclSGPT_Close(&(sw_debounce->eint_sw_debounce_handle));
   }

   sw_debounce->eint_intr_allow = (sw_debounce->eint_intr_allow == KAL_TRUE)? KAL_FALSE: KAL_TRUE;

   /*
    * This timer is to avoid if interrupt status is changed but 
    * sw_debounce->eint_intr_allow is still in KAL_TRUE state
    * because of no interrupt
    */
   if (sw_debounce->eint_intr_allow) 
   {
      SGPT_CTRL_START_T start;

      start.u2Tick= eint_sw_debounce_time_delay[sw_debounce->eint_no];

      start.pfCallback=DEINT_TIMER_CALLBACK;
      start.vPara=data;
      sw_debounce->eint_sw_debounce_handle=DclSGPT_Open(DCL_GPT_CB,0);
      DclSGPT_Control(sw_debounce->eint_sw_debounce_handle,SGPT_CMD_START,(DCL_CTRL_DATA_T*)&start);
   }
   EINT_UnMask(sw_debounce->eint_no);
}
Пример #5
0
/******************************************************************************
* Function:
*	GPSLocateVibSensorStop
*
* Usage:
*	Stop vibration sensor monitor
*
* Parameters:
*	None
*
* Return:
*	None
******************************************************************************/
void GPSLocateVibSensorStop(void)
{
	if (gGPSVibSensorStart == KAL_FALSE) return;
	gGPSVibSensorStart = KAL_FALSE;
	//Mask this EINT to stop detecting the vibration sensor status
	EINT_Mask(GPS_VIBSENSOR_EINT_NO);

	if (gGPSVibSensorTimer != NULL)
	{
		GPSAppTimer_Stop(gGPSVibSensorTimer, KAL_TRUE);
		gGPSVibSensorTimer = NULL;
	}
}
Пример #6
0
/****************************************************************************
 * FUNCTION
 *  JogBall_RIGHT_HISR
 * DESCRIPTION
 *  Register the call back functions
 *  
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void JogBall_RIGHT_HISR(void)
{		
   EINT_Mask(eint_chans_right);
   if(JBXY == KEY_RIGHT_EVENT)
   {
      kbd_SendKey(DEVICE_KEY_RIGHT);
      JBXY=KEY_DIRECTION_EVENT_NUll;
   }
   else
   {
      JBXY=KEY_RIGHT_EVENT;
   }
   EINT_UnMask(eint_chans_right);	 
}
Пример #7
0
void JogBall_DOWN_HISR(void)
{		
   EINT_Mask(eint_chans_down);		 
   if(JBXY == KEY_DOWN_EVENT)
   {
        kbd_SendKey(DEVICE_KEY_DOWN);
        JBXY=KEY_DIRECTION_EVENT_NUll;
   }
   else
   {
      JBXY=KEY_DOWN_EVENT;
   }
   EINT_UnMask(eint_chans_down);
}
Пример #8
0
/*************************************************************************
* FUNCTION
*  EINT_SaveAndMask
*
* DESCRIPTION
*  This function saves and masks the specified external interrupt
*
* PARAMETERS
*  eintno   -   external interrupt vector number
*
* RETURNS
*  original mask
*
*************************************************************************/
kal_uint32 EINT_SaveAndMask(kal_uint8 eintno)
{
   kal_uint32 savedMask, eint_mask;


   /* lockout interrupt */
   savedMask = SaveAndSetIRQMask();

   /* save EINT mask */
   eint_mask = EINT_Get_Mask_Bits();

   /* mask EINT */
   EINT_Mask(eintno);

   /* clear unnecessary bits */
   eint_mask = eint_mask & (0x0001 << eintno);

   /* un-lockout interrupt */
   RestoreIRQMask(savedMask);

   return eint_mask;
}
Пример #9
0
/******************************************************************************
* 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);
}
Пример #10
0
/*************************************************************************
* FUNCTION
*   EINT_LISR
*
* DESCRIPTION
*   Entry function of External Interrupt Service Routine
*
* CALLS
*
* PARAMETERS
*
* RETURNS
*  No return
*
* GLOBALS AFFECTE
*
*************************************************************************/
void EINT_LISR(void)
{
   kal_uint8 index;
   kal_uint32 status,mask_bits;

   status = EINT_L2_STA();
   
   if (EINT_Internal_LISR_Handler(&status))
   {
      return;
   }

   // for conventional external interrupt!
   for(index=0;index<EINT_TOTAL_CHANNEL;index++)
   {
   	  //EINT_PRINT("\tEINT triggered!");
      if ( EINT_CheckHWDebounce(index) )
      {
      	 mask_bits = EINT_Get_Mask_Bits();
         if (status & EINT_STATUS_EINT(index) && !BU_G_BIT(mask_bits, index)) 
         {
            if(eint_sw_debounce[index].eint_sw_debounce_handle != 0x7f)
            {
               DclSGPT_Control(eint_sw_debounce[index].eint_sw_debounce_handle,SGPT_CMD_STOP,0);
               DclSGPT_Close(&(eint_sw_debounce[index].eint_sw_debounce_handle));
            }
            if ( (eint_sw_debounce[index].eint_intr_allow == KAL_FALSE) && 
                 (eint_sw_debounce_time_delay[index] > 0) 
               )
            {
               SGPT_CTRL_START_T start;
			   //EINT_PRINT("\tstart timer, eint_sw_debounce_time_delay[%d] = %d",index,eint_sw_debounce_time_delay[index]);
               eint_sw_debounce[index].eint_sw_debounce_handle=DclSGPT_Open(DCL_GPT_CB,0);

               start.u2Tick=eint_sw_debounce_time_delay[index];
               start.pfCallback=EINT_TIMER_CALLBACK;
               start.vPara=&eint_sw_debounce[index];
               DclSGPT_Control(eint_sw_debounce[index].eint_sw_debounce_handle,SGPT_CMD_START,(DCL_CTRL_DATA_T*)&start);

               EINT_Mask(index);
            }
            else
            {
               eint_sw_debounce[index].eint_intr_allow = KAL_FALSE;
               // disable interrupt
               EINT_Mask(index);
                //EINT_PRINT("\tEINT trigger HISR");
               ASSERT(EINT_FUNC.eint_func[index]!=NULL);
               if ( EINT_FUNC.eint_func[index] )
               {
                  EINT_FUNC.eint_active[index] = KAL_TRUE;

                  drv_active_hisr(DRV_EINT_HISR_ID);
               }
            }
            EINT_L2_ACK(index);
         }
      }
      else
      {
	     mask_bits = EINT_Get_Mask_Bits();
         if (status & EINT_STATUS_EINT(index)  && !BU_G_BIT(mask_bits, index)) 
         {
            EINT_Mask(index);
            ASSERT(EINT_FUNC.eint_func[index]!=NULL);
            if ( EINT_FUNC.eint_func[index] )
            { 
               EINT_FUNC.eint_active[index] = KAL_TRUE;

               drv_active_hisr(DRV_EINT_HISR_ID);
            }
            EINT_L2_ACK(index);
         }
      }
   }
}