|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
Layer: Foundation ยท Build flags: PC_ENABLE_PREEMPT_QUEUE
The preempting work queue (PreemptQueue) is not one queue but several named lanes, each with its own task at its own priority:
| Lane | Role | Priority |
|---|---|---|
PC_PQ_LANE_DMA | internal: DMA peripheral transfers | highest |
PC_PQ_LANE_FORWARD | internal: interface forwarding | high |
PC_PQ_LANE_DEVICE | internal: device access | high |
PC_PQ_LANE_USER | exposed to your app (no-arg pc_pq_*) | lowest |
The internal lanes run above the user lane (base PC_PQ_INTERNAL_PRIORITY, DMA highest) and below the lwIP tcpip / WiFi tasks. So the library's own real-time ingest (a DMA transfer, a forwarded frame, a device event) always preempts user "process now" work, and neither starves networking.
pc_pq_lane_priority(lane) returns a lane's default priority, so you can confirm the ordering. Each lane is independent: separate queue, separate task, separate pc_pq_high_water_lane(). Queue storage is static (zero heap); a lane's task stack is created only when you start it, so lanes you never start cost only their queue storage.
Same guarantees as one lane: PC_PQ_DEPTH x PC_PQ_ITEM_SIZE static storage per lane, fail-closed on a full queue, no hot-path locks.
PC_ENABLE_PREEMPT_QUEUE must reach the library build, so pass it as a build flag: