File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 77#include < nanoPAL_events.h>
88// #include <stdbool.h>
99
10- volatile uint32_t systemEvents;
10+ static uint32_t systemEvents;
1111
1212set_Event_Callback g_Event_Callback = NULL ;
1313void *g_Event_Callback_Arg = NULL ;
@@ -47,20 +47,20 @@ __nfweak uint32_t Events_Get(uint32_t eventsOfInterest)
4747{
4848 NATIVE_PROFILE_PAL_EVENTS ();
4949
50+ // ... clear the requested flags atomically
51+ // give the caller notice of just the events they asked for ( and were cleared already )
52+ #ifdef __CM0_CMSIS_VERSION
5053 // get the requested flags from system events state and...
5154 uint32_t returnEvents = (systemEvents & eventsOfInterest);
5255
53- // ... clear the requested flags atomically
54- #ifdef __CM0_CMSIS_VERSION
5556 GLOBAL_LOCK ();
5657 systemEvents &= ~eventsOfInterest;
5758 GLOBAL_UNLOCK ();
58- #else
59- __atomic_fetch_nand (&systemEvents, eventsOfInterest, __ATOMIC_RELAXED);
60- #endif
6159
62- // give the caller notice of just the events they asked for ( and were cleared already )
6360 return returnEvents;
61+ #else
62+ return __atomic_fetch_and (&systemEvents, ~eventsOfInterest, __ATOMIC_RELAXED) & eventsOfInterest;
63+ #endif
6464}
6565
6666__nfweak uint32_t Events_MaskedRead (uint32_t eventsOfInterest)
You can’t perform that action at this time.
0 commit comments