Exemple #1
0
ICELIB_FIFO_ELEMENT *pICELIB_fifoIteratorNext(ICELIB_TRIGGERED_FIFO_ITERATOR *iterator)
{
    ICELIB_FIFO_ELEMENT *element = NULL;

    if (ICELIB_fifoIsEmpty(iterator->fifo))
        return NULL;

    if (iterator->atEnd)
        return NULL;

    if (ICELIB_fifoIsFull(iterator->fifo)) {
        element = &iterator->fifo->elements[ iterator->index];
        fifoIncrementToNext(iterator->index);
        if (iterator->index == iterator->fifo->inIndex) {
            iterator->atEnd = true;
        }
    } else {
        if (iterator->index == iterator->fifo->inIndex) {
            iterator->atEnd = true;
            return NULL;
        }

        element = &iterator->fifo->elements[ iterator->index];
        fifoIncrementToNext(iterator->index);
    }

    return element;
}
Exemple #2
0
ICELIB_LIST_PAIR*
pICELIB_triggeredFifoGet(ICELIB_CHECKLIST*      checkList,
                         ICELIB_CALLBACK_LOG*   callbackLog,
                         ICELIB_TRIGGERED_FIFO* fifo)
{
  uint32_t          pairId;
  ICELIB_LIST_PAIR* pair;

  do
  {
    if ( ICELIB_fifoIsEmpty(fifo) )
    {
      ICELIB_log(callbackLog, ICELIB_logDebug,
                 "Triggered Check FIFO is empty!");
      return NULL;
    }
    pairId = ICELIB_fifoGet(fifo);
  } while (pairId == ICELIB_FIFO_ELEMENT_REMOVED);

  pair = ICELIB_getPairById(checkList, pairId);

  if (pair == NULL)
  {
    ICELIB_log1(callbackLog,
                ICELIB_logDebug,
                "Could not find pair by Id: %u",
                pairId);
  }

  return pair;
}
Exemple #3
0
//
//----- Return: element               - fifo was not empty
//              ICELIB_FIFO_IS_EMPTY  - fifo is empty!!
//
ICELIB_FIFO_ELEMENT ICELIB_fifoGet(ICELIB_TRIGGERED_FIFO *fifo)
{
    unsigned int outPreIndex;

    if (ICELIB_fifoIsEmpty(fifo))
        return ICELIB_FIFO_IS_EMPTY;

    fifo->isFull = false;
    outPreIndex   = fifo->outIndex;
    fifoIncrementToNext(fifo->outIndex);

    return fifo->elements[ outPreIndex];
}
Exemple #4
0
bool ICELIB_triggeredFifoIsEmpty(const ICELIB_TRIGGERED_FIFO *fifo)
{
    return ICELIB_fifoIsEmpty(fifo);
}