aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/am9513.h
blob: f533cf1658cf731064a57b5c2541d78ef4c1bfa7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
    module/am9513.h
    value added preprocessor definitions for Am9513 timer chip

    COMEDI - Linux Control and Measurement Device Interface
    Copyright (C) 1998 David A. Schleef <ds@schleef.org>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef _AM9513_H_
#define _AM9513_H_

#if 0

/*
 *	Before including this file, the following need to be defined:
 */
#define Am9513_8BITBUS xxx
/* or */
#define Am9513_16BITBUS xxx

#define Am9513_output_control(a)	xxx
#define Am9513_input_status()		xxx
#define Am9513_output_data(a)		xxx
#define Am9513_input_data()		xxx

#endif

/*
 *
 */

#ifdef Am9513_8BITBUS

#define Am9513_write_register(reg,val)				\
	do{							\
		Am9513_output_control(reg);			\
		Am9513_output_data(val>>8);			\
		Am9513_output_data(val&0xff);			\
	}while(0)

#define Am9513_read_register(reg,val)				\
	do{							\
		Am9513_output_control(reg);			\
		val=Am9513_input_data()<<8;			\
		val|=Am9513_input_data();			\
	}while(0)

#else /* Am9513_16BITBUS */

#define Am9513_write_register(reg,val)				\
	do{							\
		Am9513_output_control(reg);			\
		Am9513_output_data(val);			\
	}while(0)

#define Am9513_read_register(reg,val)				\
	do{							\
		Am9513_output_control(reg);			\
		val=Am9513_input_data();			\
	}while(0)

#endif

#endif