Commit Graph

7 Commits (3847373660d0cee49404fe8e5e7fb644581400cb)

Author SHA1 Message Date
Kevin Bracey 70af016348 critical sections: remove unnecessary volatile
Critical section count/state variables are synchronised by IRQ disabling and
critical section calls themselves, so do not need to be volatile.

This eliminates a couple of unnecessary reads of the counter variable.
2019-01-03 11:06:44 +02:00
Martin Kojtal 406f9508d3 hal: add spdx license 2018-11-28 10:39:51 +00:00
Oren Cohen 787317b7eb Remove uVisor from mbed-os 2018-08-22 16:36:59 +03:00
Steven Cartmell 061795c489 Move in_critical_section implementation into the HAL
- Add function to HAL hal_in_critical_section()
- Wrap assert in FEATURE_UVISOR macro
2018-01-09 10:41:29 +00:00
Steven Cartmell e14bee5209 Fix potential race condition in critical section HAL API
Call underlying HAL implementation to enter critical section/disable interrupts
before incrementing the global critical section counter.

Modify HAL implementations to track first entrances to the critical section and
only update the saved state on first enter.
2018-01-05 14:55:58 +00:00
Steven Cartmell 84391f0b64 Remove invalid assert and move uVisor warning to correct function 2018-01-05 14:55:57 +00:00
Steven Cartmell 07a394ee8b Add Critical Section HAL API specification
- Define header functions for Critical Section HAL API
  - hal_critical_section_enter()
  - hal_critical_section_exit()

- Add weak default implementation for HAL API. The default implementation
  matches the previous behaviour stored in mbed_critical:
  - The first call to enter a critical section stores the state of interrupts
    before disabling and each successive call re-disables interrupts.
  - The last call (non-nested) will restore the IRQ state that was set on the
    enter to the critical section. Nested calls are ignored.

- Add function 'core_util_in_critical_section' to User facing API to determine
  if the program is currently in a critical section, instead of depending on
  'core_util_interrupts_enabled'.
2018-01-05 14:53:51 +00:00