Part 1
요약·해설
DFU와 radio stream에 필요한 buffered write, read-back validation과 interruption 뒤 progress 복원을 설명합니다.
Fragments
Aggregate
Write · resume
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
DDC7EA4B11F17B779375C301397FC618D33447AC303B6D0B73461D936448417E
.. _stream_flash:
Stream Flash
############
The Stream Flash module takes contiguous fragments of a stream of data (e.g.
from radio packets), aggregates them into a user-provided buffer, then when the
buffer fills (or stream ends) writes it to a raw flash partition. It supports
providing the read-back buffer to the client to use in validating the persisted
stream content.
One typical use of a stream write operation is when receiving a new firmware
image to be used in a DFU operation.
There are several reasons why one might want to use buffered writes instead of
writing the data directly as it is made available. Some devices have hardware
limitations which does not allow flash writes to be performed in parallel with
other operations, such as radio RX and TX. Also, fewer write operations result
in faster response times seen from the application.
Persistent stream write progress
********************************
Some stream write operations, such as DFU operations, may run for a long time.
When performing such long running operations it can be useful to be able to save
the stream write progress to persistent storage so that the operation can resume
at the same point after an unexpected interruption.
The Stream Flash module offers an API for loading, saving and clearing stream
write progress to persistent storage using the :ref:`Settings <settings_api>`
module. The API can be enabled using :kconfig:option:`CONFIG_STREAM_FLASH_PROGRESS`.
API Reference
*************
.. doxygengroup:: stream_flash
Part 3
한국어 전문 번역
Stream Flash는 radio packet처럼 연속해서 들어오는 data fragment를 user-provided buffer에 모읍니다. Buffer가 가득 차거나 stream이 끝나면 raw flash partition에 기록합니다. Client가 persisted content를 검증할 수 있도록 read-back buffer도 제공할 수 있습니다.
대표 용도는 DFU용 새 firmware image 수신입니다. Fragment마다 즉시 flash를 쓰는 대신 buffering하면 radio RX/TX와 flash write를 병렬 수행할 수 없는 hardware에서도 data loss를 줄이고, write operation 수가 감소해 application이 보는 response time도 빨라집니다.
Persistent stream write progress
DFU 같은 stream write는 오래 걸릴 수 있어 예상치 못한 interruption 뒤 같은 offset부터 재개할 필요가 있습니다. Stream Flash는 Settings module을 통해 progress를 load, save, clear하는 API를 제공합니다.
이 기능은 CONFIG_STREAM_FLASH_PROGRESS로 활성화합니다. Progress record는 data 자체가 아니라 현재 stream write 위치이므로, 재개 전에 target partition과 incoming image가 같은 작업에 속하는지 application이 함께 검증해야 합니다.
API Reference
stream_flash_callback_t- Flash block write가 완료된 뒤 호출되는 callback signature입니다.
stream_flash_init- Flash device, buffer, partition offset과 callback으로 stream context를 초기화합니다.
stream_flash_bytes_written- 현재 raw flash에 실제로 기록된 byte 수를 반환합니다.
stream_flash_buffered_write- 입력 fragment를 buffer에 모으고 full 또는 flush 때 flash block으로 씁니다.
stream_flash_erase_page- 주어진 offset이 속한 flash erase page를 지웁니다.
stream_flash_progress_load- Settings key에 저장된 persistent stream progress를 복원합니다.
stream_flash_progress_save- 현재 written offset을 지정 Settings key로 저장합니다.
stream_flash_progress_clear- Settings key의 saved stream progress를 삭제합니다.
stream_flash_ctx- Flash target, staging buffer, current offset, callback과 progress 상태를 보관합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.