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