/drivers/staging/comedi/drivers/am9513.h

https://bitbucket.org/wisechild/galaxy-nexus · C++ Header · 79 lines · 36 code · 14 blank · 29 comment · 4 complexity · 5ca63f68aade75df387ad769cb65203a MD5 · raw file

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