示例#1
0
文件: thread_arch.c 项目: A-Paul/RIOT
void  thread_yield_higher(void)
{
    /* reset hardware watchdog */
    system_soft_wdt_feed();

    /* yield next task */
    #if defined(ENABLE_DEBUG) && defined(DEVELHELP)
    if (sched_active_thread) {
        DEBUG("%u old task %u %s %u\n", phy_get_mactime(),
               sched_active_thread->pid, sched_active_thread->name,
               sched_active_thread->sp - sched_active_thread-> stack_start);
    }
    #endif

    if (!irq_is_in()) {
        #ifdef CONTEXT_SWITCH_BY_INT
        WSR(BIT(ETS_SOFT_INUM), interrupt);
        #else
        vPortYield();
        #endif
    }
    else {
        _frxt_setup_switch();
    }

    #if defined(ENABLE_DEBUG) && defined(DEVELHELP)
    if (sched_active_thread) {
        DEBUG("%u new task %u %s %u\n", phy_get_mactime(),
               sched_active_thread->pid, sched_active_thread->name,
               sched_active_thread->sp - sched_active_thread-> stack_start);
    }
    #endif

    return;
}
示例#2
0
/* ----------------------------------------------------------------------------*/
void vPortEndTask(void)
{

#if ( INCLUDE_vTaskDelete == 1 )
	vTaskDelete(NULL); /* Delete task itself */
#endif

	while(1) { /* Yield to other task */
		vPortYield();
	}
}
示例#3
0
文件: mac.c 项目: EDAyele/wsn430
static uint16_t xRxOk_cb(void)
{
    uint16_t xHigherPriorityTaskWoken;
    uint8_t event = EVENT_FRAME_RECEIVED;

    xQueueSendToBackFromISR(xEvent, &event, &xHigherPriorityTaskWoken);

    if (xHigherPriorityTaskWoken)
    {
        vPortYield();
        return 1;
    }
    return 0;
}
	void uart_read_handler(UartError status, uint8_t *data, uint16_t len)
	{
		Event e;
		e.type = READ_EVENT;
		e.length = 1;

		e.data[0] = data[0];
		BaseType_t task_woken = pdFALSE;
		xQueueSendToBackFromISR(event_queue, &e, &task_woken);
		uart->read_async(1, uart_read_del);

		if(task_woken) {
			vPortYield();
		}
	}
示例#5
0
文件: adc.c 项目: EDAyele/wsn430
interrupt(ADC12_VECTOR) adc12irq(void)
{
    uint16_t measure;
    uint16_t adc;

    for (adc = 0; adc < 6; adc++)
    {
        measure = ADC12MEMx[adc];

        if ( measure < adc_data.v_min[adc] )
        {
            adc_data.v_min[adc] = measure;
        }

        if ( measure > adc_data.v_max[adc] )
        {
            adc_data.v_max[adc] = measure;
        }

        adc_sum[adc] += measure;
    }

    adc_count ++;

    if (adc_count == ADC_COUNT_AVG)
    {
        adc_data.seq ++;

        for (adc = 0; adc < 6; adc++)
        {
            adc_data.v_avg[adc] = adc_sum[adc] >> 8;
        }

        uint16_t woken;
        xQueueSendToBackFromISR(xDataQueue, &adc_data, &woken);

        vADCClear();

        if (woken)
        {
            vPortYield();
        }

    }
示例#6
0
void vPortExitCritical( void )
{
	/* Check for unmatched exits. */
	if ( uxCriticalNesting > 0 )
	{
		uxCriticalNesting--;
	}

	/* If we have reached 0 then re-enable the interrupts. */
	if( uxCriticalNesting == 0 )
	{
		/* Have we missed ticks? This is the equivalent of pending an interrupt. */
		if ( pdTRUE == xPendYield )
		{
			xPendYield = pdFALSE;
			vPortYield();
		}
		vPortEnableInterrupts();
	}
}
示例#7
0
static void PIOS_USB_RCTX_SendReport(struct pios_usb_rctx_dev *usb_rctx_dev)
{
#ifdef PIOS_INCLUDE_FREERTOS
    bool need_yield = false;
#endif /* PIOS_INCLUDE_FREERTOS */

    usb_rctx_dev->report.id = 3; /* FIXME: shouldn't hard-code this report ID */

    UserToPMABufferCopy((uint8_t *)&usb_rctx_dev->report,
                        GetEPTxAddr(usb_rctx_dev->cfg->data_tx_ep),
                        sizeof(usb_rctx_dev->report));

    SetEPTxCount(usb_rctx_dev->cfg->data_tx_ep, sizeof(usb_rctx_dev->report));
    SetEPTxValid(usb_rctx_dev->cfg->data_tx_ep);

#ifdef PIOS_INCLUDE_FREERTOS
    if (need_yield) {
        vPortYield();
    }
#endif /* PIOS_INCLUDE_FREERTOS */
}