annotate l476rg-hal-test/Drivers/CMSIS/Include/cmsis_gcc.h @ 6:ca42336826bd default tip

working on clock sources
author cin
date Mon, 23 Jan 2017 02:40:17 +0300
parents 32a3b1785697
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1 /**************************************************************************//**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
2 * @file cmsis_gcc.h
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
3 * @brief CMSIS Cortex-M Core Function/Instruction Header File
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
4 * @version V4.30
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
5 * @date 20. October 2015
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
6 ******************************************************************************/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
7 /* Copyright (c) 2009 - 2015 ARM LIMITED
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
8
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
9 All rights reserved.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
10 Redistribution and use in source and binary forms, with or without
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
11 modification, are permitted provided that the following conditions are met:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
12 - Redistributions of source code must retain the above copyright
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
13 notice, this list of conditions and the following disclaimer.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
14 - Redistributions in binary form must reproduce the above copyright
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
15 notice, this list of conditions and the following disclaimer in the
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
16 documentation and/or other materials provided with the distribution.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
17 - Neither the name of ARM nor the names of its contributors may be used
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
18 to endorse or promote products derived from this software without
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
19 specific prior written permission.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
20 *
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
24 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
31 POSSIBILITY OF SUCH DAMAGE.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
32 ---------------------------------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
33
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
34
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
35 #ifndef __CMSIS_GCC_H
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
36 #define __CMSIS_GCC_H
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
37
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
38 /* ignore some GCC warnings */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
39 #if defined ( __GNUC__ )
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
40 #pragma GCC diagnostic push
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
41 #pragma GCC diagnostic ignored "-Wsign-conversion"
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
42 #pragma GCC diagnostic ignored "-Wconversion"
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
43 #pragma GCC diagnostic ignored "-Wunused-parameter"
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
44 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
45
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
46
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
47 /* ########################### Core Function Access ########################### */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
48 /** \ingroup CMSIS_Core_FunctionInterface
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
49 \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
50 @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
51 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
52
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
53 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
54 \brief Enable IRQ Interrupts
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
55 \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
56 Can only be executed in Privileged modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
57 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
58 __attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
59 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
60 __ASM volatile ("cpsie i" : : : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
61 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
62
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
63
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
64 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
65 \brief Disable IRQ Interrupts
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
66 \details Disables IRQ interrupts by setting the I-bit in the CPSR.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
67 Can only be executed in Privileged modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
68 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
69 __attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
70 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
71 __ASM volatile ("cpsid i" : : : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
72 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
73
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
74
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
75 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
76 \brief Get Control Register
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
77 \details Returns the content of the Control Register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
78 \return Control Register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
79 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
80 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
81 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
82 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
83
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
84 __ASM volatile ("MRS %0, control" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
85 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
86 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
87
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
88
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
89 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
90 \brief Set Control Register
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
91 \details Writes the given value to the Control Register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
92 \param [in] control Control Register value to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
93 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
94 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
95 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
96 __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
97 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
98
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
99
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
100 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
101 \brief Get IPSR Register
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
102 \details Returns the content of the IPSR Register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
103 \return IPSR Register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
104 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
105 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
106 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
107 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
108
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
109 __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
110 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
111 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
112
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
113
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
114 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
115 \brief Get APSR Register
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
116 \details Returns the content of the APSR Register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
117 \return APSR Register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
118 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
119 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
120 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
121 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
122
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
123 __ASM volatile ("MRS %0, apsr" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
124 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
125 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
126
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
127
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
128 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
129 \brief Get xPSR Register
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
130 \details Returns the content of the xPSR Register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
131
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
132 \return xPSR Register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
133 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
134 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
135 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
136 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
137
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
138 __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
139 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
140 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
141
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
142
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
143 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
144 \brief Get Process Stack Pointer
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
145 \details Returns the current value of the Process Stack Pointer (PSP).
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
146 \return PSP Register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
147 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
148 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
149 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
150 register uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
151
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
152 __ASM volatile ("MRS %0, psp\n" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
153 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
154 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
155
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
156
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
157 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
158 \brief Set Process Stack Pointer
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
159 \details Assigns the given value to the Process Stack Pointer (PSP).
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
160 \param [in] topOfProcStack Process Stack Pointer value to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
161 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
162 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
163 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
164 __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
165 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
166
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
167
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
168 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
169 \brief Get Main Stack Pointer
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
170 \details Returns the current value of the Main Stack Pointer (MSP).
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
171 \return MSP Register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
172 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
173 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
174 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
175 register uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
176
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
177 __ASM volatile ("MRS %0, msp\n" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
178 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
179 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
180
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
181
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
182 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
183 \brief Set Main Stack Pointer
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
184 \details Assigns the given value to the Main Stack Pointer (MSP).
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
185
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
186 \param [in] topOfMainStack Main Stack Pointer value to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
187 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
188 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
189 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
190 __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
191 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
192
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
193
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
194 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
195 \brief Get Priority Mask
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
196 \details Returns the current state of the priority mask bit from the Priority Mask Register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
197 \return Priority Mask value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
198 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
199 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
200 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
201 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
202
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
203 __ASM volatile ("MRS %0, primask" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
204 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
205 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
206
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
207
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
208 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
209 \brief Set Priority Mask
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
210 \details Assigns the given value to the Priority Mask Register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
211 \param [in] priMask Priority Mask
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
212 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
213 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
214 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
215 __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
216 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
217
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
218
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
219 #if (__CORTEX_M >= 0x03U)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
220
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
221 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
222 \brief Enable FIQ
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
223 \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
224 Can only be executed in Privileged modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
225 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
226 __attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
227 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
228 __ASM volatile ("cpsie f" : : : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
229 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
230
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
231
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
232 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
233 \brief Disable FIQ
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
234 \details Disables FIQ interrupts by setting the F-bit in the CPSR.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
235 Can only be executed in Privileged modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
236 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
237 __attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
238 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
239 __ASM volatile ("cpsid f" : : : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
240 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
241
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
242
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
243 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
244 \brief Get Base Priority
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
245 \details Returns the current value of the Base Priority register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
246 \return Base Priority register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
247 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
248 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
249 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
250 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
251
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
252 __ASM volatile ("MRS %0, basepri" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
253 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
254 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
255
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
256
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
257 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
258 \brief Set Base Priority
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
259 \details Assigns the given value to the Base Priority register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
260 \param [in] basePri Base Priority value to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
261 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
262 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
263 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
264 __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
265 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
266
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
267
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
268 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
269 \brief Set Base Priority with condition
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
270 \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
271 or the new value increases the BASEPRI priority level.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
272 \param [in] basePri Base Priority value to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
273 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
274 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
275 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
276 __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
277 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
278
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
279
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
280 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
281 \brief Get Fault Mask
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
282 \details Returns the current value of the Fault Mask register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
283 \return Fault Mask register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
284 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
285 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
286 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
287 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
288
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
289 __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
290 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
291 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
292
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
293
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
294 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
295 \brief Set Fault Mask
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
296 \details Assigns the given value to the Fault Mask register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
297 \param [in] faultMask Fault Mask value to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
298 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
299 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
300 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
301 __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
302 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
303
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
304 #endif /* (__CORTEX_M >= 0x03U) */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
305
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
306
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
307 #if (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
308
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
309 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
310 \brief Get FPSCR
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
311 \details Returns the current value of the Floating Point Status/Control register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
312 \return Floating Point Status/Control register value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
313 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
314 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
315 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
316 #if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
317 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
318
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
319 /* Empty asm statement works as a scheduling barrier */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
320 __ASM volatile ("");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
321 __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
322 __ASM volatile ("");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
323 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
324 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
325 return(0);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
326 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
327 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
328
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
329
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
330 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
331 \brief Set FPSCR
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
332 \details Assigns the given value to the Floating Point Status/Control register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
333 \param [in] fpscr Floating Point Status/Control value to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
334 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
335 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
336 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
337 #if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
338 /* Empty asm statement works as a scheduling barrier */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
339 __ASM volatile ("");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
340 __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
341 __ASM volatile ("");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
342 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
343 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
344
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
345 #endif /* (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
346
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
347
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
348
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
349 /*@} end of CMSIS_Core_RegAccFunctions */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
350
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
351
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
352 /* ########################## Core Instruction Access ######################### */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
353 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
354 Access to dedicated instructions
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
355 @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
356 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
357
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
358 /* Define macros for porting to both thumb1 and thumb2.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
359 * For thumb1, use low register (r0-r7), specified by constraint "l"
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
360 * Otherwise, use general registers, specified by constraint "r" */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
361 #if defined (__thumb__) && !defined (__thumb2__)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
362 #define __CMSIS_GCC_OUT_REG(r) "=l" (r)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
363 #define __CMSIS_GCC_USE_REG(r) "l" (r)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
364 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
365 #define __CMSIS_GCC_OUT_REG(r) "=r" (r)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
366 #define __CMSIS_GCC_USE_REG(r) "r" (r)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
367 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
368
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
369 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
370 \brief No Operation
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
371 \details No Operation does nothing. This instruction can be used for code alignment purposes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
372 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
373 __attribute__((always_inline)) __STATIC_INLINE void __NOP(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
374 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
375 __ASM volatile ("nop");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
376 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
377
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
378
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
379 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
380 \brief Wait For Interrupt
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
381 \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
382 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
383 __attribute__((always_inline)) __STATIC_INLINE void __WFI(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
384 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
385 __ASM volatile ("wfi");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
386 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
387
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
388
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
389 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
390 \brief Wait For Event
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
391 \details Wait For Event is a hint instruction that permits the processor to enter
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
392 a low-power state until one of a number of events occurs.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
393 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
394 __attribute__((always_inline)) __STATIC_INLINE void __WFE(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
395 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
396 __ASM volatile ("wfe");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
397 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
398
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
399
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
400 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
401 \brief Send Event
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
402 \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
403 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
404 __attribute__((always_inline)) __STATIC_INLINE void __SEV(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
405 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
406 __ASM volatile ("sev");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
407 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
408
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
409
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
410 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
411 \brief Instruction Synchronization Barrier
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
412 \details Instruction Synchronization Barrier flushes the pipeline in the processor,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
413 so that all instructions following the ISB are fetched from cache or memory,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
414 after the instruction has been completed.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
415 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
416 __attribute__((always_inline)) __STATIC_INLINE void __ISB(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
417 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
418 __ASM volatile ("isb 0xF":::"memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
419 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
420
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
421
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
422 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
423 \brief Data Synchronization Barrier
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
424 \details Acts as a special kind of Data Memory Barrier.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
425 It completes when all explicit memory accesses before this instruction complete.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
426 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
427 __attribute__((always_inline)) __STATIC_INLINE void __DSB(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
428 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
429 __ASM volatile ("dsb 0xF":::"memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
430 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
431
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
432
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
433 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
434 \brief Data Memory Barrier
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
435 \details Ensures the apparent order of the explicit memory operations before
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
436 and after the instruction, without ensuring their completion.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
437 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
438 __attribute__((always_inline)) __STATIC_INLINE void __DMB(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
439 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
440 __ASM volatile ("dmb 0xF":::"memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
441 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
442
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
443
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
444 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
445 \brief Reverse byte order (32 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
446 \details Reverses the byte order in integer value.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
447 \param [in] value Value to reverse
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
448 \return Reversed value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
449 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
450 __attribute__((always_inline)) __STATIC_INLINE uint32_t __REV(uint32_t value)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
451 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
452 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
453 return __builtin_bswap32(value);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
454 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
455 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
456
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
457 __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
458 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
459 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
460 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
461
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
462
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
463 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
464 \brief Reverse byte order (16 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
465 \details Reverses the byte order in two unsigned short values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
466 \param [in] value Value to reverse
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
467 \return Reversed value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
468 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
469 __attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
470 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
471 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
472
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
473 __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
474 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
475 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
476
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
477
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
478 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
479 \brief Reverse byte order in signed short value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
480 \details Reverses the byte order in a signed short value with sign extension to integer.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
481 \param [in] value Value to reverse
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
482 \return Reversed value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
483 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
484 __attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
485 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
486 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
487 return (short)__builtin_bswap16(value);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
488 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
489 int32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
490
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
491 __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
492 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
493 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
494 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
495
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
496
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
497 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
498 \brief Rotate Right in unsigned value (32 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
499 \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
500 \param [in] value Value to rotate
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
501 \param [in] value Number of Bits to rotate
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
502 \return Rotated value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
503 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
504 __attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
505 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
506 return (op1 >> op2) | (op1 << (32U - op2));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
507 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
508
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
509
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
510 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
511 \brief Breakpoint
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
512 \details Causes the processor to enter Debug state.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
513 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
514 \param [in] value is ignored by the processor.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
515 If required, a debugger can use it to store additional information about the breakpoint.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
516 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
517 #define __BKPT(value) __ASM volatile ("bkpt "#value)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
518
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
519
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
520 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
521 \brief Reverse bit order of value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
522 \details Reverses the bit order of the given value.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
523 \param [in] value Value to reverse
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
524 \return Reversed value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
525 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
526 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
527 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
528 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
529
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
530 #if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
531 __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
532 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
533 int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
534
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
535 result = value; /* r will be reversed bits of v; first get LSB of v */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
536 for (value >>= 1U; value; value >>= 1U)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
537 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
538 result <<= 1U;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
539 result |= value & 1U;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
540 s--;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
541 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
542 result <<= s; /* shift when v's highest bits are zero */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
543 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
544 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
545 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
546
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
547
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
548 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
549 \brief Count leading zeros
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
550 \details Counts the number of leading zeros of a data value.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
551 \param [in] value Value to count the leading zeros
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
552 \return number of leading zeros in value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
553 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
554 #define __CLZ __builtin_clz
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
555
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
556
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
557 #if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
558
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
559 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
560 \brief LDR Exclusive (8 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
561 \details Executes a exclusive LDR instruction for 8 bit value.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
562 \param [in] ptr Pointer to data
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
563 \return value of type uint8_t at (*ptr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
564 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
565 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
566 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
567 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
568
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
569 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
570 __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
571 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
572 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
573 accepted by assembler. So has to use following less efficient pattern.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
574 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
575 __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
576 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
577 return ((uint8_t) result); /* Add explicit type cast here */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
578 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
579
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
580
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
581 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
582 \brief LDR Exclusive (16 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
583 \details Executes a exclusive LDR instruction for 16 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
584 \param [in] ptr Pointer to data
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
585 \return value of type uint16_t at (*ptr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
586 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
587 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
588 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
589 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
590
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
591 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
592 __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
593 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
594 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
595 accepted by assembler. So has to use following less efficient pattern.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
596 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
597 __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
598 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
599 return ((uint16_t) result); /* Add explicit type cast here */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
600 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
601
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
602
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
603 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
604 \brief LDR Exclusive (32 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
605 \details Executes a exclusive LDR instruction for 32 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
606 \param [in] ptr Pointer to data
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
607 \return value of type uint32_t at (*ptr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
608 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
609 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
610 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
611 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
612
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
613 __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
614 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
615 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
616
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
617
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
618 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
619 \brief STR Exclusive (8 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
620 \details Executes a exclusive STR instruction for 8 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
621 \param [in] value Value to store
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
622 \param [in] ptr Pointer to location
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
623 \return 0 Function succeeded
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
624 \return 1 Function failed
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
625 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
626 __attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
627 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
628 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
629
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
630 __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
631 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
632 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
633
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
634
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
635 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
636 \brief STR Exclusive (16 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
637 \details Executes a exclusive STR instruction for 16 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
638 \param [in] value Value to store
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
639 \param [in] ptr Pointer to location
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
640 \return 0 Function succeeded
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
641 \return 1 Function failed
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
642 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
643 __attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
644 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
645 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
646
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
647 __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
648 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
649 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
650
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
651
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
652 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
653 \brief STR Exclusive (32 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
654 \details Executes a exclusive STR instruction for 32 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
655 \param [in] value Value to store
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
656 \param [in] ptr Pointer to location
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
657 \return 0 Function succeeded
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
658 \return 1 Function failed
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
659 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
660 __attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
661 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
662 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
663
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
664 __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
665 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
666 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
667
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
668
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
669 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
670 \brief Remove the exclusive lock
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
671 \details Removes the exclusive lock which is created by LDREX.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
672 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
673 __attribute__((always_inline)) __STATIC_INLINE void __CLREX(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
674 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
675 __ASM volatile ("clrex" ::: "memory");
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
676 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
677
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
678
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
679 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
680 \brief Signed Saturate
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
681 \details Saturates a signed value.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
682 \param [in] value Value to be saturated
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
683 \param [in] sat Bit position to saturate to (1..32)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
684 \return Saturated value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
685 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
686 #define __SSAT(ARG1,ARG2) \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
687 ({ \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
688 uint32_t __RES, __ARG1 = (ARG1); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
689 __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
690 __RES; \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
691 })
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
692
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
693
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
694 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
695 \brief Unsigned Saturate
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
696 \details Saturates an unsigned value.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
697 \param [in] value Value to be saturated
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
698 \param [in] sat Bit position to saturate to (0..31)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
699 \return Saturated value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
700 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
701 #define __USAT(ARG1,ARG2) \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
702 ({ \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
703 uint32_t __RES, __ARG1 = (ARG1); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
704 __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
705 __RES; \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
706 })
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
707
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
708
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
709 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
710 \brief Rotate Right with Extend (32 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
711 \details Moves each bit of a bitstring right by one bit.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
712 The carry input is shifted in at the left end of the bitstring.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
713 \param [in] value Value to rotate
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
714 \return Rotated value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
715 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
716 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
717 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
718 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
719
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
720 __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
721 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
722 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
723
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
724
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
725 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
726 \brief LDRT Unprivileged (8 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
727 \details Executes a Unprivileged LDRT instruction for 8 bit value.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
728 \param [in] ptr Pointer to data
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
729 \return value of type uint8_t at (*ptr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
730 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
731 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
732 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
733 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
734
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
735 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
736 __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*addr) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
737 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
738 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
739 accepted by assembler. So has to use following less efficient pattern.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
740 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
741 __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
742 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
743 return ((uint8_t) result); /* Add explicit type cast here */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
744 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
745
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
746
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
747 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
748 \brief LDRT Unprivileged (16 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
749 \details Executes a Unprivileged LDRT instruction for 16 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
750 \param [in] ptr Pointer to data
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
751 \return value of type uint16_t at (*ptr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
752 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
753 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
754 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
755 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
756
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
757 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
758 __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*addr) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
759 #else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
760 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
761 accepted by assembler. So has to use following less efficient pattern.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
762 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
763 __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
764 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
765 return ((uint16_t) result); /* Add explicit type cast here */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
766 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
767
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
768
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
769 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
770 \brief LDRT Unprivileged (32 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
771 \details Executes a Unprivileged LDRT instruction for 32 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
772 \param [in] ptr Pointer to data
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
773 \return value of type uint32_t at (*ptr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
774 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
775 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
776 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
777 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
778
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
779 __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*addr) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
780 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
781 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
782
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
783
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
784 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
785 \brief STRT Unprivileged (8 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
786 \details Executes a Unprivileged STRT instruction for 8 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
787 \param [in] value Value to store
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
788 \param [in] ptr Pointer to location
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
789 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
790 __attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
791 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
792 __ASM volatile ("strbt %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
793 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
794
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
795
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
796 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
797 \brief STRT Unprivileged (16 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
798 \details Executes a Unprivileged STRT instruction for 16 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
799 \param [in] value Value to store
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
800 \param [in] ptr Pointer to location
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
801 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
802 __attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
803 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
804 __ASM volatile ("strht %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
805 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
806
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
807
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
808 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
809 \brief STRT Unprivileged (32 bit)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
810 \details Executes a Unprivileged STRT instruction for 32 bit values.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
811 \param [in] value Value to store
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
812 \param [in] ptr Pointer to location
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
813 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
814 __attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *addr)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
815 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
816 __ASM volatile ("strt %1, %0" : "=Q" (*addr) : "r" (value) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
817 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
818
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
819 #endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
820
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
821 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
822
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
823
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
824 /* ################### Compiler specific Intrinsics ########################### */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
825 /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
826 Access to dedicated SIMD instructions
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
827 @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
828 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
829
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
830 #if (__CORTEX_M >= 0x04U) /* only for Cortex-M4 and above */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
831
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
832 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
833 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
834 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
835
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
836 __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
837 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
838 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
839
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
840 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
841 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
842 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
843
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
844 __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
845 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
846 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
847
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
848 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
849 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
850 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
851
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
852 __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
853 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
854 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
855
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
856 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
857 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
858 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
859
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
860 __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
861 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
862 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
863
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
864 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
865 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
866 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
867
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
868 __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
869 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
870 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
871
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
872 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
873 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
874 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
875
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
876 __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
877 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
878 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
879
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
880
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
881 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
882 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
883 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
884
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
885 __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
886 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
887 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
888
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
889 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
890 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
891 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
892
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
893 __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
894 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
895 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
896
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
897 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
898 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
899 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
900
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
901 __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
902 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
903 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
904
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
905 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
906 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
907 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
908
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
909 __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
910 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
911 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
912
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
913 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
914 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
915 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
916
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
917 __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
918 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
919 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
920
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
921 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
922 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
923 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
924
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
925 __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
926 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
927 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
928
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
929
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
930 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
931 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
932 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
933
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
934 __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
935 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
936 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
937
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
938 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
939 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
940 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
941
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
942 __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
943 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
944 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
945
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
946 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
947 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
948 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
949
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
950 __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
951 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
952 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
953
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
954 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
955 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
956 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
957
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
958 __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
959 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
960 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
961
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
962 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
963 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
964 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
965
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
966 __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
967 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
968 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
969
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
970 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
971 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
972 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
973
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
974 __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
975 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
976 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
977
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
978 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
979 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
980 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
981
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
982 __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
983 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
984 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
985
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
986 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
987 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
988 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
989
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
990 __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
991 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
992 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
993
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
994 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
995 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
996 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
997
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
998 __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
999 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1000 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1001
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1002 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1003 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1004 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1005
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1006 __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1007 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1008 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1009
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1010 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1011 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1012 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1013
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1014 __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1015 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1016 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1017
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1018 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1019 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1020 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1021
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1022 __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1023 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1024 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1025
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1026 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1027 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1028 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1029
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1030 __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1031 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1032 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1033
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1034 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1035 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1036 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1037
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1038 __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1039 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1040 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1041
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1042 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1043 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1044 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1045
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1046 __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1047 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1048 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1049
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1050 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1051 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1052 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1053
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1054 __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1055 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1056 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1057
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1058 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1059 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1060 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1061
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1062 __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1063 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1064 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1065
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1066 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1067 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1068 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1069
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1070 __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1071 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1072 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1073
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1074 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1075 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1076 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1077
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1078 __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1079 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1080 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1081
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1082 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1083 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1084 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1085
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1086 __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1087 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1088 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1089
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1090 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1091 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1092 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1093
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1094 __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1095 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1096 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1097
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1098 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1099 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1100 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1101
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1102 __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1103 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1104 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1105
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1106 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1107 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1108 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1109
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1110 __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1111 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1112 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1113
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1114 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1115 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1116 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1117
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1118 __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1119 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1120 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1121
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1122 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1123 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1124 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1125
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1126 __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1127 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1128 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1129
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1130 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1131 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1132 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1133
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1134 __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1135 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1136 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1137
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1138 #define __SSAT16(ARG1,ARG2) \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1139 ({ \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1140 int32_t __RES, __ARG1 = (ARG1); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1141 __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1142 __RES; \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1143 })
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1144
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1145 #define __USAT16(ARG1,ARG2) \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1146 ({ \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1147 uint32_t __RES, __ARG1 = (ARG1); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1148 __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1149 __RES; \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1150 })
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1151
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1152 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1153 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1154 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1155
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1156 __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1157 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1158 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1159
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1160 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1161 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1162 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1163
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1164 __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1165 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1166 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1167
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1168 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1169 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1170 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1171
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1172 __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1173 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1174 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1175
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1176 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1177 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1178 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1179
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1180 __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1181 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1182 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1183
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1184 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1185 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1186 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1187
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1188 __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1189 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1190 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1191
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1192 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1193 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1194 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1195
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1196 __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1197 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1198 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1199
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1200 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1201 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1202 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1203
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1204 __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1205 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1206 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1207
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1208 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1209 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1210 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1211
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1212 __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1213 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1214 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1215
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1216 __attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1217 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1218 union llreg_u{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1219 uint32_t w32[2];
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1220 uint64_t w64;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1221 } llr;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1222 llr.w64 = acc;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1223
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1224 #ifndef __ARMEB__ /* Little endian */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1225 __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1226 #else /* Big endian */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1227 __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1228 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1229
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1230 return(llr.w64);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1231 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1232
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1233 __attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1234 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1235 union llreg_u{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1236 uint32_t w32[2];
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1237 uint64_t w64;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1238 } llr;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1239 llr.w64 = acc;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1240
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1241 #ifndef __ARMEB__ /* Little endian */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1242 __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1243 #else /* Big endian */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1244 __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1245 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1246
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1247 return(llr.w64);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1248 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1249
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1250 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1251 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1252 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1253
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1254 __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1255 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1256 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1257
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1258 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1259 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1260 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1261
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1262 __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1263 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1264 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1265
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1266 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1267 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1268 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1269
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1270 __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1271 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1272 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1273
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1274 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1275 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1276 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1277
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1278 __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1279 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1280 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1281
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1282 __attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1283 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1284 union llreg_u{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1285 uint32_t w32[2];
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1286 uint64_t w64;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1287 } llr;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1288 llr.w64 = acc;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1289
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1290 #ifndef __ARMEB__ /* Little endian */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1291 __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1292 #else /* Big endian */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1293 __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1294 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1295
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1296 return(llr.w64);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1297 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1298
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1299 __attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1300 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1301 union llreg_u{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1302 uint32_t w32[2];
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1303 uint64_t w64;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1304 } llr;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1305 llr.w64 = acc;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1306
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1307 #ifndef __ARMEB__ /* Little endian */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1308 __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1309 #else /* Big endian */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1310 __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1311 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1312
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1313 return(llr.w64);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1314 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1315
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1316 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1317 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1318 uint32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1319
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1320 __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1321 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1322 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1323
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1324 __attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __QADD( int32_t op1, int32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1325 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1326 int32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1327
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1328 __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1329 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1330 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1331
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1332 __attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __QSUB( int32_t op1, int32_t op2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1333 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1334 int32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1335
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1336 __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1337 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1338 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1339
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1340 #define __PKHBT(ARG1,ARG2,ARG3) \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1341 ({ \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1342 uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1343 __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1344 __RES; \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1345 })
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1346
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1347 #define __PKHTB(ARG1,ARG2,ARG3) \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1348 ({ \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1349 uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1350 if (ARG3 == 0) \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1351 __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1352 else \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1353 __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1354 __RES; \
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1355 })
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1356
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1357 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1358 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1359 int32_t result;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1360
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1361 __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1362 return(result);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1363 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1364
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1365 #endif /* (__CORTEX_M >= 0x04) */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1366 /*@} end of group CMSIS_SIMD_intrinsics */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1367
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1368
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1369 #if defined ( __GNUC__ )
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1370 #pragma GCC diagnostic pop
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1371 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1372
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1373 #endif /* __CMSIS_GCC_H */