QP-nano
qfn_init.c
Go to the documentation of this file.
00001 /*****************************************************************************
00002 * Product: QF-nano implemenation
00003 * Last Updated for Version: 4.0.05
00004 * Date of the Last Update:  May 05, 2009
00005 *
00006 *                    Q u a n t u m     L e a P s
00007 *                    ---------------------------
00008 *                    innovating embedded systems
00009 *
00010 * Copyright (C) 2002-2009 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 #include "qpn_port.h"                                       /* QP-nano port */
00029 
00030 Q_DEFINE_THIS_MODULE(qfn_init)
00031 
00032 
00038 void QF_init(void) {
00039     QActive *a;
00040     uint8_t p;
00041 
00042     QF_readySet_ = (uint8_t)0;
00043 
00044 #ifdef QK_PREEMPTIVE
00045     QK_currPrio_ = (uint8_t)(QF_MAX_ACTIVE + 1);
00046 
00047 #ifdef QF_ISR_NEST
00048     QK_intNest_ = (uint8_t)0;
00049 #endif
00050 
00051 #ifdef QK_MUTEX
00052     QK_ceilingPrio_ = (uint8_t)0;
00053 #endif
00054 
00055 #endif                                              /* #ifdef QK_PREEMPTIVE */
00056 
00057                                   /* clear all registered active objects... */
00058     for (p = (uint8_t)1; p <= (uint8_t)QF_MAX_ACTIVE; ++p) {
00059         a = (QActive *)Q_ROM_PTR(QF_active[p].act);
00060 
00061         Q_ASSERT(a != (QActive *)0);    /* QF_active[p] must be initialized */
00062         a->head    = (uint8_t)0;
00063         a->tail    = (uint8_t)0;
00064         a->nUsed   = (uint8_t)0;
00065 #if (QF_TIMEEVT_CTR_SIZE != 0)
00066         a->tickCtr = (QTimeEvtCtr)0;
00067 #endif
00068     }
00069 }