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

Constituent: pbs     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

WUT.c.vx-ppc-gcc File Reference

WakeUp Timer facility. More...

#include <intLib.h>
#include "PBS/WCT.h"
#include "WCT_pvtdefs.ih"
#include "PBS/PTS.h"
#include "PBS/INT.ih"
#include <vxWorks.h>
#include <excLib.h>
#include <sysLib.h>
#include <tickLib.h>
#include <time.h>
#include "PBI/Unions.h"

Include dependency graph for WUT.c.vx-ppc-gcc:

Include dependency graph

Data Structures

struct  _WCB
 WakeUp Control Block. More...

struct  _WCB_specific
 The platform specific piece of the WUT control structure. More...


Defines

#define WUT_K_MIN_DECREMENT_COUNTER   1
 Smallest value the decrement counter will be set to.

#define WUT_K_MAX_DECREMENT_COUNTER   0x7fffffff
 Largest value the decrement counter will be set to.

#define WUT_K_RESET_TIME_CUSHION   3
 Optimization parameter used by the routine which arms the decrement counter.

#define WUT_A_TIMER_EXCEPTION_VECTOR   0x900
 The address of the decrement counter exception vector.


Typedefs

typedef _WCB_specific WCB_specific
 Typedef for struct _WCB_specific.


Functions

__inline void wut_period_set (unsigned int period)
 Informs VxWorks of a new clock rate.

int wut_sys_shutdown (WCB *wcb)
 Platform specific shutdown procedure.

void WUT_sys_handler (void)
 The facility's internal Interrupt Service Routine.

int get_decrement_counter (void)
 Gets the value of Power PCs internal decrement counter.

void set_decrement_counter (int ctr)
 Sets the Power PCs internal decrement counter to the specified value.

unsigned int calc_decrement_counter (TOV tov)
 Calculates the value to set the decrement counter based on specified timeout value.

void arm_decrement_counter (TOV tov)
 Sets the decrement counter consistent with the specified timeout value.

STATIC int cmp_lt_tov (TOV tov_a, TOV tov_b)
 Platform implementation dependent routine to compare to timeout values.

STATIC int lock_que (WCB *wcb)
 Platform implementation dependent routine to lock the WUT timer que.

STATIC void unlock_que (WCB *wcb, int key)
 Platform implementation dependent routine to unlock the WUT timer que.

STATIC void arm_handler (WCB *wcb, TOV tov)
 Seeds the timer interrupt to handle expire a tov.

STATIC void arm_handler_nxt_wut (WCB *wcb, const WUT_tmr *wut)
 Seeds the timer interrupt to handle expire at the timeout associated with the specified WUT timer entry.

int wut_sys_connect (WCB *wcb)
 Platform dependent part of the WUT system connection process.

int WUT_dec_get ()
 Gets the current time left till the next timer expiration.

WUT_cb_status WUT_keepalive_update (WUT_keepalive_ctx *keepalive, WUT_tmr *wut)
 Simple WUT timer callback routine used to update the WCT clock.

WUT_cb_status WUT_keepalive_rtn (WUT_keepalive_ctx *keepalive, WUT_tmr *wut)
 Simple WUT timer callback routine used to drive the VxWorks system clock.


Variables

WCB Wcb
 Statically allocate control block as a facilty private structure.


Detailed Description

WakeUp Timer facility.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: WUT.c.vx-ppc-gcc,v 1.7 2005/05/12 19:42:58 russell Exp $

The VxWorks implementation of the WakeUp Timers (WUT) facility.


Define Documentation

#define WUT_K_MAX_DECREMENT_COUNTER   0x7fffffff
 

Largest value the decrement counter will be set to.

This parameter is used calc_decrement_counter. This is the minimum/maximu value that the decrement counter will be set to.

#define WUT_K_MIN_DECREMENT_COUNTER   1
 

Smallest value the decrement counter will be set to.

This parameter is by calc_decrement_counter. This is the minimum value that the decrement counter will be set to.

#define WUT_K_RESET_TIME_CUSHION   3
 

Optimization parameter used by the routine which arms the decrement counter.

This parameter is by WUT_cancel to decide if one should reset the decrement counter. If the decrement counter is just about to go off, then resetting may prove futile. remove timer entry from the active queue before the timer entry becomes due. The consequences of removing a timer entry after it is due is simply an extraneous interrupt going off. WUT_sys_handler will notice that the next timer entry is not yet expired and quietly reestablish the decrement counter.

The defined cushion of 3 timer ticks for the removal should allow for the execution of about 10 instructions.


Function Documentation

void arm_decrement_counter TOV  tov  )  [inline, static]
 

Sets the decrement counter consistent with the specified timeout value.

Parameters:
tov The timeout value to set the decrement counter to. The difference between the specified timeout value and the current time is calculated. Since timeout values are not in the same units as the decrement counter, a conversion must made on this result to get it into the proper units.

