mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
fix(lp_i2s): added cbs iram check
This commit is contained in:
@ -18,6 +18,7 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "esp_clk_tree.h"
|
#include "esp_clk_tree.h"
|
||||||
|
#include "esp_memory_utils.h"
|
||||||
#include "hal/hal_utils.h"
|
#include "hal/hal_utils.h"
|
||||||
#include "hal/lp_i2s_hal.h"
|
#include "hal/lp_i2s_hal.h"
|
||||||
#include "hal/lp_i2s_ll.h"
|
#include "hal/lp_i2s_ll.h"
|
||||||
@ -250,6 +251,13 @@ esp_err_t lp_i2s_register_event_callbacks(lp_i2s_chan_handle_t handle, const lp_
|
|||||||
ESP_RETURN_ON_FALSE(handle && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
ESP_RETURN_ON_FALSE(handle && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
ESP_RETURN_ON_FALSE(handle->state < I2S_CHAN_STATE_RUNNING, ESP_ERR_INVALID_STATE, TAG, "the channel is in enabled state already");
|
ESP_RETURN_ON_FALSE(handle->state < I2S_CHAN_STATE_RUNNING, ESP_ERR_INVALID_STATE, TAG, "the channel is in enabled state already");
|
||||||
|
|
||||||
|
if (cbs->on_thresh_met) {
|
||||||
|
ESP_RETURN_ON_FALSE(esp_ptr_in_iram(cbs->on_thresh_met), ESP_ERR_INVALID_ARG, TAG, "on_thresh_met callback not in IRAM");
|
||||||
|
}
|
||||||
|
if (cbs->on_request_new_trans) {
|
||||||
|
ESP_RETURN_ON_FALSE(esp_ptr_in_iram(cbs->on_request_new_trans), ESP_ERR_INVALID_ARG, TAG, "on_request_new_trans callback not in IRAM");
|
||||||
|
}
|
||||||
|
|
||||||
handle->cbs.on_thresh_met = cbs->on_thresh_met;
|
handle->cbs.on_thresh_met = cbs->on_thresh_met;
|
||||||
handle->cbs.on_request_new_trans = cbs->on_request_new_trans;
|
handle->cbs.on_request_new_trans = cbs->on_request_new_trans;
|
||||||
handle->user_data = user_data;
|
handle->user_data = user_data;
|
||||||
|
@ -222,7 +222,7 @@ TEST_CASE("test LP I2S read for STD", "[lp_i2s]")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool s_lp_i2s_on_thresh_met(lp_i2s_chan_handle_t handle, lp_i2s_evt_data_t *edata, void *user_data)
|
static bool IRAM_ATTR s_lp_i2s_on_thresh_met(lp_i2s_chan_handle_t handle, lp_i2s_evt_data_t *edata, void *user_data)
|
||||||
{
|
{
|
||||||
ESP_DRAM_LOGD(TAG, "edata->trans.received_size: %d", edata->trans.received_size);
|
ESP_DRAM_LOGD(TAG, "edata->trans.received_size: %d", edata->trans.received_size);
|
||||||
s_data_check(edata->trans.buffer, edata->trans.received_size);
|
s_data_check(edata->trans.buffer, edata->trans.received_size);
|
||||||
@ -230,7 +230,7 @@ static bool s_lp_i2s_on_thresh_met(lp_i2s_chan_handle_t handle, lp_i2s_evt_data_
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool s_lp_i2s_on_request_new_trans(lp_i2s_chan_handle_t handle, lp_i2s_evt_data_t *edata, void *user_data)
|
static bool IRAM_ATTR s_lp_i2s_on_request_new_trans(lp_i2s_chan_handle_t handle, lp_i2s_evt_data_t *edata, void *user_data)
|
||||||
{
|
{
|
||||||
lp_i2s_trans_t trans = *(lp_i2s_trans_t *)user_data;
|
lp_i2s_trans_t trans = *(lp_i2s_trans_t *)user_data;
|
||||||
edata->trans.buffer = trans.buffer;
|
edata->trans.buffer = trans.buffer;
|
||||||
|
Reference in New Issue
Block a user