lynaghk / svd2zig

Generate Zig API from SVD register definitions.
MIT License
36 stars 2 forks source link

Expose bit-banded register access #4

Open simonschmidt opened 3 years ago

simonschmidt commented 3 years ago

Some arm processors expose bit-banding to read/write bits of peripheral registers. This provides more efficient access when reading/writing a single bit in a register

It would be convenient to expose the bit-banding in the register structs generated by svd2zig, I made an example in #3

However it would add some more complexity, especially since this information is not available in the SVD files, so it could easily be argued that this is out of scope for svd2zig, and is perhaps something that would be better to add manually to supported platforms after generating the .zig file.

Anyway, I figured I'd raise the topic for discussion here

lynaghk commented 3 years ago

Feels out of scope for this library since the info isn't in the SVD files. Do the Rust folks expose any of this in their SVD patches? https://github.com/stm32-rs/stm32-rs/tree/master/devices

That said I don't have any experience with bit-banding so may not be able to really discuss it in depth --- but feel free to do so if you have ideas and think others running across this repo would be interested to participate in a discussion here.