GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > EMSG / V0-0-3

Constituent: emsg_mt     Tag: i845e


Interface   Data Structures   File List   Data Fields   Globals  

EMSG_control.c File Reference

Routines to handle all control aspects of the message system. More...

#include <stdlib.h>
#include <string.h>
#include "PBS/MBA.h"
#include "PBS/FPA.h"
#include "EMSG/EMSG_msgs.h"
#include "EMSG_prvdefs.h"

Include dependency graph for EMSG_control.c:


Functions

unsigned int EMSG_countsSinceReset (EMSG_Counts *cnt, unsigned int rst)
 Return instrumentation counts since last reset.
unsigned int EMSG_countsSinceStart (EMSG_Counts *cnt)
 Return instrumentation counts since message task started.
unsigned int EMSG_initialize (const EMSG_InitPrm *prm)
 Initialize the message system.
unsigned int EMSG_shutdown (void)
 Shut down the message system.
unsigned int EMSG_startTask (void)
 Start the message task.
unsigned int EMSG_stopTask (void)
 Stop the message task.

Variables

EMSG_ControlEMSG_mcb = &mcb
 Pointer to the control block for the message system.
EMSG_AltMessage EMSG_alt [EMSG_L_ALTERNATE]
 Translation table for the eight "special" messages.

Detailed Description

Routines to handle all control aspects of the message system.

This file contains all the routines needed to initialize, start up, stop and shut down the error message system.

Author:
A.P.Waite & Owen H Saxton
Id
EMSG_control.c,v 1.2 2006/02/28 20:45:30 saxton Exp

Function Documentation

unsigned int EMSG_countsSinceReset EMSG_Counts cnt,
unsigned int  rst
 

Return instrumentation counts since last reset.

Parameters:
cnt Counts block into which to put the results
rst Reset flag (0 => don't reset, otherwise reset)
Return values:
EMSG_BADSTATE Message system not initialized
EMSG_SUCCESS Success
This routine returns an instrumentation block giving (bread and butter case) message counts and high and low water marks for packet usage since the last reset. This makes sense while the message task is running. The following table gives details of what's returned when the message task is not running.

MSG state MSG task has run at least once Return code Contents of instrumentation block
EMSG_S_UNINITIALIZED n/a EMSG_BADSTATE All zero
EMSG_S_INITIALIZED no EMSG_SUCCESS Fake statistics for a zero length run of the msg task
EMSG_S_INITIALIZED yes EMSG_SUCCESS Statistics from most recent reset to time msg task stopped

unsigned int EMSG_countsSinceStart EMSG_Counts cnt  ) 
 

Return instrumentation counts since message task started.

Parameters:
cnt Counts block into which to put the results
Return values:
EMSG_BADSTATE Message system not initialized
EMSG_SUCCESS Success
This routine returns an instrumentation block giving (bread and butter case), message counts and high and low water marks for packet usage since the message task was started. This makes sense while the message task is running. The following table gives details of what's returned when the message task is not running.

MSG state MSG task has run at least once Return code Contents of instrumentation block
EMSG_S_UNINITIALIZED n/a EMSG_BADSTATE All zero
EMSG_S_INITIALIZED no EMSG_SUCCESS Fake statistics for a zero length run of the msg task
EMSG_S_INITIALIZED yes EMSG_SUCCESS Statistics for the most recent run of the msg task

unsigned int EMSG_initialize const EMSG_InitPrm prm  ) 
 

Initialize the message system.

This routine initializes the message system according to the parameters provided in the parameterization block.

Parameters:
prm (in) Parameter block contining initialization information (note 1)
Note:
  1. If prm is NULL, EMSG_initialize() will provide a default (currently 32 message packets of 256 bytes each). If prm is not NULL, the caller need not make the storage for the EMSG_InitPrm structure persistent.
Return values:
EMSG_ALOCFAIL Fixed packet allocator (FPA) buffer allocation failed
EMSG_BADSTATE Cannot initialize in the current MSG state
EMSG_FINDFAIL Cannot look up up alternate messages in database
EMSG_FPAIFAIL Fixed packet allocator (FPA) initialization failed
EMSG_MUALOCFL Cannot allocate a mutex
EMSG_PKT2FEW Packet count parameter too small
EMSG_PKT2SMAL Packet length parameter too small
EMSG_SUCCESS Success

unsigned int EMSG_shutdown void   ) 
 

Shut down the message system.

This routine detaches all attached output processors and frees all resources associated with the message system.

Return values:
EMSG_BADSTATE Cannot shut down in the current state
EMSG_SUCCESS Success

unsigned int EMSG_startTask void   ) 
 

Start the message task.

In multi-threaded mode, this routine spawns a task (with the attributes defined in the task attributes block passed into this routine) to receive and process messages.

In single-threaded mode, it does not spawn a task, and all message processing is done inline with the report call. The task attributes block is ignored.

In both modes (and before the task spawn in multi-threaded mode), this routine calls each of the output processing routines in turn with a flag to indicate an inialization call.

Warning:
Message believes it owns its own task name and will overwrite a task name provided by the caller.
Return values:
EMSG_BADSTATE Cannot start in the current message state
EMSG_SPWNFAIL Message task spawn failed
EMSG_SUCCESS Success

unsigned int EMSG_stopTask void   ) 
 

Stop the message task.

In multi-threaded mode, EMSG_stopTask() runs down the task spawned in EMSG_startTask() and releases the resources associated with it.

In single-threaded mode, there is no spawned task to run down.

In both modes (and after the spawned task has run down in multi- threaded mode), EMSG_stopTask() calls each of the output processing routines in turn with a flag to indicate a cleanup call.

Return values:
EMSG_BADSTATE Cannot stop in the current message state
EMSG_SUCCESS Success


Variable Documentation

EMSG_AltMessage EMSG_alt[EMSG_L_ALTERNATE]
 

Initial value:

                 { { EMSG_UNKNOWNS, NULL, NULL },
                   { EMSG_UNKNOWNW, NULL, NULL },
                   { EMSG_UNKNOWNI, NULL, NULL },
                   { EMSG_UNKNOWNE, NULL, NULL },
                   { EMSG_UNIXGOOD, NULL, NULL },
                   { EMSG_UNIXEROR, NULL, NULL },
                   { EMSG_GAPBEGIN, NULL, NULL },
                   { EMSG_GAPEND,   NULL, NULL } }
Translation table for the eight "special" messages.


Generated on Thu Mar 8 09:41:29 2007 by  doxygen 1.4.4