FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
- more details. You should have received a copy of the GNU General Public \r
- License and the FreeRTOS license exception along with FreeRTOS; if not it \r
- can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
by writing to Richard Barry, contact details for whom are available on the\r
FreeRTOS WEB site.\r
\r
);</pre>\r
*\r
* Create a new task and add it to the list of tasks that are ready to run.\r
- * \r
+ *\r
* xTaskCreate() can only be used to create a task that has unrestricted\r
* access to the entire microcontroller memory map. Systems that include MPU\r
- * support can alternatively create an MPU constrained task using \r
+ * support can alternatively create an MPU constrained task using\r
* xTaskCreateRestricted().\r
*\r
* @param pvTaskCode Pointer to the task entry function. Tasks\r
*\r
* @param pxTaskDefinition Pointer to a structure that contains a member\r
* for each of the normal xTaskCreate() parameters (see the xTaskCreate() API\r
- * documentation) plus an optional stack buffer and the memory region \r
+ * documentation) plus an optional stack buffer and the memory region\r
* definitions.\r
*\r
* @param pxCreatedTask Used to pass back a handle by which the created task\r
* Memory regions are assigned to a restricted task when the task is created by\r
* a call to xTaskCreateRestricted(). These regions can be redefined using\r
* vTaskAllocateMPURegions().\r
- * \r
+ *\r
* @param xTask The handle of the task being updated.\r
*\r
* @param xRegions A pointer to an xMemoryRegion structure that contains the\r
void vATask( void *pvParameters )\r
{\r
// This task was created such that it has access to certain regions of\r
- // memory as defined by the MPU configuration. At some point it is \r
+ // memory as defined by the MPU configuration. At some point it is\r
// desired that these MPU regions are replaced with that defined in the\r
// xAltRegions const struct above. Use a call to vTaskAllocateMPURegions()\r
// for this purpose. NULL is used as the task handle to indicate that this\r
\r
/**\r
* task. h\r
- * <PRE>volatile portTickType xTaskGetTickCount( void );</PRE>\r
+ * <PRE>portTickType xTaskGetTickCount( void );</PRE>\r
*\r
* @return The count of ticks since vTaskStartScheduler was called.\r
*\r
*/\r
portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;\r
\r
+/**\r
+ * task. h\r
+ * <PRE>portTickType xTaskGetTickCountFromISR( void );</PRE>\r
+ *\r
+ * @return The count of ticks since vTaskStartScheduler was called.\r
+ *\r
+ * This is a version of xTaskGetTickCount() that is safe to be called from an\r
+ * ISR - provided that portTickType is the natural word size of the\r
+ * microcontroller being used or interrupt nesting is either not supported or\r
+ * not being used.\r
+ *\r
+ * \page xTaskGetTickCount xTaskGetTickCount\r
+ * \ingroup TaskUtils\r
+ */\r
+portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;\r
+\r
/**\r
* task. h\r
* <PRE>unsigned short uxTaskGetNumberOfTasks( void );</PRE>\r
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
- more details. You should have received a copy of the GNU General Public \r
- License and the FreeRTOS license exception along with FreeRTOS; if not it \r
- can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
by writing to Richard Barry, contact details for whom are available on the\r
FreeRTOS WEB site.\r
\r
portEXIT_CRITICAL();\r
\r
/* We may have just suspended the current task. */\r
- if( ( void * ) pxTaskToSuspend == NULL )\r
+ if( ( ( void * ) pxTaskToSuspend == NULL ) && ( xSchedulerRunning != pdFALSE ) )\r
{\r
portYIELD_WITHIN_API();\r
}\r
}\r
/*-----------------------------------------------------------*/\r
\r
+portTickType xTaskGetTickCountFromISR( void )\r
+{\r
+ return xTickCount;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )\r
{\r
/* A critical section is not required because the variables are of type\r