portable.h
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  * Portable layer API. Each function must be defined for each port.
31  *----------------------------------------------------------*/
32 
33 #ifndef PORTABLE_H
34 #define PORTABLE_H
35 
36 /* Each FreeRTOS port has a unique portmacro.h header file. Originally a
37 pre-processor definition was used to ensure the pre-processor found the correct
38 portmacro.h file for the port being used. That scheme was deprecated in favour
39 of setting the compiler's include path such that it found the correct
40 portmacro.h file - removing the need for the constant and allowing the
41 portmacro.h file to be located anywhere in relation to the port being used.
42 Purely for reasons of backward compatibility the old method is still valid, but
43 to make it clear that new projects should not use it, support for the port
44 specific constants has been moved into the deprecated_definitions.h header
45 file. */
46 #include "deprecated_definitions.h"
47 
48 /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
49 did not result in a portmacro.h header file being included - and it should be
50 included here. In this case the path to the correct portmacro.h header file
51 must be set in the compiler's include path. */
52 #ifndef portENTER_CRITICAL
53  #include "portmacro.h"
54 #endif
55 
56 #if portBYTE_ALIGNMENT == 32
57  #define portBYTE_ALIGNMENT_MASK ( 0x001f )
58 #endif
59 
60 #if portBYTE_ALIGNMENT == 16
61  #define portBYTE_ALIGNMENT_MASK ( 0x000f )
62 #endif
63 
64 #if portBYTE_ALIGNMENT == 8
65  #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
66 #endif
67 
68 #if portBYTE_ALIGNMENT == 4
69  #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
70 #endif
71 
72 #if portBYTE_ALIGNMENT == 2
73  #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
74 #endif
75 
76 #if portBYTE_ALIGNMENT == 1
77  #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
78 #endif
79 
80 #ifndef portBYTE_ALIGNMENT_MASK
81  #error "Invalid portBYTE_ALIGNMENT definition"
82 #endif
83 
84 #ifndef portNUM_CONFIGURABLE_REGIONS
85  #define portNUM_CONFIGURABLE_REGIONS 1
86 #endif
87 
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91 
92 #include "mpu_wrappers.h"
93 
94 /*
95  * Setup the stack of a new task so it is ready to be placed under the
96  * scheduler control. The registers have to be placed on the stack in
97  * the order that the port expects to find them.
98  *
99  */
100 #if( portUSING_MPU_WRAPPERS == 1 )
101  StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
102 #else
103  StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
104 #endif
105 
106 /* Used by heap_5.c. */
107 typedef struct HeapRegion
108 {
109  uint8_t *pucStartAddress;
110  size_t xSizeInBytes;
111 } HeapRegion_t;
112 
113 /*
114  * Used to define multiple heap regions for use by heap_5.c. This function
115  * must be called before any calls to pvPortMalloc() - not creating a task,
116  * queue, semaphore, mutex, software timer, event group, etc. will result in
117  * pvPortMalloc being called.
118  *
119  * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
120  * defines a region of memory that can be used as the heap. The array is
121  * terminated by a HeapRegions_t structure that has a size of 0. The region
122  * with the lowest start address must appear first in the array.
123  */
124 void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
125 
126 
127 /*
128  * Map to the memory management routines required for the port.
129  */
130 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
131 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
135 
136 /*
137  * Setup the hardware ready for the scheduler to take control. This generally
138  * sets up a tick interrupt and sets timers for the correct tick frequency.
139  */
141 
142 /*
143  * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
144  * the hardware is left in its original condition after the scheduler stops
145  * executing.
146  */
148 
149 /*
150  * The structures and methods of manipulating the MPU are contained within the
151  * port layer.
152  *
153  * Fills the xMPUSettings structure with the memory region information
154  * contained in xRegions.
155  */
156 #if( portUSING_MPU_WRAPPERS == 1 )
157  struct xMEMORY_REGION;
158  void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
159 #endif
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif /* PORTABLE_H */
166 
void vPortFree(void *pv) PRIVILEGED_FUNCTION
Definition: heap_4.c:311
size_t xPortGetMinimumEverFreeHeapSize(void) PRIVILEGED_FUNCTION
Definition: heap_4.c:365
void * pvPortMalloc(size_t xSize) PRIVILEGED_FUNCTION
Definition: heap_4.c:155
void vPortEndScheduler(void) PRIVILEGED_FUNCTION
Definition: port.c:384
BaseType_t xPortStartScheduler(void) PRIVILEGED_FUNCTION
Definition: port.c:282
StackType_t * pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters) PRIVILEGED_FUNCTION
size_t xPortGetFreeHeapSize(void) PRIVILEGED_FUNCTION
Definition: heap_4.c:359
size_t xSizeInBytes
Definition: portable.h:110
long BaseType_t
Definition: portmacro.h:57
struct HeapRegion HeapRegion_t
uint8_t * pucStartAddress
Definition: portable.h:109
#define PRIVILEGED_FUNCTION
Definition: mpu_wrappers.h:174
void vPortDefineHeapRegions(const HeapRegion_t *const pxHeapRegions) PRIVILEGED_FUNCTION
void vPortInitialiseBlocks(void) PRIVILEGED_FUNCTION
Definition: heap_4.c:371
void(* TaskFunction_t)(void *)
Definition: projdefs.h:36
portSTACK_TYPE StackType_t
Definition: portmacro.h:56


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:04