1 //***************************************************************************** 2 // 3 // rtos_bindings.h - Macros ulIntIDended to aid porting of StellarisWare modules 4 // for use with an RTOS. 5 // 6 // Copyright (c) 2012 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 9453 of the Stellaris Peripheral Driver Library. 38 // 39 //***************************************************************************** 40 #ifndef RTOS_BINDINGS_H_ 41 #define RTOS_BINDINGS_H_ 42 43 #ifdef USE_RTOS 44 //***************************************************************************** 45 // 46 // If an RTOS is in use, implement a header file called "stellaris_rtos.h" 47 // which contains RTOS-specific versions of each of the macros defined below 48 // and make sure it appears on the include path set when you build your 49 // project. 50 // 51 // Note that there is no default implementation of this header file included 52 // in StellarisWare - it is your responsibility to create it specifically for 53 // your RTOS. 54 // 55 //***************************************************************************** 56 #include "stellaris_rtos.h" 57 58 #else 59 //***************************************************************************** 60 // 61 // When no RTOS is in use, the follow macros compile to either nothing or a 62 // minimal implementation that works in a bare-metal environment. 63 // 64 // Each of these macros must be redefined in stellaris_rtos.h if you are using 65 // StellarisWare under an RTOS. 66 // 67 //***************************************************************************** 68 69 //***************************************************************************** 70 // 71 // A simple macro used to yield within polling loops. In the default, non-RTOS 72 // implementation, this compiles to nothing. 73 // 74 //***************************************************************************** 75 #define OS_YIELD() 76 77 //***************************************************************************** 78 // 79 // A simple macro around the SysCtlDelay function. The parameter is the number 80 // of 3 cycle loops to wait before returning (as for SysCtlDelay). In an RTOS 81 // implementation, this could be replaced with an OS delay call with 82 // appropriate parameter scaling. 83 // 84 //***************************************************************************** 85 #define OS_DELAY(ul3Cycles) MAP_SysCtlDelay(ul3Cycles) 86 87 //***************************************************************************** 88 // 89 // Wrappers around low level interrupt control functions. For information 90 // on each of these functions, please see the appropriate API documentation 91 // for the DriverLib Interrupt driver. 92 // 93 // The macros defined here represent interrupt-control functions that may be 94 // called from within StellarisWare code. It is expected that application 95 // code will use RTOS-specific functions to control interrupt priority, to 96 // pend interrupts and to perform runtime vector manipulation. As a result, 97 // no macros are defined to wrap any of these functions from interrupt.c. 98 // 99 //***************************************************************************** 100 #define OS_INT_MASTER_ENABLE() MAP_IntMasterEnable() 101 #define OS_INT_MASTER_DISABLE() MAP_IntMasterDisable() 102 #define OS_INT_DISABLE(ulIntID) MAP_IntDisable(ulIntID) 103 #define OS_INT_ENABLE(ulIntID) MAP_IntEnable(ulIntID) 104 105 #endif // USE_RTOS 106 107 #endif // RTOS_BINDINGS_H_ 108