Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:44:51

0001 #ifndef BOOST_LEAF_CONFIG_TLS_FREERTOS_HPP_INCLUDED
0002 #define BOOST_LEAF_CONFIG_TLS_FREERTOS_HPP_INCLUDED
0003 
0004 // Copyright 2018-2023 Emil Dotchevski and Reverge Studios, Inc.
0005 // Copyright (c) 2022 Khalil Estell
0006 
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 #include <task.h>
0011 
0012 #ifndef BOOST_LEAF_USE_TLS_ARRAY
0013 #   define BOOST_LEAF_USE_TLS_ARRAY
0014 #endif
0015 
0016 #ifndef BOOST_LEAF_CFG_TLS_ARRAY_SIZE
0017 #   define BOOST_LEAF_CFG_TLS_ARRAY_SIZE configNUM_THREAD_LOCAL_STORAGE_POINTERS
0018 #endif
0019 
0020 static_assert((BOOST_LEAF_CFG_TLS_ARRAY_SIZE) <= configNUM_THREAD_LOCAL_STORAGE_POINTERS,
0021     "Bad BOOST_LEAF_CFG_TLS_ARRAY_SIZE");
0022 
0023 namespace boost { namespace leaf {
0024 
0025 namespace tls
0026 {
0027     // See https://www.freertos.org/thread-local-storage-pointers.html.
0028 
0029     inline void * read_void_ptr( int tls_index ) noexcept
0030     {
0031         return pvTaskGetThreadLocalStoragePointer(0, tls_index);
0032     }
0033 
0034     inline void write_void_ptr( int tls_index, void * p ) noexcept
0035     {
0036         vTaskSetThreadLocalStoragePointer(0, tls_index, p);
0037     }
0038 }
0039 
0040 } }
0041 
0042 #endif