|
1 | 1 | // Hacked to remove the vTaskSuspendAll from heap_3.c |
2 | 2 |
|
3 | 3 | /* |
4 | | - * FreeRTOS Kernel <DEVELOPMENT BRANCH> |
5 | | - * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
6 | | - * |
7 | | - * SPDX-License-Identifier: MIT |
8 | | - * |
9 | | - * Permission is hereby granted, free of charge, to any person obtaining a copy of |
10 | | - * this software and associated documentation files (the "Software"), to deal in |
11 | | - * the Software without restriction, including without limitation the rights to |
12 | | - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
13 | | - * the Software, and to permit persons to whom the Software is furnished to do so, |
14 | | - * subject to the following conditions: |
15 | | - * |
16 | | - * The above copyright notice and this permission notice shall be included in all |
17 | | - * copies or substantial portions of the Software. |
18 | | - * |
19 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20 | | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
21 | | - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
22 | | - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
23 | | - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
24 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
25 | | - * |
26 | | - * https://www.FreeRTOS.org |
27 | | - * https://github.com/FreeRTOS |
28 | | - * |
29 | | - */ |
| 4 | + FreeRTOS Kernel <DEVELOPMENT BRANCH> |
| 5 | + Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 6 | +
|
| 7 | + SPDX-License-Identifier: MIT |
| 8 | +
|
| 9 | + Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 10 | + this software and associated documentation files (the "Software"), to deal in |
| 11 | + the Software without restriction, including without limitation the rights to |
| 12 | + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| 13 | + the Software, and to permit persons to whom the Software is furnished to do so, |
| 14 | + subject to the following conditions: |
| 15 | +
|
| 16 | + The above copyright notice and this permission notice shall be included in all |
| 17 | + copies or substantial portions of the Software. |
| 18 | +
|
| 19 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 21 | + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 22 | + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 23 | + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 24 | + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | +
|
| 26 | + https://www.FreeRTOS.org |
| 27 | + https://github.com/FreeRTOS |
| 28 | +
|
| 29 | +*/ |
30 | 30 |
|
31 | 31 |
|
32 | 32 | /* |
33 | | - * Implementation of pvPortMalloc() and vPortFree() that relies on the |
34 | | - * compilers own malloc() and free() implementations. |
35 | | - * |
36 | | - * This file can only be used if the linker is configured to to generate |
37 | | - * a heap memory area. |
38 | | - * |
39 | | - * See heap_1.c, heap_2.c and heap_4.c for alternative implementations, and the |
40 | | - * memory management pages of https://www.FreeRTOS.org for more information. |
41 | | - */ |
| 33 | + Implementation of pvPortMalloc() and vPortFree() that relies on the |
| 34 | + compilers own malloc() and free() implementations. |
| 35 | +
|
| 36 | + This file can only be used if the linker is configured to to generate |
| 37 | + a heap memory area. |
| 38 | +
|
| 39 | + See heap_1.c, heap_2.c and heap_4.c for alternative implementations, and the |
| 40 | + memory management pages of https://www.FreeRTOS.org for more information. |
| 41 | +*/ |
42 | 42 |
|
43 | 43 | #include <stdlib.h> |
44 | 44 |
|
45 | | -/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining |
46 | | - * all the API functions to use the MPU wrappers. That should only be done when |
47 | | - * task.h is included from an application file. */ |
| 45 | +/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining |
| 46 | + all the API functions to use the MPU wrappers. That should only be done when |
| 47 | + task.h is included from an application file. */ |
48 | 48 | #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE |
49 | 49 |
|
50 | 50 | #include "FreeRTOS.h" |
|
53 | 53 | #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE |
54 | 54 |
|
55 | 55 | #if ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) |
56 | | - #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 |
| 56 | +#error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 |
57 | 57 | #endif |
58 | 58 |
|
59 | 59 | /*-----------------------------------------------------------*/ |
60 | 60 |
|
61 | | -void * pvPortMalloc( size_t xWantedSize ) |
62 | | -{ |
| 61 | +void * pvPortMalloc(size_t xWantedSize) { |
63 | 62 | void * pvReturn; |
64 | 63 |
|
65 | 64 | //vTaskSuspendAll(); |
66 | 65 | { |
67 | | - pvReturn = malloc( xWantedSize ); |
68 | | - traceMALLOC( pvReturn, xWantedSize ); |
| 66 | + pvReturn = malloc(xWantedSize); |
| 67 | + traceMALLOC(pvReturn, xWantedSize); |
69 | 68 | } |
70 | 69 | //( void ) xTaskResumeAll(); |
71 | 70 |
|
72 | | - #if ( configUSE_MALLOC_FAILED_HOOK == 1 ) |
| 71 | +#if ( configUSE_MALLOC_FAILED_HOOK == 1 ) |
73 | 72 | { |
74 | | - if( pvReturn == NULL ) |
75 | | - { |
| 73 | + if (pvReturn == NULL) { |
76 | 74 | vApplicationMallocFailedHook(); |
77 | 75 | } |
78 | 76 | } |
79 | | - #endif |
| 77 | +#endif |
80 | 78 |
|
81 | 79 | return pvReturn; |
82 | 80 | } |
83 | 81 | /*-----------------------------------------------------------*/ |
84 | 82 |
|
85 | | -void vPortFree( void * pv ) |
86 | | -{ |
87 | | - if( pv != NULL ) |
88 | | - { |
| 83 | +void vPortFree(void * pv) { |
| 84 | + if (pv != NULL) { |
89 | 85 | //vTaskSuspendAll(); |
90 | 86 | { |
91 | | - free( pv ); |
92 | | - traceFREE( pv, 0 ); |
| 87 | + free(pv); |
| 88 | + traceFREE(pv, 0); |
93 | 89 | } |
94 | | - // ( void ) xTaskResumeAll(); |
| 90 | + // ( void ) xTaskResumeAll(); |
95 | 91 | } |
96 | 92 | } |
97 | 93 | /*-----------------------------------------------------------*/ |
98 | 94 |
|
99 | 95 | /* |
100 | | - * Reset the state in this file. This state is normally initialized at start up. |
101 | | - * This function must be called by the application before restarting the |
102 | | - * scheduler. |
103 | | - */ |
104 | | -void vPortHeapResetState( void ) |
105 | | -{ |
| 96 | + Reset the state in this file. This state is normally initialized at start up. |
| 97 | + This function must be called by the application before restarting the |
| 98 | + scheduler. |
| 99 | +*/ |
| 100 | +void vPortHeapResetState(void) { |
106 | 101 | /* No state needs to be re-initialised in heap_3. */ |
107 | 102 | } |
108 | 103 | /*-----------------------------------------------------------*/ |
0 commit comments