nidas  v1.2-1520
Macros | Functions
nidas_util.c File Reference
#include <nidas/linux/util.h>
#include <nidas/linux/klog.h>
#include <nidas/linux/Revision.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/uaccess.h>

Macros

#define REPO_REVISION   "unknown"
 

Functions

 MODULE_AUTHOR ("Gordon Maclean <maclean@ucar.edu>")
 
 MODULE_DESCRIPTION ("NCAR nidas utilities")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (REPO_REVISION)
 
int alloc_dsm_circ_buf (struct dsm_sample_circ_buf *c, size_t dlen, int blen)
 
void free_dsm_circ_buf (struct dsm_sample_circ_buf *c)
 
int realloc_dsm_circ_buf (struct dsm_sample_circ_buf *c, size_t dlen, int blen)
 
void init_dsm_circ_buf (struct dsm_sample_circ_buf *c)
 
ssize_t nidas_circbuf_read_nowait (struct file *filp, char __user *buf, size_t count, struct dsm_sample_circ_buf *cbuf, struct sample_read_state *state)
 
ssize_t nidas_circbuf_read (struct file *filp, char __user *buf, size_t count, struct dsm_sample_circ_buf *cbuf, struct sample_read_state *state, wait_queue_head_t *readq)
 
static void __exit nidas_util_cleanup (void)
 
static int __init nidas_util_init (void)
 
void screen_timetag_init (struct screen_timetag_data *td, int deltaT_Usec, int adjustUsec)
 
dsm_sample_time_t screen_timetag (struct screen_timetag_data *td, dsm_sample_time_t tt)
 Adjust time tags in a series which should have a fixed delta-T, such as from an A2D. More...
 
 EXPORT_SYMBOL (alloc_dsm_circ_buf)
 
 EXPORT_SYMBOL (free_dsm_circ_buf)
 
 EXPORT_SYMBOL (realloc_dsm_circ_buf)
 
 EXPORT_SYMBOL (init_dsm_circ_buf)
 
 EXPORT_SYMBOL (nidas_circbuf_read)
 
 EXPORT_SYMBOL (nidas_circbuf_read_nowait)
 
 EXPORT_SYMBOL (screen_timetag_init)
 
 EXPORT_SYMBOL (screen_timetag)
 
 module_init (nidas_util_init)
 
 module_exit (nidas_util_cleanup)
 

Macro Definition Documentation

#define REPO_REVISION   "unknown"

Referenced by nidas_util_init().

Function Documentation

int alloc_dsm_circ_buf ( struct dsm_sample_circ_buf *  c,
size_t  dlen,
int  blen 
)
EXPORT_SYMBOL ( alloc_dsm_circ_buf  )
EXPORT_SYMBOL ( free_dsm_circ_buf  )
EXPORT_SYMBOL ( realloc_dsm_circ_buf  )
EXPORT_SYMBOL ( init_dsm_circ_buf  )
EXPORT_SYMBOL ( nidas_circbuf_read  )
EXPORT_SYMBOL ( nidas_circbuf_read_nowait  )
EXPORT_SYMBOL ( screen_timetag_init  )
EXPORT_SYMBOL ( screen_timetag  )
void free_dsm_circ_buf ( struct dsm_sample_circ_buf *  c)
void init_dsm_circ_buf ( struct dsm_sample_circ_buf *  c)
MODULE_AUTHOR ( "Gordon Maclean <maclean@ucar.edu>"  )
MODULE_DESCRIPTION ( "NCAR nidas utilities"  )
module_exit ( nidas_util_cleanup  )
module_init ( nidas_util_init  )
MODULE_LICENSE ( "GPL"  )
MODULE_VERSION ( REPO_REVISION  )
ssize_t nidas_circbuf_read ( struct file *  filp,
char __user *  buf,
size_t  count,
struct dsm_sample_circ_buf *  cbuf,
struct sample_read_state *  state,
wait_queue_head_t *  readq 
)
ssize_t nidas_circbuf_read_nowait ( struct file *  filp,
char __user *  buf,
size_t  count,
struct dsm_sample_circ_buf *  cbuf,
struct sample_read_state *  state 
)
static void __exit nidas_util_cleanup ( void  )
static
static int __init nidas_util_init ( void  )
static

References REPO_REVISION.

int realloc_dsm_circ_buf ( struct dsm_sample_circ_buf *  c,
size_t  dlen,
int  blen 
)
dsm_sample_time_t screen_timetag ( struct screen_timetag_data *  td,
dsm_sample_time_t  tt 
)

Adjust time tags in a series which should have a fixed delta-T, such as from an A2D.

The A2D driver modules assign the original time tag based on the time of the read of the A2D FIFO by the interrupt service routine or polling method. These time tags may be late due to ISR or polling latency.

If DO_TIMETAG_ERROR_AVERAGE is defined then this function keeps a running mean of the differences between the original and the expected time tags. This average is used to generate a time series with (approximately) the requested delta-T, but which can slowly drift to account for any clock drift of the A2D, or to correct an error in the initial time tag in the series.

If DO_TIMETAG_ERROR_AVERAGE is not defined then this function keeps track of the minimum difference between the original and expected time tags. After npts have been received, this minimum difference is added to the added to the generated time tags. This will do step changes (hopefully small) correct for clock drift between the CPU and the A2D.

The time tags are assumed to be in the raw form generated by the NIDAS A2D driver modules, as the number of 1/10 milliseconds since 00:00 UTC.

References if(), TMSECS_PER_DAY, TMSECS_PER_SEC, and USECS_PER_TMSEC.

Referenced by dmmat_a2d_bottom_half(), and dmmat_a2d_bottom_half_fast().

void screen_timetag_init ( struct screen_timetag_data *  td,
int  deltaT_Usec,
int  adjustUsec 
)