|
QP/C
|
00001 /***************************************************************************** 00002 * Product: QF/C 00003 * Last Updated for Version: 4.0.00 00004 * Date of the Last Update: Apr 05, 2008 00005 * 00006 * Q u a n t u m L e a P s 00007 * --------------------------- 00008 * innovating embedded systems 00009 * 00010 * Copyright (C) 2002-2008 Quantum Leaps, LLC. All rights reserved. 00011 * 00012 * This software may be distributed and modified under the terms of the GNU 00013 * General Public License version 2 (GPL) as published by the Free Software 00014 * Foundation and appearing in the file GPL.TXT included in the packaging of 00015 * this file. Please note that GPL Section 2[b] requires that all works based 00016 * on this software must also be made publicly available under the terms of 00017 * the GPL ("Copyleft"). 00018 * 00019 * Alternatively, this software may be distributed and modified under the 00020 * terms of Quantum Leaps commercial licenses, which expressly supersede 00021 * the GPL and are specifically designed for licensees interested in 00022 * retaining the proprietary status of their code. 00023 * 00024 * Contact information: 00025 * Quantum Leaps Web site: http://www.quantum-leaps.com 00026 * e-mail: info@quantum-leaps.com 00027 *****************************************************************************/ 00028 #ifndef qequeue_h 00029 #define qequeue_h 00030 00043 #ifndef QF_EQUEUE_CTR_SIZE 00044 00053 #define QF_EQUEUE_CTR_SIZE 1 00054 #endif 00055 #if (QF_EQUEUE_CTR_SIZE == 1) 00056 00063 typedef uint8_t QEQueueCtr; 00064 #elif (QF_EQUEUE_CTR_SIZE == 2) 00065 typedef uint16_t QEQueueCtr; 00066 #elif (QF_EQUEUE_CTR_SIZE == 4) 00067 typedef uint32_t QEQueueCtr; 00068 #else 00069 #error "QF_EQUEUE_CTR_SIZE defined incorrectly, expected 1, 2, or 4" 00070 #endif 00071 00072 /****************************************************************************/ 00116 typedef struct QEQueueTag { 00128 QEvent const *frontEvt; 00129 00132 QEvent const **ring; 00133 00137 QEQueueCtr end; 00138 00141 QEQueueCtr head; 00142 00145 QEQueueCtr tail; 00146 00149 QEQueueCtr nFree; 00150 00157 QEQueueCtr nMin; 00158 } QEQueue; 00159 00160 /* public methods */ 00161 00171 void QEQueue_init(QEQueue *me, QEvent const *qSto[], QEQueueCtr qLen); 00172 00183 void QEQueue_postFIFO(QEQueue *me, QEvent const *e); 00184 00197 void QEQueue_postLIFO(QEQueue *me, QEvent const *e); 00198 00209 QEvent const *QEQueue_get(QEQueue *me); 00210 00222 #define QEQueue_getNFree(me_) ((me_)->nFree) 00223 00224 /* friend class QF */ 00225 /* friend class QActive */ 00226 00227 #endif /* qequeue_h */ 00228
1.7.6.1