#ifndef RTINIT_H
#define RTINIT_H

/******************************************************************************/
/******************************************************************************/
/*****************     Copyright 2004, 2005 Chronolytics Inc.   ***************/
/*****************     All Rights Reserved                      ***************/
/******************************************************************************/
/******************************************************************************/

static volatile const char __attribute__ ((unused)) rcsid_RTINIT_H[] = "$Id: RTInit.h,v 1.3 2005/08/20 21:39:25 dave Exp $";

#include <RTMagic.h>

#define RTInit_MAGIC MAGIC("Init")


/*
**
**  PRIMORDIAL means before logging, parser registration, etc.
**  Allocation is available as well as Linux API
**
**  PRETASKING means that logging, parser registration, RTInit callbacks
**  are all available.  ReactiveTasking and ReactiveResponse are not 
**  available.
** 
**  POSTTASKING mean that the Chronolytix tasking system is in place.
**  Timers, Async Logging, etc. are initialized in this phase.
**
**  CORECOMPLETE means that core initialization is complete prior to module
**  loading.
**
**  APPLICATION_INIT_1 to APPLICATION_INIT_9 mean that the rc script has 
**  completed and application initialization level n may run.  The Chronolytix
**  systems gives these inits entirely to the target application.
** 
*/


enum RTInitEpoch {  

   PRIMORDIAL,
   PRE_TASKING,
   POST_TASKING,
   CORE_COMPLETE,
   APPLICATION_INIT_1,
   APPLICATION_INIT_2,
   APPLICATION_INIT_3,
   APPLICATION_INIT_4,
   APPLICATION_INIT_5,
   APPLICATION_INIT_6,
   APPLICATION_INIT_7,
   APPLICATION_INIT_8,
   APPLICATION_INIT_9,
   __UNUSED_LAST
};

typedef int (*RTInitCallBack)(enum RTInitEpoch requested_epoch);
typedef int (*RTInitFunction)(void);

int RTInit_Register(enum RTInitEpoch epoch, RTInitCallBack init);

   /* for modules, etc. callback may be at later epoch that requested */
enum RTInitEpoch RTInit_Epoch(void);  /* current epoch (may not be requested) */
void RTInit_RunLevel(enum RTInitEpoch epoch);  /* run this epoch's callbacks */


#endif /* RTINIT_H */


