]>
Commit | Line | Data |
---|---|---|
74510d4b ML |
1 | /* |
2 | * This file is part of the libserialport project. | |
3 | * | |
4 | * Copyright (C) 2013 Martin Ling <martin-libserialport@earth.li> | |
5 | * | |
6 | * This program is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU Lesser General Public License as | |
8 | * published by the Free Software Foundation, either version 3 of the | |
9 | * License, or (at your option) any later version. | |
10 | * | |
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. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
cd5f5281 | 20 | /** |
cf9d365c UH |
21 | * @mainpage libserialport API |
22 | * | |
23 | * Introduction | |
24 | * ============ | |
25 | * | |
26 | * libserialport is a minimal library written in C that is intended to take | |
27 | * care of the OS-specific details when writing software that uses serial ports. | |
28 | * | |
29 | * By writing your serial code to use libserialport, you enable it to work | |
30 | * transparently on any platform supported by the library. | |
31 | * | |
32 | * The operations that are supported are: | |
33 | * | |
34 | * - @ref Enumeration (obtaining a list of serial ports on the system) | |
35 | * - @ref Ports | |
36 | * - @ref Configuration (baud rate, parity, etc.) | |
0151b157 | 37 | * - @ref Signals (modem control lines, breaks, etc.) |
cf9d365c UH |
38 | * - @ref Data |
39 | * - @ref Errors | |
40 | * | |
41 | * libserialport is an open source project released under the LGPL3+ license. | |
42 | * | |
43 | * API principles | |
44 | * ============== | |
45 | * | |
46 | * The API is simple, and designed to be a minimal wrapper around the serial | |
47 | * port support in each OS. | |
48 | * | |
49 | * Most functions take a pointer to a struct sp_port, which represents a serial | |
50 | * port. These structures are always allocated and freed by the library, using | |
51 | * the functions in the @ref Enumeration "Enumeration" section. | |
52 | * | |
0151b157 ML |
53 | * Most functions have return type @ref sp_return and can return only four |
54 | * possible error values: | |
cf9d365c | 55 | * |
6aabf62a ML |
56 | * - @ref SP_ERR_ARG means that a function was called with invalid |
57 | * arguments. This implies a bug in the caller. The arguments passed would | |
58 | * be invalid regardless of the underlying OS or serial device involved. | |
59 | * | |
60 | * - @ref SP_ERR_FAIL means that the OS reported a failure. The error code or | |
61 | * message provided by the OS can be obtained by calling sp_last_error_code() | |
62 | * or sp_last_error_message(). | |
63 | * | |
64 | * - @ref SP_ERR_SUPP indicates that there is no support for the requested | |
65 | * operation in the current OS, driver or device. No error message is | |
66 | * available from the OS in this case. There is either no way to request | |
67 | * the operation in the first place, or libserialport does not know how to | |
68 | * do so in the current version. | |
69 | * | |
70 | * - @ref SP_ERR_MEM indicates that a memory allocation failed. | |
71 | * | |
72 | * All of these error values are negative. | |
cf9d365c | 73 | * |
0151b157 ML |
74 | * Calls that succeed return @ref SP_OK, which is equal to zero. Some functions |
75 | * declared @ref sp_return can also return a positive value for a successful | |
0a1ab8bf | 76 | * numeric result, e.g. sp_blocking_read() or sp_blocking_write(). |
cf9d365c | 77 | */ |
cd5f5281 | 78 | |
8645feda UH |
79 | #ifndef LIBSERIALPORT_LIBSERIALPORT_H |
80 | #define LIBSERIALPORT_LIBSERIALPORT_H | |
e8ffaee9 | 81 | |
5ef8a1ed UH |
82 | #ifdef __cplusplus |
83 | extern "C" { | |
84 | #endif | |
85 | ||
74510d4b ML |
86 | #include <stddef.h> |
87 | #ifdef _WIN32 | |
88 | #include <windows.h> | |
89 | #endif | |
90 | ||
baba0759 UH |
91 | /* Package version macros (e.g. for conditional compilation). */ |
92 | #define SP_PACKAGE_VERSION_MAJOR @SP_PACKAGE_VERSION_MAJOR@ | |
93 | #define SP_PACKAGE_VERSION_MINOR @SP_PACKAGE_VERSION_MINOR@ | |
7de20e39 | 94 | #define SP_PACKAGE_VERSION_MICRO @SP_PACKAGE_VERSION_MICRO@ |
baba0759 UH |
95 | #define SP_PACKAGE_VERSION_STRING "@SP_PACKAGE_VERSION@" |
96 | ||
97 | /* Library/libtool version macros (e.g. for conditional compilation). */ | |
98 | #define SP_LIB_VERSION_CURRENT @SP_LIB_VERSION_CURRENT@ | |
99 | #define SP_LIB_VERSION_REVISION @SP_LIB_VERSION_REVISION@ | |
100 | #define SP_LIB_VERSION_AGE @SP_LIB_VERSION_AGE@ | |
101 | #define SP_LIB_VERSION_STRING "@SP_LIB_VERSION@" | |
102 | ||
cd5f5281 | 103 | /** Return values. */ |
eb6ed20f | 104 | enum sp_return { |
cd5f5281 | 105 | /** Operation completed successfully. */ |
74510d4b | 106 | SP_OK = 0, |
cd5f5281 | 107 | /** Invalid arguments were passed to the function. */ |
e9a2f9c9 | 108 | SP_ERR_ARG = -1, |
cd5f5281 | 109 | /** A system error occured while executing the operation. */ |
e9a2f9c9 | 110 | SP_ERR_FAIL = -2, |
cd5f5281 | 111 | /** A memory allocation failed while executing the operation. */ |
f92f1f0c | 112 | SP_ERR_MEM = -3, |
6aabf62a ML |
113 | /** The requested operation is not supported by this system or device. */ |
114 | SP_ERR_SUPP = -4, | |
74510d4b ML |
115 | }; |
116 | ||
cd5f5281 | 117 | /** Port access modes. */ |
eb6ed20f | 118 | enum sp_mode { |
a036341b ML |
119 | /** Open port for read access. */ |
120 | SP_MODE_READ = 1, | |
121 | /** Open port for write access. */ | |
122 | SP_MODE_WRITE = 2, | |
74510d4b ML |
123 | }; |
124 | ||
fd8fd11a ML |
125 | /** Buffer selection. */ |
126 | enum sp_buffer { | |
127 | /** Input buffer. */ | |
128 | SP_BUF_INPUT = 1, | |
129 | /** Output buffer. */ | |
130 | SP_BUF_OUTPUT = 2, | |
131 | /** Both buffers. */ | |
132 | SP_BUF_BOTH = 3, | |
133 | }; | |
134 | ||
cd5f5281 | 135 | /** Parity settings. */ |
eb6ed20f | 136 | enum sp_parity { |
c200f5c1 | 137 | /** Special value to indicate setting should be left alone. */ |
eb6ed20f | 138 | SP_PARITY_INVALID = -1, |
cd5f5281 | 139 | /** No parity. */ |
74510d4b | 140 | SP_PARITY_NONE = 0, |
cd5f5281 | 141 | /** Odd parity. */ |
20e63a77 ML |
142 | SP_PARITY_ODD = 1, |
143 | /** Even parity. */ | |
144 | SP_PARITY_EVEN = 2, | |
e432ce60 ML |
145 | /** Mark parity. */ |
146 | SP_PARITY_MARK = 3, | |
147 | /** Space parity. */ | |
148 | SP_PARITY_SPACE = 4, | |
74510d4b ML |
149 | }; |
150 | ||
cd5f5281 | 151 | /** RTS pin behaviour. */ |
eb6ed20f | 152 | enum sp_rts { |
c200f5c1 | 153 | /** Special value to indicate setting should be left alone. */ |
eb6ed20f | 154 | SP_RTS_INVALID = -1, |
cd5f5281 | 155 | /** RTS off. */ |
d514a26f | 156 | SP_RTS_OFF = 0, |
cd5f5281 | 157 | /** RTS on. */ |
d514a26f | 158 | SP_RTS_ON = 1, |
cd5f5281 | 159 | /** RTS used for flow control. */ |
cf9d365c | 160 | SP_RTS_FLOW_CONTROL = 2, |
d514a26f ML |
161 | }; |
162 | ||
cd5f5281 | 163 | /** CTS pin behaviour. */ |
eb6ed20f | 164 | enum sp_cts { |
c200f5c1 | 165 | /** Special value to indicate setting should be left alone. */ |
eb6ed20f | 166 | SP_CTS_INVALID = -1, |
cd5f5281 | 167 | /** CTS ignored. */ |
d514a26f | 168 | SP_CTS_IGNORE = 0, |
cd5f5281 | 169 | /** CTS used for flow control. */ |
cf9d365c | 170 | SP_CTS_FLOW_CONTROL = 1, |
d514a26f ML |
171 | }; |
172 | ||
cd5f5281 | 173 | /** DTR pin behaviour. */ |
eb6ed20f | 174 | enum sp_dtr { |
c200f5c1 | 175 | /** Special value to indicate setting should be left alone. */ |
eb6ed20f | 176 | SP_DTR_INVALID = -1, |
cd5f5281 | 177 | /** DTR off. */ |
d514a26f | 178 | SP_DTR_OFF = 0, |
cd5f5281 | 179 | /** DTR on. */ |
d514a26f | 180 | SP_DTR_ON = 1, |
cd5f5281 | 181 | /** DTR used for flow control. */ |
cf9d365c | 182 | SP_DTR_FLOW_CONTROL = 2, |
d514a26f ML |
183 | }; |
184 | ||
cd5f5281 | 185 | /** DSR pin behaviour. */ |
eb6ed20f | 186 | enum sp_dsr { |
c200f5c1 | 187 | /** Special value to indicate setting should be left alone. */ |
eb6ed20f | 188 | SP_DSR_INVALID = -1, |
cd5f5281 | 189 | /** DSR ignored. */ |
d514a26f | 190 | SP_DSR_IGNORE = 0, |
cd5f5281 | 191 | /** DSR used for flow control. */ |
cf9d365c | 192 | SP_DSR_FLOW_CONTROL = 1, |
d514a26f ML |
193 | }; |
194 | ||
cd5f5281 | 195 | /** XON/XOFF flow control behaviour. */ |
eb6ed20f | 196 | enum sp_xonxoff { |
c200f5c1 | 197 | /** Special value to indicate setting should be left alone. */ |
eb6ed20f | 198 | SP_XONXOFF_INVALID = -1, |
cd5f5281 | 199 | /** XON/XOFF disabled. */ |
d514a26f | 200 | SP_XONXOFF_DISABLED = 0, |
cd5f5281 | 201 | /** XON/XOFF enabled for input only. */ |
d514a26f | 202 | SP_XONXOFF_IN = 1, |
cd5f5281 | 203 | /** XON/XOFF enabled for output only. */ |
d514a26f | 204 | SP_XONXOFF_OUT = 2, |
cd5f5281 | 205 | /** XON/XOFF enabled for input and output. */ |
cf9d365c | 206 | SP_XONXOFF_INOUT = 3, |
ac74fdaf ML |
207 | }; |
208 | ||
cd5f5281 | 209 | /** Standard flow control combinations. */ |
eb6ed20f | 210 | enum sp_flowcontrol { |
cd5f5281 | 211 | /** No flow control. */ |
18fc2dd1 | 212 | SP_FLOWCONTROL_NONE = 0, |
cd5f5281 | 213 | /** Software flow control using XON/XOFF characters. */ |
18fc2dd1 | 214 | SP_FLOWCONTROL_XONXOFF = 1, |
cd5f5281 | 215 | /** Hardware flow control using RTS/CTS signals. */ |
18fc2dd1 | 216 | SP_FLOWCONTROL_RTSCTS = 2, |
cd5f5281 | 217 | /** Hardware flow control using DTR/DSR signals. */ |
cf9d365c | 218 | SP_FLOWCONTROL_DTRDSR = 3, |
18fc2dd1 ML |
219 | }; |
220 | ||
8cf7c697 ML |
221 | /** Input signals. */ |
222 | enum sp_signal { | |
223 | /** Clear to send. */ | |
224 | SP_SIG_CTS = 1, | |
225 | /** Data set ready. */ | |
226 | SP_SIG_DSR = 2, | |
227 | /** Data carrier detect. */ | |
228 | SP_SIG_DCD = 4, | |
229 | /** Ring indicator. */ | |
230 | SP_SIG_RI = 8, | |
231 | }; | |
232 | ||
0a1ab8bf UH |
233 | /** |
234 | * @struct sp_port | |
235 | * An opaque structure representing a serial port. | |
236 | */ | |
1c5aae9d | 237 | struct sp_port; |
eb6ed20f | 238 | |
0a1ab8bf UH |
239 | /** |
240 | * @struct sp_port_config | |
241 | * An opaque structure representing the configuration for a serial port. | |
242 | */ | |
9b1502ef | 243 | struct sp_port_config; |
eb6ed20f | 244 | |
091e75fe | 245 | /** |
626d280f | 246 | @defgroup Enumeration Port enumeration |
091e75fe ML |
247 | @{ |
248 | */ | |
249 | ||
cd5f5281 | 250 | /** |
cf9d365c UH |
251 | * Obtain a pointer to a new sp_port structure representing the named port. |
252 | * | |
253 | * The user should allocate a variable of type "struct sp_port *" and pass a | |
254 | * pointer to this to receive the result. | |
255 | * | |
256 | * The result should be freed after use by calling sp_free_port(). | |
257 | * | |
f36c6395 ML |
258 | * If any error is returned, the variable pointed to by port_ptr will be set |
259 | * to NULL. Otherwise, it will be set to point to the newly allocated port. | |
260 | * | |
261 | * @return SP_OK upon success, a negative error code otherwise. | |
cf9d365c | 262 | */ |
eb6ed20f | 263 | enum sp_return sp_get_port_by_name(const char *portname, struct sp_port **port_ptr); |
cd5f5281 ML |
264 | |
265 | /** | |
cf9d365c UH |
266 | * Free a port structure obtained from sp_get_port_by_name() or sp_copy_port(). |
267 | */ | |
e3b2f7a4 | 268 | void sp_free_port(struct sp_port *port); |
cd5f5281 ML |
269 | |
270 | /** | |
cf9d365c UH |
271 | * List the serial ports available on the system. |
272 | * | |
273 | * The result obtained is an array of pointers to sp_port structures, | |
274 | * terminated by a NULL. The user should allocate a variable of type | |
275 | * "struct sp_port **" and pass a pointer to this to receive the result. | |
276 | * | |
277 | * The result should be freed after use by calling sp_free_port_list(). | |
278 | * If a port from the list is to be used after freeing the list, it must be | |
279 | * copied first using sp_copy_port(). | |
280 | * | |
f36c6395 ML |
281 | * If any error is returned, the variable pointed to by list_ptr will be set |
282 | * to NULL. Otherwise, it will be set to point to the newly allocated array. | |
283 | * | |
284 | * @return SP_OK upon success, a negative error code otherwise. | |
cf9d365c | 285 | */ |
eb6ed20f | 286 | enum sp_return sp_list_ports(struct sp_port ***list_ptr); |
cd5f5281 ML |
287 | |
288 | /** | |
cf9d365c UH |
289 | * Make a new copy of a sp_port structure. |
290 | * | |
291 | * The user should allocate a variable of type "struct sp_port *" and pass a | |
292 | * pointer to this to receive the result. | |
293 | * | |
294 | * The copy should be freed after use by calling sp_free_port(). | |
295 | * | |
f36c6395 ML |
296 | * If any error is returned, the variable pointed to by copy_ptr will be set |
297 | * to NULL. Otherwise, it will be set to point to the newly allocated copy. | |
298 | * | |
299 | * @return SP_OK upon success, a negative error code otherwise. | |
cf9d365c | 300 | */ |
eb6ed20f | 301 | enum sp_return sp_copy_port(const struct sp_port *port, struct sp_port **copy_ptr); |
cd5f5281 ML |
302 | |
303 | /** | |
cf9d365c UH |
304 | * Free a port list obtained from sp_list_ports(). |
305 | * | |
306 | * This will also free all the sp_port structures referred to from the list; | |
307 | * any that are to be retained must be copied first using sp_copy_port(). | |
308 | */ | |
d54e9004 | 309 | void sp_free_port_list(struct sp_port **ports); |
e96d8bd2 | 310 | |
091e75fe | 311 | /** |
cf9d365c | 312 | * @} |
0151b157 | 313 | * @defgroup Ports Opening, closing and querying ports |
cf9d365c UH |
314 | * @{ |
315 | */ | |
091e75fe | 316 | |
cd5f5281 | 317 | /** |
cf9d365c UH |
318 | * Open the specified serial port. |
319 | * | |
320 | * @param port Pointer to port structure. | |
321 | * @param flags Flags to use when opening the serial port. | |
322 | * | |
f36c6395 | 323 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 324 | */ |
eb6ed20f | 325 | enum sp_return sp_open(struct sp_port *port, enum sp_mode flags); |
cd5f5281 ML |
326 | |
327 | /** | |
cf9d365c UH |
328 | * Close the specified serial port. |
329 | * | |
f36c6395 | 330 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 331 | */ |
eb6ed20f | 332 | enum sp_return sp_close(struct sp_port *port); |
e96d8bd2 | 333 | |
0151b157 ML |
334 | /** |
335 | * Get the name of a port. | |
336 | * | |
337 | * The name returned is whatever is normally used to refer to a port on the | |
338 | * current operating system; e.g. for Windows it will usually be a "COMn" | |
339 | * device name, and for Unix it will be a device path beginning with "/dev/". | |
340 | * | |
341 | * @param port Pointer to port structure. | |
342 | * | |
343 | * @return The port name, or NULL if an invalid port is passed. The name | |
344 | * string is part of the port structure and may not be used after the | |
345 | * port structure has been freed. | |
346 | */ | |
347 | char *sp_get_port_name(const struct sp_port *port); | |
348 | ||
349 | /** | |
350 | * Get the operating system handle for a port. | |
351 | * | |
352 | * The type of the handle depends on the operating system. On Unix based | |
353 | * systems, the handle is a file descriptor of type "int". On Windows, the | |
354 | * handle is of type "HANDLE". The user should allocate a variable of the | |
355 | * appropriate type and pass a pointer to this to receive the result. | |
356 | * | |
357 | * To obtain a valid handle, the port must first be opened by calling | |
358 | * sp_open() using the same port structure. | |
359 | * | |
360 | * After the port is closed or the port structure freed, the handle may | |
361 | * no longer be valid. | |
362 | * | |
363 | * @warning This feature is provided so that programs may make use of | |
364 | * OS-specific functionality where desired. Doing so obviously | |
365 | * comes at a cost in portability. It also cannot be guaranteed | |
366 | * that direct usage of the OS handle will not conflict with the | |
367 | * library's own usage of the port. Be careful. | |
368 | * | |
369 | * @return SP_OK upon success, a negative error code otherwise. | |
370 | */ | |
371 | enum sp_return sp_get_port_handle(const struct sp_port *port, void *result_ptr); | |
372 | ||
cd5f5281 | 373 | /** |
cf9d365c UH |
374 | * @} |
375 | * @defgroup Configuration Setting port parameters | |
376 | * @{ | |
377 | */ | |
e96d8bd2 | 378 | |
9b1502ef ML |
379 | /** |
380 | * Allocate a port configuration structure. | |
381 | * | |
382 | * The user should allocate a variable of type "struct sp_config *" and pass a | |
383 | * pointer to this to receive the result. The variable will be updated to | |
384 | * point to the new configuration structure. The structure is opaque and must | |
385 | * be accessed via the functions provided. | |
386 | * | |
387 | * All parameters in the structure will be initialised to special values which | |
388 | * are ignored by sp_set_config(). | |
389 | * | |
390 | * The structure should be freed after use by calling sp_free_config(). | |
391 | * | |
392 | * @param config_ptr Pointer to variable to receive result. | |
393 | * | |
394 | * @return SP_OK upon success, a negative error code otherwise. | |
395 | */ | |
396 | enum sp_return sp_new_config(struct sp_port_config **config_ptr); | |
397 | ||
398 | /** | |
399 | * Free a port configuration structure. | |
400 | * | |
401 | * @param config Pointer to configuration structure. | |
402 | */ | |
403 | void sp_free_config(struct sp_port_config *config); | |
404 | ||
cd5f5281 | 405 | /** |
cf9d365c UH |
406 | * Get the current configuration of the specified serial port. |
407 | * | |
9b1502ef ML |
408 | * The user should allocate a configuration structure using sp_new_config() |
409 | * and pass this as the config parameter. The configuration structure will | |
410 | * be updated with the port configuration. | |
cf9d365c | 411 | * |
9b1502ef ML |
412 | * Any parameters that are configured with settings not recognised or |
413 | * supported by libserialport, will be set to special values that are | |
414 | * ignored by sp_set_config(). | |
cf9d365c | 415 | * |
f36c6395 | 416 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 417 | */ |
eb6ed20f | 418 | enum sp_return sp_get_config(struct sp_port *port, struct sp_port_config *config); |
cd5f5281 ML |
419 | |
420 | /** | |
cf9d365c UH |
421 | * Set the configuration for the specified serial port. |
422 | * | |
9b1502ef ML |
423 | * For each parameter in the configuration, there is a special value (usually |
424 | * -1, but see the documentation for each field). These values will be ignored | |
425 | * and the corresponding setting left unchanged on the port. | |
cf9d365c | 426 | * |
f36c6395 | 427 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 428 | */ |
eb6ed20f | 429 | enum sp_return sp_set_config(struct sp_port *port, const struct sp_port_config *config); |
cd5f5281 ML |
430 | |
431 | /** | |
cf9d365c UH |
432 | * Set the baud rate for the specified serial port. |
433 | * | |
434 | * @param port Pointer to port structure. | |
435 | * @param baudrate Baud rate in bits per second. | |
436 | * | |
f36c6395 | 437 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 438 | */ |
eb6ed20f | 439 | enum sp_return sp_set_baudrate(struct sp_port *port, int baudrate); |
cd5f5281 ML |
440 | |
441 | /** | |
9b1502ef ML |
442 | * Get the baud rate from a port configuration. |
443 | * | |
444 | * The user should allocate a variable of type int and pass a pointer to this | |
445 | * to receive the result. | |
446 | * | |
447 | * @param config Pointer to configuration structure. | |
448 | * @param baudrate_ptr Pointer to variable to store result. | |
449 | * | |
450 | * @return SP_OK upon success, a negative error code otherwise. | |
451 | */ | |
452 | enum sp_return sp_get_config_baudrate(const struct sp_port_config *config, int *baudrate_ptr); | |
453 | ||
454 | /** | |
455 | * Set the baud rate in a port configuration. | |
456 | * | |
457 | * @param config Pointer to configuration structure. | |
458 | * @param baudrate Baud rate in bits per second, or -1 to retain current setting. | |
459 | * | |
460 | * @return SP_OK upon success, a negative error code otherwise. | |
461 | */ | |
462 | enum sp_return sp_set_config_baudrate(struct sp_port_config *config, int baudrate); | |
463 | ||
464 | /** | |
465 | * Set the data bits for the specified serial port. | |
cf9d365c UH |
466 | * |
467 | * @param port Pointer to port structure. | |
9b1502ef | 468 | * @param bits Number of data bits. |
cf9d365c | 469 | * |
f36c6395 | 470 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 471 | */ |
eb6ed20f | 472 | enum sp_return sp_set_bits(struct sp_port *port, int bits); |
cd5f5281 ML |
473 | |
474 | /** | |
9b1502ef ML |
475 | * Get the data bits from a port configuration. |
476 | * | |
477 | * The user should allocate a variable of type int and pass a pointer to this | |
478 | * to receive the result. | |
479 | * | |
480 | * @param config Pointer to configuration structure. | |
481 | * @param bits_ptr Pointer to variable to store result. | |
482 | * | |
483 | * @return SP_OK upon success, a negative error code otherwise. | |
484 | */ | |
485 | enum sp_return sp_get_config_bits(const struct sp_port_config *config, int *bits_ptr); | |
486 | ||
487 | /** | |
488 | * Set the data bits in a port configuration. | |
489 | * | |
490 | * @param config Pointer to configuration structure. | |
491 | * @param bits Number of data bits, or -1 to retain current setting. | |
492 | * | |
493 | * @return SP_OK upon success, a negative error code otherwise. | |
494 | */ | |
495 | enum sp_return sp_set_config_bits(struct sp_port_config *config, int bits); | |
496 | ||
497 | /** | |
498 | * Set the parity setting for the specified serial port. | |
cf9d365c UH |
499 | * |
500 | * @param port Pointer to port structure. | |
9b1502ef | 501 | * @param parity Parity setting. |
cf9d365c | 502 | * |
f36c6395 | 503 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 504 | */ |
eb6ed20f | 505 | enum sp_return sp_set_parity(struct sp_port *port, enum sp_parity parity); |
cd5f5281 ML |
506 | |
507 | /** | |
9b1502ef ML |
508 | * Get the parity setting from a port configuration. |
509 | * | |
510 | * The user should allocate a variable of type enum sp_parity and pass a pointer to this | |
511 | * to receive the result. | |
512 | * | |
513 | * @param config Pointer to configuration structure. | |
514 | * @param parity_ptr Pointer to variable to store result. | |
515 | * | |
516 | * @return SP_OK upon success, a negative error code otherwise. | |
517 | */ | |
518 | enum sp_return sp_get_config_parity(const struct sp_port_config *config, enum sp_parity *parity_ptr); | |
519 | ||
520 | /** | |
521 | * Set the parity setting in a port configuration. | |
522 | * | |
523 | * @param config Pointer to configuration structure. | |
524 | * @param parity Parity setting, or -1 to retain current setting. | |
525 | * | |
526 | * @return SP_OK upon success, a negative error code otherwise. | |
527 | */ | |
528 | enum sp_return sp_set_config_parity(struct sp_port_config *config, enum sp_parity parity); | |
529 | ||
530 | /** | |
531 | * Set the stop bits for the specified serial port. | |
cf9d365c UH |
532 | * |
533 | * @param port Pointer to port structure. | |
9b1502ef | 534 | * @param stopbits Number of stop bits. |
cf9d365c | 535 | * |
f36c6395 | 536 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 537 | */ |
eb6ed20f | 538 | enum sp_return sp_set_stopbits(struct sp_port *port, int stopbits); |
cd5f5281 ML |
539 | |
540 | /** | |
9b1502ef | 541 | * Get the stop bits from a port configuration. |
cf9d365c | 542 | * |
9b1502ef ML |
543 | * The user should allocate a variable of type int and pass a pointer to this |
544 | * to receive the result. | |
cf9d365c | 545 | * |
9b1502ef ML |
546 | * @param config Pointer to configuration structure. |
547 | * @param stopbits_ptr Pointer to variable to store result. | |
cf9d365c | 548 | * |
f36c6395 | 549 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 550 | */ |
9b1502ef ML |
551 | enum sp_return sp_get_config_stopbits(const struct sp_port_config *config, int *stopbits_ptr); |
552 | ||
553 | /** | |
554 | * Set the stop bits in a port configuration. | |
555 | * | |
556 | * @param config Pointer to configuration structure. | |
557 | * @param stopbits Number of stop bits, or -1 to retain current setting. | |
558 | * | |
559 | * @return SP_OK upon success, a negative error code otherwise. | |
560 | */ | |
561 | enum sp_return sp_set_config_stopbits(struct sp_port_config *config, int stopbits); | |
18fc2dd1 | 562 | |
cd5f5281 | 563 | /** |
9b1502ef | 564 | * Set the RTS pin behaviour for the specified serial port. |
cf9d365c UH |
565 | * |
566 | * @param port Pointer to port structure. | |
567 | * @param rts RTS pin mode. | |
568 | * | |
f36c6395 | 569 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 570 | */ |
eb6ed20f | 571 | enum sp_return sp_set_rts(struct sp_port *port, enum sp_rts rts); |
cd5f5281 ML |
572 | |
573 | /** | |
9b1502ef ML |
574 | * Get the RTS pin behaviour from a port configuration. |
575 | * | |
576 | * The user should allocate a variable of type enum sp_rts and pass a pointer to this | |
577 | * to receive the result. | |
578 | * | |
579 | * @param config Pointer to configuration structure. | |
580 | * @param rts_ptr Pointer to variable to store result. | |
581 | * | |
582 | * @return SP_OK upon success, a negative error code otherwise. | |
583 | */ | |
584 | enum sp_return sp_get_config_rts(const struct sp_port_config *config, enum sp_rts *rts_ptr); | |
585 | ||
586 | /** | |
587 | * Set the RTS pin behaviour in a port configuration. | |
588 | * | |
589 | * @param config Pointer to configuration structure. | |
590 | * @param rts RTS pin mode, or -1 to retain current setting. | |
591 | * | |
592 | * @return SP_OK upon success, a negative error code otherwise. | |
593 | */ | |
594 | enum sp_return sp_set_config_rts(struct sp_port_config *config, enum sp_rts rts); | |
595 | ||
596 | /** | |
597 | * Set the CTS pin behaviour for the specified serial port. | |
cf9d365c UH |
598 | * |
599 | * @param port Pointer to port structure. | |
600 | * @param cts CTS pin mode. | |
601 | * | |
f36c6395 | 602 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 603 | */ |
eb6ed20f | 604 | enum sp_return sp_set_cts(struct sp_port *port, enum sp_cts cts); |
cd5f5281 ML |
605 | |
606 | /** | |
9b1502ef ML |
607 | * Get the CTS pin behaviour from a port configuration. |
608 | * | |
609 | * The user should allocate a variable of type enum sp_cts and pass a pointer to this | |
610 | * to receive the result. | |
611 | * | |
612 | * @param config Pointer to configuration structure. | |
613 | * @param cts_ptr Pointer to variable to store result. | |
614 | * | |
615 | * @return SP_OK upon success, a negative error code otherwise. | |
616 | */ | |
617 | enum sp_return sp_get_config_cts(const struct sp_port_config *config, enum sp_cts *cts_ptr); | |
618 | ||
619 | /** | |
620 | * Set the CTS pin behaviour in a port configuration. | |
621 | * | |
622 | * @param config Pointer to configuration structure. | |
623 | * @param cts CTS pin mode, or -1 to retain current setting. | |
624 | * | |
625 | * @return SP_OK upon success, a negative error code otherwise. | |
626 | */ | |
627 | enum sp_return sp_set_config_cts(struct sp_port_config *config, enum sp_cts cts); | |
628 | ||
629 | /** | |
630 | * Set the DTR pin behaviour for the specified serial port. | |
cf9d365c UH |
631 | * |
632 | * @param port Pointer to port structure. | |
633 | * @param dtr DTR pin mode. | |
634 | * | |
f36c6395 | 635 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 636 | */ |
eb6ed20f | 637 | enum sp_return sp_set_dtr(struct sp_port *port, enum sp_dtr dtr); |
cd5f5281 ML |
638 | |
639 | /** | |
9b1502ef ML |
640 | * Get the DTR pin behaviour from a port configuration. |
641 | * | |
642 | * The user should allocate a variable of type enum sp_dtr and pass a pointer to this | |
643 | * to receive the result. | |
644 | * | |
645 | * @param config Pointer to configuration structure. | |
646 | * @param dtr_ptr Pointer to variable to store result. | |
647 | * | |
648 | * @return SP_OK upon success, a negative error code otherwise. | |
649 | */ | |
650 | enum sp_return sp_get_config_dtr(const struct sp_port_config *config, enum sp_dtr *dtr_ptr); | |
651 | ||
652 | /** | |
653 | * Set the DTR pin behaviour in a port configuration. | |
654 | * | |
655 | * @param config Pointer to configuration structure. | |
656 | * @param dtr DTR pin mode, or -1 to retain current setting. | |
657 | * | |
658 | * @return SP_OK upon success, a negative error code otherwise. | |
659 | */ | |
660 | enum sp_return sp_set_config_dtr(struct sp_port_config *config, enum sp_dtr dtr); | |
661 | ||
662 | /** | |
663 | * Set the DSR pin behaviour for the specified serial port. | |
cf9d365c UH |
664 | * |
665 | * @param port Pointer to port structure. | |
666 | * @param dsr DSR pin mode. | |
667 | * | |
f36c6395 | 668 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 669 | */ |
eb6ed20f | 670 | enum sp_return sp_set_dsr(struct sp_port *port, enum sp_dsr dsr); |
cd5f5281 ML |
671 | |
672 | /** | |
9b1502ef ML |
673 | * Get the DSR pin behaviour from a port configuration. |
674 | * | |
675 | * The user should allocate a variable of type enum sp_dsr and pass a pointer to this | |
676 | * to receive the result. | |
677 | * | |
678 | * @param config Pointer to configuration structure. | |
679 | * @param dsr_ptr Pointer to variable to store result. | |
680 | * | |
681 | * @return SP_OK upon success, a negative error code otherwise. | |
682 | */ | |
683 | enum sp_return sp_get_config_dsr(const struct sp_port_config *config, enum sp_dsr *dsr_ptr); | |
684 | ||
685 | /** | |
686 | * Set the DSR pin behaviour in a port configuration. | |
687 | * | |
688 | * @param config Pointer to configuration structure. | |
689 | * @param dsr DSR pin mode, or -1 to retain current setting. | |
690 | * | |
691 | * @return SP_OK upon success, a negative error code otherwise. | |
692 | */ | |
693 | enum sp_return sp_set_config_dsr(struct sp_port_config *config, enum sp_dsr dsr); | |
694 | ||
695 | /** | |
696 | * Set the XON/XOFF configuration for the specified serial port. | |
cf9d365c UH |
697 | * |
698 | * @param port Pointer to port structure. | |
9b1502ef | 699 | * @param xon_xoff XON/XOFF mode. |
cf9d365c | 700 | * |
f36c6395 | 701 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 702 | */ |
eb6ed20f | 703 | enum sp_return sp_set_xon_xoff(struct sp_port *port, enum sp_xonxoff xon_xoff); |
e96d8bd2 | 704 | |
9b1502ef ML |
705 | /** |
706 | * Get the XON/XOFF configuration from a port configuration. | |
707 | * | |
708 | * The user should allocate a variable of type enum sp_xonxoff and pass a pointer to this | |
709 | * to receive the result. | |
710 | * | |
711 | * @param config Pointer to configuration structure. | |
712 | * @param xon_xoff_ptr Pointer to variable to store result. | |
713 | * | |
714 | * @return SP_OK upon success, a negative error code otherwise. | |
715 | */ | |
716 | enum sp_return sp_get_config_xon_xoff(const struct sp_port_config *config, enum sp_xonxoff *xon_xoff_ptr); | |
717 | ||
718 | /** | |
719 | * Set the XON/XOFF configuration in a port configuration. | |
720 | * | |
721 | * @param config Pointer to configuration structure. | |
722 | * @param xon_xoff XON/XOFF mode, or -1 to retain current setting. | |
723 | * | |
724 | * @return SP_OK upon success, a negative error code otherwise. | |
725 | */ | |
726 | enum sp_return sp_set_config_xon_xoff(struct sp_port_config *config, enum sp_xonxoff xon_xoff); | |
727 | ||
728 | /** | |
729 | * Set the flow control type in a port configuration. | |
730 | * | |
731 | * This function is a wrapper that sets the RTS, CTS, DTR, DSR and | |
732 | * XON/XOFF settings as necessary for the specified flow control | |
733 | * type. For more fine-grained control of these settings, use their | |
734 | * individual configuration functions. | |
735 | * | |
736 | * @param config Pointer to configuration structure. | |
737 | * @param flowcontrol Flow control setting to use. | |
738 | * | |
739 | * @return SP_OK upon success, a negative error code otherwise. | |
740 | */ | |
741 | enum sp_return sp_set_config_flowcontrol(struct sp_port_config *config, enum sp_flowcontrol flowcontrol); | |
742 | ||
743 | /** | |
744 | * Set the flow control type for the specified serial port. | |
745 | * | |
746 | * This function is a wrapper that sets the RTS, CTS, DTR, DSR and | |
747 | * XON/XOFF settings as necessary for the specified flow control | |
748 | * type. For more fine-grained control of these settings, use their | |
749 | * individual configuration functions. | |
750 | * | |
751 | * @param port Pointer to port structure. | |
752 | * @param flowcontrol Flow control setting to use. | |
753 | * | |
754 | * @return SP_OK upon success, a negative error code otherwise. | |
755 | */ | |
756 | enum sp_return sp_set_flowcontrol(struct sp_port *port, enum sp_flowcontrol flowcontrol); | |
757 | ||
091e75fe | 758 | /** |
cf9d365c UH |
759 | * @} |
760 | * @defgroup Data Reading, writing, and flushing data | |
761 | * @{ | |
091e75fe ML |
762 | */ |
763 | ||
764 | /** | |
2007ce5e ML |
765 | * Read bytes from the specified serial port, blocking until complete. |
766 | * | |
b87deb7c ML |
767 | * @warning If your program runs on Unix, defines its own signal handlers, and |
768 | * needs to abort blocking reads when these are called, then you | |
769 | * should not use this function. It repeats system calls that return | |
770 | * with EINTR. To be able to abort a read from a signal handler, you | |
771 | * should implement your own blocking read using sp_nonblocking_read() | |
2007ce5e ML |
772 | * together with a blocking method that makes sense for your program. |
773 | * E.g. you can obtain the file descriptor for an open port using | |
774 | * sp_get_port_handle() and use this to call select() or pselect(), | |
775 | * with appropriate arrangements to return if a signal is received. | |
cf9d365c | 776 | * |
e3dcf906 ML |
777 | * @param port Pointer to port structure. |
778 | * @param buf Buffer in which to store the bytes read. | |
779 | * @param count Requested number of bytes to read. | |
780 | * @param timeout Timeout in milliseconds, or zero to wait indefinitely. | |
781 | * | |
782 | * @return The number of bytes read on success, or a negative error code. If | |
783 | * the number of bytes returned is less than that requested, the | |
784 | * timeout was reached before the requested number of bytes was | |
785 | * available. If timeout is zero, the function will always return | |
786 | * either the requested number of bytes or a negative error code. | |
787 | */ | |
788 | enum sp_return sp_blocking_read(struct sp_port *port, void *buf, size_t count, unsigned int timeout); | |
789 | ||
790 | /** | |
791 | * Read bytes from the specified serial port, without blocking. | |
cf9d365c UH |
792 | * |
793 | * @param port Pointer to port structure. | |
794 | * @param buf Buffer in which to store the bytes read. | |
795 | * @param count Maximum number of bytes to read. | |
796 | * | |
e3dcf906 ML |
797 | * @return The number of bytes read on success, or a negative error code. The |
798 | * number of bytes returned may be any number from zero to the maximum | |
799 | * that was requested. | |
800 | */ | |
801 | enum sp_return sp_nonblocking_read(struct sp_port *port, void *buf, size_t count); | |
802 | ||
803 | /** | |
804 | * Write bytes to the specified serial port, blocking until complete. | |
805 | * | |
806 | * Note that this function only ensures that the accepted bytes have been | |
807 | * written to the OS; they may be held in driver or hardware buffers and not | |
808 | * yet physically transmitted. To check whether all written bytes have actually | |
809 | * been transmitted, use the sp_output_waiting() function. To wait until all | |
810 | * written bytes have actually been transmitted, use the sp_drain() function. | |
811 | * | |
b87deb7c ML |
812 | * @warning If your program runs on Unix, defines its own signal handlers, and |
813 | * needs to abort blocking writes when these are called, then you | |
814 | * should not use this function. It repeats system calls that return | |
815 | * with EINTR. To be able to abort a write from a signal handler, you | |
816 | * should implement your own blocking write using sp_nonblocking_write() | |
2007ce5e ML |
817 | * together with a blocking method that makes sense for your program. |
818 | * E.g. you can obtain the file descriptor for an open port using | |
819 | * sp_get_port_handle() and use this to call select() or pselect(), | |
820 | * with appropriate arrangements to return if a signal is received. | |
821 | * | |
e3dcf906 ML |
822 | * @param port Pointer to port structure. |
823 | * @param buf Buffer containing the bytes to write. | |
824 | * @param count Requested number of bytes to write. | |
825 | * @param timeout Timeout in milliseconds, or zero to wait indefinitely. | |
826 | * | |
85987464 ML |
827 | * @return The number of bytes written on success, or a negative error code. |
828 | * If the number of bytes returned is less than that requested, the | |
e3dcf906 | 829 | * timeout was reached before the requested number of bytes was |
85987464 | 830 | * written. If timeout is zero, the function will always return |
e3dcf906 ML |
831 | * either the requested number of bytes or a negative error code. In |
832 | * the event of an error there is no way to determine how many bytes | |
833 | * were sent before the error occured. | |
cf9d365c | 834 | */ |
e3dcf906 | 835 | enum sp_return sp_blocking_write(struct sp_port *port, const void *buf, size_t count, unsigned int timeout); |
091e75fe ML |
836 | |
837 | /** | |
e3dcf906 | 838 | * Write bytes to the specified serial port, without blocking. |
cf9d365c | 839 | * |
e3dcf906 ML |
840 | * Note that this function only ensures that the accepted bytes have been |
841 | * written to the OS; they may be held in driver or hardware buffers and not | |
842 | * yet physically transmitted. To check whether all written bytes have actually | |
843 | * been transmitted, use the sp_output_waiting() function. To wait until all | |
844 | * written bytes have actually been transmitted, use the sp_drain() function. | |
cf9d365c UH |
845 | * |
846 | * @param port Pointer to port structure. | |
847 | * @param buf Buffer containing the bytes to write. | |
848 | * @param count Maximum number of bytes to write. | |
849 | * | |
f36c6395 | 850 | * @return The number of bytes written on success, or a negative error code. |
e3dcf906 ML |
851 | * The number of bytes returned may be any number from zero to the |
852 | * maximum that was requested. | |
cf9d365c | 853 | */ |
e3dcf906 | 854 | enum sp_return sp_nonblocking_write(struct sp_port *port, const void *buf, size_t count); |
091e75fe | 855 | |
3353c22f ML |
856 | /** |
857 | * Gets the number of bytes waiting in the input buffer. | |
858 | * | |
859 | * @param port Pointer to port structure. | |
860 | * | |
861 | * @return Number of bytes waiting on success, a negative error code otherwise. | |
862 | */ | |
863 | enum sp_return sp_input_waiting(struct sp_port *port); | |
864 | ||
865 | /** | |
866 | * Gets the number of bytes waiting in the output buffer. | |
867 | * | |
868 | * @param port Pointer to port structure. | |
869 | * | |
870 | * @return Number of bytes waiting on success, a negative error code otherwise. | |
871 | */ | |
872 | enum sp_return sp_output_waiting(struct sp_port *port); | |
873 | ||
091e75fe | 874 | /** |
fd8fd11a ML |
875 | * Flush serial port buffers. Data in the selected buffer(s) is discarded. |
876 | * | |
ea34fba8 | 877 | * @param port Pointer to port structure. |
fd8fd11a | 878 | * @param buffers Which buffer(s) to flush. |
cf9d365c | 879 | * |
f36c6395 | 880 | * @return SP_OK upon success, a negative error code otherwise. |
cf9d365c | 881 | */ |
fd8fd11a | 882 | enum sp_return sp_flush(struct sp_port *port, enum sp_buffer buffers); |
091e75fe | 883 | |
69a3739c ML |
884 | /** |
885 | * Wait for buffered data to be transmitted. | |
886 | * | |
2c827b21 ML |
887 | * @warning If your program runs on Unix, defines its own signal handlers, and |
888 | * needs to abort draining the output buffer when when these are | |
889 | * called, then you should not use this function. It repeats system | |
890 | * calls that return with EINTR. To be able to abort a drain from a | |
891 | * signal handler, you would need to implement your own blocking | |
892 | * drain by polling the result of sp_output_waiting(). | |
893 | * | |
3f099f4f ML |
894 | * @param port Pointer to port structure. |
895 | * | |
f36c6395 | 896 | * @return SP_OK upon success, a negative error code otherwise. |
69a3739c ML |
897 | */ |
898 | enum sp_return sp_drain(struct sp_port *port); | |
899 | ||
90cc3ee6 ML |
900 | /** |
901 | * @} | |
0151b157 | 902 | * @defgroup Signals Port signalling operations |
90cc3ee6 ML |
903 | * @{ |
904 | */ | |
905 | ||
8cf7c697 ML |
906 | /** |
907 | * Gets the status of the control signals for the specified port. | |
908 | * | |
909 | * The user should allocate a variable of type "enum sp_signal" and pass a | |
910 | * pointer to this variable to receive the result. The result is a bitmask | |
911 | * in which individual signals can be checked by bitwise OR with values of | |
912 | * the sp_signal enum. | |
913 | * | |
914 | * @param port Pointer to port structure. | |
915 | * @param signals Pointer to variable to receive result. | |
916 | * | |
f36c6395 | 917 | * @return SP_OK upon success, a negative error code otherwise. |
8cf7c697 ML |
918 | */ |
919 | enum sp_return sp_get_signals(struct sp_port *port, enum sp_signal *signals); | |
920 | ||
90cc3ee6 ML |
921 | /** |
922 | * Put the port transmit line into the break state. | |
923 | * | |
3f099f4f ML |
924 | * @param port Pointer to port structure. |
925 | * | |
f36c6395 | 926 | * @return SP_OK upon success, a negative error code otherwise. |
90cc3ee6 ML |
927 | */ |
928 | enum sp_return sp_start_break(struct sp_port *port); | |
929 | ||
930 | /** | |
931 | * Take the port transmit line out of the break state. | |
932 | * | |
3f099f4f ML |
933 | * @param port Pointer to port structure. |
934 | * | |
f36c6395 | 935 | * @return SP_OK upon success, a negative error code otherwise. |
90cc3ee6 ML |
936 | */ |
937 | enum sp_return sp_end_break(struct sp_port *port); | |
938 | ||
091e75fe | 939 | /** |
cf9d365c UH |
940 | * @} |
941 | * @defgroup Errors Obtaining error information | |
942 | * @{ | |
091e75fe ML |
943 | */ |
944 | ||
cd5f5281 | 945 | /** |
cf9d365c UH |
946 | * Get the error code for a failed operation. |
947 | * | |
948 | * In order to obtain the correct result, this function should be called | |
949 | * straight after the failure, before executing any other system operations. | |
950 | * | |
951 | * @return The system's numeric code for the error that caused the last | |
952 | * operation to fail. | |
953 | */ | |
74510d4b | 954 | int sp_last_error_code(void); |
cd5f5281 ML |
955 | |
956 | /** | |
cf9d365c UH |
957 | * Get the error message for a failed operation. |
958 | * | |
959 | * In order to obtain the correct result, this function should be called | |
960 | * straight after the failure, before executing other system operations. | |
961 | * | |
962 | * @return The system's message for the error that caused the last | |
963 | * operation to fail. This string may be allocated by the function, | |
964 | * and should be freed after use by calling sp_free_error_message(). | |
965 | */ | |
74510d4b | 966 | char *sp_last_error_message(void); |
cd5f5281 ML |
967 | |
968 | /** | |
cf9d365c UH |
969 | * Free an error message returned by sp_last_error_message(). |
970 | */ | |
74510d4b | 971 | void sp_free_error_message(char *message); |
e8ffaee9 | 972 | |
863b35e6 ML |
973 | /** |
974 | * Set the handler function for library debugging messages. | |
975 | * | |
976 | * Debugging messages are generated by the library during each operation, | |
977 | * to help in diagnosing problems. The handler will be called for each | |
978 | * message. The handler can be set to NULL to ignore all debug messages. | |
979 | * | |
980 | * The handler function should accept a format string and variable length | |
981 | * argument list, in the same manner as e.g. printf(). | |
982 | * | |
983 | * The default handler is sp_default_debug_handler(). | |
984 | */ | |
985 | void sp_set_debug_handler(void (*handler)(const char *format, ...)); | |
986 | ||
987 | /** | |
988 | * Default handler function for library debugging messages. | |
989 | * | |
990 | * This function prints debug messages to the standard error stream if the | |
991 | * environment variable LIBSERIALPORT_DEBUG is set. Otherwise, they are | |
992 | * ignored. | |
993 | */ | |
994 | void sp_default_debug_handler(const char *format, ...); | |
995 | ||
cf9d365c | 996 | /** @} */ |
091e75fe | 997 | |
5ef8a1ed UH |
998 | #ifdef __cplusplus |
999 | } | |
1000 | #endif | |
1001 | ||
8645feda | 1002 | #endif |