Here is the call graph for this function:

void arm_handler WCB wcb,
TOV  tov
[inline]
 

Seeds the timer interrupt to handle expire a tov.

Parameters:
wcb The WUT control block
tov The expiration timeout value

Here is the call graph for this function:

void arm_handler_nxt_wut WCB wcb,
const WUT_tmr wut
[inline]
 

Seeds the timer interrupt to handle expire at the timeout associated with the specified WUT timer entry.

Parameters:
wcb The WUT control block
wut The WUT timer entry.

Here is the call graph for this function:

unsigned int calc_decrement_counter TOV  tov  )  [inline, static]
 

Calculates the value to set the decrement counter based on specified timeout value.

Parameters:
tov The timeout value to set the decrement counter to. The difference between the specified timeout value and the current time is calculated. Since timeout values are not in the same units as the decrement counter, a conversion must made on this result to get it into the proper units.
Returns:
The calculated value to set the decrement counter to

Here is the call graph for this function:

int cmp_lt_tov TOV  tov_a,
TOV  tov_b
[inline]
 

Platform implementation dependent routine to compare to timeout values.

Parameters:
tov_a The first of the two timeout values to compare
tov_b The second of the two timeout values to compare
Returns:
non-zero if tov_a < tov_b, else 0

int get_decrement_counter void   )  [inline, static]
 

Gets the value of Power PCs internal decrement counter.

Returns:
The value of the decrement counter.
This is an internal routine only. It provides C language access to the PowerPC instruction mfdec.

int lock_que WCB wcb  )  [inline]
 

Platform implementation dependent routine to lock the WUT timer que.

Parameters:
wcb Pointer to the WUT control block
Returns:
A key to be used to unlock the que.

Here is the call graph for this function:

void set_decrement_counter int  ctr  )  [inline, static]
 

Sets the Power PCs internal decrement counter to the specified value.

Parameters:
ctr The value to set the decrement counter to.
This is an internal routine only. It provides C language access to the PowerPC instruction mtdec.

void unlock_que WCB wcb,
int  key
[inline]
 

Platform implementation dependent routine to unlock the WUT timer que.

Parameters:
wcb Pointer to the WUT control block
key The key used to unlock the que (returned from lock_que()

Here is the call graph for this function:

int WUT_dec_get void   ) 
 

Gets the current time left till the next timer expiration.

This primarily used as a debugging aid.

Here is the call graph for this function:

WUT_cb_status WUT_keepalive_rtn WUT_keepalive_ctx keepalive,
WUT_tmr wut
 

Simple WUT timer callback routine used to drive the VxWorks system clock.

Parameters:
keepalive The keepalive control structure.
wut The WUT timer entry
Return values:
WUT_K_STATE_CHANGE_YES 
VXWORKS Implementation Note
On the PowerPC platform, this routine is used to keep the decrement counter within its limited range, ensuring that no timer entry attempts to seed it with a value beyond it's limits. It is also used to update the VxWork's system clock by calling tickAnnounce().
Return Value
The return value reflects the fact the timer entries state has been changed by the callback routine (its been restarted).

Here is the call graph for this function:

WUT_cb_status WUT_keepalive_update WUT_keepalive_ctx keepalive,
WUT_tmr wut
 

Simple WUT timer callback routine used to update the WCT clock.

Parameters:
keepalive The keepalive control structure.
wut The WUT timer entry
Return values:
WUT_K_STATE_CHANGE_YES 
This routine is used in systems without an external clock, such as the sysAuxClock or the GPS.
The WUT timer entry updates the WCT clock and the timer entry is then requeued with the specified delay relative to it's previous expiration time. This creates a fairly accurate clock.
The return value reflects the fact the timer entries state has been changed by the callback routine (its been restarted).
VXWORKS IMPLEMENTATION NOTE
The VxWork's routine tickAnnounce(), is called to update the VxWork's system clock and WCT clock.

Here is the call graph for this function:

static __inline void wut_period_set unsigned int  period  )  [static]
 

Informs VxWorks of a new clock rate.

Parameters:
period The period, in nanoseconds, that tickAnnounce is being driven

int wut_sys_connect WCB wcb  ) 
 

Platform dependent part of the WUT system connection process.

Parameters:
wcb The WUT control block
Returns:
Status

Here is the call graph for this function:

void WUT_sys_handler void   ) 
 

The facility's internal Interrupt Service Routine.

Warning:
This is not a user callable routine

Here is the call graph for this function:

int wut_sys_shutdown WCB wcb  ) 
 

Platform specific shutdown procedure.

The decrement counter is set to the maximum expiration, effectively providing enough time to restore the original VxWorks exception handler.


Generated on Tue Sep 13 21:49:19 2005 by doxygen 1.3.3