GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MSG / V3-1-2 > msg_mt / sun-gcc
#include <PBS/TASK.h>
#include <PBS/WCT.h>
#include <MDB/MDB_pubdefs.h>
#include <MSG/MSG_macdefs.h>
Classes | |
struct | _MSG_InitPrm |
Structure to hold parameters needed by MSG initialization routine. More... | |
struct | _MSG_Message |
Structure to hold an instance of a message. More... | |
struct | _MSG_Counts |
Structure for instrumentation counts. More... | |
Defines | |
#define | MSG_K_FMTBITS ( 2 ) |
N-bits needed to type a substitution. | |
#define | MSG_M_FMTBITS ( ( 1 << MSG_K_FMTBITS ) - 1 ) |
Mask for above. | |
#define | MSG_L_FMTMAX ( 32 / MSG_K_FMTBITS ) |
Maximum number of substitutions. | |
#define | MSG_K_FMTSTRING ( 0 ) |
Conversion type pointer to string. | |
#define | MSG_K_FMT4BINT ( 1 ) |
Conversion type 4-byte integer. | |
#define | MSG_K_FMT8BINT ( 2 ) |
Conversion type 8-byte integer. | |
#define | MSG_K_FMTDOUBLE ( 3 ) |
Conversion type double (any float). | |
#define | MSG_L_FMTLENGTH ( 256 ) |
Maximum length of a formatting string. | |
Typedefs | |
typedef struct _MSG_OutputRtn | MSG_OutputRtn |
Typedef for struct _MSG_OutputRtn. | |
typedef enum _MSG_Level | MSG_Level |
Typedef for enum _MSG_Level. | |
typedef enum _MSG_OutputModes | MSG_OutputModes |
Typedef for enum _MSG_OutputModes. | |
typedef struct _MSG_InitPrm | MSG_InitPrm |
Typedef for struct _MSG_InitPrm. | |
typedef struct _MSG_Message | MSG_Message |
Typedef for struct _MSG_Message. | |
typedef struct _MSG_Counts | MSG_Counts |
Typedef for struct _MSG_Counts. | |
typedef void | MSG_cb_OutputRtn (MSG_OutputModes mode, void *prm, const MSG_Message *msg) |
Signature for a MSG processing callback routine. | |
Enumerations | |
enum | _MSG_Level { MSG_LVL_SUCCESS = 0, MSG_LVL_INFORMATION = 1, MSG_LVL_WARNING = 2, MSG_LVL_ERROR = 3 } |
Enumerate message severity levels. More... | |
enum | _MSG_OutputModes { MSG_OUT_INIT = 0, MSG_OUT_NORMAL = 1, MSG_OUT_EXIT = 2 } |
Enumeration of modes in which output processors can be called. More... | |
Functions | |
unsigned int | MSG_attachOutputRtn (MSG_OutputRtn **handle, MSG_cb_OutputRtn *rtn, void *prm) |
Attach a message output callback routine. | |
unsigned int | MSG_configure (void) |
Configure and start the MSG task. | |
unsigned int | MSG_countsSinceReset (MSG_Counts *cnt, unsigned int rst) |
Return instrumentation counts since last reset. | |
unsigned int | MSG_countsSinceStart (MSG_Counts *cnt) |
Return instrumentation counts since message task started. | |
unsigned int | MSG_detachOutputRtn (MSG_OutputRtn *handle) |
Detach a message callback routine. | |
unsigned int | MSG_initialize (const MSG_InitPrm *prm) |
Take message system from state MSG_S_UNINITIALIZED to state MSG_S_INITIALIZED. | |
MSG_Level | MSG_getLevel (void) |
Get the current reporting level. | |
MSG_Level | MSG_getLevel4Task (void **tbd) |
Get the current reporting level for an arbitrary task. | |
const char * | MSG_getTask (void) |
Return pointer to task name. | |
unsigned short | MSG_getTrace (void) |
Get the current trace buffer number. | |
void | MSG_setCPU (unsigned int cpu) |
Set the CPU identifier word. | |
MSG_Level | MSG_setLevel (MSG_Level level) |
Set the current reporting level. | |
MSG_Level | MSG_setLevel4Task (void **tbd, MSG_Level level) |
Set the current reporting level for an arbitrary task. | |
unsigned int | MSG_setTask (const char *task) |
Set the task name. | |
unsigned short | MSG_setTrace (unsigned short trace) |
Set the current trace buffer number. | |
unsigned int | MSG_shutdown (void) |
Take message system from state MSG_S_INITIALIZED to state MSG_S_UNINITIALIZED. | |
unsigned int | MSG_startTask (const TASK_attr *attr) |
Take message system from state MSG_S_INITIALIZED to state MSG_S_STARTED. | |
unsigned int | MSG_stopTask (void) |
Take message system from state MSG_S_STARTED to state MSG_S_INITIALIZED. |
CVS $Id: MSG_pubdefs.h,v 1.17 2011/03/25 01:05:52 apw Exp $
enum _MSG_Level |
enum _MSG_OutputModes |
Enumeration of modes in which output processors can be called.
Output processors can be called in one of three modes. Note that the pointer to the message structure is only valid during a call in mode MSG_OUT_NORMAL.
unsigned int MSG_attachOutputRtn | ( | MSG_OutputRtn ** | handle, | |
MSG_cb_OutputRtn * | rtn, | |||
void * | prm | |||
) |
Attach a message output callback routine.
handle | (out) Handle for identifying the callback (used to detach) | |
rtn | (in) Routine entry point | |
prm | (in) Routine parameter |
MSG_SUCCESS | Success | |
MSG_BADSTATE | Cannot attach output processors in the current MSG state | |
MSG_ALOCFAIL | Cannot allocate memory for the output routine description |
In the single-threaded version of MSG, the attached routines are called directly by the MSG_report() routine. In the multi-threaded version of MSG the routines are called by the message processing task.
Output processing routines may only be attached/detached when the MSG system is in state MSG_S_INITIALIZED. This is true:
References MSG_mcb, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_S_INITIALIZED, _MSG_Control::mtx, _MSG_Control::out, and _MSG_Control::state.
unsigned int MSG_configure | ( | void | ) |
Configure and start the MSG task.
MSG_ALOCFAIL | Fixed packet allocator (FPA) buffer allocation failed | |
MSG_BADSTATE | Cannot initialize in the current MSG state | |
MSG_CFGNTFND | Configuration database not found | |
MSG_FINDFAIL | Cannot look up up alternate messages in database | |
MSG_FORKFAIL | FORK initialization failed | |
MSG_FPAGFAIL | Fixed packet allocator get failed during task start | |
MSG_FPAIFAIL | Fixed packet allocator (FPA) initialization failed | |
MSG_MUALOCFL | Cannot allocate a mutex | |
MSG_PKT2FEW | Packet count parameter too small | |
MSG_PKT2SMAL | Packet length parameter too small | |
MSG_SUCCESS | Success |
References MSG_initialize(), MSG_setCPU(), MSG_startTask(), _MSG_InitPrm::pkt_cnt, and _MSG_InitPrm::pkt_len.
unsigned int MSG_countsSinceReset | ( | MSG_Counts * | cnt, | |
unsigned int | rst | |||
) |
Return instrumentation counts since last reset.
cnt | MSG_Counts block into which to put the results | |
rst | Reset flag (0 => don't reset, otherwise reset) |
MSG_BADSTATE | Message system not initialized | |
MSG_SUCCESS | Success |
MSG state | MSG task has run at least once | Return code | Contents of instrumentation block |
MSG_S_UNINITIALIZED | n/a | MSG_BADSTATE | All zero |
MSG_S_INITIALIZED | no | MSG_SUCCESS | Fake statistics for a zero length run of the MSG task |
MSG_S_INITIALIZED | yes | MSG_SUCCESS | Statistics from most recent reset to time MSG task stopped |
References countsSince().
unsigned int MSG_countsSinceStart | ( | MSG_Counts * | cnt | ) |
Return instrumentation counts since message task started.
cnt | MSG_Counts block into which to put the results |
MSG_BADSTATE | Message system not initialized | |
MSG_SUCCESS | Success |
MSG state | MSG task has run at least once | Return code | Contents of instrumentation block |
MSG_S_UNINITIALIZED | n/a | MSG_BADSTATE | All zero |
MSG_S_INITIALIZED | no | MSG_SUCCESS | Fake statistics for a zero length run of the MSG task |
MSG_S_INITIALIZED | yes | MSG_SUCCESS | Statistics for the most recent run of the MSG task |
References countsSince().
unsigned int MSG_detachOutputRtn | ( | MSG_OutputRtn * | handle | ) |
Detach a message callback routine.
handle | (in) Handle for identifying the callback (from attach call) |
MSG_SUCCESS | Success | |
MSG_BADSTATE | Cannot detach output processors in the current MSG state | |
MSG_OUTNTFND | Cannot find this output processor on the list |
Output processing routines may only be attached/detached when the MSG system is in state MSG_S_INITIALIZED. This is true
References MSG_mcb, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_S_INITIALIZED, _MSG_Control::mtx, _MSG_OutputRtn::next, _MSG_Control::out, and _MSG_Control::state.
MSG_Level MSG_getLevel | ( | void | ) |
Get the current reporting level.
If called from task level, the level associated with the task is returned. If called from interrupt level, the level associated (globally) with interrupt level is returned.
References _MSG_TaskOption::level, MSG_D_LEVEL, MSG_D_TRACE, _MSG_TaskOption::trace, and _MSG_TaskOption::valid.
Referenced by MSG_reportInternal().
MSG_Level MSG_getLevel4Task | ( | void ** | tbd | ) |
Get the current reporting level for an arbitrary task.
tbd | (in) Pointer to arbitrary task's TBD block |
References _MSG_TaskOption::level, MSG_D_LEVEL, MSG_D_TRACE, _MSG_TaskOption::trace, and _MSG_TaskOption::valid.
const char* MSG_getTask | ( | void | ) |
Return pointer to task name.
ISR>
.
UND>
. Referenced by MSG_outputScan(), and MSG_reportInternal().
unsigned short MSG_getTrace | ( | void | ) |
Get the current trace buffer number.
If called from task level, the trace buffer number associated with the task is returned. If called from interrupt level, the trace buffer number associated (globally) with interrupt level is returned.
References _MSG_TaskOption::level, MSG_D_LEVEL, MSG_D_TRACE, _MSG_TaskOption::trace, and _MSG_TaskOption::valid.
Referenced by MSG_outputScan(), and MSG_reportInternal().
unsigned int MSG_initialize | ( | const MSG_InitPrm * | prm | ) |
Take message system from state MSG_S_UNINITIALIZED to state MSG_S_INITIALIZED.
prm | (in) Parameter block contining initialization information (note 1) |
NULL
, MSG_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 MSG_InitPrm structure persistent.MSG_ALOCFAIL | Fixed packet allocator (FPA) buffer allocation failed | |
MSG_BADSTATE | Cannot initialize in the current MSG state | |
MSG_FINDFAIL | Cannot look up up alternate messages in database | |
MSG_FPAIFAIL | Fixed packet allocator (FPA) initialization failed | |
MSG_MUALOCFL | Cannot allocate a mutex | |
MSG_PKT2FEW | Packet count parameter too small | |
MSG_PKT2SMAL | Packet length parameter too small | |
MSG_SUCCESS | Success |
References _MSG_Control::acb, _MSG_Counts::beg, _MSG_Control::beg, _MSG_AltMessage::code, _MSG_Control::cpu, _MSG_Counts::drop, _MSG_Control::drp, _MSG_Counts::end, _MSG_Control::end, _MSG_Control::fcb, _MSG_AltMessage::fdb, _MSG_Control::fqi, _MSG_Counts::hwm, _MSG_Counts::lwm, _MSG_Counts::max, _MSG_AltMessage::mdb, _MSG_Control::mem, MSG_alt, MSG_L_ALTERNATE, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_P_RESERVED, MSG_reportInternal(), MSG_RW_DECLARE, MSG_S_INITIALIZED, MSG_S_UNINITIALIZED, _MSG_Control::mtx, _MSG_Control::now, _MSG_Control::out, _MSG_Control::pad, _MSG_Control::pkt_cnt, _MSG_InitPrm::pkt_cnt, _MSG_Control::pkt_len, _MSG_InitPrm::pkt_len, _MSG_Control::reset, _MSG_Counts::run, _MSG_Control::rwi, _MSG_Control::save, _MSG_Counts::sent, _MSG_Control::start, and _MSG_Control::state.
Referenced by MSG_configure().
void MSG_setCPU | ( | unsigned int | cpu | ) |
Set the CPU identifier word.
cpu | (in) CPU identifier |
References _MSG_Control::cpu.
Referenced by MSG_configure().
Set the current reporting level.
newval | (in) Reporting level to be set |
If called from task level, the level associated with the task is set and the task's previous level is returned. If called from interrupt level, the level associated (globally) with interrupt level is set and the level previously in effect at interrupt level is returned.
References _MSG_TaskOption::level, MSG_D_LEVEL, MSG_D_TRACE, MSG_LVL_ERROR, MSG_LVL_SUCCESS, _MSG_TaskOption::trace, and _MSG_TaskOption::valid.
Set the current reporting level for an arbitrary task.
tbd | (in) Pointer to arbitrary task's TBD block | |
newval | (in) Reporting level to be set |
References _MSG_TaskOption::level, MSG_D_LEVEL, MSG_D_TRACE, MSG_LVL_ERROR, MSG_LVL_SUCCESS, _MSG_TaskOption::trace, and _MSG_TaskOption::valid.
unsigned int MSG_setTask | ( | const char * | task | ) |
Set the task name.
task | (in) Pointer to task name |
MSG_SUCCESS | Always |
unsigned short MSG_setTrace | ( | unsigned short | newval | ) |
Set the current trace buffer number.
newval | (in) Trace buffer number to set |
If called from task level, the trace buffer number associated with the task is set and the task's previous trace buffer number is returned. If called from interrupt level, the trace buffer number associated (globally) with interrupt level is set and the trace buffer number previously in effect at interrupt level is returned.
References _MSG_TaskOption::level, MSG_D_LEVEL, MSG_D_TRACE, _MSG_TaskOption::trace, and _MSG_TaskOption::valid.
unsigned int MSG_shutdown | ( | void | ) |
Take message system from state MSG_S_INITIALIZED to state MSG_S_UNINITIALIZED.
MSG_BADSTATE | Cannot shut down in the current MSG state | |
MSG_SUCCESS | Success |
References _MSG_Control::acb, _MSG_Control::fcb, _MSG_Control::mem, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_S_INITIALIZED, MSG_S_UNINITIALIZED, _MSG_Control::mtx, _MSG_OutputRtn::next, _MSG_Control::out, _MSG_Control::save, and _MSG_Control::state.
unsigned int MSG_startTask | ( | const TASK_attr * | attr | ) |
Take message system from state MSG_S_INITIALIZED to state MSG_S_STARTED.
attr | (in) Task attributes block containing task start-up information (note 1) |
NULL
, MSG_startTask() will provide a default. If attr is not NULL
, the caller need not make the storage for the TASK_attr structure persistent.MSG_BADSTATE | Cannot start in the current MSG state | |
MSG_FORKFAIL | FORK initialization failed | |
MSG_FPAGFAIL | Fixed packet allocator get failed during task start | |
MSG_SUCCESS | Success |
In single-threaded mode, MSG_startTask() does not fork a task, and all message processing is done inline with the MSG_report() call. The task attributes block is ignored.
In both modes (and before the task fork in multi-threaded mode), MSG_startTask() calls each of the output processing routines in turn with a flag to indicate an inialization call.
References _MSG_Control::acb, _MSG_Control::beg, _MSG_Control::end, _MSG_Control::fcb, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_OUT_EXIT, MSG_OUT_INIT, MSG_outputScan(), MSG_P_RESERVED, MSG_S_INITIALIZED, MSG_S_STARTED, _MSG_Control::mtx, _MSG_OutputRtn::next, _MSG_Control::out, _MSG_OutputRtn::prm, _MSG_OutputRtn::rtn, _MSG_Control::save, and _MSG_Control::state.
Referenced by MSG_configure().
unsigned int MSG_stopTask | ( | void | ) |
Take message system from state MSG_S_STARTED to state MSG_S_INITIALIZED.
MSG_BADSTATE | Cannot stop in the current MSG state | |
MSG_SUCCESS | Success |
In single-threaded mode, there is no forked task to run down.
In both modes (and after the forked task has run down in multi-threaded mode), MSG_stopTask() calls each of the output processing routines in turn with a flag to indicate a cleanup call.
References _MSG_Control::acb, _MSG_Control::beg, _MSG_Counts::end, _MSG_Control::end, _MSG_Control::fcb, _MSG_Control::fqi, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_OUT_EXIT, MSG_S_INITIALIZED, MSG_S_STARTED, MSG_S_STOPPING, _MSG_Control::mtx, _MSG_OutputRtn::next, _MSG_Control::now, _MSG_Control::out, _MSG_Control::pkt_cnt, _MSG_OutputRtn::prm, _MSG_Control::reset, _MSG_OutputRtn::rtn, _MSG_Counts::run, _MSG_Control::save, _MSG_Control::start, and _MSG_Control::state.