]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core/src/Ref_cmInstr.txt
Merge pull request #42 from meriac/develop
[cmsis] / CMSIS / DoxyGen / Core / src / Ref_cmInstr.txt
1 /**\r
2 \defgroup intrinsic_CPU_gr Intrinsic Functions for CPU Instructions\r
3 @{\r
4 \brief Functions that generate specific Cortex-M CPU Instructions.\r
5 \details\r
6 The following functions generate specific Cortex-M instructions that cannot be directly accessed by the C/C++ Compiler.\r
7 Refer to the \ref ref_man_sec for detailed information about these Cortex-M instructions.\r
8 \r
9 \note\r
10 When using the ARM Compiler Toolchain the following \ref intrinsic_CPU_gr are implemented using the Embedded Assembler: \ref __RRX, <Bruno: add more...>.\r
11 The usage of the Embedded Assembler can be disabled by with <b><i>define __NO_EMBEDDED_ASM</i></b>. This avoids potential side effects of the Embedded Assembler.\r
12 Refer to <b>Compiler User Guide - Using the Inline and Embedded Assemblers of the ARM Compiler</b> for more information. \r
13 \r
14 */\r
15 /**************************************************************************************************/\r
16 /** \brief  No Operation\r
17 \r
18     This function does nothing. This instruction can be used for code alignment purposes.\r
19  */\r
20 void __NOP(void);\r
21 \r
22 \r
23 /**************************************************************************************************/\r
24 /** \brief  Wait For Interrupt\r
25 \r
26     WFI is a hint instruction that suspends execution until one of the following events occurs:\r
27     - A non-masked interrupt occurs and is taken.\r
28     - An interrupt masked by PRIMASK becomes pending.\r
29     - A Debug Entry request.\r
30  */\r
31 void __WFI(void);\r
32 \r
33 \r
34 /**************************************************************************************************/\r
35 /** \brief  Wait For Event\r
36 \r
37     Wait For Event is a hint instruction that permits the processor to enter\r
38     a low-power state until an events occurs:\r
39     \li If the <b>event register is 0</b>, then WFE suspends execution until one of the following events occurs:\r
40     - An exception, unless masked by the exception mask registers or the current priority level.\r
41     - An exception enters the Pending state, if SEVONPEND in the System Control Register is set.\r
42     - A Debug Entry request, if Debug is enabled.\r
43     - An event signaled by a peripheral or another processor in a multiprocessor system using\r
44     the SEV instruction.\r
45     \r
46     \li If the <b>event register is 1</b>, then WFE clears it to 0 and returns immediately.\r
47     \r
48  */\r
49 void __WFE(void);\r
50 \r
51 \r
52 /**************************************************************************************************/\r
53 /** \brief  Send Event\r
54 \r
55     Send Event is a hint instruction. It causes an event to be signaled to the CPU.\r
56  */\r
57 void __SEV(void);\r
58 \r
59 \r
60 /**************************************************************************************************/\r
61 /** \brief  Set Breakpoint\r
62 \r
63 This function causes the processor to enter Debug state.\r
64 Debug tools can use this to investigate system state when the instruction at a particular address is reached.\r
65 \r
66 \param [in]    value  is ignored by the processor. If required, a debugger can use it to obtain additional information about the breakpoint.\r
67 */\r
68 void __BKPT(uint8_t value);\r
69 \r
70 \r
71 /**************************************************************************************************/\r
72 /** \brief  Instruction Synchronization Barrier\r
73 \r
74     Instruction Synchronization Barrier flushes the pipeline in the processor, \r
75     so that all instructions following the ISB are fetched from cache or \r
76     memory, after the instruction has been completed.\r
77  */\r
78 void __ISB(void);\r
79 \r
80 \r
81 /**************************************************************************************************/\r
82 /** \brief  Data Synchronization Barrier\r
83 \r
84 \details\r
85 This function acts as a special kind of Data Memory Barrier. \r
86 It completes when all explicit memory accesses before this instruction complete.\r
87  */\r
88 void __DSB(void);\r
89 \r
90 \r
91 /**************************************************************************************************/\r
92 /** \brief  Data Memory Barrier\r
93 \r
94 \details\r
95 This function ensures the apparent order of the explicit memory operations before \r
96 and after the instruction, without ensuring their completion.\r
97  */\r
98 void __DMB(void);\r
99 \r
100 \r
101 /**************************************************************************************************/\r
102 /** \brief  Reverse byte order (32 bit)\r
103 \details\r
104 This function reverses the byte order in integer value.\r
105 \r
106 \param [in]    value  Value to reverse\r
107 \return               Reversed value\r
108  */\r
109 uint32_t __REV(uint32_t value);\r
110 \r
111 \r
112 /**************************************************************************************************/\r
113 /** \brief  Reverse byte order (16 bit)\r
114 \r
115 \details\r
116 This function reverses the byte order in two unsigned short values.\r
117 \r
118 \param [in]    value  Value to reverse\r
119 \return               Reversed value\r
120 */\r
121 uint32_t __REV16(uint32_t value);\r
122 \r
123 \r
124 /**************************************************************************************************/\r
125 /** \brief  Reverse byte order in signed short value\r
126 \r
127 \details\r
128 This function reverses the byte order in a signed short value with sign extension to integer.\r
129 \r
130 \param [in]    value  Value to reverse\r
131 \return               Reversed value\r
132  */\r
133 int32_t __REVSH(int32_t value);\r
134 \r
135 \r
136 /**************************************************************************************************/\r
137 /** \brief  Reverse bit order of value [not for Cortex-M0, Cortex-M0+, or SC000]\r
138 \r
139     This function reverses the bit order of the given value [not for Cortex-M0, Cortex-M0+, or SC000].\r
140 \r
141     \param [in]    value  Value to reverse\r
142     \return               Reversed value\r
143  */\r
144 uint32_t __RBIT(uint32_t value);\r
145 \r
146 \r
147 /**************************************************************************************************/\r
148 /** \brief  Rotate a value right by a number of bits\r
149 \r
150     This function rotates a value right by a specified number of bits.\r
151 \r
152     \param [in]    value  Value to be shifted right\r
153     \param [in]    shift  Number of bits in the range [1..31]\r
154     \return               Rotated value\r
155         \r
156  */\r
157 uint32_t __ROR(uint32_t value, uint32_t shift);\r
158 \r
159 \r
160 /**************************************************************************************************/\r
161 /** \brief  LDR Exclusive (8 bit) [not for Cortex-M0, Cortex-M0+, or SC000]\r
162 \r
163     This function executed an exclusive LDR command for 8 bit value [not for Cortex-M0, Cortex-M0+, or SC000].\r
164 \r
165     \param [in]    *addr  Pointer to data\r
166     \return             value of type uint8_t at (*addr)\r
167  */\r
168 uint8_t __LDREXB(volatile uint8_t *addr);\r
169 \r
170 \r
171 /**************************************************************************************************/\r
172 /** \brief  LDR Exclusive (16 bit) [not for Cortex-M0, Cortex-M0+, or SC000]\r
173 \r
174     This function executed an exclusive LDR command for 16 bit values [not for Cortex-M0, Cortex-M0+, or SC000].\r
175 \r
176     \param [in]    *addr  Pointer to data\r
177     \return        value of type uint16_t at (*addr)\r
178  */\r
179 uint16_t __LDREXH(volatile uint16_t *addr);\r
180 \r
181 \r
182 /**************************************************************************************************/\r
183 /** \brief  LDR Exclusive (32 bit) [not for Cortex-M0, Cortex-M0+, or SC000]\r
184 \r
185     This function executed an exclusive LDR command for 32 bit values [not for Cortex-M0, Cortex-M0+, or SC000].\r
186 \r
187     \param [in]    *addr  Pointer to data\r
188     \return        value of type uint32_t at (*addr)\r
189  */\r
190 uint32_t __LDREXW(volatile uint32_t *addr);\r
191 \r
192 \r
193 /**************************************************************************************************/\r
194 /** \brief  STR Exclusive (8 bit) [not for Cortex-M0, Cortex-M0+, or SC000]\r
195 \r
196     This function executed an exclusive STR command for 8 bit values [not for Cortex-M0, Cortex-M0+, or SC000].\r
197 \r
198     \param [in]  value  Value to store\r
199     \param [in]  *addr  Pointer to location\r
200     \return          0  Function succeeded\r
201     \return          1  Function failed\r
202  */\r
203 uint32_t __STREXB(uint8_t value, volatile uint8_t *addr);\r
204 \r
205 \r
206 /**************************************************************************************************/\r
207 /** \brief  STR Exclusive (16 bit) [not for Cortex-M0, Cortex-M0+, or SC000]\r
208 \r
209     This function executed an exclusive STR command for 16 bit values [not for Cortex-M0, Cortex-M0+, or SC000].\r
210 \r
211     \param [in]  value  Value to store\r
212     \param [in]  *addr  Pointer to location\r
213     \return          0  Function succeeded\r
214     \return          1  Function failed\r
215  */\r
216 uint32_t __STREXH(uint16_t value, volatile uint16_t *addr);\r
217 \r
218 \r
219 /**************************************************************************************************/\r
220 /** \brief  STR Exclusive (32 bit)  [not for Cortex-M0, Cortex-M0+, or SC000]\r
221 \r
222     This function executed an exclusive STR command for 32 bit values [not for Cortex-M0, Cortex-M0+, or SC000].\r
223 \r
224     \param [in]  value  Value to store\r
225     \param [in]  *addr  Pointer to location\r
226     \return          0  Function succeeded\r
227     \return          1  Function failed\r
228  */\r
229 uint32_t __STREXW(uint32_t value, volatile uint32_t *addr);\r
230 \r
231 \r
232 /**************************************************************************************************/\r
233 /** \brief  Remove the exclusive lock [not for Cortex-M0, Cortex-M0+, or SC000]\r
234 \r
235     This function removes the exclusive lock which is created by LDREX [not for Cortex-M0, Cortex-M0+, or SC000].\r
236 \r
237  */\r
238 void __CLREX(void);\r
239 \r
240 \r
241 /**************************************************************************************************/\r
242 /** \brief  Signed Saturate [not for Cortex-M0, Cortex-M0+, or SC000]\r
243 \r
244     This function saturates a signed value [not for Cortex-M0, Cortex-M0+, or SC000].\r
245 \r
246     \param [in]  value  Value to be saturated\r
247     \param [in]    sat  Bit position to saturate to [1..32]\r
248     \return             Saturated value\r
249  */\r
250 uint32_t __SSAT(unint32_t value, uint32_t sat);\r
251 \r
252 \r
253 /**************************************************************************************************/\r
254 /** \brief  Unsigned Saturate [not for Cortex-M0, Cortex-M0+, or SC000]\r
255 \r
256     This function saturates an unsigned value [not for Cortex-M0, Cortex-M0+, or SC000].\r
257 \r
258     \param [in]  value  Value to be saturated\r
259     \param [in]    sat  Bit position to saturate to [0..31]\r
260     \return             Saturated value\r
261  */\r
262 uint32_t __USAT(uint32_t value, uint32_t sat);\r
263 \r
264 \r
265 /**************************************************************************************************/\r
266 /** \brief  Count leading zeros [not for Cortex-M0, Cortex-M0+, or SC000]\r
267 \r
268     This function counts the number of leading zeros of a data value [not for Cortex-M0, Cortex-M0+, or SC000].\r
269 \r
270     \param [in]  value  Value to count the leading zeros\r
271     \return             number of leading zeros in value\r
272  */\r
273 uint8_t __CLZ(uint32_t value);\r
274 \r
275 \r
276 /**************************************************************************************************/\r
277 /** \brief  Rotate Right with Extend (32 bit)\r
278 \r
279     This function moves each bit of a bitstring right by one bit. The carry input is shifted in at the left end of the bitstring.\r
280 \r
281     \param [in]    value  Value to rotate\r
282     \return               Rotated value\r
283  */\r
284 uint32_t __RRX(uint32_t value);\r
285 \r
286 \r
287 /**************************************************************************************************/\r
288 /** \brief  LDRT Unprivileged (8 bit)\r
289 \r
290     This function executed an Unprivileged LDRT command for 8 bit value.\r
291 \r
292     \param [in]    ptr  Pointer to data\r
293     \return             value of type uint8_t at (*ptr)\r
294  */\r
295 uint8_t  __LDRBT(uint8_t ptr);\r
296 \r
297 \r
298 /**************************************************************************************************/\r
299 /** \brief  LDRT Unprivileged (16 bit)\r
300 \r
301     This function executed an Unprivileged LDRT command for 16 bit values.\r
302 \r
303     \param [in]    ptr  Pointer to data\r
304     \return        value of type uint16_t at (*ptr)\r
305  */\r
306 uint16_t  __LDRHT(uint16_t ptr);\r
307 \r
308 \r
309 /**************************************************************************************************/\r
310 /** \brief  LDRT Unprivileged (32 bit)\r
311 \r
312     This function executed an Unprivileged LDRT command for 32 bit values.\r
313 \r
314     \param [in]    ptr  Pointer to data\r
315     \return        value of type uint32_t at (*ptr)\r
316  */\r
317 uint32_t  __LDRT(uint32_t ptr);\r
318 \r
319 \r
320 /**************************************************************************************************/\r
321 /** \brief  STRT Unprivileged (8 bit)\r
322 \r
323     This function executed an Unprivileged STRT command for 8 bit values.\r
324 \r
325     \param [in]  value  Value to store\r
326     \param [in]    ptr  Pointer to location\r
327  */\r
328 void __STRBT(uint8_t value, uint8_t ptr);\r
329 \r
330 \r
331 /**************************************************************************************************/\r
332 /** \brief  STRT Unprivileged (16 bit)\r
333 \r
334     This function executed an Unprivileged STRT command for 16 bit values.\r
335 \r
336     \param [in]  value  Value to store\r
337     \param [in]    ptr  Pointer to location\r
338  */\r
339 void __STRHT(uint16_t value, uint16_t ptr);\r
340 \r
341 \r
342 /**************************************************************************************************/\r
343 /** \brief  STRT Unprivileged (32 bit)\r
344 \r
345     This function executed an Unprivileged STRT command for 32 bit values.\r
346 \r
347     \param [in]  value  Value to store\r
348     \param [in]    ptr  Pointer to location\r
349  */\r
350 void __STRT(uint32_t value, uint32_t ptr);\r
351 \r
352 \r
353 \r
354 /**\r
355   \brief   Load-Acquire (8 bit)\r
356   \details Executes a LDAB instruction for 8 bit value.\r
357   \param [in]    ptr  Pointer to data\r
358   \return             value of type uint8_t at (*ptr)\r
359   \note    Only availabe for ARMv8-M Architecture. \r
360  */\r
361 uint8_t __LDAB(volatile uint8_t *ptr);\r
362 \r
363 /**\r
364   \brief   Load-Acquire (16 bit)\r
365   \details Executes a LDAH instruction for 16 bit values.\r
366   \param [in]    ptr  Pointer to data\r
367   \return        value of type uint16_t at (*ptr)\r
368   \note    Only availabe for ARMv8-M Architecture. \r
369  */\r
370 uint16_t __LDAH(volatile uint16_t *ptr);\r
371 \r
372 /**\r
373   \brief   Load-Acquire (32 bit)\r
374   \details Executes a LDA instruction for 32 bit values.\r
375   \param [in]    ptr  Pointer to data\r
376   \return        value of type uint32_t at (*ptr)\r
377   \note    Only availabe for ARMv8-M Architecture. \r
378  */\r
379 uint32_t __LDA(volatile uint32_t *ptr);\r
380 \r
381 /**\r
382   \brief   Store-Release (8 bit)\r
383   \details Executes a STLB instruction for 8 bit values.\r
384   \param [in]  value  Value to store\r
385   \param [in]    ptr  Pointer to location\r
386   \note    Only availabe for ARMv8-M Architecture. \r
387  */\r
388 void __STLB(uint8_t value, volatile uint8_t *ptr);\r
389 \r
390 /**\r
391   \brief   Store-Release (16 bit)\r
392   \details Executes a STLH instruction for 16 bit values.\r
393   \param [in]  value  Value to store\r
394   \param [in]    ptr  Pointer to location\r
395   \note    Only availabe for ARMv8-M Architecture. \r
396  */\r
397 void __STLH(uint16_t value, volatile uint16_t *ptr);\r
398 \r
399 /**\r
400   \brief   Store-Release (32 bit)\r
401   \details Executes a STL instruction for 32 bit values.\r
402   \param [in]  value  Value to store\r
403   \param [in]    ptr  Pointer to location\r
404   \note    Only availabe for ARMv8-M Architecture. \r
405  */\r
406 void __STL(uint32_t value, volatile uint32_t *ptr);\r
407 \r
408 /**\r
409   \brief   Load-Acquire Exclusive (8 bit)\r
410   \details Executes a LDAB exclusive instruction for 8 bit value.\r
411   \param [in]    ptr  Pointer to data\r
412   \return             value of type uint8_t at (*ptr)\r
413   \note    Only availabe for ARMv8-M Architecture. \r
414  */\r
415 uint8_t __LDAEXB(volatile uint32_t *ptr);\r
416 \r
417 /**\r
418   \brief   Load-Acquire Exclusive (16 bit)\r
419   \details Executes a LDAH exclusive instruction for 16 bit values.\r
420   \param [in]    ptr  Pointer to data\r
421   \return        value of type uint16_t at (*ptr)\r
422   \note    Only availabe for ARMv8-M Architecture. \r
423  */\r
424 uint16_t __LDAEXH(volatile uint32_t *ptr);\r
425 \r
426 /**\r
427   \brief   Load-Acquire Exclusive (32 bit)\r
428   \details Executes a LDA exclusive instruction for 32 bit values.\r
429   \param [in]    ptr  Pointer to data\r
430   \return        value of type uint32_t at (*ptr)\r
431   \note    Only availabe for ARMv8-M Architecture. \r
432  */\r
433 uint32_t __LDAEX(volatile uint32_t *ptr);\r
434 \r
435 /**\r
436   \brief   Store-Release Exclusive (8 bit)\r
437   \details Executes a STLB exclusive instruction for 8 bit values.\r
438   \param [in]  value  Value to store\r
439   \param [in]    ptr  Pointer to location\r
440   \return          0  Function succeeded\r
441   \return          1  Function failed\r
442   \note    Only availabe for ARMv8-M Architecture. \r
443  */\r
444 uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr);\r
445 \r
446 /**\r
447   \brief   Store-Release Exclusive (16 bit)\r
448   \details Executes a STLH exclusive instruction for 16 bit values.\r
449   \param [in]  value  Value to store\r
450   \param [in]    ptr  Pointer to location\r
451   \return          0  Function succeeded\r
452   \return          1  Function failed\r
453   \note    Only availabe for ARMv8-M Architecture. \r
454  */\r
455 uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr);\r
456 \r
457 /**\r
458   \brief   Store-Release Exclusive (32 bit)\r
459   \details Executes a STL exclusive instruction for 32 bit values.\r
460   \param [in]  value  Value to store\r
461   \param [in]    ptr  Pointer to location\r
462   \return          0  Function succeeded\r
463   \return          1  Function failed\r
464   \note    Only availabe for ARMv8-M Architecture. \r
465  */\r
466 uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr);\r
467 \r
468 \r
469 /*@}*/ /* end of group Intrisic_CPU */\r
470 \r
471 \r