| 1 | /*
|
|---|
| 2 | * FreeRTOS Kernel V10.3.1
|
|---|
| 3 | * Copyright (C) 2020 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 | /*
|
|---|
| 41 | * Map standard (non MPU) API functions to equivalents that start
|
|---|
| 42 | * "MPU_". This will cause the application code to call the MPU_
|
|---|
| 43 | * version, which wraps the non-MPU version with privilege promoting
|
|---|
| 44 | * then demoting code, so the kernel code always runs will full
|
|---|
| 45 | * privileges.
|
|---|
| 46 | */
|
|---|
| 47 |
|
|---|
| 48 | /* Map standard tasks.h API functions to the MPU equivalents. */
|
|---|
| 49 | #define xTaskCreate MPU_xTaskCreate
|
|---|
| 50 | #define xTaskCreateStatic MPU_xTaskCreateStatic
|
|---|
| 51 | #define xTaskCreateRestricted MPU_xTaskCreateRestricted
|
|---|
| 52 | #define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
|---|
| 53 | #define vTaskDelete MPU_vTaskDelete
|
|---|
| 54 | #define vTaskDelay MPU_vTaskDelay
|
|---|
| 55 | #define vTaskDelayUntil MPU_vTaskDelayUntil
|
|---|
| 56 | #define xTaskAbortDelay MPU_xTaskAbortDelay
|
|---|
| 57 | #define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
|---|
| 58 | #define eTaskGetState MPU_eTaskGetState
|
|---|
| 59 | #define vTaskGetInfo MPU_vTaskGetInfo
|
|---|
| 60 | #define vTaskPrioritySet MPU_vTaskPrioritySet
|
|---|
| 61 | #define vTaskSuspend MPU_vTaskSuspend
|
|---|
| 62 | #define vTaskResume MPU_vTaskResume
|
|---|
| 63 | #define vTaskSuspendAll MPU_vTaskSuspendAll
|
|---|
| 64 | #define xTaskResumeAll MPU_xTaskResumeAll
|
|---|
| 65 | #define xTaskGetTickCount MPU_xTaskGetTickCount
|
|---|
| 66 | #define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
|---|
| 67 | #define pcTaskGetName MPU_pcTaskGetName
|
|---|
| 68 | #define xTaskGetHandle MPU_xTaskGetHandle
|
|---|
| 69 | #define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
|---|
| 70 | #define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
|
|---|
| 71 | #define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
|---|
| 72 | #define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
|
|---|
| 73 | #define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
|
|---|
| 74 | #define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
|
|---|
| 75 | #define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
|---|
| 76 | #define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
|
|---|
| 77 | #define uxTaskGetSystemState MPU_uxTaskGetSystemState
|
|---|
| 78 | #define vTaskList MPU_vTaskList
|
|---|
| 79 | #define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
|
|---|
| 80 | #define ulTaskGetIdleRunTimeCounter MPU_ulTaskGetIdleRunTimeCounter
|
|---|
| 81 | #define xTaskGenericNotify MPU_xTaskGenericNotify
|
|---|
| 82 | #define xTaskNotifyWait MPU_xTaskNotifyWait
|
|---|
| 83 | #define ulTaskNotifyTake MPU_ulTaskNotifyTake
|
|---|
| 84 | #define xTaskNotifyStateClear MPU_xTaskNotifyStateClear
|
|---|
| 85 | #define ulTaskNotifyValueClear MPU_ulTaskNotifyValueClear
|
|---|
| 86 | #define xTaskCatchUpTicks MPU_xTaskCatchUpTicks
|
|---|
| 87 |
|
|---|
| 88 | #define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
|
|---|
| 89 | #define vTaskSetTimeOutState MPU_vTaskSetTimeOutState
|
|---|
| 90 | #define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut
|
|---|
| 91 | #define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
|
|---|
| 92 |
|
|---|
| 93 | /* Map standard queue.h API functions to the MPU equivalents. */
|
|---|
| 94 | #define xQueueGenericSend MPU_xQueueGenericSend
|
|---|
| 95 | #define xQueueReceive MPU_xQueueReceive
|
|---|
| 96 | #define xQueuePeek MPU_xQueuePeek
|
|---|
| 97 | #define xQueueSemaphoreTake MPU_xQueueSemaphoreTake
|
|---|
| 98 | #define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
|
|---|
| 99 | #define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable
|
|---|
| 100 | #define vQueueDelete MPU_vQueueDelete
|
|---|
| 101 | #define xQueueCreateMutex MPU_xQueueCreateMutex
|
|---|
| 102 | #define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic
|
|---|
| 103 | #define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
|
|---|
| 104 | #define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic
|
|---|
| 105 | #define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
|
|---|
| 106 | #define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
|
|---|
| 107 | #define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
|
|---|
| 108 | #define xQueueGenericCreate MPU_xQueueGenericCreate
|
|---|
| 109 | #define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
|
|---|
| 110 | #define xQueueCreateSet MPU_xQueueCreateSet
|
|---|
| 111 | #define xQueueAddToSet MPU_xQueueAddToSet
|
|---|
| 112 | #define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
|---|
| 113 | #define xQueueSelectFromSet MPU_xQueueSelectFromSet
|
|---|
| 114 | #define xQueueGenericReset MPU_xQueueGenericReset
|
|---|
| 115 |
|
|---|
| 116 | #if( configQUEUE_REGISTRY_SIZE > 0 )
|
|---|
| 117 | #define vQueueAddToRegistry MPU_vQueueAddToRegistry
|
|---|
| 118 | #define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
|
|---|
| 119 | #define pcQueueGetName MPU_pcQueueGetName
|
|---|
| 120 | #endif
|
|---|
| 121 |
|
|---|
| 122 | /* Map standard timer.h API functions to the MPU equivalents. */
|
|---|
| 123 | #define xTimerCreate MPU_xTimerCreate
|
|---|
| 124 | #define xTimerCreateStatic MPU_xTimerCreateStatic
|
|---|
| 125 | #define pvTimerGetTimerID MPU_pvTimerGetTimerID
|
|---|
| 126 | #define vTimerSetTimerID MPU_vTimerSetTimerID
|
|---|
| 127 | #define xTimerIsTimerActive MPU_xTimerIsTimerActive
|
|---|
| 128 | #define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
|
|---|
| 129 | #define xTimerPendFunctionCall MPU_xTimerPendFunctionCall
|
|---|
| 130 | #define pcTimerGetName MPU_pcTimerGetName
|
|---|
| 131 | #define vTimerSetReloadMode MPU_vTimerSetReloadMode
|
|---|
| 132 | #define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
|
|---|
| 133 | #define xTimerGetPeriod MPU_xTimerGetPeriod
|
|---|
| 134 | #define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
|
|---|
| 135 | #define xTimerGenericCommand MPU_xTimerGenericCommand
|
|---|
| 136 |
|
|---|
| 137 | /* Map standard event_group.h API functions to the MPU equivalents. */
|
|---|
| 138 | #define xEventGroupCreate MPU_xEventGroupCreate
|
|---|
| 139 | #define xEventGroupCreateStatic MPU_xEventGroupCreateStatic
|
|---|
| 140 | #define xEventGroupWaitBits MPU_xEventGroupWaitBits
|
|---|
| 141 | #define xEventGroupClearBits MPU_xEventGroupClearBits
|
|---|
| 142 | #define xEventGroupSetBits MPU_xEventGroupSetBits
|
|---|
| 143 | #define xEventGroupSync MPU_xEventGroupSync
|
|---|
| 144 | #define vEventGroupDelete MPU_vEventGroupDelete
|
|---|
| 145 |
|
|---|
| 146 | /* Map standard message/stream_buffer.h API functions to the MPU
|
|---|
| 147 | equivalents. */
|
|---|
| 148 | #define xStreamBufferSend MPU_xStreamBufferSend
|
|---|
| 149 | #define xStreamBufferReceive MPU_xStreamBufferReceive
|
|---|
| 150 | #define xStreamBufferNextMessageLengthBytes MPU_xStreamBufferNextMessageLengthBytes
|
|---|
| 151 | #define vStreamBufferDelete MPU_vStreamBufferDelete
|
|---|
| 152 | #define xStreamBufferIsFull MPU_xStreamBufferIsFull
|
|---|
| 153 | #define xStreamBufferIsEmpty MPU_xStreamBufferIsEmpty
|
|---|
| 154 | #define xStreamBufferReset MPU_xStreamBufferReset
|
|---|
| 155 | #define xStreamBufferSpacesAvailable MPU_xStreamBufferSpacesAvailable
|
|---|
| 156 | #define xStreamBufferBytesAvailable MPU_xStreamBufferBytesAvailable
|
|---|
| 157 | #define xStreamBufferSetTriggerLevel MPU_xStreamBufferSetTriggerLevel
|
|---|
| 158 | #define xStreamBufferGenericCreate MPU_xStreamBufferGenericCreate
|
|---|
| 159 | #define xStreamBufferGenericCreateStatic MPU_xStreamBufferGenericCreateStatic
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 | /* Remove the privileged function macro, but keep the PRIVILEGED_DATA
|
|---|
| 163 | macro so applications can place data in privileged access sections
|
|---|
| 164 | (useful when using statically allocated objects). */
|
|---|
| 165 | #define PRIVILEGED_FUNCTION
|
|---|
| 166 | #define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
|---|
| 167 | #define FREERTOS_SYSTEM_CALL
|
|---|
| 168 |
|
|---|
| 169 | #else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
|---|
| 170 |
|
|---|
| 171 | /* Ensure API functions go in the privileged execution section. */
|
|---|
| 172 | #define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
|
|---|
| 173 | #define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
|---|
| 174 | #define FREERTOS_SYSTEM_CALL __attribute__((section( "freertos_system_calls")))
|
|---|
| 175 |
|
|---|
| 176 | #endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
|---|
| 177 |
|
|---|
| 178 | #else /* portUSING_MPU_WRAPPERS */
|
|---|
| 179 |
|
|---|
| 180 | #define PRIVILEGED_FUNCTION
|
|---|
| 181 | #define PRIVILEGED_DATA
|
|---|
| 182 | #define FREERTOS_SYSTEM_CALL
|
|---|
| 183 | #define portUSING_MPU_WRAPPERS 0
|
|---|
| 184 |
|
|---|
| 185 | #endif /* portUSING_MPU_WRAPPERS */
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 | #endif /* MPU_WRAPPERS_H */
|
|---|
| 189 |
|
|---|