source: rtems/cpukit/include/rtems/bspIo.h

Last change on this file was bcef89f2, checked in by Sebastian Huber <sebastian.huber@…>, on 05/19/23 at 06:18:25

Update company name

The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.

  • Property mode set to 100644
File size: 11.6 KB
RevLine 
[d999f865]1/* SPDX-License-Identifier: BSD-2-Clause */
2
[21242c2]3/**
[feea03b6]4 * @file
[1bce637]5 *
[d999f865]6 * @ingroup RTEMSAPIKernelCharIO
7 *
8 * @brief This header file provides the kernel character input/output support
9 *   API.
10 */
11
12/*
[bcef89f2]13 * Copyright (C) 2020, 2021 embedded brains GmbH & Co. KG
[d999f865]14 * Copyright (C) 2015 On-Line Applications Research Corporation (OAR)
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 *    notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 *    notice, this list of conditions and the following disclaimer in the
23 *    documentation and/or other materials provided with the distribution.
[9ab091e]24 *
[d999f865]25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
[21242c2]36 */
37
38/*
[d999f865]39 * This file is part of the RTEMS quality process and was automatically
40 * generated.  If you find something that needs to be fixed or
41 * worded better please post a report or patch to an RTEMS mailing list
42 * or raise a bug report:
43 *
44 * https://www.rtems.org/bugs.html
45 *
46 * For information on updating and regenerating please refer to the How-To
47 * section in the Software Requirements Engineering chapter of the
48 * RTEMS Software Engineering manual.  The manual is provided as a part of
49 * a release.  For development sources please refer to the online
50 * documentation at:
[1bce637]51 *
[d999f865]52 * https://docs.rtems.org
[1bce637]53 */
[a575af8]54
[d999f865]55/* Generated from spec:/rtems/io/if/header-3 */
56
[8ff51798]57#ifndef _RTEMS_BSPIO_H
58#define _RTEMS_BSPIO_H
[1bce637]59
[e8020d1]60#include <stdarg.h>
[d999f865]61#include <rtems/score/basedefs.h>
[e8020d1]62
[8eea24b]63#ifdef __cplusplus
64extern "C" {
65#endif
66
[d999f865]67/* Generated from spec:/rtems/io/if/group-3 */
68
[a575af8]69/**
[d999f865]70 * @defgroup RTEMSAPIKernelCharIO Kernel Character I/O Support
[a575af8]71 *
[d999f865]72 * @ingroup RTEMSAPIClassicIO
[4b841b3]73 *
[d999f865]74 * @brief The kernel character input/output support is an extension of the @ref
75 *   RTEMSAPIClassicIO to output characters to the kernel character output
76 *   device and receive characters from the kernel character input device using
77 *   a polled and non-blocking implementation.
[a575af8]78 *
[d999f865]79 * The directives may be used to print debug and test information.  The kernel
80 * character input/output support should work even if no Console Driver is
[1f8b26a]81 * configured, see @ref CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER.  The kernel
[d999f865]82 * character input and output device is provided by the BSP. Applications may
83 * change the device.
[a575af8]84 */
85
[d999f865]86/* Generated from spec:/rtems/io/if/bsp-output-char-function-type */
87
[a575af8]88/**
[d999f865]89 * @ingroup RTEMSAPIKernelCharIO
90 *
91 * @brief Polled character output functions shall have this type.
[1bce637]92 */
[d999f865]93typedef void ( *BSP_output_char_function_type )( char );
94
95/* Generated from spec:/rtems/io/if/bsp-output-char */
[a575af8]96
97/**
[d999f865]98 * @ingroup RTEMSAPIKernelCharIO
99 *
100 * @brief This function pointer references the kernel character output
101 *   implementation.
102 *
103 * This function pointer shall never be NULL.  It shall be provided by the BSP
104 * and statically initialized.  The referenced function shall output exactly
105 * the character specified by the parameter.  In particular, it shall not
106 * perform character translations, for example ``NL`` to ``CR`` followed by
107 * ``NR``.  The function shall not block.
[a575af8]108 */
[d999f865]109extern BSP_output_char_function_type BSP_output_char;
110
111/* Generated from spec:/rtems/io/if/putc */
[1bce637]112
[a575af8]113/**
[d999f865]114 * @ingroup RTEMSAPIKernelCharIO
[1bc0ad2]115 *
[d999f865]116 * @brief Outputs the character to the kernel character output device.
117 *
118 * @param c is the character to output.
119 *
120 * The directive outputs the character specified by ``c`` to the kernel
121 * character output device using the polled character output implementation
122 * provided by #BSP_output_char.  The directive performs a character
123 * translation from ``NL`` to ``CR`` followed by ``NR``.
124 *
125 * If the kernel character output device is concurrently accessed, then
126 * interleaved output may occur.
127 *
128 * @par Constraints
129 * @parblock
130 * The following constraints apply to this directive:
131 *
132 * * The directive may be called from within any runtime context.
133 *
134 * * The directive will not cause the calling task to be preempted.
135 * @endparblock
[a575af8]136 */
[d999f865]137void rtems_putc( char c );
138
139/* Generated from spec:/rtems/io/if/put-char */
[34fd745]140
[a575af8]141/**
[d999f865]142 * @ingroup RTEMSAPIKernelCharIO
143 *
144 * @brief Puts the character using rtems_putc()
145 *
146 * @param c is the character to output.
147 *
148 * @param unused is an unused argument.
149 *
150 * @par Notes
151 * The directive is provided to support the RTEMS Testing Framework.
152 *
153 * @par Constraints
154 * @parblock
155 * The following constraints apply to this directive:
156 *
157 * * The directive may be called from within any runtime context.
158 *
159 * * The directive will not cause the calling task to be preempted.
160 * @endparblock
[1bce637]161 */
[d999f865]162void rtems_put_char( int c, void *unused );
163
164/* Generated from spec:/rtems/io/if/putk */
[a575af8]165
[23c3f72e]166/**
[d999f865]167 * @ingroup RTEMSAPIKernelCharIO
168 *
169 * @brief Outputs the characters of the string and a newline character to the
170 *   kernel character output device.
171 *
172 * @param s is the string to output.
173 *
174 * @return Returns the number of characters output to the kernel character
175 *   output device.
176 *
177 * @par Notes
178 * @parblock
179 * The directive may be used to print debug and test information.  It uses
180 * rtems_putc() to output the characters.  This directive performs a character
181 * translation from ``NL`` to ``CR`` followed by ``NR``.
182 *
183 * If the kernel character output device is concurrently accessed, then
184 * interleaved output may occur.
185 * @endparblock
[23c3f72e]186 *
[d999f865]187 * @par Constraints
188 * @parblock
189 * The following constraints apply to this directive:
[23c3f72e]190 *
[d999f865]191 * * The directive may be called from within any runtime context.
[a575af8]192 *
[d999f865]193 * * The directive will not cause the calling task to be preempted.
194 * @endparblock
[23c3f72e]195 */
[d999f865]196int putk( const char *s );
197
198/* Generated from spec:/rtems/io/if/printk */
[a575af8]199
200/**
[d999f865]201 * @ingroup RTEMSAPIKernelCharIO
202 *
203 * @brief Outputs the characters defined by the format string and the arguments
204 *   to the kernel character output device.
205 *
206 * @param fmt is a printf()-style format string.
207 *
208 * @param ... is a list of optional parameters required by the format string.
209 *
210 * @return Returns the number of characters output to the kernel character
211 *   output device.
[a575af8]212 *
[d999f865]213 * @par Notes
214 * @parblock
215 * The directive may be used to print debug and test information.  It uses
216 * rtems_putc() to output the characters.  This directive performs a character
217 * translation from ``NL`` to ``CR`` followed by ``NR``.
[a575af8]218 *
[d999f865]219 * If the kernel character output device is concurrently accessed, then
220 * interleaved output may occur.
221 * @endparblock
[24d0ee57]222 *
[d999f865]223 * @par Constraints
224 * @parblock
225 * The following constraints apply to this directive:
226 *
227 * * The directive may be called from within any runtime context.
228 *
229 * * The directive will not cause the calling task to be preempted.
230 *
231 * * Formatting of floating point numbers is not supported.
232 * @endparblock
[a575af8]233 */
[d999f865]234RTEMS_PRINTFLIKE( 1, 2 ) int printk( const char *fmt, ... );
[a575af8]235
[d999f865]236/* Generated from spec:/rtems/io/if/vprintk */
[f703e7f]237
[a575af8]238/**
[d999f865]239 * @ingroup RTEMSAPIKernelCharIO
240 *
241 * @brief Outputs the characters defined by the format string and the variable
242 *   argument list to the kernel character output device.
243 *
244 * @param fmt is a printf()-style format string.
[a575af8]245 *
[d999f865]246 * @param ap is the variable argument list required by the format string.
[a575af8]247 *
[d999f865]248 * @return Returns the number of characters output to the kernel character
249 *   output device.
[24d0ee57]250 *
[d999f865]251 * @par Notes
252 * @parblock
253 * The directive may be used to print debug and test information.  It uses
254 * rtems_putc() to output the characters.  This directive performs a character
255 * translation from ``NL`` to ``CR`` followed by ``NR``.
256 *
257 * If the kernel character output device is concurrently accessed, then
258 * interleaved output may occur.
259 * @endparblock
260 *
261 * @par Constraints
262 * @parblock
263 * The following constraints apply to this directive:
264 *
265 * * The directive may be called from within any runtime context.
266 *
267 * * The directive will not cause the calling task to be preempted.
268 *
269 * * Formatting of floating point numbers is not supported.
270 * @endparblock
[a575af8]271 */
[d999f865]272int vprintk( const char *fmt, va_list ap );
273
274/* Generated from spec:/rtems/io/if/printk-printer */
[a575af8]275
276/**
[d999f865]277 * @ingroup RTEMSAPIKernelCharIO
278 *
279 * @brief Outputs the characters defined by the format string and the variable
280 *   argument list to the kernel character output device.
281 *
282 * @param unused is an unused argument.
283 *
284 * @param fmt is a printf()-style format string.
285 *
286 * @param ap is the variable argument list required by the format string.
[a575af8]287 *
[d999f865]288 * @return Returns the number of characters output to the kernel character
289 *   output device.
[a575af8]290 *
[d999f865]291 * @par Notes
292 * @parblock
293 * The directive may be used to print debug and test information.  It uses
294 * rtems_putc() to output the characters.  This directive performs a character
295 * translation from ``NL`` to ``CR`` followed by ``NR``.
[24d0ee57]296 *
[d999f865]297 * If the kernel character output device is concurrently accessed, then
298 * interleaved output may occur.
299 * @endparblock
300 *
301 * @par Constraints
302 * @parblock
303 * The following constraints apply to this directive:
304 *
305 * * The directive may be called from within any runtime context.
306 *
307 * * The directive will not cause the calling task to be preempted.
308 *
309 * * Formatting of floating point numbers is not supported.
310 * @endparblock
[a575af8]311 */
[d999f865]312int rtems_printk_printer( void *unused, const char *fmt, va_list ap );
313
314/* Generated from spec:/rtems/io/if/bsp-polling-getchar-function-type */
[a575af8]315
316/**
[d999f865]317 * @ingroup RTEMSAPIKernelCharIO
[a575af8]318 *
[d999f865]319 * @brief Polled character input functions shall have this type.
[a575af8]320 */
[d999f865]321typedef int (* BSP_polling_getchar_function_type )( void );
322
323/* Generated from spec:/rtems/io/if/bsp-poll-char */
[90a5d194]324
[c584d4e]325/**
[d999f865]326 * @ingroup RTEMSAPIKernelCharIO
[c584d4e]327 *
[d999f865]328 * @brief This function pointer may reference the kernel character input
329 *   implementation.
[c584d4e]330 *
[d999f865]331 * This function pointer may be NULL.  It may reference a function provided by
332 * the BSP.  Referenced functions shall dequeue the least recently received
333 * character from the device and return it as an unsigned character.  If no
334 * character is enqueued on the device, then the function shall immediately
335 * return the value minus one.
[c584d4e]336 */
[d999f865]337extern BSP_polling_getchar_function_type BSP_poll_char;
[c584d4e]338
[d999f865]339/* Generated from spec:/rtems/io/if/getchark */
340
341/**
342 * @ingroup RTEMSAPIKernelCharIO
343 *
344 * @brief Tries to dequeue a character from the kernel character input device.
345 *
346 * The directive tries to dequeue a character from the kernel character input
347 * device using the polled character input implementation referenced by
348 * #BSP_poll_char if it is available.
349 *
350 * @retval -1 The #BSP_poll_char pointer was equal to NULL.
351 *
352 * @retval -1 There was no character enqueued on the kernel character input
353 *   device.
354 *
355 * @return Returns the character least recently enqueued on the kernel
356 *   character input device as an unsigned character value.
357 *
358 * @par Constraints
359 * @parblock
360 * The following constraints apply to this directive:
361 *
362 * * The directive may be called from within any runtime context.
363 *
364 * * The directive will not cause the calling task to be preempted.
365 * @endparblock
366 */
367int getchark( void );
[1bce637]368
[8eea24b]369#ifdef __cplusplus
370}
371#endif
372
[d999f865]373#endif /* _RTEMS_BSPIO_H */
Note: See TracBrowser for help on using the repository browser.