- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am still learning about the Cortex architecture after many years using 8 bitters; apologies if this is too simple....
Is there a way to store the global interrupt enable status prior to entering a critical code section?
For example, in AVR, you can preserve the global interrupt state with, instead of a naive cli(); sei();
uint8_t sreg = SREG; //preseve global mask state
cli(); //disable global interrupts
//do something critical
SREG = sreg; //restore global state
How is this done w/ PSOC 6?
Thanks in advance...
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Scott,
In PSoC 6 this is accomplished using Cy_SysLib_EnterCriticalSection and Cy_SysLib_ExitCriticalSection APIs. The flow is below -
/* Preserve global mask state and enter critical section */
uint32_t interruptState = Cy_SysLib_EnterCriticalSection();
/* do something critical */
/* Restore global state */
Cy_SysLib_ExitCriticalSection(interruptState);
Let me know if this helps.
Regards,
Meenakshi Sundaram R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Scott,
In PSoC 6 this is accomplished using Cy_SysLib_EnterCriticalSection and Cy_SysLib_ExitCriticalSection APIs. The flow is below -
/* Preserve global mask state and enter critical section */
uint32_t interruptState = Cy_SysLib_EnterCriticalSection();
/* do something critical */
/* Restore global state */
Cy_SysLib_ExitCriticalSection(interruptState);
Let me know if this helps.
Regards,
Meenakshi Sundaram R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you!