2 * FreeRTOS Kernel V10.2.0
3 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
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:
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
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.
22 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
28 /*-----------------------------------------------------------
29 * Portable layer API. Each function must be defined for each port.
30 *----------------------------------------------------------*/
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
45 #include "deprecated_definitions.h"
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"
55 #if portBYTE_ALIGNMENT == 32
56 #define portBYTE_ALIGNMENT_MASK ( 0x001f )
59 #if portBYTE_ALIGNMENT == 16
60 #define portBYTE_ALIGNMENT_MASK ( 0x000f )
63 #if portBYTE_ALIGNMENT == 8
64 #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
67 #if portBYTE_ALIGNMENT == 4
68 #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
71 #if portBYTE_ALIGNMENT == 2
72 #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
75 #if portBYTE_ALIGNMENT == 1
76 #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
79 #ifndef portBYTE_ALIGNMENT_MASK
80 #error "Invalid portBYTE_ALIGNMENT definition"
83 #ifndef portNUM_CONFIGURABLE_REGIONS
84 #define portNUM_CONFIGURABLE_REGIONS 1
91 #include "mpu_wrappers.h"
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.
99 #if( portUSING_MPU_WRAPPERS == 1 )
100 #if( portHAS_STACK_OVERFLOW_CHECKING == 1 )
101 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, StackType_t *pxEndOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
103 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
106 #if( portHAS_STACK_OVERFLOW_CHECKING == 1 )
107 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, StackType_t *pxEndOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
109 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
113 /* Used by heap_5.c. */
114 typedef struct HeapRegion
116 uint8_t *pucStartAddress;
121 * Used to define multiple heap regions for use by heap_5.c. This function
122 * must be called before any calls to pvPortMalloc() - not creating a task,
123 * queue, semaphore, mutex, software timer, event group, etc. will result in
124 * pvPortMalloc being called.
126 * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
127 * defines a region of memory that can be used as the heap. The array is
128 * terminated by a HeapRegions_t structure that has a size of 0. The region
129 * with the lowest start address must appear first in the array.
131 void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
135 * Map to the memory management routines required for the port.
137 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
138 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
139 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
140 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
141 size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
144 * Setup the hardware ready for the scheduler to take control. This generally
145 * sets up a tick interrupt and sets timers for the correct tick frequency.
147 BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
150 * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
151 * the hardware is left in its original condition after the scheduler stops
154 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
157 * The structures and methods of manipulating the MPU are contained within the
160 * Fills the xMPUSettings structure with the memory region information
161 * contained in xRegions.
163 #if( portUSING_MPU_WRAPPERS == 1 )
164 struct xMEMORY_REGION;
165 void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
172 #endif /* PORTABLE_H */