From 6af8d2edeef79d82344bb1aa25b5971cea8bc279 Mon Sep 17 00:00:00 2001 From: SalimTerryLi Date: Wed, 1 Sep 2021 13:58:47 +0800 Subject: [PATCH] hal: remove usages of esp_log in HAL --- components/hal/esp32s2/adc_hal.c | 1 - components/hal/platform_port/include/hal/log.h | 6 ++++++ components/hal/sdio_slave_hal.c | 14 +++++++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/components/hal/esp32s2/adc_hal.c b/components/hal/esp32s2/adc_hal.c index b11de2776f..d1196c61e3 100644 --- a/components/hal/esp32s2/adc_hal.c +++ b/components/hal/esp32s2/adc_hal.c @@ -18,7 +18,6 @@ #include "hal/adc_hal.h" #include "hal/adc_types.h" #include "hal/adc_hal_conf.h" -#include "esp_log.h" /*--------------------------------------------------------------- Digital controller setting diff --git a/components/hal/platform_port/include/hal/log.h b/components/hal/platform_port/include/hal/log.h index 28bde429d4..6d5cbda381 100644 --- a/components/hal/platform_port/include/hal/log.h +++ b/components/hal/platform_port/include/hal/log.h @@ -21,3 +21,9 @@ #define HAL_LOGI(...) ESP_LOGI(__VA_ARGS__) #define HAL_LOGD(...) ESP_LOGD(__VA_ARGS__) #define HAL_LOGV(...) ESP_LOGV(__VA_ARGS__) + +#define HAL_EARLY_LOGE(...) ESP_EARLY_LOGE(__VA_ARGS__) +#define HAL_EARLY_LOGW(...) ESP_EARLY_LOGW(__VA_ARGS__) +#define HAL_EARLY_LOGI(...) ESP_EARLY_LOGI(__VA_ARGS__) +#define HAL_EARLY_LOGD(...) ESP_EARLY_LOGD(__VA_ARGS__) +#define HAL_EARLY_LOGV(...) ESP_EARLY_LOGV(__VA_ARGS__) diff --git a/components/hal/sdio_slave_hal.c b/components/hal/sdio_slave_hal.c index 457d4b9a1a..aa7568ee39 100644 --- a/components/hal/sdio_slave_hal.c +++ b/components/hal/sdio_slave_hal.c @@ -325,11 +325,11 @@ static void send_new_packet(sdio_slave_context_t *hal) // update pkt_len register to allow host reading. sdio_slave_ll_send_write_len(hal->slc, end_desc->pkt_len); - ESP_EARLY_LOGV(TAG, "send_length_write: %d, last_len: %08X", end_desc->pkt_len, sdio_slave_ll_send_read_len(hal->host)); + HAL_EARLY_LOGV(TAG, "send_length_write: %d, last_len: %08X", end_desc->pkt_len, sdio_slave_ll_send_read_len(hal->host)); send_set_state(hal, STATE_SENDING); - ESP_EARLY_LOGD(TAG, "restart new send: %p->%p, pkt_len: %d", start_desc, end_desc, end_desc->pkt_len); + HAL_EARLY_LOGD(TAG, "restart new send: %p->%p, pkt_len: %d", start_desc, end_desc, end_desc->pkt_len); } static esp_err_t send_check_new_packet(sdio_slave_context_t *hal) @@ -374,7 +374,7 @@ esp_err_t sdio_slave_hal_send_reset_counter(sdio_slave_context_t* hal) "reset counter when transmission started", ESP_ERR_INVALID_STATE); sdio_slave_ll_send_write_len(hal->slc, 0); - ESP_EARLY_LOGV(TAG, "last_len: %08X", sdio_slave_ll_send_read_len(hal->host)); + HAL_EARLY_LOGV(TAG, "last_len: %08X", sdio_slave_ll_send_read_len(hal->host)); hal->tail_pkt_len = 0; sdio_slave_hal_send_desc_t *desc = hal->in_flight_head; @@ -674,20 +674,20 @@ void sdio_slave_hal_load_buf(sdio_slave_context_t *hal, lldesc_t *desc) static inline void show_queue_item(lldesc_t *item) { - ESP_EARLY_LOGI(TAG, "=> %p: size: %d(%d), eof: %d, owner: %d", item, item->size, item->length, item->eof, item->owner); - ESP_EARLY_LOGI(TAG, " buf: %p, stqe_next: %p", item->buf, item->qe.stqe_next); + HAL_EARLY_LOGI(TAG, "=> %p: size: %d(%d), eof: %d, owner: %d", item, item->size, item->length, item->eof, item->owner); + HAL_EARLY_LOGI(TAG, " buf: %p, stqe_next: %p", item->buf, item->qe.stqe_next); } static void __attribute((unused)) dump_queue(sdio_slave_hal_recv_stailq_t *queue) { int cnt = 0; lldesc_t *item = NULL; - ESP_EARLY_LOGI(TAG, ">>>>> first: %p, last: %p <<<<<", queue->stqh_first, queue->stqh_last); + HAL_EARLY_LOGI(TAG, ">>>>> first: %p, last: %p <<<<<", queue->stqh_first, queue->stqh_last); STAILQ_FOREACH(item, queue, qe) { cnt++; show_queue_item(item); } - ESP_EARLY_LOGI(TAG, "total: %d", cnt); + HAL_EARLY_LOGI(TAG, "total: %d", cnt); } /*---------------------------------------------------------------------------