Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 1 | /* |
yang.li | b06e0a8 | 2022-01-10 17:35:09 +0800 | [diff] [blame] | 2 | * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved. |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 3 | * |
yang.li | b06e0a8 | 2022-01-10 17:35:09 +0800 | [diff] [blame] | 4 | * SPDX-License-Identifier: MIT |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __AML_PRINTF_H__ |
| 8 | #define __AML_PRINTF_H__ |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | |
xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame^] | 14 | #include <stdarg.h> /* For va_list */ |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 15 | #include <stdint.h> |
| 16 | #include <stddef.h> |
| 17 | |
| 18 | #include "common.h" |
| 19 | #include "FreeRTOSConfig.h" |
| 20 | |
xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame^] | 21 | #define KERN_ERROR 1 |
| 22 | #define KERN_WARNING 2 |
| 23 | #define KERN_DEBUG 3 |
| 24 | #define KERN_INFO 4 |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 25 | |
| 26 | #ifndef TAG |
| 27 | #define TAG |
| 28 | #endif |
| 29 | |
| 30 | #if CONFIG_LOGLEVEL_DEFAULT >= 1 |
xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame^] | 31 | #define AGLOGE(format, ...) LOGE(KERN_ERROR, TAG format, ##__VA_ARGS__) |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 32 | #else |
| 33 | #define AGLOGE(format, ...) |
| 34 | #endif |
| 35 | |
| 36 | #if CONFIG_LOGLEVEL_DEFAULT >= 2 |
xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame^] | 37 | #define AGLOGW(format, ...) LOGW(KERN_WARNING, TAG format, ##__VA_ARGS__) |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 38 | #else |
| 39 | #define AGLOGW(format, ...) |
| 40 | #endif |
| 41 | |
| 42 | #if CONFIG_LOGLEVEL_DEFAULT >= 3 |
xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame^] | 43 | #define AGLOGD(format, ...) LOGD(KERN_DEBUG, TAG format, ##__VA_ARGS__) |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 44 | #else |
| 45 | #define AGLOGD(format, ...) |
| 46 | #endif |
| 47 | |
xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame^] | 48 | int vfnprintf(int (*addchar)(void *context, int c), void *context, const char *format, |
| 49 | va_list args); |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 50 | |
xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame^] | 51 | int sPrintf_ext(char *str, size_t size, const char *format, va_list args); |
| 52 | int printf(const char *fmt, ...); |
| 53 | int iprintf(const char *fmt, ...); |
| 54 | int printk(const char *fmt, ...); |
| 55 | int sPrintf(char *str, size_t size, const char *fmt, ...); |
| 56 | int syslog_buf_init(void); |
| 57 | int iprint_string(char *str); |
Xiaohu.Huang | 60a7f2f | 2021-10-25 15:40:57 +0800 | [diff] [blame] | 58 | |
| 59 | #ifdef __cplusplus |
| 60 | } |
| 61 | #endif |
| 62 | |
xiaohu.huang | 1fd6f11 | 2022-05-24 11:02:05 +0800 | [diff] [blame^] | 63 | #endif /* __CROS_EC_PRINTF_H */ |