]> git.sur5r.net Git - freertos/blob - FreeRTOS/Source/include/portable.h
Update version numbers in preparation for a new release.
[freertos] / FreeRTOS / Source / include / portable.h
1 /*\r
2  * FreeRTOS Kernel V10.1.0\r
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 /*-----------------------------------------------------------\r
29  * Portable layer API.  Each function must be defined for each port.\r
30  *----------------------------------------------------------*/\r
31 \r
32 #ifndef PORTABLE_H\r
33 #define PORTABLE_H\r
34 \r
35 /* Each FreeRTOS port has a unique portmacro.h header file.  Originally a\r
36 pre-processor definition was used to ensure the pre-processor found the correct\r
37 portmacro.h file for the port being used.  That scheme was deprecated in favour\r
38 of setting the compiler's include path such that it found the correct\r
39 portmacro.h file - removing the need for the constant and allowing the\r
40 portmacro.h file to be located anywhere in relation to the port being used.\r
41 Purely for reasons of backward compatibility the old method is still valid, but\r
42 to make it clear that new projects should not use it, support for the port\r
43 specific constants has been moved into the deprecated_definitions.h header\r
44 file. */\r
45 #include "deprecated_definitions.h"\r
46 \r
47 /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h\r
48 did not result in a portmacro.h header file being included - and it should be\r
49 included here.  In this case the path to the correct portmacro.h header file\r
50 must be set in the compiler's include path. */\r
51 #ifndef portENTER_CRITICAL\r
52         #include "portmacro.h"\r
53 #endif\r
54 \r
55 #if portBYTE_ALIGNMENT == 32\r
56         #define portBYTE_ALIGNMENT_MASK ( 0x001f )\r
57 #endif\r
58 \r
59 #if portBYTE_ALIGNMENT == 16\r
60         #define portBYTE_ALIGNMENT_MASK ( 0x000f )\r
61 #endif\r
62 \r
63 #if portBYTE_ALIGNMENT == 8\r
64         #define portBYTE_ALIGNMENT_MASK ( 0x0007 )\r
65 #endif\r
66 \r
67 #if portBYTE_ALIGNMENT == 4\r
68         #define portBYTE_ALIGNMENT_MASK ( 0x0003 )\r
69 #endif\r
70 \r
71 #if portBYTE_ALIGNMENT == 2\r
72         #define portBYTE_ALIGNMENT_MASK ( 0x0001 )\r
73 #endif\r
74 \r
75 #if portBYTE_ALIGNMENT == 1\r
76         #define portBYTE_ALIGNMENT_MASK ( 0x0000 )\r
77 #endif\r
78 \r
79 #ifndef portBYTE_ALIGNMENT_MASK\r
80         #error "Invalid portBYTE_ALIGNMENT definition"\r
81 #endif\r
82 \r
83 #ifndef portNUM_CONFIGURABLE_REGIONS\r
84         #define portNUM_CONFIGURABLE_REGIONS 1\r
85 #endif\r
86 \r
87 #ifdef __cplusplus\r
88 extern "C" {\r
89 #endif\r
90 \r
91 #include "mpu_wrappers.h"\r
92 \r
93 /*\r
94  * Setup the stack of a new task so it is ready to be placed under the\r
95  * scheduler control.  The registers have to be placed on the stack in\r
96  * the order that the port expects to find them.\r
97  *\r
98  */\r
99 #if( portUSING_MPU_WRAPPERS == 1 )\r
100         StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;\r
101 #else\r
102         StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;\r
103 #endif\r
104 \r
105 /* Used by heap_5.c. */\r
106 typedef struct HeapRegion\r
107 {\r
108         uint8_t *pucStartAddress;\r
109         size_t xSizeInBytes;\r
110 } HeapRegion_t;\r
111 \r
112 /*\r
113  * Used to define multiple heap regions for use by heap_5.c.  This function\r
114  * must be called before any calls to pvPortMalloc() - not creating a task,\r
115  * queue, semaphore, mutex, software timer, event group, etc. will result in\r
116  * pvPortMalloc being called.\r
117  *\r
118  * pxHeapRegions passes in an array of HeapRegion_t structures - each of which\r
119  * defines a region of memory that can be used as the heap.  The array is\r
120  * terminated by a HeapRegions_t structure that has a size of 0.  The region\r
121  * with the lowest start address must appear first in the array.\r
122  */\r
123 void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;\r
124 \r
125 \r
126 /*\r
127  * Map to the memory management routines required for the port.\r
128  */\r
129 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;\r
130 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;\r
131 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;\r
132 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
133 size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;\r
134 \r
135 /*\r
136  * Setup the hardware ready for the scheduler to take control.  This generally\r
137  * sets up a tick interrupt and sets timers for the correct tick frequency.\r
138  */\r
139 BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;\r
140 \r
141 /*\r
142  * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so\r
143  * the hardware is left in its original condition after the scheduler stops\r
144  * executing.\r
145  */\r
146 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;\r
147 \r
148 /*\r
149  * The structures and methods of manipulating the MPU are contained within the\r
150  * port layer.\r
151  *\r
152  * Fills the xMPUSettings structure with the memory region information\r
153  * contained in xRegions.\r
154  */\r
155 #if( portUSING_MPU_WRAPPERS == 1 )\r
156         struct xMEMORY_REGION;\r
157         void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;\r
158 #endif\r
159 \r
160 #ifdef __cplusplus\r
161 }\r
162 #endif\r
163 \r
164 #endif /* PORTABLE_H */\r
165 \r