No Blocking on Yesterday’s Embedded CSP Implementation

Øyvind Teig, AFS

- A new fire alarm panel -

- A new fire alarm panel -
Autronica Fire and Security (A UTC Fire and Security Company)
Trondheim, Norway

This paper builds on an earlier paper

"From message queue to ready queue" (also by this author)

Program and architecture wear

After Porto: Errors and Modifications

SDL and this "CHAN_CSP" layer

API and ALT

API functions are all wrapped in macros:
#define CHAN_INIT_F                (CHAN,SENDER,RECEIVER,ALTTAKEN)
#define CHAN_IN_F                  (CHAN,DATA,EVENT)
#define CHAN_IN_VARLEN_F           (CHAN,LEN,DATA,EVENT)
#define ALT_CHAN_IN_F              (GUARD,CHAN,DATA,EVENT,ALTTAKEN)
#define ALT_CHAN_IN_VARLEN_F       (GUARD,CHAN,LEN,DATA,EVENT,ALTTAKEN)
#define ALT_CHAN_IN_ASYNC_SIGNAL_F (GUARD,CHAN,EVENT,ALTTAKEN) 
#define CHAN_OUT_F                 (CHAN,DATA,EVENT)
#define CHAN_OUT_VARLEN_F          (CHAN,LEN,DATA,EVENT)
#define CHAN_OUT_ASYNC_SIGNAL_F    (CHAN,RESCHEDULEME) 
#define CHAN_IN_ASYNC_SIGNAL_F     (CHAN,EVENT)|
#define ALT_TIMER_IN_F             (GUARD,TIME,UNIT,EVENT,ALTSTATE,ALTTAKEN)
#define FSM_RESCHEDULE_F           (EVENT)
Example of an ALT:
case ST_STATE_IN_ALT_200_202_204_301_A:
{
    bool_a alt_taken = FALSE;
    g_ALT_LH         = CHAN_ALT_ENABLED_ON_A;
    CP->Timer_xxx    = CHAN_TIMEOUT_MS;
    Guard_ModifyAny(CP);
    //
    ALT_CHAN_IN_ASYNC_SIGNAL_F (CP->Guard_202i, g_chan_202, S_EVENT_ALT_202_A, &alt_taken);
    ALT_CHAN_IN_ASYNC_SIGNAL_F (CP->Guard_204i, g_chan_204, S_EVENT_ALT_204_A, &alt_taken);
    ALT_CHAN_IN_F              (CP->Guard_200i, g_chan_200, CP->Chan_200i, S_200_A, &alt_taken);
    ALT_CHAN_IN_F              (CP->Guard_301i, g_chan_301, CP->Chan_301i, S_301__A, &alt_taken);
    ALT_TIMER_IN_F             (CP->Guard_Tim, CP->Tim, TU_MS_A, S_TIME_A, &g_ALT_LH &alt_taken);
    //
    CP->State = ST_STATE_IN_ALT_200_202_204_301_END_A;
}
break;

"From message queue to Ready Queue"

Implementing CHAN_CSP in an existing tradition

1.1- Problems with timeouts

1.2 -  Problem with not clearing "first" on all channels

2.1 - Two asynchronous channels

2.2 - Overflow buffer and no asynchronous channel

Conclusions

Links and contact info

Autronica Fire and Security
http://home.no.net/oyvteig/ http://www.autronicafire.com