Files
openthread/tools
Jonathan Hui fcf7b4cef5 [spi-hdlc-adapter] define explicit worst-case HDLC frame size macro (#13237)
This commit replaces the implicit sizing of `escaped_frame_buffer`
with an explicit macro `HDLC_MAX_FRAME_SIZE` in the standalone
`spi-hdlc-adapter` tool.

Previously, `escaped_frame_buffer` was sized statically to
`MAX_FRAME_SIZE * 2` (4096 bytes). While this size is mathematically
sufficient to hold a worst-case escaped payload (4091 bytes for a
2043-byte max payload, 4 escaped CRC bytes, and 1 flag byte), it was
not self-documenting and relied on implicit math.

This commit defines `HDLC_MAX_FRAME_SIZE` explicitly as:
`((MAX_FRAME_SIZE - HEADER_LEN) * 2 + 5)`
making the worst-case framing overhead bounds clear and robust to
any future changes to the constants.
2026-06-11 18:00:57 -07:00
..
2025-06-18 23:09:47 +09:00