fprime/Svc/ComQueue/ComQueue.fpp
David Kessler 6a921a1ef1
Fix ComQueue Does Not Deallocate Buffers on Overflow (#2853)
* Added Fw.BufferSend deallocate port to `ComQueue`

* Updated FPP to v2.2.0a2

* Change `buffQueueIn` port from `drop` to `hook`

* Added queue overflow hook method implementation

* Added return status to `ComQueue::enqueue()`

* `Fw::Buffer` is now deallocated on queue overflow

* Enabled `UT_AUTO_HELPERS` in `ComQueue` UT build

* Updated `ComQueue` UTs

* Explicitly discard `enqueue()` return status

* Replaced `overflowhook()` call with `deallocate()`

* Fixed comment style

* Renamed UT test case

* Added internal queue overflow UT

* Added assertion on `overflowHook()` argument
2024-09-17 18:09:32 -07:00

79 lines
2.4 KiB
Fortran

module Svc {
@ An enumeration of queue data types
enum QueueType { COM_QUEUE, BUFFER_QUEUE }
@ Array of queue depths for Fw::Com types
array ComQueueDepth = [ComQueueComPorts] U32
@ Array of queue depths for Fw::Buffer types
array BuffQueueDepth = [ComQueueBufferPorts] U32
@ Component used to queue buffer types
active component ComQueue {
# ----------------------------------------------------------------------
# General ports
# ----------------------------------------------------------------------
@ Fw::ComBuffer output port
output port comQueueSend: Fw.Com
@ Fw::Buffer output port
output port buffQueueSend: Fw.BufferSend
@ Port for deallocating Fw::Buffer on queue overflow
output port deallocate: Fw.BufferSend
@ Port for receiving the status signal
async input port comStatusIn: Fw.SuccessCondition
@ Port array for receiving Fw::ComBuffers
async input port comQueueIn: [ComQueueComPorts] Fw.Com drop
@ Port array for receiving Fw::Buffers
async input port buffQueueIn: [ComQueueBufferPorts] Fw.BufferSend hook
@ Port for scheduling telemetry output
async input port run: Svc.Sched drop
# ----------------------------------------------------------------------
# Special ports
# ----------------------------------------------------------------------
@ Port for emitting events
event port Log
@ Port for emitting text events
text event port LogText
@ Port for getting the time
time get port Time
@ Port for emitting telemetry
telemetry port Tlm
# ----------------------------------------------------------------------
# Events
# ----------------------------------------------------------------------
@ Queue overflow event
event QueueOverflow(
queueType: QueueType @< The Queue data type
index: U32 @< index of overflowed queue
) \
severity warning high \
format "The {} queue at index {} overflowed"
# ----------------------------------------------------------------------
# Telemetry
# ----------------------------------------------------------------------
@ Depth of queues of Fw::ComBuffer type
telemetry comQueueDepth: ComQueueDepth id 0
@ Depth of queues of Fw::Buffer type
telemetry buffQueueDepth: BuffQueueDepth id 1
}
}