|
libxr
1.0
Want to be the best embedded framework
|
UART 单次 DMA 发送执行模型 / UART one-shot DMA TX execution model. More...
#include <uart_dma_tx_model.hpp>
Data Structures | |
| struct | SubmitContext |
Public Member Functions | |
| UartDmaTxModel (Backend &backend, WritePort &port, RawData storage) | |
| 绑定平台后端、写端口和 DMA 双缓冲区 / Bind the backend, write port, and DMA double buffer | |
| ErrorCode | Submit (bool in_isr) |
| 发布 WRITE 事件并推进队首请求 / Publish WRITE and advance the head request | |
| void | OnTransferDone (bool in_isr) |
| 发布正常完成事件 / Publish a normal completion event | |
| void | OnTransferError (bool in_isr) |
| 在平台恢复旧 DMA 后发布错误终止事件 / Publish an error terminal event after platform recovery | |
| void | RequestConfig (bool in_isr) |
| 发布最高优先级配置事件 / Publish the highest-priority configuration event | |
| bool | IsBusy () const |
| 查询 DMA 是否持有 active 请求 / Check whether DMA owns an active request | |
| uint8_t * | Buffer (int block) const |
| size_t | BufferSize () const |
Private Types | |
| enum class | TxEvent : uint32_t { WRITE = 1U << 0U , COMPLETE = 1U << 1U , ERROR = 1U << 2U , CONFIG = 1U << 3U } |
Private Member Functions | |
| void | ServiceTx (uint32_t events, bool in_isr, SubmitContext *submit) noexcept |
| bool | PopPayload (uint8_t *destination, size_t size) |
| bool | DiscardPayload (size_t size) |
| bool | PopActiveInfo (WriteInfoBlock &info) |
| bool | StagePending (const WriteInfoBlock &info) |
| bool | StageNextPending (bool in_isr) |
| bool | PromotePending (WriteInfoBlock &info) |
| bool | StartActive () |
| bool | ReleaseActive () |
| bool | PromoteAndStartPending (bool in_isr) |
| void | StartQueuedActive (bool in_isr, SubmitContext *submit) |
| bool | ApplyConfig (bool in_isr) |
| void | FailPublishedQueued (bool in_isr, size_t count) |
| void | ClearActive () |
Static Private Member Functions | |
| static constexpr uint32_t | EventMask (TxEvent event) |
| static constexpr bool | HasEvent (uint32_t events, TxEvent event) |
Private Attributes | |
| Backend & | backend_ |
| WritePort & | port_ |
| DoubleBuffer | buffers_ |
| SerializedService | service_ {} |
| size_t | active_length_ = 0U |
| size_t | config_prefix_count_ = 0U |
| bool | busy_ = false |
| bool | pending_valid_ = false |
| bool | config_boundary_valid_ = false |
UART 单次 DMA 发送执行模型 / UART one-shot DMA TX execution model.
Submit()、正常完成和错误恢复入口只发布可合并事件。SerializedService 选出的 唯一 owner 负责 active/pending buffer、WritePort 出队、DMA 启动以及 Operation 完成,避免提交线程与完成 ISR 并发推进双缓冲状态。 Submit(), normal completion, and recovered-error entries only publish coalesced events. The sole owner selected by SerializedService controls active/pending buffers, WritePort dequeue, DMA start, and Operation completion, preventing submitters and completion ISRs from advancing the double-buffer state concurrently.
| Backend | 静态绑定的平台后端类型 / Statically bound platform backend type |
Definition at line 28 of file uart_dma_tx_model.hpp.
|
strongprivate |
Definition at line 111 of file uart_dma_tx_model.hpp.
|
inline |
绑定平台后端、写端口和 DMA 双缓冲区 / Bind the backend, write port, and DMA double buffer
Definition at line 35 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 373 of file uart_dma_tx_model.hpp.
|
inlinenodiscard |
Definition at line 106 of file uart_dma_tx_model.hpp.
|
inlinenodiscard |
Definition at line 108 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 434 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 189 of file uart_dma_tx_model.hpp.
|
inlinestaticconstexprprivate |
Definition at line 124 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 415 of file uart_dma_tx_model.hpp.
|
inlinestaticconstexprprivate |
Definition at line 129 of file uart_dma_tx_model.hpp.
|
inlinenodiscard |
查询 DMA 是否持有 active 请求 / Check whether DMA owns an active request
Definition at line 104 of file uart_dma_tx_model.hpp.
|
inline |
发布正常完成事件 / Publish a normal completion event
| in_isr | 当前调用是否位于 ISR / Whether the current caller is in an ISR |
Definition at line 60 of file uart_dma_tx_model.hpp.
|
inline |
在平台恢复旧 DMA 后发布错误终止事件 / Publish an error terminal event after platform recovery
| in_isr | 当前调用是否位于 ISR / Whether the current caller is in an ISR |
Definition at line 74 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 203 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 182 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 291 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 247 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 279 of file uart_dma_tx_model.hpp.
|
inline |
发布最高优先级配置事件 / Publish the highest-priority configuration event
| in_isr | 当前调用是否位于 ISR / Whether the current caller is in an ISR |
平台后端负责保存最新配置 payload。本入口只发布可合并事件;CONFIG owner 会停止并 重配硬件、终止旧 TX 前缀,然后让 CONFIG 期间追加的请求在后续轮次继续推进。 The platform backend owns the latest configuration payload. This entry only publishes the coalesced event; the CONFIG owner reconfigures hardware, aborts the old TX prefix, and leaves requests appended during CONFIG for later service rounds.
Definition at line 91 of file uart_dma_tx_model.hpp.
|
inlineprivatenoexcept |
Definition at line 134 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 221 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 210 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 265 of file uart_dma_tx_model.hpp.
|
inlineprivate |
Definition at line 316 of file uart_dma_tx_model.hpp.
|
inline |
发布 WRITE 事件并推进队首请求 / Publish WRITE and advance the head request
| in_isr | 当前调用是否位于 ISR / Whether the current caller is in an ISR |
OK,留在流水中时返回 PENDING,同步启动失败 时返回错误 / OK for a synchronous start, PENDING while retained by the pipeline, or an error for a synchronous start failure Definition at line 47 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 440 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 436 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 438 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 442 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 444 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 441 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 443 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 437 of file uart_dma_tx_model.hpp.
|
private |
Definition at line 439 of file uart_dma_tx_model.hpp.