dv-sockser.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Serial port emulation via sockets.
  2. Copyright (C) 1998-2015 Free Software Foundation, Inc.
  3. This file is part of the GNU simulators.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef DV_SOCKSER_H
  15. #define DV_SOCKSER_H
  16. #include "sim-inline.h"
  17. /* bits in result of dev_sockser_status */
  18. #define DV_SOCKSER_INPUT_EMPTY 0x1
  19. #define DV_SOCKSER_OUTPUT_EMPTY 0x2
  20. #define DV_SOCKSER_DISCONNECTED 0x4
  21. #ifdef HAVE_DV_SOCKSER
  22. /* FIXME: later add a device ptr arg */
  23. extern int dv_sockser_status (SIM_DESC);
  24. int dv_sockser_write (SIM_DESC, unsigned char);
  25. int dv_sockser_write_buffer (SIM_DESC, const unsigned char *, unsigned);
  26. int dv_sockser_read (SIM_DESC);
  27. SIM_RC dv_sockser_install (SIM_DESC);
  28. #else
  29. /* If dv-sockser isn't available, provide stub functions. */
  30. STATIC_INLINE int
  31. dv_sockser_status (SIM_DESC sd)
  32. {
  33. return (DV_SOCKSER_INPUT_EMPTY |
  34. DV_SOCKSER_OUTPUT_EMPTY |
  35. DV_SOCKSER_DISCONNECTED);
  36. }
  37. STATIC_INLINE int
  38. dv_sockser_write (SIM_DESC sd, unsigned char c)
  39. {
  40. return -1;
  41. }
  42. STATIC_INLINE int
  43. dv_sockser_write_buffer (SIM_DESC sd, const unsigned char *buffer,
  44. unsigned nr_bytes)
  45. {
  46. return -1;
  47. }
  48. STATIC_INLINE int
  49. dv_sockser_read (SIM_DESC sd)
  50. {
  51. return -1;
  52. }
  53. #endif /* HAVE_DV_SOCKSER */
  54. #endif /* DV_SOCKSER_H */