Open utterances-bot opened 7 months ago
Typo
inline State state() const { return static_cast<State>(m_bits.busy); }
should read as
inline State state() const { return static_cast<State>(m_bits.state); }
shouldn't uint32_t status_reg_mem;
be initialized by a proper VMA value before delegating it into the register class composition?
Typo
inline State state() const { return static_cast<State>(m_bits.busy); }
should read asinline State state() const { return static_cast<State>(m_bits.state); }
Thanks! I fixed the typo.
shouldn't
uint32_t status_reg_mem;
be initialized by a proper VMA value before delegating it into the register class composition?
Yes, that is correct. I was attempting to exemplify how to use the class without getting into consideration about whether the underlying memory modified by it is an actual register or not, but you are correct, in this case it would simply be writing a local variable in the stack. To avoid confusions I modified this snipped so that the function takes the status register as an argument directly.
Bare Metal C++ Register Access API - AllThingsEmbedded
Introduction to memory-mapping Note: This section is introductory material for those who are not yet familiar with the concept of memory-mapping. If you are already experienced with memory-mapping feel free to jump to the next section. Most likely you won’t miss anything new. One of the most common ways of accessing peripherals from a CPU is memory-mapping. In short, this means that the address space of the CPU has some addresses that when accessed read/write peripheral’s registers.
https://allthingsembedded.com/post/bare-metal-register-access-api/