Attention is currently required from: laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35044?usp=email )
Change subject: soft_uart: implement the transmitter ......................................................................
Patch Set 4:
(1 comment)
File src/core/soft_uart.c:
https://gerrit.osmocom.org/c/libosmocore/+/35044/comment/10132040_afdd4a54 PS4, Line 206: msgb_pull_u8
what if the msgb doesn't have anything to pull anymore? Ah, I guess that's why you check msg->len above.
Exactly. `msg->len` gets decremented every time we do `msgb_pull_u8()`. If there is still some data (`if msg->len > 0`), we pull one byte from the beginning and transmit a UART frame going via all those flow states. If the `msg` has no more data, we remain in `IDLE` and transmit stop bits.
It would be more elegant to avoid dereferencing msgb internals and instead use msgb_length(msg) here.
What I don't like about `msgb_length()` is that it's not a `static inline` function, but a regular function defined in `core/msgb.c`. I was afraid of a negative performance impact, but I hope the compiler is smart enough to optimize out a function call. Will migrate to `msgb_length()`.