1 //***************************************************************************** 2 // 3 // rtos_bindings.h - Macros intended to aid porting of TivaWare modules 4 // for use with an RTOS. 5 // 6 // Copyright (c) 2012-2020 Texas Instruments Incorporated. All rights reserved. 7 // Software License Agreement 8 // 9 // Redistribution and use in source and binary forms, with or without 10 // modification, are permitted provided that the following conditions 11 // are met: 12 // 13 // Redistributions of source code must retain the above copyright 14 // notice, this list of conditions and the following disclaimer. 15 // 16 // Redistributions in binary form must reproduce the above copyright 17 // notice, this list of conditions and the following disclaimer in the 18 // documentation and/or other materials provided with the 19 // distribution. 20 // 21 // Neither the name of Texas Instruments Incorporated nor the names of 22 // its contributors may be used to endorse or promote products derived 23 // from this software without specific prior written permission. 24 // 25 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 // 37 // This is part of revision 2.2.0.295 of the Tiva Peripheral Driver Library. 38 // 39 //***************************************************************************** 40 41 #ifndef __DRIVERLIB_RTOS_BINDINGS_H__ 42 #define __DRIVERLIB_RTOS_BINDINGS_H__ 43 44 #ifdef USE_RTOS 45 //***************************************************************************** 46 // 47 // If an RTOS is in use, implement a header file called "tiva_rtos.h" 48 // which contains RTOS-specific versions of each of the macros defined below 49 // and make sure it appears on the include path set when you build your 50 // project. 51 // 52 // Note that there is no default implementation of this header file included 53 // in TivaWare - it is your responsibility to create it specifically for 54 // your RTOS. 55 // 56 //***************************************************************************** 57 #include "tiva_rtos.h" 58 59 #else 60 //***************************************************************************** 61 // 62 // When no RTOS is in use, the follow macros compile to either nothing or a 63 // minimal implementation that works in a bare-metal environment. 64 // 65 // Each of these macros must be redefined in tiva_rtos.h if you are using 66 // TivaWare under an RTOS. 67 // 68 //***************************************************************************** 69 70 //***************************************************************************** 71 // 72 // A simple macro used to yield within polling loops. In the default, non-RTOS 73 // implementation, this compiles to nothing. 74 // 75 //***************************************************************************** 76 #define OS_YIELD() 77 78 //***************************************************************************** 79 // 80 // A simple macro around the SysCtlDelay function. The parameter is the number 81 // of 3 cycle loops to wait before returning (as for SysCtlDelay). In an RTOS 82 // implementation, this could be replaced with an OS delay call with 83 // appropriate parameter scaling. 84 // 85 //***************************************************************************** 86 #define OS_DELAY(ul3Cycles) MAP_SysCtlDelay(ul3Cycles) 87 88 //***************************************************************************** 89 // 90 // Wrappers around low level interrupt control functions. For information 91 // on each of these functions, please see the appropriate API documentation 92 // for the DriverLib Interrupt driver. 93 // 94 // The macros defined here represent interrupt-control functions that may be 95 // called from within TivaWare code. It is expected that application 96 // code will use RTOS-specific functions to control interrupt priority, to 97 // pend interrupts and to perform runtime vector manipulation. As a result, 98 // no macros are defined to wrap any of these functions from interrupt.c. 99 // 100 //***************************************************************************** 101 #define OS_INT_MASTER_ENABLE() MAP_IntMasterEnable() 102 #define OS_INT_MASTER_DISABLE() MAP_IntMasterDisable() 103 #define OS_INT_DISABLE(ui32IntID) MAP_IntDisable(ui32IntID) 104 #define OS_INT_ENABLE(ui32IntID) MAP_IntEnable(ui32IntID) 105 106 #endif // USE_RTOS 107 108 #endif // __DRIVERLIB_RTOS_BINDINGS_H__ 109