├── Demo
└── Common
│ ├── Full
│ ├── BlockQ.c
│ ├── PollQ.c
│ ├── comtest.c
│ ├── death.c
│ ├── dynamic.c
│ ├── events.c
│ ├── flash.c
│ ├── flop.c
│ ├── integer.c
│ ├── print.c
│ └── semtest.c
│ ├── Minimal
│ ├── AbortDelay.c
│ ├── BlockQ.c
│ ├── EventGroupsDemo.c
│ ├── GenQTest.c
│ ├── IntQueue.c
│ ├── IntSemTest.c
│ ├── MessageBufferAMP.c
│ ├── MessageBufferDemo.c
│ ├── PollQ.c
│ ├── QPeek.c
│ ├── QueueOverwrite.c
│ ├── QueueSet.c
│ ├── QueueSetPolling.c
│ ├── StaticAllocation.c
│ ├── StreamBufferDemo.c
│ ├── StreamBufferInterrupt.c
│ ├── TaskNotify.c
│ ├── TimerDemo.c
│ ├── blocktim.c
│ ├── comtest.c
│ ├── comtest_strings.c
│ ├── countsem.c
│ ├── crflash.c
│ ├── crhook.c
│ ├── death.c
│ ├── dynamic.c
│ ├── flash.c
│ ├── flash_timer.c
│ ├── flop.c
│ ├── integer.c
│ ├── readme.txt
│ ├── recmutex.c
│ ├── semtest.c
│ └── sp_flop.c
│ ├── ReadMe.txt
│ └── include
│ ├── AbortDelay.h
│ ├── BlockQ.h
│ ├── EventGroupsDemo.h
│ ├── GenQTest.h
│ ├── IntQueue.h
│ ├── IntSemTest.h
│ ├── MessageBufferAMP.h
│ ├── MessageBufferDemo.h
│ ├── PollQ.h
│ ├── QPeek.h
│ ├── QueueOverwrite.h
│ ├── QueueSet.h
│ ├── QueueSetPolling.h
│ ├── StaticAllocation.h
│ ├── StreamBufferDemo.h
│ ├── StreamBufferInterrupt.h
│ ├── TaskNotify.h
│ ├── TimerDemo.h
│ ├── blocktim.h
│ ├── comtest.h
│ ├── comtest2.h
│ ├── comtest_strings.h
│ ├── countsem.h
│ ├── crflash.h
│ ├── crhook.h
│ ├── death.h
│ ├── dynamic.h
│ ├── fileIO.h
│ ├── flash.h
│ ├── flash_timer.h
│ ├── flop.h
│ ├── integer.h
│ ├── mevents.h
│ ├── partest.h
│ ├── print.h
│ ├── recmutex.h
│ ├── semtest.h
│ └── serial.h
├── LICENSE
├── Makefile
├── Project
├── FreeRTOSConfig.h
└── main.c
├── README.md
└── Source
├── croutine.c
├── event_groups.c
├── include
├── FreeRTOS.h
├── StackMacros.h
├── croutine.h
├── deprecated_definitions.h
├── event_groups.h
├── list.h
├── message_buffer.h
├── mpu_prototypes.h
├── mpu_wrappers.h
├── portable.h
├── projdefs.h
├── queue.h
├── semphr.h
├── stack_macros.h
├── stdint.readme
├── stream_buffer.h
├── task.h
└── timers.h
├── list.c
├── portable
├── GCC
│ └── POSIX
│ │ ├── port.c
│ │ └── portmacro.h
└── MemMang
│ ├── ReadMe.url
│ ├── heap_1.c
│ ├── heap_2.c
│ ├── heap_3.c
│ ├── heap_4.c
│ └── heap_5.c
├── queue.c
├── readme.txt
├── stream_buffer.c
├── tasks.c
└── timers.c
/Demo/Common/Full/PollQ.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 |
29 | /**
30 | * This is a very simple queue test. See the BlockQ. c documentation for a more
31 | * comprehensive version.
32 | *
33 | * Creates two tasks that communicate over a single queue. One task acts as a
34 | * producer, the other a consumer.
35 | *
36 | * The producer loops for three iteration, posting an incrementing number onto the
37 | * queue each cycle. It then delays for a fixed period before doing exactly the
38 | * same again.
39 | *
40 | * The consumer loops emptying the queue. Each item removed from the queue is
41 | * checked to ensure it contains the expected value. When the queue is empty it
42 | * blocks for a fixed period, then does the same again.
43 | *
44 | * All queue access is performed without blocking. The consumer completely empties
45 | * the queue each time it runs so the producer should never find the queue full.
46 | *
47 | * An error is flagged if the consumer obtains an unexpected value or the producer
48 | * find the queue is full.
49 | *
50 | * \page PollQC pollQ.c
51 | * \ingroup DemoFiles
52 | *
53 | */
54 |
55 | /*
56 | Changes from V2.0.0
57 |
58 | + Delay periods are now specified using variables and constants of
59 | TickType_t rather than unsigned long.
60 | */
61 |
62 | #include
63 |
64 | /* Scheduler include files. */
65 | #include "FreeRTOS.h"
66 | #include "task.h"
67 | #include "queue.h"
68 | #include "print.h"
69 |
70 | /* Demo program include files. */
71 | #include "PollQ.h"
72 |
73 | #define pollqSTACK_SIZE ( ( unsigned short ) configMINIMAL_STACK_SIZE )
74 |
75 | /* The task that posts the incrementing number onto the queue. */
76 | static void vPolledQueueProducer( void *pvParameters );
77 |
78 | /* The task that empties the queue. */
79 | static void vPolledQueueConsumer( void *pvParameters );
80 |
81 | /* Variables that are used to check that the tasks are still running with no errors. */
82 | static volatile short sPollingConsumerCount = 0, sPollingProducerCount = 0;
83 | /*-----------------------------------------------------------*/
84 |
85 | void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority )
86 | {
87 | static QueueHandle_t xPolledQueue;
88 | const unsigned portBASE_TYPE uxQueueSize = 10;
89 |
90 | /* Create the queue used by the producer and consumer. */
91 | xPolledQueue = xQueueCreate( uxQueueSize, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
92 |
93 | /* Spawn the producer and consumer. */
94 | xTaskCreate( vPolledQueueConsumer, "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, NULL );
95 | xTaskCreate( vPolledQueueProducer, "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, NULL );
96 | }
97 | /*-----------------------------------------------------------*/
98 |
99 | static void vPolledQueueProducer( void *pvParameters )
100 | {
101 | unsigned short usValue = 0, usLoop;
102 | QueueHandle_t *pxQueue;
103 | const TickType_t xDelay = ( TickType_t ) 200 / portTICK_PERIOD_MS;
104 | const unsigned short usNumToProduce = 3;
105 | const char * const pcTaskStartMsg = "Polled queue producer started.\r\n";
106 | const char * const pcTaskErrorMsg = "Could not post on polled queue.\r\n";
107 | short sError = pdFALSE;
108 |
109 | /* Queue a message for printing to say the task has started. */
110 | vPrintDisplayMessage( &pcTaskStartMsg );
111 |
112 | /* The queue being used is passed in as the parameter. */
113 | pxQueue = ( QueueHandle_t * ) pvParameters;
114 |
115 | for( ;; )
116 | {
117 | for( usLoop = 0; usLoop < usNumToProduce; ++usLoop )
118 | {
119 | /* Send an incrementing number on the queue without blocking. */
120 | if( xQueueSendToBack( *pxQueue, ( void * ) &usValue, ( TickType_t ) 0 ) != pdPASS )
121 | {
122 | /* We should never find the queue full - this is an error. */
123 | vPrintDisplayMessage( &pcTaskErrorMsg );
124 | sError = pdTRUE;
125 | }
126 | else
127 | {
128 | if( sError == pdFALSE )
129 | {
130 | /* If an error has ever been recorded we stop incrementing the
131 | check variable. */
132 | ++sPollingProducerCount;
133 | }
134 |
135 | /* Update the value we are going to post next time around. */
136 | ++usValue;
137 | }
138 | }
139 |
140 | /* Wait before we start posting again to ensure the consumer runs and
141 | empties the queue. */
142 | vTaskDelay( xDelay );
143 | }
144 | }
145 | /*-----------------------------------------------------------*/
146 |
147 | static void vPolledQueueConsumer( void *pvParameters )
148 | {
149 | unsigned short usData, usExpectedValue = 0;
150 | QueueHandle_t *pxQueue;
151 | const TickType_t xDelay = ( TickType_t ) 200 / portTICK_PERIOD_MS;
152 | const char * const pcTaskStartMsg = "Polled queue consumer started.\r\n";
153 | const char * const pcTaskErrorMsg = "Incorrect value received on polled queue.\r\n";
154 | short sError = pdFALSE;
155 |
156 | /* Queue a message for printing to say the task has started. */
157 | vPrintDisplayMessage( &pcTaskStartMsg );
158 |
159 | /* The queue being used is passed in as the parameter. */
160 | pxQueue = ( QueueHandle_t * ) pvParameters;
161 |
162 | for( ;; )
163 | {
164 | /* Loop until the queue is empty. */
165 | while( uxQueueMessagesWaiting( *pxQueue ) )
166 | {
167 | if( xQueueReceive( *pxQueue, &usData, ( TickType_t ) 0 ) == pdPASS )
168 | {
169 | if( usData != usExpectedValue )
170 | {
171 | /* This is not what we expected to receive so an error has
172 | occurred. */
173 | vPrintDisplayMessage( &pcTaskErrorMsg );
174 | sError = pdTRUE;
175 | /* Catch-up to the value we received so our next expected value
176 | should again be correct. */
177 | usExpectedValue = usData;
178 | }
179 | else
180 | {
181 | if( sError == pdFALSE )
182 | {
183 | /* Only increment the check variable if no errors have
184 | occurred. */
185 | ++sPollingConsumerCount;
186 | }
187 | }
188 | ++usExpectedValue;
189 | }
190 | }
191 |
192 | /* Now the queue is empty we block, allowing the producer to place more
193 | items in the queue. */
194 | vTaskDelay( xDelay );
195 | }
196 | }
197 | /*-----------------------------------------------------------*/
198 |
199 | /* This is called to check that all the created tasks are still running with no errors. */
200 | portBASE_TYPE xArePollingQueuesStillRunning( void )
201 | {
202 | static short sLastPollingConsumerCount = 0, sLastPollingProducerCount = 0;
203 | portBASE_TYPE xReturn;
204 |
205 | if( ( sLastPollingConsumerCount == sPollingConsumerCount ) ||
206 | ( sLastPollingProducerCount == sPollingProducerCount )
207 | )
208 | {
209 | xReturn = pdFALSE;
210 | }
211 | else
212 | {
213 | xReturn = pdTRUE;
214 | }
215 |
216 | sLastPollingConsumerCount = sPollingConsumerCount;
217 | sLastPollingProducerCount = sPollingProducerCount;
218 |
219 | return xReturn;
220 | }
221 |
--------------------------------------------------------------------------------
/Demo/Common/Full/death.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /**
29 | * Create a single persistent task which periodically dynamically creates another
30 | * four tasks. The original task is called the creator task, the four tasks it
31 | * creates are called suicidal tasks.
32 | *
33 | * Two of the created suicidal tasks kill one other suicidal task before killing
34 | * themselves - leaving just the original task remaining.
35 | *
36 | * The creator task must be spawned after all of the other demo application tasks
37 | * as it keeps a check on the number of tasks under the scheduler control. The
38 | * number of tasks it expects to see running should never be greater than the
39 | * number of tasks that were in existence when the creator task was spawned, plus
40 | * one set of four suicidal tasks. If this number is exceeded an error is flagged.
41 | *
42 | * \page DeathC death.c
43 | * \ingroup DemoFiles
44 | *
45 | */
46 |
47 | /*
48 | Changes from V2.0.0
49 |
50 | + Delay periods are now specified using variables and constants of
51 | TickType_t rather than unsigned long.
52 | */
53 |
54 | #include
55 |
56 | /* Scheduler include files. */
57 | #include "FreeRTOS.h"
58 | #include "task.h"
59 |
60 | /* Demo program include files. */
61 | #include "death.h"
62 | #include "print.h"
63 |
64 | #define deathSTACK_SIZE ( ( unsigned short ) 512 )
65 |
66 | /* The task originally created which is responsible for periodically dynamically
67 | creating another four tasks. */
68 | static void vCreateTasks( void *pvParameters );
69 |
70 | /* The task function of the dynamically created tasks. */
71 | static void vSuicidalTask( void *pvParameters );
72 |
73 | /* A variable which is incremented every time the dynamic tasks are created. This
74 | is used to check that the task is still running. */
75 | static volatile short sCreationCount = 0;
76 |
77 | /* Used to store the number of tasks that were originally running so the creator
78 | task can tell if any of the suicidal tasks have failed to die. */
79 | static volatile unsigned portBASE_TYPE uxTasksRunningAtStart = 0;
80 | static const unsigned portBASE_TYPE uxMaxNumberOfExtraTasksRunning = 5;
81 |
82 | /* Used to store a handle to the tasks that should be killed by a suicidal task,
83 | before it kills itself. */
84 | TaskHandle_t xCreatedTask1, xCreatedTask2;
85 |
86 | /*-----------------------------------------------------------*/
87 |
88 | void vCreateSuicidalTasks( unsigned portBASE_TYPE uxPriority )
89 | {
90 | unsigned portBASE_TYPE *puxPriority;
91 |
92 | /* Create the Creator tasks - passing in as a parameter the priority at which
93 | the suicidal tasks should be created. */
94 | puxPriority = ( unsigned portBASE_TYPE * ) pvPortMalloc( sizeof( unsigned portBASE_TYPE ) );
95 | *puxPriority = uxPriority;
96 |
97 | xTaskCreate( vCreateTasks, "CREATOR", deathSTACK_SIZE, ( void * ) puxPriority, uxPriority, NULL );
98 |
99 | /* Record the number of tasks that are running now so we know if any of the
100 | suicidal tasks have failed to be killed. */
101 | uxTasksRunningAtStart = uxTaskGetNumberOfTasks();
102 | }
103 | /*-----------------------------------------------------------*/
104 |
105 | static void vSuicidalTask( void *pvParameters )
106 | {
107 | portDOUBLE d1, d2;
108 | TaskHandle_t xTaskToKill;
109 | const TickType_t xDelay = ( TickType_t ) 500 / portTICK_PERIOD_MS;
110 |
111 | if( pvParameters != NULL )
112 | {
113 | /* This task is periodically created four times. Tow created tasks are
114 | passed a handle to the other task so it can kill it before killing itself.
115 | The other task is passed in null. */
116 | xTaskToKill = *( TaskHandle_t* )pvParameters;
117 | }
118 | else
119 | {
120 | xTaskToKill = NULL;
121 | }
122 |
123 | for( ;; )
124 | {
125 | /* Do something random just to use some stack and registers. */
126 | d1 = 2.4;
127 | d2 = 89.2;
128 | d2 *= d1;
129 | vTaskDelay( xDelay );
130 |
131 | if( xTaskToKill != NULL )
132 | {
133 | /* Make sure the other task has a go before we delete it. */
134 | vTaskDelay( ( TickType_t ) 0 );
135 | /* Kill the other task that was created by vCreateTasks(). */
136 | vTaskDelete( xTaskToKill );
137 | /* Kill ourselves. */
138 | vTaskDelete( NULL );
139 | }
140 | }
141 | }/*lint !e818 !e550 Function prototype must be as per standard for task functions. */
142 | /*-----------------------------------------------------------*/
143 |
144 | static void vCreateTasks( void *pvParameters )
145 | {
146 | const TickType_t xDelay = ( TickType_t ) 1000 / portTICK_PERIOD_MS;
147 | unsigned portBASE_TYPE uxPriority;
148 | const char * const pcTaskStartMsg = "Create task started.\r\n";
149 |
150 | /* Queue a message for printing to say the task has started. */
151 | vPrintDisplayMessage( &pcTaskStartMsg );
152 |
153 | uxPriority = *( unsigned portBASE_TYPE * ) pvParameters;
154 | vPortFree( pvParameters );
155 |
156 | for( ;; )
157 | {
158 | /* Just loop round, delaying then creating the four suicidal tasks. */
159 | vTaskDelay( xDelay );
160 |
161 | xTaskCreate( vSuicidalTask, "SUICIDE1", deathSTACK_SIZE, NULL, uxPriority, &xCreatedTask1 );
162 | xTaskCreate( vSuicidalTask, "SUICIDE2", deathSTACK_SIZE, &xCreatedTask1, uxPriority, NULL );
163 |
164 | xTaskCreate( vSuicidalTask, "SUICIDE1", deathSTACK_SIZE, NULL, uxPriority, &xCreatedTask2 );
165 | xTaskCreate( vSuicidalTask, "SUICIDE2", deathSTACK_SIZE, &xCreatedTask2, uxPriority, NULL );
166 |
167 | ++sCreationCount;
168 | }
169 | }
170 | /*-----------------------------------------------------------*/
171 |
172 | /* This is called to check that the creator task is still running and that there
173 | are not any more than four extra tasks. */
174 | portBASE_TYPE xIsCreateTaskStillRunning( void )
175 | {
176 | static short sLastCreationCount = 0;
177 | short sReturn = pdTRUE;
178 | unsigned portBASE_TYPE uxTasksRunningNow;
179 |
180 | if( sLastCreationCount == sCreationCount )
181 | {
182 | sReturn = pdFALSE;
183 | }
184 |
185 | uxTasksRunningNow = uxTaskGetNumberOfTasks();
186 |
187 | if( uxTasksRunningNow < uxTasksRunningAtStart )
188 | {
189 | sReturn = pdFALSE;
190 | }
191 | else if( ( uxTasksRunningNow - uxTasksRunningAtStart ) > uxMaxNumberOfExtraTasksRunning )
192 | {
193 | sReturn = pdFALSE;
194 | }
195 | else
196 | {
197 | /* Everything is okay. */
198 | }
199 |
200 | return sReturn;
201 | }
202 |
203 |
204 |
--------------------------------------------------------------------------------
/Demo/Common/Full/flash.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 |
29 | /**
30 | * Creates eight tasks, each of which flash an LED at a different rate. The first
31 | * LED flashes every 125ms, the second every 250ms, the third every 375ms, etc.
32 | *
33 | * The LED flash tasks provide instant visual feedback. They show that the scheduler
34 | * is still operational.
35 | *
36 | * The PC port uses the standard parallel port for outputs, the Flashlite 186 port
37 | * uses IO port F.
38 | *
39 | * \page flashC flash.c
40 | * \ingroup DemoFiles
41 | *
42 | */
43 |
44 | /*
45 | Changes from V2.0.0
46 |
47 | + Delay periods are now specified using variables and constants of
48 | TickType_t rather than unsigned long.
49 |
50 | Changes from V2.1.1
51 |
52 | + The stack size now uses configMINIMAL_STACK_SIZE.
53 | + String constants made file scope to decrease stack depth on 8051 port.
54 | */
55 |
56 | #include
57 |
58 | /* Scheduler include files. */
59 | #include "FreeRTOS.h"
60 | #include "task.h"
61 |
62 | /* Demo program include files. */
63 | #include "partest.h"
64 | #include "flash.h"
65 | #include "print.h"
66 |
67 | #define ledSTACK_SIZE configMINIMAL_STACK_SIZE
68 |
69 | /* Structure used to pass parameters to the LED tasks. */
70 | typedef struct LED_PARAMETERS
71 | {
72 | unsigned portBASE_TYPE uxLED; /*< The output the task should use. */
73 | TickType_t xFlashRate; /*< The rate at which the LED should flash. */
74 | } xLEDParameters;
75 |
76 | /* The task that is created eight times - each time with a different xLEDParaemtes
77 | structure passed in as the parameter. */
78 | static void vLEDFlashTask( void *pvParameters );
79 |
80 | /* String to print if USE_STDIO is defined. */
81 | const char * const pcTaskStartMsg = "LED flash task started.\r\n";
82 |
83 | /*-----------------------------------------------------------*/
84 |
85 | void vStartLEDFlashTasks( unsigned portBASE_TYPE uxPriority )
86 | {
87 | unsigned portBASE_TYPE uxLEDTask;
88 | xLEDParameters *pxLEDParameters;
89 | const unsigned portBASE_TYPE uxNumOfLEDs = 8;
90 | const TickType_t xFlashRate = 125;
91 |
92 | /* Create the eight tasks. */
93 | for( uxLEDTask = 0; uxLEDTask < uxNumOfLEDs; ++uxLEDTask )
94 | {
95 | /* Create and complete the structure used to pass parameters to the next
96 | created task. */
97 | pxLEDParameters = ( xLEDParameters * ) pvPortMalloc( sizeof( xLEDParameters ) );
98 | pxLEDParameters->uxLED = uxLEDTask;
99 | pxLEDParameters->xFlashRate = ( xFlashRate + ( xFlashRate * ( TickType_t ) uxLEDTask ) );
100 | pxLEDParameters->xFlashRate /= portTICK_PERIOD_MS;
101 |
102 | /* Spawn the task. */
103 | xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, ( void * ) pxLEDParameters, uxPriority, ( TaskHandle_t * ) NULL );
104 | }
105 | }
106 | /*-----------------------------------------------------------*/
107 |
108 | static void vLEDFlashTask( void *pvParameters )
109 | {
110 | xLEDParameters *pxParameters;
111 |
112 | /* Queue a message for printing to say the task has started. */
113 | vPrintDisplayMessage( &pcTaskStartMsg );
114 |
115 | pxParameters = ( xLEDParameters * ) pvParameters;
116 |
117 | for(;;)
118 | {
119 | /* Delay for half the flash period then turn the LED on. */
120 | vTaskDelay( pxParameters->xFlashRate / ( TickType_t ) 2 );
121 | vParTestToggleLED( pxParameters->uxLED );
122 |
123 | /* Delay for half the flash period then turn the LED off. */
124 | vTaskDelay( pxParameters->xFlashRate / ( TickType_t ) 2 );
125 | vParTestToggleLED( pxParameters->uxLED );
126 | }
127 | }
128 |
129 |
--------------------------------------------------------------------------------
/Demo/Common/Full/print.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /**
29 | * Manages a queue of strings that are waiting to be displayed. This is used to
30 | * ensure mutual exclusion of console output.
31 | *
32 | * A task wishing to display a message will call vPrintDisplayMessage (), with a
33 | * pointer to the string as the parameter. The pointer is posted onto the
34 | * xPrintQueue queue.
35 | *
36 | * The task spawned in main. c blocks on xPrintQueue. When a message becomes
37 | * available it calls pcPrintGetNextMessage () to obtain a pointer to the next
38 | * string, then uses the functions defined in the portable layer FileIO. c to
39 | * display the message.
40 | *
41 | * NOTE:
42 | * Using console IO can disrupt real time performance - depending on the port.
43 | * Standard C IO routines are not designed for real time applications. While
44 | * standard IO is useful for demonstration and debugging an alternative method
45 | * should be used if you actually require console IO as part of your application.
46 | *
47 | * \page PrintC print.c
48 | * \ingroup DemoFiles
49 | *
50 | */
51 |
52 | /*
53 | Changes from V2.0.0
54 |
55 | + Delay periods are now specified using variables and constants of
56 | TickType_t rather than unsigned long.
57 | */
58 |
59 | #include
60 |
61 | /* Scheduler include files. */
62 | #include "FreeRTOS.h"
63 | #include "queue.h"
64 |
65 | /* Demo program include files. */
66 | #include "print.h"
67 |
68 | static QueueHandle_t xPrintQueue;
69 |
70 | /*-----------------------------------------------------------*/
71 |
72 | void vPrintInitialise( void )
73 | {
74 | const unsigned portBASE_TYPE uxQueueSize = 20;
75 |
76 | /* Create the queue on which errors will be reported. */
77 | xPrintQueue = xQueueCreate( uxQueueSize, ( unsigned portBASE_TYPE ) sizeof( char * ) );
78 | }
79 | /*-----------------------------------------------------------*/
80 |
81 | void vPrintDisplayMessage( const char * const * ppcMessageToSend )
82 | {
83 | #ifdef USE_STDIO
84 | xQueueSend( xPrintQueue, ( void * ) ppcMessageToSend, ( TickType_t ) 0 );
85 | #else
86 | /* Stop warnings. */
87 | ( void ) ppcMessageToSend;
88 | #endif
89 | }
90 | /*-----------------------------------------------------------*/
91 |
92 | const char *pcPrintGetNextMessage( TickType_t xPrintRate )
93 | {
94 | char *pcMessage;
95 |
96 | if( xQueueReceive( xPrintQueue, &pcMessage, xPrintRate ) == pdPASS )
97 | {
98 | return pcMessage;
99 | }
100 | else
101 | {
102 | return NULL;
103 | }
104 | }
105 |
106 |
107 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/PollQ.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*
29 | * This version of PollQ. c is for use on systems that have limited stack
30 | * space and no display facilities. The complete version can be found in
31 | * the Demo/Common/Full directory.
32 | *
33 | * Creates two tasks that communicate over a single queue. One task acts as a
34 | * producer, the other a consumer.
35 | *
36 | * The producer loops for three iteration, posting an incrementing number onto the
37 | * queue each cycle. It then delays for a fixed period before doing exactly the
38 | * same again.
39 | *
40 | * The consumer loops emptying the queue. Each item removed from the queue is
41 | * checked to ensure it contains the expected value. When the queue is empty it
42 | * blocks for a fixed period, then does the same again.
43 | *
44 | * All queue access is performed without blocking. The consumer completely empties
45 | * the queue each time it runs so the producer should never find the queue full.
46 | *
47 | * An error is flagged if the consumer obtains an unexpected value or the producer
48 | * find the queue is full.
49 | */
50 |
51 | /*
52 | Changes from V2.0.0
53 |
54 | + Delay periods are now specified using variables and constants of
55 | TickType_t rather than uint32_t.
56 | */
57 |
58 | #include
59 |
60 | /* Scheduler include files. */
61 | #include "FreeRTOS.h"
62 | #include "task.h"
63 | #include "queue.h"
64 |
65 | /* Demo program include files. */
66 | #include "PollQ.h"
67 |
68 | #define pollqSTACK_SIZE configMINIMAL_STACK_SIZE
69 | #define pollqQUEUE_SIZE ( 10 )
70 | #define pollqPRODUCER_DELAY ( pdMS_TO_TICKS( ( TickType_t ) 200 ) )
71 | #define pollqCONSUMER_DELAY ( pollqPRODUCER_DELAY - ( TickType_t ) ( 20 / portTICK_PERIOD_MS ) )
72 | #define pollqNO_DELAY ( ( TickType_t ) 0 )
73 | #define pollqVALUES_TO_PRODUCE ( ( BaseType_t ) 3 )
74 | #define pollqINITIAL_VALUE ( ( BaseType_t ) 0 )
75 |
76 | /* The task that posts the incrementing number onto the queue. */
77 | static portTASK_FUNCTION_PROTO( vPolledQueueProducer, pvParameters );
78 |
79 | /* The task that empties the queue. */
80 | static portTASK_FUNCTION_PROTO( vPolledQueueConsumer, pvParameters );
81 |
82 | /* Variables that are used to check that the tasks are still running with no
83 | errors. */
84 | static volatile BaseType_t xPollingConsumerCount = pollqINITIAL_VALUE, xPollingProducerCount = pollqINITIAL_VALUE;
85 |
86 | /*-----------------------------------------------------------*/
87 |
88 | void vStartPolledQueueTasks( UBaseType_t uxPriority )
89 | {
90 | static QueueHandle_t xPolledQueue;
91 |
92 | /* Create the queue used by the producer and consumer. */
93 | xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( UBaseType_t ) sizeof( uint16_t ) );
94 |
95 | if( xPolledQueue != NULL )
96 | {
97 | /* vQueueAddToRegistry() adds the queue to the queue registry, if one is
98 | in use. The queue registry is provided as a means for kernel aware
99 | debuggers to locate queues and has no purpose if a kernel aware debugger
100 | is not being used. The call to vQueueAddToRegistry() will be removed
101 | by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
102 | defined to be less than 1. */
103 | vQueueAddToRegistry( xPolledQueue, "Poll_Test_Queue" );
104 |
105 | /* Spawn the producer and consumer. */
106 | xTaskCreate( vPolledQueueConsumer, "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );
107 | xTaskCreate( vPolledQueueProducer, "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );
108 | }
109 | }
110 | /*-----------------------------------------------------------*/
111 |
112 | static portTASK_FUNCTION( vPolledQueueProducer, pvParameters )
113 | {
114 | uint16_t usValue = ( uint16_t ) 0;
115 | BaseType_t xError = pdFALSE, xLoop;
116 |
117 | for( ;; )
118 | {
119 | for( xLoop = 0; xLoop < pollqVALUES_TO_PRODUCE; xLoop++ )
120 | {
121 | /* Send an incrementing number on the queue without blocking. */
122 | if( xQueueSend( *( ( QueueHandle_t * ) pvParameters ), ( void * ) &usValue, pollqNO_DELAY ) != pdPASS )
123 | {
124 | /* We should never find the queue full so if we get here there
125 | has been an error. */
126 | xError = pdTRUE;
127 | }
128 | else
129 | {
130 | if( xError == pdFALSE )
131 | {
132 | /* If an error has ever been recorded we stop incrementing the
133 | check variable. */
134 | portENTER_CRITICAL();
135 | xPollingProducerCount++;
136 | portEXIT_CRITICAL();
137 | }
138 |
139 | /* Update the value we are going to post next time around. */
140 | usValue++;
141 | }
142 | }
143 |
144 | /* Wait before we start posting again to ensure the consumer runs and
145 | empties the queue. */
146 | vTaskDelay( pollqPRODUCER_DELAY );
147 | }
148 | } /*lint !e818 Function prototype must conform to API. */
149 | /*-----------------------------------------------------------*/
150 |
151 | static portTASK_FUNCTION( vPolledQueueConsumer, pvParameters )
152 | {
153 | uint16_t usData, usExpectedValue = ( uint16_t ) 0;
154 | BaseType_t xError = pdFALSE;
155 |
156 | for( ;; )
157 | {
158 | /* Loop until the queue is empty. */
159 | while( uxQueueMessagesWaiting( *( ( QueueHandle_t * ) pvParameters ) ) )
160 | {
161 | if( xQueueReceive( *( ( QueueHandle_t * ) pvParameters ), &usData, pollqNO_DELAY ) == pdPASS )
162 | {
163 | if( usData != usExpectedValue )
164 | {
165 | /* This is not what we expected to receive so an error has
166 | occurred. */
167 | xError = pdTRUE;
168 |
169 | /* Catch-up to the value we received so our next expected
170 | value should again be correct. */
171 | usExpectedValue = usData;
172 | }
173 | else
174 | {
175 | if( xError == pdFALSE )
176 | {
177 | /* Only increment the check variable if no errors have
178 | occurred. */
179 | portENTER_CRITICAL();
180 | xPollingConsumerCount++;
181 | portEXIT_CRITICAL();
182 | }
183 | }
184 |
185 | /* Next time round we would expect the number to be one higher. */
186 | usExpectedValue++;
187 | }
188 | }
189 |
190 | /* Now the queue is empty we block, allowing the producer to place more
191 | items in the queue. */
192 | vTaskDelay( pollqCONSUMER_DELAY );
193 | }
194 | } /*lint !e818 Function prototype must conform to API. */
195 | /*-----------------------------------------------------------*/
196 |
197 | /* This is called to check that all the created tasks are still running with no errors. */
198 | BaseType_t xArePollingQueuesStillRunning( void )
199 | {
200 | BaseType_t xReturn;
201 |
202 | /* Check both the consumer and producer poll count to check they have both
203 | been changed since out last trip round. We do not need a critical section
204 | around the check variables as this is called from a higher priority than
205 | the other tasks that access the same variables. */
206 | if( ( xPollingConsumerCount == pollqINITIAL_VALUE ) ||
207 | ( xPollingProducerCount == pollqINITIAL_VALUE )
208 | )
209 | {
210 | xReturn = pdFALSE;
211 | }
212 | else
213 | {
214 | xReturn = pdTRUE;
215 | }
216 |
217 | /* Set the check variables back down so we know if they have been
218 | incremented the next time around. */
219 | xPollingConsumerCount = pollqINITIAL_VALUE;
220 | xPollingProducerCount = pollqINITIAL_VALUE;
221 |
222 | return xReturn;
223 | }
224 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/QueueOverwrite.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*
29 | * Basic task to demonstrate the xQueueOverwrite() function. See the comments
30 | * in the function itself.
31 | */
32 |
33 | /* Scheduler include files. */
34 | #include "FreeRTOS.h"
35 | #include "task.h"
36 | #include "queue.h"
37 |
38 | /* Demo program include files. */
39 | #include "QueueOverwrite.h"
40 |
41 | /* A block time of 0 just means "don't block". */
42 | #define qoDONT_BLOCK 0
43 |
44 | /* Number of times to overwrite the value in the queue. */
45 | #define qoLOOPS 5
46 |
47 | /* The task that uses the queue. */
48 | static void prvQueueOverwriteTask( void *pvParameters );
49 |
50 | /* Variable that is incremented on each loop of prvQueueOverwriteTask() provided
51 | prvQueueOverwriteTask() has not found any errors. */
52 | static uint32_t ulLoopCounter = 0;
53 |
54 | /* Set to pdFALSE if an error is discovered by the
55 | vQueueOverwritePeriodicISRDemo() function. */
56 | static BaseType_t xISRTestStatus = pdPASS;
57 |
58 | /* The queue that is accessed from the ISR. The queue accessed by the task is
59 | created inside the task itself. */
60 | static QueueHandle_t xISRQueue = NULL;
61 |
62 | /*-----------------------------------------------------------*/
63 |
64 | void vStartQueueOverwriteTask( UBaseType_t uxPriority )
65 | {
66 | const UBaseType_t uxQueueLength = 1;
67 |
68 | /* Create the queue used by the ISR. xQueueOverwriteFromISR() should only
69 | be used on queues that have a length of 1. */
70 | xISRQueue = xQueueCreate( uxQueueLength, ( UBaseType_t ) sizeof( uint32_t ) );
71 |
72 | /* Create the test task. The queue used by the test task is created inside
73 | the task itself. */
74 | xTaskCreate( prvQueueOverwriteTask, "QOver", configMINIMAL_STACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
75 | }
76 | /*-----------------------------------------------------------*/
77 |
78 | static void prvQueueOverwriteTask( void *pvParameters )
79 | {
80 | QueueHandle_t xTaskQueue;
81 | const UBaseType_t uxQueueLength = 1;
82 | uint32_t ulValue, ulStatus = pdPASS, x;
83 |
84 | /* The parameter is not used. */
85 | ( void ) pvParameters;
86 |
87 | /* Create the queue. xQueueOverwrite() should only be used on queues that
88 | have a length of 1. */
89 | xTaskQueue = xQueueCreate( uxQueueLength, ( UBaseType_t ) sizeof( uint32_t ) );
90 | configASSERT( xTaskQueue );
91 |
92 | for( ;; )
93 | {
94 | /* The queue is empty. Writing to the queue then reading from the queue
95 | should return the item written. */
96 | ulValue = 10;
97 | xQueueOverwrite( xTaskQueue, &ulValue );
98 |
99 | ulValue = 0;
100 | xQueueReceive( xTaskQueue, &ulValue, qoDONT_BLOCK );
101 |
102 | if( ulValue != 10 )
103 | {
104 | ulStatus = pdFAIL;
105 | }
106 |
107 | /* Now try writing to the queue several times. Each time the value
108 | in the queue should get overwritten. */
109 | for( x = 0; x < qoLOOPS; x++ )
110 | {
111 | /* Write to the queue. */
112 | xQueueOverwrite( xTaskQueue, &x );
113 |
114 | /* Check the value in the queue is that written, even though the
115 | queue was not necessarily empty. */
116 | xQueuePeek( xTaskQueue, &ulValue, qoDONT_BLOCK );
117 | if( ulValue != x )
118 | {
119 | ulStatus = pdFAIL;
120 | }
121 |
122 | /* There should always be one item in the queue. */
123 | if( uxQueueMessagesWaiting( xTaskQueue ) != uxQueueLength )
124 | {
125 | ulStatus = pdFAIL;
126 | }
127 | }
128 |
129 | /* Empty the queue again. */
130 | xQueueReceive( xTaskQueue, &ulValue, qoDONT_BLOCK );
131 |
132 | if( uxQueueMessagesWaiting( xTaskQueue ) != 0 )
133 | {
134 | ulStatus = pdFAIL;
135 | }
136 |
137 | if( ulStatus != pdFAIL )
138 | {
139 | /* Increment a counter to show this task is still running without
140 | error. */
141 | ulLoopCounter++;
142 | }
143 |
144 | #if( configUSE_PREEMPTION == 0 )
145 | taskYIELD();
146 | #endif
147 | }
148 | }
149 | /*-----------------------------------------------------------*/
150 |
151 | BaseType_t xIsQueueOverwriteTaskStillRunning( void )
152 | {
153 | BaseType_t xReturn;
154 |
155 | if( xISRTestStatus != pdPASS )
156 | {
157 | xReturn = pdFAIL;
158 | }
159 | else if( ulLoopCounter > 0 )
160 | {
161 | xReturn = pdPASS;
162 | }
163 | else
164 | {
165 | /* The task has either stalled of discovered an error. */
166 | xReturn = pdFAIL;
167 | }
168 |
169 | ulLoopCounter = 0;
170 |
171 | return xReturn;
172 | }
173 | /*-----------------------------------------------------------*/
174 |
175 | void vQueueOverwritePeriodicISRDemo( void )
176 | {
177 | static uint32_t ulCallCount = 0;
178 | const uint32_t ulTx1 = 10UL, ulTx2 = 20UL, ulNumberOfSwitchCases = 3UL;
179 | uint32_t ulRx;
180 |
181 | /* This function should be called from an interrupt, such as the tick hook
182 | function vApplicationTickHook(). */
183 |
184 | configASSERT( xISRQueue );
185 |
186 | switch( ulCallCount )
187 | {
188 | case 0:
189 | /* The queue is empty. Write ulTx1 to the queue. In this demo the
190 | last parameter is not used because there are no tasks blocked on
191 | this queue. */
192 | xQueueOverwriteFromISR( xISRQueue, &ulTx1, NULL );
193 |
194 | /* Peek the queue to check it holds the expected value. */
195 | xQueuePeekFromISR( xISRQueue, &ulRx );
196 | if( ulRx != ulTx1 )
197 | {
198 | xISRTestStatus = pdFAIL;
199 | }
200 | break;
201 |
202 | case 1:
203 | /* The queue already holds ulTx1. Overwrite the value in the queue
204 | with ulTx2. */
205 | xQueueOverwriteFromISR( xISRQueue, &ulTx2, NULL );
206 | break;
207 |
208 | case 2:
209 | /* Read from the queue to empty the queue again. The value read
210 | should be ulTx2. */
211 | xQueueReceiveFromISR( xISRQueue, &ulRx, NULL );
212 |
213 | if( ulRx != ulTx2 )
214 | {
215 | xISRTestStatus = pdFAIL;
216 | }
217 | break;
218 | }
219 |
220 | /* Run the next case in the switch statement above next time this function
221 | is called. */
222 | ulCallCount++;
223 |
224 | if( ulCallCount >= ulNumberOfSwitchCases )
225 | {
226 | /* Go back to the start. */
227 | ulCallCount = 0;
228 | }
229 | }
230 |
231 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/QueueSetPolling.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*
29 | * Tests the use of queue sets.
30 | *
31 | * A receive task creates a number of queues and adds them to a queue set before
32 | * blocking on the queue set receive. A transmit task and (optionally) an
33 | * interrupt repeatedly unblocks the receive task by sending messages to the
34 | * queues in a pseudo random order. The receive task removes the messages from
35 | * the queues and flags an error if the received message does not match that
36 | * expected. The task sends values in the range 0 to
37 | * queuesetINITIAL_ISR_TX_VALUE, and the ISR sends value in the range
38 | * queuesetINITIAL_ISR_TX_VALUE to ULONG_MAX.
39 | */
40 |
41 |
42 | /* Standard includes. */
43 | #include
44 | #include
45 |
46 | /* Kernel includes. */
47 | #include "FreeRTOS.h"
48 | #include "task.h"
49 | #include "queue.h"
50 |
51 | /* Demo includes. */
52 | #include "QueueSetPolling.h"
53 |
54 | /* The length of each created queue. */
55 | #define setpollQUEUE_LENGTH 10
56 |
57 | /* Block times used in this demo. A block time or 0 means "don't block". */
58 | #define setpollDONT_BLOCK 0
59 |
60 | /* The ISR sends to the queue every setpollISR_TX_PERIOD ticks. */
61 | #define queuesetISR_TX_PERIOD ( 50UL )
62 |
63 | /*
64 | * The task that reads from the queue set.
65 | */
66 | static void prvQueueSetReceivingTask( void *pvParameters );
67 |
68 | /*-----------------------------------------------------------*/
69 |
70 | /* The queue that is added to the set. */
71 | static QueueHandle_t xQueue = NULL;
72 |
73 | /* The handle of the queue set to which the queue is added. */
74 | static QueueSetHandle_t xQueueSet = NULL;
75 |
76 | /* Set to pdFAIL if an error is detected by any queue set task.
77 | ulCycleCounter will only be incremented if xQueueSetTasksSatus equals pdPASS. */
78 | static volatile BaseType_t xQueueSetPollStatus = pdPASS;
79 |
80 | /* Counter used to ensure the task is still running. */
81 | static uint32_t ulCycleCounter = 0;
82 |
83 | /*-----------------------------------------------------------*/
84 |
85 | void vStartQueueSetPollingTask( void )
86 | {
87 | /* Create the queue that is added to the set, the set, and add the queue to
88 | the set. */
89 | xQueue = xQueueCreate( setpollQUEUE_LENGTH, sizeof( uint32_t ) );
90 | xQueueSet = xQueueCreateSet( setpollQUEUE_LENGTH );
91 |
92 | if( ( xQueue != NULL ) && ( xQueueSet != NULL ) )
93 | {
94 | xQueueAddToSet( xQueue, xQueueSet );
95 |
96 | /* Create the task. */
97 | xTaskCreate( prvQueueSetReceivingTask, "SetPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
98 | }
99 | }
100 | /*-----------------------------------------------------------*/
101 |
102 | static void prvQueueSetReceivingTask( void *pvParameters )
103 | {
104 | uint32_t ulReceived, ulExpected = 0;
105 | QueueHandle_t xActivatedQueue;
106 |
107 | /* Remove compiler warnings. */
108 | ( void ) pvParameters;
109 |
110 | for( ;; )
111 | {
112 | /* Is a message waiting? A block time is not used to ensure the queue
113 | set is polled while it is being written to from an interrupt. */
114 | xActivatedQueue = xQueueSelectFromSet( xQueueSet, setpollDONT_BLOCK );
115 |
116 | if( xActivatedQueue != NULL )
117 | {
118 | /* Reading from the queue should pass with a zero block time as
119 | this task will only run when something has been posted to a task
120 | in the queue set. */
121 | if( xQueueReceive( xActivatedQueue, &ulReceived, setpollDONT_BLOCK ) != pdPASS )
122 | {
123 | xQueueSetPollStatus = pdFAIL;
124 | }
125 |
126 | if( ulReceived == ulExpected )
127 | {
128 | ulExpected++;
129 | }
130 | else
131 | {
132 | xQueueSetPollStatus = pdFAIL;
133 | }
134 |
135 | if( xQueueSetPollStatus == pdPASS )
136 | {
137 | ulCycleCounter++;
138 | }
139 | }
140 | }
141 | }
142 | /*-----------------------------------------------------------*/
143 |
144 | void vQueueSetPollingInterruptAccess( void )
145 | {
146 | static uint32_t ulCallCount = 0, ulValueToSend = 0;
147 |
148 | /* It is intended that this function is called from the tick hook
149 | function, so each call is one tick period apart. */
150 | ulCallCount++;
151 | if( ulCallCount > queuesetISR_TX_PERIOD )
152 | {
153 | ulCallCount = 0;
154 |
155 | if( xQueueSendFromISR( xQueue, ( void * ) &ulValueToSend, NULL ) == pdPASS )
156 | {
157 | /* Send the next value next time. */
158 | ulValueToSend++;
159 | }
160 | }
161 | }
162 | /*-----------------------------------------------------------*/
163 |
164 | BaseType_t xAreQueueSetPollTasksStillRunning( void )
165 | {
166 | static uint32_t ulLastCycleCounter = 0;
167 |
168 | if( ulLastCycleCounter == ulCycleCounter )
169 | {
170 | xQueueSetPollStatus = pdFAIL;
171 | }
172 |
173 | ulLastCycleCounter = ulCycleCounter;
174 |
175 | return xQueueSetPollStatus;
176 | }
177 | /*-----------------------------------------------------------*/
178 |
179 |
180 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/StreamBufferInterrupt.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*
29 | * A simple example that shows a stream buffer being used to pass data from an
30 | * interrupt to a task.
31 | *
32 | * There are two strings, pcStringToSend and pcStringToReceive, where
33 | * pcStringToReceive is a substring of pcStringToSend. The interrupt sends
34 | * a few bytes of pcStringToSend to a stream buffer ever few times that it
35 | * executes. A task reads the bytes from the stream buffer, looking for the
36 | * substring, and flagging an error if the received data is invalid.
37 | */
38 |
39 | /* Standard includes. */
40 | #include "stdio.h"
41 | #include "string.h"
42 |
43 | /* FreeRTOS includes. */
44 | #include "FreeRTOS.h"
45 | #include "task.h"
46 | #include "stream_buffer.h"
47 |
48 | /* Demo app includes. */
49 | #include "StreamBufferInterrupt.h"
50 |
51 | #define sbiSTREAM_BUFFER_LENGTH_BYTES ( ( size_t ) 100 )
52 | #define sbiSTREAM_BUFFER_TRIGGER_LEVEL_10 ( ( BaseType_t ) 10 )
53 |
54 | /*-----------------------------------------------------------*/
55 |
56 | /* Implements the task that receives a stream of bytes from the interrupt. */
57 | static void prvReceivingTask( void *pvParameters );
58 |
59 | /*-----------------------------------------------------------*/
60 |
61 | /* The stream buffer that is used to send data from an interrupt to the task. */
62 | static StreamBufferHandle_t xStreamBuffer = NULL;
63 |
64 | /* The string that is sent from the interrupt to the task four bytes at a
65 | time. Must be multiple of 4 bytes long as the ISR sends 4 bytes at a time*/
66 | static const char * pcStringToSend = "_____Hello FreeRTOS_____";
67 |
68 | /* The string to task is looking for, which must be a substring of
69 | pcStringToSend. */
70 | static const char * pcStringToReceive = "Hello FreeRTOS";
71 |
72 | /* Set to pdFAIL if anything unexpected happens. */
73 | static BaseType_t xDemoStatus = pdPASS;
74 |
75 | /* Incremented each time pcStringToReceive is correctly received, provided no
76 | errors have occurred. Used so the check task can check this task is still
77 | running as expected. */
78 | static uint32_t ulCycleCount = 0;
79 |
80 | /*-----------------------------------------------------------*/
81 |
82 | void vStartStreamBufferInterruptDemo( void )
83 | {
84 | /* Create the stream buffer that sends data from the interrupt to the
85 | task, and create the task. */
86 | xStreamBuffer = xStreamBufferCreate( /* The buffer length in bytes. */
87 | sbiSTREAM_BUFFER_LENGTH_BYTES,
88 | /* The stream buffer's trigger level. */
89 | sbiSTREAM_BUFFER_TRIGGER_LEVEL_10 );
90 |
91 | xTaskCreate( prvReceivingTask, /* The function that implements the task. */
92 | "StrIntRx", /* Human readable name for the task. */
93 | configMINIMAL_STACK_SIZE, /* Stack size (in words!). */
94 | NULL, /* Task parameter is not used. */
95 | tskIDLE_PRIORITY + 2, /* The priority at which the task is created. */
96 | NULL ); /* No use for the task handle. */
97 | }
98 | /*-----------------------------------------------------------*/
99 |
100 | static void prvReceivingTask( void *pvParameters )
101 | {
102 | char cRxBuffer[ 20 ];
103 | BaseType_t xNextByte = 0;
104 |
105 | /* Remove warning about unused parameters. */
106 | ( void ) pvParameters;
107 |
108 | /* Make sure the string will fit in the Rx buffer, including the NULL
109 | terminator. */
110 | configASSERT( sizeof( cRxBuffer ) > strlen( pcStringToReceive ) );
111 |
112 | /* Make sure the stream buffer has been created. */
113 | configASSERT( xStreamBuffer != NULL );
114 |
115 | /* Start with the Rx buffer in a known state. */
116 | memset( cRxBuffer, 0x00, sizeof( cRxBuffer ) );
117 |
118 | for( ;; )
119 | {
120 | /* Keep receiving characters until the end of the string is received.
121 | Note: An infinite block time is used to simplify the example. Infinite
122 | block times are not recommended in production code as they do not allow
123 | for error recovery. */
124 | xStreamBufferReceive( /* The stream buffer data is being received from. */
125 | xStreamBuffer,
126 | /* Where to place received data. */
127 | ( void * ) &( cRxBuffer[ xNextByte ] ),
128 | /* The number of bytes to receive. */
129 | sizeof( char ),
130 | /* The time to wait for the next data if the buffer
131 | is empty. */
132 | portMAX_DELAY );
133 |
134 | /* If xNextByte is 0 then this task is looking for the start of the
135 | string, which is 'H'. */
136 | if( xNextByte == 0 )
137 | {
138 | if( cRxBuffer[ xNextByte ] == 'H' )
139 | {
140 | /* The start of the string has been found. Now receive
141 | characters until the end of the string is found. */
142 | xNextByte++;
143 | }
144 | }
145 | else
146 | {
147 | /* Receiving characters while looking for the end of the string,
148 | which is an 'S'. */
149 | if( cRxBuffer[ xNextByte ] == 'S' )
150 | {
151 | /* The string has now been received. Check its validity. */
152 | if( strcmp( cRxBuffer, pcStringToReceive ) != 0 )
153 | {
154 | xDemoStatus = pdFAIL;
155 | }
156 |
157 | /* Return to start looking for the beginning of the string
158 | again. */
159 | memset( cRxBuffer, 0x00, sizeof( cRxBuffer ) );
160 | xNextByte = 0;
161 |
162 | /* Increment the cycle count as an indication to the check task
163 | that this demo is still running. */
164 | if( xDemoStatus == pdPASS )
165 | {
166 | ulCycleCount++;
167 | }
168 | }
169 | else
170 | {
171 | /* Receive the next character the next time around, while
172 | continuing to look for the end of the string. */
173 | xNextByte++;
174 |
175 | configASSERT( xNextByte < sizeof( cRxBuffer ) );
176 | }
177 | }
178 | }
179 | }
180 | /*-----------------------------------------------------------*/
181 |
182 | void vBasicStreamBufferSendFromISR( void )
183 | {
184 | static size_t xNextByteToSend = 0;
185 | const BaseType_t xCallsBetweenSends = 100, xBytesToSend = 4;
186 | static BaseType_t xCallCount = 0;
187 |
188 | /* Is it time to write to the stream buffer again? */
189 | xCallCount++;
190 | if( xCallCount > xCallsBetweenSends )
191 | {
192 | xCallCount = 0;
193 |
194 | /* Send the next four bytes to the stream buffer. */
195 | xStreamBufferSendFromISR( xStreamBuffer,
196 | ( void * ) ( pcStringToSend + xNextByteToSend ),
197 | xBytesToSend,
198 | NULL );
199 |
200 | /* Send the next four bytes the next time around, wrapping to the start
201 | of the string if necessary. */
202 | xNextByteToSend += xBytesToSend;
203 |
204 | if( xNextByteToSend >= strlen( pcStringToSend ) )
205 | {
206 | xNextByteToSend = 0;
207 | }
208 | }
209 | }
210 | /*-----------------------------------------------------------*/
211 |
212 | BaseType_t xIsInterruptStreamBufferDemoStillRunning( void )
213 | {
214 | uint32_t ulLastCycleCount = 0;
215 |
216 | /* Check the demo is still running. */
217 | if( ulLastCycleCount == ulCycleCount )
218 | {
219 | xDemoStatus = pdFAIL;
220 | }
221 | else
222 | {
223 | ulLastCycleCount = ulCycleCount;
224 | }
225 |
226 | return xDemoStatus;
227 | }
228 |
229 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/crflash.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*
29 | * This demo application file demonstrates the use of queues to pass data
30 | * between co-routines.
31 | *
32 | * N represents the number of 'fixed delay' co-routines that are created and
33 | * is set during initialisation.
34 | *
35 | * N 'fixed delay' co-routines are created that just block for a fixed
36 | * period then post the number of an LED onto a queue. Each such co-routine
37 | * uses a different block period. A single 'flash' co-routine is also created
38 | * that blocks on the same queue, waiting for the number of the next LED it
39 | * should flash. Upon receiving a number it simply toggle the instructed LED
40 | * then blocks on the queue once more. In this manner each LED from LED 0 to
41 | * LED N-1 is caused to flash at a different rate.
42 | *
43 | * The 'fixed delay' co-routines are created with co-routine priority 0. The
44 | * flash co-routine is created with co-routine priority 1. This means that
45 | * the queue should never contain more than a single item. This is because
46 | * posting to the queue will unblock the 'flash' co-routine, and as this has
47 | * a priority greater than the tasks posting to the queue it is guaranteed to
48 | * have emptied the queue and blocked once again before the queue can contain
49 | * any more date. An error is indicated if an attempt to post data to the
50 | * queue fails - indicating that the queue is already full.
51 | *
52 | */
53 |
54 | /* Scheduler includes. */
55 | #include "FreeRTOS.h"
56 | #include "croutine.h"
57 | #include "queue.h"
58 |
59 | /* Demo application includes. */
60 | #include "partest.h"
61 | #include "crflash.h"
62 |
63 | /* The queue should only need to be of length 1. See the description at the
64 | top of the file. */
65 | #define crfQUEUE_LENGTH 1
66 |
67 | #define crfFIXED_DELAY_PRIORITY 0
68 | #define crfFLASH_PRIORITY 1
69 |
70 | /* Only one flash co-routine is created so the index is not significant. */
71 | #define crfFLASH_INDEX 0
72 |
73 | /* Don't allow more than crfMAX_FLASH_TASKS 'fixed delay' co-routines to be
74 | created. */
75 | #define crfMAX_FLASH_TASKS 8
76 |
77 | /* We don't want to block when posting to the queue. */
78 | #define crfPOSTING_BLOCK_TIME 0
79 |
80 | /*
81 | * The 'fixed delay' co-routine as described at the top of the file.
82 | */
83 | static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex );
84 |
85 | /*
86 | * The 'flash' co-routine as described at the top of the file.
87 | */
88 | static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex );
89 |
90 | /* The queue used to pass data between the 'fixed delay' co-routines and the
91 | 'flash' co-routine. */
92 | static QueueHandle_t xFlashQueue;
93 |
94 | /* This will be set to pdFALSE if we detect an error. */
95 | static BaseType_t xCoRoutineFlashStatus = pdPASS;
96 |
97 | /*-----------------------------------------------------------*/
98 |
99 | /*
100 | * See the header file for details.
101 | */
102 | void vStartFlashCoRoutines( UBaseType_t uxNumberToCreate )
103 | {
104 | UBaseType_t uxIndex;
105 |
106 | if( uxNumberToCreate > crfMAX_FLASH_TASKS )
107 | {
108 | uxNumberToCreate = crfMAX_FLASH_TASKS;
109 | }
110 |
111 | /* Create the queue used to pass data between the co-routines. */
112 | xFlashQueue = xQueueCreate( crfQUEUE_LENGTH, sizeof( UBaseType_t ) );
113 |
114 | if( xFlashQueue )
115 | {
116 | /* Create uxNumberToCreate 'fixed delay' co-routines. */
117 | for( uxIndex = 0; uxIndex < uxNumberToCreate; uxIndex++ )
118 | {
119 | xCoRoutineCreate( prvFixedDelayCoRoutine, crfFIXED_DELAY_PRIORITY, uxIndex );
120 | }
121 |
122 | /* Create the 'flash' co-routine. */
123 | xCoRoutineCreate( prvFlashCoRoutine, crfFLASH_PRIORITY, crfFLASH_INDEX );
124 | }
125 | }
126 | /*-----------------------------------------------------------*/
127 |
128 | static void prvFixedDelayCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
129 | {
130 | /* Even though this is a co-routine the xResult variable does not need to be
131 | static as we do not need it to maintain its state between blocks. */
132 | BaseType_t xResult;
133 | /* The uxIndex parameter of the co-routine function is used as an index into
134 | the xFlashRates array to obtain the delay period to use. */
135 | static const TickType_t xFlashRates[ crfMAX_FLASH_TASKS ] = { 150 / portTICK_PERIOD_MS,
136 | 200 / portTICK_PERIOD_MS,
137 | 250 / portTICK_PERIOD_MS,
138 | 300 / portTICK_PERIOD_MS,
139 | 350 / portTICK_PERIOD_MS,
140 | 400 / portTICK_PERIOD_MS,
141 | 450 / portTICK_PERIOD_MS,
142 | 500 / portTICK_PERIOD_MS };
143 |
144 | /* Co-routines MUST start with a call to crSTART. */
145 | crSTART( xHandle );
146 |
147 | for( ;; )
148 | {
149 | /* Post our uxIndex value onto the queue. This is used as the LED to
150 | flash. */
151 | crQUEUE_SEND( xHandle, xFlashQueue, ( void * ) &uxIndex, crfPOSTING_BLOCK_TIME, &xResult );
152 |
153 | if( xResult != pdPASS )
154 | {
155 | /* For the reasons stated at the top of the file we should always
156 | find that we can post to the queue. If we could not then an error
157 | has occurred. */
158 | xCoRoutineFlashStatus = pdFAIL;
159 | }
160 |
161 | crDELAY( xHandle, xFlashRates[ uxIndex ] );
162 | }
163 |
164 | /* Co-routines MUST end with a call to crEND. */
165 | crEND();
166 | }
167 | /*-----------------------------------------------------------*/
168 |
169 | static void prvFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
170 | {
171 | /* Even though this is a co-routine the variable do not need to be
172 | static as we do not need it to maintain their state between blocks. */
173 | BaseType_t xResult;
174 | UBaseType_t uxLEDToFlash;
175 |
176 | /* Co-routines MUST start with a call to crSTART. */
177 | crSTART( xHandle );
178 | ( void ) uxIndex;
179 |
180 | for( ;; )
181 | {
182 | /* Block to wait for the number of the LED to flash. */
183 | crQUEUE_RECEIVE( xHandle, xFlashQueue, &uxLEDToFlash, portMAX_DELAY, &xResult );
184 |
185 | if( xResult != pdPASS )
186 | {
187 | /* We would not expect to wake unless we received something. */
188 | xCoRoutineFlashStatus = pdFAIL;
189 | }
190 | else
191 | {
192 | /* We received the number of an LED to flash - flash it! */
193 | vParTestToggleLED( uxLEDToFlash );
194 | }
195 | }
196 |
197 | /* Co-routines MUST end with a call to crEND. */
198 | crEND();
199 | }
200 | /*-----------------------------------------------------------*/
201 |
202 | BaseType_t xAreFlashCoRoutinesStillRunning( void )
203 | {
204 | /* Return pdPASS or pdFAIL depending on whether an error has been detected
205 | or not. */
206 | return xCoRoutineFlashStatus;
207 | }
208 |
209 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/crhook.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*
29 | * This demo file demonstrates how to send data between an ISR and a
30 | * co-routine. A tick hook function is used to periodically pass data between
31 | * the RTOS tick and a set of 'hook' co-routines.
32 | *
33 | * hookNUM_HOOK_CO_ROUTINES co-routines are created. Each co-routine blocks
34 | * to wait for a character to be received on a queue from the tick ISR, checks
35 | * to ensure the character received was that expected, then sends the number
36 | * back to the tick ISR on a different queue.
37 | *
38 | * The tick ISR checks the numbers received back from the 'hook' co-routines
39 | * matches the number previously sent.
40 | *
41 | * If at any time a queue function returns unexpectedly, or an incorrect value
42 | * is received either by the tick hook or a co-routine then an error is
43 | * latched.
44 | *
45 | * This demo relies on each 'hook' co-routine to execute between each
46 | * hookTICK_CALLS_BEFORE_POST tick interrupts. This and the heavy use of
47 | * queues from within an interrupt may result in an error being detected on
48 | * slower targets simply due to timing.
49 | */
50 |
51 | /* Scheduler includes. */
52 | #include "FreeRTOS.h"
53 | #include "croutine.h"
54 | #include "queue.h"
55 |
56 | /* Demo application includes. */
57 | #include "crhook.h"
58 |
59 | /* The number of 'hook' co-routines that are to be created. */
60 | #define hookNUM_HOOK_CO_ROUTINES ( 4 )
61 |
62 | /* The number of times the tick hook should be called before a character is
63 | posted to the 'hook' co-routines. */
64 | #define hookTICK_CALLS_BEFORE_POST ( 500 )
65 |
66 | /* There should never be more than one item in any queue at any time. */
67 | #define hookHOOK_QUEUE_LENGTH ( 1 )
68 |
69 | /* Don't block when initially posting to the queue. */
70 | #define hookNO_BLOCK_TIME ( 0 )
71 |
72 | /* The priority relative to other co-routines (rather than tasks) that the
73 | 'hook' co-routines should take. */
74 | #define mainHOOK_CR_PRIORITY ( 1 )
75 | /*-----------------------------------------------------------*/
76 |
77 | /*
78 | * The co-routine function itself.
79 | */
80 | static void prvHookCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex );
81 |
82 |
83 | /*
84 | * The tick hook function. This receives a number from each 'hook' co-routine
85 | * then sends a number to each co-routine. An error is flagged if a send or
86 | * receive fails, or an unexpected number is received.
87 | */
88 | void vApplicationTickHook( void );
89 |
90 | /*-----------------------------------------------------------*/
91 |
92 | /* Queues used to send data FROM a co-routine TO the tick hook function.
93 | The hook functions received (Rx's) on these queues. One queue per
94 | 'hook' co-routine. */
95 | static QueueHandle_t xHookRxQueues[ hookNUM_HOOK_CO_ROUTINES ];
96 |
97 | /* Queues used to send data FROM the tick hook TO a co-routine function.
98 | The hood function transmits (Tx's) on these queues. One queue per
99 | 'hook' co-routine. */
100 | static QueueHandle_t xHookTxQueues[ hookNUM_HOOK_CO_ROUTINES ];
101 |
102 | /* Set to true if an error is detected at any time. */
103 | static BaseType_t xCoRoutineErrorDetected = pdFALSE;
104 |
105 | /*-----------------------------------------------------------*/
106 |
107 | void vStartHookCoRoutines( void )
108 | {
109 | UBaseType_t uxIndex, uxValueToPost = 0;
110 |
111 | for( uxIndex = 0; uxIndex < hookNUM_HOOK_CO_ROUTINES; uxIndex++ )
112 | {
113 | /* Create a queue to transmit to and receive from each 'hook'
114 | co-routine. */
115 | xHookRxQueues[ uxIndex ] = xQueueCreate( hookHOOK_QUEUE_LENGTH, sizeof( UBaseType_t ) );
116 | xHookTxQueues[ uxIndex ] = xQueueCreate( hookHOOK_QUEUE_LENGTH, sizeof( UBaseType_t ) );
117 |
118 | /* To start things off the tick hook function expects the queue it
119 | uses to receive data to contain a value. */
120 | xQueueSend( xHookRxQueues[ uxIndex ], &uxValueToPost, hookNO_BLOCK_TIME );
121 |
122 | /* Create the 'hook' co-routine itself. */
123 | xCoRoutineCreate( prvHookCoRoutine, mainHOOK_CR_PRIORITY, uxIndex );
124 | }
125 | }
126 | /*-----------------------------------------------------------*/
127 |
128 | static UBaseType_t uxCallCounter = 0, uxNumberToPost = 0;
129 | void vApplicationTickHook( void )
130 | {
131 | UBaseType_t uxReceivedNumber;
132 | BaseType_t xIndex, xCoRoutineWoken;
133 |
134 | /* Is it time to talk to the 'hook' co-routines again? */
135 | uxCallCounter++;
136 | if( uxCallCounter >= hookTICK_CALLS_BEFORE_POST )
137 | {
138 | uxCallCounter = 0;
139 |
140 | for( xIndex = 0; xIndex < hookNUM_HOOK_CO_ROUTINES; xIndex++ )
141 | {
142 | xCoRoutineWoken = pdFALSE;
143 | if( crQUEUE_RECEIVE_FROM_ISR( xHookRxQueues[ xIndex ], &uxReceivedNumber, &xCoRoutineWoken ) != pdPASS )
144 | {
145 | /* There is no reason why we would not expect the queue to
146 | contain a value. */
147 | xCoRoutineErrorDetected = pdTRUE;
148 | }
149 | else
150 | {
151 | /* Each queue used to receive data from the 'hook' co-routines
152 | should contain the number we last posted to the same co-routine. */
153 | if( uxReceivedNumber != uxNumberToPost )
154 | {
155 | xCoRoutineErrorDetected = pdTRUE;
156 | }
157 |
158 | /* Nothing should be blocked waiting to post to the queue. */
159 | if( xCoRoutineWoken != pdFALSE )
160 | {
161 | xCoRoutineErrorDetected = pdTRUE;
162 | }
163 | }
164 | }
165 |
166 | /* Start the next cycle by posting the next number onto each Tx queue. */
167 | uxNumberToPost++;
168 |
169 | for( xIndex = 0; xIndex < hookNUM_HOOK_CO_ROUTINES; xIndex++ )
170 | {
171 | if( crQUEUE_SEND_FROM_ISR( xHookTxQueues[ xIndex ], &uxNumberToPost, pdFALSE ) != pdTRUE )
172 | {
173 | /* Posting to the queue should have woken the co-routine that
174 | was blocked on the queue. */
175 | xCoRoutineErrorDetected = pdTRUE;
176 | }
177 | }
178 | }
179 | }
180 | /*-----------------------------------------------------------*/
181 |
182 | static void prvHookCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
183 | {
184 | static UBaseType_t uxReceivedValue[ hookNUM_HOOK_CO_ROUTINES ];
185 | BaseType_t xResult;
186 |
187 | /* Each co-routine MUST start with a call to crSTART(); */
188 | crSTART( xHandle );
189 |
190 | for( ;; )
191 | {
192 | /* Wait to receive a value from the tick hook. */
193 | xResult = pdFAIL;
194 | crQUEUE_RECEIVE( xHandle, xHookTxQueues[ uxIndex ], &( uxReceivedValue[ uxIndex ] ), portMAX_DELAY, &xResult );
195 |
196 | /* There is no reason why we should not have received something on
197 | the queue. */
198 | if( xResult != pdPASS )
199 | {
200 | xCoRoutineErrorDetected = pdTRUE;
201 | }
202 |
203 | /* Send the same number back to the idle hook so it can verify it. */
204 | xResult = pdFAIL;
205 | crQUEUE_SEND( xHandle, xHookRxQueues[ uxIndex ], &( uxReceivedValue[ uxIndex ] ), hookNO_BLOCK_TIME, &xResult );
206 | if( xResult != pdPASS )
207 | {
208 | /* There is no reason why we should not have been able to post to
209 | the queue. */
210 | xCoRoutineErrorDetected = pdTRUE;
211 | }
212 | }
213 |
214 | /* Each co-routine MUST end with a call to crEND(). */
215 | crEND();
216 | }
217 | /*-----------------------------------------------------------*/
218 |
219 | BaseType_t xAreHookCoRoutinesStillRunning( void )
220 | {
221 | if( xCoRoutineErrorDetected )
222 | {
223 | return pdFALSE;
224 | }
225 | else
226 | {
227 | return pdTRUE;
228 | }
229 | }
230 |
231 |
232 |
233 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/death.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /**
29 | * Create a single persistent task which periodically dynamically creates another
30 | * two tasks. The original task is called the creator task, the two tasks it
31 | * creates are called suicidal tasks.
32 | *
33 | * One of the created suicidal tasks kill one other suicidal task before killing
34 | * itself - leaving just the original task remaining.
35 | *
36 | * The creator task must be spawned after all of the other demo application tasks
37 | * as it keeps a check on the number of tasks under the scheduler control. The
38 | * number of tasks it expects to see running should never be greater than the
39 | * number of tasks that were in existence when the creator task was spawned, plus
40 | * one set of four suicidal tasks. If this number is exceeded an error is flagged.
41 | *
42 | * \page DeathC death.c
43 | * \ingroup DemoFiles
44 | *
45 | */
46 |
47 |
48 | #include
49 |
50 | /* Scheduler include files. */
51 | #include "FreeRTOS.h"
52 | #include "task.h"
53 |
54 | /* Demo program include files. */
55 | #include "death.h"
56 |
57 | #define deathSTACK_SIZE ( configMINIMAL_STACK_SIZE + 60 )
58 |
59 | /* The task originally created which is responsible for periodically dynamically
60 | creating another four tasks. */
61 | static portTASK_FUNCTION_PROTO( vCreateTasks, pvParameters );
62 |
63 | /* The task function of the dynamically created tasks. */
64 | static portTASK_FUNCTION_PROTO( vSuicidalTask, pvParameters );
65 |
66 | /* A variable which is incremented every time the dynamic tasks are created. This
67 | is used to check that the task is still running. */
68 | static volatile uint16_t usCreationCount = 0;
69 |
70 | /* Used to store the number of tasks that were originally running so the creator
71 | task can tell if any of the suicidal tasks have failed to die.
72 | */
73 | static volatile UBaseType_t uxTasksRunningAtStart = 0;
74 |
75 | /* When a task deletes itself, it stack and TCB are cleaned up by the Idle task.
76 | Under heavy load the idle task might not get much processing time, so it would
77 | be legitimate for several tasks to remain undeleted for a short period. There
78 | may also be a few other unexpected tasks if, for example, the tasks that test
79 | static allocation are also being used. */
80 | static const UBaseType_t uxMaxNumberOfExtraTasksRunning = 3;
81 |
82 | /* Used to store a handle to the task that should be killed by a suicidal task,
83 | before it kills itself. */
84 | TaskHandle_t xCreatedTask;
85 |
86 | /*-----------------------------------------------------------*/
87 |
88 | void vCreateSuicidalTasks( UBaseType_t uxPriority )
89 | {
90 | xTaskCreate( vCreateTasks, "CREATOR", deathSTACK_SIZE, ( void * ) NULL, uxPriority, NULL );
91 | }
92 | /*-----------------------------------------------------------*/
93 |
94 | static portTASK_FUNCTION( vSuicidalTask, pvParameters )
95 | {
96 | volatile long l1, l2;
97 | TaskHandle_t xTaskToKill;
98 | const TickType_t xDelay = pdMS_TO_TICKS( ( TickType_t ) 200 );
99 |
100 | /* Test deletion of a task's secure context, if any. */
101 | portTASK_CALLS_SECURE_FUNCTIONS();
102 |
103 | if( pvParameters != NULL )
104 | {
105 | /* This task is periodically created four times. Two created tasks are
106 | passed a handle to the other task so it can kill it before killing itself.
107 | The other task is passed in null. */
108 | xTaskToKill = *( TaskHandle_t* )pvParameters;
109 | }
110 | else
111 | {
112 | xTaskToKill = NULL;
113 | }
114 |
115 | for( ;; )
116 | {
117 | /* Do something random just to use some stack and registers. */
118 | l1 = 2;
119 | l2 = 89;
120 | l2 *= l1;
121 | vTaskDelay( xDelay );
122 |
123 | if( xTaskToKill != NULL )
124 | {
125 | /* Make sure the other task has a go before we delete it. */
126 | vTaskDelay( ( TickType_t ) 0 );
127 |
128 | /* Kill the other task that was created by vCreateTasks(). */
129 | vTaskDelete( xTaskToKill );
130 |
131 | /* Kill ourselves. */
132 | vTaskDelete( NULL );
133 | }
134 | }
135 | }/*lint !e818 !e550 Function prototype must be as per standard for task functions. */
136 | /*-----------------------------------------------------------*/
137 |
138 | static portTASK_FUNCTION( vCreateTasks, pvParameters )
139 | {
140 | const TickType_t xDelay = pdMS_TO_TICKS( ( TickType_t ) 1000 );
141 | UBaseType_t uxPriority;
142 |
143 | /* Remove compiler warning about unused parameter. */
144 | ( void ) pvParameters;
145 |
146 | /* Delay at the start to ensure tasks created by other demos have been
147 | created before storing the current number of tasks. */
148 | vTaskDelay( xDelay );
149 | uxTasksRunningAtStart = ( UBaseType_t ) uxTaskGetNumberOfTasks();
150 |
151 | uxPriority = uxTaskPriorityGet( NULL );
152 |
153 | for( ;; )
154 | {
155 | /* Just loop round, delaying then creating the four suicidal tasks. */
156 | vTaskDelay( xDelay );
157 |
158 | xCreatedTask = NULL;
159 |
160 | xTaskCreate( vSuicidalTask, "SUICID1", configMINIMAL_STACK_SIZE, NULL, uxPriority, &xCreatedTask );
161 | xTaskCreate( vSuicidalTask, "SUICID2", configMINIMAL_STACK_SIZE, &xCreatedTask, uxPriority, NULL );
162 |
163 | ++usCreationCount;
164 | }
165 | }
166 | /*-----------------------------------------------------------*/
167 |
168 | /* This is called to check that the creator task is still running and that there
169 | are not any more than four extra tasks. */
170 | BaseType_t xIsCreateTaskStillRunning( void )
171 | {
172 | static uint16_t usLastCreationCount = 0xfff;
173 | BaseType_t xReturn = pdTRUE;
174 | static UBaseType_t uxTasksRunningNow;
175 |
176 | if( usLastCreationCount == usCreationCount )
177 | {
178 | xReturn = pdFALSE;
179 | }
180 | else
181 | {
182 | usLastCreationCount = usCreationCount;
183 | }
184 |
185 | uxTasksRunningNow = ( UBaseType_t ) uxTaskGetNumberOfTasks();
186 |
187 | if( uxTasksRunningNow < uxTasksRunningAtStart )
188 | {
189 | xReturn = pdFALSE;
190 | }
191 | else if( ( uxTasksRunningNow - uxTasksRunningAtStart ) > uxMaxNumberOfExtraTasksRunning )
192 | {
193 | xReturn = pdFALSE;
194 | }
195 | else
196 | {
197 | /* Everything is okay. */
198 | }
199 |
200 | return xReturn;
201 | }
202 |
203 |
204 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/flash.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /**
29 | * This version of flash .c is for use on systems that have limited stack space
30 | * and no display facilities. The complete version can be found in the
31 | * Demo/Common/Full directory.
32 | *
33 | * Three tasks are created, each of which flash an LED at a different rate. The first
34 | * LED flashes every 200ms, the second every 400ms, the third every 600ms.
35 | *
36 | * The LED flash tasks provide instant visual feedback. They show that the scheduler
37 | * is still operational.
38 | *
39 | */
40 |
41 |
42 | #include
43 |
44 | /* Scheduler include files. */
45 | #include "FreeRTOS.h"
46 | #include "task.h"
47 |
48 | /* Demo program include files. */
49 | #include "partest.h"
50 | #include "flash.h"
51 |
52 | #define ledSTACK_SIZE configMINIMAL_STACK_SIZE
53 | #define ledNUMBER_OF_LEDS ( 3 )
54 | #define ledFLASH_RATE_BASE ( ( TickType_t ) 333 )
55 |
56 | /* Variable used by the created tasks to calculate the LED number to use, and
57 | the rate at which they should flash the LED. */
58 | static volatile UBaseType_t uxFlashTaskNumber = 0;
59 |
60 | /* The task that is created three times. */
61 | static portTASK_FUNCTION_PROTO( vLEDFlashTask, pvParameters );
62 |
63 | /*-----------------------------------------------------------*/
64 |
65 | void vStartLEDFlashTasks( UBaseType_t uxPriority )
66 | {
67 | BaseType_t xLEDTask;
68 |
69 | /* Create the three tasks. */
70 | for( xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask )
71 | {
72 | /* Spawn the task. */
73 | xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
74 | }
75 | }
76 | /*-----------------------------------------------------------*/
77 |
78 | static portTASK_FUNCTION( vLEDFlashTask, pvParameters )
79 | {
80 | TickType_t xFlashRate, xLastFlashTime;
81 | UBaseType_t uxLED;
82 |
83 | /* The parameters are not used. */
84 | ( void ) pvParameters;
85 |
86 | /* Calculate the LED and flash rate. */
87 | portENTER_CRITICAL();
88 | {
89 | /* See which of the eight LED's we should use. */
90 | uxLED = uxFlashTaskNumber;
91 |
92 | /* Update so the next task uses the next LED. */
93 | uxFlashTaskNumber++;
94 | }
95 | portEXIT_CRITICAL();
96 |
97 | xFlashRate = ledFLASH_RATE_BASE + ( ledFLASH_RATE_BASE * ( TickType_t ) uxLED );
98 | xFlashRate /= portTICK_PERIOD_MS;
99 |
100 | /* We will turn the LED on and off again in the delay period, so each
101 | delay is only half the total period. */
102 | xFlashRate /= ( TickType_t ) 2;
103 |
104 | /* We need to initialise xLastFlashTime prior to the first call to
105 | vTaskDelayUntil(). */
106 | xLastFlashTime = xTaskGetTickCount();
107 |
108 | for(;;)
109 | {
110 | /* Delay for half the flash period then turn the LED on. */
111 | vTaskDelayUntil( &xLastFlashTime, xFlashRate );
112 | vParTestToggleLED( uxLED );
113 |
114 | /* Delay for half the flash period then turn the LED off. */
115 | vTaskDelayUntil( &xLastFlashTime, xFlashRate );
116 | vParTestToggleLED( uxLED );
117 | }
118 | } /*lint !e715 !e818 !e830 Function definition must be standard for task creation. */
119 |
120 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/flash_timer.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /**
29 | * Repeatedly toggles one or more LEDs using software timers - one timer per
30 | * LED.
31 | */
32 |
33 | /* Scheduler include files. */
34 | #include "FreeRTOS.h"
35 | #include "timers.h"
36 |
37 | /* Demo program include files. */
38 | #include "partest.h"
39 | #include "flash_timer.h"
40 |
41 | /* The toggle rates are all a multple of ledFLASH_RATE_BASE. */
42 | #define ledFLASH_RATE_BASE ( ( ( TickType_t ) 333 ) / portTICK_PERIOD_MS )
43 |
44 | /* A block time of zero simple means "don't block". */
45 | #define ledDONT_BLOCK ( ( TickType_t ) 0 )
46 |
47 | /*-----------------------------------------------------------*/
48 |
49 | /*
50 | * The callback function used by each LED flashing timer. All the timers use
51 | * this function, and the timer ID is used within the function to determine
52 | * which timer has actually expired.
53 | */
54 | static void prvLEDTimerCallback( TimerHandle_t xTimer );
55 |
56 | /*-----------------------------------------------------------*/
57 |
58 | void vStartLEDFlashTimers( UBaseType_t uxNumberOfLEDs )
59 | {
60 | UBaseType_t uxLEDTimer;
61 | TimerHandle_t xTimer;
62 |
63 | /* Create and start the requested number of timers. */
64 | for( uxLEDTimer = 0; uxLEDTimer < uxNumberOfLEDs; ++uxLEDTimer )
65 | {
66 | /* Create the timer. */
67 | xTimer = xTimerCreate( "Flasher", /* A text name, purely to help debugging. */
68 | ledFLASH_RATE_BASE * ( uxLEDTimer + 1 ),/* The timer period, which is a multiple of ledFLASH_RATE_BASE. */
69 | pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
70 | ( void * ) uxLEDTimer, /* The ID is used to identify the timer within the timer callback function, as each timer uses the same callback. */
71 | prvLEDTimerCallback /* Each timer uses the same callback. */
72 | );
73 |
74 | /* If the timer was created successfully, attempt to start it. If the
75 | scheduler has not yet been started then the timer command queue must
76 | be long enough to hold each command sent to it until such time that the
77 | scheduler is started. The timer command queue length is set by
78 | configTIMER_QUEUE_LENGTH in FreeRTOSConfig.h. */
79 | if( xTimer != NULL )
80 | {
81 | xTimerStart( xTimer, ledDONT_BLOCK );
82 | }
83 | }
84 | }
85 | /*-----------------------------------------------------------*/
86 |
87 | static void prvLEDTimerCallback( TimerHandle_t xTimer )
88 | {
89 | BaseType_t xTimerID;
90 |
91 | /* The timer ID is used to identify the timer that has actually expired as
92 | each timer uses the same callback. The ID is then also used as the number
93 | of the LED that is to be toggled. */
94 | xTimerID = ( BaseType_t ) pvTimerGetTimerID( xTimer );
95 | vParTestToggleLED( xTimerID );
96 | }
97 |
98 |
99 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/integer.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*
29 | * Creates one or more tasks that repeatedly perform a set of integer
30 | * calculations. The result of each run-time calculation is compared to the
31 | * known expected result - with a mismatch being indicative of an error in the
32 | * context switch mechanism.
33 | */
34 |
35 | #include
36 |
37 | /* Scheduler include files. */
38 | #include "FreeRTOS.h"
39 | #include "task.h"
40 |
41 | /* Demo program include files. */
42 | #include "integer.h"
43 |
44 | /* The constants used in the calculation. */
45 | #define intgCONST1 ( ( long ) 123 )
46 | #define intgCONST2 ( ( long ) 234567 )
47 | #define intgCONST3 ( ( long ) -3 )
48 | #define intgCONST4 ( ( long ) 7 )
49 | #define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
50 |
51 | #define intgSTACK_SIZE configMINIMAL_STACK_SIZE
52 |
53 | /* As this is the minimal version, we will only create one task. */
54 | #define intgNUMBER_OF_TASKS ( 1 )
55 |
56 | /* The task function. Repeatedly performs a 32 bit calculation, checking the
57 | result against the expected result. If the result is incorrect then the
58 | context switch must have caused some corruption. */
59 | static portTASK_FUNCTION_PROTO( vCompeteingIntMathTask, pvParameters );
60 |
61 | /* Variables that are set to true within the calculation task to indicate
62 | that the task is still executing. The check task sets the variable back to
63 | false, flagging an error if the variable is still false the next time it
64 | is called. */
65 | static BaseType_t xTaskCheck[ intgNUMBER_OF_TASKS ] = { ( BaseType_t ) pdFALSE };
66 |
67 | /*-----------------------------------------------------------*/
68 |
69 | void vStartIntegerMathTasks( UBaseType_t uxPriority )
70 | {
71 | short sTask;
72 |
73 | for( sTask = 0; sTask < intgNUMBER_OF_TASKS; sTask++ )
74 | {
75 | xTaskCreate( vCompeteingIntMathTask, "IntMath", intgSTACK_SIZE, ( void * ) &( xTaskCheck[ sTask ] ), uxPriority, ( TaskHandle_t * ) NULL );
76 | }
77 | }
78 | /*-----------------------------------------------------------*/
79 |
80 | static portTASK_FUNCTION( vCompeteingIntMathTask, pvParameters )
81 | {
82 | /* These variables are all effectively set to constants so they are volatile to
83 | ensure the compiler does not just get rid of them. */
84 | volatile long lValue;
85 | short sError = pdFALSE;
86 | volatile BaseType_t *pxTaskHasExecuted;
87 |
88 | /* Set a pointer to the variable we are going to set to true each
89 | iteration. This is also a good test of the parameter passing mechanism
90 | within each port. */
91 | pxTaskHasExecuted = ( volatile BaseType_t * ) pvParameters;
92 |
93 | /* Keep performing a calculation and checking the result against a constant. */
94 | for( ;; )
95 | {
96 | /* Perform the calculation. This will store partial value in
97 | registers, resulting in a good test of the context switch mechanism. */
98 | lValue = intgCONST1;
99 | lValue += intgCONST2;
100 |
101 | /* Yield in case cooperative scheduling is being used. */
102 | #if configUSE_PREEMPTION == 0
103 | {
104 | taskYIELD();
105 | }
106 | #endif
107 |
108 | /* Finish off the calculation. */
109 | lValue *= intgCONST3;
110 | lValue /= intgCONST4;
111 |
112 | /* If the calculation is found to be incorrect we stop setting the
113 | TaskHasExecuted variable so the check task can see an error has
114 | occurred. */
115 | if( lValue != intgEXPECTED_ANSWER ) /*lint !e774 volatile used to prevent this being optimised out. */
116 | {
117 | sError = pdTRUE;
118 | }
119 |
120 | if( sError == pdFALSE )
121 | {
122 | /* We have not encountered any errors, so set the flag that show
123 | we are still executing. This will be periodically cleared by
124 | the check task. */
125 | portENTER_CRITICAL();
126 | *pxTaskHasExecuted = pdTRUE;
127 | portEXIT_CRITICAL();
128 | }
129 |
130 | /* Yield in case cooperative scheduling is being used. */
131 | #if configUSE_PREEMPTION == 0
132 | {
133 | taskYIELD();
134 | }
135 | #endif
136 | }
137 | }
138 | /*-----------------------------------------------------------*/
139 |
140 | /* This is called to check that all the created tasks are still running. */
141 | BaseType_t xAreIntegerMathsTaskStillRunning( void )
142 | {
143 | BaseType_t xReturn = pdTRUE;
144 | short sTask;
145 |
146 | /* Check the maths tasks are still running by ensuring their check variables
147 | are still being set to true. */
148 | for( sTask = 0; sTask < intgNUMBER_OF_TASKS; sTask++ )
149 | {
150 | if( xTaskCheck[ sTask ] == pdFALSE )
151 | {
152 | /* The check has not incremented so an error exists. */
153 | xReturn = pdFALSE;
154 | }
155 |
156 | /* Reset the check variable so we can tell if it has been set by
157 | the next time around. */
158 | xTaskCheck[ sTask ] = pdFALSE;
159 | }
160 |
161 | return xReturn;
162 | }
163 |
164 |
--------------------------------------------------------------------------------
/Demo/Common/Minimal/readme.txt:
--------------------------------------------------------------------------------
1 | This directory contains the implementation of the "common demo tasks". These
2 | are test tasks and demo tasks that are used by nearly all the demo applications.
--------------------------------------------------------------------------------
/Demo/Common/ReadMe.txt:
--------------------------------------------------------------------------------
1 | Contains the files that are not specific to any one demo, but are instead used
2 | by all the demo applications.
3 |
4 | Most of the directories are now obsolete, and only maintained for backward
5 | compatibility. The directories in active use are:
6 |
7 | + Minimal - this contains the implementation of what are referred to as the
8 | "Standard Demo Tasks". These are used by all the demo applications. Their only
9 | purpose is to demonstrate the FreeRTOS API and test the FreeRTOS features. The
10 | directory is called 'Minimal' as it contains a minimal implementation of files
11 | contained in the 'Full' directory - but the 'Full' directory is no longer used.
12 |
13 | + include - contains header files for the C source files located in the Minimal
14 | directory.
--------------------------------------------------------------------------------
/Demo/Common/include/AbortDelay.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef ABORT_DELAY_H
29 | #define ABORT_DELAY_H
30 |
31 | void vCreateAbortDelayTasks( void );
32 | BaseType_t xAreAbortDelayTestTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/BlockQ.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef BLOCK_Q_H
29 | #define BLOCK_Q_H
30 |
31 | void vStartBlockingQueueTasks( UBaseType_t uxPriority );
32 | BaseType_t xAreBlockingQueuesStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/EventGroupsDemo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 |
29 |
30 | /*
31 | * This file contains fairly comprehensive checks on the behaviour of event
32 | * groups. It is not intended to be a user friendly demonstration of the event
33 | * groups API.
34 | */
35 |
36 | #ifndef EVENT_GROUPS_DEMO_H
37 | #define EVENT_GROUPS_DEMO_H
38 |
39 | void vStartEventGroupTasks( void );
40 | BaseType_t xAreEventGroupTasksStillRunning( void );
41 | void vPeriodicEventGroupsProcessing( void );
42 |
43 | #endif /* EVENT_GROUPS_DEMO_H */
44 |
45 |
--------------------------------------------------------------------------------
/Demo/Common/include/GenQTest.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef GEN_Q_TEST_H
29 | #define GEN_Q_TEST_H
30 |
31 | void vStartGenericQueueTasks( UBaseType_t uxPriority );
32 | BaseType_t xAreGenericQueueTasksStillRunning( void );
33 | void vMutexISRInteractionTest( void );
34 |
35 | #endif /* GEN_Q_TEST_H */
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Demo/Common/include/IntQueue.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef QUEUE_ACCESS_TEST
29 | #define QUEUE_ACCESS_TEST
30 |
31 | void vStartInterruptQueueTasks( void );
32 | BaseType_t xAreIntQueueTasksStillRunning( void );
33 | BaseType_t xFirstTimerHandler( void );
34 | BaseType_t xSecondTimerHandler( void );
35 |
36 | #endif /* QUEUE_ACCESS_TEST */
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Demo/Common/include/IntSemTest.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef INT_SEM_TEST_H
29 | #define INT_SEM_TEST_H
30 |
31 | void vStartInterruptSemaphoreTasks( void );
32 | BaseType_t xAreInterruptSemaphoreTasksStillRunning( void );
33 | void vInterruptSemaphorePeriodicTest( void );
34 |
35 | #endif /* INT_SEM_TEST_H */
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Demo/Common/include/MessageBufferAMP.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef MESSAGE_BUFFER_AMP_H
29 | #define MESSAGE_BUFFER_AMP_H
30 |
31 | void vStartMessageBufferAMPTasks( void );
32 | BaseType_t xAreMessageBufferAMPTasksStillRunning( void );
33 | void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer );
34 |
35 | #endif /* MESSAGE_BUFFER_AMP_H */
36 |
--------------------------------------------------------------------------------
/Demo/Common/include/MessageBufferDemo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef MESSAGE_BUFFER_TEST_H
29 | #define MESSAGE_BUFFER_TEST_H
30 |
31 | void vStartMessageBufferTasks( void );
32 | BaseType_t xAreMessageBufferTasksStillRunning( void );
33 |
34 | #endif /* MESSAGE_BUFFER_TEST_H */
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Demo/Common/include/PollQ.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef POLLED_Q_H
29 | #define POLLED_Q_H
30 |
31 | void vStartPolledQueueTasks( UBaseType_t uxPriority );
32 | BaseType_t xArePollingQueuesStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/QPeek.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef Q_PEEK_TEST_H
29 | #define Q_PEEK_TEST_H
30 |
31 | void vStartQueuePeekTasks( void );
32 | BaseType_t xAreQueuePeekTasksStillRunning( void );
33 |
34 | #endif /* Q_PEEK_TEST_H */
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Demo/Common/include/QueueOverwrite.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef QUEUE_OVERWRITE_H
29 | #define QUEUE_OVERWRITE_H
30 |
31 | void vStartQueueOverwriteTask( UBaseType_t uxPriority );
32 | BaseType_t xIsQueueOverwriteTaskStillRunning( void );
33 | void vQueueOverwritePeriodicISRDemo( void );
34 |
35 | #endif /* QUEUE_OVERWRITE_H */
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Demo/Common/include/QueueSet.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef QUEUE_WAIT_MULTIPLE_H
29 | #define QUEUE_WAIT_MULTIPLE_H
30 |
31 | void vStartQueueSetTasks( void );
32 | BaseType_t xAreQueueSetTasksStillRunning( void );
33 | void vQueueSetAccessQueueSetFromISR( void );
34 |
35 | #endif /* QUEUE_WAIT_MULTIPLE_H */
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Demo/Common/include/QueueSetPolling.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef QUEUE_SET_POLLING_H
29 | #define QUEUE_SET_POLLING_H
30 |
31 | void vStartQueueSetPollingTask( void );
32 | BaseType_t xAreQueueSetPollTasksStillRunning( void );
33 | void vQueueSetPollingInterruptAccess( void );
34 |
35 | #endif /* QUEUE_SET_POLLING_H */
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Demo/Common/include/StaticAllocation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef STATIC_ALLOCATION_H
29 | #define STATIC_ALLOCATION_H
30 |
31 | void vStartStaticallyAllocatedTasks( void );
32 | BaseType_t xAreStaticAllocationTasksStillRunning( void );
33 |
34 | #endif /* STATIC_ALLOCATION_H */
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Demo/Common/include/StreamBufferDemo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef STREAM_BUFFER_TEST_H
29 | #define STREAM_BUFFER_TEST_H
30 |
31 | void vStartStreamBufferTasks( void );
32 | BaseType_t xAreStreamBufferTasksStillRunning( void );
33 | void vPeriodicStreamBufferProcessing( void );
34 |
35 | #endif /* STREAM_BUFFER_TEST_H */
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Demo/Common/include/StreamBufferInterrupt.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef STREAM_BUFFER_INTERRUPT_H
29 | #define STREAM_BUFFER_INTERRUPT_H
30 |
31 | void vStartStreamBufferInterruptDemo( void );
32 | void vBasicStreamBufferSendFromISR( void );
33 | BaseType_t xIsInterruptStreamBufferDemoStillRunning( void );
34 |
35 | #endif /* STREAM_BUFFER_INTERRUPT_H */
36 |
--------------------------------------------------------------------------------
/Demo/Common/include/TaskNotify.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef TASK_NOTIFY_H
29 | #define TASK_NOTIFY_H
30 |
31 | void vStartTaskNotifyTask( void );
32 | BaseType_t xAreTaskNotificationTasksStillRunning( void );
33 | void xNotifyTaskFromISR( void );
34 |
35 | #endif /* TASK_NOTIFY_H */
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Demo/Common/include/TimerDemo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef TIMER_DEMO_H
29 | #define TIMER_DEMO_H
30 |
31 | void vStartTimerDemoTask( TickType_t xBaseFrequencyIn );
32 | BaseType_t xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency );
33 | void vTimerPeriodicISRTests( void );
34 |
35 | #endif /* TIMER_DEMO_H */
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Demo/Common/include/blocktim.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef BLOCK_TIME_TEST_H
29 | #define BLOCK_TIME_TEST_H
30 |
31 | void vCreateBlockTimeTasks( void );
32 | BaseType_t xAreBlockTimeTestTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/comtest.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef COMTEST_H
29 | #define COMTEST_H
30 |
31 | void vAltStartComTestTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED );
32 | void vStartComTestTasks( UBaseType_t uxPriority, eCOMPort ePort, eBaud eBaudRate );
33 | BaseType_t xAreComTestTasksStillRunning( void );
34 | void vComTestUnsuspendTask( void );
35 |
36 | #endif
37 |
38 |
--------------------------------------------------------------------------------
/Demo/Common/include/comtest2.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef COMTEST_H
29 | #define COMTEST_H
30 |
31 | void vAltStartComTestTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED );
32 | BaseType_t xAreComTestTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
--------------------------------------------------------------------------------
/Demo/Common/include/comtest_strings.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef COMTEST_STRINGS_H
29 | #define COMTEST_STRINGS_H
30 |
31 | void vStartComTestStringsTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED );
32 | BaseType_t xAreComTestTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
--------------------------------------------------------------------------------
/Demo/Common/include/countsem.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef COUNT_SEMAPHORE_TEST_H
29 | #define COUNT_SEMAPHORE_TEST_H
30 |
31 | void vStartCountingSemaphoreTasks( void );
32 | BaseType_t xAreCountingSemaphoreTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
--------------------------------------------------------------------------------
/Demo/Common/include/crflash.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef CRFLASH_LED_H
29 | #define CRFLASH_LED_H
30 |
31 | /*
32 | * Create the co-routines used to flash the LED's at different rates.
33 | *
34 | * @param uxPriority The number of 'fixed delay' co-routines to create. This
35 | * also effects the number of LED's that will be utilised. For example,
36 | * passing in 3 will cause LED's 0 to 2 to be utilised.
37 | */
38 | void vStartFlashCoRoutines( UBaseType_t uxPriority );
39 |
40 | /*
41 | * Return pdPASS or pdFAIL depending on whether an error has been detected
42 | * or not.
43 | */
44 | BaseType_t xAreFlashCoRoutinesStillRunning( void );
45 |
46 | #endif
47 |
48 |
--------------------------------------------------------------------------------
/Demo/Common/include/crhook.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef CRHOOK_H
29 | #define CRHOOK_H
30 |
31 | /*
32 | * Create the co-routines used to communicate wit the tick hook.
33 | */
34 | void vStartHookCoRoutines( void );
35 |
36 | /*
37 | * Return pdPASS or pdFAIL depending on whether an error has been detected
38 | * or not.
39 | */
40 | BaseType_t xAreHookCoRoutinesStillRunning( void );
41 |
42 | #endif
43 |
44 |
--------------------------------------------------------------------------------
/Demo/Common/include/death.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef SUICIDE_TASK_H
29 | #define SUICIDE_TASK_H
30 |
31 | void vCreateSuicidalTasks( UBaseType_t uxPriority );
32 | BaseType_t xIsCreateTaskStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/dynamic.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef DYNAMIC_MANIPULATION_H
29 | #define DYNAMIC_MANIPULATION_H
30 |
31 | void vStartDynamicPriorityTasks( void );
32 | BaseType_t xAreDynamicPriorityTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/fileIO.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef FILE_IO_H
29 | #define FILE_IO_H
30 |
31 | void vDisplayMessage( const char * const pcMessageToPrint );
32 | void vWriteMessageToDisk( const char * const pcMessage );
33 | void vWriteBufferToDisk( const char * const pcBuffer, uint32_t ulBufferLength );
34 |
35 | #endif
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/flash.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef FLASH_LED_H
29 | #define FLASH_LED_H
30 |
31 | void vStartLEDFlashTasks( UBaseType_t uxPriority );
32 |
33 | #endif
34 |
35 |
--------------------------------------------------------------------------------
/Demo/Common/include/flash_timer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef FLASH_TIMER_H
29 | #define FLASH_TIMER_H
30 |
31 | /*
32 | * Creates the LED flashing timers. xNumberOfLEDs specifies how many timers to
33 | * create, with each timer toggling a different LED. The first LED to be
34 | * toggled is LED 0, with subsequent LEDs following on in numerical order. Each
35 | * timer uses the exact same callback function, with the timer ID being used
36 | * within the callback function to determine which timer has actually expired
37 | * (and therefore which LED to toggle).
38 | */
39 | void vStartLEDFlashTimers( UBaseType_t uxNumberOfLEDs );
40 |
41 | #endif /* FLASH_TIMER_H */
42 |
--------------------------------------------------------------------------------
/Demo/Common/include/flop.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef FLOP_TASKS_H
29 | #define FLOP_TASKS_H
30 |
31 | void vStartMathTasks( UBaseType_t uxPriority );
32 | BaseType_t xAreMathsTaskStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/integer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef INTEGER_TASKS_H
29 | #define INTEGER_TASKS_H
30 |
31 | void vStartIntegerMathTasks( UBaseType_t uxPriority );
32 | BaseType_t xAreIntegerMathsTaskStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/mevents.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef EVENTS_TEST_H
29 | #define EVENTS_TEST_H
30 |
31 | void vStartMultiEventTasks( void );
32 | BaseType_t xAreMultiEventTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Demo/Common/include/partest.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef PARTEST_H
29 | #define PARTEST_H
30 |
31 | #define partstDEFAULT_PORT_ADDRESS ( ( uint16_t ) 0x378 )
32 |
33 | void vParTestInitialise( void );
34 | void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue );
35 | void vParTestToggleLED( UBaseType_t uxLED );
36 |
37 | #endif
38 |
39 |
--------------------------------------------------------------------------------
/Demo/Common/include/print.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef PRINT_H
29 | #define PRINT_H
30 |
31 | void vPrintInitialise( void );
32 | void vPrintDisplayMessage( const char * const * pcMessageToSend );
33 | const char *pcPrintGetNextMessage( TickType_t xPrintRate );
34 |
35 | #endif
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Demo/Common/include/recmutex.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef RECURSIVE_MUTEX_TEST_H
29 | #define RECURSIVE_MUTEX_TEST_H
30 |
31 | void vStartRecursiveMutexTasks( void );
32 | BaseType_t xAreRecursiveMutexTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
--------------------------------------------------------------------------------
/Demo/Common/include/semtest.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef SEMAPHORE_TEST_H
29 | #define SEMAPHORE_TEST_H
30 |
31 | void vStartSemaphoreTasks( UBaseType_t uxPriority );
32 | BaseType_t xAreSemaphoreTasksStillRunning( void );
33 |
34 | #endif
35 |
36 |
--------------------------------------------------------------------------------
/Demo/Common/include/serial.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef SERIAL_COMMS_H
29 | #define SERIAL_COMMS_H
30 |
31 | typedef void * xComPortHandle;
32 |
33 | typedef enum
34 | {
35 | serCOM1,
36 | serCOM2,
37 | serCOM3,
38 | serCOM4,
39 | serCOM5,
40 | serCOM6,
41 | serCOM7,
42 | serCOM8
43 | } eCOMPort;
44 |
45 | typedef enum
46 | {
47 | serNO_PARITY,
48 | serODD_PARITY,
49 | serEVEN_PARITY,
50 | serMARK_PARITY,
51 | serSPACE_PARITY
52 | } eParity;
53 |
54 | typedef enum
55 | {
56 | serSTOP_1,
57 | serSTOP_2
58 | } eStopBits;
59 |
60 | typedef enum
61 | {
62 | serBITS_5,
63 | serBITS_6,
64 | serBITS_7,
65 | serBITS_8
66 | } eDataBits;
67 |
68 | typedef enum
69 | {
70 | ser50,
71 | ser75,
72 | ser110,
73 | ser134,
74 | ser150,
75 | ser200,
76 | ser300,
77 | ser600,
78 | ser1200,
79 | ser1800,
80 | ser2400,
81 | ser4800,
82 | ser9600,
83 | ser19200,
84 | ser38400,
85 | ser57600,
86 | ser115200
87 | } eBaud;
88 |
89 | xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength );
90 | xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength );
91 | void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength );
92 | signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime );
93 | signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime );
94 | portBASE_TYPE xSerialWaitForSemaphore( xComPortHandle xPort );
95 | void vSerialClose( xComPortHandle xPort );
96 |
97 | #endif
98 |
99 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | ######## Build options ########
2 |
3 | verbose = 0
4 |
5 | ######## Build setup ########
6 |
7 | # SRCROOT should always be the current directory
8 | SRCROOT = $(CURDIR)
9 |
10 | # .o directory
11 | ODIR = obj
12 |
13 | # Source VPATHS
14 | VPATH += $(SRCROOT)/Source
15 | VPATH += $(SRCROOT)/Source/portable/MemMang
16 | VPATH += $(SRCROOT)/Source/portable/GCC/POSIX
17 | VPATH += $(SRCROOT)/Demo/Common
18 | VPATH += $(SRCROOT)/Project/FileIO
19 | VPATH += $(SRCROOT)/Project
20 |
21 | # FreeRTOS Objects
22 | C_FILES += croutine.c
23 | C_FILES += event_groups.c
24 | C_FILES += list.c
25 | C_FILES += queue.c
26 | C_FILES += tasks.c
27 | C_FILES += timers.c
28 |
29 | # portable Objects
30 | C_FILES += heap_3.c
31 | C_FILES += port.c
32 |
33 | # Demo Objects
34 | C_FILES += Minimal/blocktim.c
35 | C_FILES += Minimal/countsem.c
36 | C_FILES += Minimal/GenQTest.c
37 | C_FILES += Minimal/QPeek.c
38 | C_FILES += Minimal/recmutex.c
39 | C_FILES += Full/BlockQ.c
40 | C_FILES += Full/death.c
41 | C_FILES += Full/dynamic.c
42 | C_FILES += Full/flop.c
43 | C_FILES += Full/integer.c
44 | C_FILES += Full/PollQ.c
45 | C_FILES += Full/semtest.c
46 | C_FILES += Full/print.c
47 |
48 | C_FILES += Minimal/AbortDelay.c
49 | C_FILES += Minimal/EventGroupsDemo.c
50 | C_FILES += Minimal/IntSemTest.c
51 | C_FILES += Minimal/QueueSet.c
52 | C_FILES += Minimal/QueueSetPolling.c
53 | C_FILES += Minimal/QueueOverwrite.c
54 | C_FILES += Minimal/TaskNotify.c
55 | C_FILES += Minimal/TimerDemo.c
56 |
57 | # Main Object
58 | C_FILES += main.c
59 |
60 | # Include Paths
61 | INCLUDES += -I$(SRCROOT)/Source/include
62 | INCLUDES += -I$(SRCROOT)/Source/portable/GCC/POSIX/
63 | INCLUDES += -I$(SRCROOT)/Demo/Common/include
64 | INCLUDES += -I$(SRCROOT)/Project
65 |
66 | # Generate OBJS names
67 | OBJS = $(patsubst %.c,%.o,$(C_FILES))
68 |
69 | ######## C Flags ########
70 |
71 | # Warnings
72 | CWARNS += -W
73 | CWARNS += -Wall
74 | CWARNS += -Werror
75 | CWARNS += -Wextra
76 | CWARNS += -Wformat
77 | CWARNS += -Wmissing-braces
78 | CWARNS += -Wno-cast-align
79 | CWARNS += -Wparentheses
80 | CWARNS += -Wshadow
81 | CWARNS += -Wno-sign-compare
82 | CWARNS += -Wswitch
83 | CWARNS += -Wuninitialized
84 | CWARNS += -Wunknown-pragmas
85 | CWARNS += -Wunused-function
86 | CWARNS += -Wunused-label
87 | CWARNS += -Wunused-parameter
88 | CWARNS += -Wunused-value
89 | CWARNS += -Wunused-variable
90 | CWARNS += -Wmissing-prototypes
91 |
92 | #CWARNS += -Wno-unused-function
93 |
94 | CFLAGS += -m32
95 | CFLAGS += -DDEBUG=1
96 | #CFLAGS += -g -DUSE_STDIO=1 -D__GCC_POSIX__=1
97 | CFLAGS += -g -UUSE_STDIO -D__GCC_POSIX__=1
98 | ifneq ($(shell uname), Darwin)
99 | CFLAGS += -pthread
100 | endif
101 |
102 | # MAX_NUMBER_OF_TASKS = max pthreads used in the POSIX port.
103 | # Default value is 64 (_POSIX_THREAD_THREADS_MAX), the minimum number required by POSIX.
104 | CFLAGS += -DMAX_NUMBER_OF_TASKS=300
105 |
106 | CFLAGS += $(INCLUDES) $(CWARNS) -O2
107 |
108 | ######## Makefile targets ########
109 |
110 | # Rules
111 | .PHONY : all
112 | all: FreeRTOS-Sim
113 |
114 |
115 | # Fix to place .o files in ODIR
116 | _OBJS = $(patsubst %,$(ODIR)/%,$(OBJS))
117 |
118 | $(ODIR)/%.o: %.c
119 | @mkdir -p $(dir $@)
120 | # If verbose, print gcc execution, else hide
121 | ifeq ($(verbose),1)
122 | @echo ">> Compiling $<"
123 | $(CC) $(CFLAGS) -c -o $@ $<
124 | else
125 | @echo ">> Compiling $(notdir $<)"
126 | @$(CC) $(CFLAGS) -c -o $@ $<
127 | endif
128 |
129 | FreeRTOS-Sim: $(_OBJS)
130 | @echo ">> Linking $@..."
131 | ifeq ($(verbose),1)
132 | $(CC) $(CFLAGS) $^ $(LINKFLAGS) $(LIBS) -o $@
133 | else
134 | @$(CC) $(CFLAGS) $^ $(LINKFLAGS) $(LIBS) -o $@
135 | endif
136 |
137 | @echo "-------------------------"
138 | @echo "BUILD COMPLETE: $@"
139 | @echo "-------------------------"
140 |
141 | .PHONY : clean
142 | clean:
143 | @-rm -rf $(ODIR) FreeRTOS-Sim
144 | @echo "--------------"
145 | @echo "CLEAN COMPLETE"
146 | @echo "--------------"
147 |
148 |
149 | .PHONY: valgrind
150 | valgrind: FreeRTOS-Sim
151 | valgrind.bin --tool=memcheck --leak-check=full --show-reachable=yes --track-fds=yes ./FreeRTOS-Sim
152 |
--------------------------------------------------------------------------------
/Project/FreeRTOSConfig.h:
--------------------------------------------------------------------------------
1 | #ifndef FREERTOS_CONFIG_H
2 | #define FREERTOS_CONFIG_H
3 |
4 | /*-----------------------------------------------------------
5 | * Application specific definitions.
6 | *
7 | * These definitions should be adjusted for your particular hardware and
8 | * application requirements.
9 | *
10 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
11 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
12 | *
13 | * See http://www.freertos.org/a00110.html.
14 | *----------------------------------------------------------*/
15 |
16 | #define configUSE_PREEMPTION 1
17 | #define configUSE_IDLE_HOOK 1
18 | #define configUSE_TICK_HOOK 1
19 | #define configTICK_RATE_HZ ( ( portTickType ) 1000 )
20 | #define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 64 ) /* This can be made smaller if required. */
21 | #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 64 * 1024 ) )
22 | #define configMAX_TASK_NAME_LEN ( 16 )
23 | #define configUSE_TRACE_FACILITY 0
24 | #define configUSE_16_BIT_TICKS 0
25 | #define configIDLE_SHOULD_YIELD 1
26 | #define configUSE_MUTEXES 1
27 | #define configCHECK_FOR_STACK_OVERFLOW 0 /* Do not use this option on the PC port. */
28 | #define configUSE_RECURSIVE_MUTEXES 1
29 | #define configQUEUE_REGISTRY_SIZE 20
30 | #define configUSE_MALLOC_FAILED_HOOK 1
31 | #define configUSE_APPLICATION_TASK_TAG 1
32 | #define configUSE_COUNTING_SEMAPHORES 1
33 | #define configUSE_ALTERNATIVE_API 0
34 | //#define configMAX_SYSCALL_INTERRUPT_PRIORITY 1
35 |
36 | #define configUSE_QUEUE_SETS 1
37 | #define configUSE_TASK_NOTIFICATIONS 1
38 |
39 | /* Software timer related configuration options. */
40 | #define configUSE_TIMERS 1
41 | #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
42 | #define configTIMER_QUEUE_LENGTH 20
43 | #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
44 |
45 | #define configMAX_PRIORITIES ( 10 )
46 |
47 | #define configGENERATE_RUN_TIME_STATS 1
48 |
49 | /* Set the following definitions to 1 to include the API function, or zero
50 | to exclude the API function. In most cases the linker will remove unused
51 | functions anyway. */
52 | #define INCLUDE_vTaskPrioritySet 1
53 | #define INCLUDE_uxTaskPriorityGet 1
54 | #define INCLUDE_vTaskDelete 1
55 | #define INCLUDE_vTaskSuspend 1
56 | #define INCLUDE_vTaskDelayUntil 1
57 | #define INCLUDE_vTaskDelay 1
58 | #define INCLUDE_uxTaskGetStackHighWaterMark 0 /* Do not use this option on the PC port. */
59 | #define INCLUDE_xTaskGetSchedulerState 1
60 | #define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
61 | #define INCLUDE_xTaskGetIdleTaskHandle 1
62 | #define INCLUDE_pcTaskGetTaskName 1
63 | #define INCLUDE_eTaskGetState 1
64 | #define INCLUDE_xSemaphoreGetMutexHolder 1
65 | #define INCLUDE_xTimerPendFunctionCall 1
66 | #define INCLUDE_xTaskAbortDelay 1
67 | #define INCLUDE_xTaskGetHandle 1
68 |
69 | /* It is a good idea to define configASSERT() while developing. configASSERT()
70 | uses the same semantics as the standard C assert() macro. */
71 | extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName );
72 | #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ )
73 |
74 | #endif /* FREERTOS_CONFIG_H */
75 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FreeRTOS-Sim
2 | FreeRTOS simulator for POSIX (Linux, OS X and maybe other POSIX OS)
3 |
4 | Based on the Linux simulator originally developed by William Davy, the goal of this work is to keep FreeRTOS POSIX simulator in a clean seperate package and up to date with the latest FreeRTOS releases.
5 |
6 | Directory description
7 | - Source: FreeRTOS kernel and POSIX simulator source files
8 | - Project: the project directory that includes main() and FreeRTOS settings for the POSIX port
9 | - Demo: demo tasks from the official FreeRTOS release
10 |
11 | ### Note
12 | V10 is added to the master branch without extensive tests. Feel free to report or fix bugs.
13 |
--------------------------------------------------------------------------------
/Source/include/StackMacros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef STACK_MACROS_H
29 | #define STACK_MACROS_H
30 |
31 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */
32 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released.
33 | #endif
34 |
35 | /*
36 | * Call the stack overflow hook function if the stack of the task being swapped
37 | * out is currently overflowed, or looks like it might have overflowed in the
38 | * past.
39 | *
40 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
41 | * the current stack state only - comparing the current top of stack value to
42 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
43 | * will also cause the last few stack bytes to be checked to ensure the value
44 | * to which the bytes were set when the task was created have not been
45 | * overwritten. Note this second test does not guarantee that an overflowed
46 | * stack will always be recognised.
47 | */
48 |
49 | /*-----------------------------------------------------------*/
50 |
51 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
52 |
53 | /* Only the current stack state is to be checked. */
54 | #define taskCHECK_FOR_STACK_OVERFLOW() \
55 | { \
56 | /* Is the currently saved stack pointer within the stack limit? */ \
57 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
58 | { \
59 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
60 | } \
61 | }
62 |
63 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
64 | /*-----------------------------------------------------------*/
65 |
66 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
67 |
68 | /* Only the current stack state is to be checked. */
69 | #define taskCHECK_FOR_STACK_OVERFLOW() \
70 | { \
71 | \
72 | /* Is the currently saved stack pointer within the stack limit? */ \
73 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
74 | { \
75 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
76 | } \
77 | }
78 |
79 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
80 | /*-----------------------------------------------------------*/
81 |
82 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
83 |
84 | #define taskCHECK_FOR_STACK_OVERFLOW() \
85 | { \
86 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
87 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
88 | \
89 | if( ( pulStack[ 0 ] != ulCheckValue ) || \
90 | ( pulStack[ 1 ] != ulCheckValue ) || \
91 | ( pulStack[ 2 ] != ulCheckValue ) || \
92 | ( pulStack[ 3 ] != ulCheckValue ) ) \
93 | { \
94 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
95 | } \
96 | }
97 |
98 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
99 | /*-----------------------------------------------------------*/
100 |
101 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
102 |
103 | #define taskCHECK_FOR_STACK_OVERFLOW() \
104 | { \
105 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
106 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
107 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
108 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
109 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
110 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
111 | \
112 | \
113 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
114 | \
115 | /* Has the extremity of the task stack ever been written over? */ \
116 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
117 | { \
118 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
119 | } \
120 | }
121 |
122 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
123 | /*-----------------------------------------------------------*/
124 |
125 | /* Remove stack overflow macro if not being used. */
126 | #ifndef taskCHECK_FOR_STACK_OVERFLOW
127 | #define taskCHECK_FOR_STACK_OVERFLOW()
128 | #endif
129 |
130 |
131 |
132 | #endif /* STACK_MACROS_H */
133 |
134 |
--------------------------------------------------------------------------------
/Source/include/deprecated_definitions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef DEPRECATED_DEFINITIONS_H
29 | #define DEPRECATED_DEFINITIONS_H
30 |
31 |
32 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a
33 | pre-processor definition was used to ensure the pre-processor found the correct
34 | portmacro.h file for the port being used. That scheme was deprecated in favour
35 | of setting the compiler's include path such that it found the correct
36 | portmacro.h file - removing the need for the constant and allowing the
37 | portmacro.h file to be located anywhere in relation to the port being used. The
38 | definitions below remain in the code for backward compatibility only. New
39 | projects should not use them. */
40 |
41 | #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
42 | #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
43 | typedef void ( __interrupt __far *pxISR )();
44 | #endif
45 |
46 | #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
47 | #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
48 | typedef void ( __interrupt __far *pxISR )();
49 | #endif
50 |
51 | #ifdef GCC_MEGA_AVR
52 | #include "../portable/GCC/ATMega323/portmacro.h"
53 | #endif
54 |
55 | #ifdef IAR_MEGA_AVR
56 | #include "../portable/IAR/ATMega323/portmacro.h"
57 | #endif
58 |
59 | #ifdef MPLAB_PIC24_PORT
60 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
61 | #endif
62 |
63 | #ifdef MPLAB_DSPIC_PORT
64 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
65 | #endif
66 |
67 | #ifdef MPLAB_PIC18F_PORT
68 | #include "../../Source/portable/MPLAB/PIC18F/portmacro.h"
69 | #endif
70 |
71 | #ifdef MPLAB_PIC32MX_PORT
72 | #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"
73 | #endif
74 |
75 | #ifdef _FEDPICC
76 | #include "libFreeRTOS/Include/portmacro.h"
77 | #endif
78 |
79 | #ifdef SDCC_CYGNAL
80 | #include "../../Source/portable/SDCC/Cygnal/portmacro.h"
81 | #endif
82 |
83 | #ifdef GCC_ARM7
84 | #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
85 | #endif
86 |
87 | #ifdef GCC_ARM7_ECLIPSE
88 | #include "portmacro.h"
89 | #endif
90 |
91 | #ifdef ROWLEY_LPC23xx
92 | #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
93 | #endif
94 |
95 | #ifdef IAR_MSP430
96 | #include "..\..\Source\portable\IAR\MSP430\portmacro.h"
97 | #endif
98 |
99 | #ifdef GCC_MSP430
100 | #include "../../Source/portable/GCC/MSP430F449/portmacro.h"
101 | #endif
102 |
103 | #ifdef ROWLEY_MSP430
104 | #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
105 | #endif
106 |
107 | #ifdef ARM7_LPC21xx_KEIL_RVDS
108 | #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
109 | #endif
110 |
111 | #ifdef SAM7_GCC
112 | #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
113 | #endif
114 |
115 | #ifdef SAM7_IAR
116 | #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
117 | #endif
118 |
119 | #ifdef SAM9XE_IAR
120 | #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
121 | #endif
122 |
123 | #ifdef LPC2000_IAR
124 | #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
125 | #endif
126 |
127 | #ifdef STR71X_IAR
128 | #include "..\..\Source\portable\IAR\STR71x\portmacro.h"
129 | #endif
130 |
131 | #ifdef STR75X_IAR
132 | #include "..\..\Source\portable\IAR\STR75x\portmacro.h"
133 | #endif
134 |
135 | #ifdef STR75X_GCC
136 | #include "..\..\Source\portable\GCC\STR75x\portmacro.h"
137 | #endif
138 |
139 | #ifdef STR91X_IAR
140 | #include "..\..\Source\portable\IAR\STR91x\portmacro.h"
141 | #endif
142 |
143 | #ifdef GCC_H8S
144 | #include "../../Source/portable/GCC/H8S2329/portmacro.h"
145 | #endif
146 |
147 | #ifdef GCC_AT91FR40008
148 | #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
149 | #endif
150 |
151 | #ifdef RVDS_ARMCM3_LM3S102
152 | #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
153 | #endif
154 |
155 | #ifdef GCC_ARMCM3_LM3S102
156 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
157 | #endif
158 |
159 | #ifdef GCC_ARMCM3
160 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
161 | #endif
162 |
163 | #ifdef IAR_ARM_CM3
164 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
165 | #endif
166 |
167 | #ifdef IAR_ARMCM3_LM
168 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
169 | #endif
170 |
171 | #ifdef HCS12_CODE_WARRIOR
172 | #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
173 | #endif
174 |
175 | #ifdef MICROBLAZE_GCC
176 | #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
177 | #endif
178 |
179 | #ifdef TERN_EE
180 | #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
181 | #endif
182 |
183 | #ifdef GCC_HCS12
184 | #include "../../Source/portable/GCC/HCS12/portmacro.h"
185 | #endif
186 |
187 | #ifdef GCC_MCF5235
188 | #include "../../Source/portable/GCC/MCF5235/portmacro.h"
189 | #endif
190 |
191 | #ifdef COLDFIRE_V2_GCC
192 | #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
193 | #endif
194 |
195 | #ifdef COLDFIRE_V2_CODEWARRIOR
196 | #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
197 | #endif
198 |
199 | #ifdef GCC_PPC405
200 | #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
201 | #endif
202 |
203 | #ifdef GCC_PPC440
204 | #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
205 | #endif
206 |
207 | #ifdef _16FX_SOFTUNE
208 | #include "..\..\Source\portable\Softune\MB96340\portmacro.h"
209 | #endif
210 |
211 | #ifdef BCC_INDUSTRIAL_PC_PORT
212 | /* A short file name has to be used in place of the normal
213 | FreeRTOSConfig.h when using the Borland compiler. */
214 | #include "frconfig.h"
215 | #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
216 | typedef void ( __interrupt __far *pxISR )();
217 | #endif
218 |
219 | #ifdef BCC_FLASH_LITE_186_PORT
220 | /* A short file name has to be used in place of the normal
221 | FreeRTOSConfig.h when using the Borland compiler. */
222 | #include "frconfig.h"
223 | #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
224 | typedef void ( __interrupt __far *pxISR )();
225 | #endif
226 |
227 | #ifdef __GNUC__
228 | #ifdef __AVR32_AVR32A__
229 | #include "portmacro.h"
230 | #endif
231 | #endif
232 |
233 | #ifdef __ICCAVR32__
234 | #ifdef __CORE__
235 | #if __CORE__ == __AVR32A__
236 | #include "portmacro.h"
237 | #endif
238 | #endif
239 | #endif
240 |
241 | #ifdef __91467D
242 | #include "portmacro.h"
243 | #endif
244 |
245 | #ifdef __96340
246 | #include "portmacro.h"
247 | #endif
248 |
249 |
250 | #ifdef __IAR_V850ES_Fx3__
251 | #include "../../Source/portable/IAR/V850ES/portmacro.h"
252 | #endif
253 |
254 | #ifdef __IAR_V850ES_Jx3__
255 | #include "../../Source/portable/IAR/V850ES/portmacro.h"
256 | #endif
257 |
258 | #ifdef __IAR_V850ES_Jx3_L__
259 | #include "../../Source/portable/IAR/V850ES/portmacro.h"
260 | #endif
261 |
262 | #ifdef __IAR_V850ES_Jx2__
263 | #include "../../Source/portable/IAR/V850ES/portmacro.h"
264 | #endif
265 |
266 | #ifdef __IAR_V850ES_Hx2__
267 | #include "../../Source/portable/IAR/V850ES/portmacro.h"
268 | #endif
269 |
270 | #ifdef __IAR_78K0R_Kx3__
271 | #include "../../Source/portable/IAR/78K0R/portmacro.h"
272 | #endif
273 |
274 | #ifdef __IAR_78K0R_Kx3L__
275 | #include "../../Source/portable/IAR/78K0R/portmacro.h"
276 | #endif
277 |
278 | #endif /* DEPRECATED_DEFINITIONS_H */
279 |
280 |
--------------------------------------------------------------------------------
/Source/include/portable.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | /*-----------------------------------------------------------
29 | * Portable layer API. Each function must be defined for each port.
30 | *----------------------------------------------------------*/
31 |
32 | #ifndef PORTABLE_H
33 | #define PORTABLE_H
34 |
35 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a
36 | pre-processor definition was used to ensure the pre-processor found the correct
37 | portmacro.h file for the port being used. That scheme was deprecated in favour
38 | of setting the compiler's include path such that it found the correct
39 | portmacro.h file - removing the need for the constant and allowing the
40 | portmacro.h file to be located anywhere in relation to the port being used.
41 | Purely for reasons of backward compatibility the old method is still valid, but
42 | to make it clear that new projects should not use it, support for the port
43 | specific constants has been moved into the deprecated_definitions.h header
44 | file. */
45 | #include "deprecated_definitions.h"
46 |
47 | /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
48 | did not result in a portmacro.h header file being included - and it should be
49 | included here. In this case the path to the correct portmacro.h header file
50 | must be set in the compiler's include path. */
51 | #ifndef portENTER_CRITICAL
52 | #include "portmacro.h"
53 | #endif
54 |
55 | #if portBYTE_ALIGNMENT == 32
56 | #define portBYTE_ALIGNMENT_MASK ( 0x001f )
57 | #endif
58 |
59 | #if portBYTE_ALIGNMENT == 16
60 | #define portBYTE_ALIGNMENT_MASK ( 0x000f )
61 | #endif
62 |
63 | #if portBYTE_ALIGNMENT == 8
64 | #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
65 | #endif
66 |
67 | #if portBYTE_ALIGNMENT == 4
68 | #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
69 | #endif
70 |
71 | #if portBYTE_ALIGNMENT == 2
72 | #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
73 | #endif
74 |
75 | #if portBYTE_ALIGNMENT == 1
76 | #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
77 | #endif
78 |
79 | #ifndef portBYTE_ALIGNMENT_MASK
80 | #error "Invalid portBYTE_ALIGNMENT definition"
81 | #endif
82 |
83 | #ifndef portNUM_CONFIGURABLE_REGIONS
84 | #define portNUM_CONFIGURABLE_REGIONS 1
85 | #endif
86 |
87 | #ifdef __cplusplus
88 | extern "C" {
89 | #endif
90 |
91 | #include "mpu_wrappers.h"
92 |
93 | /*
94 | * Setup the stack of a new task so it is ready to be placed under the
95 | * scheduler control. The registers have to be placed on the stack in
96 | * the order that the port expects to find them.
97 | *
98 | */
99 | #if( portUSING_MPU_WRAPPERS == 1 )
100 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
101 | #else
102 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
103 | #endif
104 |
105 | /* Used by heap_5.c. */
106 | typedef struct HeapRegion
107 | {
108 | uint8_t *pucStartAddress;
109 | size_t xSizeInBytes;
110 | } HeapRegion_t;
111 |
112 | /*
113 | * Used to define multiple heap regions for use by heap_5.c. This function
114 | * must be called before any calls to pvPortMalloc() - not creating a task,
115 | * queue, semaphore, mutex, software timer, event group, etc. will result in
116 | * pvPortMalloc being called.
117 | *
118 | * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
119 | * defines a region of memory that can be used as the heap. The array is
120 | * terminated by a HeapRegions_t structure that has a size of 0. The region
121 | * with the lowest start address must appear first in the array.
122 | */
123 | void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
124 |
125 |
126 | /*
127 | * Map to the memory management routines required for the port.
128 | */
129 | void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
130 | void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
131 | void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
132 | size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
133 | size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
134 |
135 | /*
136 | * Setup the hardware ready for the scheduler to take control. This generally
137 | * sets up a tick interrupt and sets timers for the correct tick frequency.
138 | */
139 | BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
140 |
141 | /*
142 | * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
143 | * the hardware is left in its original condition after the scheduler stops
144 | * executing.
145 | */
146 | void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
147 |
148 | /*
149 | * The structures and methods of manipulating the MPU are contained within the
150 | * port layer.
151 | *
152 | * Fills the xMPUSettings structure with the memory region information
153 | * contained in xRegions.
154 | */
155 | #if( portUSING_MPU_WRAPPERS == 1 )
156 | struct xMEMORY_REGION;
157 | void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
158 | #endif
159 |
160 | #ifdef __cplusplus
161 | }
162 | #endif
163 |
164 | #endif /* PORTABLE_H */
165 |
166 |
--------------------------------------------------------------------------------
/Source/include/projdefs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef PROJDEFS_H
29 | #define PROJDEFS_H
30 |
31 | /*
32 | * Defines the prototype to which task functions must conform. Defined in this
33 | * file to ensure the type is known before portable.h is included.
34 | */
35 | typedef void (*TaskFunction_t)( void * );
36 |
37 | /* Converts a time in milliseconds to a time in ticks. This macro can be
38 | overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
39 | definition here is not suitable for your application. */
40 | #ifndef pdMS_TO_TICKS
41 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) )
42 | #endif
43 |
44 | #define pdFALSE ( ( BaseType_t ) 0 )
45 | #define pdTRUE ( ( BaseType_t ) 1 )
46 |
47 | #define pdPASS ( pdTRUE )
48 | #define pdFAIL ( pdFALSE )
49 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
50 | #define errQUEUE_FULL ( ( BaseType_t ) 0 )
51 |
52 | /* FreeRTOS error definitions. */
53 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
54 | #define errQUEUE_BLOCKED ( -4 )
55 | #define errQUEUE_YIELD ( -5 )
56 |
57 | /* Macros used for basic data corruption checks. */
58 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
59 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
60 | #endif
61 |
62 | #if( configUSE_16_BIT_TICKS == 1 )
63 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a
64 | #else
65 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
66 | #endif
67 |
68 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS
69 | itself. */
70 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */
71 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
72 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
73 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
74 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
75 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
76 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
77 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
78 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
79 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
80 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
81 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
82 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
83 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
84 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
85 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
86 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
87 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
88 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
89 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
90 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
91 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
92 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
93 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
94 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
95 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
96 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
97 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
98 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
99 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
100 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
101 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
102 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
103 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
104 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
105 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
106 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
107 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
108 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
109 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
110 |
111 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS
112 | itself. */
113 | #define pdFREERTOS_LITTLE_ENDIAN 0
114 | #define pdFREERTOS_BIG_ENDIAN 1
115 |
116 | /* Re-defining endian values for generic naming. */
117 | #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN
118 | #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN
119 |
120 |
121 | #endif /* PROJDEFS_H */
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/Source/include/stack_macros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 | #ifndef STACK_MACROS_H
29 | #define STACK_MACROS_H
30 |
31 | /*
32 | * Call the stack overflow hook function if the stack of the task being swapped
33 | * out is currently overflowed, or looks like it might have overflowed in the
34 | * past.
35 | *
36 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
37 | * the current stack state only - comparing the current top of stack value to
38 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
39 | * will also cause the last few stack bytes to be checked to ensure the value
40 | * to which the bytes were set when the task was created have not been
41 | * overwritten. Note this second test does not guarantee that an overflowed
42 | * stack will always be recognised.
43 | */
44 |
45 | /*-----------------------------------------------------------*/
46 |
47 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
48 |
49 | /* Only the current stack state is to be checked. */
50 | #define taskCHECK_FOR_STACK_OVERFLOW() \
51 | { \
52 | /* Is the currently saved stack pointer within the stack limit? */ \
53 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
54 | { \
55 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
56 | } \
57 | }
58 |
59 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
60 | /*-----------------------------------------------------------*/
61 |
62 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
63 |
64 | /* Only the current stack state is to be checked. */
65 | #define taskCHECK_FOR_STACK_OVERFLOW() \
66 | { \
67 | \
68 | /* Is the currently saved stack pointer within the stack limit? */ \
69 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
70 | { \
71 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
72 | } \
73 | }
74 |
75 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
76 | /*-----------------------------------------------------------*/
77 |
78 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
79 |
80 | #define taskCHECK_FOR_STACK_OVERFLOW() \
81 | { \
82 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
83 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
84 | \
85 | if( ( pulStack[ 0 ] != ulCheckValue ) || \
86 | ( pulStack[ 1 ] != ulCheckValue ) || \
87 | ( pulStack[ 2 ] != ulCheckValue ) || \
88 | ( pulStack[ 3 ] != ulCheckValue ) ) \
89 | { \
90 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
91 | } \
92 | }
93 |
94 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
95 | /*-----------------------------------------------------------*/
96 |
97 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
98 |
99 | #define taskCHECK_FOR_STACK_OVERFLOW() \
100 | { \
101 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
102 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
103 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
104 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
105 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
106 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
107 | \
108 | \
109 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
110 | \
111 | /* Has the extremity of the task stack ever been written over? */ \
112 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
113 | { \
114 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
115 | } \
116 | }
117 |
118 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
119 | /*-----------------------------------------------------------*/
120 |
121 | /* Remove stack overflow macro if not being used. */
122 | #ifndef taskCHECK_FOR_STACK_OVERFLOW
123 | #define taskCHECK_FOR_STACK_OVERFLOW()
124 | #endif
125 |
126 |
127 |
128 | #endif /* STACK_MACROS_H */
129 |
130 |
--------------------------------------------------------------------------------
/Source/include/stdint.readme:
--------------------------------------------------------------------------------
1 |
2 | #ifndef FREERTOS_STDINT
3 | #define FREERTOS_STDINT
4 |
5 | /*******************************************************************************
6 | * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions
7 | * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be
8 | * built using compilers that do not provide their own stdint.h definition.
9 | *
10 | * To use this file:
11 | *
12 | * 1) Copy this file into the directory that contains your FreeRTOSConfig.h
13 | * header file, as that directory will already be in the compilers include
14 | * path.
15 | *
16 | * 2) Rename the copied file stdint.h.
17 | *
18 | */
19 |
20 | typedef signed char int8_t;
21 | typedef unsigned char uint8_t;
22 | typedef short int16_t;
23 | typedef unsigned short uint16_t;
24 | typedef long int32_t;
25 | typedef unsigned long uint32_t;
26 |
27 | #endif /* FREERTOS_STDINT */
28 |
--------------------------------------------------------------------------------
/Source/portable/GCC/POSIX/portmacro.h:
--------------------------------------------------------------------------------
1 | /*
2 | POSIX Simulator
3 | Tested with FreeRTOS V8.2.2
4 | 1 tab == 4 spaces!
5 | */
6 |
7 | #ifndef PORTMACRO_H
8 | #define PORTMACRO_H
9 |
10 | #ifdef __cplusplus
11 | extern "C" {
12 | #endif
13 |
14 | /******************************************************************************
15 | Defines
16 | ******************************************************************************/
17 | /* Type definitions. */
18 | #define portCHAR char
19 | #define portFLOAT float
20 | #define portDOUBLE double
21 | #define portLONG long
22 | #define portSHORT short
23 | #define portSTACK_TYPE size_t
24 | #define portBASE_TYPE long
25 | #define portPOINTER_SIZE_TYPE size_t
26 |
27 | typedef portSTACK_TYPE StackType_t;
28 | typedef long BaseType_t;
29 | typedef unsigned long UBaseType_t;
30 |
31 | #if( configUSE_16_BIT_TICKS == 1 )
32 | typedef uint16_t TickType_t;
33 | #define portMAX_DELAY ( TickType_t ) 0xffff
34 | #else
35 | typedef uint32_t TickType_t;
36 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
37 |
38 | /* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick
39 | count do not need to be guarded with a critical section. */
40 | #define portTICK_TYPE_IS_ATOMIC 1
41 | #endif
42 |
43 | /* Hardware specifics. */
44 | #define portSTACK_GROWTH ( -1 )
45 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
46 | #define portINLINE __inline__
47 |
48 | #if defined( __x86_64__)
49 | #define portBYTE_ALIGNMENT 8
50 | #else
51 | #define portBYTE_ALIGNMENT 4
52 | #endif
53 |
54 | //TODO: check portREMOVE_STATIC_QUALIFIER
55 | #define portREMOVE_STATIC_QUALIFIER
56 |
57 | /*-----------------------------------------------------------*/
58 |
59 | /* Scheduler utilities. */
60 | extern void vPortYieldFromISR( void );
61 | extern void vPortYield( void );
62 | #define portYIELD() vPortYield()
63 | #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYieldFromISR()
64 | #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
65 |
66 | /*-----------------------------------------------------------*/
67 |
68 | /* Critical section management. */
69 | extern BaseType_t xPortSetInterruptMask( void );
70 | extern void vPortClearInterruptMask( portBASE_TYPE xMask );
71 |
72 | #define portSET_INTERRUPT_MASK_FROM_ISR() xPortSetInterruptMask()
73 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x)
74 |
75 | extern void vPortDisableInterrupts( void );
76 | extern void vPortEnableInterrupts( void );
77 | #define portSET_INTERRUPT_MASK() ( vPortDisableInterrupts() )
78 | #define portCLEAR_INTERRUPT_MASK() ( vPortEnableInterrupts() )
79 |
80 | #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK()
81 | #define portENABLE_INTERRUPTS() portCLEAR_INTERRUPT_MASK()
82 |
83 | extern void vPortEnterCritical( void );
84 | extern void vPortExitCritical( void );
85 | #define portENTER_CRITICAL() vPortEnterCritical()
86 | #define portEXIT_CRITICAL() vPortExitCritical()
87 |
88 | /*-----------------------------------------------------------*/
89 |
90 | /* Task function macros as described on the FreeRTOS.org WEB site. */
91 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
92 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
93 |
94 | #define portNOP()
95 |
96 | #define portOUTPUT_BYTE( a, b )
97 |
98 | extern void vPortForciblyEndThread( void *pxTaskToDelete );
99 | #define traceTASK_DELETE( pxTaskToDelete ) vPortForciblyEndThread( pxTaskToDelete )
100 |
101 | extern void vPortAddTaskHandle( void *pxTaskHandle );
102 | #define traceTASK_CREATE( pxNewTCB ) vPortAddTaskHandle( pxNewTCB )
103 |
104 | /* Posix Signal definitions that can be changed or read as appropriate. */
105 | #define SIG_SUSPEND SIGUSR1
106 | #define SIG_RESUME SIGUSR2
107 |
108 | /* Enable the following hash defines to make use of the real-time tick where time progresses at real-time. */
109 | #define SIG_TICK SIGALRM
110 | #define TIMER_TYPE ITIMER_REAL
111 | /* Enable the following hash defines to make use of the process tick where time progresses only when the process is executing.
112 | #define SIG_TICK SIGVTALRM
113 | #define TIMER_TYPE ITIMER_VIRTUAL */
114 | /* Enable the following hash defines to make use of the profile tick where time progresses when the process or system calls are executing.
115 | #define SIG_TICK SIGPROF
116 | #define TIMER_TYPE ITIMER_PROF */
117 |
118 | /* Make use of times(man 2) to gather run-time statistics on the tasks. */
119 | extern void vPortFindTicksPerSecond( void );
120 | #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vPortFindTicksPerSecond() /* Nothing to do because the timer is already present. */
121 | extern unsigned long ulPortGetTimerValue( void );
122 | #define portGET_RUN_TIME_COUNTER_VALUE() ulPortGetTimerValue() /* Query the System time stats for this process. */
123 |
124 | #ifdef __cplusplus
125 | } /* extern C */
126 | #endif
127 |
128 | #endif /* PORTMACRO_H */
129 |
--------------------------------------------------------------------------------
/Source/portable/MemMang/ReadMe.url:
--------------------------------------------------------------------------------
1 | [{000214A0-0000-0000-C000-000000000046}]
2 | Prop3=19,2
3 | [InternetShortcut]
4 | URL=http://www.freertos.org/a00111.html
5 | IDList=
6 |
--------------------------------------------------------------------------------
/Source/portable/MemMang/heap_1.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 |
29 | /*
30 | * The simplest possible implementation of pvPortMalloc(). Note that this
31 | * implementation does NOT allow allocated memory to be freed again.
32 | *
33 | * See heap_2.c, heap_3.c and heap_4.c for alternative implementations, and the
34 | * memory management pages of http://www.FreeRTOS.org for more information.
35 | */
36 | #include
37 |
38 | /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
39 | all the API functions to use the MPU wrappers. That should only be done when
40 | task.h is included from an application file. */
41 | #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
42 |
43 | #include "FreeRTOS.h"
44 | #include "task.h"
45 |
46 | #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
47 |
48 | #if( configSUPPORT_DYNAMIC_ALLOCATION == 0 )
49 | #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
50 | #endif
51 |
52 | /* A few bytes might be lost to byte aligning the heap start address. */
53 | #define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )
54 |
55 | /* Allocate the memory for the heap. */
56 | /* Allocate the memory for the heap. */
57 | #if( configAPPLICATION_ALLOCATED_HEAP == 1 )
58 | /* The application writer has already defined the array used for the RTOS
59 | heap - probably so it can be placed in a special segment or address. */
60 | extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
61 | #else
62 | static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
63 | #endif /* configAPPLICATION_ALLOCATED_HEAP */
64 |
65 | /* Index into the ucHeap array. */
66 | static size_t xNextFreeByte = ( size_t ) 0;
67 |
68 | /*-----------------------------------------------------------*/
69 |
70 | void *pvPortMalloc( size_t xWantedSize )
71 | {
72 | void *pvReturn = NULL;
73 | static uint8_t *pucAlignedHeap = NULL;
74 |
75 | /* Ensure that blocks are always aligned to the required number of bytes. */
76 | #if( portBYTE_ALIGNMENT != 1 )
77 | {
78 | if( xWantedSize & portBYTE_ALIGNMENT_MASK )
79 | {
80 | /* Byte alignment required. */
81 | xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
82 | }
83 | }
84 | #endif
85 |
86 | vTaskSuspendAll();
87 | {
88 | if( pucAlignedHeap == NULL )
89 | {
90 | /* Ensure the heap starts on a correctly aligned boundary. */
91 | pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
92 | }
93 |
94 | /* Check there is enough room left for the allocation. */
95 | if( ( ( xNextFreeByte + xWantedSize ) < configADJUSTED_HEAP_SIZE ) &&
96 | ( ( xNextFreeByte + xWantedSize ) > xNextFreeByte ) )/* Check for overflow. */
97 | {
98 | /* Return the next free byte then increment the index past this
99 | block. */
100 | pvReturn = pucAlignedHeap + xNextFreeByte;
101 | xNextFreeByte += xWantedSize;
102 | }
103 |
104 | traceMALLOC( pvReturn, xWantedSize );
105 | }
106 | ( void ) xTaskResumeAll();
107 |
108 | #if( configUSE_MALLOC_FAILED_HOOK == 1 )
109 | {
110 | if( pvReturn == NULL )
111 | {
112 | extern void vApplicationMallocFailedHook( void );
113 | vApplicationMallocFailedHook();
114 | }
115 | }
116 | #endif
117 |
118 | return pvReturn;
119 | }
120 | /*-----------------------------------------------------------*/
121 |
122 | void vPortFree( void *pv )
123 | {
124 | /* Memory cannot be freed using this scheme. See heap_2.c, heap_3.c and
125 | heap_4.c for alternative implementations, and the memory management pages of
126 | http://www.FreeRTOS.org for more information. */
127 | ( void ) pv;
128 |
129 | /* Force an assert as it is invalid to call this function. */
130 | configASSERT( pv == NULL );
131 | }
132 | /*-----------------------------------------------------------*/
133 |
134 | void vPortInitialiseBlocks( void )
135 | {
136 | /* Only required when static memory is not cleared. */
137 | xNextFreeByte = ( size_t ) 0;
138 | }
139 | /*-----------------------------------------------------------*/
140 |
141 | size_t xPortGetFreeHeapSize( void )
142 | {
143 | return ( configADJUSTED_HEAP_SIZE - xNextFreeByte );
144 | }
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/Source/portable/MemMang/heap_3.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FreeRTOS Kernel V10.0.1
3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | * this software and associated documentation files (the "Software"), to deal in
7 | * the Software without restriction, including without limitation the rights to
8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | * the Software, and to permit persons to whom the Software is furnished to do so,
10 | * subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in all
13 | * copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | *
22 | * http://www.FreeRTOS.org
23 | * http://aws.amazon.com/freertos
24 | *
25 | * 1 tab == 4 spaces!
26 | */
27 |
28 |
29 | /*
30 | * Implementation of pvPortMalloc() and vPortFree() that relies on the
31 | * compilers own malloc() and free() implementations.
32 | *
33 | * This file can only be used if the linker is configured to to generate
34 | * a heap memory area.
35 | *
36 | * See heap_1.c, heap_2.c and heap_4.c for alternative implementations, and the
37 | * memory management pages of http://www.FreeRTOS.org for more information.
38 | */
39 |
40 | #include
41 |
42 | /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
43 | all the API functions to use the MPU wrappers. That should only be done when
44 | task.h is included from an application file. */
45 | #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
46 |
47 | #include "FreeRTOS.h"
48 | #include "task.h"
49 |
50 | #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
51 |
52 | #if( configSUPPORT_DYNAMIC_ALLOCATION == 0 )
53 | #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
54 | #endif
55 |
56 | /*-----------------------------------------------------------*/
57 |
58 | void *pvPortMalloc( size_t xWantedSize )
59 | {
60 | void *pvReturn;
61 |
62 | vTaskSuspendAll();
63 | {
64 | pvReturn = malloc( xWantedSize );
65 | traceMALLOC( pvReturn, xWantedSize );
66 | }
67 | ( void ) xTaskResumeAll();
68 |
69 | #if( configUSE_MALLOC_FAILED_HOOK == 1 )
70 | {
71 | if( pvReturn == NULL )
72 | {
73 | extern void vApplicationMallocFailedHook( void );
74 | vApplicationMallocFailedHook();
75 | }
76 | }
77 | #endif
78 |
79 | return pvReturn;
80 | }
81 | /*-----------------------------------------------------------*/
82 |
83 | void vPortFree( void *pv )
84 | {
85 | if( pv )
86 | {
87 | vTaskSuspendAll();
88 | {
89 | free( pv );
90 | traceFREE( pv, 0 );
91 | }
92 | ( void ) xTaskResumeAll();
93 | }
94 | }
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/Source/readme.txt:
--------------------------------------------------------------------------------
1 | Each real time kernel port consists of three files that contain the core kernel
2 | components and are common to every port, and one or more files that are
3 | specific to a particular microcontroller and or compiler.
4 |
5 | + The FreeRTOS/Source directory contains the three files that are common to
6 | every port - list.c, queue.c and tasks.c. The kernel is contained within these
7 | three files. croutine.c implements the optional co-routine functionality - which
8 | is normally only used on very memory limited systems.
9 |
10 | + The FreeRTOS/Source/Portable directory contains the files that are specific to
11 | a particular microcontroller and or compiler.
12 |
13 | + The FreeRTOS/Source/include directory contains the real time kernel header
14 | files.
15 |
16 | See the readme file in the FreeRTOS/Source/Portable directory for more
17 | information.
--------------------------------------------------------------------------------