2 * FreeRTOS Kernel V11.1.0
3 * Copyright (C) 2015-2019 Cadence Design Systems, Inc.
4 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 * SPDX-License-Identifier: MIT
8 * Permission is hereby granted, free of charge, to any person obtaining a copy of
9 * this software and associated documentation files (the "Software"), to deal in
10 * the Software without restriction, including without limitation the rights to
11 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12 * the Software, and to permit persons to whom the Software is furnished to do so,
13 * subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in all
16 * copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * https://www.FreeRTOS.org
26 * https://github.com/FreeRTOS
31 * xtensa_overlay_os_hook.c -- Overlay manager OS hooks for FreeRTOS.
39 /* Mutex object that controls access to the overlay. Currently only one
40 * overlay region is supported so one mutex suffices.
42 static SemaphoreHandle_t xt_overlay_mutex;
45 /* This function should be overridden to provide OS specific init such
46 * as the creation of a mutex lock that can be used for overlay locking.
47 * Typically this mutex would be set up with priority inheritance. See
48 * overlay manager documentation for more details.
50 void xt_overlay_init_os(void)
52 /* Create the mutex for overlay access. Priority inheritance is
55 xt_overlay_mutex = xSemaphoreCreateMutex();
59 /* This function locks access to shared overlay resources, typically
60 * by acquiring a mutex.
62 void xt_overlay_lock(void)
64 xSemaphoreTake(xt_overlay_mutex, 0);
68 /* This function releases access to shared overlay resources, typically
69 * by unlocking a mutex.
71 void xt_overlay_unlock(void)
73 xSemaphoreGive(xt_overlay_mutex);