-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/sam0_common: avoid bitfield usage #20747
cpu/sam0_common: avoid bitfield usage #20747
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are a lot of 1 rmw to 2 rmw cases.
some might need a temporary, can probably be some thing like
REG = (REG & ~Msk) | ((val << Pos) &Msk);
there might be a macro for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not merge until the doubling of the rmws is fixed
@kfessel I've pushed my fixup commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
mostly good
do { | ||
cmd = ((dev(tim)->CTRLBSET.reg & TC_CTRLBSET_CMD_Msk) >> TC_CTRLBSET_CMD_Pos); | ||
} while(cmd == TC_CTRLBSET_CMD_READSYNC_Val); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be faster but please ignore unless someone objdumped
do { | |
cmd = ((dev(tim)->CTRLBSET.reg & TC_CTRLBSET_CMD_Msk) >> TC_CTRLBSET_CMD_Pos); | |
} while(cmd == TC_CTRLBSET_CMD_READSYNC_Val); | |
do { | |
cmd = ((dev(tim)->CTRLBSET.reg & TC_CTRLBSET_CMD_Msk)); | |
} while(cmd == TC_CTRLBSET_CMD_READSYNC_Val << TC_CTRLBSET_CMD_Pos); | |
@kfessel A new round of fixups has been pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it getting fewer
btw i'd like to ask: if you are doing tests?
uint32_t ctrlc = dev->CTRLC.reg; | ||
dev->CTRLC.reg = ((ctrlc & ~ADC_CTRLC_RESSEL_Msk) | ADC_CTRLC_RESSEL(res)); | ||
#else | ||
/* Reset resolution bits in CTRLB */ | ||
dev->CTRLB.bit.RESSEL = res & 0x3; | ||
uint32_t ctrlb = dev->CTRLB.reg; | ||
dev->CTRLB.reg = ((ctrlb & ~ADC_CTRLB_RESSEL_Msk) | ADC_CTRLB_RESSEL(res)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function is called configure but does not configure all the bits (and nothing else in this file does) this seem to me like bad code translated well.
you might ignore this comment your translation mimics the old behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks fine testing?
I don't have hardware with me right now. I'll re-run tests on hardware this weekend if I manage to get some time. |
I've run basics tests (timers, RTC, I2C, SPI, UART, USB, PWM) on |
thanks for testing; please squash |
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
fa40dc1
to
f32f08a
Compare
Squashed ! |
f32f08a
to
f1116f2
Compare
Fixed a typo in the UART driver spotted by Murdock. |
All green ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
translation looks correct,
For the test i trust @dylad.
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
f1116f2
to
ccc155e
Compare
Murdock spotted an inconsistency in PWM driver for SAMD20. That should be good now. |
Thanks ! |
Contribution description
This PR removes all bitfields usage from
cpu/sam0_common/
folder.I decided to go with a commit per file to allow an easy revert in case something got terribly wrong. Nevertheless, CI should catch most of the issues early. However, I might get sleepy here and there so please, take a careful eyes at this.
/!\ Breakages are highly probable here /!\
Testing procedure
Triple careful review and CI should save us hopefully.
Issues/PRs references
#20457