Beispiel #1
0
	xQueueHandle MPU_xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount )
	{
    xQueueHandle xReturn;
	portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();

		xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount );
		portRESET_PRIVILEGE( xRunningPrivileged );
		return xReturn;
	}
Beispiel #2
0
QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount )
{
    QueueHandle_t xReturn;
    BaseType_t xRunningPrivileged = prvRaisePrivilege();

    xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount );
    portRESET_PRIVILEGE( xRunningPrivileged );
    return xReturn;
}
Beispiel #3
0
	QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount )
	{
	QueueHandle_t xReturn;
	BaseType_t xRunningPrivileged = xPortRaisePrivilege();

		xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount );
		vPortResetPrivilege( xRunningPrivileged );
		return xReturn;
	}
{
    while(1){
        vTaskDelay(portMAX_DELAY);
    }
}

void suspended_task(void *arg)
{
    while(1){
        vTaskSuspend(NULL);
    }
}

TEST_CASE("Test eTaskGetState", "[freertos]")
{
    done_sem = xQueueCreateCountingSemaphore(portNUM_PROCESSORS, 0);
    //Create blocked and suspended task
    xTaskCreatePinnedToCore(blocked_task, "Blocked task", 1024, NULL, TSK_PRIORITY, &blocked_task_handle, tskNO_AFFINITY);
    xTaskCreatePinnedToCore(suspended_task, "Suspended task", 1024, NULL, TSK_PRIORITY, &suspended_task_handle, tskNO_AFFINITY);
    //Create testing task
    for(int i = 0; i < portNUM_PROCESSORS; i++){
        xTaskCreatePinnedToCore(test_task_get_state, "Test task", 1024, NULL, TSK_PRIORITY, NULL, i);
    }

    //Wait until done
    for(int i = 0; i < portNUM_PROCESSORS; i++){
        xSemaphoreTake(done_sem, portMAX_DELAY);
    }
    //Clean up blocked and suspended tasks
    vTaskDelete(blocked_task_handle);
    blocked_task_handle = NULL;