VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmserialifs.h@ 78415

Last change on this file since 78415 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.6 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Serial port related interfaces.
3 */
4
5/*
6 * Copyright (C) 2018-2019 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef VBOX_INCLUDED_vmm_pdmserialifs_h
27#define VBOX_INCLUDED_vmm_pdmserialifs_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <VBox/types.h>
33
34RT_C_DECLS_BEGIN
35
36/** @defgroup grp_pdm_ifs_serial PDM Serial Port Interfaces
37 * @ingroup grp_pdm_interfaces
38 * @{
39 */
40
41
42/** @name Bit mask definitions for status line type.
43 * @{ */
44#define PDMISERIALPORT_STS_LINE_DCD RT_BIT(0)
45#define PDMISERIALPORT_STS_LINE_RI RT_BIT(1)
46#define PDMISERIALPORT_STS_LINE_DSR RT_BIT(2)
47#define PDMISERIALPORT_STS_LINE_CTS RT_BIT(3)
48/** @} */
49
50/** Pointer to a serial port interface. */
51typedef struct PDMISERIALPORT *PPDMISERIALPORT;
52/**
53 * Serial port interface (down).
54 */
55typedef struct PDMISERIALPORT
56{
57 /**
58 * Notifies the upper device/driver that data is available for reading.
59 *
60 * @returns VBox status code.
61 * @param pInterface Pointer to the interface structure containing the called function pointer.
62 * @param cbAvail The amount of data available to be written.
63 */
64 DECLR3CALLBACKMEMBER(int, pfnDataAvailRdrNotify, (PPDMISERIALPORT pInterface, size_t cbAvail));
65
66 /**
67 * Notifies the upper device/driver that all data was sent.
68 *
69 * @returns VBox status code.
70 * @param pInterface Pointer to the interface structure containing the called function pointer.
71 */
72 DECLR3CALLBACKMEMBER(int, pfnDataSentNotify, (PPDMISERIALPORT pInterface));
73
74 /**
75 * Try to read data from the device/driver above for writing.
76 *
77 * @returns VBox status code.
78 * @param pInterface Pointer to the interface structure containing the called function pointer.
79 * @param pvBuf Where to store the read data.
80 * @param cbRead How much to read.
81 * @param pcbRead Where to store the amount of data actually read on success.
82 */
83 DECLR3CALLBACKMEMBER(int, pfnReadWr, (PPDMISERIALPORT pInterface, void *pvBuf, size_t cbRead, size_t *pcbRead));
84
85 /**
86 * Notify the device/driver when the status lines changed.
87 *
88 * @returns VBox status code.
89 * @param pInterface Pointer to the interface structure containing the called function pointer.
90 * @param fNewStatusLines New state of the status line pins.
91 * @thread Any thread.
92 */
93 DECLR3CALLBACKMEMBER(int, pfnNotifyStsLinesChanged, (PPDMISERIALPORT pInterface, uint32_t fNewStatusLines));
94
95 /**
96 * Notify the device/driver that a break condition occurred.
97 *
98 * @returns VBox statsus code.
99 * @param pInterface Pointer to the interface structure containing the called function pointer.
100 * @thread Any thread.
101 */
102 DECLR3CALLBACKMEMBER(int, pfnNotifyBrk, (PPDMISERIALPORT pInterface));
103
104} PDMISERIALPORT;
105/** PDMISERIALPORT interface ID. */
106#define PDMISERIALPORT_IID "44540323-06ca-44c1-8eb2-f5a387704dbd"
107
108
109/**
110 * Supported parity modes.
111 */
112typedef enum PDMSERIALPARITY
113{
114 /** Invalid parity setting. */
115 PDMSERIALPARITY_INVALID = 0,
116 /** No parity. */
117 PDMSERIALPARITY_NONE,
118 /** Even parity. */
119 PDMSERIALPARITY_EVEN,
120 /** Odd parity. */
121 PDMSERIALPARITY_ODD,
122 /** Mark parity. */
123 PDMSERIALPARITY_MARK,
124 /** Space parity. */
125 PDMSERIALPARITY_SPACE,
126 /** 32bit hack. */
127 PDMSERIALPARITY_32BIT_HACK = 0x7fffffff
128} PDMSERIALPARITY;
129
130
131/**
132 * Supported number of stop bits.
133 */
134typedef enum PDMSERIALSTOPBITS
135{
136 /** Invalid stop bits setting. */
137 PDMSERIALSTOPBITS_INVALID = 0,
138 /** One stop bit is used. */
139 PDMSERIALSTOPBITS_ONE,
140 /** 1.5 stop bits are used. */
141 PDMSERIALSTOPBITS_ONEPOINTFIVE,
142 /** 2 stop bits are used. */
143 PDMSERIALSTOPBITS_TWO,
144 /** 32bit hack. */
145 PDMSERIALSTOPBITS_32BIT_HACK = 0x7fffffff
146} PDMSERIALSTOPBITS;
147
148
149/** Pointer to a serial interface. */
150typedef struct PDMISERIALCONNECTOR *PPDMISERIALCONNECTOR;
151/**
152 * Serial interface (up).
153 * Pairs with PDMISERIALPORT.
154 */
155typedef struct PDMISERIALCONNECTOR
156{
157 /**
158 * Notifies the lower layer that data is available for writing.
159 *
160 * @returns VBox status code.
161 * @param pInterface Pointer to the interface structure containing the called function pointer.
162 */
163 DECLR3CALLBACKMEMBER(int, pfnDataAvailWrNotify, (PPDMISERIALCONNECTOR pInterface));
164
165 /**
166 * Try to read data from the underyling driver.
167 *
168 * @returns VBox status code.
169 * @param pInterface Pointer to the interface structure containing the called function pointer.
170 * @param pvBuf Where to store the read data.
171 * @param cbRead How much to read.
172 * @param pcbRead Where to store the amount of data actually read on success.
173 */
174 DECLR3CALLBACKMEMBER(int, pfnReadRdr, (PPDMISERIALCONNECTOR pInterface, void *pvBuf, size_t cbRead, size_t *pcbRead));
175
176 /**
177 * Change device parameters.
178 *
179 * @returns VBox status code.
180 * @param pInterface Pointer to the interface structure containing the called function pointer.
181 * @param uBps Speed of the serial connection. (bits per second)
182 * @param enmParity Parity method.
183 * @param cDataBits Number of data bits.
184 * @param enmStopBits Number of stop bits.
185 * @thread Any thread.
186 */
187 DECLR3CALLBACKMEMBER(int, pfnChgParams, (PPDMISERIALCONNECTOR pInterface, uint32_t uBps,
188 PDMSERIALPARITY enmParity, unsigned cDataBits,
189 PDMSERIALSTOPBITS enmStopBits));
190
191 /**
192 * Set the state of the modem lines.
193 *
194 * @returns VBox status code.
195 * @param pInterface Pointer to the interface structure containing the called function pointer.
196 * @param fRts Set to true to make the Request to Send line active otherwise to 0.
197 * @param fDtr Set to true to make the Data Terminal Ready line active otherwise 0.
198 * @thread Any thread.
199 */
200 DECLR3CALLBACKMEMBER(int, pfnChgModemLines, (PPDMISERIALCONNECTOR pInterface, bool fRts, bool fDtr));
201
202 /**
203 * Changes the TD line into the requested break condition.
204 *
205 * @returns VBox status code.
206 * @param pInterface Pointer to the interface structure containing the called function pointer.
207 * @param fBrk Set to true to let the device send a break false to put into normal operation.
208 * @thread Any thread.
209 */
210 DECLR3CALLBACKMEMBER(int, pfnChgBrk, (PPDMISERIALCONNECTOR pInterface, bool fBrk));
211
212 /**
213 * Queries the current state of the status lines.
214 *
215 * @returns VBox status code.
216 * @param pInterface Pointer to the interface structure containing the called function pointer.
217 * @param pfStsLines Where to store the status line states on success.
218 */
219 DECLR3CALLBACKMEMBER(int, pfnQueryStsLines, (PPDMISERIALCONNECTOR pInterface, uint32_t *pfStsLines));
220
221 /**
222 * Flushes the indicated queues.
223 *
224 * @returns VBox status code.
225 * @param pInterface Pointer to the interface structure containing the called function pointer.
226 * @param fQueueRecv Flag whether to flush the receive queue.
227 * @param fQueueXmit Flag whether to flush the transmit queue.
228 */
229 DECLR3CALLBACKMEMBER(int, pfnQueuesFlush, (PPDMISERIALCONNECTOR pInterface, bool fQueueRecv, bool fQueueXmit));
230
231} PDMISERIALCONNECTOR;
232/** PDMIMEDIA interface ID. */
233#define PDMISERIALCONNECTOR_IID "d024f170-c00d-11e8-b568-0800200c9a66"
234
235/** @} */
236
237RT_C_DECLS_END
238
239#endif /* !VBOX_INCLUDED_vmm_pdmserialifs_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette