GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBS / V2-12-2 > pbs / rad750
#include <PBS/TOV.h>
#include <PBS/WUT_cb.h>
Defines | |
#define | WUT_INIT(_wut) (_wut)->state = WUT_K_ALLOCATED |
Initializes a user allocated timer for use. | |
Typedefs | |
typedef enum _WUT_state | WUT_state |
Typedef for enum _WUT_state. | |
Enumerations | |
enum | _WUT_state { WUT_K_FREE = -2, WUT_K_ACTIVE = -1, WUT_K_QUEUED = 0, WUT_K_ALLOCATED = 1, WUT_K_CANCELLED = 2, WUT_K_EXPIRED = 3 } |
Enumerate the possible states of a WakeUp Timer entry. More... | |
Functions | |
int | WUT_sys_adjust (long long int dnsecx) |
Adjusts all the current entries on the WUT timer que in response to a change in the base time. | |
int | WUT_sys_init (int count) |
One time WUT services initialization routine. | |
int | WUT_sys_connect (unsigned int keepalive, unsigned int update) |
One time WUT connection routine to start WUT system. | |
int | WUT_sys_reset (unsigned int keepalive, unsigned int update) |
Resets the keepalive and update times. | |
int | WUT_sys_shutdown (void) |
Shuts down the WUT routine. | |
WUT_state | WUT_cancel (WUT_tmr *wut) |
Cancels a WUT timer entry. | |
WUT_tmr * | WUT_create (void) |
Allocate a WUT timer entry. | |
WUT_state | WUT_expire (WUT_tmr *wut) |
Marks a wut timer as expire. | |
WUT_state | WUT_destroy (WUT_tmr *wut) |
Destroys, ie frees, an unused WUT timer entry. | |
WUT_state | WUT_restart (WUT_tmr *wut, register TOV tov) |
Restarts a WUT timer entry. | |
WUT_state | WUT_start (WUT_tmr *wut, register TOV tov, WUT_cb_routine cb, void *prm) |
Establishes and starts a WUT timer entry. | |
WUT_state | WUT_state_get (const WUT_tmr *wut) |
Gets the current state of the WUT timer entry. | |
TOV | WUT_tov_get (const WUT_tmr *wut) |
Gets the current TOV of the WUT timer entry. | |
int | WUT_dec_get (void) |
Gets the current time left till the next timer expiration. | |
unsigned int | WUT_frequency (void) |
Gets frequency, in Hertz of the WUT clock. |
CVS $Id: WUT.h,v 1.8 2011/03/24 23:05:44 apw Exp $
Interface file for the WakeUp Timer interrupt facility.
#define WUT_INIT | ( | _wut | ) | (_wut)->state = WUT_K_ALLOCATED |
Initializes a user allocated timer for use.
_wut | A pointer to the user timer to initialize |
Referenced by TASK_wait().
Typedef for enum _WUT_state.
The ownership of a timer handle is divided into two pieces.
When the value of the state is >= WUT_K_ALLOCATED, the user has ownership of the WUT timer handle. When the user has ownership of the WUT timer handle, it's state will not change except by user request. The user is allowed to request state changes, for example, by WUT_cancel, but there is no guarantee that these state changes will be granted.
When the value of the state is < WUT_K_ALLOCATED, the WUT services have ownership of the WUT handle. When the WUT services have ownership, the state may spontaneously change due to WUT activity.
enum _WUT_state |
Cancels a WUT timer entry.
wut | The WUT timer entry to cancel |
References arm_handler_nxt_wut(), _WCB::com, _Q_node::flnk, get_wut(), has_key(), lock_que(), _WUT_tmr::node, _Q_head::node, Q__unlink(), _WCB_common::que, remove_key(), _WUT_tmr::state, unlock_que(), Wcb, WUT_K_CANCELLED, and WUT_K_QUEUED.
Referenced by RW__tmr_destroy(), and TASK_wait().
WUT_tmr * WUT_create | ( | void | ) |
Allocate a WUT timer entry.
References _WCB::com, _WCB_common::fcb, FPA_get(), _WUT_tmr::state, Wcb, and WUT_K_ALLOCATED.
int WUT_dec_get | ( | void | ) |
Gets the current time left till the next timer expiration.
This primarily used as a debugging aid.
References get_decrement_counter().
Destroys, ie frees, an unused WUT timer entry.
wut | The WUT timer entry to destroy |
References _WCB::com, _WCB_common::fcb, FPA_free(), has_key(), remove_key(), _WUT_tmr::state, Wcb, WUT_K_ALLOCATED, and WUT_K_FREE.
Marks a wut timer as expire.
wut | The WUT timer entry to expire |
This call is necessary on platforms on POSIX platforms that do not support task priorities. On these platforms, the WUT timer cannot be protected by having the callback routine run in a higher priority thread. This means that WUT driver servicing the timer que cannot touch the WUT timer after the user's callback has been called. If this were allowed, there is a possibility that as soon as the user calls his synchronization routine, the thread waiting on that synchronization mechanism can begin execution. In that case, the user would make the reasonable assumption that the WUT timer handle is no longer property of the WUT facility. This call effectively declares to the WUT timer entry is no longer property of the WUT facility.
References has_key(), remove_key(), _WUT_tmr::state, and WUT_K_EXPIRED.
unsigned int WUT_frequency | ( | void | ) |
Gets frequency, in Hertz of the WUT clock.
References PTS_frequency().
Restarts a WUT timer entry.
wut | The WUT timer entry to restart. | |
tov | The timeout value. |
References add_wut(), has_key(), remove_key(), _WUT_tmr::state, and WUT_K_ALLOCATED.
Referenced by WUT_keepalive_rtn(), and WUT_keepalive_update().
WUT_state WUT_start | ( | WUT_tmr * | wut, | |
register TOV | tov, | |||
WUT_cb_routine | cb, | |||
void * | prm | |||
) |
Establishes and starts a WUT timer entry.
wut | The WUT timer entry to restart. | |
tov | The timeout value | |
cb | The address of the WUT timer entry's callback service routine. | |
prm | A user parameter passed transparently through to the timer entry's callback service routine |
References add_wut(), _WUT_tmr::cb, has_key(), _WUT_tmr::prm, remove_key(), _WUT_tmr::state, and WUT_K_ALLOCATED.
Referenced by RW__tmr_wait(), and TASK_wait().
Gets the current state of the WUT timer entry.
wut | The WUT timer entry to get the state for. |
References remove_key(), and _WUT_tmr::state.
Referenced by RW__tmr_wait().
int WUT_sys_adjust | ( | long long int | dnsecx | ) |
Adjusts all the current entries on the WUT timer que in response to a change in the base time.
dnsecx | The number of nanoseconds to shift the timer que entries by. |
It is assumed that interrupts are locked during the course of this execution.
References _WCB::com, _Q_node::flnk, get_wut(), _Q_head::node, _WCB_common::que, _WUT_tmr::tov, TOV_K_FOREVER, and Wcb.
int WUT_sys_connect | ( | unsigned int | keepalive, | |
unsigned int | update | |||
) |
One time WUT connection routine to start WUT system.
keepalive | The timeout period, in nsecs, to run the keepalive timer. | |
update | The update period. If non-zero, the WCT clock will be updated at this rate. If 0, then WCT clock will be update externally. |
It also has another role, that of making sure that no timer ISR becomes active 'too far' from the last update of the system clock. This means that value one places in the decrement counter is never very large. Imagine that no keepalive timer ISR existed and the user requested a wakeup timer 1 day from now. When the timer was requested, WUT would calculate the number of decrement counter ticks until expiration. Two bad things happen without the keepalive:
By providing a keepalive counter in 50-100Hz range, problem 1 is avoided, and problem 2 is lessened. The extrapolation error can be no more than that accumulated in the time period between wall clock updates. Since it is expected that the GPS time will update the wall clock at a 1Hz and the short term processor clock stability is about 10-6 to 10-5, the extrapolation error 1-10usecs.
References _WUT_tmr::cb, _WCB::com, _WUT_keepalive::ctx, _WUT_keepalive_ctx::elapsed, _WCB_common::keepalive, _WUT_tmr::node, _WUT_keepalive_ctx::period, _WUT_tmr::prm, Q_insert(), _WCB_common::que, _WUT_tmr::state, _WCB_common::terminator, _WUT_keepalive::tmr, _WUT_tmr::tov, TOV_from_nsecs(), TOV_K_FOREVER, _WUT_keepalive_ctx::update, Wcb, WUT_K_QUEUED, WUT_keepalive_rtn(), WUT_keepalive_update(), and wut_sys_connect().
Referenced by PBS_initialize2().
int WUT_sys_init | ( | int | count | ) |
One time WUT services initialization routine.
count | The number of available timer entries |
References _WCB_common::cnt, _WCB::com, _WCB_common::fcb, FPA_fcb_sizeof(), FPA_init(), FPA_K_PCB_AT_EOP, FPA_K_TYPE_PENDING_FIFO, init_wut(), MBA_alloc(), Q_init(), _WCB_common::que, Wcb, and wut_spc_init().
Referenced by PBS_initialize2().
int WUT_sys_reset | ( | unsigned int | keepalive, | |
unsigned int | update | |||
) |
Resets the keepalive and update times.
keepalive | The timeout period, in nsecs, to run the keepalive timer. One values is recognized as special
| |
update | The new update period (in nanoseconds). Three values are recognized
|
References _WUT_tmr::cb, _WCB::com, _WUT_keepalive::ctx, _WCB_common::keepalive, _WUT_keepalive_ctx::period, _WUT_keepalive::tmr, _WUT_keepalive_ctx::update, Wcb, WUT_keepalive_rtn(), WUT_keepalive_update(), and wut_period_set().
int WUT_sys_shutdown | ( | void | ) |
Shuts down the WUT routine.
References _WCB::com, _WCB_common::fcb, MBA_free(), Wcb, and wut_sys_shutdown().
Referenced by PBS_shutdown().
Gets the current TOV of the WUT timer entry.
wut | The WUT timer entry to get the TOV for. |
References remove_key(), and _WUT_tmr::tov.