|
ecor
|
Source for scheduling transactions in a request-reply protocol (e.g. More...
#include <ecor.hpp>
Public Types | |
| using | sender_type = _trnx_controller_sender< T > |
Public Member Functions | |
| trnx_entry< T > * | query_next_trnx () |
| Retrieve the next pending transaction entry for processing by the driver. More... | |
| sender_type | schedule (T val) |
| Schedule a new transaction with the given user data. More... | |
Source for scheduling transactions in a request-reply protocol (e.g.
UART, SPI, I²C) where multiple transactions can be in flight simultaneously. The source will get user-defined type T as transaction payload and will return senders that complete when the transaction is completed by the driver.
The source maintains a linked list of pending transactions. Once a transaction is taken by the driver, it is removed from the list and handed off to the driver, which is responsible for managing it until completion.
On completion, the driver calls set_value/set_error/set_stopped on the transaction entry. The exact API is specified by the user-provided transaction data type T.
Architecture of the transaction abstraction:
Usage:
Stop semantics: stop tokens are checked only for pending transactions (still in the source's linked list). Once a transaction is moved outside, whenever it can be cancelled or not depends solely on the driver.
T: User-defined transaction data type providing get_completion_signatures.
|
inline |
Retrieve the next pending transaction entry for processing by the driver.
Returns nullptr if there are no pending transactions. Any transaction has been cancelled (stop token triggered) while it was pending, it will be removed from the list, set_stopped() will be called on it, and it will not be returned.
|
inline |
Schedule a new transaction with the given user data.
Returns a sender that completes when the transaction is completed by the driver.