|
Embedded Artistry Framework
Embedded Systems C++ Framework
|
These functions promote safer loading and storing of volatile values. More...
|
Functions | |
| template<typename TType > | |
| constexpr TType | embutil::volatile_load (const TType *target) noexcept |
| Read from a volatile variable. More... | |
| template<typename TType > | |
| constexpr TType | embutil::volatile_load (volatile const TType *target) noexcept |
| Read from a volatile memory location. More... | |
| template<typename TType > | |
| void | embutil::volatile_store (TType *target, TType value) noexcept |
| Write to a volatile variable. More... | |
| template<typename TType > | |
| void | embutil::volatile_store (volatile TType *target, TType value) noexcept |
| Write to a volatile memory location. More... | |
These functions promote safer loading and storing of volatile values.
To quote Odin Holmes:
There is a scary amount of bare metal devs who think
volatilemeans atomic, because sometimes it happens to mean that on primitive cores.
Instead we must use volatile_load() and volatile_store() to ensure the operations are probably atomic:
What are some goals for an implementation of volatile_load() and volatile_store()?
atomic_thread_fence.
|
inlinenoexcept |
Read from a volatile variable.
| TType | the type of the variable. This will be deduced by the compiler. |
| target | The pointer to the volatile variable to read from. |
References assert.
Referenced by check_event_(), clear_event_(), disable_shortcuts_(), get_errorsrc_(), get_rxd_amount_(), and get_txd_amount_().
|
inlinenoexcept |
Read from a volatile memory location.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References assert.
|
inlinenoexcept |
Write to a volatile variable.
Causes the value of *target to be overwritten with value.
| TType | the type of the variable. This will be deduced by the compiler. |
| target | The pointer to the volatile variable to update. |
| value | The new value for the volatile variable. |
References assert.
Referenced by nRFGPIOTranslator::clear(), clear_event_(), configure(), nRFTWITranslator::disable(), nRFTWIMTranslator::disable(), disable_shortcuts_(), nRFTWITranslator::enable(), nRFTWIMTranslator::enable(), get_errorsrc_(), interrupts_disable_(), interrupts_enable_(), rx_list_disable_(), rx_list_enable_(), nRFGPIOTranslator::set(), set_rx_buffer_(), set_shortcuts_(), nRFTWITranslator::set_transfer_address(), nRFTWIMTranslator::set_transfer_address(), set_tx_buffer_(), nRFTWITranslator::setFrequency(), nRFTWIMTranslator::setFrequency(), nRFTWITranslator::setSCLPin(), nRFTWIMTranslator::setSCLPin(), nRFTWITranslator::setSDAPin(), nRFTWIMTranslator::setSDAPin(), task_trigger_(), tx_list_disable_(), and tx_list_enable_().
|
inlinenoexcept |
Write to a volatile memory location.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References assert.
1.8.15