1 /*
2  * FreeRTOS Kernel V10.2.0
3  * Copyright (C) 2019 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.
14  *
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.
21  *
22  * http://www.FreeRTOS.org
23  * http://aws.amazon.com/freertos
24  *
25  * 1 tab == 4 spaces!
26  */
27 
28 #ifndef MPU_WRAPPERS_H
29 #define MPU_WRAPPERS_H
30 
31 /* This file redefines API functions to be called through a wrapper macro, but
32 only for ports that are using the MPU. */
33 #ifdef portUSING_MPU_WRAPPERS
34 
35 	/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
36 	included from queue.c or task.c to prevent it from having an effect within
37 	those files. */
38 	#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
39 
40 		#define xTaskGenericCreate				MPU_xTaskGenericCreate
41 		#define vTaskAllocateMPURegions			MPU_vTaskAllocateMPURegions
42 		#define vTaskDelete						MPU_vTaskDelete
43 		#define vTaskDelayUntil					MPU_vTaskDelayUntil
44 		#define vTaskDelay						MPU_vTaskDelay
45 		#define uxTaskPriorityGet				MPU_uxTaskPriorityGet
46 		#define vTaskPrioritySet				MPU_vTaskPrioritySet
47 		#define eTaskGetState					MPU_eTaskGetState
48 		#define vTaskSuspend					MPU_vTaskSuspend
49 		#define vTaskResume						MPU_vTaskResume
50 		#define vTaskSuspendAll					MPU_vTaskSuspendAll
51 		#define xTaskResumeAll					MPU_xTaskResumeAll
52 		#define xTaskGetTickCount				MPU_xTaskGetTickCount
53 		#define uxTaskGetNumberOfTasks			MPU_uxTaskGetNumberOfTasks
54 		#define vTaskList						MPU_vTaskList
55 		#define vTaskGetRunTimeStats			MPU_vTaskGetRunTimeStats
56 		#define vTaskSetApplicationTaskTag		MPU_vTaskSetApplicationTaskTag
57 		#define xTaskGetApplicationTaskTag		MPU_xTaskGetApplicationTaskTag
58 		#define xTaskCallApplicationTaskHook	MPU_xTaskCallApplicationTaskHook
59 		#define uxTaskGetStackHighWaterMark		MPU_uxTaskGetStackHighWaterMark
60 		#define xTaskGetCurrentTaskHandle		MPU_xTaskGetCurrentTaskHandle
61 		#define xTaskGetSchedulerState			MPU_xTaskGetSchedulerState
62 		#define xTaskGetIdleTaskHandle			MPU_xTaskGetIdleTaskHandle
63 		#define uxTaskGetSystemState			MPU_uxTaskGetSystemState
64 
65 		#define xQueueGenericCreate				MPU_xQueueGenericCreate
66 		#define xQueueCreateMutex				MPU_xQueueCreateMutex
67 		#define xQueueGiveMutexRecursive		MPU_xQueueGiveMutexRecursive
68 		#define xQueueTakeMutexRecursive		MPU_xQueueTakeMutexRecursive
69 		#define xQueueCreateCountingSemaphore	MPU_xQueueCreateCountingSemaphore
70 		#define xQueueGenericSend				MPU_xQueueGenericSend
71 		#define xQueueAltGenericSend			MPU_xQueueAltGenericSend
72 		#define xQueueAltGenericReceive			MPU_xQueueAltGenericReceive
73 		#define xQueueGenericReceive			MPU_xQueueGenericReceive
74 		#define uxQueueMessagesWaiting			MPU_uxQueueMessagesWaiting
75 		#define vQueueDelete					MPU_vQueueDelete
76 		#define xQueueGenericReset				MPU_xQueueGenericReset
77 		#define xQueueCreateSet					MPU_xQueueCreateSet
78 		#define xQueueSelectFromSet				MPU_xQueueSelectFromSet
79 		#define xQueueAddToSet					MPU_xQueueAddToSet
80 		#define xQueueRemoveFromSet				MPU_xQueueRemoveFromSet
81 		#define xQueuePeekFromISR				MPU_xQueuePeekFromISR
82 		#define xQueueGetMutexHolder			MPU_xQueueGetMutexHolder
83 
84 		#define pvPortMalloc					MPU_pvPortMalloc
85 		#define vPortFree						MPU_vPortFree
86 		#define xPortGetFreeHeapSize			MPU_xPortGetFreeHeapSize
87 		#define vPortInitialiseBlocks			MPU_vPortInitialiseBlocks
88 
89 		#if configQUEUE_REGISTRY_SIZE > 0
90 			#define vQueueAddToRegistry				MPU_vQueueAddToRegistry
91 			#define vQueueUnregisterQueue			MPU_vQueueUnregisterQueue
92 		#endif
93 
94 		/* Remove the privileged function macro. */
95 		#define PRIVILEGED_FUNCTION
96 
97 	#else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
98 
99 		/* Ensure API functions go in the privileged execution section. */
100 		#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
101 		#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
102 
103 	#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
104 
105 #else /* portUSING_MPU_WRAPPERS */
106 
107 	#define PRIVILEGED_FUNCTION
108 	#define PRIVILEGED_DATA
109 	#define portUSING_MPU_WRAPPERS 0
110 
111 #endif /* portUSING_MPU_WRAPPERS */
112 
113 
114 #endif /* MPU_WRAPPERS_H */
115 
116