Line data Source code
1 0 : /*
2 : * Copyright (c) 2020 Nordic Semiconductor ASA
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_IO_FLASH_H__
8 : #define ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_IO_FLASH_H__
9 :
10 : #include <stdint.h>
11 :
12 : #ifdef __cplusplus
13 : extern "C" {
14 : #endif
15 :
16 : /**
17 : * @defgroup bt_mesh_blob_io_flash Bluetooth Mesh BLOB flash stream
18 : * @ingroup bt_mesh
19 : * @{
20 : */
21 :
22 : /** BLOB flash stream. */
23 1 : struct bt_mesh_blob_io_flash {
24 : /** Flash area ID to write the BLOB to. */
25 1 : uint8_t area_id;
26 : /** Active stream mode. */
27 1 : enum bt_mesh_blob_io_mode mode;
28 : /** Offset into the flash area to place the BLOB at (in bytes). */
29 1 : off_t offset;
30 :
31 :
32 : /* Internal flash area pointer. */
33 0 : const struct flash_area *area;
34 : /* BLOB stream. */
35 0 : struct bt_mesh_blob_io io;
36 : };
37 :
38 : /** @brief Initialize a flash stream.
39 : *
40 : * @param flash Flash stream.
41 : * @param area_id Flash partition identifier. See @ref flash_area_open.
42 : * @param offset Offset into the flash area, in bytes.
43 : *
44 : * @return 0 on success or (negative) error code otherwise.
45 : */
46 1 : int bt_mesh_blob_io_flash_init(struct bt_mesh_blob_io_flash *flash,
47 : uint8_t area_id, off_t offset);
48 :
49 : /** @} */
50 :
51 : #ifdef __cplusplus
52 : }
53 : #endif
54 :
55 : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_BLOB_IO_FLASH_H__ */
|