Allow tasks to be suspended immediately after creation - provided the scheduler is not running.

Add API function that allows the tick count to be queried from an interrupt.
pull/4/head
Richard Barry 15 years ago
parent ad451e8b70
commit 7ce7d21ca8

@ -963,7 +963,7 @@ signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTI
/**
* task. h
* <PRE>volatile portTickType xTaskGetTickCount( void );</PRE>
* <PRE>portTickType xTaskGetTickCount( void );</PRE>
*
* @return The count of ticks since vTaskStartScheduler was called.
*
@ -972,6 +972,22 @@ signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTI
*/
portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;
/**
* task. h
* <PRE>portTickType xTaskGetTickCountFromISR( void );</PRE>
*
* @return The count of ticks since vTaskStartScheduler was called.
*
* This is a version of xTaskGetTickCount() that is safe to be called from an
* ISR - provided that portTickType is the natural word size of the
* microcontroller being used or interrupt nesting is either not supported or
* not being used.
*
* \page xTaskGetTickCount xTaskGetTickCount
* \ingroup TaskUtils
*/
portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
/**
* task. h
* <PRE>unsigned short uxTaskGetNumberOfTasks( void );</PRE>

@ -894,7 +894,7 @@ tskTCB * pxNewTCB;
portEXIT_CRITICAL();
/* We may have just suspended the current task. */
if( ( void * ) pxTaskToSuspend == NULL )
if( ( ( void * ) pxTaskToSuspend == NULL ) && ( xSchedulerRunning != pdFALSE ) )
{
portYIELD_WITHIN_API();
}
@ -1175,6 +1175,12 @@ portTickType xTicks;
}
/*-----------------------------------------------------------*/
portTickType xTaskGetTickCountFromISR( void )
{
return xTickCount;
}
/*-----------------------------------------------------------*/
unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
{
/* A critical section is not required because the variables are of type

Loading…
Cancel
Save