periph_flashpage: Make pagewise API optional#15412
Conversation
|
When I see the |
samr21-xpro (sam0) OKopenmote-b (cc2538) OKdwm1001 (nrf5x) OKnucleo-l152re (stm32) OKfrdm-kw41z (kinetis) OKz1 (msp430) OK (with patch) |
I fully agree! Anything against this? I can do the rename tomorrow during the sprint day. |
Only thing I see is that it would be a massive api change: I think that all functions in the API and files, and includes would have to be renamed as well ( |
I already had to rename all functions because of the |
5d25f04 to
63c39fd
Compare
|
rebased to exclude the commit from #15410 |
Decided offline to postpone this to a future PR. |
Rebased! |
benpicco
left a comment
There was a problem hiding this comment.
looks good, mostly mechanical translations
cpu/nrf52/include/cpu_conf.h
Outdated
| * block is always FLASHPAGE_SIZE. | ||
| */ | ||
| #define FLASHPAGE_RAW_BLOCKSIZE (4U) | ||
| #define FLASHPAGE_BLOCK_SIZE (4U) |
There was a problem hiding this comment.
Since you are doing a rename anyway, how about calling this FLASHPAGE_WRITE_BLOCK_SIZE
cpu/cc2538/periph/flashpage.c
Outdated
| flashpage_write_raw(page_addr, data, FLASHPAGE_SIZE); | ||
| flashpage_write(page_addr, data, FLASHPAGE_SIZE); | ||
| } | ||
| } |
There was a problem hiding this comment.
We can now have a generic flashpage_write_page() implementation in drivers/periph_common/flashpage.c
void flashpage_write_page(unsigned page, const void *data)
{
assert((unsigned) page < FLASHPAGE_NUMOF);
flashpage_erase(page);
/* write page */
if (data != NULL) {
flashpage_write(flashpage_addr(page), data, FLASHPAGE_SIZE);
}
}There was a problem hiding this comment.
Good idea. I can add this here (or in a follow up) and guard it to only include it when FLASHPAGE_SIZE is available (it is not available on the stm32f{2,4,7}) and allow CPU implementations to override it if they have an optimized version available.
|
Please squash! |
257a4f2 to
f4dda1a
Compare
Squashed! |
benpicco
left a comment
There was a problem hiding this comment.
looks good to me.
I check all the patches and there are only mechanical changes / renames.
flashpage currently requires pagewise implementation with an optional extension for per block writes (flashpage_raw). Most implementations with flashpage_raw implement the pagewise access via the flashpage_raw functions. This commit makes the flashpage raw the main access method and adds an extension feature for the pagewise access. The functions and defines are renamed to reflect this. The API is also extended with a dedicated function for erasing a sector.
395198d to
411c690
Compare
The features in flashpage_raw are now default in flashpage and do not have to be included as a separate dependency
411c690 to
7222239
Compare
|
Thanks for reviewing! |
|
So can we drop all the |
Contribution description
flashpage currently requires pagewise implementation with an optional
extension for per block writes (flashpage_raw). Most implementations
with flashpage_raw implement the pagewise access via the flashpage_raw
functions. This commit makes the flashpage raw the main access method
and adds an extension feature for the pagewise access.
The functions and defines are renamed to reflect this. The API is also
extended with a dedicated function for erasing a sector.
Testing procedure
Preferably every CPU family should be tested with
tests/periph_flashpageIssues/PRs references
Depends on #15410