本文整理汇总了C++中xQueueSendFromISR函数的典型用法代码示例。如果您正苦于以下问题:C++ xQueueSendFromISR函数的具体用法?C++ xQueueSendFromISR怎么用?C++ xQueueSendFromISR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xQueueSendFromISR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prvSelectButtonInterrupt
interrupt void prvSelectButtonInterrupt( void )
{
/* Define the message sent to the LCD task from this interrupt. */
static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt" };
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* This is the interrupt handler for the joystick select button input.
The button has been pushed, write a message to the LCD via the LCD task. */
xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken );
P2IFG = 0;
/* If writing to xLCDQueue caused a task to unblock, and the unblocked task
has a priority equal to or above the task that this interrupt interrupted,
then lHigherPriorityTaskWoken will have been set to pdTRUE internally within
xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this
interrupt returns directly to the higher priority unblocked task. */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
示例2: GPIO0_IRQHandler
void GPIO0_IRQHandler()
{
portBASE_TYPE xSwitchRequired1;
if (Chip_PININT_GetFallStates(LPC_GPIO_PIN_INT)&PININTCH0)
{
Chip_PININT_ClearIntStatus(LPC_GPIO_PIN_INT,PININTCH0);
//xSemaphoreGiveFromISR(xSemaphore,&xSwitchRequired1);
uint8_t aux=0;
xQueueSendFromISR( xQueue1, ( void * ) &aux, &xSwitchRequired1);
//NO USAR - xSemaphoreGive(xSemaphore);
}
portEND_SWITCHING_ISR(xSwitchRequired1);
}
示例3: EXTI9_5_IRQHandler
void EXTI9_5_IRQHandler( void )
{
/* Define the message sent to the LCD task from this interrupt. */
const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt!" };
long lHigherPriorityTaskWoken = pdFALSE;
/* This is the interrupt handler for the joystick select button input.
The button has been pushed, write a message to the LCD via the LCD task. */
xQueueSendFromISR( xLCDQueue, &xMessage, &lHigherPriorityTaskWoken );
EXTI_ClearITPendingBit( SEL_BUTTON_EXTI_LINE );
/* If writing to xLCDQueue caused a task to unblock, and the unblocked task
has a priority equal to or above the task that this interrupt interrupted,
then lHigherPriorityTaskWoken will have been set to pdTRUE internally within
xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this
interrupt returns directly to the higher priority unblocked task. */
portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
}
示例4: interrupt
/*
* UART RX interrupt service routine.
*/
interrupt (UART1RX_VECTOR) wakeup vRxISR( void )
{
signed char cChar;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* Get the character from the UART and post it on the queue of Rxed
characters. */
cChar = U1RXBUF;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
if( xHigherPriorityTaskWoken )
{
/*If the post causes a task to wake force a context switch
as the woken task may have a higher priority than the task we have
interrupted. */
taskYIELD();
}
}
示例5: vSerialISR
/* Serial port ISR. This can cause a context switch so is not defined as a
standard ISR using the __irq keyword. Instead a wrapper function is defined
within serialISR.s79 which in turn calls this function. See the port
documentation on the FreeRTOS.org website for more information. */
__arm void vSerialISR( void )
{
unsigned short usStatus;
signed char cChar;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* What caused the interrupt? */
usStatus = UART_FlagStatus( UART0 );
if( usStatus & UART_TxHalfEmpty )
{
/* The interrupt was caused by the THR becoming empty. Are there any
more characters to transmit? */
if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )
{
/* A character was retrieved from the queue so can be sent to the
THR now. */
UART0->TxBUFR = cChar;
}
else
{
/* Queue empty, nothing to send so turn off the Tx interrupt. */
serINTERRUPT_OFF();
}
}
if( usStatus & UART_RxBufFull )
{
/* The interrupt was caused by a character being received. Grab the
character from the RHR and place it in the queue of received
characters. */
cChar = UART0->RxBUFR;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
}
/* If a task was woken by either a character being received or a character
being transmitted then we may need to switch to another task. */
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
/* End the interrupt in the EIC. */
portCLEAR_EIC();
}
示例6: vSerialISR
/* Serial port ISR. This can cause a context switch so is not defined as a
standard ISR using the __irq keyword. Instead a wrapper function is defined
within serialISR.s79 which in turn calls this function. See the port
documentation on the FreeRTOS.org website for more information. */
__arm void vSerialISR( void )
{
unsigned long ulStatus;
signed char cChar;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* What caused the interrupt? */
ulStatus = serCOM0->US_CSR &= serCOM0->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( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )
{
/* A character was retrieved from the queue so can be sent to the
THR now. */
serCOM0->US_THR = cChar;
}
else
{
/* Queue empty, nothing to send so turn off the Tx interrupt. */
vInterruptOff();
}
}
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. */
cChar = serCOM0->US_RHR;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
}
/* If a task was woken by either a character being received or a character
being transmitted then we may need to switch to another task. */
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
/* End the interrupt in the AIC. */
AT91C_BASE_AIC->AIC_EOICR = 0;
}
示例7: prvUSCI_A1_ISR
static __interrupt void prvUSCI_A1_ISR( void )
{
signed char cChar;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
while( ( UCA1IFG & UCRXIFG ) != 0 )
{
/* Get the character from the UART and post it on the queue of Rxed
characters. */
cChar = UCA1RXBUF;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
}
/* If there is a Tx interrupt pending and the tx interrupts are enabled. */
if( ( UCA1IFG & UCTXIFG ) != 0 )
{
/* The previous character has been transmitted. See if there are any
further characters waiting transmission. */
if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )
{
/* There was another character queued - transmit it now. */
UCA1TXBUF = cChar;
}
else
{
/* There were no other characters to transmit - disable the Tx
interrupt. */
UCA1IE &= ~UCTXIE;
}
}
__bic_SR_register_on_exit( SCG1 + SCG0 + OSCOFF + CPUOFF );
/* If writing to a queue caused a task to unblock, and the unblocked task
has a priority equal to or above the task that this interrupt interrupted,
then lHigherPriorityTaskWoken will have been set to pdTRUE internally within
xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this
interrupt returns directly to the higher priority unblocked task.
THIS MUST BE THE LAST THING DONE IN THE ISR. */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
示例8: bus_rxISR
/**
* Bus UART RX interrupt.
*/
void bus_rxISR( void )
{
uint8_t byte;
/* Get the character from the UART and post it on the queue of Rxed
characters. */
byte = USART_ReceiveData(USART1);
if( xQueueSendFromISR(debug_rx, &byte, pdFALSE ) )
{
/*If the post causes a task to wake force a context switch
as the woken task may have a higher priority than the task we have
interrupted. */
taskYIELD();
}
#ifdef HAVE_POWERSAVE
power_interrupt_epilogue();
#endif
}
示例9: EncolarEventoFromISR
portBASE_TYPE EncolarEventoFromISR (Modulo_t * receptor, Signal_t senial, int valor)
{
//xQueueHandle colaEventos = getColaEventos(receptor->prioridad);
portBASE_TYPE cambiarCtx = pdFALSE;
/*Evento_t evn;
evn.receptor = receptor;
evn.signal = senial;
evn.valor = valor;
*/
EventoDriver_t msg;
msg.codigo = 3; //timeoutSalud
msg.dato = 0;
xQueueSendFromISR(colaEventosDrivers, &msg, &cambiarCtx);
//xQueueSendFromISR(colaEventos, &evn, &cambiarCtx);
return cambiarCtx;
}
示例10: __gmsReceiveCSQData
static inline void __gmsReceiveCSQData(unsigned char data)
{
if (data == 0x0A) {
GsmTaskMessage *message;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
buffer[bufferIndex++] = 0;
message = __gsmCreateMessage(TYPE_CSQ_DATA, buffer, bufferIndex);
if (pdTRUE == xQueueSendFromISR(__queue, &message, &xHigherPriorityTaskWoken)) {
if (xHigherPriorityTaskWoken) {
taskYIELD();
}
} else {
__gsmDestroyMessage(message);
}
isCSQ = 0;
bufferIndex = 0;
} else if (data != 0x0D) {
buffer[bufferIndex++] = data;
}
}
示例11: Timer_GetTime
/******** Timer_GetCCPPeriod ************************************************
// Count the number of system ticks during one period of CCP input frequency
// Input: timer is one of the Timer_T value ( Timer1A, Timer1B... )
// Output: none
// ------------------------------------------------------------------------*/
void Timer_GetCCPPeriod ( Timer_T timer )
{
unsigned long ticks = 0;
static unsigned long last_time = 0;
static unsigned long this_time = 0;
static char counter = 0;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
if ( counter )
{
// finish
this_time = Timer_GetTime ( timer );
if ( this_time >= last_time )
{
// sysTick overflow, flush data
last_time = 0;
this_time = 0;
counter = 0;
}
else
{
// get the number of ticks in a period, push on to the Queue
ticks = last_time - this_time;
while ( xQueueSendFromISR (CCPQueue[timer], &ticks, &xHigherPriorityTaskWoken) != pdTRUE );
// reset ISR and disable interrupt
counter = 0;
Timer_Disable ( timer ) ;
}
}
else
{
// begin
last_time = Timer_GetTime ( timer );
// next interrupt will finish system tick calculation
counter = 1;
}
}
示例12: vEINT0_ISR_Handler
/*
* When the WIZnet device asserts an interrupt we send an (empty) message to
* the TCP task. This wakes the task so the interrupt can be processed. The
* source of the interrupt has to be ascertained by the TCP task as this
* requires an I2C transaction which cannot be performed from this ISR.
* Note this code predates the introduction of semaphores, a semaphore should
* be used in place of the empty queue message.
*/
void vEINT0_ISR_Handler( void )
{
extern xQueueHandle xTCPISRQueue;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* Just wake the TCP task so it knows an ISR has occurred. */
xQueueSendFromISR( xTCPISRQueue, ( void * ) &lDummyVariable, &xHigherPriorityTaskWoken );
/* We cannot carry on processing interrupts until the TCP task has
processed this one - so for now interrupts are disabled. The TCP task will
re-enable it. */
VICIntEnClear |= tcpEINT0_VIC_CHANNEL_BIT;
/* Clear the interrupt bit. */
VICVectAddr = tcpCLEAR_VIC_INTERRUPT;
if( xHigherPriorityTaskWoken )
{
portYIELD_FROM_ISR();
}
}
示例13: tdcMeasurementHandler
/**
* \brief TDC interrupt handler, called after the propagation delay measurement.
*/
void tdcMeasurementHandler(void) {
uint32_t result;
event_t error_event;
BaseType_t xTaskWoken = pdFALSE;
/* Check the pointer */
if (g_rawDataPtr != NULL) {
/* Read the calibration value */
bsp_GP22RegRead(GP22_RD_RES_0, &result, 4);
/* Safe the raw data */
g_rawDataPtr->raw[g_rawDataPtr->raw_ctr++] = result;
}
else {
/* Send error event */
error_event.event = Fault_MemoryPoolPtr;
xQueueSendFromISR(queueEvent, &error_event, &xTaskWoken);
}
/* Check if a higher prior task is woken up */
portEND_SWITCHING_ISR(xTaskWoken);
}
示例14: r_scifa2_callback_receiveend
/***********************************************************************************************************************
* Function Name: r_scifa2_callback_receiveend
* Description : This function is a callback function when SCIFA2 finishes reception.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void r_scifa2_callback_receiveend(void)
{
/* Start user code. Do not edit comment generated here */
uint8_t ucRxedChar = 0;
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
/* Read the received data */
ucRxedChar = SCIFA2.FRDR;
/* Characters received from the UART are stored in this queue, ready to be
received by the application. ***NOTE*** Using a queue in this way is very
convenient, but also very inefficient. It can be used here because
characters will only arrive slowly. In a higher bandwidth system a circular
RAM buffer or DMA should be used in place of this queue. */
xQueueSendFromISR( xRxQueue, ( void * ) &ucRxedChar, &xHigherPriorityTaskWoken );
/* Re-enable receptions */
SCIFA2.SCR.BIT.RE = 1U;
/* End user code. Do not edit comment generated here */
}
示例15: vAsyncSerialIODataAvailableISR
/* Define a callback function which is called when data is available. */
void vAsyncSerialIODataAvailableISR( int iFileDescriptor, void *pContext )
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
ssize_t iReadResult = -1;
unsigned char ucRx;
/* This handler only processes a single byte/character at a time. */
iReadResult = read( iFileDescriptor, &ucRx, 1 );
if ( 1 == iReadResult )
{
if ( NULL != pContext )
{
/* Send the received byte to the queue. */
if ( pdTRUE != xQueueSendFromISR( (xQueueHandle)pContext, &ucRx, &xHigherPriorityTaskWoken ) )
{
/* the queue is full. */
}
}
}
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}