storage/stream_flash: Add API to query buffered data size
add a wrapper function to read the number of bytes currently buffered and pending for the next flash write operation. Signed-off-by: Syver Haraldsen <syver.haraldsen@nordicsemi.no>
This commit is contained in:
committed by
Benjamin Cabé
parent
633246a3ea
commit
6331225c94
@@ -106,6 +106,15 @@ int stream_flash_init(struct stream_flash_ctx *ctx, const struct device *fdev,
|
||||
*/
|
||||
size_t stream_flash_bytes_written(const struct stream_flash_ctx *ctx);
|
||||
|
||||
/**
|
||||
* @brief Read number of bytes buffered for the next flash write.
|
||||
*
|
||||
* @param ctx context
|
||||
*
|
||||
* @return Number of payload bytes buffered for the next flash write.
|
||||
*/
|
||||
size_t stream_flash_bytes_buffered(const struct stream_flash_ctx *ctx);
|
||||
|
||||
/**
|
||||
* @brief Process input buffers to be written to flash device in single blocks.
|
||||
* Will store remainder between calls.
|
||||
|
||||
@@ -307,6 +307,11 @@ size_t stream_flash_bytes_written(const struct stream_flash_ctx *ctx)
|
||||
return ctx->bytes_written;
|
||||
}
|
||||
|
||||
size_t stream_flash_bytes_buffered(const struct stream_flash_ctx *ctx)
|
||||
{
|
||||
return ctx->buf_bytes;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_STREAM_FLASH_INSPECT
|
||||
struct _inspect_flash {
|
||||
size_t buf_len;
|
||||
|
||||
Reference in New Issue
Block a user