33#ifndef NCAR_A2D_PRIV_H
34#define NCAR_A2D_PRIV_H
39#include <linux/wait.h>
40#include <linux/device.h>
42#define A2D_MAX_RATE 5000
45#define A2DINSTBSY 0x8000
46#define A2DDATARDY 0x4000
47#define A2DDATAREQ 0x2000
48#define A2DIDERR 0x1000
49#define A2DCRCERR 0x0800
50#define A2DDATAERR 0x0400
51#define A2DINSTREG15 0x0200
52#define A2DINSTREG13 0x0100
53#define A2DINSTREG12 0x0080
54#define A2DINSTREG11 0x0040
55#define A2DINSTREG06 0x0020
56#define A2DINSTREG05 0x0010
57#define A2DINSTREG04 0x0008
58#define A2DINSTREG01 0x0004
59#define A2DINSTREG00 0x0002
60#define A2DCONFIGEND 0x0001
62#define A2DSTAT_INSTR_MASK 0x3fe
86#define MAX_A2D_BOARDS 4
88#define HWFIFODEPTH 1024
109#define POLL_WHEN_QUARTER_FULL
112#define A2DIOWIDTH 0x10
117# define A2DCMDADDR 0xF
121#define A2DIO_FIFO 0x0
122#define A2DIO_CS_CMD 0x1
124#define A2DIO_DATA 0x3
125#define A2DIO_D2A1 0x4
126#define A2DIO_CALV 0x5
127#define A2DIO_SYSCTL 0x6
128#define A2DIO_FIFOSTAT 0x7
131#define A2DIO_CS_WR 0x0
132#define A2DIO_CS_RD 0x8
134#define A2DIO_CS_CMD_RD (A2DIO_CS_CMD + A2DIO_CS_RD)
135#define A2DIO_CS_CMD_WR (A2DIO_CS_CMD + A2DIO_CS_WR)
138#define AD7725_READID 0x8802
139#define AD7725_READDATA 0x8d21
140#define AD7725_WRCONFIG 0x1800
141#define AD7725_WRCONFEM 0x1A00
142#define AD7725_ABORT 0x0000
143#define AD7725_BFIR 0x2000
149#define A2DSYNCCK 0x08
150#define A2D1PPSEBL 0x10
151#define FIFODAFAE 0x20
152#define A2DSTATEBL 0x40
153#define FIFOWREBL 0x80
158#define FIFONOTEMPTY 0x04
159#define FIFONOTFULL 0x08
163#define USE_RESET_WORKER
239#ifdef USE_RESET_WORKER
260#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
263 struct semaphore
mutex;
#define NUM_NCAR_A2D_CHANNELS
Definition ncar_a2d.h:55
#define CONFBLOCKS
Definition ncar_a2d.h:60
#define CONFBLLEN
Definition ncar_a2d.h:61
Definition ncar_a2d_priv.h:174
struct device * device
Definition ncar_a2d_priv.h:185
struct irig_callback * tempCallback
Definition ncar_a2d_priv.h:230
struct ncar_a2d_cal_config cal
Definition ncar_a2d_priv.h:256
unsigned short OffCal
Definition ncar_a2d_priv.h:246
short currentTemp
Definition ncar_a2d_priv.h:233
int scanDeltatMsec
Definition ncar_a2d_priv.h:194
struct irig_callback * ppsCallback
Definition ncar_a2d_priv.h:221
unsigned char FIFOCtl
Definition ncar_a2d_priv.h:247
int havePPS
Definition ncar_a2d_priv.h:223
int totalOutputRate
Definition ncar_a2d_priv.h:214
unsigned int readCtr
Definition ncar_a2d_priv.h:202
struct ncar_a2d_status cur_status
Definition ncar_a2d_priv.h:257
struct dsm_sample_circ_buf fifo_samples
Definition ncar_a2d_priv.h:216
struct work_struct resetWorker
Definition ncar_a2d_priv.h:240
struct dsm_sample_circ_buf a2d_samples
Definition ncar_a2d_priv.h:217
struct short_filter_info * filters
Definition ncar_a2d_priv.h:226
unsigned short ocfilter[CONFBLOCKS *CONFBLLEN+1]
Definition ncar_a2d_priv.h:191
int pollRate
Definition ncar_a2d_priv.h:196
int resets
Definition ncar_a2d_priv.h:244
int master
Definition ncar_a2d_priv.h:203
struct irig_callback * a2dCallback
Definition ncar_a2d_priv.h:228
int tempRate
Definition ncar_a2d_priv.h:232
int pollDeltatMsec
Definition ncar_a2d_priv.h:195
int errorState
Definition ncar_a2d_priv.h:242
struct sample_read_state a2d_read_state
Definition ncar_a2d_priv.h:219
int nfilters
Definition ncar_a2d_priv.h:225
unsigned int ioport
Definition ncar_a2d_priv.h:175
struct work_struct sampleWorker
Definition ncar_a2d_priv.h:250
int discardNextScan
Definition ncar_a2d_priv.h:204
int interrupted
Definition ncar_a2d_priv.h:201
unsigned int skippedSamples
Definition ncar_a2d_priv.h:237
int numPollDelaysLeft
Definition ncar_a2d_priv.h:212
wait_queue_head_t ppsWaitQ
Definition ncar_a2d_priv.h:222
int gain[NUM_NCAR_A2D_CHANNELS]
Definition ncar_a2d_priv.h:189
unsigned int nbadFifoLevel
Definition ncar_a2d_priv.h:235
long latencyMsecs
Definition ncar_a2d_priv.h:252
unsigned long lastWakeup
Definition ncar_a2d_priv.h:254
int busy
Definition ncar_a2d_priv.h:200
struct ncar_a2d_status prev_status
Definition ncar_a2d_priv.h:258
unsigned int fifoNotEmpty
Definition ncar_a2d_priv.h:236
unsigned long base_addr
Definition ncar_a2d_priv.h:177
unsigned char i2c
Definition ncar_a2d_priv.h:248
int offset[NUM_NCAR_A2D_CHANNELS]
Definition ncar_a2d_priv.h:190
unsigned short ser_num
Definition ncar_a2d_priv.h:187
int skipFactor
Definition ncar_a2d_priv.h:199
int scanRate
Definition ncar_a2d_priv.h:193
int nFifoValues
Definition ncar_a2d_priv.h:198
int irigRate
Definition ncar_a2d_priv.h:197
unsigned long cmd_addr
Definition ncar_a2d_priv.h:181
int delaysBeforeFirstPoll
To be sure reads are not done from an empty FIFO, delay the reads until it is a least 1/4 full.
Definition ncar_a2d_priv.h:210
struct mutex mutex
Definition ncar_a2d_priv.h:261
char deviceName[32]
Definition ncar_a2d_priv.h:183
unsigned long base_addr16
Definition ncar_a2d_priv.h:179
long latencyJiffies
Definition ncar_a2d_priv.h:253
wait_queue_head_t rwaitq_a2d
Definition ncar_a2d_priv.h:218
Definition ncar_a2d_priv.h:166
dsm_sample_time_t timetag
Definition ncar_a2d_priv.h:167
short data[NUM_NCAR_A2D_CHANNELS]
Definition ncar_a2d_priv.h:170
dsm_sample_length_t length
Definition ncar_a2d_priv.h:168
unsigned short id
Definition ncar_a2d_priv.h:169
Definition ncar_a2d.h:113
unsigned int dsm_sample_length_t
length of data portion of sample.
Definition types.h:51
int dsm_sample_time_t
Depending on the module, either tenths of milliseconds, or milliseconds since 00:00 UTC today.
Definition types.h:48