17 ComQueue ::QueueConfigurationTable ::QueueConfigurationTable() {
 
   19         this->entries[i].priority = 0;
 
   20         this->entries[i].depth = 0;
 
   29       m_allocation(nullptr) {
 
   32         this->m_throttle[i] = 
false;
 
   40     if ((this->m_allocator != 
nullptr) && (this->m_allocation != 
nullptr)) {
 
   41         this->m_allocator->
deallocate(this->m_allocationId, this->m_allocation);
 
   52     this->m_allocator = &allocator;
 
   53     this->m_allocationId = allocationId;
 
   54     this->m_allocation = 
nullptr;
 
   78                 QueueMetadata& entry = this->m_prioritizedList[currentPriorityIndex];
 
   81                 entry.index = entryIndex;
 
   85                 totalAllocation += 
static_cast<NATIVE_UINT_TYPE>(entry.depth * entry.msgSize);
 
   86                 currentPriorityIndex++;
 
   91     bool recoverable = 
false;
 
   92     this->m_allocation = this->m_allocator->
allocate(this->m_allocationId, totalAllocation, recoverable);
 
  100         FwSizeType allocationSize = this->m_prioritizedList[i].depth * this->m_prioritizedList[i].msgSize;
 
  102                   this->m_prioritizedList[i].index);
 
  104             (allocationSize + allocationOffset) <= totalAllocation,
 
  110         if (allocationSize > 0) {
 
  111             this->m_queues[this->m_prioritizedList[i].index].
setup(
 
  112                 reinterpret_cast<U8*
>(this->m_allocation) + allocationOffset, allocationSize,
 
  113                 this->m_prioritizedList[i].depth, this->m_prioritizedList[i].msgSize);
 
  115         allocationOffset += allocationSize;
 
  119         allocationOffset == totalAllocation,
 
  146     switch (this->m_state) {
 
  150                 this->m_state = READY;
 
  151                 this->processQueue();
 
  153                 FW_ASSERT((this->m_state == WAITING || this->m_state == READY), this->m_state);
 
  155                 this->m_state = WAITING;
 
  166 void ComQueue::run_handler(
const NATIVE_INT_TYPE portNum, U32 context) {
 
  168     ComQueueDepth comQueueDepth;
 
  169     for (U32 i = 0; i < comQueueDepth.SIZE; i++) {
 
  176     BuffQueueDepth buffQueueDepth;
 
  177     for (U32 i = 0; i < buffQueueDepth.SIZE; i++) {
 
  197 bool ComQueue::enqueue(
const FwIndexType queueNum, QueueType queueType, 
const U8* data, 
const FwSizeType size) {
 
  202     bool rvStatus = 
true;
 
  204         expectedSize == size,
 
  210         if (!this->m_throttle[queueNum]) {
 
  212             this->m_throttle[queueNum] = 
true;
 
  218     if (this->m_state == READY) {
 
  219         this->processQueue();
 
  228     this->m_state = WAITING;
 
  231 void ComQueue::sendBuffer(
Fw::Buffer& buffer) {
 
  235     this->m_state = WAITING;
 
  238 void ComQueue::processQueue() {
 
  246     for (priorityIndex = 0; priorityIndex < 
TOTAL_PORT_COUNT; priorityIndex++) {
 
  247         QueueMetadata& entry = this->m_prioritizedList[priorityIndex];
 
  258             queue.
dequeue(
reinterpret_cast<U8*
>(&comBuffer), 
sizeof(comBuffer));
 
  259             this->sendComBuffer(comBuffer);
 
  262             queue.
dequeue(
reinterpret_cast<U8*
>(&buffer), 
sizeof(buffer));
 
  263             this->sendBuffer(buffer);
 
  267         this->m_throttle[entry.index] = 
false;
 
  270         sendPriority = entry.priority;
 
  277     for (priorityIndex++;
 
  278          priorityIndex < 
TOTAL_PORT_COUNT && (this->m_prioritizedList[priorityIndex].priority == sendPriority);
 
  281         QueueMetadata temp = this->m_prioritizedList[priorityIndex];
 
  282         this->m_prioritizedList[priorityIndex] = this->m_prioritizedList[priorityIndex - 1];
 
  283         this->m_prioritizedList[priorityIndex - 1] = temp;
 
PlatformIntType NATIVE_INT_TYPE
 
uint8_t U8
8-bit unsigned integer
 
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
 
PlatformUIntType NATIVE_UINT_TYPE
 
C++ header for working with basic fprime types.
 
PlatformAssertArgType FwAssertArgType
 
PlatformSizeType FwSizeType
 
PlatformIndexType FwIndexType
 
virtual void deallocate(const NATIVE_UINT_TYPE identifier, void *ptr)=0
Deallocate memory.
 
virtual void * allocate(const NATIVE_UINT_TYPE identifier, NATIVE_UINT_TYPE &size, bool &recoverable)=0
Allocate memory.
 
@ SUCCESS
Representing success.
 
Auto-generated base for ComQueue component.
 
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port deallocate.
 
void tlmWrite_comQueueDepth(const Svc::ComQueueDepth &arg, Fw::Time _tlmTime=Fw::Time())
 
void tlmWrite_buffQueueDepth(const Svc::BuffQueueDepth &arg, Fw::Time _tlmTime=Fw::Time())
 
void buffQueueSend_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port buffQueueSend.
 
void comQueueSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port comQueueSend.
 
void log_WARNING_HI_QueueOverflow(Svc::QueueType queueType, U32 index)
 
ComQueue(const char *const compName)
 
void configure(QueueConfigurationTable queueConfig, NATIVE_UINT_TYPE allocationId, Fw::MemAllocator &allocator)
 
static const FwIndexType BUFFER_PORT_COUNT
Total count of input buffer ports and thus total queues.
 
static const FwIndexType COM_PORT_COUNT
< Count of Fw::Com input ports and thus Fw::Com queues
 
static const FwIndexType TOTAL_PORT_COUNT
 
NATIVE_UINT_TYPE getQueueSize() const
 
void setup(U8 *const storage, const FwSizeType storage_size, const FwSizeType depth, const FwSizeType message_size)
setup the queue object to setup storage
 
Fw::SerializeStatus dequeue(U8 *const message, const FwSizeType size)
pops a fixed-size message off the front of the queue
 
Fw::SerializeStatus enqueue(const U8 *const message, const FwSizeType size)
pushes a fixed-size message onto the back of the queue
 
NATIVE_UINT_TYPE get_high_water_mark() const
 
void clear_high_water_mark()
 
SerializeStatus
forward declaration for string
 
@ FW_SERIALIZE_NO_ROOM_LEFT
No room left in the buffer to serialize data.
 
FwIndexType priority
Priority of the queue [0, TOTAL_PORT_COUNT)
 
FwSizeType depth
Depth of the queue [0, infinity)
 
configuration table for each queue
 
QueueConfigurationEntry entries[TOTAL_PORT_COUNT]