rt_printf.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /******************************************************************************
  2. 版权所有:
  3. 文件名称: rt_printf.h
  4. 文件版本: 01.01
  5. 创建作者: sunxi
  6. 创建日期: 2020-06-18
  7. 功能说明: 实时微系统调试输出接口
  8. 其它说明:
  9. 修改记录:
  10. */
  11. #ifndef _RT_PRINTF_H
  12. #define _RT_PRINTF_H
  13. /*------------------------------- 头文件 --------------------------------------
  14. */
  15. #include <time.h>
  16. #include <stdio.h>
  17. /*------------------------------- 宏定义 --------------------------------------
  18. */
  19. #define RT_PRINTF_POSITION() rt_printf("%s:%d\r\n",__FUNCTION__,__LINE__)
  20. /*------------------------------ 类型结构 -------------------------------------
  21. */
  22. //sunxi for history
  23. typedef struct
  24. {
  25. unsigned ms:16;
  26. unsigned min:6;
  27. unsigned :2;
  28. unsigned hour:5;
  29. unsigned :3;
  30. unsigned day:5;
  31. unsigned week:3;
  32. unsigned month:4;
  33. unsigned :4;
  34. unsigned year:7;
  35. unsigned :1;
  36. }CP56_TIME2A_T;
  37. typedef union
  38. {
  39. unsigned char a_time[7];
  40. CP56_TIME2A_T time_t;
  41. }CP56_TIME2A;
  42. /*------------------------------ 函数声明 -------------------------------------
  43. */
  44. // sunxi 20200810 int rt_printf_init(void);
  45. // sunxi 20200810 int rt_printf_exit(void);
  46. int rt_printf_fifo_get(int is_net);
  47. //int rt_printf_time(const char *fmt, ...);
  48. void rt_printf_time2(struct timespec ts);
  49. void print_mem(char *name,void * addr,unsigned int len);
  50. void print_mem_time(char *name,void * addr,unsigned int len);
  51. void print_msg(char *name,void * addr,unsigned int len);
  52. int myprintf(const char *fmt, ...);
  53. void co_printf(const char *fp,const int line);
  54. #define rt_printf_time(fmt,...)\
  55. co_printf(__FILE__,__LINE__);\
  56. myprintf(fmt,##__VA_ARGS__);\
  57. int rt_printf(const char *fmt, ...);
  58. /******************************************************************************
  59. 函数名称: rt_printf_init
  60. 函数版本: 01.01
  61. 创建作者: sunxi
  62. 创建日期: 2022-5-31
  63. 函数说明: 初始化.
  64. 参数说明:
  65. 返回值: 成功返回0, 失败返回-1
  66. 修改记录:
  67. */
  68. int rt_printf_init(void);
  69. /******************************************************************************
  70. 函数名称: rt_printf_exit
  71. 函数版本: 01.01
  72. 创建作者: sunxi
  73. 创建日期: 2022-5-31
  74. 函数说明: 反初始化.
  75. 参数说明:
  76. 返回值: 总是返回0.
  77. 修改记录:
  78. */
  79. int rt_printf_exit(void);
  80. /*------------------------------ 文件结束 -------------------------------------
  81. */
  82. #endif // sunxi 20180627