hv_vos_Printf.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * @file hv_vos_Printf.h
  3. * @brief Header file of I2C driver.
  4. *
  5. * @verbatim
  6. * ==============================================================================
  7. * ##### How to use #####
  8. * ==============================================================================
  9. * (+) Use ()
  10. *
  11. * @endverbatim
  12. * @author HiView SoC Software Team
  13. * @version 1.0.0
  14. * @date 2023-03-01
  15. */
  16. #ifndef _VOS_PRINTF_H
  17. #define _VOS_PRINTF_H
  18. #include "hv_vos_Types.h"
  19. VOS_EXTERN_C_BEGIN
  20. #ifdef __GNUC__
  21. #define _VOS_SPECIFY_PRINTF_FMT(fmt_idx,arg1_idx) __attribute__((format (printf, fmt_idx, arg1_idx)))
  22. #else
  23. #define _VOS_SPECIFY_PRINTF_FMT(fmt_idx,arg1_idx)
  24. #endif
  25. int Hv_Vos_vsnprintf(char *str, size_t size, const char *fmt, va_list ap);
  26. int Hv_Vos_snprintf(char *str, size_t size, const char *fmt, ...) _VOS_SPECIFY_PRINTF_FMT(3, 4);
  27. int Hv_Vos_vsprintf(char *str, const char *fmt, va_list ap);
  28. int Hv_Vos_sprintf(char *str, const char *fmt, ...) _VOS_SPECIFY_PRINTF_FMT(2, 3);
  29. void Hv_Vos_printf(const char *fmt, ...) _VOS_SPECIFY_PRINTF_FMT(1, 2);
  30. #ifdef HV_CONFIG_NO_PRINTF
  31. #define HV_VSNPRINTF(...)
  32. #define HV_SNPRINTF(...)
  33. INLINE int HV_VSPRINTF(char *str, const char *format, va_list ap)
  34. {
  35. return 0;
  36. }
  37. #define HV_SPRINTF(str, format, ...) (1)
  38. #define HV_PRINTF(...)
  39. #else
  40. #define HV_VSNPRINTF Hv_Vos_vsnprintf
  41. #define HV_SNPRINTF Hv_Vos_snprintf
  42. #define HV_VSPRINTF Hv_Vos_vsprintf
  43. #define HV_SPRINTF Hv_Vos_sprintf
  44. #define HV_PRINTF Hv_Vos_printf
  45. #define HV_PUTCHAR Hv_Vos_STDIO_PutChar
  46. #define HV_FFLUSH Hv_Vos_STDIO_FFlush
  47. #endif
  48. VOS_EXTERN_C_END
  49. #endif