/****************************************************************************** * * Copyright (C) 2021-2021 amlogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ #ifndef AMLBT_FWLOG_H #define AMLBT_FWLOG_H #ifdef __cplusplus extern "C" { #endif #include #include #define DEFAULT_LOG_DIR "/data/wifi_bt_log/" #define DEFAULT_LOG_FILE "fw_log.txt" #define DEFAULT_FWLOG_PATH DEFAULT_LOG_DIR DEFAULT_LOG_FILE #define FWLOG_PATH_MAX_SIZE 256 #define FWLOG_DIR_MAX_SIZE 128 #define FWLOG_NAME_MAX_SIZE 64 #define FWLOG_PREFIX_MAX_SIZE 32 #define AMLBT_FWLOG_EVENT 0x62 /* debug log switch */ #define FWLOG_DBG_IO false #ifndef LOG_TAG #define LOG_TAG "bt_fw" #endif #ifndef ALOGI #define ALOGI(fmt, args...) \ do { \ fprintf(stderr, "[%s][%s] " fmt "\n", LOG_TAG, __func__, ##args); \ } while (0) #endif #ifndef ALOGD #define ALOGD(fmt, args...) \ do { \ if (FWLOG_DBG_IO) { \ fprintf(stderr, "[%s][%s] " fmt "\n", LOG_TAG, __func__, ##args); \ } \ } while (0) #endif #ifndef ALOGE #define ALOGE(fmt, args...) \ do { \ fprintf(stderr, "[%s][%s] " fmt "\n", LOG_TAG, __func__, ##args); \ } while (0) #endif int fwlog_set_path(const char *new_path); void fwlog_set_size(uint16_t val); void fwlog_set_cnt(uint16_t val); void fwlog_pcap_flag_set(bool val); bool fwlog_pcap_flag_get(void); void fwlog_init(void); void fwlog_close(void); void fwlog_handle_signal(int sig); void fwlog_record(const uint8_t* data, uint32_t data_len); #ifdef __cplusplus } #endif #endif /* AMLBT_FWLOG_H */