The transaction machine of one serial line, shared by every instrument on it.
More...
|
| | Bus (Port &port) noexcept |
| | Bind to a port; no I/O.
|
| |
|
| Bus (const Bus &)=delete |
| | One bus per serial line.
|
| |
|
Bus & | operator= (const Bus &)=delete |
| | One bus per serial line.
|
| |
| Port & | GetPort () &noexcept |
| |
| Result< void > | ApplyBaud (uint32_t baud) noexcept |
| | Change the port's speed through the optional hook.
|
| |
| Error | Submit (const Request &request, const Timing &timing) noexcept |
| | Start a transaction.
|
| |
| PollState | Poll () noexcept |
| | Advance the machine without blocking.
|
| |
| Result< Reply > | Take () noexcept |
| | Take the result of a finished transaction.
|
| |
|
void | Abort () noexcept |
| | Drop the pending transaction and drain the line before the next send.
|
| |
|
void | EnterQuarantine () noexcept |
| | Drain the line until quiet before the next send (a decoder found the reply unusable).
|
| |
| Result< Reply > | Execute (const Request &request, const Timing &timing) noexcept |
| | Run one transaction to the end: wait for the bus, submit, poll, take. Blocks with DelayMs() or spins. A non-blocking result that was never Take()n is dropped (its transaction is over), and the wait for a busy bus is bounded by WaitBoundMs(). A request whose line is not quiet within one line wait (its reply wait without its own duration) ends Busy, unsent; the next request then waits only for the quiet line.
|
| |
| uint32_t | WaitBoundMs () const noexcept |
| | The longest Execute() waits for the transaction submitted last to end before it gives up with Busy: the gap and one line wait (a reply wait without the request's own duration) for a quiet line, the request's line time, one reply wait, a quarantine of two, its hold-off, a quiet margin of 2 ms and a slack of 2 ms per phase (four) for a sleep that overshoots.
|
| |
| uint32_t | StrayLineCount () const noexcept |
| |
| bool | StreamingSuspected () const noexcept |
| |
| uint32_t | WireViolations () const noexcept |
| |
| BusState | State () const noexcept |
| |
| uint8_t | DeviceCount () const noexcept |
| |
| void | SetDeviceCount (uint8_t count) noexcept |
| |
template<UartPort Port>
class alicat_basis2::Bus< Port >
The transaction machine of one serial line, shared by every instrument on it.
One transaction at a time ("behavior undefined" otherwise, M p.10): Submit() on a busy bus returns Busy and sends nothing. After a timeout, an overflow, a bad line or a wrong-ID reply the bus waits out the failed request's reply wait and drains the line until it has been quiet for t3.5 + 2 ms before it sends again, so a late reply is never taken for the next answer. A request that never reached the wire (the line did not go quiet) only needs the quiet line. While idle, bytes that arrive are counted as stray lines and never used.
- Template Parameters
-