GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCI / V6-0-0 > lci / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

control.h File Reference

The control functions coordinate the activities of the calibration package. More...

#include "LCI/lci.h"
#include "ITC/ITC_pubdefs.h"

Typedefs

typedef struct
_LCI_controller 
LCI_controller
 Declaration of the opaque controller structure.

Functions

void LCI_abort (void)
 Abort a calibration.
unsigned LCI_calibrate (unsigned latccfg, unsigned lcicfg, unsigned lcirunid, ITC_NodeID iniNode, ITC_TaskID iniTask, ITC_QueueID iniQueue)
 Start a new calibration.
void LCI_cb_statusFree (ITC_QueueItem *qitem, unsigned status, void *prm0, void *prm1, void *prm2, unsigned tx)
unsigned LCI_comp (unsigned comp)
 Set the calibration compression level.
unsigned LCI_cycle (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned len)
unsigned LCI_cycles (void)
 Get the calibration cycle count.
void LCI_deleteController (LCI_controller *cnt)
 Free the calibration controller structure.
unsigned LCI_init (unsigned capacity, unsigned cpuid, unsigned srcid)
 Initialize the calibration system.
unsigned LCI_monitor (unsigned mon)
 Set the calibration monitoring level.
LCI_controllerLCI_newController (unsigned cap, unsigned cpuid, unsigned srcid)
 Create calibration controller structure.
unsigned LCI_start (const TASK_attr *attr)
 Start the LCI task.
unsigned LCI_startCycle (void)
 Request the next calibration cycle.
unsigned LCI_status (void)
 Get the calibration state.
unsigned LCI_terminate (unsigned status)
 Terminate a calibration.


Detailed Description

The control functions coordinate the activities of the calibration package.

Author:
James Swain & Owen Saxton
Id

Function Documentation

void LCI_abort ( void   ) 

Abort a calibration.

This routine is called when an abort calibration telecommand is received. If the current state is calibrating, it changes the state to aborting

unsigned LCI_calibrate ( unsigned  latccfg,
unsigned  lcicfg,
unsigned  lcirunid,
ITC_NodeID  iniNode,
ITC_TaskID  iniTask,
ITC_QueueID  iniQueue 
)

Start a new calibration.

This routine is called when a start calibration telecommand is received. It first uses LATC to perform an initial LAT configuration then peforms a configure, collect, compact, consign cycle for each LCI configuration in the LCI file.

Parameters:
latccfg File ID for the LATC configuration master to use with this calibration
lcicfg File ID for the LCI configuration file to use to drive this calibration
lcirunid Run ID to use in the datagrams
iniNode Node ID of the task that initiated the calibration (used to send a message back when the calibration completes)
iniTask Task ID of the task that initiated the calibration (used to send a message back when the calibration completes)
iniQueue ID of the queue that will receive the status message.
Return values:
LCI_STATE LCI is not in the correct state to start a calibration
ITC_ALOCFAIL Memory allocation failure
ITC_FPAGET Memory allocation from FPA failed
ITC_SENDNID Invalid/unreachable destination node
ITC_SENDQID Invalid/unreachable destination queue
ITC_SHRMEM Shared memory pool stopping/stopped
ITC_SUCCESS If an item is sent to the LCI bulk queue

unsigned LCI_comp ( unsigned  comp  ) 

Set the calibration compression level.

This routine sets the LCI compression level and returns the old value. This feature is used only for testing.

Parameters:
comp Compression level to set
Returns:
Previous compression level

unsigned LCI_cycles ( void   ) 

Get the calibration cycle count.

This rouine returns the number of cycles performed since the last calibration command was issued.

Returns:
Number of cycles performed since the last command to calibrate was issued

void LCI_deleteController ( LCI_controller cnt  ) 

Free the calibration controller structure.

This routine frees all the resources associated with the LCI task.

unsigned LCI_init ( unsigned  capacity,
unsigned  cpuid,
unsigned  srcid 
)

Initialize the calibration system.

This routine performs resource allocation, initializes the ITC message queues, and sets the state to INITIALISED.

Parameters:
srcid ID of the source of data being processed through LCI
cpuid ID of the CPU LCI is being run on
capacity Maximum number of events per calibration cycle.
Returns:
LCI_SUCCESS if all goes well, otherwise one of many errors from LCI (typically LCI_MEMERROR if an allocation fails), PBS, IMM or ITC.

unsigned LCI_monitor ( unsigned  mon  ) 

Set the calibration monitoring level.

This routine sets the LCI monitoring level and returns the old value.

Parameters:
mon Monitoring level to set
Returns:
Previous monitoring level

LCI_controller* LCI_newController ( unsigned  cap,
unsigned  cpuid,
unsigned  srcid 
)

Create calibration controller structure.

This routine allocates memory for an LCI_controller structure and all associated structures.

Parameters:
srcid ID of the source of data being processed through LCI
cpuid ID of the CPU LCI is being run on
cap Capacity of the calibration task, the maximum number of events that can be collected each cycle
Returns:
Pointer to a new LCI_controller

unsigned LCI_start ( const TASK_attr *  attr  ) 

Start the LCI task.

This routine starts the LCI task and waits for it be up and running before setting the state to WAITING.

Parameters:
attr Task attributes to use for the LCI task.
Returns:
Error status code from ITC_startTaskW, LCI_STATE if the state is not INITIALISED, LCI_ATTRIBS if the task attribute pointer is NULL or LCI_SUCCESS if all goes well.

unsigned LCI_startCycle ( void   ) 

Request the next calibration cycle.

This routine is called whenever the next (or first) calibration cycle is to be performed. It puts an empty item to the LCI bulk queue to initiate the cycle. This indirection is needed to allow any abort requests to be processed in a timely manner.

Return values:
LCI_QITEM The attempt to allocate a QueueItem fails
ITC_ALOCFAIL Memory allocation failure
ITC_FPAGET Memory allocation from FPA failed
ITC_SENDNID Invalid/unreachable destination node
ITC_SENDQID Invalid/unreachable destination queue
ITC_SHRMEM Shared memory pool stopping/stopped
ITC_SUCCESS If an item is sent to the LCI bulk queue

!!! KULDGE - ITC won't accept a NULL payload pointer.

unsigned LCI_status ( void   ) 

Get the calibration state.

This routine returns the current state of LCI.

Returns:
Current state of LCI

unsigned LCI_terminate ( unsigned  status  ) 

Terminate a calibration.

This routine finishes out the calibration by sending a status message back to the originating task and setting the state to WAITING.

Parameters:
status Termination status of the last calibration cycle, and hence of the whole calibration
Return values:
LCI_QITEM The attempt to allocate a QueueItem fails
ITC_ALOCFAIL Memory allocation failure
ITC_FPAGET Memory allocation from FPA failed
ITC_SENDNID Invalid/unreachable destination node
ITC_SENDQID Invalid/unreachable destination queue
ITC_SHRMEM Shared memory pool stopping/stopped
ITC_SUCCESS If the item is sent


Generated on Thu Aug 20 14:53:30 2009 by  doxygen 1.5.3