- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can read/write the core special function registers with their respective offset address of registers for a given core using the instruction mfcr/mtcr.
But how I can read/write a core special function register from other core ?
The scenario is here that a piece of code is executing in core1 and for a particular scenario this piece of code needs to read the core register values for current core and other core such as core 0 & core 2.
How I can achieve this with the instruction mfcr ?
Thanks in advance for your support.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
You cannot not use the instructions mfcr/mtcr to access the CSFR registers of a different core. You need to use load and store instructions to access the CSFRs of another core. For the same core, you must use mfcr/mtcr instructions.
For ex if you want to access DATR registers of all cores from CPU-0 then you may consider implementing one of the following approaches:
volatile uint32 g_datrRegValCore0, g_datrRegValCore1, g_datrRegValCore2;
g_datrRegValCore0 = __mfcr(CPU_DATR);
g_datrRegValCore1 = CPU1_DATR.U;
g_datrRegValCore2 = CPU2_DATR.U;
(OR)
If your function is called by multiple cores, use GetCoreId function first and based on Core implement a switch case where for each core you update the above variables using mfcr/mtcr instructions.
Please see section "3.12 Accessing Core Special Function Registers (CSFRs)" in the Vol_1 and section "2.12.3 Access to the Core Special Function Registers (CSFRs)" and the usage of mfcr/mtcr in the Vol_2.
Regards,
Prudhvi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
You cannot not use the instructions mfcr/mtcr to access the CSFR registers of a different core. You need to use load and store instructions to access the CSFRs of another core. For the same core, you must use mfcr/mtcr instructions.
For ex if you want to access DATR registers of all cores from CPU-0 then you may consider implementing one of the following approaches:
volatile uint32 g_datrRegValCore0, g_datrRegValCore1, g_datrRegValCore2;
g_datrRegValCore0 = __mfcr(CPU_DATR);
g_datrRegValCore1 = CPU1_DATR.U;
g_datrRegValCore2 = CPU2_DATR.U;
(OR)
If your function is called by multiple cores, use GetCoreId function first and based on Core implement a switch case where for each core you update the above variables using mfcr/mtcr instructions.
Please see section "3.12 Accessing Core Special Function Registers (CSFRs)" in the Vol_1 and section "2.12.3 Access to the Core Special Function Registers (CSFRs)" and the usage of mfcr/mtcr in the Vol_2.
Regards,
Prudhvi.