mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Updated acc to comments
This commit is contained in:
parent
c2c9149a24
commit
60c45ae2c4
@ -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;
|
||||
}
|
||||
|
@ -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!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user