blob: 8cf22cbc9c6900a4a3bef16f452965419625ab4c [file] [log] [blame]
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +08001/*
yang.lib06e0a82022-01-10 17:35:09 +08002 * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +08003 *
yang.lib06e0a82022-01-10 17:35:09 +08004 * SPDX-License-Identifier: MIT
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +08005 */
6
7#ifndef __AML_PRINTF_H__
8#define __AML_PRINTF_H__
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
xiaohu.huang1fd6f112022-05-24 11:02:05 +080014#include <stdarg.h> /* For va_list */
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +080015#include <stdint.h>
16#include <stddef.h>
17
18#include "common.h"
19#include "FreeRTOSConfig.h"
20
xiaohu.huang1fd6f112022-05-24 11:02:05 +080021#define KERN_ERROR 1
22#define KERN_WARNING 2
23#define KERN_DEBUG 3
24#define KERN_INFO 4
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +080025
26#ifndef TAG
27#define TAG
28#endif
29
30#if CONFIG_LOGLEVEL_DEFAULT >= 1
xiaohu.huang1fd6f112022-05-24 11:02:05 +080031#define AGLOGE(format, ...) LOGE(KERN_ERROR, TAG format, ##__VA_ARGS__)
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +080032#else
33#define AGLOGE(format, ...)
34#endif
35
36#if CONFIG_LOGLEVEL_DEFAULT >= 2
xiaohu.huang1fd6f112022-05-24 11:02:05 +080037#define AGLOGW(format, ...) LOGW(KERN_WARNING, TAG format, ##__VA_ARGS__)
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +080038#else
39#define AGLOGW(format, ...)
40#endif
41
42#if CONFIG_LOGLEVEL_DEFAULT >= 3
xiaohu.huang1fd6f112022-05-24 11:02:05 +080043#define AGLOGD(format, ...) LOGD(KERN_DEBUG, TAG format, ##__VA_ARGS__)
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +080044#else
45#define AGLOGD(format, ...)
46#endif
47
xiaohu.huang1fd6f112022-05-24 11:02:05 +080048int vfnprintf(int (*addchar)(void *context, int c), void *context, const char *format,
49 va_list args);
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +080050
xiaohu.huang1fd6f112022-05-24 11:02:05 +080051int sPrintf_ext(char *str, size_t size, const char *format, va_list args);
52int printf(const char *fmt, ...);
53int iprintf(const char *fmt, ...);
54int printk(const char *fmt, ...);
55int sPrintf(char *str, size_t size, const char *fmt, ...);
56int syslog_buf_init(void);
57int iprint_string(char *str);
Xiaohu.Huang60a7f2f2021-10-25 15:40:57 +080058
59#ifdef __cplusplus
60}
61#endif
62
xiaohu.huang1fd6f112022-05-24 11:02:05 +080063#endif /* __CROS_EC_PRINTF_H */