/* Declare queue type macro. */
#define DECLARE_QUEUE_TYPE(_QUEUE_TYPE, _QUEUE_SIZE) \
- \
+ \
typedef struct { \
- QQ_CONTAINER Container; \
- PQQ_ENTRY EntryBuffer[_QUEUE_SIZE]; \
+ QQ_CONTAINER Container; \
+ PQQ_ENTRY EntryBuffer[_QUEUE_SIZE]; \
} _QUEUE_TYPE, *P##_QUEUE_TYPE
-
/******************************************************************************/
/* Compilation switches. */
/******************************************************************************/
} /* QQ_InitQueue */
-
/******************************************************************************/
/* Description: */
/* */
} /* QQ_Full */
-
/******************************************************************************/
/* Description: */
/* */
} /* QQ_Empty */
-
/******************************************************************************/
/* Description: */
/* */
} /* QQ_GetSize */
-
/******************************************************************************/
/* Description: */
/* */
} /* QQ_GetEntryCnt */
-
/******************************************************************************/
/* Description: */
/* */
#if !defined(QQ_NO_OVERFLOW_CHECK)
if(Head == pQueue->Tail) {
- return 0;
+ return 0;
} /* if */
#endif /* QQ_NO_OVERFLOW_CHECK */
} /* QQ_PushHead */
-
/******************************************************************************/
/* Description: */
/* */
Tail = pQueue->Tail;
if(Tail == 0) {
- Tail = pQueue->Size;
+ Tail = pQueue->Size;
} /* if */
Tail--;
#if !defined(QQ_NO_OVERFLOW_CHECK)
if(Tail == pQueue->Head) {
- return 0;
+ return 0;
} /* if */
#endif /* QQ_NO_OVERFLOW_CHECK */
} /* QQ_PushTail */
-
/******************************************************************************/
/* Description: */
/* */
#if !defined(QQ_NO_UNDERFLOW_CHECK)
if(Head == pQueue->Tail) {
- return (PQQ_ENTRY) 0;
+ return (PQQ_ENTRY) 0;
} /* if */
#endif /* QQ_NO_UNDERFLOW_CHECK */
if(Head == 0) {
- Head = pQueue->Size;
+ Head = pQueue->Size;
} /* if */
Head--;
} /* QQ_PopHead */
-
/******************************************************************************/
/* Description: */
/* */
#if !defined(QQ_NO_UNDERFLOW_CHECK)
if(Tail == pQueue->Head) {
- return (PQQ_ENTRY) 0;
+ return (PQQ_ENTRY) 0;
} /* if */
#endif /* QQ_NO_UNDERFLOW_CHECK */
} /* QQ_PopTail */
-
/******************************************************************************/
/* Description: */
/* */
{
if(Idx >= atomic_read(&pQueue->EntryCnt))
{
- return (PQQ_ENTRY) 0;
+ return (PQQ_ENTRY) 0;
}
if(pQueue->Head > Idx)
{
- Idx = pQueue->Head - Idx;
+ Idx = pQueue->Head - Idx;
}
else
{
- Idx = pQueue->Size - (Idx - pQueue->Head);
+ Idx = pQueue->Size - (Idx - pQueue->Head);
}
Idx--;
}
-
/******************************************************************************/
/* Description: */
/* */
{
if(Idx >= atomic_read(&pQueue->EntryCnt))
{
- return (PQQ_ENTRY) 0;
+ return (PQQ_ENTRY) 0;
}
Idx += pQueue->Tail;
if(Idx >= pQueue->Size)
{
- Idx = Idx - pQueue->Size;
+ Idx = Idx - pQueue->Size;
}
return pQueue->Array[Idx];
#endif /* QQ_USE_MACROS */
-
#endif /* QUEUE_H */