nidas  v1.2-1520
Classes | Macros | Enumerations | Functions
irigclock.h File Reference
#include <sys/time.h>
#include "types.h"

Go to the source code of this file.

Classes

struct  timeval32
 
struct  dsm_clock_data
 
struct  dsm_clock_data_2
 
struct  dsm_clock_data_3
 Note that a int64_t has the same size, 8 bytes, as a timeval32. More...
 
struct  dsm_clock_sample
 
struct  dsm_clock_sample_2
 
struct  dsm_clock_sample_3
 
struct  pc104sg_status
 

Macros

#define IRIG_MAX_DT_DIFF   20
 Limits for how many ticks the 100Hz software clock can disagree with the hardware clock before a reset is done. More...
 
#define IRIG_MIN_DT_DIFF   -20
 
#define IRIG_IOC_MAGIC   'I' /* Unique(ish) char for IRIG ioctls */
 User IOCTLs that we support. More...
 
#define IRIG_OPEN   _IO(IRIG_IOC_MAGIC, 0)
 
#define IRIG_CLOSE   _IO(IRIG_IOC_MAGIC, 1)
 
#define IRIG_GET_STATUS   _IOR(IRIG_IOC_MAGIC, 2, struct pc104sg_status)
 
#define IRIG_GET_CLOCK   _IOR(IRIG_IOC_MAGIC, 3, struct timeval32)
 
#define IRIG_SET_CLOCK   _IOW(IRIG_IOC_MAGIC, 4, struct timeval32)
 
#define IRIG_OVERRIDE_CLOCK   _IOW(IRIG_IOC_MAGIC, 5, struct timeval32)
 
#define IRIG_GET_CLOCK64   _IOR(IRIG_IOC_MAGIC, 6, int64_t)
 
#define IRIG_SET_CLOCK64   _IOW(IRIG_IOC_MAGIC, 7, int64_t)
 

Enumerations

enum  irigClockRates {
  IRIG_0_1_HZ, IRIG_1_HZ, IRIG_2_HZ, IRIG_4_HZ,
  IRIG_5_HZ, IRIG_10_HZ, IRIG_20_HZ, IRIG_25_HZ,
  IRIG_50_HZ, IRIG_100_HZ, IRIG_NUM_RATES, IRIG_ZERO_HZ = IRIG_NUM_RATES
}
 Enumeration of the callback rates supported by this module. More...
 

Functions

static enum irigClockRates irigClockRateToEnum (unsigned int value)
 Convert a rate in Hz to an enumerated value, rounding up to the next highest supported rate, if necessary. More...
 
static unsigned int irigClockEnumToRate (enum irigClockRates value)
 Convert an enumerated value back to a rate in Hz. More...
 

Macro Definition Documentation

#define IRIG_CLOSE   _IO(IRIG_IOC_MAGIC, 1)
#define IRIG_GET_CLOCK   _IOR(IRIG_IOC_MAGIC, 3, struct timeval32)
#define IRIG_GET_CLOCK64   _IOR(IRIG_IOC_MAGIC, 6, int64_t)
#define IRIG_GET_STATUS   _IOR(IRIG_IOC_MAGIC, 2, struct pc104sg_status)
#define IRIG_IOC_MAGIC   'I' /* Unique(ish) char for IRIG ioctls */

User IOCTLs that we support.

Referenced by pc104sg_ioctl().

#define IRIG_MAX_DT_DIFF   20

Limits for how many ticks the 100Hz software clock can disagree with the hardware clock before a reset is done.

If the clock difference is within this range, the software clock is slewed by incrementing slower or faster, rather than a step change reset.

Referenced by checkSoftTicker().

#define IRIG_MIN_DT_DIFF   -20
#define IRIG_OPEN   _IO(IRIG_IOC_MAGIC, 0)
#define IRIG_OVERRIDE_CLOCK   _IOW(IRIG_IOC_MAGIC, 5, struct timeval32)
#define IRIG_SET_CLOCK   _IOW(IRIG_IOC_MAGIC, 4, struct timeval32)
#define IRIG_SET_CLOCK64   _IOW(IRIG_IOC_MAGIC, 7, int64_t)

Enumeration Type Documentation

Enumeration of the callback rates supported by this module.

The enumeration values are a simple integer sequence from 0 by 1 rather than the actual rate value because they are used as an index into an array of callback structures.

Enumerator
IRIG_0_1_HZ 
IRIG_1_HZ 
IRIG_2_HZ 
IRIG_4_HZ 
IRIG_5_HZ 
IRIG_10_HZ 
IRIG_20_HZ 
IRIG_25_HZ 
IRIG_50_HZ 
IRIG_100_HZ 
IRIG_NUM_RATES 
IRIG_ZERO_HZ 

Function Documentation

static unsigned int irigClockEnumToRate ( enum irigClockRates  value)
inlinestatic

Convert an enumerated value back to a rate in Hz.

References rate.

static enum irigClockRates irigClockRateToEnum ( unsigned int  value)
inlinestatic

Convert a rate in Hz to an enumerated value, rounding up to the next highest supported rate, if necessary.

This is a rather inefficient function and should only be called at device open or module initialization. We make it inline to avoid "defined but not used" compiler warning. This is called by kernel and user code.

References IRIG_0_1_HZ, IRIG_100_HZ, IRIG_10_HZ, IRIG_1_HZ, IRIG_20_HZ, IRIG_25_HZ, IRIG_2_HZ, IRIG_4_HZ, IRIG_50_HZ, IRIG_5_HZ, and IRIG_NUM_RATES.

Referenced by arinc_ioctl(), mesa_ioctl(), startBoard(), and nidas::dynld::raf::DSMAnalogSensor::validate().