示例#1
0
void ProgramManager::notifyManagerFromISR(uint32_t ulValue){
  BaseType_t xHigherPriorityTaskWoken = 0; 
  if(xManagerHandle != NULL)
    xTaskNotifyFromISR(xManagerHandle, ulValue, eSetBits, &xHigherPriorityTaskWoken );
  portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
#ifdef DEFINE_OWL_SYSTICK
  // vPortYield(); // can we call this from an interrupt?
  // taskYIELD();
#endif /* DEFINE_OWL_SYSTICK */
}
示例#2
0
// Frequency Analyzer VHDL interrupt
void frequency_interrupt_function(void* context, alt_u32 id){

	BaseType_t xHigherPriorityTaskWoken = pdFALSE;
	uint32_t value;

	configASSERT(xTaskToNotify != NULL);
	value = IORD_ALTERA_AVALON_PIO_DATA(FREQUENCY_ANALYSER_BASE);
	xTaskNotifyFromISR( xFreqTask, value, eSetBits, &xHigherPriorityTaskWoken );
	//printf("frequecny ISR %d\n", frequency_value);
	//printf("HANDLE: %d\n",(int)xTaskToNotify);
	portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
void xNotifyTaskFromISR( void )
{
static BaseType_t xCallCount = 0, xAPIToUse = 0;
const BaseType_t xCallInterval = pdMS_TO_TICKS( 50 );
uint32_t ulPreviousValue;
const uint32_t ulUnexpectedValue = 0xff;

	/* The task performs some tests before starting the timer that gives the
	notification from this interrupt.  If the timer has not been created yet
	then the initial tests have not yet completed and the notification should
	not be sent. */
	if( xTimer != NULL )
	{
		xCallCount++;

		if( xCallCount >= xCallInterval )
		{
			/* It is time to 'give' the notification again. */
			xCallCount = 0;

			/* Test using both vTaskNotifyGiveFromISR(), xTaskNotifyFromISR()
			and xTaskNotifyAndQueryFromISR(). */
			switch( xAPIToUse )
			{
				case 0:	vTaskNotifyGiveFromISR( xTaskToNotify, NULL );
						xAPIToUse++;
						break;

				case 1:	xTaskNotifyFromISR( xTaskToNotify, 0, eIncrement, NULL );
						xAPIToUse++;
						break;

				case 2: ulPreviousValue = ulUnexpectedValue;
						xTaskNotifyAndQueryFromISR( xTaskToNotify, 0, eIncrement, &ulPreviousValue, NULL );
						configASSERT( ulPreviousValue != ulUnexpectedValue );
						xAPIToUse = 0;
						break;

				default:/* Should never get here!. */
						break;
			}

			ulTimerNotificationsSent++;
		}
	}
}
示例#4
0
/**
* @brief  Set the specified Signal Flags of an active thread.
* @param  thread_id     thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
* @param  signals       specifies the signal flags of the thread that should be set.
* @retval  osOK if successful, osErrorOS if failed .
* @note   MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS.
*/
int32_t osSignalSet (osThreadId thread_id, int32_t signal)
{
  BaseType_t xHigherPriorityTaskWoken = pdFALSE;
  
  if (inHandlerMode())
  {
    if(xTaskNotifyFromISR( thread_id, (uint32_t)signal, eSetBits, &xHigherPriorityTaskWoken ) != pdPASS )
      return osErrorOS;

    portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
  }  
  else if(xTaskNotify( thread_id, (uint32_t)signal, eSetBits) != pdPASS )
  {
    return osErrorOS;
  }
  
  return osOK;
}
示例#5
0
static void example_timer_isr(void *arg)
{
    example_event_data_t *tim_arg = (example_event_data_t *)arg;

    if (tim_arg->thnd != NULL) {
        if (tim_arg->count++ < 10) {
            BaseType_t xHigherPriorityTaskWoken = pdFALSE;
            SYSVIEW_EXAMPLE_SEND_EVENT_START();
            if (xTaskNotifyFromISR(tim_arg->thnd, tim_arg->count, eSetValueWithOverwrite, &xHigherPriorityTaskWoken) != pdPASS) {
                ESP_EARLY_LOGE(TAG, "Failed to notify task %p", tim_arg->thnd);
            } else {
                SYSVIEW_EXAMPLE_SEND_EVENT_END(tim_arg->count);
                if (xHigherPriorityTaskWoken == pdTRUE) {
                    portYIELD_FROM_ISR();
                }
            }
        }
    }
    // re-start timer
    example_timer_rearm(tim_arg->group, tim_arg->timer);
}
示例#6
0
void LittleConsole::update() {
	xTaskNotifyFromISR(updateTask, 0, eNoAction, nullptr);
}