fsl_str.h 1.6 KB

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