cpu/sam0_common: avoid bitfield usage#20747
Conversation
kfessel
left a comment
There was a problem hiding this comment.
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
kfessel
left a comment
There was a problem hiding this comment.
Please do not merge until the doubling of the rmws is fixed
|
@kfessel I've pushed my fixup commits. |
| 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.
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. |
kfessel
left a comment
There was a problem hiding this comment.
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.
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
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 <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
fa40dc1 to
f32f08a
Compare
|
Squashed ! |
f32f08a to
f1116f2
Compare
|
Fixed a typo in the UART driver spotted by Murdock. |
|
All green ! |
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
Signed-off-by: Dylan Laduranty <[email protected]>
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