Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log_seq_read读取数据超过1个扇区时,会数据错乱,应修改为 #161

Open
cenyi12345678 opened this issue Sep 22, 2023 · 0 comments

Comments

@cenyi12345678
Copy link

`static EfErrCode log_seq_read(uint32_t addr, uint32_t *log, size_t size) {
EfErrCode result = EF_NO_ERR;
size_t read_size = 0, read_size_temp = 0;

while (size) {
    /* move to sector data address */
    if ((addr + read_size) % EF_ERASE_MIN_SIZE == 0) {
        addr += LOG_SECTOR_HEADER_SIZE;
    }
    /* calculate current sector last data size */
    read_size_temp = EF_ERASE_MIN_SIZE - ((addr + read_size) % EF_ERASE_MIN_SIZE);
    if (size < read_size_temp) {
        read_size_temp = size;
    }
    result = ef_port_read(addr + read_size, log + read_size / 4, read_size_temp);
    if (result != EF_NO_ERR) {
        return result;
    }
    read_size += read_size_temp;
    size -= read_size_temp;
}

return result;

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant