Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sub-registers #22

Merged
merged 7 commits into from
Sep 11, 2018
Merged

Add support for sub-registers #22

merged 7 commits into from
Sep 11, 2018

Conversation

hannobraun
Copy link
Contributor

Adds support for sub-registers (registers that can only be accessed with a sub-index) by extending the register definition macro syntax and updating all code that touches headers to support any header size.

This pull request only contains changes to infrastructure, but I have local code (coming soon) that adds support for sub-registers and tests that all of this actually work.

Currently, we only address whole registers, with no sub-indices.
Therefore headers are always one byte long, and `make_header` could just
return that byte.

I'm currently working on support for the sub-registers that can only be
addressed using sub-indices. For that I need to make `make_header` more
flexible.
This is the only of the three access methods that needs to care about
header length. Both `write` and `modify` use buffers that are provided
by the `R`/`W` types and rely on those types to not mess up the buffer
management.
I'm about to add more information to the register definition, which adds
more characters to the line. I don't have space for those, if the
comments stay where they were before this commit (comments would have
spilled into the next line).

So yeah, my dream of keeping those comments lined up forever has
officially died.
Currently, the sub-index is `0x00` for all defined registers, and the
code only supports this value. The next steps will make the code more
flexible, until registers with a real sub-index can be added.
I think this leaves only `init_header` as the last piece of code that
assumes an hard-coded header length of `1`.
This is the last change required to fully support sub-indices.
@hannobraun hannobraun merged commit 3261cda into jkelleyrtp:master Sep 11, 2018
@hannobraun hannobraun deleted the sub-registers branch September 11, 2018 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant