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

[nrf fromtree] bluetooth: mesh: Adapt BLOB IO to RRAM write size #1664

Merged
merged 1 commit into from
May 13, 2024
Merged
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
11 changes: 9 additions & 2 deletions subsys/bluetooth/mesh/blob_io_flash.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Noioic Semiconductor ASA
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -12,7 +12,7 @@
#include "net.h"
#include "transport.h"

#define WRITE_BLOCK_SIZE 4
#define WRITE_BLOCK_SIZE DT_PROP(DT_INST(0, soc_nv_flash), write_block_size)

#define FLASH_IO(_io) CONTAINER_OF(_io, struct bt_mesh_blob_io_flash, io)

Expand Down Expand Up @@ -110,6 +110,13 @@ static int wr_chunk(const struct bt_mesh_blob_io *io,
const struct bt_mesh_blob_chunk *chunk)
{
struct bt_mesh_blob_io_flash *flash = FLASH_IO(io);

if (IS_ENABLED(CONFIG_SOC_FLASH_NRF_RRAM)) {
return flash_area_write(flash->area,
flash->offset + block->offset + chunk->offset,
chunk->data, chunk->size);
}

uint8_t buf[ROUND_UP(BLOB_CHUNK_SIZE_MAX(BT_MESH_RX_SDU_MAX),
WRITE_BLOCK_SIZE)];
off_t area_offset = flash->offset + block->offset + chunk->offset;
Expand Down
Loading