This commit is contained in:
soym 2023-01-29 17:17:57 -05:00 committed by Man, Jianting (Meco)
parent 61a168099b
commit 450cd68a4a
1 changed files with 6 additions and 6 deletions

View File

@ -72,7 +72,7 @@ static sfud_err reset(const sfud_flash *flash);
static sfud_err read_jedec_id(sfud_flash *flash); static sfud_err read_jedec_id(sfud_flash *flash);
static sfud_err set_write_enabled(const sfud_flash *flash, bool enabled); static sfud_err set_write_enabled(const sfud_flash *flash, bool enabled);
static sfud_err set_4_byte_address_mode(sfud_flash *flash, bool enabled); static sfud_err set_4_byte_address_mode(sfud_flash *flash, bool enabled);
static void make_adress_byte_array(const sfud_flash *flash, uint32_t addr, uint8_t *array); static void make_address_byte_array(const sfud_flash *flash, uint32_t addr, uint8_t *array);
/* ../port/sfup_port.c */ /* ../port/sfup_port.c */
extern void sfud_log_debug(const char *file, const long line, const char *format, ...); extern void sfud_log_debug(const char *file, const long line, const char *format, ...);
@ -430,7 +430,7 @@ sfud_err sfud_read(const sfud_flash *flash, uint32_t addr, size_t size, uint8_t
#endif #endif
{ {
cmd_data[0] = SFUD_CMD_READ_DATA; cmd_data[0] = SFUD_CMD_READ_DATA;
make_adress_byte_array(flash, addr, &cmd_data[1]); make_address_byte_array(flash, addr, &cmd_data[1]);
cmd_size = flash->addr_in_4_byte ? 5 : 4; cmd_size = flash->addr_in_4_byte ? 5 : 4;
result = spi->wr(spi, cmd_data, cmd_size, data, size); result = spi->wr(spi, cmd_data, cmd_size, data, size);
} }
@ -557,7 +557,7 @@ sfud_err sfud_erase(const sfud_flash *flash, uint32_t addr, size_t size) {
} }
cmd_data[0] = cur_erase_cmd; cmd_data[0] = cur_erase_cmd;
make_adress_byte_array(flash, addr, &cmd_data[1]); make_address_byte_array(flash, addr, &cmd_data[1]);
cmd_size = flash->addr_in_4_byte ? 5 : 4; cmd_size = flash->addr_in_4_byte ? 5 : 4;
result = spi->wr(spi, cmd_data, cmd_size, NULL, 0); result = spi->wr(spi, cmd_data, cmd_size, NULL, 0);
if (result != SFUD_SUCCESS) { if (result != SFUD_SUCCESS) {
@ -639,7 +639,7 @@ static sfud_err page256_or_1_byte_write(const sfud_flash *flash, uint32_t addr,
goto __exit; goto __exit;
} }
cmd_data[0] = SFUD_CMD_PAGE_PROGRAM; cmd_data[0] = SFUD_CMD_PAGE_PROGRAM;
make_adress_byte_array(flash, addr, &cmd_data[1]); make_address_byte_array(flash, addr, &cmd_data[1]);
cmd_size = flash->addr_in_4_byte ? 5 : 4; cmd_size = flash->addr_in_4_byte ? 5 : 4;
/* make write align and calculate next write address */ /* make write align and calculate next write address */
@ -731,7 +731,7 @@ static sfud_err aai_write(const sfud_flash *flash, uint32_t addr, size_t size, c
cmd_data[0] = SFUD_CMD_AAI_WORD_PROGRAM; cmd_data[0] = SFUD_CMD_AAI_WORD_PROGRAM;
while (size >= 2) { while (size >= 2) {
if (first_write) { if (first_write) {
make_adress_byte_array(flash, addr, &cmd_data[1]); make_address_byte_array(flash, addr, &cmd_data[1]);
cmd_size = flash->addr_in_4_byte ? 5 : 4; cmd_size = flash->addr_in_4_byte ? 5 : 4;
cmd_data[cmd_size] = *data; cmd_data[cmd_size] = *data;
cmd_data[cmd_size + 1] = *(data + 1); cmd_data[cmd_size + 1] = *(data + 1);
@ -995,7 +995,7 @@ static sfud_err wait_busy(const sfud_flash *flash) {
return result; return result;
} }
static void make_adress_byte_array(const sfud_flash *flash, uint32_t addr, uint8_t *array) { static void make_address_byte_array(const sfud_flash *flash, uint32_t addr, uint8_t *array) {
uint8_t len, i; uint8_t len, i;
SFUD_ASSERT(flash); SFUD_ASSERT(flash);