listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );\r
\r
/* Event lists are always in priority order. */\r
- listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );\r
+ listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( portTickType ) configMAX_CO_ROUTINE_PRIORITIES - ( portTickType ) uxPriority ) );\r
\r
/* Now the co-routine has been initialised it can be added to the ready\r
list at the correct priority. */\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
* within FreeRTOSConfig.h.\r
*/\r
\r
+#ifndef configMINIMAL_STACK_SIZE\r
+ #error Missing definition: configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h. configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task. Refer to the demo project provided for your port for a suitable value.\r
+#endif\r
+\r
+#ifndef configMAX_PRIORITIES\r
+ #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
#ifndef configUSE_PREEMPTION\r
- #error Missing definition: configUSE_PREEMPTION should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef configUSE_IDLE_HOOK\r
- #error Missing definition: configUSE_IDLE_HOOK should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef configUSE_TICK_HOOK\r
- #error Missing definition: configUSE_TICK_HOOK should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef configUSE_CO_ROUTINES\r
- #error Missing definition: configUSE_CO_ROUTINES should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: configUSE_CO_ROUTINES must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef INCLUDE_vTaskPrioritySet\r
- #error Missing definition: INCLUDE_vTaskPrioritySet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: INCLUDE_vTaskPrioritySet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef INCLUDE_uxTaskPriorityGet\r
- #error Missing definition: INCLUDE_uxTaskPriorityGet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: INCLUDE_uxTaskPriorityGet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef INCLUDE_vTaskDelete\r
- #error Missing definition: INCLUDE_vTaskDelete should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: INCLUDE_vTaskDelete must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef INCLUDE_vTaskSuspend\r
- #error Missing definition: INCLUDE_vTaskSuspend should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: INCLUDE_vTaskSuspend must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef INCLUDE_vTaskDelayUntil\r
- #error Missing definition: INCLUDE_vTaskDelayUntil should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: INCLUDE_vTaskDelayUntil must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef INCLUDE_vTaskDelay\r
- #error Missing definition: INCLUDE_vTaskDelay should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: INCLUDE_vTaskDelay must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
#endif\r
\r
#ifndef configUSE_16_BIT_TICKS\r
- #error Missing definition: configUSE_16_BIT_TICKS should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+ #error Missing definition: configUSE_16_BIT_TICKS must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.\r
+#endif\r
+\r
+#if configUSE_CO_ROUTINES != 0\r
+ #if configMAX_CO_ROUTINE_PRIORITIES < 1\r
+ #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.\r
+ #endif\r
+#endif\r
+\r
+#if configMAX_PRIORITIES < 1\r
+ #error configMAX_PRIORITIES must be greater than or equal to 1.\r
#endif\r
\r
#ifndef INCLUDE_xTaskGetIdleTaskHandle\r
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()\r
#endif\r
\r
+#ifndef configUSE_TRACE_FACILITY\r
+ #define configUSE_TRACE_FACILITY 0\r
+#endif\r
+\r
/* For backward compatability. */\r
#define eTaskStateGet eTaskGetState\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
* complete and obvious failure of the scheduler. If this is ever experienced\r
* then the volatile qualifier can be inserted in the relevant places within the\r
* list structures by simply defining configLIST_VOLATILE to volatile in\r
- * FreeRTOSConfig.h (as per the example at the bottom of this comment block). \r
- * If configLIST_VOLATILE is not defined then the preprocessor directives below \r
+ * FreeRTOSConfig.h (as per the example at the bottom of this comment block).\r
+ * If configLIST_VOLATILE is not defined then the preprocessor directives below\r
* will simply #define configLIST_VOLATILE away completely.\r
*\r
* To use volatile list structure members then add the following line to\r
typedef struct xLIST\r
{\r
configLIST_VOLATILE unsigned portBASE_TYPE uxNumberOfItems;\r
- xListItem * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to pvListGetOwnerOfNextEntry (). */\r
+ xListItem * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */\r
xMiniListItem xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */\r
} xList;\r
\r
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER\r
* \ingroup LinkedList\r
*/\r
-#define listGET_LIST_ITEM_OWNER( pxListItem ) ( pxListItem )->pvOwner\r
+#define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner )\r
\r
/*\r
* Access macro to set the value of the list item. In most cases the value is\r
\r
/*\r
* Access macro to retrieve the value of the list item. The value can\r
- * represent anything - for example a the priority of a task, or the time at\r
+ * represent anything - for example the priority of a task, or the time at\r
* which a task should be unblocked.\r
*\r
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE\r
#define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue )\r
\r
/*\r
- * Access macro the retrieve the value of the list item at the head of a given\r
+ * Access macro to retrieve the value of the list item at the head of a given\r
* list.\r
*\r
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE\r
*\r
* The list member pxIndex is used to walk through a list. Calling\r
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list\r
- * and returns that entries pxOwner parameter. Using multiple calls to this\r
+ * and returns that entry's pxOwner parameter. Using multiple calls to this\r
* function it is therefore possible to move through every item contained in\r
* a list.\r
*\r
* The pxOwner parameter effectively creates a two way link between the list\r
* item and its owner.\r
*\r
+ * @param pxTCB pxTCB is set to the address of the owner of the next list item.\r
* @param pxList The list from which the next item owner is to be returned.\r
*\r
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY\r
*\r
* @param pxList The list we want to know if the list item is within.\r
* @param pxListItem The list item we want to know if is in the list.\r
- * @return pdTRUE is the list item is in the list, otherwise pdFALSE.\r
- * pointer against\r
+ * @return pdTRUE if the list item is in the list, otherwise pdFALSE.\r
*/\r
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( portBASE_TYPE ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) )\r
\r
*\r
* @param pxList The list into which the item is to be inserted.\r
*\r
- * @param pxNewListItem The item to that is to be placed in the list.\r
+ * @param pxNewListItem The item that is to be placed in the list.\r
*\r
* \page vListInsert vListInsert\r
* \ingroup LinkedList\r
\r
/* Error definitions. */\r
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )\r
-#define errNO_TASK_TO_RUN ( -2 )\r
#define errQUEUE_BLOCKED ( -4 )\r
#define errQUEUE_YIELD ( -5 )\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
<pre>\r
\r
xQueueHandle xQueue;\r
- \r
+\r
void vFunction( void *pvParameters )\r
{\r
// Create a queue to hold one unsigned long value. It is strongly\r
// Reading from the queue will now return 100.\r
\r
// ...\r
- \r
+\r
if( xHigherPrioritytaskWoken == pdTRUE )\r
{\r
// Writing to the queue caused a task to unblock and the unblocked task\r
* handles can also be passed in here.\r
*\r
* @param pcName The name to be associated with the handle. This is the\r
- * name that the kernel aware debugger will display.\r
+ * name that the kernel aware debugger will display. The queue registry only\r
+ * stores a pointer to the string - so the string must be persistent (global or\r
+ * preferably in ROM/Flash), not on the stack.\r
*/\r
#if configQUEUE_REGISTRY_SIZE > 0\r
void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName ) PRIVILEGED_FUNCTION;\r
* If xMutex is not a mutex type semaphore, or the mutex is available (not held\r
* by a task), return NULL.\r
*\r
- * Note: This Is is a good way of determining if the calling task is the mutex\r
+ * Note: This is a good way of determining if the calling task is the mutex\r
* holder, but not a good way of determining the identity of the mutex holder as\r
* the holder may change between the function exiting and the returned value\r
* being tested.\r
/*\r
* Parameters required to create an MPU protected task.\r
*/\r
-typedef struct xTASK_PARAMTERS\r
+typedef struct xTASK_PARAMETERS\r
{\r
pdTASK_CODE pvTaskCode;\r
const signed char * const pcName;\r
} eSleepModeStatus;\r
\r
\r
-/*\r
+/**\r
* Defines the priority used by the idle task. This must not be modified.\r
*\r
* \ingroup TaskUtils\r
*<pre>\r
portBASE_TYPE xTaskCreate(\r
pdTASK_CODE pvTaskCode,\r
- const char * const pcName,\r
+ const signed char * const pcName,\r
unsigned short usStackDepth,\r
void *pvParameters,\r
unsigned portBASE_TYPE uxPriority,\r
* must be implemented to never return (i.e. continuous loop).\r
*\r
* @param pcName A descriptive name for the task. This is mainly used to\r
- * facilitate debugging. Max length defined by tskMAX_TASK_NAME_LEN - default\r
+ * facilitate debugging. Max length defined by configMAX_TASK_NAME_LEN - default\r
* is 16.\r
*\r
* @param usStackDepth The size of the task stack specified as the number of\r
* can be referenced.\r
*\r
* @return pdPASS if the task was successfully created and added to a ready\r
- * list, otherwise an error code defined in the file errors. h\r
+ * list, otherwise an error code defined in the file projdefs.h\r
*\r
* Example usage:\r
<pre>\r
void vOtherFunction( void )\r
{\r
static unsigned char ucParameterToPass;\r
- xTaskHandle xHandle;\r
+ xTaskHandle xHandle = NULL;\r
\r
// Create the task, storing the handle. Note that the passed parameter ucParameterToPass\r
// must exist for the lifetime of the task, so in this case is declared static. If it was just an\r
// an automatic stack variable it might no longer exist, or at least have been corrupted, by the time\r
// the new task attempts to access it.\r
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, &ucParameterToPass, tskIDLE_PRIORITY, &xHandle );\r
+ configASSERT( xHandle );\r
\r
// Use the handle to delete the task.\r
- vTaskDelete( xHandle );\r
+ if( xHandle != NULL )\r
+ {\r
+ vTaskDelete( xHandle );\r
+ }\r
}\r
</pre>\r
* \defgroup xTaskCreate xTaskCreate\r
* can be referenced.\r
*\r
* @return pdPASS if the task was successfully created and added to a ready\r
- * list, otherwise an error code defined in the file errors. h\r
+ * list, otherwise an error code defined in the file projdefs.h\r
*\r
* Example usage:\r
<pre>\r
vTaskStartScheduler();\r
\r
// Will only get here if there was insufficient memory to create the idle\r
- // task.\r
+ // and/or timer task.\r
for( ;; );\r
}\r
</pre>\r
* INCLUDE_vTaskDelete must be defined as 1 for this function to be available.\r
* See the configuration section for more information.\r
*\r
- * Remove a task from the RTOS real time kernels management. The task being\r
+ * Remove a task from the RTOS real time kernel's management. The task being\r
* deleted will be removed from all ready, blocked, suspended and event lists.\r
*\r
* NOTE: The idle task is responsible for freeing the kernel allocated\r
\r
/**\r
* task. h\r
- * <pre>void vTaskDelay( portTickType xTicksToDelay );</pre>\r
+ * <pre>void vTaskDelay( const portTickType xTicksToDelay );</pre>\r
*\r
* Delay a task for a given number of ticks. The actual time that the\r
* task remains blocked depends on the tick rate. The constant\r
* the time at which vTaskDelay() is called. For example, specifying a block\r
* period of 100 ticks will cause the task to unblock 100 ticks after\r
* vTaskDelay() is called. vTaskDelay() does not therefore provide a good method\r
- * of controlling the frequency of a cyclical task as the path taken through the\r
+ * of controlling the frequency of a periodic task as the path taken through the\r
* code, as well as other task and interrupt activity, will effect the frequency\r
* at which vTaskDelay() gets called and therefore the time at which the task\r
* next executes. See vTaskDelayUntil() for an alternative API function designed\r
*\r
* Example usage:\r
\r
- void vTaskFunction( void * pvParameters )\r
- {\r
void vTaskFunction( void * pvParameters )\r
{\r
// Block for 500ms.\r
* \defgroup vTaskDelay vTaskDelay\r
* \ingroup TaskCtrl\r
*/\r
-void vTaskDelay( portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;\r
+void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;\r
\r
/**\r
* task. h\r
- * <pre>void vTaskDelayUntil( portTickType *pxPreviousWakeTime, portTickType xTimeIncrement );</pre>\r
+ * <pre>void vTaskDelayUntil( portTickType *pxPreviousWakeTime, const portTickType xTimeIncrement );</pre>\r
*\r
* INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available.\r
* See the configuration section for more information.\r
*\r
- * Delay a task until a specified time. This function can be used by cyclical\r
+ * Delay a task until a specified time. This function can be used by periodic\r
* tasks to ensure a constant execution frequency.\r
*\r
* This function differs from vTaskDelay () in one important aspect: vTaskDelay () will\r
* \defgroup vTaskDelayUntil vTaskDelayUntil\r
* \ingroup TaskCtrl\r
*/\r
-void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ) PRIVILEGED_FUNCTION;\r
+void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickType xTimeIncrement ) PRIVILEGED_FUNCTION;\r
\r
/**\r
* task. h\r
* <pre>unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask );</pre>\r
*\r
- * INCLUDE_xTaskPriorityGet must be defined as 1 for this function to be available.\r
+ * INCLUDE_uxTaskPriorityGet must be defined as 1 for this function to be available.\r
* See the configuration section for more information.\r
*\r
* Obtain the priority of any task.\r
*\r
* Resumes a suspended task.\r
*\r
- * A task that has been suspended by one of more calls to vTaskSuspend ()\r
+ * A task that has been suspended by one or more calls to vTaskSuspend ()\r
* will be made available for running again by a single call to\r
* vTaskResume ().\r
*\r
vTaskResume( xHandle );\r
\r
// The created task will once again get microcontroller processing\r
- // time in accordance with it priority within the system.\r
+ // time in accordance with its priority within the system.\r
}\r
</pre>\r
* \defgroup vTaskResume vTaskResume\r
*\r
* An implementation of vTaskResume() that can be called from within an ISR.\r
*\r
- * A task that has been suspended by one of more calls to vTaskSuspend ()\r
+ * A task that has been suspended by one or more calls to vTaskSuspend ()\r
* will be made available for running again by a single call to\r
* xTaskResumeFromISR ().\r
*\r
+ * xTaskResumeFromISR() should not be used to synchronise a task with an\r
+ * interrupt if there is a chance that the interrupt could arrive prior to the\r
+ * task being suspended - as this can lead to interrupts being missed. Use of a\r
+ * semaphore as a synchronisation mechanism would avoid this eventuality.\r
+ *\r
* @param xTaskToResume Handle to the task being readied.\r
*\r
+ * @return pdTRUE if resuming the task should result in a context switch,\r
+ * otherwise pdFALSE. This is used by the ISR to determine if a context switch\r
+ * may be required following the ISR.\r
+ *\r
* \defgroup vTaskResumeFromISR vTaskResumeFromISR\r
* \ingroup TaskCtrl\r
*/\r
* <pre>void vTaskStartScheduler( void );</pre>\r
*\r
* Starts the real time kernel tick processing. After calling the kernel\r
- * has control over which tasks are executed and when. This function\r
- * does not return until an executing task calls vTaskEndScheduler ().\r
- *\r
- * At least one task should be created via a call to xTaskCreate ()\r
- * before calling vTaskStartScheduler (). The idle task is created\r
- * automatically when the first application task is created.\r
+ * has control over which tasks are executed and when.\r
*\r
* See the demo application file main.c for an example of creating\r
* tasks and starting the kernel.\r
* task. h\r
* <pre>void vTaskEndScheduler( void );</pre>\r
*\r
+ * NOTE: At the time of writing only the x86 real mode port, which runs on a PC\r
+ * in place of DOS, implements this function.\r
+ *\r
* Stops the real time kernel tick. All created tasks will be automatically\r
* deleted and multitasking (either preemptive or cooperative) will\r
* stop. Execution then resumes from the point where vTaskStartScheduler ()\r
* task. h\r
* <pre>void vTaskSuspendAll( void );</pre>\r
*\r
- * Suspends all real time kernel activity while keeping interrupts (including the\r
- * kernel tick) enabled.\r
+ * Suspends the scheduler without disabling interrupts. Context switches will\r
+ * not occur while the scheduler is suspended.\r
*\r
* After calling vTaskSuspendAll () the calling task will continue to execute\r
* without risk of being swapped out until a call to xTaskResumeAll () has been\r
* task. h\r
* <pre>char xTaskResumeAll( void );</pre>\r
*\r
- * Resumes real time kernel activity following a call to vTaskSuspendAll ().\r
- * After a call to vTaskSuspendAll () the kernel will take control of which\r
- * task is executing at any time.\r
+ * Resumes scheduler activity after it was suspended by a call to\r
+ * vTaskSuspendAll().\r
+ *\r
+ * xTaskResumeAll() only resumes the scheduler. It does not unsuspend tasks\r
+ * that were previously suspended by a call to vTaskSuspend().\r
*\r
* @return If resuming the scheduler caused a context switch then pdTRUE is\r
* returned, otherwise pdFALSE is returned.\r
* is in any other state.\r
*\r
*/\r
-signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
+signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
\r
/*-----------------------------------------------------------\r
* TASK UTILITIES\r
* microcontroller being used or interrupt nesting is either not supported or\r
* not being used.\r
*\r
- * \defgroup xTaskGetTickCount xTaskGetTickCount\r
+ * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR\r
* \ingroup TaskUtils\r
*/\r
portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;\r
* <PRE>signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );</PRE>\r
*\r
* @return The text (human readable) name of the task referenced by the handle\r
- * xTaskToQueury. A task can query its own name by either passing in its own\r
+ * xTaskToQuery. A task can query its own name by either passing in its own\r
* handle, or by setting xTaskToQuery to NULL. INCLUDE_pcTaskGetTaskName must be\r
* set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available.\r
*\r
* @param xTask Handle of the task associated with the stack to be checked.\r
* Set xTask to NULL to check the stack of the calling task.\r
*\r
- * @return The smallest amount of free stack space there has been (in bytes)\r
- * since the task referenced by xTask was created.\r
+ * @return The smallest amount of free stack space there has been (in words, so\r
+ * actual spaces on the stack rather than bytes) since the task referenced by\r
+ * xTask was created.\r
*/\r
unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
\r
-/* When using trace macros it is sometimes necessary to include tasks.h before\r
+/* When using trace macros it is sometimes necessary to include task.h before\r
FreeRTOS.h. When this is done pdTASK_HOOK_CODE will not yet have been defined,\r
so the following two prototypes will cause a compilation error. This can be\r
fixed by simply guarding against the inclusion of these two prototypes unless\r
\r
/**\r
* task.h\r
- * <pre>portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>\r
+ * <pre>portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter );</pre>\r
*\r
* Calls the hook function associated with xTask. Passing xTask as NULL has\r
* the effect of calling the Running tasks (the calling task) hook function.\r
*\r
* pvParameter is passed to the hook function for the task to interpret as it\r
- * wants.\r
+ * wants. The return value is the value returned by the task hook function\r
+ * registered by the user.\r
*/\r
portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) PRIVILEGED_FUNCTION;\r
\r
xTaskHandle xTaskGetIdleTaskHandle( void );\r
\r
/**\r
- * configUSE_TRACE_FACILITY must bet defined as 1 in FreeRTOSConfig.h for\r
+ * configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for\r
* uxTaskGetSystemState() to be available.\r
*\r
* uxTaskGetSystemState() populates an xTaskStatusType structure for each task in\r
\r
// Take a snapshot of the number of tasks in case it changes while this\r
// function is executing.\r
- uxArraySize = uxCurrentNumberOfTasks();\r
+ uxArraySize = uxTaskGetNumberOfTasks();\r
\r
// Allocate a xTaskStatusType structure for each task. An array could be\r
// allocated statically at compile time.\r
- pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( xTaskStatusType ) );\r
+ pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( xTaskStatusType ) );\r
\r
if( pxTaskStatusArray != NULL )\r
{\r
* call to vTaskList().\r
*\r
* @param pcWriteBuffer A buffer into which the above mentioned details\r
- * will be written, in ascii form. This buffer is assumed to be large\r
+ * will be written, in ASCII form. This buffer is assumed to be large\r
* enough to contain the generated report. Approximately 40 bytes per\r
* task should be sufficient.\r
*\r
* configGENERATE_RUN_TIME_STATS and configUSE_STATS_FORMATTING_FUNCTIONS\r
* must both be defined as 1 for this function to be available. The application\r
* must also then provide definitions for\r
- * portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and portGET_RUN_TIME_COUNTER_VALUE\r
+ * portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and portGET_RUN_TIME_COUNTER_VALUE()\r
* to configure a peripheral timer/counter and return the timers current count\r
* value respectively. The counter should be at least 10 times the frequency of\r
* the tick count.\r
* vTaskGetRunTimeStats().\r
*\r
* @param pcWriteBuffer A buffer into which the execution times will be\r
- * written, in ascii form. This buffer is assumed to be large enough to\r
+ * written, in ASCII form. This buffer is assumed to be large enough to\r
* contain the generated report. Approximately 40 bytes per task should\r
* be sufficient.\r
*\r
* The difference being that this function does not permit tasks to block\r
* indefinitely, whereas vTaskPlaceOnEventList() does.\r
*\r
- * @return pdTRUE if the task being removed has a higher priority than the task\r
- * making the call, otherwise pdFALSE.\r
*/\r
void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
\r
unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
\r
/*\r
- * Set the uxTCBNumber of the task referenced by the xTask parameter to\r
- * ucHandle.\r
+ * Set the uxTaskNumber of the task referenced by the xTask parameter to\r
+ * uxHandle.\r
*/\r
void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle ) PRIVILEGED_FUNCTION;\r
\r
/*\r
+ * Only available when configUSE_TICKLESS_IDLE is set to 1.\r
* If tickless mode is being used, or a low power mode is implemented, then\r
* the tick interrupt will not execute during idle periods. When this is the\r
* case, the tick count value maintained by the scheduler needs to be kept up\r
- * to date with the actual execution time by being skipped forward by the by\r
- * a time equal to the idle period.\r
+ * to date with the actual execution time by being skipped forward by a time\r
+ * equal to the idle period.\r
*/\r
void vTaskStepTick( portTickType xTicksToJump ) PRIVILEGED_FUNCTION;\r
\r
/*\r
+ * Only avilable when configUSE_TICKLESS_IDLE is set to 1.\r
* Provided for use within portSUPPRESS_TICKS_AND_SLEEP() to allow the port\r
* specific sleep function to determine if it is ok to proceed with the sleep,\r
* and if it is ok to proceed, if it is ok to sleep indefinitely.\r
extern "C" {\r
#endif\r
\r
+/*-----------------------------------------------------------\r
+ * MACROS AND DEFINITIONS\r
+ *----------------------------------------------------------*/\r
+\r
/* IDs for commands that can be sent/received on the timer queue. These are to\r
be used solely through the macros that make up the public software timer API,\r
as defined below. */\r
#define tmrCOMMAND_CHANGE_PERIOD ( ( portBASE_TYPE ) 2 )\r
#define tmrCOMMAND_DELETE ( ( portBASE_TYPE ) 3 )\r
\r
-/*-----------------------------------------------------------\r
- * MACROS AND DEFINITIONS\r
- *----------------------------------------------------------*/\r
-\r
- /**\r
+/**\r
* Type by which software timers are referenced. For example, a call to\r
* xTimerCreate() returns an xTimerHandle variable that can then be used to\r
* reference the subject timer in calls to other software timer API functions\r
typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );\r
\r
/**\r
- * xTimerHandle xTimerCreate( const signed char *pcTimerName,\r
+ * xTimerHandle xTimerCreate( const signed char * const pcTimerName,\r
* portTickType xTimerPeriodInTicks,\r
* unsigned portBASE_TYPE uxAutoReload,\r
* void * pvTimerID,\r
* Callback functions must have the prototype defined by tmrTIMER_CALLBACK,\r
* which is "void vCallbackFunction( xTimerHandle xTimer );".\r
*\r
- * @return If the timer is successfully create then a handle to the newly\r
+ * @return If the timer is successfully created then a handle to the newly\r
* created timer is returned. If the timer cannot be created (because either\r
* there is insufficient FreeRTOS heap remaining to allocate the timer\r
- * structures, or the timer period was set to 0) then 0 is returned.\r
+ * structures, or the timer period was set to 0) then NULL is returned.\r
*\r
* Example usage:\r
* @verbatim\r
*\r
* A timer will be dormant if:\r
* 1) It has been created but not started, or\r
- * 2) It is an expired on-shot timer that has not been restarted.\r
+ * 2) It is an expired one-shot timer that has not been restarted.\r
*\r
* Timers are created in the dormant state. The xTimerStart(), xTimerReset(),\r
* xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and\r
portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;\r
\r
/**\r
+ * xTaskHandle xTimerGetTimerDaemonTaskHandle( void );\r
+ *\r
* xTimerGetTimerDaemonTaskHandle() is only available if\r
* INCLUDE_xTimerGetTimerDaemonTaskHandle is set to 1 in FreeRTOSConfig.h.\r
*\r
*\r
* Timer functionality is provided by a timer service/daemon task. Many of the\r
* public FreeRTOS timer API functions send commands to the timer service task\r
- * though a queue called the timer command queue. The timer command queue is\r
+ * through a queue called the timer command queue. The timer command queue is\r
* private to the kernel itself and is not directly accessible to application\r
* code. The length of the timer command queue is set by the\r
* configTIMER_QUEUE_LENGTH configuration constant.\r
*\r
* Timer functionality is provided by a timer service/daemon task. Many of the\r
* public FreeRTOS timer API functions send commands to the timer service task\r
- * though a queue called the timer command queue. The timer command queue is\r
+ * through a queue called the timer command queue. The timer command queue is\r
* private to the kernel itself and is not directly accessible to application\r
* code. The length of the timer command queue is set by the\r
* configTIMER_QUEUE_LENGTH configuration constant.\r
*\r
* Timer functionality is provided by a timer service/daemon task. Many of the\r
* public FreeRTOS timer API functions send commands to the timer service task\r
- * though a queue called the timer command queue. The timer command queue is\r
+ * through a queue called the timer command queue. The timer command queue is\r
* private to the kernel itself and is not directly accessible to application\r
* code. The length of the timer command queue is set by the\r
* configTIMER_QUEUE_LENGTH configuration constant.\r
*\r
* Timer functionality is provided by a timer service/daemon task. Many of the\r
* public FreeRTOS timer API functions send commands to the timer service task\r
- * though a queue called the timer command queue. The timer command queue is\r
+ * through a queue called the timer command queue. The timer command queue is\r
* private to the kernel itself and is not directly accessible to application\r
* code. The length of the timer command queue is set by the\r
* configTIMER_QUEUE_LENGTH configuration constant.\r
*\r
* Timer functionality is provided by a timer service/daemon task. Many of the\r
* public FreeRTOS timer API functions send commands to the timer service task\r
- * though a queue called the timer command queue. The timer command queue is\r
+ * through a queue called the timer command queue. The timer command queue is\r
* private to the kernel itself and is not directly accessible to application\r
* code. The length of the timer command queue is set by the\r
* configTIMER_QUEUE_LENGTH configuration constant.\r
* if( xHigherPriorityTaskWoken != pdFALSE )\r
* {\r
* // Call the interrupt safe yield function here (actual function\r
- * // depends on the FreeRTOS port being used.\r
+ * // depends on the FreeRTOS port being used).\r
* }\r
* }\r
* @endverbatim\r
* if( xHigherPriorityTaskWoken != pdFALSE )\r
* {\r
* // Call the interrupt safe yield function here (actual function\r
- * // depends on the FreeRTOS port being used.\r
+ * // depends on the FreeRTOS port being used).\r
* }\r
* }\r
* @endverbatim\r
* if( xHigherPriorityTaskWoken != pdFALSE )\r
* {\r
* // Call the interrupt safe yield function here (actual function\r
- * // depends on the FreeRTOS port being used.\r
+ * // depends on the FreeRTOS port being used).\r
* }\r
* }\r
* @endverbatim\r
* if( xHigherPriorityTaskWoken != pdFALSE )\r
* {\r
* // Call the interrupt safe yield function here (actual function\r
- * // depends on the FreeRTOS port being used.\r
+ * // depends on the FreeRTOS port being used).\r
* }\r
* }\r
* @endverbatim\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem )\r
{\r
-xListItem * pxIndex;\r
+xListItem * const pxIndex = pxList->pxIndex;\r
\r
/* Insert a new list item into pxList, but rather than sort the list,\r
makes the new list item the last item to be removed by a call to\r
- pvListGetOwnerOfNextEntry. */\r
- pxIndex = pxList->pxIndex;\r
-\r
+ listGET_OWNER_OF_NEXT_ENTRY(). */\r
pxNewListItem->pxNext = pxIndex;\r
pxNewListItem->pxPrevious = pxIndex->pxPrevious;\r
pxIndex->pxPrevious->pxNext = pxNewListItem;\r
void vListInsert( xList * const pxList, xListItem * const pxNewListItem )\r
{\r
xListItem *pxIterator;\r
-portTickType xValueOfInsertion;\r
+const portTickType xValueOfInsertion = pxNewListItem->xItemValue;\r
\r
- /* Insert the new list item into the list, sorted in ulListItem order. */\r
- xValueOfInsertion = pxNewListItem->xItemValue;\r
+ /* Insert the new list item into the list, sorted in xItemValue order.\r
\r
- /* If the list already contains a list item with the same item value then\r
+ If the list already contains a list item with the same item value then\r
the new list item should be placed after it. This ensures that TCB's which\r
- are stored in ready lists (all of which have the same ulListItem value)\r
+ are stored in ready lists (all of which have the same xItemValue value)\r
get an equal share of the CPU. However, if the xItemValue is the same as\r
the back marker the iteration loop below will not end. This means we need\r
to guard against this by checking the value first and modifying the\r
\r
unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove )\r
{\r
-xList * pxList;\r
+/* The list item knows which list it is in. Obtain the list from the list\r
+item. */\r
+xList * const pxList = ( xList * ) pxItemToRemove->pvContainer;\r
\r
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;\r
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;\r
\r
- /* The list item knows which list it is in. Obtain the list from the list\r
- item. */\r
- pxList = ( xList * ) pxItemToRemove->pvContainer;\r
-\r
/* Make sure the index is left pointing to a valid item. */\r
if( pxList->pxIndex == pxItemToRemove )\r
{\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
*/\r
void vPortEndScheduler(void)\r
{\r
- /* It is unlikely that the port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( ulCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
\r
/*-----------------------------------------------------------*/ \r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
" pop {pc} \n" /* Finally, pop the PC to jump to the user defined task code. */\r
" \n"\r
" .align 2 \n"\r
- "pxCurrentTCBConst2: .word pxCurrentTCB " \r
+ "pxCurrentTCBConst2: .word pxCurrentTCB "\r
);\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* Start the first task. */\r
vPortStartFirstTask();\r
- \r
+\r
/* Should never get here as the tasks will now be executing! Call the task\r
exit error function to prevent compiler warnings about a static function\r
not being called in the case that the application writer overrides this\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM0 port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM3 port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
{\r
portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();\r
\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
\r
/* ------------------------ Architecture specifics ------------------------ */\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
#include <xil_exception.h>\r
#include <microblaze_exceptions_g.h>\r
\r
-/* Tasks are started with a critical section nesting of 0 - however, prior to \r
-the scheduler being commenced interrupts should not be enabled, so the critical \r
+/* Tasks are started with a critical section nesting of 0 - however, prior to\r
+the scheduler being commenced interrupts should not be enabled, so the critical\r
nesting variable is initialised to a non-zero value. */\r
#define portINITIAL_NESTING_VALUE ( 0xff )\r
\r
*/\r
static long prvInitialiseInterruptController( void );\r
\r
-/* Ensure the interrupt controller instance variable is initialised before it is \r
- * used, and that the initialisation only happens once. \r
+/* Ensure the interrupt controller instance variable is initialised before it is\r
+ * used, and that the initialisation only happens once.\r
*/\r
static long prvEnsureInterruptControllerIsInitialised( void );\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task \r
+/* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task\r
maintains its own count, so this variable is saved as part of the task\r
context. */\r
volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE;\r
get set to 1. ulTaskSwitchRequested is inspected just before the main interrupt\r
handler exits. If, at that time, ulTaskSwitchRequested is set to 1, the kernel\r
will call vTaskSwitchContext() to ensure the task that runs immediately after\r
-the interrupt exists is the highest priority task that is able to run. This is \r
-an unusual mechanism, but is used for this port because a single interrupt can \r
+the interrupt exists is the highest priority task that is able to run. This is\r
+an unusual mechanism, but is used for this port because a single interrupt can\r
cause the servicing of multiple peripherals - and it is inefficient to call\r
vTaskSwitchContext() multiple times as each peripheral is serviced. */\r
volatile unsigned long ulTaskSwitchRequested = 0UL;\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* \r
- * Initialise the stack of a task to look exactly as if a call to \r
+/*\r
+ * Initialise the stack of a task to look exactly as if a call to\r
* portSAVE_CONTEXT had been made.\r
- * \r
+ *\r
* See the portable.h header file.\r
*/\r
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
const unsigned long ulR2 = ( unsigned long ) &_SDA2_BASE_;\r
const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;\r
\r
- /* Place a few bytes of known values on the bottom of the stack. \r
+ /* Place a few bytes of known values on the bottom of the stack.\r
This is essential for the Microblaze port and these lines must\r
not be omitted. */\r
*pxTopOfStack = ( portSTACK_TYPE ) 0x00000000;\r
/* First stack an initial value for the critical section nesting. This\r
is initialised to zero. */\r
*pxTopOfStack = ( portSTACK_TYPE ) 0x00;\r
- \r
+\r
/* R0 is always zero. */\r
/* R1 is the SP. */\r
\r
#else\r
pxTopOfStack-= 8;\r
#endif\r
- \r
+\r
*pxTopOfStack = ( portSTACK_TYPE ) ulR13; /* R13 - read/write small data area. */\r
pxTopOfStack--;\r
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14 - return address for interrupt. */\r
pxTopOfStack--;\r
*pxTopOfStack = ( portSTACK_TYPE ) NULL; /* R15 - return address for subroutine. */\r
- \r
+\r
#ifdef portPRE_LOAD_STACK_FOR_DEBUGGING\r
pxTopOfStack--;\r
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16 - return address for trap (debugger). */\r
#else\r
pxTopOfStack -= 4;\r
#endif\r
- \r
+\r
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R19 - must be saved across function calls. Callee-save. Seems to be interpreted as the frame pointer. */\r
- \r
- #ifdef portPRE_LOAD_STACK_FOR_DEBUGGING \r
+\r
+ #ifdef portPRE_LOAD_STACK_FOR_DEBUGGING\r
pxTopOfStack--;\r
*pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */\r
pxTopOfStack--;\r
pxTopOfStack -= 13;\r
#endif\r
\r
- /* Return a pointer to the top of the stack that has been generated so this \r
+ /* Return a pointer to the top of the stack that has been generated so this\r
can be stored in the task control block for the task. */\r
return pxTopOfStack;\r
}\r
extern unsigned long _stack[];\r
\r
/* Setup the hardware to generate the tick. Interrupts are disabled when\r
- this function is called. \r
- \r
+ this function is called.\r
+\r
This port uses an application defined callback function to install the tick\r
- interrupt handler because the kernel will run on lots of different \r
- MicroBlaze and FPGA configurations - not all of which will have the same \r
+ interrupt handler because the kernel will run on lots of different\r
+ MicroBlaze and FPGA configurations - not all of which will have the same\r
timer peripherals defined or available. An example definition of\r
vApplicationSetupTimerInterrupt() is provided in the official demo\r
application that accompanies this port. */\r
\r
void vPortEndScheduler( void )\r
{\r
- /* Not implemented. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- * Manual context switch called by portYIELD or taskYIELD. \r
+ * Manual context switch called by portYIELD or taskYIELD.\r
*/\r
void vPortYield( void )\r
{\r
{\r
XIntc_Enable( &xInterruptControllerInstance, ucInterruptID );\r
}\r
- \r
+\r
configASSERT( lReturn );\r
}\r
/*-----------------------------------------------------------*/\r
controller because the interrupt controller instance variable is private\r
to this file. */\r
lReturn = prvEnsureInterruptControllerIsInitialised();\r
- \r
+\r
if( lReturn == pdPASS )\r
{\r
XIntc_Disable( &xInterruptControllerInstance, ucInterruptID );\r
}\r
- \r
+\r
configASSERT( lReturn );\r
}\r
/*-----------------------------------------------------------*/\r
{\r
long lReturn;\r
\r
- /* An API function is provided to install an interrupt handler because the \r
+ /* An API function is provided to install an interrupt handler because the\r
interrupt controller instance variable is private to this file. */\r
\r
lReturn = prvEnsureInterruptControllerIsInitialised();\r
- \r
+\r
if( lReturn == pdPASS )\r
{\r
lReturn = XIntc_Connect( &xInterruptControllerInstance, ucInterruptID, pxHandler, pvCallBackRef );\r
{\r
lReturn = pdPASS;\r
}\r
- \r
+\r
configASSERT( lReturn == pdPASS );\r
\r
return lReturn;\r
if( lInterruptControllerInitialised != pdTRUE )\r
{\r
lReturn = prvInitialiseInterruptController();\r
- \r
+\r
if( lReturn == pdPASS )\r
{\r
lInterruptControllerInitialised = pdTRUE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-/* \r
+/*\r
* Handler for the timer interrupt. This is the handler that the application\r
* defined callback function vApplicationSetupTimerInterrupt() should install.\r
*/\r
( void ) pvUnused;\r
\r
/* This port uses an application defined callback function to clear the tick\r
- interrupt because the kernel will run on lots of different MicroBlaze and \r
- FPGA configurations - not all of which will have the same timer peripherals \r
+ interrupt because the kernel will run on lots of different MicroBlaze and\r
+ FPGA configurations - not all of which will have the same timer peripherals\r
defined or available. An example definition of\r
vApplicationClearTimerInterrupt() is provided in the official demo\r
- application that accompanies this port. */ \r
+ application that accompanies this port. */\r
vApplicationClearTimerInterrupt();\r
\r
/* Increment the RTOS tick - this might cause a task to unblock. */\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* Not implemented as there is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( pxCurrentTCB == NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* Tasks should start with interrupts enabled and in Supervisor mode, therefore \r
+/* Tasks should start with interrupts enabled and in Supervisor mode, therefore\r
PSW is set with U and I set, and PM and IPL clear. */\r
#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 )\r
#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 )\r
\r
/* These macros allow a critical section to be added around the call to\r
-xTaskIncrementTick(), which is only ever called from interrupts at the kernel \r
-priority - ie a known priority. Therefore these local macros are a slight \r
-optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros, \r
+xTaskIncrementTick(), which is only ever called from interrupts at the kernel\r
+priority - ie a known priority. Therefore these local macros are a slight\r
+optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros,\r
which would require the old IPL to be read first and stored in a local variable. */\r
#define portDISABLE_INTERRUPTS_FROM_KERNEL_ISR() __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) )\r
#define portENABLE_INTERRUPTS_FROM_KERNEL_ISR() __asm volatile ( "MVTIPL %0" ::"i"(configKERNEL_INTERRUPT_PRIORITY) )\r
\r
/*\r
* Function to start the first task executing - written in asm code as direct\r
- * access to registers is required. \r
+ * access to registers is required.\r
*/\r
static void prvStartFirstTask( void ) __attribute__((naked));\r
\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* \r
- * See header file for description. \r
+/*\r
+ * See header file for description.\r
*/\r
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
{\r
/* R0 is not included as it is the stack pointer. */\r
- \r
+\r
*pxTopOfStack = 0x00;\r
pxTopOfStack--;\r
*pxTopOfStack = portINITIAL_PSW;\r
pxTopOfStack--;\r
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;\r
- \r
+\r
/* When debugging it can be useful if every register is set to a known\r
value. Otherwise code space can be saved by just setting the registers\r
that need to be set. */\r
pxTopOfStack -= 15;\r
}\r
#endif\r
- \r
+\r
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */\r
- pxTopOfStack--; \r
+ pxTopOfStack--;\r
*pxTopOfStack = portINITIAL_FPSW;\r
pxTopOfStack--;\r
*pxTopOfStack = 0x12345678; /* Accumulator. */\r
if( pxCurrentTCB != NULL )\r
{\r
/* Call an application function to set up the timer that will generate the\r
- tick interrupt. This way the application can decide which peripheral to \r
+ tick interrupt. This way the application can decide which peripheral to\r
use. A demo application is provided to show a suitable example. */\r
vApplicationSetupTimerInterrupt();\r
\r
- /* Enable the software interrupt. */ \r
+ /* Enable the software interrupt. */\r
_IEN( _ICU_SWINT ) = 1;\r
- \r
+\r
/* Ensure the software interrupt is clear. */\r
_IR( _ICU_SWINT ) = 0;\r
- \r
+\r
/* Ensure the software interrupt is set to the kernel priority. */\r
_IPR( _ICU_SWINT ) = configKERNEL_INTERRUPT_PRIORITY;\r
\r
\r
void vPortEndScheduler( void )\r
{\r
- /* Not implemented as there is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( pxCurrentTCB == NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
static void prvStartFirstTask( void )\r
{\r
__asm volatile\r
- ( \r
+ (\r
/* When starting the scheduler there is nothing that needs moving to the\r
interrupt stack because the function is not called from an interrupt.\r
Just ensure the current stack is the user stack. */\r
"SETPSW U \n" \\r
\r
- /* Obtain the location of the stack associated with which ever task \r
+ /* Obtain the location of the stack associated with which ever task\r
pxCurrentTCB is currently pointing to. */\r
"MOV.L #_pxCurrentTCB, R15 \n" \\r
"MOV.L [R15], R15 \n" \\r
"MOV.L [R15], R0 \n" \\r
\r
- /* Restore the registers from the stack of the task pointed to by \r
+ /* Restore the registers from the stack of the task pointed to by\r
pxCurrentTCB. */\r
"POP R15 \n" \\r
- \r
+\r
/* Accumulator low 32 bits. */\r
"MVTACLO R15 \n" \\r
"POP R15 \n" \\r
- \r
+\r
/* Accumulator high 32 bits. */\r
"MVTACHI R15 \n" \\r
"POP R15 \n" \\r
- \r
+\r
/* Floating point status word. */\r
"MVTC R15, FPSW \n" \\r
- \r
+\r
/* R1 to R15 - R0 is not included as it is the SP. */\r
"POPM R1-R15 \n" \\r
- \r
+\r
/* This pops the remaining registers. */\r
"RTE \n" \\r
"NOP \n" \\r
"SETPSW I \n" \\r
\r
/* Move the data that was automatically pushed onto the interrupt stack when\r
- the interrupt occurred from the interrupt stack to the user stack. \r
- \r
+ the interrupt occurred from the interrupt stack to the user stack.\r
+\r
R15 is saved before it is clobbered. */\r
"PUSH.L R15 \n" \\r
- \r
+\r
/* Read the user stack pointer. */\r
"MVFC USP, R15 \n" \\r
- \r
+\r
/* Move the address down to the data being moved. */\r
"SUB #12, R15 \n" \\r
"MVTC R15, USP \n" \\r
- \r
+\r
/* Copy the data across, R15, then PC, then PSW. */\r
"MOV.L [ R0 ], [ R15 ] \n" \\r
"MOV.L 4[ R0 ], 4[ R15 ] \n" \\r
\r
/* Move the interrupt stack pointer to its new correct position. */\r
"ADD #12, R0 \n" \\r
- \r
+\r
/* All the rest of the registers are saved directly to the user stack. */\r
"SETPSW U \n" \\r
\r
/* Save the rest of the general registers (R15 has been saved already). */\r
"PUSHM R1-R14 \n" \\r
- \r
+\r
/* Save the FPSW and accumulator. */\r
"MVFC FPSW, R15 \n" \\r
"PUSH.L R15 \n" \\r
"MVFACHI R15 \n" \\r
"PUSH.L R15 \n" \\r
- \r
+\r
/* Middle word. */\r
"MVFACMI R15 \n" \\r
- \r
+\r
/* Shifted left as it is restored to the low order word. */\r
"SHLL #16, R15 \n" \\r
"PUSH.L R15 \n" \\r
"MOV.L #_pxCurrentTCB, R15 \n" \\r
"MOV.L [ R15 ], R15 \n" \\r
"MOV.L R0, [ R15 ] \n" \\r
- \r
+\r
/* Ensure the interrupt mask is set to the syscall priority while the kernel\r
structures are being accessed. */\r
"MVTIPL %0 \n" \\r
{\r
/* Re-enabled interrupts. */\r
__asm volatile( "SETPSW I" );\r
- \r
+\r
/* Increment the tick, and perform any processing the new tick value\r
necessitates. Ensure IPL is at the max syscall value first. */\r
portDISABLE_INTERRUPTS_FROM_KERNEL_ISR();\r
unsigned long ulPortGetIPL( void )\r
{\r
__asm volatile\r
- ( \r
+ (\r
"MVFC PSW, R1 \n" \\r
"SHLR #24, R1 \n" \\r
"RTS "\r
);\r
- \r
+\r
/* This will never get executed, but keeps the compiler from complaining. */\r
return 0;\r
}\r
void vPortSetIPL( unsigned long ulNewIPL )\r
{\r
__asm volatile\r
- ( \r
+ (\r
"PUSH R5 \n" \\r
"MVFC PSW, R5 \n" \\r
"SHLL #24, R1 \n" \\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*---------------------------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned long portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the ARM port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( ulCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#define portSTACK_TYPE unsigned long\r
#define portBASE_TYPE portLONG\r
typedef unsigned long portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
static void prvTaskExitError( void )\r
{\r
/* A function that implements a task must not exit or attempt to return to\r
- its caller as there is nothing to return to. If a task wants to exit it \r
+ its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
- \r
- Artificially force an assert() to be triggered if configASSERT() is \r
+\r
+ Artificially force an assert() to be triggered if configASSERT() is\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( uxCriticalNesting == ~0UL );\r
- portDISABLE_INTERRUPTS(); \r
+ portDISABLE_INTERRUPTS();\r
for( ;; );\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM0 port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
static void prvTaskExitError( void )\r
{\r
/* A function that implements a task must not exit or attempt to return to\r
- its caller as there is nothing to return to. If a task wants to exit it \r
+ its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
- \r
- Artificially force an assert() to be triggered if configASSERT() is \r
+\r
+ Artificially force an assert() to be triggered if configASSERT() is\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( uxCriticalNesting == ~0UL );\r
- portDISABLE_INTERRUPTS(); \r
+ portDISABLE_INTERRUPTS();\r
for( ;; );\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM3 port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
/* Restart from whatever is left in the count register to complete\r
this tick period. */\r
portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG;\r
- \r
+\r
/* Restart SysTick. */\r
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;\r
- \r
+\r
/* Reset the reload register to the value required for normal tick\r
periods. */\r
portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL;\r
if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )\r
{\r
unsigned long ulCalculatedLoadValue;\r
- \r
+\r
/* The tick interrupt has already executed, and the SysTick\r
count reloaded with ulReloadValue. Reset the\r
portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick\r
period. */\r
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );\r
\r
- /* Don't allow a tiny value, or values that have somehow \r
- underflowed because the post sleep hook did something \r
+ /* Don't allow a tiny value, or values that have somehow\r
+ underflowed because the post sleep hook did something\r
that took too long. */\r
if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) )\r
{\r
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL );\r
}\r
- \r
+\r
portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue;\r
- \r
+\r
/* The tick interrupt handler will already have pended the tick\r
processing in the kernel. As the pending tick will be\r
processed as soon as this function exits, the tick value\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM4F port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )\r
{\r
unsigned long ulCalculatedLoadValue;\r
- \r
+\r
/* The tick interrupt has already executed, and the SysTick\r
count reloaded with ulReloadValue. Reset the\r
portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick\r
period. */\r
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );\r
\r
- /* Don't allow a tiny value, or values that have somehow \r
- underflowed because the post sleep hook did something \r
+ /* Don't allow a tiny value, or values that have somehow\r
+ underflowed because the post sleep hook did something\r
that took too long. */\r
if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) )\r
{\r
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL );\r
}\r
- \r
+\r
portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue;\r
- \r
+\r
/* The tick interrupt handler will already have pended the tick\r
processing in the kernel. As the pending tick will be\r
processed as soon as this function exits, the tick value\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
\r
/*-----------------------------------------------------------*/\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
\r
/*-----------------------------------------------------------*/ \r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
\r
/*-----------------------------------------------------------*/ \r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned long portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* Not implemented as there is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( pxCurrentTCB == NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* Not implemented as there is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( pxCurrentTCB == NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the scheduler for the PIC port will get stopped\r
- once running. If required disable the tick interrupt here, then return\r
- to xPortStartScheduler(). */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortEndScheduler(void)\r
{\r
- /* It is unlikely that the scheduler for the PIC port will get stopped\r
- once running. If required disable the tick interrupt here, then return\r
- to xPortStartScheduler(). */\r
- for( ;; );\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxInterruptNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned long portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortEndScheduler(void)\r
{\r
- /* It is unlikely that the scheduler for the PIC port will get stopped\r
- once running. If required disable the tick interrupt here, then return\r
- to xPortStartScheduler(). */\r
- for( ;; );\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxInterruptNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned long portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
\r
/* Hardware specifics. */\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
setting. See the comments in vPortValidateInterruptPriority() below for\r
more information. */\r
configASSERT( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE );\r
- \r
+\r
if( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE )\r
- { \r
+ {\r
/* Start the timer that generates the tick ISR. */\r
configSETUP_TICK_INTERRUPT();\r
\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the ARM port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( ulCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned long portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
static void prvTaskExitError( void )\r
{\r
/* A function that implements a task must not exit or attempt to return to\r
- its caller as there is nothing to return to. If a task wants to exit it \r
+ its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
- \r
- Artificially force an assert() to be triggered if configASSERT() is \r
+\r
+ Artificially force an assert() to be triggered if configASSERT() is\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( uxCriticalNesting == ~0UL );\r
- portDISABLE_INTERRUPTS(); \r
+ portDISABLE_INTERRUPTS();\r
for( ;; );\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vPortSVCHandler( void )\r
{\r
- /* This function is no longer used, but retained for backward \r
+ /* This function is no longer used, but retained for backward\r
compatibility. */\r
}\r
/*-----------------------------------------------------------*/\r
__asm void prvPortStartFirstTask( void )\r
{\r
extern pxCurrentTCB;\r
- \r
+\r
PRESERVE8\r
- \r
+\r
/* The MSP stack is not reset as, unlike on M3/4 parts, there is no vector\r
table offset register that can be used to locate the initial stack value.\r
Not all M0 parts have the application vector table at address 0. */\r
- \r
+\r
ldr r3, =pxCurrentTCB /* Obtain location of pxCurrentTCB. */\r
- ldr r1, [r3] \r
+ ldr r1, [r3]\r
ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */\r
adds r0, #32 /* Discard everything up to r0. */\r
msr psp, r0 /* This is now the new top of stack to use in the task. */\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM0 port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
#endif /* configUSE_TICKLESS_IDLE */\r
\r
/*\r
- * Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure \r
+ * Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure\r
* FreeRTOS API functions are not called from interrupts that have been assigned\r
* a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.\r
*/\r
static void prvTaskExitError( void )\r
{\r
/* A function that implements a task must not exit or attempt to return to\r
- its caller as there is nothing to return to. If a task wants to exit it \r
+ its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
- \r
- Artificially force an assert() to be triggered if configASSERT() is \r
+\r
+ Artificially force an assert() to be triggered if configASSERT() is\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( uxCriticalNesting == ~0UL );\r
- portDISABLE_INTERRUPTS(); \r
+ portDISABLE_INTERRUPTS();\r
for( ;; );\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM3 port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
/* Restart from whatever is left in the count register to complete\r
this tick period. */\r
portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG;\r
- \r
+\r
/* Restart SysTick. */\r
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;\r
- \r
+\r
/* Reset the reload register to the value required for normal tick\r
periods. */\r
portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL;\r
if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )\r
{\r
unsigned long ulCalculatedLoadValue;\r
- \r
+\r
/* The tick interrupt has already executed, and the SysTick\r
count reloaded with ulReloadValue. Reset the\r
portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick\r
period. */\r
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );\r
\r
- /* Don't allow a tiny value, or values that have somehow \r
- underflowed because the post sleep hook did something \r
+ /* Don't allow a tiny value, or values that have somehow\r
+ underflowed because the post sleep hook did something\r
that took too long. */\r
if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) )\r
{\r
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL );\r
}\r
- \r
+\r
portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue;\r
- \r
+\r
/* The tick interrupt handler will already have pended the tick\r
processing in the kernel. As the pending tick will be\r
processed as soon as this function exits, the tick value\r
__asm unsigned long vPortGetIPSR( void )\r
{\r
PRESERVE8\r
- \r
+\r
mrs r0, ipsr\r
bx r14\r
}\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM4F port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( uxCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( uxCriticalNesting );\r
uxCriticalNesting--;\r
if( uxCriticalNesting == 0 )\r
{\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* Not implemented as there is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( pxCurrentTCB == NULL );\r
\r
/* The following line is just to prevent the symbol getting optimised away. */\r
( void ) vTaskSwitchContext();\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* Tasks should start with interrupts enabled and in Supervisor mode, therefore \r
+/* Tasks should start with interrupts enabled and in Supervisor mode, therefore\r
PSW is set with U and I set, and PM and IPL clear. */\r
#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 )\r
\r
\r
/*\r
* Function to start the first task executing - written in asm code as direct\r
- * access to registers is required. \r
+ * access to registers is required.\r
*/\r
static void prvStartFirstTask( void );\r
\r
\r
/*\r
* The entry point for the software interrupt handler. This is the function\r
- * that calls the inline asm function prvYieldHandler(). It is installed in \r
+ * that calls the inline asm function prvYieldHandler(). It is installed in\r
* the vector table, but the code that installs it is in prvYieldHandler rather\r
* than using a #pragma.\r
*/\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* \r
- * See header file for description. \r
+/*\r
+ * See header file for description.\r
*/\r
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
{\r
pxTopOfStack -= 15;\r
}\r
#endif\r
- \r
+\r
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */\r
- pxTopOfStack--; \r
+ pxTopOfStack--;\r
*pxTopOfStack = 0x12345678; /* Accumulator. */\r
pxTopOfStack--;\r
*pxTopOfStack = 0x87654321; /* Accumulator. */\r
if( pxCurrentTCB != NULL )\r
{\r
/* Call an application function to set up the timer that will generate the\r
- tick interrupt. This way the application can decide which peripheral to \r
+ tick interrupt. This way the application can decide which peripheral to\r
use. A demo application is provided to show a suitable example. */\r
vApplicationSetupTimerInterrupt();\r
\r
- /* Enable the software interrupt. */ \r
+ /* Enable the software interrupt. */\r
_IEN( _ICU_SWINT ) = 1;\r
- \r
+\r
/* Ensure the software interrupt is clear. */\r
_IR( _ICU_SWINT ) = 0;\r
- \r
+\r
/* Ensure the software interrupt is set to the kernel priority. */\r
_IPR( _ICU_SWINT ) = configKERNEL_INTERRUPT_PRIORITY;\r
- \r
+\r
/* Start the first task. */\r
prvStartFirstTask();\r
}\r
Just ensure the current stack is the user stack. */\r
SETPSW U\r
\r
- /* Obtain the location of the stack associated with which ever task \r
+ /* Obtain the location of the stack associated with which ever task\r
pxCurrentTCB is currently pointing to. */\r
MOV.L #_pxCurrentTCB, R15\r
MOV.L [R15], R15\r
MOV.L [R15], R0\r
\r
- /* Restore the registers from the stack of the task pointed to by \r
+ /* Restore the registers from the stack of the task pointed to by\r
pxCurrentTCB. */\r
POP R15\r
MVTACLO R15 /* Accumulator low 32 bits. */\r
SETPSW I\r
\r
/* Move the data that was automatically pushed onto the interrupt stack when\r
- the interrupt occurred from the interrupt stack to the user stack. \r
- \r
+ the interrupt occurred from the interrupt stack to the user stack.\r
+\r
R15 is saved before it is clobbered. */\r
PUSH.L R15\r
- \r
+\r
/* Read the user stack pointer. */\r
MVFC USP, R15\r
- \r
+\r
/* Move the address down to the data being moved. */\r
SUB #12, R15\r
MVTC R15, USP\r
- \r
+\r
/* Copy the data across. */\r
MOV.L [ R0 ], [ R15 ] ; R15\r
MOV.L 4[ R0 ], 4[ R15 ] ; PC\r
\r
/* Move the interrupt stack pointer to its new correct position. */\r
ADD #12, R0\r
- \r
+\r
/* All the rest of the registers are saved directly to the user stack. */\r
SETPSW U\r
\r
/* Save the rest of the general registers (R15 has been saved already). */\r
PUSHM R1-R14\r
- \r
+\r
/* Save the accumulator. */\r
MVFACHI R15\r
PUSH.L R15\r
MOV.L #_pxCurrentTCB, R15\r
MOV.L [ R15 ], R15\r
MOV.L R0, [ R15 ]\r
- \r
+\r
/* Ensure the interrupt mask is set to the syscall priority while the kernel\r
structures are being accessed. */\r
MVTIPL #configMAX_SYSCALL_INTERRUPT_PRIORITY\r
\r
void vPortEndScheduler( void )\r
{\r
- /* Not implemented as there is nothing to return to. */\r
- \r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( pxCurrentTCB == NULL );\r
+\r
/* The following line is just to prevent the symbol getting optimised away. */\r
( void ) vTaskSwitchContext();\r
}\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
void vPortEndScheduler( void )\r
{\r
- /* Not implemented as there is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( pxCurrentTCB == NULL );\r
\r
/* The following line is just to prevent the symbol getting optimised away. */\r
( void ) vTaskSwitchContext();\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
\r
/*-----------------------------------------------------------*/ \r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
/*\r
- FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
static void prvTaskExitError( void )\r
{\r
/* A function that implements a task must not exit or attempt to return to\r
- its caller as there is nothing to return to. If a task wants to exit it \r
+ its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
- \r
- Artificially force an assert() to be triggered if configASSERT() is \r
+\r
+ Artificially force an assert() to be triggered if configASSERT() is\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( ulCriticalNesting == ~0UL );\r
- portDISABLE_INTERRUPTS(); \r
+ portDISABLE_INTERRUPTS();\r
for( ;; );\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vPortEndScheduler( void )\r
{\r
- /* It is unlikely that the CM4F port will require this function as there\r
- is nothing to return to. */\r
+ /* Not implemented in ports where there is nothing to return to.\r
+ Artificially force an assert. */\r
+ configASSERT( ulCriticalNesting == 1000UL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vPortExitCritical( void )\r
{\r
+ configASSERT( ulCriticalNesting );\r
ulCriticalNesting--;\r
if( ulCriticalNesting == 0 )\r
{\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
#define portMAX_DELAY ( portTickType ) 0xffff\r
#else\r
typedef unsigned portLONG portTickType;\r
- #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffffUL\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
void *pxReturn;\r
\r
/* This function is called by xSemaphoreGetMutexHolder(), and should not\r
- be called directly. Note: This is is a good way of determining if the\r
+ be called directly. Note: This is a good way of determining if the\r
calling task is the mutex holder, but not a good way of determining the\r
identity of the mutex holder, as the holder may change between the\r
following critical section exiting and the function returning. */\r
{\r
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )\r
{\r
- portENTER_CRITICAL();\r
+ taskENTER_CRITICAL();\r
{\r
vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder );\r
}\r
- portEXIT_CRITICAL();\r
+ taskEXIT_CRITICAL();\r
}\r
}\r
#endif\r
\r
/* RTOS ports that support interrupt nesting have the concept of a maximum\r
system call (or maximum API call) interrupt priority. Interrupts that are\r
- above the maximum system call priority are keep permanently enabled, even\r
+ above the maximum system call priority are kept permanently enabled, even\r
when the RTOS kernel is in a critical section, but cannot make any calls to\r
FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h\r
then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
{\r
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )\r
{\r
- portENTER_CRITICAL();\r
+ taskENTER_CRITICAL();\r
{\r
vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder );\r
}\r
- portEXIT_CRITICAL();\r
+ taskEXIT_CRITICAL();\r
}\r
}\r
#endif\r
\r
/* RTOS ports that support interrupt nesting have the concept of a maximum\r
system call (or maximum API call) interrupt priority. Interrupts that are\r
- above the maximum system call priority are keep permanently enabled, even\r
+ above the maximum system call priority are kept permanently enabled, even\r
when the RTOS kernel is in a critical section, but cannot make any calls to\r
FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h\r
then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
\r
/* RTOS ports that support interrupt nesting have the concept of a maximum\r
system call (or maximum API call) interrupt priority. Interrupts that are\r
- above the maximum system call priority are keep permanently enabled, even\r
+ above the maximum system call priority are kept permanently enabled, even\r
when the RTOS kernel is in a critical section, but cannot make any calls to\r
FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h\r
then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
\r
#if ( INCLUDE_vTaskDelete == 1 )\r
\r
- PRIVILEGED_DATA static xList xTasksWaitingTermination; /*< Tasks that have been deleted - but the their memory not yet freed. */\r
+ PRIVILEGED_DATA static xList xTasksWaitingTermination; /*< Tasks that have been deleted - but their memory not yet freed. */\r
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTasksDeleted = ( unsigned portBASE_TYPE ) 0U;\r
\r
#endif\r
#endif /* portUSING_MPU_WRAPPERS == 1 */\r
\r
/* Calculate the top of stack address. This depends on whether the\r
- stack grows from high memory to low (as per the 80x86) or visa versa.\r
+ stack grows from high memory to low (as per the 80x86) or vice versa.\r
portSTACK_GROWTH is used to make the result positive or negative as\r
required by the port. */\r
#if( portSTACK_GROWTH < 0 )\r
\r
taskENTER_CRITICAL();\r
{\r
- /* If null is passed in here then we are deleting ourselves. */\r
+ /* If null is passed in here then it is the calling task that is\r
+ being deleted. */\r
pxTCB = prvGetTCBFromHandle( xTaskToDelete );\r
\r
/* Remove task from the ready list and place in the termination list.\r
\r
#if ( INCLUDE_vTaskDelayUntil == 1 )\r
\r
- void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement )\r
+ void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickType xTimeIncrement )\r
{\r
portTickType xTimeToWake;\r
portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE;\r
\r
#if ( INCLUDE_vTaskDelay == 1 )\r
\r
- void vTaskDelay( portTickType xTicksToDelay )\r
+ void vTaskDelay( const portTickType xTicksToDelay )\r
{\r
portTickType xTimeToWake;\r
signed portBASE_TYPE xAlreadyYielded = pdFALSE;\r
xList *pxStateList;\r
const tskTCB * const pxTCB = ( tskTCB * ) xTask;\r
\r
+ configASSERT( pxTCB );\r
+\r
if( pxTCB == pxCurrentTCB )\r
{\r
/* The task calling this function is querying its own state. */\r
\r
#if ( INCLUDE_vTaskSuspend == 1 )\r
\r
- signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask )\r
+ signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask )\r
{\r
- portBASE_TYPE xReturn = pdFALSE;\r
+ signed portBASE_TYPE xReturn = pdFALSE;\r
const tskTCB * const pxTCB = ( tskTCB * ) xTask;\r
\r
/* It does not make sense to check if the calling task is suspended. */\r
\r
/* RTOS ports that support interrupt nesting have the concept of a maximum\r
system call (or maximum API call) interrupt priority. Interrupts that are\r
- above the maximum system call priority are keep permanently enabled, even\r
+ above the maximum system call priority are kept permanently enabled, even\r
when the RTOS kernel is in a critical section, but cannot make any calls to\r
FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h\r
then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
}\r
\r
/* See if this tick has made a timeout expire. Tasks are stored in the\r
- queue in the order of their wake time - meaning once one tasks has been\r
- found whose block time has not expired there is no need not look any\r
+ queue in the order of their wake time - meaning once one task has been\r
+ found whose block time has not expired there is no need to look any\r
further down the list. */\r
if( xConstTickCount >= xNextTaskUnblockTime )\r
{\r
{\r
tskTCB *xTCB;\r
\r
- /* If xTask is NULL then we are setting our own task hook. */\r
+ /* If xTask is NULL then it is the task hook of the calling task that is\r
+ getting set. */\r
if( xTask == NULL )\r
{\r
xTCB = ( tskTCB * ) pxCurrentTCB;\r
/* Store the item value in the event list item. */\r
listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xEventListItem ), xItemValue );\r
\r
- /* Place the event list item of the TCB at the end of the appropriate event \r
+ /* Place the event list item of the TCB at the end of the appropriate event\r
list. */\r
vListInsertEnd( pxEventList, &( pxCurrentTCB->xEventListItem ) );\r
\r
}\r
else\r
{\r
- /* Cannot access the delayed or ready lists, so will hold this task \r
+ /* Cannot access the delayed or ready lists, so will hold this task\r
pending until the scheduler is resumed. */\r
vListInsertEnd( &( xPendingReadyList ), pxEventListItem );\r
}\r
}\r
else\r
{\r
- /* Just to help debugging. */\r
- ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) );\r
+ /* Avoid dependency on memset() if it is not required. */\r
+ #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )\r
+ {\r
+ /* Just to help debugging. */\r
+ ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) );\r
+ }\r
+ #endif /* ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) ) */\r
}\r
}\r
\r
\r
static unsigned short prvTaskCheckFreeStackSpace( const unsigned char * pucStackByte )\r
{\r
- unsigned short usCount = 0U;\r
+ unsigned long ulCount = 0U;\r
\r
while( *pucStackByte == tskSTACK_FILL_BYTE )\r
{\r
pucStackByte -= portSTACK_GROWTH;\r
- usCount++;\r
+ ulCount++;\r
}\r
\r
- usCount /= sizeof( portSTACK_TYPE );\r
+ ulCount /= ( unsigned long ) sizeof( portSTACK_TYPE );\r
\r
- return usCount;\r
+ return ( unsigned short ) ulCount;\r
}\r
\r
#endif /* ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) */\r
{\r
xTaskStatusType *pxTaskStatusArray;\r
volatile unsigned portBASE_TYPE uxArraySize, x;\r
- char cStatus;\r
+ signed char cStatus;\r
\r
/*\r
* PLEASE NOTE:\r
break;\r
}\r
\r
- sprintf( ( char * ) pcWriteBuffer, ( char * ) "%s\t\t%c\t%u\t%u\t%u\r\n", pxTaskStatusArray[ x ].pcTaskName, cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );\r
+ sprintf( ( char * ) pcWriteBuffer, ( char * ) "%s\t\t%c\t%u\t%u\t%u\r\n", pxTaskStatusArray[ x ].pcTaskName, ( char ) cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );\r
pcWriteBuffer += strlen( ( char * ) pcWriteBuffer );\r
}\r
\r
}\r
}\r
\r
-#endif /* configUSE_TRACE_FACILITY */\r
+#endif /* ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) */\r
/*----------------------------------------------------------*/\r
\r
#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )\r
}\r
}\r
\r
-#endif /* configGENERATE_RUN_TIME_STATS */\r
+#endif /* ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) */\r
/*-----------------------------------------------------------*/\r
\r
portTickType uxTaskResetEventItemValue( void )\r
const signed char *pcTimerName; /*<< Text name. This is not used by the kernel, it is included simply to make debugging easier. */\r
xListItem xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */\r
portTickType xTimerPeriodInTicks;/*<< How quickly and often the timer expires. */\r
- unsigned portBASE_TYPE uxAutoReload; /*<< Set to pdTRUE if the timer should be automatically restarted once expired. Set to pdFALSE if the timer is, in effect, a one shot timer. */\r
+ unsigned portBASE_TYPE uxAutoReload; /*<< Set to pdTRUE if the timer should be automatically restarted once expired. Set to pdFALSE if the timer is, in effect, a one-shot timer. */\r
void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */\r
tmrTIMER_CALLBACK pxCallbackFunction; /*<< The function that will be called when the timer expires. */\r
} xTIMER;\r
\r
/* The list in which active timers are stored. Timers are referenced in expire\r
time order, with the nearest expiry time at the front of the list. Only the\r
-timer service task is allowed to access xActiveTimerList. */\r
+timer service task is allowed to access these lists. */\r
PRIVILEGED_DATA static xList xActiveTimerList1;\r
PRIVILEGED_DATA static xList xActiveTimerList2;\r
PRIVILEGED_DATA static xList *pxCurrentTimerList;\r
{\r
/* Create the timer task, storing its handle in xTimerTaskHandle so\r
it can be returned by the xTimerGetTimerDaemonTaskHandle() function. */\r
- xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );\r
+ xReturn = xTaskCreate( prvTimerTask, ( const signed char * const ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );\r
}\r
#else\r
{\r
/* Create the timer task without storing its handle. */\r
- xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL);\r
+ xReturn = xTaskCreate( prvTimerTask, ( const signed char * const ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL);\r
}\r
#endif\r
}\r
has expired or not. If obtaining the time causes the lists to switch\r
then don't process this timer as any timers that remained in the list\r
when the lists were switched will have been processed within the\r
- prvSampelTimeNow() function. */\r
+ prvSampleTimeNow() function. */\r
xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched );\r
if( xTimerListsWereSwitched == pdFALSE )\r
{\r
pxCurrentTimerList = &xActiveTimerList1;\r
pxOverflowTimerList = &xActiveTimerList2;\r
xTimerQueue = xQueueCreate( ( unsigned portBASE_TYPE ) configTIMER_QUEUE_LENGTH, sizeof( xDAEMON_TASK_MESSAGE ) );\r
+ configASSERT( xTimerQueue );\r
+\r
+ #if ( configQUEUE_REGISTRY_SIZE > 0 )\r
+ {\r
+ if( xTimerQueue != NULL )\r
+ {\r
+ vQueueAddToRegistry( xTimerQueue, ( signed char * ) "TmrQ" );\r
+ }\r
+ }\r
+ #endif /* configQUEUE_REGISTRY_SIZE */\r
}\r
}\r
taskEXIT_CRITICAL();\r