• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  * Description:   LOG PRINTF MODULE
15  * Author:
16  * Create:
17  */
18 
19 #include <stdarg.h>
20 #include "log_printf.h"
21 
22 typedef void (* comrepss_printf_cb)(uint32_t log_addr, uint32_t log_code, uint32_t log_header, va_list args);
23 
24 comrepss_printf_cb g_compress_printf_cb = compress_printf_rom_callback;
25 #if CHIP_LIBRA || CHIP_SOCMN1 || CHIP_BS25 || CHIP_BRANDY
26 comrepss_printf_cb g_compress_log_no_print_cb = compress_log_no_print_rom_callback;
27 #endif
compress_printf_in_rom(uint32_t log_addr,uint32_t log_header_user,uint32_t log_header_eng,...)28 void compress_printf_in_rom(uint32_t log_addr, uint32_t log_header_user, uint32_t log_header_eng, ...)
29 {
30     va_list args;
31     va_start(args, log_header_eng);
32     if (g_compress_printf_cb != NULL) {
33         g_compress_printf_cb(log_addr, log_header_user, log_header_eng, args);
34     }
35     va_end(args);
36 }
37 #if CHIP_LIBRA || CHIP_SOCMN1 || CHIP_BS25 || CHIP_BRANDY
38 // The log is not printed when the log is a compress log.
compress_log_no_print_in_rom(uint32_t log_addr,uint32_t log_header_user,uint32_t log_header_eng,...)39 void compress_log_no_print_in_rom(uint32_t log_addr, uint32_t log_header_user, uint32_t log_header_eng, ...)
40 {
41     va_list args;
42     va_start(args, log_header_eng);
43     if (g_compress_log_no_print_cb != NULL) {
44         g_compress_log_no_print_cb(log_addr, log_header_user, log_header_eng, args);
45     }
46     va_end(args);
47 }
48 #endif
49