heap_3.c
Go to the documentation of this file.
1 /*
2  * FreeRTOS Kernel V10.0.0
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. If you wish to use our Amazon
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * http://www.FreeRTOS.org
24  * http://aws.amazon.com/freertos
25  *
26  * 1 tab == 4 spaces!
27  */
28 
29 
30 /*
31  * Implementation of pvPortMalloc() and vPortFree() that relies on the
32  * compilers own malloc() and free() implementations.
33  *
34  * This file can only be used if the linker is configured to to generate
35  * a heap memory area.
36  *
37  * See heap_1.c, heap_2.c and heap_4.c for alternative implementations, and the
38  * memory management pages of http://www.FreeRTOS.org for more information.
39  */
40 
41 #if 0
42 
43 #include <stdlib.h>
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. */
48 #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
49 
50 #include "FreeRTOS.h"
51 #include "task.h"
52 
53 #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
54 
55 #if( configSUPPORT_DYNAMIC_ALLOCATION == 0 )
56  #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
57 #endif
58 
59 /*-----------------------------------------------------------*/
60 
61 extern void vApplicationMallocFailedHook( void );
62 void *pvPortMalloc( size_t xWantedSize )
63 {
64 void *pvReturn;
65 
67  {
68  pvReturn = malloc( xWantedSize );
69  traceMALLOC( pvReturn, xWantedSize );
70  }
71  ( void ) xTaskResumeAll();
72 
73  #if( configUSE_MALLOC_FAILED_HOOK == 1 )
74  {
75  if( pvReturn == NULL )
76  {
78  }
79  }
80  #endif
81 
82  return pvReturn;
83 }
84 /*-----------------------------------------------------------*/
85 
86 void vPortFree( void *pv )
87 {
88  if( pv )
89  {
91  {
92  free( pv );
93  traceFREE( pv, 0 );
94  }
95  ( void ) xTaskResumeAll();
96  }
97 }
98 
99 #endif
void vPortFree(void *pv) PRIVILEGED_FUNCTION
Definition: heap_4.c:311
void vApplicationMallocFailedHook(uint32_t size, uint32_t remaining, uint32_t prevLR)
Definition: rtos.c:166
void vTaskSuspendAll(void) PRIVILEGED_FUNCTION
Definition: tasks.c:2034
void * pvPortMalloc(size_t xSize) PRIVILEGED_FUNCTION
Definition: heap_4.c:155
#define NULL
Definition: nm_bsp.h:52
void free(void *ptr)
#define traceFREE(pvAddress, uiSize)
Definition: FreeRTOS.h:553
BaseType_t xTaskResumeAll(void) PRIVILEGED_FUNCTION
Definition: tasks.c:2107
void * malloc(size_t size)
#define traceMALLOC(pvAddress, uiSize)
Definition: FreeRTOS.h:549


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57