]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/driverlib/inc/CMSIS/cmsis_ccs.h
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil / driverlib / inc / CMSIS / cmsis_ccs.h
1 //*****************************************************************************\r
2 //\r
3 // Copyright (C) 2012 - 2014 Texas Instruments Incorporated - http://www.ti.com/\r
4 //\r
5 // Redistribution and use in source and binary forms, with or without\r
6 // modification, are permitted provided that the following conditions\r
7 // are met:\r
8 //\r
9 //  Redistributions of source code must retain the above copyright\r
10 //  notice, this list of conditions and the following disclaimer.\r
11 //\r
12 //  Redistributions in binary form must reproduce the above copyright\r
13 //  notice, this list of conditions and the following disclaimer in the\r
14 //  documentation and/or other materials provided with the\r
15 //  distribution.\r
16 //\r
17 //  Neither the name of Texas Instruments Incorporated nor the names of\r
18 //  its contributors may be used to endorse or promote products derived\r
19 //  from this software without specific prior written permission.\r
20 //\r
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
32 //\r
33 // MSP432 Family CMSIS Definitions\r
34 //\r
35 //****************************************************************************\r
36 \r
37 #ifndef CMSIS_CCS_H_\r
38 #define CMSIS_CCS_H_\r
39 \r
40 //*****************************************************************************\r
41 // CMSIS-compatible instruction calls\r
42 //*****************************************************************************\r
43 \r
44 // No Operation\r
45 __attribute__( ( always_inline ) ) static inline void __nop(void)\r
46 {\r
47         __asm("  nop");\r
48 }\r
49 \r
50 // Wait For Interrupt\r
51 __attribute__( ( always_inline ) ) static inline void __wfi(void)\r
52 {\r
53         __asm("  wfi");\r
54 }\r
55 \r
56 // Wait For Event\r
57 __attribute__( ( always_inline ) ) static inline void __wfe(void)\r
58 {\r
59         __asm("  wfe");\r
60 }\r
61 \r
62 // Enable Interrupts\r
63 __attribute__( ( always_inline ) ) static inline void __enable_irq(void)\r
64 {\r
65         __asm("  cpsie i");\r
66 }\r
67 \r
68 // Disable Interrupts\r
69 __attribute__( ( always_inline ) ) static inline void __disable_irq(void)\r
70 {\r
71         __asm("  cpsid i");\r
72 }\r
73 \r
74 // Data Synchronization Barrier\r
75 __attribute__( ( always_inline ) ) static inline void __DSB(void)\r
76 {\r
77         __asm("  dsb");\r
78 }\r
79 \r
80 #if (0)\r
81 // Get Main Stack Pointer\r
82 static inline uint32_t __get_MSP(void)\r
83 {\r
84         register uint32_t result;\r
85         //__asm ("  mrs result, msp");\r
86         return(result);\r
87 }\r
88 \r
89 // Set Main Stack Pointer\r
90 static inline void __set_MSP(uint32_t topOfMainStack)\r
91 {\r
92         asm(" .global topOfMainStack");\r
93         __asm ("  msr msp, topOfMainStack");\r
94 }\r
95 \r
96 \r
97 // Get Priority Mask\r
98 static inline uint32_t __get_PRIMASK(void)\r
99 {\r
100         uint32_t result;\r
101         __asm ("  mrs result, primask");\r
102         return(result);\r
103 }\r
104 \r
105 \r
106 // Set Priority Mask\r
107 static inline void __set_PRIMASK(uint32_t priMask)\r
108 {\r
109         __asm ("  msr primask, priMask");\r
110 }\r
111 #endif\r
112 \r
113 \r
114 //\r
115 //      v5e, v6, Cortex-M3, Cortex-M4, Cortex-R4, and Cortex-A8 compiler intrinsics\r
116 //\r
117 #define __CLZ           _norm\r
118 #define __SXTB          _sxtb\r
119 #define __SXTH          _sxth\r
120 #define __UXTB          _uxtb\r
121 #define __UXTH          _uxth\r
122 //  CCS supports intrinsics to take advantage of the shift operand left/right\r
123 //        before saturation extension of SSAT, but CMSIS does not take advantage\r
124 //        of those, so tell the compiler to use a sat & shift left with a shift\r
125 //        value of 0 whenever it encounters an SSAT\r
126 #define __SSAT(VAL, BITPOS) \\r
127         _ssatl(VAL , 0, BITPOS)\r
128 \r
129 //\r
130 //  Only define M4 based intrinsics if we're not using an M4\r
131 //\r
132 #if defined (__TI_TMS470_V7M4__)\r
133 //              \r
134 //      V5E, V6, Cortex-M4, Cortex-R4, and Cortex-A8 compiler intrinsics\r
135 //\r
136 #define __QADD          _sadd\r
137 #define __QDADD         _sdadd\r
138 #define __QDSUB         _sdsub\r
139 #define __SMLABB        _smlabb\r
140 #define __SMLABT        _smlabt\r
141 #define __SMLALBB       _smlalbb\r
142 #define __SMLALBT       _smlalbt\r
143 #define __SMLALTB       _smlaltb\r
144 #define __SMLALTT       _smlaltt\r
145 #define __SMLATB        _smlatb\r
146 #define __SMLATT        _smlatt\r
147 #define __SMLAWB        _smlawb\r
148 #define __SMLAWT        _smlawt\r
149 \r
150 #define __SMULBB        _smulbb\r
151 #define __SMULBT        _smulbt\r
152 #define __SMULTB        _smultb\r
153 #define __SMULTT        _smultt\r
154 #define __SMULWB        _smulwb\r
155 #define __SMULWT        _smulwt\r
156 #define __QSUB          _ssub\r
157 #define __SUBC          _subc\r
158 \r
159 //\r
160 //      v6, Cortex-M4, Cortex-R4, and Cortex-A8 compiler intrinsics\r
161 //\r
162 #define __SHASX         _shaddsubx\r
163 #define __SHSAX         _shsubaddx\r
164 #define __PKHBT         _pkhbt\r
165 #define __PKHTB         _pkhtb\r
166 #define __QADD16        _qadd16\r
167 #define __QADD8         _qadd8\r
168 #define __QSUB16        _qsub16\r
169 #define __QSUB8         _qsub8\r
170 #define __QASX          _saddsubx\r
171 #define __QSAX          _qsubaddx\r
172 #define __SADD16        _sadd16\r
173 #define __SADD8         _sadd8\r
174 #define __SASX          _saddsubx\r
175 #define __SEL           _sel\r
176 #define __SHADD16       _shadd16\r
177 #define __SHADD8        _shadd8\r
178 #define __SHSUB16       _shsub16\r
179 #define __SHSUB8        _shsub8\r
180 #define __SMLAD         _smlad\r
181 #define __SMLADX        _smladx\r
182 #define __SMLALD        _smlald\r
183 #define __SMLALDX       _smlaldx\r
184 #define __SMLSD         _smlsd\r
185 #define __SMLSDX        _smlsdx\r
186 #define __SMLSLD        _smlsld\r
187 #define __SMLSLDX       _smlsldx\r
188 #define __SMMLA         _smmla\r
189 #define __SMMLAR        _smmlar\r
190 #define __SMMLS         _smmls\r
191 #define __SMMLSR        _smmlsr\r
192 #define __SMMUL         _smmul\r
193 #define __SMMULR        _smmulr\r
194 #define __SMUAD         _smuad\r
195 #define __SMUADX        _smuadx\r
196 #define __SMUSD         _smusd\r
197 #define __SMUSDX        _smusd\r
198 #define __SSAT16        _ssat16\r
199 #define __SSUB16        _ssub16\r
200 #define __SSUB8         _ssub8\r
201 #define __SSAX          _ssubaddx\r
202 #define __SXTAB         _sxtab\r
203 #define __SXTAB16       _sxtab16\r
204 #define __SXTAH         _sxtah\r
205 #define __UMAAL         _umaal\r
206 #define __UADD16        _uadd16\r
207 #define __UADD8         _uadd8\r
208 #define __UHADD16       _uhadd16\r
209 #define __UHADD8        _uhadd8\r
210 #define __UASX          _uaddsubx\r
211 #define __UHSUB16       _uhsub16\r
212 #define __UHSUB8        _uhsub8\r
213 #define __UQADD16       _uqadd16\r
214 #define __UQADD8        _uqadd8\r
215 #define __UQASX         _uqaddsubx\r
216 #define __UQSUB16       _uqsub16\r
217 #define __UQSUB8        _uqsub8\r
218 #define __UQSAX         _uqsubaddx\r
219 #define __USAD8         _usad8\r
220 #define __USAT16        _usat16\r
221 #define __USUB16        _usub16\r
222 #define __USUB8         _usub8\r
223 #define __USAX          _usubaddx\r
224 #define __UXTAB         _uxtab\r
225 #define __UXTAB16       _uxtab16\r
226 #define __UXTAH         _uxtah\r
227 #define __UXTB16        _uxtb16\r
228 #endif /*__TI_TMS470_V7M4__*/\r
229 \r
230 #endif /*CMSIS_CCS_H_*/\r