Merge branch 'for-linus' of git://github.com/schandinat/linux-2.6
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / comedi / drivers / am9513.h
CommitLineData
fc59905e
DS
1/*
2 module/am9513.h
3 value added preprocessor definitions for Am9513 timer chip
4
5 COMEDI - Linux Control and Measurement Device Interface
6 Copyright (C) 1998 David A. Schleef <ds@schleef.org>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22*/
23
24#ifndef _AM9513_H_
25#define _AM9513_H_
26
27#if 0
28
29/*
30 * Before including this file, the following need to be defined:
31 */
32#define Am9513_8BITBUS xxx
33/* or */
34#define Am9513_16BITBUS xxx
35
36#define Am9513_output_control(a) xxx
37#define Am9513_input_status() xxx
38#define Am9513_output_data(a) xxx
39#define Am9513_input_data() xxx
40
41#endif
42
43/*
44 *
45 */
46
47#ifdef Am9513_8BITBUS
48
f7cbd7aa 49#define Am9513_write_register(reg, val) \
0c55484d 50 do { \
fc59905e
DS
51 Am9513_output_control(reg); \
52 Am9513_output_data(val>>8); \
53 Am9513_output_data(val&0xff); \
0c55484d 54 } while (0)
fc59905e 55
f7cbd7aa 56#define Am9513_read_register(reg, val) \
0c55484d 57 do { \
fc59905e 58 Am9513_output_control(reg); \
0c55484d
BB
59 val = Am9513_input_data()<<8; \
60 val |= Am9513_input_data(); \
61 } while (0)
fc59905e
DS
62
63#else /* Am9513_16BITBUS */
64
f7cbd7aa 65#define Am9513_write_register(reg, val) \
0c55484d 66 do { \
fc59905e
DS
67 Am9513_output_control(reg); \
68 Am9513_output_data(val); \
0c55484d 69 } while (0)
fc59905e 70
f7cbd7aa 71#define Am9513_read_register(reg, val) \
0c55484d 72 do { \
fc59905e 73 Am9513_output_control(reg); \
0c55484d
BB
74 val = Am9513_input_data(); \
75 } while (0)
fc59905e
DS
76
77#endif
78
79#endif