trick/trick_source/sim_services/Timer/docs/design.dox_in
Alex Lin 19025d77ad Standardize directory names
Reorganized.  Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory.  Created a libexec directory that holds all of the executables that users don't need to execute directly.  Changed all of the executables remaining in bin to start with "trick-".  In the sim_services directories changed all source files to find the Trick headers in their new location.  Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level.  Moved the makefiles, docs, man, and other architecture independent files into a top level share directory.  Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on.

refs #63
2015-06-09 08:44:42 -05:00

93 lines
2.7 KiB
Plaintext

/**
@page LEVEL2 Sleep Timer Design
After all jobs in an execution frame have run, the default behavior (the timer is disabled)
is that the simulation will spin on the clock until real-time has caught up to simulation time.
Enabling the sleep timer gives control to the timer's pause() function, in which it may
release the processor and regain control when the timer elapses.
@section LEVEL3 Base Sleep Timer
The base Timer object provides a common interface for all Timers for the
following functions.
-# Enabling the Timer
-# Disabling the Timer
-# Getting the enabled/disabled status
The base Timer object provides an interface for the following operations. The
base Timer does not implement the following operations.
-# Initializing the Timer hardware
-# Setting the frame time for timer
-# Starting the timer
-# Resetting the timer
-# Pausing for the timer to expire
-# Stopping the timer
-# Shutting down the Timer hardware
@section LEVEL3 ITimer
The ITimer is a Timer object that derives from the the Base Sleep Timer. The
ITimer uses system itimer functionality to allow the simulation to release the
cpu while waiting for the timer to expire. When the itimer expires it uses
the SIGALRM signal to set a semaphore. When the semaphore is set the simulation
wakes up.
The itimer does not expire exactly at the desired period. It actually exipres after
the desired period by up to 1ms. To compensate for the delay we subtract 2ms from
the desired period. The RealtimeSync class "spins" on the clock the remaining
1-2ms the timer does not sleep for.
The ITimer implements the interface laid out by the base Timer class
@section LEVEL4 Initialization
@copydetails Trick::ITimer::init()
Trick::ITimer::init()
@section LEVEL4 Setting the Frame Time
@copydetails Trick::ITimer::set_frame_times()
Trick::ITimer::set_frame_times()
@section LEVEL4 Starting the timer.
@copydetails Trick::ITimer::start()
Trick::ITimer::start()
@section LEVEL4 Restarting the timer.
@copydetails Trick::ITimer::reset()
Trick::ITimer::reset()
@section LEVEL4 Pausing for the Timer to Expire
Pausing for the timer has 2 parts. The first is the signal handler that posts
a semaphore in response to a SIGALRM signal. The signal handler is assigned
to SIGALRM during the initialization routine. The second is the pause routine
that waits for the semaphore to be posted.
@section LEVEL5 Signal Handler
@copydetails Trick::ITimer::it_handler()
Trick::ITimer::it_handler()
@section LEVEL4 Pause for Semaphore
@copydetails Trick::ITimer::pause()
Trick::ITimer::pause()
@section LEVEL4 Stopping the timer.
@copydetails Trick::ITimer::stop()
Trick::ITimer::stop()
@section LEVEL4 Shutting Down the Timer
@copydetails Trick::ITimer::shutdown()
Trick::ITimer::shutdown()
*/