QP/C
qevt.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 * Product: QP/C
00003 * Last Updated for Version: 4.5.04
00004 * Date of the Last Update:  Feb 92, 2013
00005 *
00006 *                    Q u a n t u m     L e a P s
00007 *                    ---------------------------
00008 *                    innovating embedded systems
00009 *
00010 * Copyright (C) 2002-2013 Quantum Leaps, LLC. All rights reserved.
00011 *
00012 * This program is open source software: you can redistribute it and/or
00013 * modify it under the terms of the GNU General Public License as published
00014 * by the Free Software Foundation, either version 2 of the License, or
00015 * (at your option) any later version.
00016 *
00017 * Alternatively, this program may be distributed and modified under the
00018 * terms of Quantum Leaps commercial licenses, which expressly supersede
00019 * the GNU General Public License and are specifically designed for
00020 * licensees interested in retaining the proprietary status of their code.
00021 *
00022 * This program is distributed in the hope that it will be useful,
00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00025 * GNU General Public License for more details.
00026 *
00027 * You should have received a copy of the GNU General Public License
00028 * along with this program. If not, see <http://www.gnu.org/licenses/>.
00029 *
00030 * Contact information:
00031 * Quantum Leaps Web sites: http://www.quantum-leaps.com
00032 *                          http://www.state-machine.com
00033 * e-mail:                  info@quantum-leaps.com
00034 *****************************************************************************/
00035 #ifndef qevt_h
00036 #define qevt_h
00037 
00047 /****************************************************************************/
00054 #define QP_VERSION      0x4504U
00055 
00056 #ifndef Q_ROM
00057 
00070     #define Q_ROM
00071 #endif
00072 #ifndef Q_ROM_VAR         /* if NOT defined, provide the default definition */
00073 
00088     #define Q_ROM_VAR
00089 #endif
00090 #ifndef Q_ROM_BYTE
00091 
00105     #define Q_ROM_BYTE(rom_var_)   (rom_var_)
00106 #endif
00107 
00108 /****************************************************************************/
00109 #ifndef Q_SIGNAL_SIZE
00110 
00118     #define Q_SIGNAL_SIZE 2
00119 #endif
00120 #if (Q_SIGNAL_SIZE == 1)
00121     typedef uint8_t QSignal;
00122 #elif (Q_SIGNAL_SIZE == 2)
00123 
00133     typedef uint16_t QSignal;
00134 #elif (Q_SIGNAL_SIZE == 4)
00135     typedef uint32_t QSignal;
00136 #else
00137     #error "Q_SIGNAL_SIZE defined incorrectly, expected 1, 2, or 4"
00138 #endif
00139 
00140 /****************************************************************************/
00141 /* typedefs for basic numerical types; MISRA-C 2004 rule 6.3(req).          */
00148 typedef char char_t;
00149 
00151 typedef float float32_t;
00152 
00154 typedef double float64_t;
00155 
00157 typedef int enum_t;
00158 
00159 /****************************************************************************/
00172 typedef struct QEvtTag {
00173     QSignal sig;                          
00174     uint8_t poolId_;                      
00175     uint8_t refCtr_;                                 
00176 } QEvt;
00177 
00178 #ifdef Q_EVT_CTOR            /* Provide the constructor for the QEvt class? */
00179 
00180 QEvt *QEvt_ctor(QEvt * const me, enum_t const sig);
00181 
00182 #endif
00183 
00184 /****************************************************************************/
00191 #define Q_EVT_CAST(class_) ((class_ const *)e)
00192 
00194 #define Q_DIM(array_) (sizeof(array_) / sizeof(array_[0]))
00195 
00204 #define Q_UINT2PTR_CAST(type_, uint_)  ((type_ *)(uint_))
00205 
00206 /****************************************************************************/
00207 #ifndef Q_NQEVENT
00208     typedef QEvt QEvent;          
00209 #endif
00210 
00211 #endif                                                            /* qevt_h */