Skip to content

Commit 8137bd7

Browse files
HaavardReinordicjm
authored andcommitted
[nrf fromtree] bluetooth: mesh: Adapt BLOB IO to RRAM write size
Adapts flash writing for BLOB IO to RRAM. The previously used write block alignment is not needed for RRAM. Signed-off-by: Håvard Reierstad <[email protected]> (cherry picked from commit 0f416b3576d2b259f1bf4f381d8cae430bb41d2a) Signed-off-by: Håvard Reierstad <[email protected]>
1 parent 934b55e commit 8137bd7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

subsys/bluetooth/mesh/blob_io_flash.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020 Noioic Semiconductor ASA
2+
* Copyright (c) 2020 Nordic Semiconductor ASA
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -12,7 +12,7 @@
1212
#include "net.h"
1313
#include "transport.h"
1414

15-
#define WRITE_BLOCK_SIZE 4
15+
#define WRITE_BLOCK_SIZE DT_PROP(DT_INST(0, soc_nv_flash), write_block_size)
1616

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

@@ -110,6 +110,13 @@ static int wr_chunk(const struct bt_mesh_blob_io *io,
110110
const struct bt_mesh_blob_chunk *chunk)
111111
{
112112
struct bt_mesh_blob_io_flash *flash = FLASH_IO(io);
113+
114+
if (IS_ENABLED(CONFIG_SOC_FLASH_NRF_RRAM)) {
115+
return flash_area_write(flash->area,
116+
flash->offset + block->offset + chunk->offset,
117+
chunk->data, chunk->size);
118+
}
119+
113120
uint8_t buf[ROUND_UP(BLOB_CHUNK_SIZE_MAX(BT_MESH_RX_SDU_MAX),
114121
WRITE_BLOCK_SIZE)];
115122
off_t area_offset = flash->offset + block->offset + chunk->offset;

0 commit comments

Comments
 (0)