18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_CPU_SH3_DAC_H 38c2ecf20Sopenharmony_ci#define __ASM_CPU_SH3_DAC_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * Copyright (C) 2003 Andriy Skulysh 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#define DADR0 0xa40000a0 118c2ecf20Sopenharmony_ci#define DADR1 0xa40000a2 128c2ecf20Sopenharmony_ci#define DACR 0xa40000a4 138c2ecf20Sopenharmony_ci#define DACR_DAOE1 0x80 148c2ecf20Sopenharmony_ci#define DACR_DAOE0 0x40 158c2ecf20Sopenharmony_ci#define DACR_DAE 0x20 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistatic __inline__ void sh_dac_enable(int channel) 198c2ecf20Sopenharmony_ci{ 208c2ecf20Sopenharmony_ci unsigned char v; 218c2ecf20Sopenharmony_ci v = __raw_readb(DACR); 228c2ecf20Sopenharmony_ci if(channel) v |= DACR_DAOE1; 238c2ecf20Sopenharmony_ci else v |= DACR_DAOE0; 248c2ecf20Sopenharmony_ci __raw_writeb(v,DACR); 258c2ecf20Sopenharmony_ci} 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cistatic __inline__ void sh_dac_disable(int channel) 288c2ecf20Sopenharmony_ci{ 298c2ecf20Sopenharmony_ci unsigned char v; 308c2ecf20Sopenharmony_ci v = __raw_readb(DACR); 318c2ecf20Sopenharmony_ci if(channel) v &= ~DACR_DAOE1; 328c2ecf20Sopenharmony_ci else v &= ~DACR_DAOE0; 338c2ecf20Sopenharmony_ci __raw_writeb(v,DACR); 348c2ecf20Sopenharmony_ci} 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistatic __inline__ void sh_dac_output(u8 value, int channel) 378c2ecf20Sopenharmony_ci{ 388c2ecf20Sopenharmony_ci if(channel) __raw_writeb(value,DADR1); 398c2ecf20Sopenharmony_ci else __raw_writeb(value,DADR0); 408c2ecf20Sopenharmony_ci} 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#endif /* __ASM_CPU_SH3_DAC_H */ 43