1 /* 2 * Copyright 2017 NXP 3 * All rights reserved. 4 * 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 * 8 */ 9 10 #ifndef _FSL_STR_H 11 #define _FSL_STR_H 12 13 #include "fsl_common.h" 14 15 /*! 16 * @addtogroup debugconsole 17 * @{ 18 */ 19 20 /******************************************************************************* 21 * Prototypes 22 ******************************************************************************/ 23 #if defined(__cplusplus) 24 extern "C" { 25 #endif /* __cplusplus */ 26 27 /*! 28 * @brief A function pointer which is used when format printf log. 29 */ 30 typedef void (*printfCb)(char *buf, int32_t *indicator, char val, int len); 31 32 /*! 33 * @brief This function outputs its parameters according to a formatted string. 34 * 35 * @note I/O is performed by calling given function pointer using following 36 * (*func_ptr)(c); 37 * 38 * @param[in] fmt Format string for printf. 39 * @param[in] ap Arguments to printf. 40 * @param[in] buf pointer to the buffer 41 * @param cb print callbck function pointer 42 * 43 * @return Number of characters to be print 44 */ 45 int StrFormatPrintf(const char *fmt, va_list ap, char *buf, printfCb cb); 46 47 /*! 48 * @brief Converts an input line of ASCII characters based upon a provided 49 * string format. 50 * 51 * @param[in] line_ptr The input line of ASCII data. 52 * @param[in] format Format first points to the format string. 53 * @param[in] args_ptr The list of parameters. 54 * 55 * @return Number of input items converted and assigned. 56 * @retval IO_EOF When line_ptr is empty string "". 57 */ 58 int StrFormatScanf(const char *line_ptr, char *format, va_list args_ptr); 59 60 #if defined(__cplusplus) 61 } 62 #endif /* __cplusplus */ 63 64 /*! @} */ 65 66 #endif /* _FSL_STR_H */ 67