Changeset d999f865 in rtems
- Timestamp:
- 07/29/21 12:48:40 (3 years ago)
- Branches:
- master
- Children:
- 53c84ac
- Parents:
- 913b326a
- git-author:
- Sebastian Huber <sebastian.huber@…> (07/29/21 12:48:40)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (08/02/21 05:14:05)
- Location:
- cpukit
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/include/rtems/bspIo.h
r913b326a rd999f865 1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 1 3 /** 2 4 * @file 3 5 * 4 * @brief Interface to Kernel Print Methods 5 * 6 * This include file defines the interface to kernel print methods. 6 * @ingroup RTEMSAPIKernelCharIO 7 * 8 * @brief This header file provides the kernel character input/output support 9 * API. 7 10 */ 8 11 9 12 /* 10 * COPYRIGHT (c) 1998 valette@crf.canon.fr 11 * COPYRIGHT (c) 2011 On-Line Applications Research Corporation. 12 * 13 * The license and distribution terms for this file may be 14 * found in the file LICENSE in this distribution or at 15 * http://www.rtems.org/license/LICENSE. 16 */ 13 * Copyright (C) 2020, 2021 embedded brains GmbH (http://www.embedded-brains.de) 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. 24 * 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. 36 */ 37 38 /* 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: 51 * 52 * https://docs.rtems.org 53 */ 54 55 /* Generated from spec:/rtems/io/if/header-3 */ 17 56 18 57 #ifndef _RTEMS_BSPIO_H 19 58 #define _RTEMS_BSPIO_H 20 59 60 #include <stdarg.h> 21 61 #include <rtems/score/basedefs.h> 22 23 #include <stdarg.h>24 62 25 63 #ifdef __cplusplus … … 27 65 #endif 28 66 29 /** 30 * @defgroup BSPIO Kernel Print Support 31 * 32 * @ingroup RTEMSAPIPrintSupport 33 * 34 * This module contains all methods and support related to providing 35 * kernel level print support. 36 * 37 * The following variables below are declared as extern and 38 * MUST be declared and initialized in each BSP. Using this indirect 39 * function, the functionality in this group is tailored for the BSP. 40 * 41 * - BSP_output_char 42 * - BSP_poll_char 43 */ 44 45 /** 46 * This type defines the prototype for the BSP provided method to 47 * print a single character. It is assumed to be polled. 48 */ 49 typedef void (*BSP_output_char_function_type) (char c); 50 51 /** 52 * This type defines the prototype for the BSP provided method to 53 * input a single character. It is assumed to be polled. 54 */ 55 typedef int (*BSP_polling_getchar_function_type) (void); 56 57 /** 58 * This variable points to the BSP provided method to output a 59 * character for the purposes of debug output. 60 * 61 * It must output only the specific character. It must not perform character 62 * translations, e.g. "\n" to "\r\n". 63 */ 64 extern BSP_output_char_function_type BSP_output_char; 65 66 /** 67 * This variable points to the BSP provided method to input a 68 * character for the purposes of debug input. 69 */ 70 extern BSP_polling_getchar_function_type BSP_poll_char; 71 72 /** 73 * @brief Get Character (kernel I/O) 74 * 75 * This method polls for a key in the simplest possible fashion 76 * from whatever the debug console device is. 77 * 78 * @return If a character is available, it is returned. Otherwise 79 * this method returns -1. 80 * 81 * @note This method uses the BSP_poll_char pointer to a BSP 82 * provided method. 83 */ 84 extern int getchark(void); 85 86 /** 87 * @brief Variable Argument printk() 88 * 89 * This method allows the user to access printk() functionality 90 * with a va_list style argument. 91 * 92 * @param[in] fmt is a printf()-style format string 93 * @param[in] ap is a va_list pointer to arguments 94 * 95 * @return The number of characters output. 96 */ 97 extern int vprintk(const char *fmt, va_list ap); 98 99 int rtems_printk_printer( 100 void *ignored, 101 const char *format, 102 va_list ap 103 ); 104 105 /** 106 * @brief Kernel Print 107 * 108 * This method allows the user to perform a debug printk(). It performs a 109 * character translation from "\n" to "\r\n". 110 * 111 * @param[in] fmt is a printf()-style format string 112 * 113 * @return The number of characters output. 114 */ 115 extern int printk(const char *fmt, ...) RTEMS_PRINTFLIKE(1, 2); 116 117 /** 118 * @brief Kernel Put String 119 * 120 * This method allows the user to perform a debug puts(). 121 * 122 * @param[in] s is the string to print 123 * 124 * @return The number of characters output. 125 */ 126 extern int putk(const char *s); 127 128 /** 129 * @brief Kernel Put Character 130 * 131 * This method allows the user to perform a debug putc(). It performs a 132 * character translation from "\n" to "\r\n". 133 * 134 * @param[in] c is the character to print 135 */ 136 extern void rtems_putc(char c); 137 138 /** 139 * @brief Puts the character via rtems_putc(). 140 * 141 * This is a compatibility function to support an internal API. 142 * 143 * @param c The character to put. 144 * @param arg Ignored. 145 */ 146 void rtems_put_char( int c, void *arg ); 147 148 /**@}*/ 67 /* Generated from spec:/rtems/io/if/group-3 */ 68 69 /** 70 * @defgroup RTEMSAPIKernelCharIO Kernel Character I/O Support 71 * 72 * @ingroup RTEMSAPIClassicIO 73 * 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. 78 * 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 81 * configured, see #CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER. The kernel 82 * character input and output device is provided by the BSP. Applications may 83 * change the device. 84 */ 85 86 /* Generated from spec:/rtems/io/if/bsp-output-char-function-type */ 87 88 /** 89 * @ingroup RTEMSAPIKernelCharIO 90 * 91 * @brief Polled character output functions shall have this type. 92 */ 93 typedef void ( *BSP_output_char_function_type )( char ); 94 95 /* Generated from spec:/rtems/io/if/bsp-output-char */ 96 97 /** 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. 108 */ 109 extern BSP_output_char_function_type BSP_output_char; 110 111 /* Generated from spec:/rtems/io/if/putc */ 112 113 /** 114 * @ingroup RTEMSAPIKernelCharIO 115 * 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 136 */ 137 void rtems_putc( char c ); 138 139 /* Generated from spec:/rtems/io/if/put-char */ 140 141 /** 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 161 */ 162 void rtems_put_char( int c, void *unused ); 163 164 /* Generated from spec:/rtems/io/if/putk */ 165 166 /** 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 186 * 187 * @par Constraints 188 * @parblock 189 * The following constraints apply to this directive: 190 * 191 * * The directive may be called from within any runtime context. 192 * 193 * * The directive will not cause the calling task to be preempted. 194 * @endparblock 195 */ 196 int putk( const char *s ); 197 198 /* Generated from spec:/rtems/io/if/printk */ 199 200 /** 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. 212 * 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``. 218 * 219 * If the kernel character output device is concurrently accessed, then 220 * interleaved output may occur. 221 * @endparblock 222 * 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 233 */ 234 RTEMS_PRINTFLIKE( 1, 2 ) int printk( const char *fmt, ... ); 235 236 /* Generated from spec:/rtems/io/if/vprintk */ 237 238 /** 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. 245 * 246 * @param ap is the variable argument list required by the format string. 247 * 248 * @return Returns the number of characters output to the kernel character 249 * output device. 250 * 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 271 */ 272 int vprintk( const char *fmt, va_list ap ); 273 274 /* Generated from spec:/rtems/io/if/printk-printer */ 275 276 /** 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. 287 * 288 * @return Returns the number of characters output to the kernel character 289 * output device. 290 * 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``. 296 * 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 311 */ 312 int rtems_printk_printer( void *unused, const char *fmt, va_list ap ); 313 314 /* Generated from spec:/rtems/io/if/bsp-polling-getchar-function-type */ 315 316 /** 317 * @ingroup RTEMSAPIKernelCharIO 318 * 319 * @brief Polled character input functions shall have this type. 320 */ 321 typedef int (* BSP_polling_getchar_function_type )( void ); 322 323 /* Generated from spec:/rtems/io/if/bsp-poll-char */ 324 325 /** 326 * @ingroup RTEMSAPIKernelCharIO 327 * 328 * @brief This function pointer may reference the kernel character input 329 * implementation. 330 * 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. 336 */ 337 extern BSP_polling_getchar_function_type BSP_poll_char; 338 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 */ 367 int getchark( void ); 149 368 150 369 #ifdef __cplusplus … … 152 371 #endif 153 372 154 #endif 373 #endif /* _RTEMS_BSPIO_H */ -
cpukit/libcsupport/src/getchark.c
r913b326a rd999f865 2 2 * @file 3 3 * 4 * @ingroup BSPIO4 * @ingroup RTEMSAPIKernelCharIO 5 5 * 6 6 * @brief This source file contains the implementation of getchark(). -
cpukit/libcsupport/src/printk.c
r913b326a rd999f865 1 1 /** 2 * 2 * @file 3 3 * 4 * @brief Kernel Printf Function 5 * @ingroup libcsupport 4 * @ingroup RTEMSAPIKernelCharIO 5 * 6 * @brief This source file contains the implementation of printk(). 6 7 */ 7 8 -
cpukit/libcsupport/src/printk_plugin.c
r913b326a rd999f865 1 1 /** 2 * 2 * @file 3 3 * 4 * @brief Plugin Printk 5 * @ingroup libcsupport 4 * @ingroup RTEMSAPIKernelCharIO 5 * @ingroup RTEMSPrintSupport 6 * 7 * @brief This source file contains the implementation of 8 * rtems_printk_printer() and rtems_print_printer_printk(). 6 9 */ 7 10 -
cpukit/libcsupport/src/putk.c
r913b326a rd999f865 1 1 /** 2 * 2 * @file 3 3 * 4 * @brief Write Character to Stream 5 * @ingroup libcsupport 4 * @ingroup RTEMSAPIKernelCharIO 5 * 6 * @brief This source file contains the implementation of putk(). 6 7 */ 7 8 -
cpukit/libcsupport/src/rtems_put_char.c
r913b326a rd999f865 1 1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 3 /** 4 * @file 5 * 6 * @ingroup RTEMSAPIKernelCharIO 7 * 8 * @brief This source file contains the implementation of rtems_put_char(). 9 */ 2 10 3 11 /* -
cpukit/libcsupport/src/rtems_putc.c
r913b326a rd999f865 4 4 * @file 5 5 * 6 * @ingroup BSPIO6 * @ingroup RTEMSAPIKernelCharIO 7 7 * 8 8 * @brief This source file contains the implementation of rtems_putc(). -
cpukit/libcsupport/src/vprintk.c
r913b326a rd999f865 1 1 /** 2 * 2 * @file 3 3 * 4 * @brief Print Formatted Output 5 * @ingroup libcsupport 4 * @ingroup RTEMSAPIKernelCharIO 5 * 6 * @brief This source file contains the implementation of vprintk(). 6 7 */ 7 8
Note: See TracChangeset
for help on using the changeset viewer.