mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-07 01:15:20 +00:00
So far there was a simple char array used as buffer, with additional variable representing number of bytes already written into it. After full frame was written, a boolean flag was simply set to notify thread about being ready to be processed. There was however no mechanism implemented to prevent new incoming bytes from overwriting such buffer before (or during) being processed. Use net_buf to store temporary frame. Define dedicated net_buf_pool, from which such buffer will be allocated and freed after being processed. This will prevent from reusing the same buffer before having it fully processed (and returning once again to available buffer pool) in shell thread. Define also fifo that will store buffers that are ready to be processed. This will be the mechanism for notifying thread about new UART SMP fragments. net_buf pool and k_fifo are used on purpose, keeping in mind their additional overhead (mostly in RAM/ROM usage). This makes the code ready for increasing number of buffers if needed. In this commit however we stick with only 1 buffer, to keep minimal changes in processing flow. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> |
||
---|---|---|
.. | ||
buf.h | ||
serial.h | ||
smp_bt.h | ||
smp_shell.h | ||
smp_udp.h | ||
smp.h |