Change psw io bit from context save area in tc39x aurix infineon

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

cross mob
indra
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

Hi, I want to switch to user mode in tc39x. I tried to change the IO bit of psw register but it always setting the interrupt stack control bit(IS) bit. I even tried to change it through an isr in this case the register value isn't changing at all(the isr executes other instructions like toggling gpr value). One reply I got is to change the register value through upper context save area but at that memory location I cant find the psw values. I dont know if I am seeing it correct or wrong . What should I do?

0 Likes
1 Solution
Jeremy_Z
Moderator
Moderator
Moderator
1000 replies posted 250 sign-ins 100 likes received

Hi @indra ,

/* CSA Manipulation. */
#define portCSA_TO_ADDRESS( pCSA )			( ( uint32_t * )( ( ( ( pCSA ) & 0x000F0000 ) << 12 ) | ( ( ( pCSA ) & 0x0000FFFF ) << 6 ) ) )
#define portADDRESS_TO_CSA( pAddress )		( ( uint32_t )( ( ( ( (uint32_t)( pAddress ) ) & 0xF0000000 ) >> 12 ) | ( ( ( uint32_t )( pAddress ) & 0x003FFFC0 ) >> 6 ) ) )


BR,
Jeremy

View solution in original post

0 Likes
3 Replies
Jeremy_Z
Moderator
Moderator
Moderator
1000 replies posted 250 sign-ins 100 likes received

Hi @indra ,

When an interrupt happens and enters the ISR function, you can try below function to set the PSW in the upper context.

uppercase = _mfcr( CPU_PCI ); //Get the value of the PCI register

pxUpperCSA = portCSA_TO_ADDRESS( uppercase ); //Convert PCXS and PCXO fields in PCXI to CSA addresses pointed by PCX


pxUpperCSA[ 1 ] = pxUpperCSA[ 1 ] & 0xfffff3ffU;   //Set PSW.IO =0

Then exit the ISR function.

BR,

Jeremy

0 Likes
indra
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

Hi @Jeremy_Z 

Can you define pxUpperCSA and portCSA to address

BR,

Indra

 

0 Likes
Jeremy_Z
Moderator
Moderator
Moderator
1000 replies posted 250 sign-ins 100 likes received

Hi @indra ,

/* CSA Manipulation. */
#define portCSA_TO_ADDRESS( pCSA )			( ( uint32_t * )( ( ( ( pCSA ) & 0x000F0000 ) << 12 ) | ( ( ( pCSA ) & 0x0000FFFF ) << 6 ) ) )
#define portADDRESS_TO_CSA( pAddress )		( ( uint32_t )( ( ( ( (uint32_t)( pAddress ) ) & 0xF0000000 ) >> 12 ) | ( ( ( uint32_t )( pAddress ) & 0x003FFFC0 ) >> 6 ) ) )


BR,
Jeremy

0 Likes