示例#1
0
文件: qkn.c 项目: lwid/openasc
/*..........................................................................*/
static void initialize(void) {
    uint8_t p;
    QActive *a;
                         /* set priorities all registered active objects... */
    for (p = (uint8_t)1; p <= (uint8_t)QF_MAX_ACTIVE; ++p) {
        a = QF_ROM_ACTIVE_GET_(p);
        Q_ASSERT(a != (QActive *)0);    /* QF_active[p] must be initialized */
        a->prio = p;               /* set the priority of the active object */
    }
         /* trigger initial transitions in all registered active objects... */
    for (p = (uint8_t)1; p <= (uint8_t)QF_MAX_ACTIVE; ++p) {
        a = QF_ROM_ACTIVE_GET_(p);
#ifndef QF_FSM_ACTIVE
        QHsm_init(&a->super);                              /* initial tran. */
#else
        QFsm_init(&a->super);                              /* initial tran. */
#endif
    }

    QF_INT_DISABLE();
    QK_currPrio_ = (uint8_t)0;     /* set the priority for the QK idle loop */
    p = QK_schedPrio_();
    if (p != (uint8_t)0) {
        QK_sched_(p);                 /* process all events produced so far */
    }
    QF_INT_ENABLE();
}
示例#2
0
文件: qfn_init.c 项目: lwid/openasc
void QF_init(void) {
    QActive *a;
    uint8_t p;

    QF_readySet_ = (uint8_t)0;

#ifdef QK_PREEMPTIVE
    QK_currPrio_ = (uint8_t)(QF_MAX_ACTIVE + 1);

#ifdef QF_ISR_NEST
    QK_intNest_ = (uint8_t)0;
#endif

#ifdef QK_MUTEX
    QK_ceilingPrio_ = (uint8_t)0;
#endif

#endif                                              /* #ifdef QK_PREEMPTIVE */
                                  /* clear all registered active objects... */
    for (p = (uint8_t)1; p <= (uint8_t)QF_MAX_ACTIVE; ++p) {
        a = QF_ROM_ACTIVE_GET_(p);

        Q_ASSERT(a != (QActive *)0);    /* QF_active[p] must be initialized */
        a->head    = (uint8_t)0;
        a->tail    = (uint8_t)0;
        a->nUsed   = (uint8_t)0;
#if (QF_TIMEEVT_CTR_SIZE != 0)
        a->tickCtr = (QTimeEvtCtr)0;
#endif
    }
}
示例#3
0
文件: qfn_init.c 项目: felis/ICBM
/**
* \description
* This function initializes the internal QF-nano variables as well as all
* registered active objects to zero. In the C startup code compliant with
* the C Standard this clearing of internal variables is unnecessary, because
* all static variables are supposed to be cleared in the startup code.
* However in non-compliant implementations calling QF_init() can be very
* handy.
*
* \note Function QF_init() is defined in the separate module qf_init.c, which
* needs to be included in the build only if the non-standard initialization
* is required.
*/
void QF_init(void) {
    QActive *a;
    uint_fast8_t p;
    uint_fast8_t n;

#ifdef Q_TIMERSET
    for (n = (uint_fast8_t)0; n < (uint_fast8_t)QF_MAX_TICK_RATE; ++n) {
        QF_timerSetX_[n] = (uint_fast8_t)0;
    }
#endif

    QF_readySet_ = (uint_fast8_t)0;

#ifdef QK_PREEMPTIVE
    QK_currPrio_ = (uint_fast8_t)(QF_MAX_ACTIVE + 1);

#ifdef QF_ISR_NEST
    QK_intNest_ = (uint_fast8_t)0;
#endif

#ifndef QK_NO_MUTEX
    QK_ceilingPrio_ = (uint_fast8_t)0;
#endif

#endif /* #ifdef QK_PREEMPTIVE */

    /* clear all registered active objects... */
    for (p = (uint_fast8_t)1; p <= (uint_fast8_t)QF_MAX_ACTIVE; ++p) {
        a = QF_ROM_ACTIVE_GET_(p);

        /* QF_active[p] must be initialized */
        Q_ASSERT_ID(110, a != (QActive *)0);

        a->head    = (uint_fast8_t)0;
        a->tail    = (uint_fast8_t)0;
        a->nUsed   = (uint_fast8_t)0;
#if (QF_TIMEEVT_CTR_SIZE != 0)
        for (n = (uint_fast8_t)0; n < (uint_fast8_t)QF_MAX_TICK_RATE; ++n) {
            a->tickCtr[n] = (QTimeEvtCtr)0;
        }
#endif
    }
}