예제 #1
0
/*******************************************************************************
* Function Name  : EXTI4_IRQHandler
* Description    : This function handles External interrupt Line 4 request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI4_IRQHandler(void)
{
  if(EXTI_GetITStatus(EXTI_Line4) != RESET){
    debugpins_isr_set();

    //leds_error_toggle();
    EXTI_ClearITPendingBit(EXTI_Line4);

    //RCC_Wakeup();
    radio_isr();

    debugpins_isr_clr();
  }
}
예제 #2
0
/*******************************************************************************
* Function Name  : EXTI15_10_IRQHandler
* Description    : This function handles External lines 15 to 10 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI15_10_IRQHandler(void)
{
    debugpins_isr_set();
    if(EXTI_GetITStatus(EXTI_Line10) != RESET)
    {
      //leds_sync_toggle();
      EXTI_ClearITPendingBit(EXTI_Line10);
      //call RCC wake up here as we cannot include rcc at radio.c 
      //as brakes compatibility with other boards using atmel radio
      RCC_Wakeup();
      radio_isr();
    }
    debugpins_isr_clr();
}
예제 #3
0
파일: board.c 프로젝트: Babody/openwsn-fw
/*
 * This function is only called when the radio isr is executed and the MCU 
 * is either RUNNING or in WAIT state. 
 * In case that the MCU is in deep sleep (LLS mode), the LLWU is handling the
 * interrupt and consequently this function is not being call. For some reason,
 * the LLWU interrupt, does not trigger this interrupt function. In contrast the
 * LPTMR ISR is invoked right after the LLWU_isr in case the timer wake's up the MCU. 
 * 
 * So if you are working in LLS mode, then check LLWU_isr function in llwu.c file.
 * 
 */
