1 /*
2  * FreeRTOS Kernel V10.6.2
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  * Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
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:
14  *
15  * The above copyright notice and this permission notice shall be included in all
16  * copies or substantial portions of the Software.
17  *
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.
24  *
25  * https://www.FreeRTOS.org
26  * https://github.com/FreeRTOS
27  */
28 
29 #ifndef FREERTOS_SDK_CONFIG_H
30 #define FREERTOS_SDK_CONFIG_H
31 
32 #ifndef __ASSEMBLER__
33     #include "FreeRTOSConfig.h"
34     #include "rp2040_config.h"
35     #ifndef PICO_USE_MALLOC_MUTEX
36         // malloc needs to be made thread safe
37         #define PICO_USE_MALLOC_MUTEX 1
38     #endif /* PICO_USE_MALLOC_MUTEX */
39     #if ( configSUPPORT_PICO_SYNC_INTEROP == 1 )
40         // increase the amount of time it may reasonably take to wake us up
41         #ifndef PICO_TIME_SLEEP_OVERHEAD_ADJUST_US
42         #define PICO_TIME_SLEEP_OVERHEAD_ADJUST_US 150
43         #endif
44 
45         #define lock_owner_id_t uint32_t
46         extern uint32_t ulPortLockGetCurrentOwnerId(void);
47         #define lock_get_caller_owner_id() ulPortLockGetCurrentOwnerId()
48         #define LOCK_INVALID_OWNER_ID ((uint32_t)-1)
49 
50         struct lock_core;
51         #ifndef lock_internal_spin_unlock_with_wait
52         extern void vPortLockInternalSpinUnlockWithWait( struct lock_core *pxLock, uint32_t ulSave);
53         #define lock_internal_spin_unlock_with_wait(lock, save) vPortLockInternalSpinUnlockWithWait(lock, save)
54         #endif
55 
56         #ifndef lock_internal_spin_unlock_with_notify
57         extern void vPortLockInternalSpinUnlockWithNotify( struct lock_core *pxLock, uint32_t save);
58         #define lock_internal_spin_unlock_with_notify(lock, save) vPortLockInternalSpinUnlockWithNotify(lock, save);
59         #endif
60 
61         #ifndef lock_internal_spin_unlock_with_best_effort_wait_or_timeout
62         extern bool xPortLockInternalSpinUnlockWithBestEffortWaitOrTimeout( struct lock_core *pxLock, uint32_t ulSave, absolute_time_t uxUntil);
63         #define lock_internal_spin_unlock_with_best_effort_wait_or_timeout(lock, save, until) \
64             xPortLockInternalSpinUnlockWithBestEffortWaitOrTimeout(lock, save, until)
65         #endif
66     #endif /* configSUPPORT_PICO_SYNC_INTEROP */
67 
68     #if ( configSUPPORT_PICO_TIME_INTEROP == 1 )
69         extern void xPortSyncInternalYieldUntilBefore(absolute_time_t t);
70         #define sync_internal_yield_until_before(t) xPortSyncInternalYieldUntilBefore(t)
71     #endif /* configSUPPORT_PICO_TIME_INTEROP */
72 #endif /* __ASSEMBLER__ */
73 #endif
74