mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
mtd_flashpage: only depend on periph_flashpage
The features in flashpage_raw are now default in flashpage and do not have to be included as a separate dependency
This commit is contained in:
parent
1c063a74ea
commit
3aa5203bc5
@ -1,2 +1,2 @@
|
|||||||
FEATURES_REQUIRED += periph_flashpage
|
FEATURES_REQUIRED += periph_flashpage
|
||||||
FEATURES_REQUIRED += periph_flashpage_raw
|
FEATURES_REQUIRED += periph_flashpage_pagewise
|
||||||
|
@ -42,7 +42,7 @@ static int _read(mtd_dev_t *dev, void *buf, uint32_t addr, uint32_t size)
|
|||||||
|
|
||||||
(void)dev;
|
(void)dev;
|
||||||
|
|
||||||
if (addr % FLASHPAGE_RAW_ALIGNMENT) {
|
if (addr % FLASHPAGE_WRITE_BLOCK_ALIGNMENT) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,13 +61,13 @@ static int _write(mtd_dev_t *dev, const void *buf, uint32_t addr, uint32_t size)
|
|||||||
{
|
{
|
||||||
(void)dev;
|
(void)dev;
|
||||||
|
|
||||||
if (addr % FLASHPAGE_RAW_ALIGNMENT) {
|
if (addr % FLASHPAGE_WRITE_BLOCK_ALIGNMENT) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if ((uintptr_t)buf % FLASHPAGE_RAW_ALIGNMENT) {
|
if ((uintptr_t)buf % FLASHPAGE_WRITE_BLOCK_ALIGNMENT) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (size % FLASHPAGE_RAW_BLOCKSIZE) {
|
if (size % FLASHPAGE_WRITE_BLOCK_SIZE) {
|
||||||
return -EOVERFLOW;
|
return -EOVERFLOW;
|
||||||
}
|
}
|
||||||
if (addr + size > MTD_FLASHPAGE_END_ADDR) {
|
if (addr + size > MTD_FLASHPAGE_END_ADDR) {
|
||||||
@ -80,7 +80,7 @@ static int _write(mtd_dev_t *dev, const void *buf, uint32_t addr, uint32_t size)
|
|||||||
uint32_t dst_addr = addr;
|
uint32_t dst_addr = addr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
flashpage_write_raw((void *)dst_addr, buf, size);
|
flashpage_write((void *)dst_addr, buf, size);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ int _erase(mtd_dev_t *dev, uint32_t addr, uint32_t size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (size_t i = 0; i < size; i += sector_size) {
|
for (size_t i = 0; i < size; i += sector_size) {
|
||||||
flashpage_write(flashpage_page((void *)(dst_addr + i)), NULL);
|
flashpage_erase(flashpage_page((void *)(dst_addr + i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -122,7 +122,8 @@ static void test_mtd_write_erase(void)
|
|||||||
|
|
||||||
static void test_mtd_write_read(void)
|
static void test_mtd_write_read(void)
|
||||||
{
|
{
|
||||||
const char buf[] __attribute__ ((aligned (FLASHPAGE_RAW_ALIGNMENT))) = "ABCDEFGHIJKLMNO";
|
const char buf[] __attribute__ ((aligned (FLASHPAGE_WRITE_BLOCK_ALIGNMENT)))
|
||||||
|
= "ABCDEFGHIJKLMNO";
|
||||||
|
|
||||||
/* stm32l0x and stm32l1x erase its flash with 0's */
|
/* stm32l0x and stm32l1x erase its flash with 0's */
|
||||||
#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
|
#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
|
||||||
|
Loading…
Reference in New Issue
Block a user