mirror of
https://github.com/apache/nuttx.git
synced 2026-09-23 16:22:23 +08:00
arch/tricore: add tricore_mtcr and tricore_mfcr macros
Add tricore_mtcr()/tricore_mfcr() inline-assembly wrappers for the MTCR/MFCR (move to/from Core Special Function Register) instructions. These let arch/tricore code access CSRs directly without relying on the Infineon iLLD intrinsics, and are used by the following iLLD-removal change in the performance-counter path. Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
This commit is contained in:
@@ -42,6 +42,20 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* MTCR and MFCR - move to / from Core Special Function Register */
|
||||
|
||||
#define tricore_mtcr(reg, val) \
|
||||
({ \
|
||||
__asm__ volatile ("mtcr %0,%1\n\t"::"i"(reg),"d"(val):"memory"); \
|
||||
})
|
||||
|
||||
#define tricore_mfcr(reg) \
|
||||
({ \
|
||||
uint32_t __val; \
|
||||
__asm__ volatile ("mfcr %0,%1": "=d" (__val) :"i"(reg): "memory"); \
|
||||
__val; \
|
||||
})
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user