Debian Codegraph @

arch/sh/include/cpu-sh3/cpu/dac.h

raw
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_CPU_SH3_DAC_H
3 #define __ASM_CPU_SH3_DAC_H
4
5 #include <linux/io.h>
6
7 /*
8 * Copyright (C) 2003 Andriy Skulysh
9 */
10
11
12 #define DADR0 0xa40000a0
13 #define DADR1 0xa40000a2
14 #define DACR 0xa40000a4
15 #define DACR_DAOE1 0x80
16 #define DACR_DAOE0 0x40
17 #define DACR_DAE 0x20
18
19
20 static __inline__ void sh_dac_enable(int channel)
21 {
22 unsigned char v;
23 v = __raw_readb(DACR);
24 if(channel) v |= DACR_DAOE1;
25 else v |= DACR_DAOE0;
26 __raw_writeb(v,DACR);
27 }
28
29 static __inline__ void sh_dac_disable(int channel)
30 {
31 unsigned char v;
32 v = __raw_readb(DACR);
33 if(channel) v &= ~DACR_DAOE1;
34 else v &= ~DACR_DAOE0;
35 __raw_writeb(v,DACR);
36 }
37
38 static __inline__ void sh_dac_output(u8 value, int channel)
39 {
40 if(channel) __raw_writeb(value,DADR1);
41 else __raw_writeb(value,DADR0);
42 }
43
44 #endif /* __ASM_CPU_SH3_DAC_H */