QP/C
qs_.c
Go to the documentation of this file.
00001 /*****************************************************************************
00002 * Product:  QS/C
00003 * Last Updated for Version: 4.4.02
00004 * Date of the Last Update:  Apr 13, 2012
00005 *
00006 *                    Q u a n t u m     L e a P s
00007 *                    ---------------------------
00008 *                    innovating embedded systems
00009 *
00010 * Copyright (C) 2002-2012 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 #include "qs_pkg.h"
00036 
00043 /*..........................................................................*/
00044 void const *QS_smObj_;                    /* local state machine QEP filter */
00045 void const *QS_aoObj_;                     /* local active object QF filter */
00046 void const *QS_mpObj_;                        /* local event pool QF filter */
00047 void const *QS_eqObj_;                         /* local raw queue QF filter */
00048 void const *QS_teObj_;                        /* local time event QF filter */
00049 void const *QS_apObj_;                   /* local object Application filter */
00050 
00051 QSTimeCtr QS_tickCtr_;            /* tick counter for the QS_QF_TICK record */
00052 
00053 /*..........................................................................*/
00054 void QS_u8_(uint8_t d) {
00055     QS_INSERT_ESC_BYTE(d)
00056 }
00057 /*..........................................................................*/
00058 void QS_u16_(uint16_t d) {
00059     QS_INSERT_ESC_BYTE((uint8_t)d)
00060     d >>= 8;
00061     QS_INSERT_ESC_BYTE((uint8_t)d)
00062 }
00063 /*..........................................................................*/
00064 void QS_u32_(uint32_t d) {
00065     QS_INSERT_ESC_BYTE((uint8_t)d)
00066     d >>= 8;
00067     QS_INSERT_ESC_BYTE((uint8_t)d)
00068     d >>= 8;
00069     QS_INSERT_ESC_BYTE((uint8_t)d)
00070     d >>= 8;
00071     QS_INSERT_ESC_BYTE((uint8_t)d)
00072 }
00073 /*..........................................................................*/
00074 void QS_str_(char_t const *s) {
00075     uint8_t b = (uint8_t)(*s);
00076     while (b != (uint8_t)(0)) {
00077                                    /* ASCII characters don't need escaping  */
00078         QS_chksum_ = (uint8_t)(QS_chksum_ + (uint8_t)*s);
00079         QS_INSERT_BYTE((uint8_t)*s)
00080         QS_PTR_INC_(s);
00081         b = (uint8_t)(*s);
00082     }
00083     QS_INSERT_BYTE((uint8_t)0)
00084 }
00085 /*..........................................................................*/
00086 void QS_str_ROM_(char_t const Q_ROM * Q_ROM_VAR s) {
00087     uint8_t b = (uint8_t)Q_ROM_BYTE(*s);
00088     while (b != (uint8_t)0) {
00089                                    /* ASCII characters don't need escaping  */
00090         QS_chksum_ = (uint8_t)(QS_chksum_ + b);
00091         QS_INSERT_BYTE(b)
00092         QS_PTR_INC_(s);
00093         b = (uint8_t)Q_ROM_BYTE(*s);
00094     }
00095     QS_INSERT_BYTE((uint8_t)0)
00096 }