diff --git a/components/app_trace/app_trace.c b/components/app_trace/app_trace.c index 939f3c4840..679686a39a 100644 --- a/components/app_trace/app_trace.c +++ b/components/app_trace/app_trace.c @@ -364,24 +364,10 @@ static inline esp_err_t esp_apptrace_lock_cleanup() esp_err_t esp_apptrace_lock(esp_apptrace_tmo_t *tmo) { #if CONFIG_ESP32_APPTRACE_LOCK_ENABLE - //unsigned cur, elapsed, start = xthal_get_ccount(); - esp_err_t ret = esp_apptrace_lock_take(&s_trace_buf.lock, tmo); if (ret != ESP_OK) { return ESP_FAIL; } - // decrease tmo by actual waiting time - // cur = xthal_get_ccount(); - // if (start <= cur) { - // elapsed = cur - start; - // } else { - // elapsed = ULONG_MAX - start + cur; - // } - // if (ESP_APPTRACE_CPUTICKS2US(elapsed) > *tmo) { - // *tmo = 0; - // } else { - // *tmo -= ESP_APPTRACE_CPUTICKS2US(elapsed); - // } #endif return ESP_OK; } diff --git a/docs/api-guides/app_trace.rst b/docs/api-guides/app_trace.rst index c8e54a6142..0873decb2d 100644 --- a/docs/api-guides/app_trace.rst +++ b/docs/api-guides/app_trace.rst @@ -116,7 +116,7 @@ Also according to his needs user may want to receive data from the host. Piece o ... } -``esp_apptrace_read()`` function uses memcpy to copy host data to user buffer. In some cases it can be more optimal to use ``esp_apptrace_down_buffer_get()`` and ``esp_apptrace_down_buffer_put()`` functions. +``esp_apptrace_read()`` function uses memcpy to copy host data to user buffer. In some cases it can be more optimal to use ``esp_apptrace_down_buffer_get()`` and ``esp_apptrace_down_buffer_put()`` functions. They allow developers to ocupy chunk of read buffer and process it in-place. The following piece of code shows how to do this. .. code-block:: c @@ -135,12 +135,12 @@ They allow developers to ocupy chunk of read buffer and process it in-place. The return ESP_FAIL; } if (sz > 4) { - number = (uint32_t *)ptr; - printf("Here is the number %d", *number); + number = (uint32_t *)ptr; + printf("Here is the number %d", *number); } else { - printf("No data"); + printf("No data"); } - esp_err_t res = esp_apptrace_buffer_put(ESP_APPTRACE_DEST_TRAX, ptr, 100/*tmo in us*/); + esp_err_t res = esp_apptrace_down_buffer_put(ESP_APPTRACE_DEST_TRAX, ptr, 100/*tmo in us*/); if (res != ESP_OK) { /* in case of error host tracing tool (e.g. OpenOCD) will report incomplete user buffer */ ESP_LOGE("Failed to put buffer!");