gmp-utils: New API to simply use of GMP's integer/rational/float objects
[binutils-gdb.git] / sim / common / dv-sockser.h
blob11852a0d3c538a8267dab81bc40a5a999b557ed3
1 /* Serial port emulation via sockets.
2 Copyright (C) 1998-2020 Free Software Foundation, Inc.
4 This file is part of the GNU simulators.
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 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #ifndef DV_SOCKSER_H
20 #define DV_SOCKSER_H
22 #include "sim-inline.h"
24 /* bits in result of dev_sockser_status */
25 #define DV_SOCKSER_INPUT_EMPTY 0x1
26 #define DV_SOCKSER_OUTPUT_EMPTY 0x2
27 #define DV_SOCKSER_DISCONNECTED 0x4
29 #ifdef HAVE_DV_SOCKSER
31 /* FIXME: later add a device ptr arg */
32 extern int dv_sockser_status (SIM_DESC);
33 int dv_sockser_write (SIM_DESC, unsigned char);
34 int dv_sockser_write_buffer (SIM_DESC, const unsigned char *, unsigned);
35 int dv_sockser_read (SIM_DESC);
37 SIM_RC dv_sockser_install (SIM_DESC);
39 #else
41 /* If dv-sockser isn't available, provide stub functions. */
43 STATIC_INLINE int
44 dv_sockser_status (SIM_DESC sd)
46 return (DV_SOCKSER_INPUT_EMPTY |
47 DV_SOCKSER_OUTPUT_EMPTY |
48 DV_SOCKSER_DISCONNECTED);
51 STATIC_INLINE int
52 dv_sockser_write (SIM_DESC sd, unsigned char c)
54 return -1;
57 STATIC_INLINE int
58 dv_sockser_write_buffer (SIM_DESC sd, const unsigned char *buffer,
59 unsigned nr_bytes)
61 return -1;
64 STATIC_INLINE int
65 dv_sockser_read (SIM_DESC sd)
67 return -1;
70 #endif /* HAVE_DV_SOCKSER */
72 #endif /* DV_SOCKSER_H */