Move a configASSERT() call in timers.c to prevent a "condition is always true" compiler warning.
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2039
1d2547de-c912-0410-9cb9-
b8ca96c0e9e2
*/\r
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;\r
\r
*/\r
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;\r
\r
+/**\r
+ * queue. h\r
+ * <pre>unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue );</pre>\r
+ *\r
+ * Return the number of free spaces available in a queue. This is equal to the\r
+ * number of items that can be sent to the queue before the queue becomes full\r
+ * if no items are removed.\r
+ *\r
+ * @param xQueue A handle to the queue being queried.\r
+ *\r
+ * @return The number of spaces available in the queue.\r
+ *\r
+ * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting\r
+ * \ingroup QueueManagement\r
+ */\r
+unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;\r
+\r
/**\r
* queue. h\r
* <pre>void vQueueDelete( xQueueHandle xQueue );</pre>\r
/**\r
* queue. h\r
* <pre>void vQueueDelete( xQueueHandle xQueue );</pre>\r
\r
traceTAKE_MUTEX_RECURSIVE( pxMutex );\r
\r
\r
traceTAKE_MUTEX_RECURSIVE( pxMutex );\r
\r
- if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Cast is not redundant as xTaskHandle is a typedef. */\r
+ if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Cast is not redundant as xTaskHandle is a typedef. */\r
{\r
( pxMutex->u.uxRecursiveCallCount )++;\r
xReturn = pdPASS;\r
{\r
( pxMutex->u.uxRecursiveCallCount )++;\r
xReturn = pdPASS;\r
- /* Entry time was already set. */ \r
+ /* Entry time was already set. */\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
\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 keep permanently enabled, even\r
when the RTOS kernel is in a critical section, but cannot make any calls to\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
+ FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h\r
then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
failure if a FreeRTOS API function is called from an interrupt that has been\r
assigned a priority above the configured maximum system call priority.\r
Only FreeRTOS functions that end in FromISR can be called from interrupts\r
then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
failure if a FreeRTOS API function is called from an interrupt that has been\r
assigned a priority above the configured maximum system call priority.\r
Only FreeRTOS functions that end in FromISR can be called from interrupts\r
- that have been assigned a priority at or (logically) below the maximum \r
- system call interrupt priority. FreeRTOS maintains a separate interrupt \r
- safe API to ensure interrupt entry is as fast and as simple as possible. \r
- More information (albeit Cortex-M specific) is provided on the following \r
+ that have been assigned a priority at or (logically) below the maximum\r
+ system call interrupt priority. FreeRTOS maintains a separate interrupt\r
+ safe API to ensure interrupt entry is as fast and as simple as possible.\r
+ More information (albeit Cortex-M specific) is provided on the following\r
link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
\r
link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
\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
\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 keep permanently enabled, even\r
when the RTOS kernel is in a critical section, but cannot make any calls to\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
+ FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h\r
then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
failure if a FreeRTOS API function is called from an interrupt that has been\r
assigned a priority above the configured maximum system call priority.\r
Only FreeRTOS functions that end in FromISR can be called from interrupts\r
then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
failure if a FreeRTOS API function is called from an interrupt that has been\r
assigned a priority above the configured maximum system call priority.\r
Only FreeRTOS functions that end in FromISR can be called from interrupts\r
- that have been assigned a priority at or (logically) below the maximum \r
- system call interrupt priority. FreeRTOS maintains a separate interrupt \r
- safe API to ensure interrupt entry is as fast and as simple as possible. \r
- More information (albeit Cortex-M specific) is provided on the following \r
+ that have been assigned a priority at or (logically) below the maximum\r
+ system call interrupt priority. FreeRTOS maintains a separate interrupt\r
+ safe API to ensure interrupt entry is as fast and as simple as possible.\r
+ More information (albeit Cortex-M specific) is provided on the following\r
link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
\r
link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
\r
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */\r
/*-----------------------------------------------------------*/\r
\r
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */\r
/*-----------------------------------------------------------*/\r
\r
+unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue )\r
+{\r
+unsigned portBASE_TYPE uxReturn;\r
+xQUEUE *pxQueue;\r
+\r
+ pxQueue = ( xQUEUE * ) xQueue;\r
+ configASSERT( pxQueue );\r
+\r
+ taskENTER_CRITICAL();\r
+ uxReturn = pxQueue->uxLength - pxQueue->uxMessagesWaiting;\r
+ taskEXIT_CRITICAL();\r
+\r
+ return uxReturn;\r
+} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */\r
+/*-----------------------------------------------------------*/\r
+\r
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )\r
{\r
unsigned portBASE_TYPE uxReturn;\r
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )\r
{\r
unsigned portBASE_TYPE uxReturn;\r
if( xTimerPeriodInTicks == ( portTickType ) 0U )\r
{\r
pxNewTimer = NULL;\r
if( xTimerPeriodInTicks == ( portTickType ) 0U )\r
{\r
pxNewTimer = NULL;\r
- configASSERT( ( xTimerPeriodInTicks > 0 ) );\r
+ /* 0 is not a valid value for xTimerPeriodInTicks. */\r
+ configASSERT( ( xTimerPeriodInTicks > 0 ) );\r
+\r
return ( xTimerHandle ) pxNewTimer;\r
}\r
/*-----------------------------------------------------------*/\r
return ( xTimerHandle ) pxNewTimer;\r
}\r
/*-----------------------------------------------------------*/\r