Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bsp/allwinner/d1s/ports/fal/fal_norflash_sfud_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include <sfud.h>

static int init(void);
static int read(long offset, uint8_t *buf, size_t size);
static int write(long offset, const uint8_t *buf, size_t size);
static int erase(long offset, size_t size);
static int read(long offset, rt_uint8_t *buf, rt_size_t size);
static int write(long offset, const rt_uint8_t *buf, rt_size_t size);
static int erase(long offset, rt_size_t size);

extern sfud_flash sfud_norflash0;
struct fal_flash_dev nor_flash0 =
Expand All @@ -30,13 +30,13 @@ struct fal_flash_dev nor_flash0 =
{init, read, write, erase}
};

static int read(long offset, uint8_t *buf, size_t size)
static int read(long offset, rt_uint8_t *buf, rt_size_t size)
{
sfud_read(&sfud_norflash0, nor_flash0.addr + offset, size, buf);
return size;
}

static int write(long offset, const uint8_t *buf, size_t size)
static int write(long offset, const rt_uint8_t *buf, rt_size_t size)
{
if (sfud_write(&sfud_norflash0, nor_flash0.addr + offset, size, buf) != SFUD_SUCCESS)
{
Expand All @@ -46,7 +46,7 @@ static int write(long offset, const uint8_t *buf, size_t size)
return size;
}

static int erase(long offset, size_t size)
static int erase(long offset, rt_size_t size)
{
if (sfud_erase(&sfud_norflash0, nor_flash0.addr + offset, size) != SFUD_SUCCESS)
{
Expand Down
18 changes: 9 additions & 9 deletions bsp/allwinner/d1s/ports/fal/fal_sd_sfud_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
rt_device_t sd_dev;
#define SECTOR_SIZE 512
static int init(void);
static int read(long offset, uint8_t *buf, size_t size);
static int write(long offset, const uint8_t *buf, size_t size);
static int erase(long offset, size_t size);
static int read(long offset, rt_uint8_t *buf, rt_size_t size);
static int write(long offset, const rt_uint8_t *buf, rt_size_t size);
static int erase(long offset, rt_size_t size);

struct fal_flash_dev sd_card = {
"sdcard0", /* name string match yml file */
Expand All @@ -31,13 +31,13 @@ struct fal_flash_dev sd_card = {
{init, read, write, erase}
};

static int read(long offset, uint8_t *buf, size_t size)
static int read(long offset, rt_uint8_t *buf, rt_size_t size)
{
rt_size_t sector_pos;
rt_size_t sector_offset;
rt_size_t remain_size = size;
rt_size_t req_size;
rt_align(4) uint8_t buffer[SECTOR_SIZE];
rt_align(4) rt_uint8_t buffer[SECTOR_SIZE];

while (remain_size)
{
Expand All @@ -54,13 +54,13 @@ static int read(long offset, uint8_t *buf, size_t size)
return size;
}

static int write(long offset, const uint8_t *buf, size_t size)
static int write(long offset, const rt_uint8_t *buf, rt_size_t size)
{
rt_size_t sector_pos;
rt_size_t sector_offset;
rt_size_t remain_size = size;
rt_size_t req_size;
rt_align(4) uint8_t buffer[SECTOR_SIZE];
rt_align(4) rt_uint8_t buffer[SECTOR_SIZE];

while (remain_size)
{
Expand All @@ -79,7 +79,7 @@ static int write(long offset, const uint8_t *buf, size_t size)
return size;
}

static int erase(long offset, size_t size)
static int erase(long offset, rt_size_t size)
{
return size;
}
Expand All @@ -93,7 +93,7 @@ static int init(void)
}
rt_device_open(sd_dev, RT_DEVICE_OFLAG_RDWR);
struct dev_sdmmc *dev_sdmmc = (struct dev_sdmmc *)sd_dev->user_data;
sd_card.len = (size_t)dev_sdmmc->geometry.bytes_per_sector * dev_sdmmc->geometry.sector_count;
sd_card.len = (rt_size_t)dev_sdmmc->geometry.bytes_per_sector * dev_sdmmc->geometry.sector_count;
sd_card.blk_size = dev_sdmmc->geometry.bytes_per_sector;

return 0;
Expand Down
24 changes: 12 additions & 12 deletions bsp/hc32/ev_hc32f448_lqfp80/board/ports/fal/fal_flash_sfud_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#endif

static int init(void);
static int read(long offset, uint8_t *buf, size_t size);
static int write(long offset, const uint8_t *buf, size_t size);
static int erase(long offset, size_t size);
static int read(long offset, rt_uint8_t *buf, rt_size_t size);
static int write(long offset, const rt_uint8_t *buf, rt_size_t size);
static int erase(long offset, rt_size_t size);

static sfud_flash_t sfud_dev = NULL;
struct fal_flash_dev ext_nor_flash0 =
Expand Down Expand Up @@ -51,19 +51,19 @@ static int init(void)
return 0;
}

static int read(long offset, uint8_t *buf, size_t size)
static int read(long offset, rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
sfud_read(sfud_dev, ext_nor_flash0.addr + offset, size, buf);

return size;
}

static int write(long offset, const uint8_t *buf, size_t size)
static int write(long offset, const rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_write(sfud_dev, ext_nor_flash0.addr + offset, size, buf) != SFUD_SUCCESS)
{
return -1;
Expand All @@ -72,10 +72,10 @@ static int write(long offset, const uint8_t *buf, size_t size)
return size;
}

static int erase(long offset, size_t size)
static int erase(long offset, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_erase(sfud_dev, ext_nor_flash0.addr + offset, size) != SFUD_SUCCESS)
{
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#endif

static int init(void);
static int read(long offset, uint8_t *buf, size_t size);
static int write(long offset, const uint8_t *buf, size_t size);
static int erase(long offset, size_t size);
static int read(long offset, rt_uint8_t *buf, rt_size_t size);
static int write(long offset, const rt_uint8_t *buf, rt_size_t size);
static int erase(long offset, rt_size_t size);

static sfud_flash_t sfud_dev = NULL;
struct fal_flash_dev ext_nor_flash0 =
Expand Down Expand Up @@ -50,19 +50,19 @@ static int init(void)
return 0;
}

static int read(long offset, uint8_t *buf, size_t size)
static int read(long offset, rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
sfud_read(sfud_dev, ext_nor_flash0.addr + offset, size, buf);

return size;
}

static int write(long offset, const uint8_t *buf, size_t size)
static int write(long offset, const rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_write(sfud_dev, ext_nor_flash0.addr + offset, size, buf) != SFUD_SUCCESS)
{
return -1;
Expand All @@ -71,10 +71,10 @@ static int write(long offset, const uint8_t *buf, size_t size)
return size;
}

static int erase(long offset, size_t size)
static int erase(long offset, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_erase(sfud_dev, ext_nor_flash0.addr + offset, size) != SFUD_SUCCESS)
{
return -1;
Expand Down
24 changes: 12 additions & 12 deletions bsp/hc32/ev_hc32f4a0_lqfp176/board/ports/fal/fal_flash_sfud_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#endif

static int init(void);
static int read(long offset, uint8_t *buf, size_t size);
static int write(long offset, const uint8_t *buf, size_t size);
static int erase(long offset, size_t size);
static int read(long offset, rt_uint8_t *buf, rt_size_t size);
static int write(long offset, const rt_uint8_t *buf, rt_size_t size);
static int erase(long offset, rt_size_t size);

static sfud_flash_t sfud_dev = NULL;
struct fal_flash_dev ext_nor_flash0 =
Expand Down Expand Up @@ -50,19 +50,19 @@ static int init(void)
return 0;
}

static int read(long offset, uint8_t *buf, size_t size)
static int read(long offset, rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
sfud_read(sfud_dev, ext_nor_flash0.addr + offset, size, buf);

return size;
}

static int write(long offset, const uint8_t *buf, size_t size)
static int write(long offset, const rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_write(sfud_dev, ext_nor_flash0.addr + offset, size, buf) != SFUD_SUCCESS)
{
return -1;
Expand All @@ -71,10 +71,10 @@ static int write(long offset, const uint8_t *buf, size_t size)
return size;
}

static int erase(long offset, size_t size)
static int erase(long offset, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_erase(sfud_dev, ext_nor_flash0.addr + offset, size) != SFUD_SUCCESS)
{
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#endif

static int init(void);
static int read(long offset, uint8_t *buf, size_t size);
static int write(long offset, const uint8_t *buf, size_t size);
static int erase(long offset, size_t size);
static int read(long offset, rt_uint8_t *buf, rt_size_t size);
static int write(long offset, const rt_uint8_t *buf, rt_size_t size);
static int erase(long offset, rt_size_t size);

static sfud_flash_t sfud_dev = NULL;
struct fal_flash_dev ext_nor_flash0 =
Expand Down Expand Up @@ -50,19 +50,19 @@ static int init(void)
return 0;
}

static int read(long offset, uint8_t *buf, size_t size)
static int read(long offset, rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
sfud_read(sfud_dev, ext_nor_flash0.addr + offset, size, buf);

return size;
}

static int write(long offset, const uint8_t *buf, size_t size)
static int write(long offset, const rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_write(sfud_dev, ext_nor_flash0.addr + offset, size, buf) != SFUD_SUCCESS)
{
return -1;
Expand All @@ -71,10 +71,10 @@ static int write(long offset, const uint8_t *buf, size_t size)
return size;
}

static int erase(long offset, size_t size)
static int erase(long offset, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_erase(sfud_dev, ext_nor_flash0.addr + offset, size) != SFUD_SUCCESS)
{
return -1;
Expand Down
24 changes: 12 additions & 12 deletions bsp/hc32/platform/fal/fal_flash_sfud_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@


static int init(void);
static int read(long offset, uint8_t *buf, size_t size);
static int write(long offset, const uint8_t *buf, size_t size);
static int erase(long offset, size_t size);
static int read(long offset, rt_uint8_t *buf, rt_size_t size);
static int write(long offset, const rt_uint8_t *buf, rt_size_t size);
static int erase(long offset, rt_size_t size);


static sfud_flash_t sfud_dev = NULL;
Expand Down Expand Up @@ -57,19 +57,19 @@ static int init(void)
return 0;
}

static int read(long offset, uint8_t *buf, size_t size)
static int read(long offset, rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
sfud_read(sfud_dev, ext_nor_flash0.addr + offset, size, buf);

return size;
}

static int write(long offset, const uint8_t *buf, size_t size)
static int write(long offset, const rt_uint8_t *buf, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_write(sfud_dev, ext_nor_flash0.addr + offset, size, buf) != SFUD_SUCCESS)
{
return -1;
Expand All @@ -78,10 +78,10 @@ static int write(long offset, const uint8_t *buf, size_t size)
return size;
}

static int erase(long offset, size_t size)
static int erase(long offset, rt_size_t size)
{
assert(sfud_dev);
assert(sfud_dev->init_ok);
RT_ASSERT(sfud_dev);
RT_ASSERT(sfud_dev->init_ok);
if (sfud_erase(sfud_dev, ext_nor_flash0.addr + offset, size) != SFUD_SUCCESS)
{
return -1;
Expand Down
Loading
Loading