GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > PBS / V2-10-5

Constituent: pbs     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

WCT.c.vx-xxx-xxx File Reference

Implementation file for the WCT (Wall Clock Time) facility for VXWORK's platform. More...

#include <sysLib.h>
#include <timers.h>
#include "PBS/TSS.h"
#include "PBS/FFS.ih"
#include "PBS/WCT.h"
#include "PBS/PTS.h"
#include "PBS/LSU.h"
#include "PBS/INT.ih"
#include "WCT_pvtdefs.h"

Include dependency graph for WCT.c.vx-xxx-xxx:

Include dependency graph

Functions

WCT_time WCT_get (void)
 Retrieves the current time in absolute time units.

long long int WCT_set (register WCT_time atime, unsigned int ptime, unsigned int aticks, unsigned int pticks)
 Sets both the absolute time and the information needed to convert back and forth from WCT_atick and WCT_ptick.

void WCT_announce (unsigned int elapsed)
 Announce that elapsed absolute time ticks have elapsed.

unsigned int WCT_update (void)
 Reset the time bases that tie the PTIME and ATIME.


Variables

_WCT Wct
 The global control structure for WCT.


Detailed Description

Implementation file for the WCT (Wall Clock Time) facility for VXWORK's platform.

Author:
JJRussell - russell@slac.stanford.edu

    CVS $Id: WCT.c.vx-xxx-xxx,v 1.6 2005/05/12 19:42:58 russell Exp $

Function Documentation

void WCT_announce unsigned int  elapsed  ) 
 

Announce that elapsed absolute time ticks have elapsed.

Parameters:
elapsed The number of absolute time ticks that have elapsed since the last update.
Warning:
This is not part of the PBS public interface. It is a PBS private routine.

WCT_time WCT_get void   ) 
 

Retrieves the current time in absolute time units.

This routine is coded to be a cheap call on the PowerPC, involving less than 20 cycles. Other implementations may be more expensive.

Here is the call graph for this function:

long long int WCT_set register WCT_time  atime,
unsigned int  ptime,
unsigned int  aticks,
unsigned int  pticks
 

Sets both the absolute time and the information needed to convert back and forth from WCT_atick and WCT_ptick.

Returns:
The adjustment time in absolute ticks.
This is a call-back routine to announce a precise time and the provide the numbers needed to convert absolute ticks to and from processor ticks. It is expected that this routine will be called from an ISR routine and, so is coded to obey the rules of an ISR.
The natural example is in the context of the 1 PPS interrupt. When the 1 PPS interrupt is received, the processor clock is read and the absolute time is retrieved from the most recent GPS message. The elapsed time in both absolute ticks and processor ticks since the last 1PPS message are the last two arguments.
Note that this routine does not assume that it being called at 1 second intervals or even regular intervals. The interface does not prohibit the caller from violating the three rules of a good clock. It is the responsibility of the caller to be a good citizen. Arthimetic limitations make it unsafe to call it at intervals longer than this.
If the time shift is very large, as in the case when the system has been running a while before the absolute time can be established, one may wish to use the return value to adjust times in other components of the system. The most notable example would be to adjust the expiration time in the WUT timer que entries.

Here is the call graph for this function:

unsigned int WCT_update void   ) 
 

Reset the time bases that tie the PTIME and ATIME.

This is a simplified version of WCT_set. However, whereas WCT_set adjusts both the time base and the frequency, this routine only adjusts the only time bases to the current time without changing the frequency. It is primarily meant to be used in an environment where there is no external clock/time source and is needed to keep the time conversion scaling parameters from causing an overflow.
Warning:
Since this routine resets the scaling parameters, it must be called under conditions which ensure that the scaling parameters are not being modified by another thread of execution. Typically the easiest way to ensure this condition is to lock the interrupts around the call to WCT_update. A design choice was made to not have this routine do the locking for two reasons
  1. The user may have a better way to ensure this
  2. The most natural calling of this routine will occur within the context of a WUT ISR, i.e. interrrupts are already locked.

Here is the call graph for this function:


Variable Documentation

struct _WCT Wct
 

The global control structure for WCT.

This variable must be exposed to allow the inline implementation of the conversion routines. No other routine within the package should access this structure.


Generated on Tue Sep 13 21:47:53 2005 by doxygen 1.3.3