nidas v1.2.3
pcmcom8.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#ifndef NIDAS_LINUX_PCMCOM8_H
27#define NIDAS_LINUX_PCMCOM8_H
28
29
30#define PCMCOM8_NR_PORTS 8 /* number of serial ports on a board */
31
32# ifdef __KERNEL__
33
34#include <linux/version.h>
35#include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */
36#include <linux/cdev.h>
37#include <linux/device.h>
38
39#ifndef PCMCOM8_MAJOR
40/* look in Documentation/devices.txt
41 * 60-63,120-127,240-254 LOCAL/EXPERIMENTAL USE
42 * 231-239 unassigned
43 * 208,209: user space serial ports - what are these?
44 */
45#define PCMCOM8_MAJOR 0 /* dynamic major by default */
46#endif
47
48#define PCMCOM8_MAX_NR_DEVS 4 /* maximum number of pcmcom8 cards in sys */
49#define PCMCOM8_IO_REGION_SIZE 8 /* number of 1-byte registers */
50
51/* registers on the pcmcom8 starting at the ioport address */
52#define PCMCOM8_IDX 0x0 /* index register, R/W */
53#define PCMCOM8_ADR 0x1 /* address and enable reg, R/W */
54#define PCMCOM8_IAR 0x2 /* IRQ assigmment register, R/W */
55#define PCMCOM8_IIR 0x3 /* IRQ id reg, RO */
56#define PCMCOM8_ECR 0x4 /* EEPROM cmd, R/W */
57#define PCMCOM8_EHR 0x5 /* EEPROM high data register, R/W */
58#define PCMCOM8_ELR 0x6 /* EEPROM low data register, R/W */
59#define PCMCOM8_CMD 0x7 /* command register W */
60#define PCMCOM8_STA 0x7 /* status register RO */
61
62# endif /* __KERNEL__ */
63
65 unsigned int ioport; /* ISA ioport address, e.g. 0x100 */
66 unsigned int irq; /* ISA IRQ */
67 unsigned int enable; /* whether to enable uart */
69
73
74# ifdef __KERNEL__
75
76typedef struct pcmcom8_board {
77
78 unsigned int ioport; /* ioport addr of the pcmcom8 card */
79
80 unsigned long addr; /* ioport plus system ISA base address */
81
82 struct pcmcom8_config config; /* ioport and irq of 8 serial ports */
83
84#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
85 struct mutex mutex;
86#else
87 struct semaphore mutex;
88#endif
89 struct cdev cdev;
90
91 struct device *device;
92
93 int region_req; /* ioport region requested */
94 int cdev_ready; /* cdev_add done */
95} pcmcom8_board;
96
97
98# endif /* __KERNEL__ */
99
100/* Look in Documentation/ioctl-number.txt */
101#define PCMCOM8_IOC_MAGIC 'p'
102#define PCMCOM8_IOCSPORTCONFIG _IOW(PCMCOM8_IOC_MAGIC, 1, struct pcmcom8_config)
103#define PCMCOM8_IOCGPORTCONFIG _IOR(PCMCOM8_IOC_MAGIC, 2, struct pcmcom8_config)
104#define PCMCOM8_IOCSEEPORTCONFIG _IOW(PCMCOM8_IOC_MAGIC, 3, struct pcmcom8_config)
105#define PCMCOM8_IOCGEEPORTCONFIG _IOR(PCMCOM8_IOC_MAGIC, 4, struct pcmcom8_config)
106#define PCMCOM8_IOCEECONFIGLOAD _IO(PCMCOM8_IOC_MAGIC, 5)
107#define PCMCOM8_IOCPORTENABLE _IO(PCMCOM8_IOC_MAGIC, 6)
108#define PCMCOM8_IOCGNBOARD _IOR(PCMCOM8_IOC_MAGIC, 7, int)
109#define PCMCOM8_IOCGISABASE _IOR(PCMCOM8_IOC_MAGIC,8,unsigned long)
110
111#define PCMCOM8_IOC_MAXNR 9
112
113#endif /* _PCMCOM8_H */
114
static unsigned int ioport[MESA_4I34_MAX_NR_DEVS]
Definition mesa.c:72
#define PCMCOM8_NR_PORTS
Definition pcmcom8.h:30
struct pcmcom8_config pcmcom8_config
struct pcmcom8_serial_port pcmcom8_serial_port
static string device
Definition sing.cc:60
Definition pcmcom8.h:70
struct pcmcom8_serial_port ports[PCMCOM8_NR_PORTS]
Definition pcmcom8.h:71
Definition pcmcom8.h:64
unsigned int ioport
Definition pcmcom8.h:65
unsigned int enable
Definition pcmcom8.h:67
unsigned int irq
Definition pcmcom8.h:66