nidas  v1.2-1520
arinc.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  ** 2008, 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 /* arinc.h
27 
28  Header for the CEI420a ARINC driver.
29 
30  Original Author: John Wasinger
31 
32 */
33 
34 #ifndef ARINC_H
35 #define ARINC_H
36 
37 #include <nidas/linux/types.h>
38 
39 /* This header is also included from user-side code that
40  * wants to get the values of the ioctl commands, and
41  * the definition of the structures.
42  */
43 
48 #define LPB 256
49 
54 #define N_ARINC_RX 4
55 #define N_ARINC_TX 2
56 
60 typedef struct {
61  short label;
62  short rate;
63 } arcfg_t;
64 
68 typedef struct {
69  unsigned int speed;
70  unsigned int parity;
71 } archn_t;
72 
76 typedef struct {
77  unsigned int time;
78  int data;
79 } tt_data_t;
80 
84 typedef struct {
85  unsigned int lps_cnt; // Labels Per Second
86  unsigned int lps; // Labels Per Second
87  unsigned int pollRate; // Hz
88  unsigned int overflow;
89  unsigned int underflow;
90  unsigned int nosync;
92 
93 /* Pick a character as the magic number of your driver.
94  * It isn't strictly necessary that it be distinct between
95  * all modules on the system, but is a good idea. With
96  * distinct magic numbers one can catch a user sending
97  * a ioctl to the wrong device.
98  */
99 #define ARINC_MAGIC 'K'
100 
104 #define ARINC_SET _IOW(ARINC_MAGIC,0, arcfg_t)
105 #define ARINC_OPEN _IOW(ARINC_MAGIC,1, archn_t)
106 #define ARINC_BIT _IOW(ARINC_MAGIC,2, short)
107 #define ARINC_STAT _IOR(ARINC_MAGIC,3, dsm_arinc_status)
108 #define ARINC_IOC_MAXNR 3
109 
110 // These are copied from dsm/modules/CEI420A/Include/utildefs.h
111 #define AR_ODD 0 /* Used to set ODD parity */
112 #define AR_EVEN 1 /* Used to set EVEN parity */
113 #define AR_HIGH 0 /* Used to set HIGH speed (100 Kbaud) */
114 #define AR_LOW 1 /* Used to set LOW speed (12.5 Kbaud) */
115 
116 #endif
int data
Definition: arinc.h:78
unsigned int pollRate
Definition: arinc.h:87
ARINC label configuration structure.
Definition: arinc.h:60
unsigned int parity
Definition: arinc.h:70
unsigned int lps
Definition: arinc.h:86
ARINC channel configuration structure.
Definition: arinc.h:68
ARINC channel status.
Definition: arinc.h:84
unsigned int time
Definition: arinc.h:77
unsigned int speed
Definition: arinc.h:69
unsigned int nosync
Definition: arinc.h:90
short rate
Definition: arinc.h:62
ARINC time tagged sample structure.
Definition: arinc.h:76
unsigned int underflow
Definition: arinc.h:89
short label
Definition: arinc.h:61
unsigned int lps_cnt
Definition: arinc.h:85
unsigned int overflow
Definition: arinc.h:88