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 * Prototypes 17 ******************************************************************************/ 18 #if defined(__cplusplus) 19 extern "C" { 20 #endif /* __cplusplus */ 21 22 /*! 23 * @brief A function pointer which is used when format printf log. 24 */ 25 typedef void (*printfCb)(char *buf, int32_t *indicator, char val, int len); 26 27 /*! 28 * @brief This function outputs its parameters according to a formatted string. 29 * 30 * @note I/O is performed by calling given function pointer using following 31 * (*func_ptr)(c); 32 * 33 * @param[in] fmt_ptr Format string for printf. 34 * @param[in] args_ptr Arguments to printf. 35 * @param[in] buf pointer to the buffer 36 * @param cb print callbck function pointer 37 * 38 * @return Number of characters to be print 39 */ 40 int StrFormatPrintf(const char *fmt, va_list ap, char *buf, printfCb cb); 41 42 /*! 43 * @brief Converts an input line of ASCII characters based upon a provided 44 * string format. 45 * 46 * @param[in] line_ptr The input line of ASCII data. 47 * @param[in] format Format first points to the format string. 48 * @param[in] args_ptr The list of parameters. 49 * 50 * @return Number of input items converted and assigned. 51 * @retval IO_EOF When line_ptr is empty string "". 52 */ 53 int StrFormatScanf(const char *line_ptr, char *format, va_list args_ptr); 54 55 #if defined(__cplusplus) 56 } 57 #endif /* __cplusplus */ 58 59 #endif /* _FSL_STR_H */ 60