nidas v1.2.3
a2d.h
Go to the documentation of this file.
1/* -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8; -*- */
2/* vim: set shiftwidth=8 softtabstop=8 expandtab: */
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2007, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26/* nidas_analog.h
27
28 Common ioctl definitions for analog boards.
29
30 Original Author: Gordon Maclean
31
32*/
33
34#ifndef NIDAS_LINUX_A2D_H
35#define NIDAS_LINUX_A2D_H
36
37#include "short_filters.h"
38
39#ifndef __KERNEL__
40/* User programs need this for the _IO macros, but kernel
41 * modules get their's elsewhere.
42 */
43#include <sys/ioctl.h>
44#include <sys/types.h>
45#endif
46
47/* This header is also included from user-side code that
48 * wants to get the values of the ioctl commands, and
49 * the definition of the structures.
50 */
51
52/*
53 * Set this to the maximum number of A2D channels on any
54 * board that uses this header file.
55 * The diamond MM32XAT has 32 channels, so it should be at least 32.
56 */
57#define MAX_A2D_CHANNELS 32 // max num A/D channels per card
58
63{
64 int scanRate; // how fast to sample
65 int latencyUsecs; // buffer latency in micro-sec
66};
67
72{
73 int sindex; // sample index, 0,1,etc
74 int nvars; // number of variables in sample
75 int rate; // sample rate
76 int filterType; // one of nidas_short_filter enum
77 int channels[MAX_A2D_CHANNELS]; // which channel for each variable
78 int gain[MAX_A2D_CHANNELS]; // gain setting for the channel
79 int bipolar[MAX_A2D_CHANNELS];// 1=bipolar,0=unipolar
80 int nFilterData; // number of bytes in filterData;
81 char filterData[0]; // data for filter
82};
83
84/* Pick a character as the magic number of your driver.
85 * It isn't strictly necessary that it be distinct between
86 * all modules on the system, but is a good idea. With
87 * distinct magic numbers one can catch a user sending
88 * an ioctl to the wrong device.
89 */
90#define NIDAS_A2D_IOC_MAGIC 'n'
91
92/*
93 * IOCTLS that are supported on all A2D cards.
94 */
95#define NIDAS_A2D_GET_NCHAN _IOR(NIDAS_A2D_IOC_MAGIC,0,int)
96#define NIDAS_A2D_SET_CONFIG \
97 _IOW(NIDAS_A2D_IOC_MAGIC,1,struct nidas_a2d_config)
98#define NIDAS_A2D_CONFIG_SAMPLE \
99 _IOW(NIDAS_A2D_IOC_MAGIC,2,struct nidas_a2d_sample_config)
100
101#endif
#define MAX_A2D_CHANNELS
Definition a2d.h:57
Fields common to all A2D configurations.
Definition a2d.h:63
int latencyUsecs
Definition a2d.h:65
int scanRate
Definition a2d.h:64
Information for configuring a sample from an A2D.
Definition a2d.h:72
int bipolar[MAX_A2D_CHANNELS]
Definition a2d.h:79
char filterData[0]
Definition a2d.h:81
int nFilterData
Definition a2d.h:80
int rate
Definition a2d.h:75
int channels[MAX_A2D_CHANNELS]
Definition a2d.h:77
int gain[MAX_A2D_CHANNELS]
Definition a2d.h:78
int sindex
Definition a2d.h:73
int nvars
Definition a2d.h:74
int filterType
Definition a2d.h:76