zoom2_serial.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2009 Wind River Systems, Inc.
  3. * Tom Rix <Tom.Rix@windriver.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  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. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. *
  20. */
  21. #ifndef ZOOM2_SERIAL_H
  22. #define ZOOM2_SERIAL_H
  23. #include <linux/stringify.h>
  24. extern int zoom2_debug_board_connected (void);
  25. #define SERIAL_TL16CP754C_BASE 0x10000000 /* Zoom2 Serial chip address */
  26. #define QUAD_BASE_0 SERIAL_TL16CP754C_BASE
  27. #define QUAD_BASE_1 (SERIAL_TL16CP754C_BASE + 0x100)
  28. #define QUAD_BASE_2 (SERIAL_TL16CP754C_BASE + 0x200)
  29. #define QUAD_BASE_3 (SERIAL_TL16CP754C_BASE + 0x300)
  30. #define QUAD_INIT(n) \
  31. int quad_init_##n(void) \
  32. { \
  33. return quad_init_dev(QUAD_BASE_##n); \
  34. } \
  35. void quad_setbrg_##n(void) \
  36. { \
  37. quad_setbrg_dev(QUAD_BASE_##n); \
  38. } \
  39. void quad_putc_##n(const char c) \
  40. { \
  41. quad_putc_dev(QUAD_BASE_##n, c); \
  42. } \
  43. void quad_puts_##n(const char *s) \
  44. { \
  45. quad_puts_dev(QUAD_BASE_##n, s); \
  46. } \
  47. int quad_getc_##n(void) \
  48. { \
  49. return quad_getc_dev(QUAD_BASE_##n); \
  50. } \
  51. int quad_tstc_##n(void) \
  52. { \
  53. return quad_tstc_dev(QUAD_BASE_##n); \
  54. } \
  55. struct serial_device zoom2_serial_device##n = \
  56. { \
  57. .name = __stringify(n), \
  58. .start = quad_init_##n, \
  59. .stop = NULL, \
  60. .setbrg = quad_setbrg_##n, \
  61. .getc = quad_getc_##n, \
  62. .tstc = quad_tstc_##n, \
  63. .putc = quad_putc_##n, \
  64. .puts = quad_puts_##n, \
  65. };
  66. #endif /* ZOOM2_SERIAL_H */