nidas v1.2.3
ir104.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 ** 2011, 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/*
27 * Driver for Diamond IR104 relay card made by Tri-M Engineering.
28 * This pc104 card has 20 output relays and 20 opto-isolated inputs.
29 * Newer versions of this card can generate interrupts on inputs,
30 * but as of now, this driver does not support interrupts.
31 *
32 * Original Author: Gordon Maclean
33*/
34
35#ifndef NIDAS_DIAMOND_IR104_H
36#define NIDAS_DIAMOND_IR104_H
37
38#ifndef __KERNEL__
39
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
46#endif
47
48#define IR104_IOC_MAGIC 'i'
49
51#define IR104_MAX_BOARDS 4
52
53#define IR104_IO_REGION_SIZE 15
54
58#define IR104_GET_NOUT _IO(IR104_IOC_MAGIC,0)
59
61#define IR104_GET_NIN _IO(IR104_IOC_MAGIC,1)
62
64#define IR104_CLEAR \
65 _IOW(IR104_IOC_MAGIC,2,unsigned char[3])
66
68#define IR104_SET \
69 _IOW(IR104_IOC_MAGIC,3,unsigned char[3])
70
73#define IR104_SET_TO_VAL \
74 _IOW(IR104_IOC_MAGIC,4,unsigned char[6])
75
77#define IR104_GET_DOUT \
78 _IOR(IR104_IOC_MAGIC,5,unsigned char[3])
79
81#define IR104_GET_DIN \
82 _IOR(IR104_IOC_MAGIC,6,unsigned char[3])
83
84#define IR104_IOC_MAXNR 6
85
86#define IR104_NOUT 20
87
88#define IR104_NIN 20
89
90#ifdef __KERNEL__
91/******** Start of definitions used by the driver module only **********/
92
93#include <linux/cdev.h>
94#include <linux/device.h>
95#include <linux/types.h>
96
97#include <nidas/linux/util.h>
98
102struct IR104 {
103
105 unsigned int ioport;
106
108 unsigned long addr;
109
111 char deviceName[16];
112
114 struct cdev cdev;
115
116 struct device* device;
117
119 atomic_t num_opened;
120
122#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
123 struct mutex mutex;
124#else
125 struct semaphore mutex;
126#endif
127
129 unsigned char outputs[3];
130
136 struct dsm_sample_circ_buf relay_samples;
137
141 wait_queue_head_t read_queue;
142
146 struct sample_read_state read_state;
147
152 unsigned int missedSamples;
153
154};
155
156#endif
157
158#endif
static unsigned int ioport[MESA_4I34_MAX_NR_DEVS]
Definition mesa.c:72
static string device
Definition sing.cc:60