Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User17612
Level 4
Level 4
First like received
Hi all,

I want to assign a user level to a task (function) how do I read and write to CPU registers like the PSW.

Kind regards,
Lucas

#8042000 20422
0 Likes
1 Reply
User18237
Level 5
Level 5
First solution authored First like received
Hi Lucas,

Core Special Function registers are read with a MFCR (Move From Core Register) instruction and written with a MTCR (Move To Core register) instruction.
Compiler support this instruction with an intrinsic function:
1. volatile int _mfcr( int _csfr );
Move contents of the addressed Core Special Function Register (CSFR) into a data register

2. volatile void _mtcr ( int _csfr, int val );
Move contents of a data register (second int) to the addressed CSFR (first int) and generate an ISYNC instruction. The ISYNC instruction ensures that the effects of the CSFR update are correctly seen by all following instructions.

Best regards,
Mr. AURIX™
0 Likes