mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-13 16:27:43 -04:00
Run unctustify, fix some Readme wording
This commit is contained in:
parent
a2029c781c
commit
0c0333985b
13 changed files with 1589 additions and 1527 deletions
|
@ -27,154 +27,158 @@
|
|||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. See
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. See
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
|
||||
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 65 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 20
|
||||
#define configUSE_APPLICATION_TASK_TAG 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
|
||||
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 65 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 20
|
||||
#define configUSE_APPLICATION_TASK_TAG 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* Software timer related configuration options. The maximum possible task
|
||||
priority is configMAX_PRIORITIES - 1. The priority of the timer task is
|
||||
deliberately set higher to ensure it is correctly capped back to
|
||||
configMAX_PRIORITIES - 1. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 20
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
* priority is configMAX_PRIORITIES - 1. The priority of the timer task is
|
||||
* deliberately set higher to ensure it is correctly capped back to
|
||||
* configMAX_PRIORITIES - 1. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 20
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
|
||||
/* Run time stats gathering configuration options. */
|
||||
unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */
|
||||
void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
|
||||
/* Co-routine related configuration options. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* This demo can use of one or more example stats formatting functions. These
|
||||
format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
readable ASCII form. See the notes in the implementation of vTaskList() within
|
||||
FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
* readable ASCII form. See the notes in the implementation of vTaskList() within
|
||||
* FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Enables the test whereby a stack larger than the total heap size is
|
||||
requested. */
|
||||
#define configSTACK_DEPTH_TYPE uint32_t
|
||||
* requested. */
|
||||
#define configSTACK_DEPTH_TYPE uint32_t
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. In most cases the linker will remove unused
|
||||
functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark2 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
* to exclude the API function. In most cases the linker will remove unused
|
||||
* functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark2 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
|
||||
#define configINCLUDE_MESSAGE_BUFFER_AMP_DEMO 0
|
||||
#define configINCLUDE_MESSAGE_BUFFER_AMP_DEMO 0
|
||||
#if ( configINCLUDE_MESSAGE_BUFFER_AMP_DEMO == 1 )
|
||||
extern void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer );
|
||||
#define sbSEND_COMPLETED( pxStreamBuffer ) vGenerateCoreBInterrupt( pxStreamBuffer )
|
||||
extern void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer );
|
||||
#define sbSEND_COMPLETED( pxStreamBuffer ) vGenerateCoreBInterrupt( pxStreamBuffer )
|
||||
#endif /* configINCLUDE_MESSAGE_BUFFER_AMP_DEMO */
|
||||
|
||||
extern void vAssertCalled( const char * const pcFileName, unsigned long ulLine );
|
||||
extern void vAssertCalled( const char * const pcFileName,
|
||||
unsigned long ulLine );
|
||||
|
||||
/* projCOVERAGE_TEST should be defined on the command line so this file can be
|
||||
used with multiple project configurations. If it is
|
||||
* used with multiple project configurations. If it is
|
||||
*/
|
||||
#ifndef projCOVERAGE_TEST
|
||||
#error projCOVERAGE_TEST should be defined to 1 or 0 on the command line.
|
||||
#error projCOVERAGE_TEST should be defined to 1 or 0 on the command line.
|
||||
#endif
|
||||
|
||||
#if( projCOVERAGE_TEST == 1 )
|
||||
/* Insert NOPs in empty decision paths to ensure both true and false paths
|
||||
are being tested. */
|
||||
#define mtCOVERAGE_TEST_MARKER() __asm volatile( "NOP" )
|
||||
#if ( projCOVERAGE_TEST == 1 )
|
||||
|
||||
/* Ensure the tick count overflows during the coverage test. */
|
||||
#define configINITIAL_TICK_COUNT 0xffffd800UL
|
||||
/* Insert NOPs in empty decision paths to ensure both true and false paths
|
||||
* are being tested. */
|
||||
#define mtCOVERAGE_TEST_MARKER() __asm volatile ( "NOP" )
|
||||
|
||||
/* Allows tests of trying to allocate more than the heap has free. */
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
/* Ensure the tick count overflows during the coverage test. */
|
||||
#define configINITIAL_TICK_COUNT 0xffffd800UL
|
||||
|
||||
/* To test builds that remove the static qualifier for debug builds. */
|
||||
#define portREMOVE_STATIC_QUALIFIER
|
||||
#else
|
||||
/* It is a good idea to define configASSERT() while developing. configASSERT()
|
||||
uses the same semantics as the standard C assert() macro. Don't define
|
||||
configASSERT() when performing code coverage tests though, as it is not
|
||||
intended to asserts() to fail, some some code is intended not to run if no
|
||||
errors are present. */
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
|
||||
/* Allows tests of trying to allocate more than the heap has free. */
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
/* To test builds that remove the static qualifier for debug builds. */
|
||||
#define portREMOVE_STATIC_QUALIFIER
|
||||
#else /* if ( projCOVERAGE_TEST == 1 ) */
|
||||
|
||||
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
|
||||
#include "trcRecorder.h"
|
||||
#endif
|
||||
/* It is a good idea to define configASSERT() while developing. configASSERT()
|
||||
* uses the same semantics as the standard C assert() macro. Don't define
|
||||
* configASSERT() when performing code coverage tests though, as it is not
|
||||
* intended to asserts() to fail, some some code is intended not to run if no
|
||||
* errors are present. */
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
|
||||
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
|
||||
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
|
||||
#include "trcRecorder.h"
|
||||
#endif /* if ( projCOVERAGE_TEST == 1 ) */
|
||||
|
||||
/* networking definitions */
|
||||
#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
|
||||
/* Prototype for the function used to print out. In this case it prints to the
|
||||
console before the network is connected then a UDP port after the network has
|
||||
connected. */
|
||||
extern void vLoggingPrintf( const char *pcFormatString, ... );
|
||||
* console before the network is connected then a UDP port after the network has
|
||||
* connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
|
||||
1 then FreeRTOS_debug_printf should be defined to the function used to print
|
||||
out the debugging messages. */
|
||||
#define ipconfigHAS_DEBUG_PRINTF 1
|
||||
#if( ipconfigHAS_DEBUG_PRINTF == 1 )
|
||||
#define FreeRTOS_debug_printf(X) vLoggingPrintf X
|
||||
* 1 then FreeRTOS_debug_printf should be defined to the function used to print
|
||||
* out the debugging messages. */
|
||||
#define ipconfigHAS_DEBUG_PRINTF 1
|
||||
#if ( ipconfigHAS_DEBUG_PRINTF == 1 )
|
||||
#define FreeRTOS_debug_printf( X ) vLoggingPrintf X
|
||||
#endif
|
||||
|
||||
/* Set to 1 to print out non debugging messages, for example the output of the
|
||||
FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
|
||||
then FreeRTOS_printf should be set to the function used to print out the
|
||||
messages. */
|
||||
#define ipconfigHAS_PRINTF 0
|
||||
#if( ipconfigHAS_PRINTF == 1 )
|
||||
#define FreeRTOS_printf(X) vLoggingPrintf X
|
||||
* FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
|
||||
* then FreeRTOS_printf should be set to the function used to print out the
|
||||
* messages. */
|
||||
#define ipconfigHAS_PRINTF 0
|
||||
#if ( ipconfigHAS_PRINTF == 1 )
|
||||
#define FreeRTOS_printf( X ) vLoggingPrintf X
|
||||
#endif
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
|
|
@ -63,7 +63,7 @@ SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/streamp
|
|||
|
||||
CFLAGS := -ggdb3 -DprojCOVERAGE_TEST=0 -D_WINDOWS_
|
||||
LDFLAGS := -ggdb3 -pthread
|
||||
CPPFLAGS := $(INCLUDE_DIRS) -DBUILD_DIR=\"$(BUILD_DIR_ABS)\"
|
||||
CPPFLAGS := $(INCLUDE_DIRS) -DBUILD_DIR=\"$(BUILD_DIR_ABS)\"
|
||||
|
||||
ifdef PROFILE
|
||||
CFLAGS += -pg -O0
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
## Introduction [(from the official gprof doc)](https://sourceware.org/binutils/docs/gprof/Introduction.html#Introduction)
|
||||
Profiling allows you to learn where your program spent its time and which
|
||||
functions called which other functions while it was executing. This information
|
||||
functions called which other functions while it was executing. This information
|
||||
can show you which pieces of your program are slower than you expected, and
|
||||
might be candidates for rewriting to make your program execute faster. It can
|
||||
might be candidates for rewriting to make your program execute faster. It can
|
||||
also tell you which functions are being called more or less often than you
|
||||
expected. This may help you spot bugs that had otherwise been unnoticed.
|
||||
expected. This may help you spot bugs that had otherwise been unnoticed.
|
||||
|
||||
## Requirements
|
||||
### gprof
|
||||
|
@ -25,26 +25,33 @@ Run your application
|
|||
$ ./build/possix_demo
|
||||
```
|
||||
Since FreeRTOS and its application never come to an end and typically run
|
||||
forever. The user has to kill the application with **Ctrl_C** when they feel
|
||||
satisfied that the application achieved its indented task. Killing the
|
||||
forever. The user has to kill the application with **Ctrl_C** when they feel
|
||||
satisfied that the application achieved its intented task. Killing the
|
||||
application will force the profiling file *gmon.out* to be generated
|
||||
automatically.
|
||||
In order to make sense of this file, the user has to convert the file with:
|
||||
```
|
||||
$ make profile
|
||||
```
|
||||
two (2) files *prof_call_graph.txt* and *prof_flat.txt* will be generated in the
|
||||
build directory.
|
||||
After running the previous command, two (2) profiling files
|
||||
*prof_call_graph.txt* and *prof_flat.txt* will be generated and placed in
|
||||
the build directory.
|
||||
* *prof_call_graph.txt*: The call graph shows which functions called which
|
||||
others, and how much time each function used when its subroutine calls are
|
||||
included.
|
||||
* *prof_flat.txt*: The flat profile shows how much time was spent
|
||||
executing directly in each function.
|
||||
In order to understand the outputs generated, the best way is to read the
|
||||
official documentation of gprof [here](https://sourceware.org/binutils/docs/gprof/Output.html#Output)
|
||||
official documentation of gprof
|
||||
[here](https://sourceware.org/binutils/docs/gprof/Output.html#Output)
|
||||
|
||||
|
||||
# Run your application with Sanitizers
|
||||
## Introduction
|
||||
* AddressSanitizer, a fast memory error detector. Memory
|
||||
* AddressSanitizer, a fast memory error detector. Memory
|
||||
access instructions are instrumented to detect out-of-bounds and use-after-free
|
||||
bugs
|
||||
* LeakSanitizer, a memory leak detector. This option only matters for linking of
|
||||
* LeakSanitizer, a memory leak detector. This option only matters for linking of
|
||||
executables and the executable is linked against a library that overrides malloc
|
||||
and other allocator functions
|
||||
|
||||
|
|
|
@ -88,527 +88,557 @@ static BaseType_t prvTimerQuery( void );
|
|||
|
||||
static BaseType_t prvStaticAllocationsWithNullBuffers( void )
|
||||
{
|
||||
uintptr_t ulReturned = 0;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxDummy = 10;
|
||||
uintptr_t ulReturned = 0;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxDummy = 10;
|
||||
|
||||
/* Don't expect to create any of the objects as a NULL parameter is always
|
||||
passed in place of a required buffer. Hence if all passes then none of the
|
||||
|= will be against 0, and ulReturned will still be zero at the end of this
|
||||
function. */
|
||||
ulReturned |= ( uintptr_t ) xEventGroupCreateStatic( NULL );
|
||||
/* Don't expect to create any of the objects as a NULL parameter is always
|
||||
* passed in place of a required buffer. Hence if all passes then none of the
|
||||
|= will be against 0, and ulReturned will still be zero at the end of this
|
||||
* function. */
|
||||
ulReturned |= ( uintptr_t ) xEventGroupCreateStatic( NULL );
|
||||
|
||||
/* Try creating a task twice, once with puxStackBuffer NULL, and once with
|
||||
pxTaskBuffer NULL. */
|
||||
ulReturned |= ( uintptr_t ) xTaskCreateStatic( NULL, /* Task to run, not needed as the task is not created. */
|
||||
"Dummy", /* Task name. */
|
||||
configMINIMAL_STACK_SIZE,
|
||||
NULL,
|
||||
tskIDLE_PRIORITY,
|
||||
NULL,
|
||||
( StaticTask_t * ) &xReturn ); /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
/* Try creating a task twice, once with puxStackBuffer NULL, and once with
|
||||
* pxTaskBuffer NULL. */
|
||||
ulReturned |= ( uintptr_t ) xTaskCreateStatic( NULL, /* Task to run, not needed as the task is not created. */
|
||||
"Dummy", /* Task name. */
|
||||
configMINIMAL_STACK_SIZE,
|
||||
NULL,
|
||||
tskIDLE_PRIORITY,
|
||||
NULL,
|
||||
( StaticTask_t * ) &xReturn ); /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
|
||||
ulReturned |= ( uintptr_t ) xTaskCreateStatic( NULL, /* Task to run, not needed as the task is not created. */
|
||||
"Dummy", /* Task name. */
|
||||
configMINIMAL_STACK_SIZE,
|
||||
NULL,
|
||||
tskIDLE_PRIORITY,
|
||||
( StackType_t * ) &xReturn, /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
NULL );
|
||||
ulReturned |= ( uintptr_t ) xTaskCreateStatic( NULL, /* Task to run, not needed as the task is not created. */
|
||||
"Dummy", /* Task name. */
|
||||
configMINIMAL_STACK_SIZE,
|
||||
NULL,
|
||||
tskIDLE_PRIORITY,
|
||||
( StackType_t * ) &xReturn, /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
NULL );
|
||||
|
||||
ulReturned |= ( uintptr_t ) xQueueCreateStatic( uxDummy,
|
||||
uxDummy,
|
||||
( uint8_t * ) &xReturn, /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
NULL );
|
||||
ulReturned |= ( uintptr_t ) xQueueCreateStatic( uxDummy,
|
||||
uxDummy,
|
||||
( uint8_t * ) &xReturn, /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
NULL );
|
||||
|
||||
/* Try creating a stream buffer twice, once with pucStreamBufferStorageArea
|
||||
set to NULL, and once with pxStaticStreamBuffer set to NULL. */
|
||||
ulReturned |= ( uintptr_t ) xStreamBufferCreateStatic( uxDummy,
|
||||
uxDummy,
|
||||
NULL,
|
||||
( StaticStreamBuffer_t * ) &xReturn ); /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
/* Try creating a stream buffer twice, once with pucStreamBufferStorageArea
|
||||
* set to NULL, and once with pxStaticStreamBuffer set to NULL. */
|
||||
ulReturned |= ( uintptr_t ) xStreamBufferCreateStatic( uxDummy,
|
||||
uxDummy,
|
||||
NULL,
|
||||
( StaticStreamBuffer_t * ) &xReturn ); /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
|
||||
ulReturned |= ( uintptr_t ) xStreamBufferCreateStatic( uxDummy,
|
||||
uxDummy,
|
||||
( uint8_t * ) &xReturn, /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
NULL );
|
||||
ulReturned |= ( uintptr_t ) xStreamBufferCreateStatic( uxDummy,
|
||||
uxDummy,
|
||||
( uint8_t * ) &xReturn, /* Dummy value just to pass a non NULL value in - won't get used. */
|
||||
NULL );
|
||||
|
||||
if( ulReturned != 0 )
|
||||
{
|
||||
/* Something returned a non-NULL value. */
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( ulReturned != 0 )
|
||||
{
|
||||
/* Something returned a non-NULL value. */
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTraceUtils( void )
|
||||
{
|
||||
EventGroupHandle_t xEventGroup;
|
||||
QueueHandle_t xQueue;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
const UBaseType_t xNumber = ( UBaseType_t ) 100, xQueueLength = ( UBaseType_t ) 1;
|
||||
UBaseType_t uxValue;
|
||||
TaskHandle_t xTaskHandle;
|
||||
StreamBufferHandle_t xStreamBuffer;
|
||||
MessageBufferHandle_t xMessageBuffer;
|
||||
EventGroupHandle_t xEventGroup;
|
||||
QueueHandle_t xQueue;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
const UBaseType_t xNumber = ( UBaseType_t ) 100, xQueueLength = ( UBaseType_t ) 1;
|
||||
UBaseType_t uxValue;
|
||||
TaskHandle_t xTaskHandle;
|
||||
StreamBufferHandle_t xStreamBuffer;
|
||||
MessageBufferHandle_t xMessageBuffer;
|
||||
|
||||
/* Exercise the event group trace utilities. */
|
||||
xEventGroup = xEventGroupCreate();
|
||||
/* Exercise the event group trace utilities. */
|
||||
xEventGroup = xEventGroupCreate();
|
||||
|
||||
if( xEventGroup != NULL )
|
||||
{
|
||||
vEventGroupSetNumber( xEventGroup, xNumber );
|
||||
if( uxEventGroupGetNumber( NULL ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxEventGroupGetNumber( xEventGroup ) != xNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xEventGroup != NULL )
|
||||
{
|
||||
vEventGroupSetNumber( xEventGroup, xNumber );
|
||||
|
||||
vEventGroupDelete( xEventGroup );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxEventGroupGetNumber( NULL ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Exercise the queue trace utilities. */
|
||||
xQueue = xQueueCreate( xQueueLength, ( UBaseType_t ) sizeof( uxValue ) );
|
||||
if( xQueue != NULL )
|
||||
{
|
||||
vQueueSetQueueNumber( xQueue, xNumber );
|
||||
if( uxQueueGetQueueNumber( xQueue ) != xNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( ucQueueGetQueueType( xQueue ) != queueQUEUE_TYPE_BASE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxEventGroupGetNumber( xEventGroup ) != xNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
vEventGroupDelete( xEventGroup );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Exercise the task trace utilities. Value of 100 is arbitrary, just want
|
||||
to check the value that is set is also read back. */
|
||||
uxValue = 100;
|
||||
xTaskHandle = xTaskGetCurrentTaskHandle();
|
||||
vTaskSetTaskNumber( xTaskHandle, uxValue );
|
||||
if( uxTaskGetTaskNumber( xTaskHandle ) != uxValue )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxTaskGetTaskNumber( NULL ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
/* Exercise the queue trace utilities. */
|
||||
xQueue = xQueueCreate( xQueueLength, ( UBaseType_t ) sizeof( uxValue ) );
|
||||
|
||||
/* Timer trace util functions are exercised in prvTimerQuery(). */
|
||||
if( xQueue != NULL )
|
||||
{
|
||||
vQueueSetQueueNumber( xQueue, xNumber );
|
||||
|
||||
if( uxQueueGetQueueNumber( xQueue ) != xNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( ucQueueGetQueueType( xQueue ) != queueQUEUE_TYPE_BASE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vQueueDelete( xQueue );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Exercise the task trace utilities. Value of 100 is arbitrary, just want
|
||||
* to check the value that is set is also read back. */
|
||||
uxValue = 100;
|
||||
xTaskHandle = xTaskGetCurrentTaskHandle();
|
||||
vTaskSetTaskNumber( xTaskHandle, uxValue );
|
||||
|
||||
if( uxTaskGetTaskNumber( xTaskHandle ) != uxValue )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( uxTaskGetTaskNumber( NULL ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Timer trace util functions are exercised in prvTimerQuery(). */
|
||||
|
||||
|
||||
/* Exercise the stream buffer utilities. Try creating with a trigger level
|
||||
of 0, it should then get capped to 1. */
|
||||
xStreamBuffer = xStreamBufferCreate( sizeof( uint32_t ), 0 );
|
||||
if( xStreamBuffer != NULL )
|
||||
{
|
||||
vStreamBufferSetStreamBufferNumber( xStreamBuffer, uxValue );
|
||||
if( uxStreamBufferGetStreamBufferNumber( xStreamBuffer ) != uxValue )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
if( ucStreamBufferGetStreamBufferType( xStreamBuffer ) != 0 )
|
||||
{
|
||||
/* "Is Message Buffer" flag should have been 0. */
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
/* Exercise the stream buffer utilities. Try creating with a trigger level
|
||||
* of 0, it should then get capped to 1. */
|
||||
xStreamBuffer = xStreamBufferCreate( sizeof( uint32_t ), 0 );
|
||||
|
||||
vStreamBufferDelete( xStreamBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
if( xStreamBuffer != NULL )
|
||||
{
|
||||
vStreamBufferSetStreamBufferNumber( xStreamBuffer, uxValue );
|
||||
|
||||
xMessageBuffer = xMessageBufferCreate( sizeof( uint32_t ) );
|
||||
if( xMessageBuffer != NULL )
|
||||
{
|
||||
if( ucStreamBufferGetStreamBufferType( xMessageBuffer ) == 0 )
|
||||
{
|
||||
/* "Is Message Buffer" flag should have been 1. */
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
if( uxStreamBufferGetStreamBufferNumber( xStreamBuffer ) != uxValue )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
vMessageBufferDelete( xMessageBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
if( ucStreamBufferGetStreamBufferType( xStreamBuffer ) != 0 )
|
||||
{
|
||||
/* "Is Message Buffer" flag should have been 0. */
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
vStreamBufferDelete( xStreamBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
xMessageBuffer = xMessageBufferCreate( sizeof( uint32_t ) );
|
||||
|
||||
if( xMessageBuffer != NULL )
|
||||
{
|
||||
if( ucStreamBufferGetStreamBufferType( xMessageBuffer ) == 0 )
|
||||
{
|
||||
/* "Is Message Buffer" flag should have been 1. */
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
vMessageBufferDelete( xMessageBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvPeekTimeout( void )
|
||||
{
|
||||
QueueHandle_t xHandle;
|
||||
const UBaseType_t xQueueLength = 1;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
TickType_t xBlockTime = ( TickType_t ) 2;
|
||||
UBaseType_t uxReceived;
|
||||
QueueHandle_t xHandle;
|
||||
const UBaseType_t xQueueLength = 1;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
TickType_t xBlockTime = ( TickType_t ) 2;
|
||||
UBaseType_t uxReceived;
|
||||
|
||||
/* Create the queue just to try peeking it while it is empty. */
|
||||
xHandle = xQueueCreate( xQueueLength, ( UBaseType_t ) sizeof( xQueueLength ) );
|
||||
/* Create the queue just to try peeking it while it is empty. */
|
||||
xHandle = xQueueCreate( xQueueLength, ( UBaseType_t ) sizeof( xQueueLength ) );
|
||||
|
||||
if( xHandle != NULL )
|
||||
{
|
||||
if( uxQueueMessagesWaiting( xHandle ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xHandle != NULL )
|
||||
{
|
||||
if( uxQueueMessagesWaiting( xHandle ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Ensure peeking from the queue times out as the queue is empty. */
|
||||
if( xQueuePeek( xHandle, &uxReceived, xBlockTime ) != pdFALSE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
/* Ensure peeking from the queue times out as the queue is empty. */
|
||||
if( xQueuePeek( xHandle, &uxReceived, xBlockTime ) != pdFALSE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vQueueDelete( xHandle );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
vQueueDelete( xHandle );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvQueueQueryFromISR( void )
|
||||
{
|
||||
BaseType_t xReturn = pdPASS, xValue = 1;
|
||||
const UBaseType_t xISRQueueLength = ( UBaseType_t ) 1;
|
||||
const char *pcISRQueueName = "ISRQueue";
|
||||
QueueHandle_t xISRQueue = NULL;
|
||||
BaseType_t xReturn = pdPASS, xValue = 1;
|
||||
const UBaseType_t xISRQueueLength = ( UBaseType_t ) 1;
|
||||
const char * pcISRQueueName = "ISRQueue";
|
||||
QueueHandle_t xISRQueue = NULL;
|
||||
|
||||
xISRQueue = xQueueCreate( xISRQueueLength, ( UBaseType_t ) sizeof( BaseType_t ) );
|
||||
xISRQueue = xQueueCreate( xISRQueueLength, ( UBaseType_t ) sizeof( BaseType_t ) );
|
||||
|
||||
if( xISRQueue != NULL )
|
||||
{
|
||||
vQueueAddToRegistry( xISRQueue, pcISRQueueName );
|
||||
if( strcmp( pcQueueGetName( xISRQueue ), pcISRQueueName ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xISRQueue != NULL )
|
||||
{
|
||||
vQueueAddToRegistry( xISRQueue, pcISRQueueName );
|
||||
|
||||
/* Expect the queue to be empty here. */
|
||||
if( uxQueueMessagesWaitingFromISR( xISRQueue ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( strcmp( pcQueueGetName( xISRQueue ), pcISRQueueName ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xQueueIsQueueEmptyFromISR( xISRQueue ) != pdTRUE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
/* Expect the queue to be empty here. */
|
||||
if( uxQueueMessagesWaitingFromISR( xISRQueue ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xQueueIsQueueFullFromISR( xISRQueue ) != pdFALSE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xQueueIsQueueEmptyFromISR( xISRQueue ) != pdTRUE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Now fill the queue - it only has one space. */
|
||||
if( xQueueSendFromISR( xISRQueue, &xValue, NULL ) != pdPASS )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xQueueIsQueueFullFromISR( xISRQueue ) != pdFALSE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Check it now reports as full. */
|
||||
if( uxQueueMessagesWaitingFromISR( xISRQueue ) != 1 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
/* Now fill the queue - it only has one space. */
|
||||
if( xQueueSendFromISR( xISRQueue, &xValue, NULL ) != pdPASS )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xQueueIsQueueEmptyFromISR( xISRQueue ) != pdFALSE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
/* Check it now reports as full. */
|
||||
if( uxQueueMessagesWaitingFromISR( xISRQueue ) != 1 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xQueueIsQueueFullFromISR( xISRQueue ) != pdTRUE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xQueueIsQueueEmptyFromISR( xISRQueue ) != pdFALSE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vQueueDelete( xISRQueue );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xQueueIsQueueFullFromISR( xISRQueue ) != pdTRUE )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
vQueueDelete( xISRQueue );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTaskQueryFunctions( void )
|
||||
{
|
||||
static TaskStatus_t xStatus, *pxStatusArray;
|
||||
TaskHandle_t xTimerTask, xIdleTask;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxNumberOfTasks, uxReturned, ux;
|
||||
uint32_t ulTotalRunTime1, ulTotalRunTime2;
|
||||
const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
|
||||
static TaskStatus_t xStatus, * pxStatusArray;
|
||||
TaskHandle_t xTimerTask, xIdleTask;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxNumberOfTasks, uxReturned, ux;
|
||||
uint32_t ulTotalRunTime1, ulTotalRunTime2;
|
||||
const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
|
||||
|
||||
/* Obtain task status with the stack high water mark and without the
|
||||
state. */
|
||||
vTaskGetInfo( NULL, &xStatus, pdTRUE, eRunning );
|
||||
/* Obtain task status with the stack high water mark and without the
|
||||
* state. */
|
||||
vTaskGetInfo( NULL, &xStatus, pdTRUE, eRunning );
|
||||
|
||||
if( uxTaskGetStackHighWaterMark( NULL ) != xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxTaskGetStackHighWaterMark( NULL ) != xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( uxTaskGetStackHighWaterMark2( NULL ) != ( configSTACK_DEPTH_TYPE ) xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxTaskGetStackHighWaterMark2( NULL ) != ( configSTACK_DEPTH_TYPE ) xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Now obtain a task status without the high water mark but with the state,
|
||||
which in the case of the idle task should be Read. */
|
||||
xTimerTask = xTimerGetTimerDaemonTaskHandle();
|
||||
vTaskSuspend( xTimerTask ); /* Should never suspend Timer task normally!. */
|
||||
vTaskGetInfo( xTimerTask, &xStatus, pdFALSE, eInvalid );
|
||||
if( xStatus.eCurrentState != eSuspended )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xStatus.uxBasePriority != uxTaskPriorityGetFromISR( xTimerTask ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xStatus.uxBasePriority != ( configMAX_PRIORITIES - 1 ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
xTaskResumeFromISR( xTimerTask );
|
||||
vTaskGetInfo( xTimerTask, &xStatus, pdTRUE, eInvalid );
|
||||
if( ( xStatus.eCurrentState != eReady ) && ( xStatus.eCurrentState != eBlocked ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxTaskGetStackHighWaterMark( xTimerTask ) != xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxTaskGetStackHighWaterMark2( xTimerTask ) != ( configSTACK_DEPTH_TYPE ) xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
/* Now obtain a task status without the high water mark but with the state,
|
||||
* which in the case of the idle task should be Read. */
|
||||
xTimerTask = xTimerGetTimerDaemonTaskHandle();
|
||||
vTaskSuspend( xTimerTask ); /* Should never suspend Timer task normally!. */
|
||||
vTaskGetInfo( xTimerTask, &xStatus, pdFALSE, eInvalid );
|
||||
|
||||
/* Attempting to abort a delay in the idle task should be guaranteed to
|
||||
fail as the idle task should never block. */
|
||||
xIdleTask = xTaskGetIdleTaskHandle();
|
||||
if( xTaskAbortDelay( xIdleTask ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xStatus.eCurrentState != eSuspended )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Create an array of task status objects large enough to hold information
|
||||
on the number of tasks at this time - note this may change at any time if
|
||||
higher priority tasks are executing and creating tasks. */
|
||||
uxNumberOfTasks = uxTaskGetNumberOfTasks();
|
||||
pxStatusArray = ( TaskStatus_t * ) pvPortMalloc( uxNumberOfTasks * sizeof( TaskStatus_t ) );
|
||||
if( xStatus.uxBasePriority != uxTaskPriorityGetFromISR( xTimerTask ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( pxStatusArray != NULL )
|
||||
{
|
||||
/* Pass part of the array into uxTaskGetSystemState() to ensure it doesn't
|
||||
try using more space than there is available. */
|
||||
uxReturned = uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks / ( UBaseType_t ) 2, NULL );
|
||||
if( uxReturned != ( UBaseType_t ) 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xStatus.uxBasePriority != ( configMAX_PRIORITIES - 1 ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Now do the same but passing in the complete array size, this is done
|
||||
twice to check for a difference in the total run time. */
|
||||
uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks, &ulTotalRunTime1 );
|
||||
memset( ( void * ) pxStatusArray, 0xaa, uxNumberOfTasks * sizeof( TaskStatus_t ) );
|
||||
uxReturned = uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks, &ulTotalRunTime2 );
|
||||
if( ( ulTotalRunTime2 - ulTotalRunTime1 ) > ulRunTimeTollerance )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
xTaskResumeFromISR( xTimerTask );
|
||||
vTaskGetInfo( xTimerTask, &xStatus, pdTRUE, eInvalid );
|
||||
|
||||
/* Basic santity check of array contents. */
|
||||
for( ux = 0; ux < uxReturned; ux++ )
|
||||
{
|
||||
if( pxStatusArray[ ux ].eCurrentState >= ( UBaseType_t ) eInvalid )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( pxStatusArray[ ux ].uxCurrentPriority >= ( UBaseType_t ) configMAX_PRIORITIES )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
}
|
||||
if( ( xStatus.eCurrentState != eReady ) && ( xStatus.eCurrentState != eBlocked ) )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vPortFree( pxStatusArray );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxTaskGetStackHighWaterMark( xTimerTask ) != xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
if( uxTaskGetStackHighWaterMark2( xTimerTask ) != ( configSTACK_DEPTH_TYPE ) xStatus.usStackHighWaterMark )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Attempting to abort a delay in the idle task should be guaranteed to
|
||||
* fail as the idle task should never block. */
|
||||
xIdleTask = xTaskGetIdleTaskHandle();
|
||||
|
||||
if( xTaskAbortDelay( xIdleTask ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Create an array of task status objects large enough to hold information
|
||||
* on the number of tasks at this time - note this may change at any time if
|
||||
* higher priority tasks are executing and creating tasks. */
|
||||
uxNumberOfTasks = uxTaskGetNumberOfTasks();
|
||||
pxStatusArray = ( TaskStatus_t * ) pvPortMalloc( uxNumberOfTasks * sizeof( TaskStatus_t ) );
|
||||
|
||||
if( pxStatusArray != NULL )
|
||||
{
|
||||
/* Pass part of the array into uxTaskGetSystemState() to ensure it doesn't
|
||||
* try using more space than there is available. */
|
||||
uxReturned = uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks / ( UBaseType_t ) 2, NULL );
|
||||
|
||||
if( uxReturned != ( UBaseType_t ) 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Now do the same but passing in the complete array size, this is done
|
||||
* twice to check for a difference in the total run time. */
|
||||
uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks, &ulTotalRunTime1 );
|
||||
memset( ( void * ) pxStatusArray, 0xaa, uxNumberOfTasks * sizeof( TaskStatus_t ) );
|
||||
uxReturned = uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks, &ulTotalRunTime2 );
|
||||
|
||||
if( ( ulTotalRunTime2 - ulTotalRunTime1 ) > ulRunTimeTollerance )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Basic santity check of array contents. */
|
||||
for( ux = 0; ux < uxReturned; ux++ )
|
||||
{
|
||||
if( pxStatusArray[ ux ].eCurrentState >= ( UBaseType_t ) eInvalid )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( pxStatusArray[ ux ].uxCurrentPriority >= ( UBaseType_t ) configMAX_PRIORITIES )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
}
|
||||
|
||||
vPortFree( pxStatusArray );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvDummyTagFunction( void *pvParameter )
|
||||
static BaseType_t prvDummyTagFunction( void * pvParameter )
|
||||
{
|
||||
return ( BaseType_t ) pvParameter;
|
||||
return ( BaseType_t ) pvParameter;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTaskTags( void )
|
||||
{
|
||||
BaseType_t xReturn = pdPASS, xParameter = ( BaseType_t ) 0xDEADBEEF;
|
||||
TaskHandle_t xTask;
|
||||
BaseType_t xReturn = pdPASS, xParameter = ( BaseType_t ) 0xDEADBEEF;
|
||||
TaskHandle_t xTask;
|
||||
|
||||
/* First try with the handle of a different task. Use the timer task for
|
||||
convenience. */
|
||||
xTask = xTimerGetTimerDaemonTaskHandle();
|
||||
/* First try with the handle of a different task. Use the timer task for
|
||||
* convenience. */
|
||||
xTask = xTimerGetTimerDaemonTaskHandle();
|
||||
|
||||
vTaskSetApplicationTaskTag( xTask, prvDummyTagFunction );
|
||||
if( xTaskGetApplicationTaskTag( xTask ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( xTaskCallApplicationTaskHook( xTask, ( void * ) xParameter ) != xParameter )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xTaskCallApplicationTaskHook( xTask, ( void * ) NULL ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
}
|
||||
vTaskSetApplicationTaskTag( xTask, prvDummyTagFunction );
|
||||
|
||||
/* Try FromISR version too. */
|
||||
if( xTaskGetApplicationTaskTagFromISR( xTask ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xTaskGetApplicationTaskTag( xTask ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( xTaskCallApplicationTaskHook( xTask, ( void * ) xParameter ) != xParameter )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Now try with a NULL handle, so using this task. */
|
||||
vTaskSetApplicationTaskTag( NULL, NULL );
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xTaskGetApplicationTaskTagFromISR( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xTaskCallApplicationTaskHook( xTask, ( void * ) NULL ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
}
|
||||
|
||||
vTaskSetApplicationTaskTag( NULL, prvDummyTagFunction );
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( xTaskCallApplicationTaskHook( NULL, ( void * ) xParameter ) != xParameter )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xTaskCallApplicationTaskHook( NULL, ( void * ) NULL ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
}
|
||||
/* Try FromISR version too. */
|
||||
if( xTaskGetApplicationTaskTagFromISR( xTask ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Try FromISR version too. */
|
||||
if( xTaskGetApplicationTaskTagFromISR( NULL ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
/* Now try with a NULL handle, so using this task. */
|
||||
vTaskSetApplicationTaskTag( NULL, NULL );
|
||||
|
||||
vTaskSetApplicationTaskTag( NULL, NULL );
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
if( xTaskGetApplicationTaskTagFromISR( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vTaskSetApplicationTaskTag( NULL, prvDummyTagFunction );
|
||||
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( xTaskCallApplicationTaskHook( NULL, ( void * ) xParameter ) != xParameter )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( xTaskCallApplicationTaskHook( NULL, ( void * ) NULL ) != pdFAIL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Try FromISR version too. */
|
||||
if( xTaskGetApplicationTaskTagFromISR( NULL ) != prvDummyTagFunction )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vTaskSetApplicationTaskTag( NULL, NULL );
|
||||
|
||||
if( xTaskGetApplicationTaskTag( NULL ) != NULL )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTimerQuery( void )
|
||||
{
|
||||
TimerHandle_t xTimer;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
const char *pcTimerName = "TestTimer";
|
||||
const TickType_t xTimerPeriod = ( TickType_t ) 100;
|
||||
const UBaseType_t uxTimerNumber = ( UBaseType_t ) 55;
|
||||
TimerHandle_t xTimer;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
const char * pcTimerName = "TestTimer";
|
||||
const TickType_t xTimerPeriod = ( TickType_t ) 100;
|
||||
const UBaseType_t uxTimerNumber = ( UBaseType_t ) 55;
|
||||
|
||||
xTimer = xTimerCreate( pcTimerName,
|
||||
xTimerPeriod,
|
||||
pdFALSE,
|
||||
( void * ) xTimerPeriod,
|
||||
NULL ); /* Not actually going to start timer so NULL callback is ok. */
|
||||
xTimer = xTimerCreate( pcTimerName,
|
||||
xTimerPeriod,
|
||||
pdFALSE,
|
||||
( void * ) xTimerPeriod,
|
||||
NULL ); /* Not actually going to start timer so NULL callback is ok. */
|
||||
|
||||
if( xTimer != NULL )
|
||||
{
|
||||
if( xTimerGetPeriod( xTimer ) != xTimerPeriod )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( xTimer != NULL )
|
||||
{
|
||||
if( xTimerGetPeriod( xTimer ) != xTimerPeriod )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
if( strcmp( pcTimerGetName( xTimer ), pcTimerName ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( strcmp( pcTimerGetName( xTimer ), pcTimerName ) != 0 )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
vTimerSetTimerNumber( xTimer, uxTimerNumber );
|
||||
if( uxTimerGetTimerNumber( xTimer ) != uxTimerNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
vTimerSetTimerNumber( xTimer, uxTimerNumber );
|
||||
|
||||
xTimerDelete( xTimer, portMAX_DELAY );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
if( uxTimerGetTimerNumber( xTimer ) != uxTimerNumber )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
xTimerDelete( xTimer, portMAX_DELAY );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xRunCodeCoverageTestAdditions( void )
|
||||
{
|
||||
BaseType_t xReturn = pdPASS;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
|
||||
xReturn &= prvStaticAllocationsWithNullBuffers();
|
||||
xReturn &= prvTraceUtils();
|
||||
xReturn &= prvPeekTimeout();
|
||||
xReturn &= prvQueueQueryFromISR();
|
||||
xReturn &= prvTaskQueryFunctions();
|
||||
xReturn &= prvTaskTags();
|
||||
xReturn &= prvTimerQuery();
|
||||
xReturn &= prvStaticAllocationsWithNullBuffers();
|
||||
xReturn &= prvTraceUtils();
|
||||
xReturn &= prvPeekTimeout();
|
||||
xReturn &= prvQueueQueryFromISR();
|
||||
xReturn &= prvTaskQueryFunctions();
|
||||
xReturn &= prvTaskTags();
|
||||
xReturn &= prvTimerQuery();
|
||||
|
||||
return xReturn;
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
*/
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Example console I/O wrappers.
|
||||
*----------------------------------------------------------*/
|
||||
* Example console I/O wrappers.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -37,22 +37,23 @@
|
|||
SemaphoreHandle_t xStdioMutex;
|
||||
StaticSemaphore_t xStdioMutexBuffer;
|
||||
|
||||
void console_init(void)
|
||||
void console_init( void )
|
||||
{
|
||||
xStdioMutex = xSemaphoreCreateMutexStatic(&xStdioMutexBuffer);
|
||||
xStdioMutex = xSemaphoreCreateMutexStatic( &xStdioMutexBuffer );
|
||||
}
|
||||
|
||||
void console_print(const char *fmt, ...)
|
||||
void console_print( const char * fmt,
|
||||
... )
|
||||
{
|
||||
va_list vargs;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
|
||||
xSemaphoreTake(xStdioMutex, portMAX_DELAY);
|
||||
va_start( vargs, fmt );
|
||||
|
||||
vprintf(fmt, vargs);
|
||||
xSemaphoreTake( xStdioMutex, portMAX_DELAY );
|
||||
|
||||
xSemaphoreGive(xStdioMutex);
|
||||
vprintf( fmt, vargs );
|
||||
|
||||
va_end(vargs);
|
||||
xSemaphoreGive( xStdioMutex );
|
||||
|
||||
va_end( vargs );
|
||||
}
|
||||
|
|
|
@ -25,21 +25,22 @@
|
|||
*/
|
||||
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Example console I/O wrappers.
|
||||
*----------------------------------------------------------*/
|
||||
* Example console I/O wrappers.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
void console_init(void);
|
||||
void console_print(const char *fmt, ...);
|
||||
void console_init( void );
|
||||
void console_print( const char * fmt,
|
||||
... );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONSOLE_H */
|
||||
|
|
|
@ -65,15 +65,15 @@
|
|||
/* Local includes. */
|
||||
#include "console.h"
|
||||
|
||||
#define BLINKY_DEMO 0
|
||||
#define FULL_DEMO 1
|
||||
#define BLINKY_DEMO 0
|
||||
#define FULL_DEMO 1
|
||||
|
||||
#define mainSELECTED_APPLICATION BLINKY_DEMO
|
||||
#define mainSELECTED_APPLICATION BLINKY_DEMO
|
||||
|
||||
#ifdef BUILD_DIR
|
||||
#define BUILD BUILD_DIR
|
||||
#define BUILD BUILD_DIR
|
||||
#else
|
||||
#define BUILD "./"
|
||||
#define BUILD "./"
|
||||
#endif
|
||||
|
||||
/* This demo uses heap_3.c (the libc provided malloc() and free()). */
|
||||
|
@ -82,6 +82,7 @@
|
|||
extern void main_blinky( void );
|
||||
extern void main_full( void );
|
||||
static void traceOnEnter( void );
|
||||
|
||||
/*
|
||||
* Only the comprehensive demo uses application hook (callback) functions. See
|
||||
* http://www.freertos.org/a00016.html for more information.
|
||||
|
@ -96,14 +97,14 @@ void vFullDemoIdleFunction( void );
|
|||
void vApplicationMallocFailedHook( void );
|
||||
void vApplicationIdleHook( void );
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char *pcTaskName );
|
||||
char * pcTaskName );
|
||||
void vApplicationTickHook( void );
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
||||
StackType_t **ppxIdleTaskStackBuffer,
|
||||
uint32_t *pulIdleTaskStackSize );
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
|
||||
StackType_t **ppxTimerTaskStackBuffer,
|
||||
uint32_t *pulTimerTaskStackSize );
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize );
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize );
|
||||
|
||||
/*
|
||||
* Writes trace data to a disk file when the trace recording is stopped.
|
||||
|
@ -115,15 +116,15 @@ static void prvSaveTraceFile( void );
|
|||
* Signal handler for Ctrl_C to cause the program to exit, and generate the
|
||||
* profiling info.
|
||||
*/
|
||||
static void handle_sigint(int signal);
|
||||
static void handle_sigint( int signal );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* When configSUPPORT_STATIC_ALLOCATION is set to 1 the application writer can
|
||||
use a callback function to optionally provide the memory required by the idle
|
||||
and timer tasks. This is the stack that will be used by the timer task. It is
|
||||
declared here, as a global, so it can be checked by a test that is implemented
|
||||
in a different file. */
|
||||
* use a callback function to optionally provide the memory required by the idle
|
||||
* and timer tasks. This is the stack that will be used by the timer task. It is
|
||||
* declared here, as a global, so it can be checked by a test that is implemented
|
||||
* in a different file. */
|
||||
StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Notes if the trace is running or not. */
|
||||
|
@ -140,34 +141,34 @@ int main( void )
|
|||
|
||||
/* Do not include trace code when performing a code coverage analysis. */
|
||||
#if ( projCOVERAGE_TEST != 1 )
|
||||
{
|
||||
/* Initialise the trace recorder. Use of the trace recorder is optional.
|
||||
See http://www.FreeRTOS.org/trace for more information. */
|
||||
vTraceEnable( TRC_START );
|
||||
{
|
||||
/* Initialise the trace recorder. Use of the trace recorder is optional.
|
||||
* See http://www.FreeRTOS.org/trace for more information. */
|
||||
vTraceEnable( TRC_START );
|
||||
|
||||
/* Start the trace recording - the recording is written to a file if
|
||||
configASSERT() is called. */
|
||||
printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );
|
||||
printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" );
|
||||
uiTraceStart();
|
||||
}
|
||||
/* Start the trace recording - the recording is written to a file if
|
||||
* configASSERT() is called. */
|
||||
printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );
|
||||
printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" );
|
||||
uiTraceStart();
|
||||
}
|
||||
#endif
|
||||
|
||||
console_init();
|
||||
#if ( mainSELECTED_APPLICATION == BLINKY_DEMO )
|
||||
{
|
||||
console_print("Starting echo blinky demo\n");
|
||||
main_blinky();
|
||||
}
|
||||
#elif ( mainSELECTED_APPLICATION == FULL_DEMO)
|
||||
{
|
||||
console_print("Starting full demo\n");
|
||||
main_full();
|
||||
}
|
||||
{
|
||||
console_print( "Starting echo blinky demo\n" );
|
||||
main_blinky();
|
||||
}
|
||||
#elif ( mainSELECTED_APPLICATION == FULL_DEMO )
|
||||
{
|
||||
console_print( "Starting full demo\n" );
|
||||
main_full();
|
||||
}
|
||||
#else
|
||||
{
|
||||
#error "The selected demo is not valid"
|
||||
}
|
||||
{
|
||||
#error "The selected demo is not valid"
|
||||
}
|
||||
#endif /* if ( mainSELECTED_APPLICATION ) */
|
||||
|
||||
return 0;
|
||||
|
@ -177,17 +178,17 @@ int main( void )
|
|||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* vApplicationMallocFailedHook() will only be called if
|
||||
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
function that will get called if a call to pvPortMalloc() fails.
|
||||
pvPortMalloc() is called internally by the kernel whenever a task, queue,
|
||||
timer or semaphore is created. It is also called by various parts of the
|
||||
demo application. If heap_1.c, heap_2.c or heap_4.c is being used, then the
|
||||
size of the heap available to pvPortMalloc() is defined by
|
||||
configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize()
|
||||
API function can be used to query the size of free heap space that remains
|
||||
(although it does not provide information on how the remaining heap might be
|
||||
fragmented). See http://www.freertos.org/a00111.html for more
|
||||
information. */
|
||||
* configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
* function that will get called if a call to pvPortMalloc() fails.
|
||||
* pvPortMalloc() is called internally by the kernel whenever a task, queue,
|
||||
* timer or semaphore is created. It is also called by various parts of the
|
||||
* demo application. If heap_1.c, heap_2.c or heap_4.c is being used, then the
|
||||
* size of the heap available to pvPortMalloc() is defined by
|
||||
* configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize()
|
||||
* API function can be used to query the size of free heap space that remains
|
||||
* (although it does not provide information on how the remaining heap might be
|
||||
* fragmented). See http://www.freertos.org/a00111.html for more
|
||||
* information. */
|
||||
vAssertCalled( __FILE__, __LINE__ );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -195,40 +196,40 @@ void vApplicationMallocFailedHook( void )
|
|||
void vApplicationIdleHook( void )
|
||||
{
|
||||
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
||||
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
task. It is essential that code added to this hook function never attempts
|
||||
to block in any way (for example, call xQueueReceive() with a block time
|
||||
specified, or call vTaskDelay()). If application tasks make use of the
|
||||
vTaskDelete() API function to delete themselves then it is also important
|
||||
that vApplicationIdleHook() is permitted to return to its calling function,
|
||||
because it is the responsibility of the idle task to clean up memory
|
||||
allocated by the kernel to any task that has since deleted itself. */
|
||||
* to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
* task. It is essential that code added to this hook function never attempts
|
||||
* to block in any way (for example, call xQueueReceive() with a block time
|
||||
* specified, or call vTaskDelay()). If application tasks make use of the
|
||||
* vTaskDelete() API function to delete themselves then it is also important
|
||||
* that vApplicationIdleHook() is permitted to return to its calling function,
|
||||
* because it is the responsibility of the idle task to clean up memory
|
||||
* allocated by the kernel to any task that has since deleted itself. */
|
||||
|
||||
|
||||
usleep(15000);
|
||||
usleep( 15000 );
|
||||
traceOnEnter();
|
||||
|
||||
#if ( mainSELECTED_APPLICATION == FULL_DEMO )
|
||||
{
|
||||
/* Call the idle task processing used by the full demo. The simple
|
||||
blinky demo does not use the idle task hook. */
|
||||
vFullDemoIdleFunction();
|
||||
}
|
||||
{
|
||||
/* Call the idle task processing used by the full demo. The simple
|
||||
* blinky demo does not use the idle task hook. */
|
||||
vFullDemoIdleFunction();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char *pcTaskName )
|
||||
char * pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
/* Run time stack overflow checking is performed if
|
||||
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
function is called if a stack overflow is detected. This function is
|
||||
provided as an example only as stack overflow checking does not function
|
||||
when running the FreeRTOS POSIX port. */
|
||||
* configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
* function is called if a stack overflow is detected. This function is
|
||||
* provided as an example only as stack overflow checking does not function
|
||||
* when running the FreeRTOS POSIX port. */
|
||||
vAssertCalled( __FILE__, __LINE__ );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -236,15 +237,15 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
|||
void vApplicationTickHook( void )
|
||||
{
|
||||
/* This function will be called by each tick interrupt if
|
||||
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
|
||||
added here, but the tick hook is called from an interrupt context, so
|
||||
code must not attempt to block, and only the interrupt safe FreeRTOS API
|
||||
functions can be used (those that end in FromISR()). */
|
||||
* configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
|
||||
* added here, but the tick hook is called from an interrupt context, so
|
||||
* code must not attempt to block, and only the interrupt safe FreeRTOS API
|
||||
* functions can be used (those that end in FromISR()). */
|
||||
|
||||
#if (mainSELECTED_APPLICATION == FULL_DEMO )
|
||||
{
|
||||
vFullDemoTickHookFunction();
|
||||
}
|
||||
#if ( mainSELECTED_APPLICATION == FULL_DEMO )
|
||||
{
|
||||
vFullDemoTickHookFunction();
|
||||
}
|
||||
#endif /* mainSELECTED_APPLICATION */
|
||||
}
|
||||
|
||||
|
@ -253,25 +254,28 @@ void traceOnEnter()
|
|||
int xReturn;
|
||||
struct timeval tv = { 0L, 0L };
|
||||
fd_set fds;
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(0, &fds);
|
||||
xReturn = select(1, &fds, NULL, NULL, &tv);
|
||||
if ( xReturn > 0 )
|
||||
|
||||
FD_ZERO( &fds );
|
||||
FD_SET( 0, &fds );
|
||||
xReturn = select( 1, &fds, NULL, NULL, &tv );
|
||||
|
||||
if( xReturn > 0 )
|
||||
{
|
||||
if( xTraceRunning == pdTRUE )
|
||||
{
|
||||
prvSaveTraceFile();
|
||||
}
|
||||
/* clear the buffer */
|
||||
char buffer[200];
|
||||
read(1, &buffer, 200);
|
||||
if( xTraceRunning == pdTRUE )
|
||||
{
|
||||
prvSaveTraceFile();
|
||||
}
|
||||
|
||||
/* clear the buffer */
|
||||
char buffer[ 200 ];
|
||||
read( 1, &buffer, 200 );
|
||||
}
|
||||
}
|
||||
|
||||
void vLoggingPrintf( const char *pcFormat,
|
||||
void vLoggingPrintf( const char * pcFormat,
|
||||
... )
|
||||
{
|
||||
va_list arg;
|
||||
va_list arg;
|
||||
|
||||
va_start( arg, pcFormat );
|
||||
vprintf( pcFormat, arg );
|
||||
|
@ -282,20 +286,20 @@ va_list arg;
|
|||
void vApplicationDaemonTaskStartupHook( void )
|
||||
{
|
||||
/* This function will be called once only, when the daemon task starts to
|
||||
execute (sometimes called the timer task). This is useful if the
|
||||
application includes initialisation code that would benefit from executing
|
||||
after the scheduler has been started. */
|
||||
* execute (sometimes called the timer task). This is useful if the
|
||||
* application includes initialisation code that would benefit from executing
|
||||
* after the scheduler has been started. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( const char * const pcFileName,
|
||||
unsigned long ulLine )
|
||||
{
|
||||
static BaseType_t xPrinted = pdFALSE;
|
||||
volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
|
||||
static BaseType_t xPrinted = pdFALSE;
|
||||
volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
|
||||
|
||||
/* Called if an assertion passed to configASSERT() fails. See
|
||||
http://www.freertos.org/a00110.html#configASSERT for more information. */
|
||||
* http://www.freertos.org/a00110.html#configASSERT for more information. */
|
||||
|
||||
/* Parameters are not used. */
|
||||
( void ) ulLine;
|
||||
|
@ -316,8 +320,8 @@ volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
|
|||
}
|
||||
|
||||
/* You can step out of this function to debug the assertion by using
|
||||
the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero
|
||||
value. */
|
||||
* the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero
|
||||
* value. */
|
||||
while( ulSetToNonZeroInDebuggerToContinue == 0 )
|
||||
{
|
||||
__asm volatile ( "NOP" );
|
||||
|
@ -332,77 +336,77 @@ static void prvSaveTraceFile( void )
|
|||
{
|
||||
/* Tracing is not used when code coverage analysis is being performed. */
|
||||
#if ( projCOVERAGE_TEST != 1 )
|
||||
{
|
||||
FILE * pxOutputFile;
|
||||
|
||||
vTraceStop();
|
||||
|
||||
pxOutputFile = fopen( "Trace.dump", "wb" );
|
||||
|
||||
if( pxOutputFile != NULL )
|
||||
{
|
||||
fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile );
|
||||
fclose( pxOutputFile );
|
||||
printf( "\r\nTrace output saved to Trace.dump\r\n" );
|
||||
FILE * pxOutputFile;
|
||||
|
||||
vTraceStop();
|
||||
|
||||
pxOutputFile = fopen( "Trace.dump", "wb" );
|
||||
|
||||
if( pxOutputFile != NULL )
|
||||
{
|
||||
fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile );
|
||||
fclose( pxOutputFile );
|
||||
printf( "\r\nTrace output saved to Trace.dump\r\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "\r\nFailed to create trace dump file\r\n" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "\r\nFailed to create trace dump file\r\n" );
|
||||
}
|
||||
}
|
||||
#endif /* if ( projCOVERAGE_TEST != 1 ) */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
||||
StackType_t **ppxIdleTaskStackBuffer,
|
||||
uint32_t *pulIdleTaskStackSize )
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
function then they must be declared static - otherwise they will be allocated on
|
||||
the stack and so not exists after this function exits. */
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
state will be stored. */
|
||||
* state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
Note that, as the array is necessarily of type StackType_t,
|
||||
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
|
||||
StackType_t **ppxTimerTaskStackBuffer,
|
||||
uint32_t *pulTimerTaskStackSize )
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
function then they must be declared static - otherwise they will be allocated on
|
||||
the stack and so not exists after this function exits. */
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
task's state will be stored. */
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
Note that, as the array is necessarily of type StackType_t,
|
||||
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
|
||||
|
@ -414,5 +418,6 @@ void handle_sigint( int signal )
|
|||
{
|
||||
printf( "chdir into %s error is %d\n", BUILD, errno );
|
||||
}
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
|
|
@ -93,29 +93,29 @@
|
|||
#include "console.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
|
||||
/* The rate at which data is sent to the queue. The times are converted from
|
||||
milliseconds to ticks using the pdMS_TO_TICKS() macro. */
|
||||
#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL )
|
||||
#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL )
|
||||
* milliseconds to ticks using the pdMS_TO_TICKS() macro. */
|
||||
#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL )
|
||||
#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL )
|
||||
|
||||
/* The number of items the queue can hold at once. */
|
||||
#define mainQUEUE_LENGTH ( 2 )
|
||||
#define mainQUEUE_LENGTH ( 2 )
|
||||
|
||||
/* The values sent to the queue receive task from the queue send task and the
|
||||
queue send software timer respectively. */
|
||||
#define mainVALUE_SENT_FROM_TASK ( 100UL )
|
||||
#define mainVALUE_SENT_FROM_TIMER ( 200UL )
|
||||
* queue send software timer respectively. */
|
||||
#define mainVALUE_SENT_FROM_TASK ( 100UL )
|
||||
#define mainVALUE_SENT_FROM_TIMER ( 200UL )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* The tasks as described in the comments at the top of this file.
|
||||
*/
|
||||
static void prvQueueReceiveTask( void *pvParameters );
|
||||
static void prvQueueSendTask( void *pvParameters );
|
||||
static void prvQueueReceiveTask( void * pvParameters );
|
||||
static void prvQueueSendTask( void * pvParameters );
|
||||
|
||||
/*
|
||||
* The callback function executed when the software timer expires.
|
||||
|
@ -135,130 +135,132 @@ static TimerHandle_t xTimer = NULL;
|
|||
/*** SEE THE COMMENTS AT THE TOP OF THIS FILE ***/
|
||||
void main_blinky( void )
|
||||
{
|
||||
const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS;
|
||||
const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS;
|
||||
|
||||
/* Create the queue. */
|
||||
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
/* Create the queue. */
|
||||
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
|
||||
if( xQueue != NULL )
|
||||
{
|
||||
/* Start the two tasks as described in the comments at the top of this
|
||||
file. */
|
||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||
NULL, /* The parameter passed to the task - not used in this simple case. */
|
||||
mainQUEUE_RECEIVE_TASK_PRIORITY,/* The priority assigned to the task. */
|
||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||
if( xQueue != NULL )
|
||||
{
|
||||
/* Start the two tasks as described in the comments at the top of this
|
||||
* file. */
|
||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||
NULL, /* The parameter passed to the task - not used in this simple case. */
|
||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||
|
||||
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the software timer, but don't start it yet. */
|
||||
xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */
|
||||
xTimerPeriod, /* The period of the software timer in ticks. */
|
||||
pdTRUE, /* xAutoReload is set to pdTRUE. */
|
||||
NULL, /* The timer's ID is not used. */
|
||||
prvQueueSendTimerCallback );/* The function executed when the timer expires. */
|
||||
/* Create the software timer, but don't start it yet. */
|
||||
xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */
|
||||
xTimerPeriod, /* The period of the software timer in ticks. */
|
||||
pdTRUE, /* xAutoReload is set to pdTRUE. */
|
||||
NULL, /* The timer's ID is not used. */
|
||||
prvQueueSendTimerCallback ); /* The function executed when the timer expires. */
|
||||
|
||||
if( xTimer != NULL )
|
||||
{
|
||||
xTimerStart( xTimer, 0 );
|
||||
}
|
||||
if( xTimer != NULL )
|
||||
{
|
||||
xTimerStart( xTimer, 0 );
|
||||
}
|
||||
|
||||
/* Start the tasks and timer running. */
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
/* Start the tasks and timer running. */
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
line will never be reached. If the following line does execute, then
|
||||
there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
timer tasks to be created. See the memory management section on the
|
||||
FreeRTOS web site for more details. */
|
||||
for( ;; );
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details. */
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueSendTask( void *pvParameters )
|
||||
static void prvQueueSendTask( void * pvParameters )
|
||||
{
|
||||
TickType_t xNextWakeTime;
|
||||
const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS;
|
||||
const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK;
|
||||
TickType_t xNextWakeTime;
|
||||
const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS;
|
||||
const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK;
|
||||
|
||||
/* Prevent the compiler warning about the unused parameter. */
|
||||
( void ) pvParameters;
|
||||
/* Prevent the compiler warning about the unused parameter. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Initialise xNextWakeTime - this only needs to be done once. */
|
||||
xNextWakeTime = xTaskGetTickCount();
|
||||
/* Initialise xNextWakeTime - this only needs to be done once. */
|
||||
xNextWakeTime = xTaskGetTickCount();
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Place this task in the blocked state until it is time to run again.
|
||||
The block time is specified in ticks, pdMS_TO_TICKS() was used to
|
||||
convert a time specified in milliseconds into a time specified in ticks.
|
||||
While in the Blocked state this task will not consume any CPU time. */
|
||||
vTaskDelayUntil( &xNextWakeTime, xBlockTime );
|
||||
for( ; ; )
|
||||
{
|
||||
/* Place this task in the blocked state until it is time to run again.
|
||||
* The block time is specified in ticks, pdMS_TO_TICKS() was used to
|
||||
* convert a time specified in milliseconds into a time specified in ticks.
|
||||
* While in the Blocked state this task will not consume any CPU time. */
|
||||
vTaskDelayUntil( &xNextWakeTime, xBlockTime );
|
||||
|
||||
/* Send to the queue - causing the queue receive task to unblock and
|
||||
write to the console. 0 is used as the block time so the send operation
|
||||
will not block - it shouldn't need to block as the queue should always
|
||||
have at least one space at this point in the code. */
|
||||
xQueueSend( xQueue, &ulValueToSend, 0U );
|
||||
}
|
||||
/* Send to the queue - causing the queue receive task to unblock and
|
||||
* write to the console. 0 is used as the block time so the send operation
|
||||
* will not block - it shouldn't need to block as the queue should always
|
||||
* have at least one space at this point in the code. */
|
||||
xQueueSend( xQueue, &ulValueToSend, 0U );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueSendTimerCallback( TimerHandle_t xTimerHandle )
|
||||
{
|
||||
const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER;
|
||||
const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER;
|
||||
|
||||
/* This is the software timer callback function. The software timer has a
|
||||
period of two seconds and is reset each time a key is pressed. This
|
||||
callback function will execute if the timer expires, which will only happen
|
||||
if a key is not pressed for two seconds. */
|
||||
/* This is the software timer callback function. The software timer has a
|
||||
* period of two seconds and is reset each time a key is pressed. This
|
||||
* callback function will execute if the timer expires, which will only happen
|
||||
* if a key is not pressed for two seconds. */
|
||||
|
||||
/* Avoid compiler warnings resulting from the unused parameter. */
|
||||
( void ) xTimerHandle;
|
||||
/* Avoid compiler warnings resulting from the unused parameter. */
|
||||
( void ) xTimerHandle;
|
||||
|
||||
/* Send to the queue - causing the queue receive task to unblock and
|
||||
write out a message. This function is called from the timer/daemon task, so
|
||||
must not block. Hence the block time is set to 0. */
|
||||
xQueueSend( xQueue, &ulValueToSend, 0U );
|
||||
/* Send to the queue - causing the queue receive task to unblock and
|
||||
* write out a message. This function is called from the timer/daemon task, so
|
||||
* must not block. Hence the block time is set to 0. */
|
||||
xQueueSend( xQueue, &ulValueToSend, 0U );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueReceiveTask( void *pvParameters )
|
||||
static void prvQueueReceiveTask( void * pvParameters )
|
||||
{
|
||||
uint32_t ulReceivedValue;
|
||||
uint32_t ulReceivedValue;
|
||||
|
||||
/* Prevent the compiler warning about the unused parameter. */
|
||||
( void ) pvParameters;
|
||||
/* Prevent the compiler warning about the unused parameter. */
|
||||
( void ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait until something arrives in the queue - this task will block
|
||||
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
|
||||
FreeRTOSConfig.h. It will not use any CPU time while it is in the
|
||||
Blocked state. */
|
||||
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
|
||||
for( ; ; )
|
||||
{
|
||||
/* Wait until something arrives in the queue - this task will block
|
||||
* indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
|
||||
* FreeRTOSConfig.h. It will not use any CPU time while it is in the
|
||||
* Blocked state. */
|
||||
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
|
||||
|
||||
/* To get here something must have been received from the queue, but
|
||||
is it an expected value? Normally calling printf() from a task is not
|
||||
a good idea. Here there is lots of stack space and only one task is
|
||||
using console IO so it is ok. However, note the comments at the top of
|
||||
this file about the risks of making Linux system calls (such as
|
||||
console output) from a FreeRTOS task. */
|
||||
if( ulReceivedValue == mainVALUE_SENT_FROM_TASK )
|
||||
{
|
||||
console_print( "Message received from task\n" );
|
||||
}
|
||||
else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER )
|
||||
{
|
||||
console_print( "Message received from software timer\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
console_print( "Unexpected message\n" );
|
||||
}
|
||||
}
|
||||
/* To get here something must have been received from the queue, but
|
||||
* is it an expected value? Normally calling printf() from a task is not
|
||||
* a good idea. Here there is lots of stack space and only one task is
|
||||
* using console IO so it is ok. However, note the comments at the top of
|
||||
* this file about the risks of making Linux system calls (such as
|
||||
* console output) from a FreeRTOS task. */
|
||||
if( ulReceivedValue == mainVALUE_SENT_FROM_TASK )
|
||||
{
|
||||
console_print( "Message received from task\n" );
|
||||
}
|
||||
else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER )
|
||||
{
|
||||
console_print( "Message received from software timer\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
console_print( "Unexpected message\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
* Also note that it is assumed this demo is going to be used for short periods
|
||||
* of time only, and therefore timer overflows are not handled.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
@ -48,20 +48,20 @@ static unsigned long ulStartTimeNs;
|
|||
|
||||
void vConfigureTimerForRunTimeStats( void )
|
||||
{
|
||||
struct timespec xNow;
|
||||
struct timespec xNow;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &xNow);
|
||||
ulStartTimeNs = xNow.tv_sec * 1000000000ul + xNow.tv_nsec;
|
||||
clock_gettime( CLOCK_MONOTONIC, &xNow );
|
||||
ulStartTimeNs = xNow.tv_sec * 1000000000ul + xNow.tv_nsec;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulGetRunTimeCounterValue( void )
|
||||
{
|
||||
struct timespec xNow;
|
||||
struct timespec xNow;
|
||||
|
||||
/* Time at start. */
|
||||
clock_gettime(CLOCK_MONOTONIC, &xNow);
|
||||
/* Time at start. */
|
||||
clock_gettime( CLOCK_MONOTONIC, &xNow );
|
||||
|
||||
return xNow.tv_sec * 1000000000ul + xNow.tv_nsec - ulStartTimeNs;
|
||||
return xNow.tv_sec * 1000000000ul + xNow.tv_nsec - ulStartTimeNs;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -46,13 +46,13 @@
|
|||
******************************************************************************/
|
||||
|
||||
#ifndef TRC_CONFIG_H
|
||||
#define TRC_CONFIG_H
|
||||
#define TRC_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "trcPortDefines.h"
|
||||
#include "trcPortDefines.h"
|
||||
|
||||
/******************************************************************************
|
||||
* Include of processor header file
|
||||
|
@ -61,7 +61,7 @@ extern "C" {
|
|||
* required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
|
||||
* Try that in case of build problems. Otherwise, remove the #error line below.
|
||||
*****************************************************************************/
|
||||
//#error "Trace Recorder: Please include your processor's header file here and remove this line."
|
||||
/*#error "Trace Recorder: Please include your processor's header file here and remove this line." */
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_HARDWARE_PORT
|
||||
|
@ -81,7 +81,7 @@ extern "C" {
|
|||
* See trcHardwarePort.h for available ports and information on how to
|
||||
* define your own port, if not already present.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_Win32
|
||||
#define TRC_CFG_HARDWARE_PORT TRC_HARDWARE_PORT_Win32
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_RECORDER_MODE
|
||||
|
@ -97,7 +97,8 @@ extern "C" {
|
|||
* TRC_RECORDER_MODE_SNAPSHOT
|
||||
* TRC_RECORDER_MODE_STREAMING
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT
|
||||
#define TRC_CFG_RECORDER_MODE TRC_RECORDER_MODE_SNAPSHOT
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_FREERTOS_VERSION
|
||||
*
|
||||
|
@ -105,7 +106,7 @@ extern "C" {
|
|||
* trace recorder library with an older version of FreeRTOS).
|
||||
*
|
||||
* TRC_FREERTOS_VERSION_7_3_X If using FreeRTOS v7.3.X
|
||||
* TRC_FREERTOS_VERSION_7_4_X If using FreeRTOS v7.4.X
|
||||
* TRC_FREERTOS_VERSION_7_4_X If using FreeRTOS v7.4.X
|
||||
* TRC_FREERTOS_VERSION_7_5_X If using FreeRTOS v7.5.X
|
||||
* TRC_FREERTOS_VERSION_7_6_X If using FreeRTOS v7.6.X
|
||||
* TRC_FREERTOS_VERSION_8_X_X If using FreeRTOS v8.X.X
|
||||
|
@ -122,7 +123,7 @@ extern "C" {
|
|||
* TRC_FREERTOS_VERSION_10_3_1 If using FreeRTOS v10.3.1
|
||||
* TRC_FREERTOS_VERSION_10_4_0 If using FreeRTOS v10.4.0 or later
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_4_0
|
||||
#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_4_0
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_SCHEDULING_ONLY
|
||||
|
@ -134,9 +135,9 @@ extern "C" {
|
|||
*
|
||||
* Default value is 0 (= include additional events).
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SCHEDULING_ONLY 0
|
||||
#define TRC_CFG_SCHEDULING_ONLY 0
|
||||
|
||||
/******************************************************************************
|
||||
/******************************************************************************
|
||||
* TRC_CFG_INCLUDE_MEMMANG_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
|
@ -146,20 +147,20 @@ extern "C" {
|
|||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1
|
||||
#define TRC_CFG_INCLUDE_MEMMANG_EVENTS 1
|
||||
|
||||
/******************************************************************************
|
||||
/******************************************************************************
|
||||
* TRC_CFG_INCLUDE_USER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), all code related to User Events is excluded in order
|
||||
* If this is zero (0), all code related to User Events is excluded in order
|
||||
* to reduce code size. Any attempts of storing User Events are then silently
|
||||
* ignored.
|
||||
*
|
||||
* User Events are application-generated events, like "printf" but for the
|
||||
* trace log, generated using vTracePrint and vTracePrintF.
|
||||
* The formatting is done on host-side, by Tracealyzer. User Events are
|
||||
* User Events are application-generated events, like "printf" but for the
|
||||
* trace log, generated using vTracePrint and vTracePrintF.
|
||||
* The formatting is done on host-side, by Tracealyzer. User Events are
|
||||
* therefore much faster than a console printf and can often be used
|
||||
* in timing critical code without problems.
|
||||
*
|
||||
|
@ -171,84 +172,84 @@ extern "C" {
|
|||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_USER_EVENTS 1
|
||||
#define TRC_CFG_INCLUDE_USER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_ISR_TRACING
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded, in order to reduce code size.
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin
|
||||
* and vTraceStoreISREnd in your interrupt handlers.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_ISR_TRACING 1
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_ISR_TRACING
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the code for recording Interrupt Service Routines is
|
||||
* excluded, in order to reduce code size.
|
||||
*
|
||||
* Default value is 1.
|
||||
*
|
||||
* Note: tracing ISRs requires that you insert calls to vTraceStoreISRBegin
|
||||
* and vTraceStoreISREnd in your interrupt handlers.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_ISR_TRACING 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_READY_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If one (1), events are recorded when tasks enter scheduling state "ready".
|
||||
* This allows Tracealyzer to show the initial pending time before tasks enter
|
||||
* the execution state, and present accurate response times.
|
||||
* If zero (0), "ready events" are not created, which allows for recording
|
||||
* longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_READY_EVENTS 1
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_READY_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If one (1), events are recorded when tasks enter scheduling state "ready".
|
||||
* This allows Tracealyzer to show the initial pending time before tasks enter
|
||||
* the execution state, and present accurate response times.
|
||||
* If zero (0), "ready events" are not created, which allows for recording
|
||||
* longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_READY_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_OSTICK_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is one (1), events will be generated whenever the OS clock is
|
||||
* increased. If zero (0), OS tick events are not generated, which allows for
|
||||
* recording longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_OSTICK_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is one (1), events will be generated whenever the OS clock is
|
||||
* increased. If zero (0), OS tick events are not generated, which allows for
|
||||
* recording longer traces in the same amount of RAM.
|
||||
*
|
||||
* Default value is 1.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_OSTICK_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any "event group" events.
|
||||
*
|
||||
* Default value is 0 (excluded) since dependent on event_groups.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS 1
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any "event group" events.
|
||||
*
|
||||
* Default value is 0 (excluded) since dependent on event_groups.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_EVENT_GROUP_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_TIMER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any Timer events.
|
||||
*
|
||||
* Default value is 0 since dependent on timers.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_TIMER_EVENTS 1
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_TIMER_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any Timer events.
|
||||
*
|
||||
* Default value is 0 since dependent on timers.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_TIMER_EVENTS 1
|
||||
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any "pending function call"
|
||||
* events, such as xTimerPendFunctionCall().
|
||||
*
|
||||
* Default value is 0 since dependent on timers.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS 1
|
||||
/*****************************************************************************
|
||||
* TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS
|
||||
*
|
||||
* Macro which should be defined as either zero (0) or one (1).
|
||||
*
|
||||
* If this is zero (0), the trace will exclude any "pending function call"
|
||||
* events, such as xTimerPendFunctionCall().
|
||||
*
|
||||
* Default value is 0 since dependent on timers.c
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_PEND_FUNC_CALL_EVENTS 1
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS
|
||||
|
@ -260,7 +261,7 @@ extern "C" {
|
|||
*
|
||||
* Default value is 0 since dependent on stream_buffer.c (new in FreeRTOS v10)
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS 1
|
||||
#define TRC_CFG_INCLUDE_STREAM_BUFFER_EVENTS 1
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_RECORDER_BUFFER_ALLOCATION
|
||||
|
@ -278,7 +279,7 @@ extern "C" {
|
|||
* The custom mode allows you to control how and where the allocation is made,
|
||||
* for details see TRC_ALLOC_CUSTOM_BUFFER and vTraceSetRecorderDataBuffer().
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
#define TRC_CFG_RECORDER_BUFFER_ALLOCATION TRC_RECORDER_BUFFER_ALLOCATION_STATIC
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_MAX_ISR_NESTING
|
||||
|
@ -293,17 +294,17 @@ extern "C" {
|
|||
*
|
||||
* Default value: 8
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_MAX_ISR_NESTING 8
|
||||
#define TRC_CFG_MAX_ISR_NESTING 8
|
||||
|
||||
/* Specific configuration, depending on Streaming/Snapshot mode */
|
||||
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
|
||||
#include "trcSnapshotConfig.h"
|
||||
#elif (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
|
||||
#include "trcStreamingConfig.h"
|
||||
#endif
|
||||
#if ( TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT )
|
||||
#include "trcSnapshotConfig.h"
|
||||
#elif ( TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING )
|
||||
#include "trcStreamingConfig.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TRC_CONFIG_H */
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
#ifndef TRC_SNAPSHOT_CONFIG_H
|
||||
#define TRC_SNAPSHOT_CONFIG_H
|
||||
|
||||
#define TRC_SNAPSHOT_MODE_RING_BUFFER (0x01)
|
||||
#define TRC_SNAPSHOT_MODE_STOP_WHEN_FULL (0x02)
|
||||
#define TRC_SNAPSHOT_MODE_RING_BUFFER ( 0x01 )
|
||||
#define TRC_SNAPSHOT_MODE_STOP_WHEN_FULL ( 0x02 )
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_SNAPSHOT_MODE
|
||||
|
@ -67,7 +67,7 @@
|
|||
* recording is stopped when the buffer becomes full. This is useful for
|
||||
* recording events following a specific state, e.g., the startup sequence.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
#define TRC_CFG_SNAPSHOT_MODE TRC_SNAPSHOT_MODE_RING_BUFFER
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_EVENT_BUFFER_SIZE
|
||||
|
@ -82,7 +82,7 @@
|
|||
* Default value is 1000, which means that 4000 bytes is allocated for the
|
||||
* event buffer.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_EVENT_BUFFER_SIZE 32000
|
||||
#define TRC_CFG_EVENT_BUFFER_SIZE 32000
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_NTASK, TRC_CFG_NISR, TRC_CFG_NQUEUE, TRC_CFG_NSEMAPHORE...
|
||||
|
@ -106,15 +106,15 @@
|
|||
* check the actual usage by selecting View menu -> Trace Details ->
|
||||
* Resource Usage -> Object Table.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_NTASK 150
|
||||
#define TRC_CFG_NISR 90
|
||||
#define TRC_CFG_NQUEUE 90
|
||||
#define TRC_CFG_NSEMAPHORE 90
|
||||
#define TRC_CFG_NMUTEX 90
|
||||
#define TRC_CFG_NTIMER 250
|
||||
#define TRC_CFG_NEVENTGROUP 90
|
||||
#define TRC_CFG_NSTREAMBUFFER 100
|
||||
#define TRC_CFG_NMESSAGEBUFFER 100
|
||||
#define TRC_CFG_NTASK 150
|
||||
#define TRC_CFG_NISR 90
|
||||
#define TRC_CFG_NQUEUE 90
|
||||
#define TRC_CFG_NSEMAPHORE 90
|
||||
#define TRC_CFG_NMUTEX 90
|
||||
#define TRC_CFG_NTIMER 250
|
||||
#define TRC_CFG_NEVENTGROUP 90
|
||||
#define TRC_CFG_NSTREAMBUFFER 100
|
||||
#define TRC_CFG_NMESSAGEBUFFER 100
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -133,7 +133,7 @@
|
|||
*
|
||||
* Default value is 0.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0
|
||||
#define TRC_CFG_INCLUDE_FLOAT_SUPPORT 0
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_SYMBOL_TABLE_SIZE
|
||||
|
@ -149,10 +149,10 @@
|
|||
*
|
||||
* Default value is 800.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SYMBOL_TABLE_SIZE 32000
|
||||
#define TRC_CFG_SYMBOL_TABLE_SIZE 32000
|
||||
|
||||
#if (TRC_CFG_SYMBOL_TABLE_SIZE == 0)
|
||||
#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#if ( TRC_CFG_SYMBOL_TABLE_SIZE == 0 )
|
||||
#error "TRC_CFG_SYMBOL_TABLE_SIZE may not be zero!"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -162,15 +162,15 @@
|
|||
* kernel objects, such as tasks and queues. If longer names are used, they will
|
||||
* be truncated when stored in the recorder.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_NAME_LEN_TASK 15
|
||||
#define TRC_CFG_NAME_LEN_ISR 15
|
||||
#define TRC_CFG_NAME_LEN_QUEUE 15
|
||||
#define TRC_CFG_NAME_LEN_SEMAPHORE 15
|
||||
#define TRC_CFG_NAME_LEN_MUTEX 15
|
||||
#define TRC_CFG_NAME_LEN_TIMER 15
|
||||
#define TRC_CFG_NAME_LEN_EVENTGROUP 15
|
||||
#define TRC_CFG_NAME_LEN_STREAMBUFFER 15
|
||||
#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15
|
||||
#define TRC_CFG_NAME_LEN_TASK 15
|
||||
#define TRC_CFG_NAME_LEN_ISR 15
|
||||
#define TRC_CFG_NAME_LEN_QUEUE 15
|
||||
#define TRC_CFG_NAME_LEN_SEMAPHORE 15
|
||||
#define TRC_CFG_NAME_LEN_MUTEX 15
|
||||
#define TRC_CFG_NAME_LEN_TIMER 15
|
||||
#define TRC_CFG_NAME_LEN_EVENTGROUP 15
|
||||
#define TRC_CFG_NAME_LEN_STREAMBUFFER 15
|
||||
#define TRC_CFG_NAME_LEN_MESSAGEBUFFER 15
|
||||
|
||||
/******************************************************************************
|
||||
*** ADVANCED SETTINGS ********************************************************
|
||||
|
@ -190,7 +190,7 @@
|
|||
*
|
||||
* Default value is 0.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_HEAP_SIZE_BELOW_16M 0
|
||||
#define TRC_CFG_HEAP_SIZE_BELOW_16M 0
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_IMPLICIT_IFE_RULES
|
||||
|
@ -222,7 +222,7 @@
|
|||
* For details, see trcSnapshotKernelPort.h and look for references to the
|
||||
* macro trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1
|
||||
#define TRC_CFG_USE_IMPLICIT_IFE_RULES 1
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_16BIT_OBJECT_HANDLES
|
||||
|
@ -246,7 +246,7 @@
|
|||
* the event buffer whenever the object is referenced. Moreover, some internal
|
||||
* tables in the recorder gets slightly larger when using 16-bit handles.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 0
|
||||
#define TRC_CFG_USE_16BIT_OBJECT_HANDLES 0
|
||||
|
||||
/******************************************************************************
|
||||
* TRC_CFG_USE_TRACE_ASSERT
|
||||
|
@ -264,7 +264,7 @@
|
|||
* parameters. Can be switched off to reduce the footprint of the tracing, but
|
||||
* we recommend to have it enabled initially.
|
||||
*****************************************************************************/
|
||||
#define TRC_CFG_USE_TRACE_ASSERT 1
|
||||
#define TRC_CFG_USE_TRACE_ASSERT 1
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER
|
||||
|
@ -320,9 +320,9 @@
|
|||
*
|
||||
* // Finds the existing UB channel
|
||||
* vTracePrintF(chn2, "%Z: %d", value2);
|
||||
|
||||
*
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE
|
||||
|
@ -334,7 +334,7 @@
|
|||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200
|
||||
#define TRC_CFG_SEPARATE_USER_EVENT_BUFFER_SIZE 200
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_UB_CHANNELS
|
||||
|
@ -348,7 +348,7 @@
|
|||
*
|
||||
* Only applicable if TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER is 1.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_UB_CHANNELS 32
|
||||
#define TRC_CFG_UB_CHANNELS 32
|
||||
|
||||
/*******************************************************************************
|
||||
* TRC_CFG_ISR_TAILCHAINING_THRESHOLD
|
||||
|
@ -373,6 +373,6 @@
|
|||
* Note: This setting has separate definitions in trcSnapshotConfig.h and
|
||||
* trcStreamingConfig.h, since it is affected by the recorder mode.
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
|
||||
#define TRC_CFG_ISR_TAILCHAINING_THRESHOLD 0
|
||||
|
||||
#endif /*TRC_SNAPSHOT_CONFIG_H*/
|
||||
|
|
|
@ -204,6 +204,7 @@ cg
|
|||
ch
|
||||
chacha
|
||||
chachapoly
|
||||
chdir
|
||||
checklogin
|
||||
checknullarg
|
||||
checktimer
|
||||
|
@ -777,6 +778,7 @@ gir
|
|||
girq
|
||||
girqm
|
||||
github
|
||||
gmon
|
||||
gnd
|
||||
gnuc
|
||||
googleapis
|
||||
|
@ -2158,6 +2160,7 @@ shouldn
|
|||
shtml
|
||||
sice
|
||||
sifive
|
||||
sigint
|
||||
signalled
|
||||
signatureverificationstate
|
||||
signatureverificationstateptr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue