zoom2_serial.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. extern int zoom2_debug_board_connected (void);
  24. #define SERIAL_TL16CP754C_BASE 0x10000000 /* Zoom2 Serial chip address */
  25. #define QUAD_BASE_0 SERIAL_TL16CP754C_BASE
  26. #define QUAD_BASE_1 (SERIAL_TL16CP754C_BASE + 0x100)
  27. #define QUAD_BASE_2 (SERIAL_TL16CP754C_BASE + 0x200)
  28. #define QUAD_BASE_3 (SERIAL_TL16CP754C_BASE + 0x300)
  29. #define S(a) #a
  30. #define N(a) S(quad##a)
  31. #define QUAD_INIT(n) \
  32. int quad_init_##n(void) \
  33. { \
  34. return quad_init_dev(QUAD_BASE_##n); \
  35. } \
  36. void quad_setbrg_##n(void) \
  37. { \
  38. quad_setbrg_dev(QUAD_BASE_##n); \
  39. } \
  40. void quad_putc_##n(const char c) \
  41. { \
  42. quad_putc_dev(QUAD_BASE_##n, c); \
  43. } \
  44. void quad_puts_##n(const char *s) \
  45. { \
  46. quad_puts_dev(QUAD_BASE_##n, s); \
  47. } \
  48. int quad_getc_##n(void) \
  49. { \
  50. return quad_getc_dev(QUAD_BASE_##n); \
  51. } \
  52. int quad_tstc_##n(void) \
  53. { \
  54. return quad_tstc_dev(QUAD_BASE_##n); \
  55. } \
  56. struct serial_device zoom2_serial_device##n = \
  57. { \
  58. N(n), \
  59. quad_init_##n, \
  60. NULL, \
  61. quad_setbrg_##n, \
  62. quad_getc_##n, \
  63. quad_tstc_##n, \
  64. quad_putc_##n, \
  65. quad_puts_##n, \
  66. };
  67. #endif /* ZOOM2_SERIAL_H */