mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 13:44:32 +02:00
Updated acc to comments
This commit is contained in:
@@ -364,24 +364,10 @@ static inline esp_err_t esp_apptrace_lock_cleanup()
|
|||||||
esp_err_t esp_apptrace_lock(esp_apptrace_tmo_t *tmo)
|
esp_err_t esp_apptrace_lock(esp_apptrace_tmo_t *tmo)
|
||||||
{
|
{
|
||||||
#if CONFIG_ESP32_APPTRACE_LOCK_ENABLE
|
#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);
|
esp_err_t ret = esp_apptrace_lock_take(&s_trace_buf.lock, tmo);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
return ESP_FAIL;
|
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
|
#endif
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
@@ -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.
|
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
|
.. 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;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
if (sz > 4) {
|
if (sz > 4) {
|
||||||
number = (uint32_t *)ptr;
|
number = (uint32_t *)ptr;
|
||||||
printf("Here is the number %d", *number);
|
printf("Here is the number %d", *number);
|
||||||
} else {
|
} 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) {
|
if (res != ESP_OK) {
|
||||||
/* in case of error host tracing tool (e.g. OpenOCD) will report incomplete user buffer */
|
/* in case of error host tracing tool (e.g. OpenOCD) will report incomplete user buffer */
|
||||||
ESP_LOGE("Failed to put buffer!");
|
ESP_LOGE("Failed to put buffer!");
|
||||||
|
Reference in New Issue
Block a user