void radio_external_port_c_isr(void) {
	uint32_t portc;
	debugpins_isr_set();
	portc=PORTC_ISFR;
	
	if ((PORTC_ISFR) & (RADIO_ISR_MASK)) {
		
		PORTC_ISFR |= RADIO_ISR_MASK; //clear isr flag
		PORTC_PCR5 |= PORT_PCR_ISF_MASK;    //clear flag
		radio_isr();
		//leds_debug_toggle();
	}else{
		while(1);
		//radio_isr();
	}		   
	debugpins_isr_clr();
}
예제 #4
0
파일: llwu.c 프로젝트: Bug-bear/g_nf_vs_pdr
/*******************************************************************************
*
*   PROCEDURE NAME:
*       llwu_isr - Interrupt handler for LLWU
*       the commented code is kept as an example for future alternative wake up sources.
*
*******************************************************************************/
void llwu_isr(void)
{

debugpins_radio_set();

//   if (LLWU_F1 & LLWU_F1_WUF0_MASK) {
//       LLWU_F1 |= LLWU_F1_WUF0_MASK;   // write one to clear the flag -- UART RX flag
////       printf("\n[LLWU ISR]  ****WUF0 was set *****\r\n");
//   }
//   if (LLWU_F1 & LLWU_F1_WUF1_MASK) {
////       printf("\n [LLWU ISR] ****WUF1 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF2_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F1 & LLWU_F1_WUF2_MASK) {
////       printf("\n [LLWU ISR] ****WUF2 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF2_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F1 & LLWU_F1_WUF3_MASK){
////       printf("\n [LLWU ISR] ****WUF3 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF3_MASK;   // write one to clear the flag
//    }
//   if (LLWU_F1 & LLWU_F1_WUF4_MASK) {
// //      printf("\n [LLWU ISR] ****WUF4 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF4_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F1 & LLWU_F1_WUF5_MASK) {
////       printf("\n [LLWU ISR] ****WUF5 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF5_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F1 & LLWU_F1_WUF6_MASK) {
////       printf("\n [LLWU ISR] ****WUF6 was set *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF6_MASK;   // write one to clear the flag
//    }
//   if (LLWU_F1 & LLWU_F1_WUF7_MASK) {
////       printf("\n [LLWU ISR] ****WUF7 was set from PTC3 input  *****\r\n");
//       LLWU_F1 |= LLWU_F1_WUF7_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF8_MASK) {
// //      printf("\n [LLWU ISR] ****WUF8 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF8_MASK;   // write one to clear the flag
//   }
  if (LLWU_F2 & LLWU_F2_WUF9_MASK) {
       LLWU_F2 |= LLWU_F2_WUF9_MASK;   // write one to clear the flag -- radio isr (ptc5 external interrupt)
   	  // signal_irq(RADIO_EXTERNAL_PORT_IRQ_NUM);//activate nvic irq.
       radio_isr(); //instead of that, the isr of that port can be set in the NVIC and there handle the 
       //corresponding action after clearing the LLWU_F2 WUF9 flag. (hence not clearing it here)
  }
//   if (LLWU_F2 & LLWU_F2_WUF10_MASK) {
////       printf("\n [LLWU ISR] ****WUF10 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF10_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF11_MASK) {
// //      printf("\n [LLWU ISR] ****WUF11 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF11_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF12_MASK) {
////       printf("\n [LLWU ISR] ****WUF12 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF12_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF13_MASK) {
////       printf("[LLWU ISR] ****WUF13 was set *****\r\n");
//       LLWU_F2 |= LLWU_F2_WUF13_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F2 & LLWU_F2_WUF14_MASK) {
////       printf("[LLWU ISR] RTS\n");
//       SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK; // turn on port D ajj per alister
//       LLWU_F2 |= LLWU_F2_WUF14_MASK;   // write one to clear the flag
//       PORTD_PCR4 |= PORT_PCR_ISF_MASK  ;   //  clear Flag if there
//   }
//   if (LLWU_F2 & LLWU_F2_WUF15_MASK) {
////       printf("[LLWU ISR] UART0\n");
//       SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK; // turn on port D ajj per alister
//   //    ch = uart_getchar(UART0_BASE_PTR);
//     //  out_char(ch);
//       LLWU_F2 |= LLWU_F2_WUF15_MASK;   // write one to clear the flag
//       PORTD_PCR6  |= PORT_PCR_ISF_MASK  ;   //  clear Flag if there
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF0_MASK) {
////       printf("[LLWU ISR] LPT0\n");
////       LPTMR0_CSR |=  LPTMR_CSR_TCF_MASK;   // write 1 to TCF to clear the LPT timer compare flag
////       LPTMR0_CSR = ( LPTMR_CSR_TEN_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TCF_MASK  );
//       LLWU_F3 |= LLWU_F3_MWUF0_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF1_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF1 IF  CMP0  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF1_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF2_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF2 IF  CMP1 *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF2_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF3_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF3 IF CMP2/CMP3  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF3_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF4_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF4 IF TSI  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF4_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF5_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF5 IF RTC Alarm  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF5_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF6_MASK) {
////       printf("\n [LLWU ISR] ****WUF3_MWUF6 IF DryIce(Tamper Detect)  *****\r\n");
//       LLWU_F3 |= LLWU_F3_MWUF6_MASK;   // write one to clear the flag
//   }
//   if (LLWU_F3 & LLWU_F3_MWUF7_MASK) {
////       printf("[LLWU ISR] RTC\n");
//       LLWU_F3 |= LLWU_F3_MWUF7_MASK;   // write one to clear the flag
//   }
//
//   if(LLWU_FILT1 & LLWU_FILT1_FILTF_MASK){
//
//       LLWU_FILT1 |= LLWU_FILT1_FILTF_MASK;
//   }
//   if(LLWU_FILT2 & LLWU_FILT2_FILTF_MASK){
//
//       LLWU_FILT2 |= LLWU_FILT2_FILTF_MASK;
//   }
   
	   LLWU_F1 = 0xFF;            // clear wakeup flags
	   LLWU_F2 = 0xFF;            // clear wakeup flags
	   LLWU_F3 = 0xFF;            // clear wakeup flags
	
   debugpins_radio_clr();

}