]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/cbus/user_retu_tahvo.h
Merge branch 'omap-fixes'
[linux-2.6-omap-h63xx.git] / drivers / cbus / user_retu_tahvo.h
1 /**
2  * drivers/cbus/user_retu_tahvo.h
3  *
4  * Copyright (C) 2004, 2005 Nokia Corporation
5  *
6  * Written by Mikko Ylinen <mikko.k.ylinen@nokia.com>
7  *
8  * Definitions and types used by both retu-user and tahvo-user.
9  *
10  * This file is subject to the terms and conditions of the GNU General
11  * Public License. See the file "COPYING" in the main directory of this
12  * archive for more details.
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  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #ifndef _USER_RETU_TAHVO_H
25 #define _USER_RETU_TAHVO_H
26
27 /* Chip IDs */
28 #define CHIP_RETU       1
29 #define CHIP_TAHVO      2
30
31 /* Register access type bits */
32 #define READ_ONLY               1
33 #define WRITE_ONLY              2
34 #define READ_WRITE              3
35 #define TOGGLE                  4
36
37 #define MASK(field)             ((u16)(field & 0xFFFF))
38 #define REG(field)              ((u16)((field >> 16) & 0x3F))
39
40 /*** IOCTL definitions. These should be kept in sync with user space **********/
41
42 #define URT_IOC_MAGIC '`'
43
44 /*
45  * IOCTL function naming conventions:
46  * ==================================
47  *  0 -- No argument and return value
48  *  S -- Set through a pointer
49  *  T -- Tell directly with the argument value
50  *  G -- Reply by setting through a pointer
51  *  Q -- response is on the return value
52  *  X -- S and G atomically
53  *  H -- T and Q atomically
54  */
55
56 /* General */
57 #define URT_IOCT_IRQ_SUBSCR             _IO(URT_IOC_MAGIC, 0)
58
59 /* RETU */
60 #define RETU_IOCH_READ                  _IO(URT_IOC_MAGIC, 1)
61 #define RETU_IOCX_WRITE                 _IO(URT_IOC_MAGIC, 2)
62 #define RETU_IOCH_ADC_READ              _IO(URT_IOC_MAGIC, 3)
63
64 /* TAHVO */
65 #define TAHVO_IOCH_READ                 _IO(URT_IOC_MAGIC, 4)
66 #define TAHVO_IOCX_WRITE                _IO(URT_IOC_MAGIC, 5)
67
68 /* This structure is used for writing RETU/TAHVO registers */
69 struct retu_tahvo_write_parms {
70     u32 field;
71     u16 value;
72     u8  result;
73 };
74
75 #endif