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