/***************************************************************************** * file: cksetup.c * * Purpose: * * This file creates the Periodic Clock (CK) State Model completely. */ #include #include "olc96fa.h" /* OLC Fall Semester 96 schema input file */ #include "olc3common.h" #include "activeclass.h" #include "activeinstance.h" #include "eventinstance.h" #include "statemodel.h" #include "processevent.h" #include "clock.h" /* ** Periodic TImer (CK) SetUp and Action routines */ PROTOTYPE(extern void CKsetup, (void)) PROTOTYPE(extern void CKAction0, (hcg_key EIid)) PROTOTYPE(extern void CKAction1, (hcg_key EIid)) PROTOTYPE(extern void CKAction2, (hcg_key EIid)) PROTOTYPE(extern void CKAction3, (hcg_key EIid)) /* */ /*======================================================================== * Function Name: CKsetup * * Description: This function creates a Periodic Clock State * Model Completely. An Active Class (AC) and * Active Instance(s) (AI) of the clock are * created. */ FUNCTION( void CKsetup ) { static EventTypeList CKEventTypes[] = { {"CK00", "Initialize Periodic Clock"}, {"CK01", "Wait for Timer (TI) event"}, {"CK02", "Generate Periodic Clock (CK) event"}, {"CK03", "Reset Timer"}}; static StateList CKStates[] = { {"INIT", "CKAction0", CKAction0}, {"WAIT", "CKAction1", CKAction1}, {"GENERATE", "CKAction2", CKAction2}, {"RESET", "CKAction3", CKAction3}}; static StateTransitionList CKTransitions[] = { {"INIT", "INIT", "CK00"}, {"INIT", "WAIT", "CK01"}, {"WAIT", "GENERATE", "CK02"}, {"GENERATE", "RESET", "CK03"}, {"RESET", "WAIT", "CK01"}}; hcg_key CKSMid; hcg_key CKACid; hcg_key CKAIid ; CKSMid = StateModelCreateCompletely("Periodic Clock State Machine", "CK", ARRAY_SIZE(CKEventTypes), CKEventTypes, ARRAY_SIZE(CKStates), CKStates, ARRAY_SIZE(CKTransitions), CKTransitions); CKACid = ActiveClassCreate("Clock Active Class", CKSMid); CKAIid = ActiveInstanceCreate("CK1", CKACid, "INIT"); GenerateClock("CK1","CK1","AI1","T",1); }