dac.h 809 B

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