Exemple #1
0
void
mcf523xfec_rx_irq( void )
{
    static portBASE_TYPE xNeedSwitch = pdFALSE;

    /* Workaround GCC if frame pointers are enabled. This is an ISR and
     * we must not modify the stack before portENTER_SWITCHING_ISR( )
     * has been called. */
#if _GCC_USES_FP == 1
    asm volatile    ( "unlk %fp\n\t" );
#endif

    /* This ISR can cause a context switch, so the first statement must be
     * a call to the portENTER_SWITCHING_ISR() macro.
     */
    portENTER_SWITCHING_ISR(  );

    /* Set Debug PIN to high to measure RX latency. */
    FEC_DEBUG_RX_TIMING( 1 );

    /* Clear FEC RX Event from the Event Register (by writing 1) */
    if( MCF_FEC_EIR & ( MCF_FEC_EIR_RXB | MCF_FEC_EIR_RXF ) )
    {
        /* Clear interrupt from EIR register immediately */
        MCF_FEC_EIR = ( MCF_FEC_EIR_RXB | MCF_FEC_EIR_RXF );
        xNeedSwitch = xSemaphoreGiveFromISR( fecif_g->rx_sem, pdFALSE );
    }
    portEXIT_SWITCHING_ISR( xNeedSwitch );
}
Exemple #2
0
void vCOM_1_Rx_ISR( void )
{
	/* This can cause a context switch so this macro must be the first line
	in the function. */
	portENTER_SWITCHING_ISR();

	/* As this is a switching ISR the local variables must be declared as 
	static. */
	static char cRxByte;
	static portBASE_TYPE xHigherPriorityTaskWoken;

		xHigherPriorityTaskWoken = pdFALSE;

		/* Get the character. */
		cRxByte = RDR1;

		/* Post the character onto the queue of received characters - noting
		whether or not this wakes a task. */
		xQueueSendFromISR( xRxedChars, &cRxByte, &xHigherPriorityTaskWoken );

		/* Clear the interrupt. */
		SSR1 &= ~serRX_INTERRUPT;

	/* This must be the last line in the function.  We pass cTaskWokenByPost so 
	a context switch will occur if the received character woke a task that has
	a priority higher than the task we interrupted. */
	portEXIT_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
void
prvvMBSerialIRQHandler( void )
{
    portENTER_SWITCHING_ISR(  );

    static BOOL     xTaskWokenReceive = FALSE;
    static BOOL     xTaskWokenTransmit = FALSE;
    static USHORT   usStatus;

    usStatus = UART_FlagStatus( MB_UART_DEV );

    if( prvMBPortTXIsEnabled(  ) && ( usStatus & UART_TxHalfEmpty ) )
    {
        xTaskWokenReceive = pxMBFrameCBTransmitterEmpty(  );
    }
    if( prvMBPortRXIsEnabled(  ) && ( usStatus & UART_RxBufFull ) )
    {
        xTaskWokenReceive = pxMBFrameCBByteReceived(  );
    }

    /* End the interrupt in the EIC. */
    EIC->IPR |= 1 << EIC_CurrentIRQChannelValue(  );

    portEXIT_SWITCHING_ISR( ( xTaskWokenReceive
                              || xTaskWokenTransmit ) ? pdTRUE : pdFALSE );
}
Exemple #4
0
void vpushb_ISR( void )
{
 /* This ISR can cause a context switch, so the first statement must be a
     call to the portENTER_SWITCHING_ISR() macro.  This must be BEFORE any
     variable declarations. */
  portENTER_SWITCHING_ISR();

  prvpushb_ISR_NonNakedBehaviour();

  portEXIT_SWITCHING_ISR();
}
Exemple #5
0
void vUART_ISR( void )
{
	/* This ISR can cause a context switch, so the first statement must be a
	call to the portENTER_SWITCHING_ISR() macro.  This must be BEFORE any
	variable declarations. */
	portENTER_SWITCHING_ISR();

	/* Now we can declare the local variables. */
	signed portCHAR cChar;
	portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByRx = pdFALSE;

	/* What caused the interrupt? */
	switch( UART0_IIR & serINTERRUPT_SOURCE_MASK )
	{
		case serSOURCE_ERROR :	/* Not handling this, but clear the interrupt. */
								cChar = UART0_LSR;
								break;

		case serSOURCE_THRE	:	/* The THRE is empty.  If there is another
								character in the Tx queue, send it now. */
								if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xTaskWokenByTx ) == pdTRUE )
								{
									UART0_THR = cChar;
								}
								else
								{
									/* There are no further characters 
									queued to send so we can indicate 
									that the THRE is available. */
									lTHREEmpty = pdTRUE;
								}
								break;

		case serSOURCE_RX_TIMEOUT :
		case serSOURCE_RX	:	/* A character was received.  Place it in 
								the queue of received characters. */
								cChar = UART0_RBR;
								if( xQueueSendFromISR( xRxedChars, &cChar, ( portBASE_TYPE ) pdFALSE ) ) 
								{
									xTaskWokenByRx = pdTRUE;
								}
								break;

		default				:	/* There is nothing to do, leave the ISR. */
								break;
	}

	/* Clear the ISR in the VIC. */
	VICVectAddr = serCLEAR_VIC_INTERRUPT;

	/* Exit the ISR.  If a task was woken by either a character being received
	or transmitted then a context switch will occur. */
	portEXIT_SWITCHING_ISR( ( xTaskWokenByTx || xTaskWokenByRx ) );
}
Exemple #6
0
static void vUSART0_ISR( void )
{

 /* This ISR can cause a context switch, so the first statement must be a
  call to the portENTER_SWITCHING_ISR() macro.  This must be BEFORE any
  variable declarations. */
  portENTER_SWITCHING_ISR();
  prvUSART0_ISR_NonNakedBehaviour();
 /* Exit the ISR.  If a task was woken by either a character being received
  or transmitted then a context switch will occur. */
  portEXIT_SWITCHING_ISR();
}
Exemple #7
0
void vUART_ISR( void )
{
	/* This ISR can cause a context switch, so the first statement must be a
	call to the portENTER_SWITCHING_ISR() macro.  This must be BEFORE any
	variable declarations. */
	portENTER_SWITCHING_ISR();

	/* Now we can declare the local variables. */
	signed portCHAR cChar;
	portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByRx = pdFALSE;
	unsigned portLONG ulStatus;

	/* What caused the interrupt? */
	ulStatus = AT91C_BASE_US0->US_CSR & AT91C_BASE_US0->US_IMR;

	if (ulStatus & US_TXRDY)
	{
		/* The interrupt was caused by the THR becoming empty.  Are there any
		more characters to transmit? */
		if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xTaskWokenByTx ) == pdTRUE )
		{
			/* A character was retrieved from the queue so can be sent to the
			THR now. */
			AT91C_BASE_US0->US_THR = cChar;
		}
		else
		{
			/* Queue empty, nothing to send so turn off the Tx interrupt. */
			AT91C_BASE_US0->US_IDR = US_TXRDY;
		}    
	}

	if (ulStatus & US_RXRDY)
	{
		/* The interrupt was caused by the receiver getting data. */
		cChar = AT91C_BASE_US0->US_RHR;

		if (xQueueSendFromISR(xRxedChars, &cChar, pdFALSE))
		{
			xTaskWokenByRx = pdTRUE;
		}
	}

	// Acknowledge the interrupt at AIC level...
	AT91C_BASE_AIC->AIC_EOICR = serCLEAR_AIC_INTERRUPT;

	/* Exit the ISR.  If a task was woken by either a character being received
	or transmitted then a context switch will occur. */
	portEXIT_SWITCHING_ISR( ( xTaskWokenByTx || xTaskWokenByRx ) );
}
Exemple #8
0
void Serial_Isr( void )
{
	/* This ISR can cause a context switch.  Therefore a call to the 
	portENTER_SWITCHING_ISR() macro is made.  This must come BEFORE any 
	stack variable declarations. */
	portENTER_SWITCHING_ISR();
    
  unsigned portLONG ulStatus; 
  signed portCHAR cChar; 
  long xTaskWokenByTx = false; 
  long xTaskWokenByPost = false; 
 
  /* What caused the interrupt? */ 
  ulStatus = AT91C_BASE_US0->US_CSR & AT91C_BASE_US0->US_IMR; 
 
  if( ulStatus & AT91C_US_TXRDY ) 
  { 
    /* The interrupt was caused by the THR becoming empty. Are there any 
       more characters to transmit? */ 
    if( xQueueReceiveFromISR( Serial.transmitQueue, &cChar, &xTaskWokenByTx ) == pdTRUE ) 
    { 
      /* A character was retrieved from the queue so can be sent to the 
         THR now. */ 
      AT91C_BASE_US0->US_THR = cChar; 
    } 
    else 
    {    
      /* Queue empty, nothing to send so turn off the Tx interrupt. */ 
      AT91C_BASE_US0->US_IDR = AT91C_US_TXRDY; 
    }   
  } 
   
  if( ulStatus & AT91C_US_RXRDY ) 
  { 
    /* The interrupt was caused by a character being received. Grab the 
    character from the RHR and place it in the queue or received  
    characters. */ 
    int t = AT91C_BASE_US0->US_RHR;
    cChar = t & 0xFF; 
    xTaskWokenByPost = xQueueSendFromISR( Serial.receiveQueue, &cChar, xTaskWokenByPost ); 
  } 
   
  /* End the interrupt in the AIC. */ 
  AT91C_BASE_AIC->AIC_EOICR = 0;

	/* Do a task switch if needed */
	portEXIT_SWITCHING_ISR( ( xTaskWokenByPost || xTaskWokenByTx ) );
}
Exemple #9
0
void
sio_uart1_irq( void )
{
    /* Save context to stack. */
    portENTER_SWITCHING_ISR(  );

    static u8_t     need_ctx_switch;

    sio_serial_isr( UART1, &need_ctx_switch );

    /* End the interrupt in the EIC. */
    EIC->IPR |= 1 << EIC_CurrentIRQChannelValue(  );

    /* End the ISR. */
    portEXIT_SWITCHING_ISR( need_ctx_switch ? pdTRUE : pdFALSE );
}
Exemple #10
0
__interrupt
#endif
#endif
void vMACB_ISR(void)
{
  // This ISR can cause a context switch, so the first statement must be a
  // call to the portENTER_SWITCHING_ISR() macro.  This must be BEFORE any
  // variable declarations.
  portENTER_SWITCHING_ISR();

  // the return value is used by FreeRTOS to change the context if needed after rete instruction
  // in standalone use, this value should be ignored
  prvMACB_ISR_NonNakedBehaviour();

  // Exit the ISR.  If a task was woken by either a character being received
  // or transmitted then a context switch will occur.
  portEXIT_SWITCHING_ISR();
}
Exemple #11
0
void vCOM_1_Tx_ISR( void )
{
	/* This can cause a context switch so this macro must be the first line
	in the function. */
	portENTER_SWITCHING_ISR();

	/* As this is a switching ISR the local variables must be declared as 
	static. */
	static char cTxByte;
	static signed portBASE_TYPE xTaskWokenByTx;

		/* This variable is static so must be explicitly reinitialised each
		time the function executes. */
		xTaskWokenByTx = pdFALSE;

		/* The interrupt was caused by the THR becoming empty.  Are there any
		more characters to transmit?  Note whether or not the Tx interrupt has
		woken a task. */
		if( xQueueReceiveFromISR( xCharsForTx, &cTxByte, &xTaskWokenByTx ) == pdTRUE )
		{
			/* A character was retrieved from the queue so can be sent to the
			THR now. */							
			TDR1 = cTxByte;

			/* Clear the interrupt. */
			SSR1 &= ~serTX_INTERRUPT;
		}
		else
		{
			/* Queue empty, nothing to send so turn off the Tx interrupt. */
			serTX_INTERRUPT_OFF();
		}		

	/* This must be the last line in the function.  We pass cTaskWokenByTx so 
	a context switch will occur if the Tx'ed character woke a task that has
	a priority higher than the task we interrupted. */
	portEXIT_SWITCHING_ISR( xTaskWokenByTx );
}
Exemple #12
0
static void usb_general_interrupt(void)
{
  portENTER_SWITCHING_ISR();
  usb_general_interrupt_non_naked();
  portEXIT_SWITCHING_ISR();
}