mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
arch/risc-v: register Wi-Fi IRQs in non_iram mask for SPI flash
Wi-Fi used a locally allocated vector_desc, so those CPU interrupt lines were never recorded in the HAL non_iram_int_mask. During SPI flash, esp_intr_noniram_disable() therefore did not mask them, and Wi-Fi ISRs could still run with the cache off. Now, Wi-Fi IRQs are treated as non-IRAM and get masked while flash/cache is suspended. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
This commit is contained in:
committed by
Xiang Xiao
parent
0885b45256
commit
e8bcbbc5d3
@@ -40,6 +40,7 @@
|
|||||||
#include "esp_hr_timer.h"
|
#include "esp_hr_timer.h"
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "esp_intr_alloc.h"
|
||||||
#include "esp_mac.h"
|
#include "esp_mac.h"
|
||||||
#include "esp_random.h"
|
#include "esp_random.h"
|
||||||
#include "esp_private/wifi_os_adapter.h"
|
#include "esp_private/wifi_os_adapter.h"
|
||||||
@@ -85,6 +86,12 @@ struct vector_desc_t
|
|||||||
vector_desc_t *next;
|
vector_desc_t *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* From esp_hw_support/intr_alloc.c: returns a pointer to a HAL-owned
|
||||||
|
* vector descriptor for some intno and cpu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern vector_desc_t *get_desc_for_int(int intno, int cpu);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -532,7 +539,9 @@ static void wifi_delete_queue_wrapper(void *queue)
|
|||||||
* Name: set_intr_wrapper
|
* Name: set_intr_wrapper
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Do nothing
|
* Route the Wi-Fi interrupt source and attach a handle that uses the HAL
|
||||||
|
* global vector descriptor list. Mark the CPU line as non-IRAM so
|
||||||
|
* esp_intr_noniram_disable() masks it while SPI flash holds the cache off.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* cpu_no - The CPU which the interrupt number belongs.
|
* cpu_no - The CPU which the interrupt number belongs.
|
||||||
@@ -550,6 +559,7 @@ static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source,
|
|||||||
{
|
{
|
||||||
intr_handle_t handle;
|
intr_handle_t handle;
|
||||||
int irq = ESP_SOURCE2IRQ(intr_source);
|
int irq = ESP_SOURCE2IRQ(intr_source);
|
||||||
|
esp_err_t err;
|
||||||
|
|
||||||
wlinfo("cpu_no=%" PRId32 ", intr_source=%" PRIu32
|
wlinfo("cpu_no=%" PRId32 ", intr_source=%" PRIu32
|
||||||
", intr_num=%" PRIu32 ", intr_prio=%" PRId32 "\n",
|
", intr_num=%" PRIu32 ", intr_prio=%" PRId32 "\n",
|
||||||
@@ -566,22 +576,24 @@ static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->vector_desc = kmm_calloc(1, sizeof(vector_desc_t));
|
handle->vector_desc = get_desc_for_int(intr_num, cpu_no);
|
||||||
if (handle->vector_desc == NULL)
|
if (handle->vector_desc == NULL)
|
||||||
{
|
{
|
||||||
wlerr("Failed to kmm_calloc\n");
|
wlerr("get_desc_for_int failed\n");
|
||||||
kmm_free(handle);
|
kmm_free(handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->vector_desc->intno = intr_num;
|
|
||||||
handle->vector_desc->cpu = cpu_no;
|
|
||||||
handle->vector_desc->source = intr_source;
|
handle->vector_desc->source = intr_source;
|
||||||
handle->vector_desc->shared_vec_info = NULL;
|
|
||||||
handle->vector_desc->next = NULL;
|
|
||||||
handle->shared_vector_desc = NULL;
|
handle->shared_vector_desc = NULL;
|
||||||
|
|
||||||
esp_set_handle(cpu_no, irq, handle);
|
esp_set_handle(cpu_no, irq, handle);
|
||||||
|
|
||||||
|
err = esp_intr_set_in_iram(handle, false);
|
||||||
|
if (err != ESP_OK)
|
||||||
|
{
|
||||||
|
wlerr("esp_intr_set_in_iram failed: %d\n", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -121,6 +121,12 @@ struct vector_desc_t
|
|||||||
vector_desc_t *next;
|
vector_desc_t *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* From esp_hw_support/intr_alloc.c: returns a pointer to a HAL-owned
|
||||||
|
* vector descriptor for some intno and cpu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern vector_desc_t *get_desc_for_int(int intno, int cpu);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -566,7 +572,9 @@ static void wifi_delete_queue_wrapper(void *queue)
|
|||||||
* Name: set_intr_wrapper
|
* Name: set_intr_wrapper
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Do nothing
|
* Route the Wi-Fi interrupt source and attach a handle that uses the HAL
|
||||||
|
* global vector descriptor list. Mark the CPU line as non-IRAM so
|
||||||
|
* esp_intr_noniram_disable() masks it while SPI flash holds the cache off.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* cpu_no - The CPU which the interrupt number belongs.
|
* cpu_no - The CPU which the interrupt number belongs.
|
||||||
@@ -584,6 +592,7 @@ static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source,
|
|||||||
{
|
{
|
||||||
intr_handle_t handle;
|
intr_handle_t handle;
|
||||||
int irq = ESP_SOURCE2IRQ(intr_source);
|
int irq = ESP_SOURCE2IRQ(intr_source);
|
||||||
|
esp_err_t err;
|
||||||
|
|
||||||
wlinfo("cpu_no=%" PRId32 ", intr_source=%" PRIu32
|
wlinfo("cpu_no=%" PRId32 ", intr_source=%" PRIu32
|
||||||
", intr_num=%" PRIu32 ", intr_prio=%" PRId32 "\n",
|
", intr_num=%" PRIu32 ", intr_prio=%" PRId32 "\n",
|
||||||
@@ -600,22 +609,24 @@ static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->vector_desc = kmm_calloc(1, sizeof(vector_desc_t));
|
handle->vector_desc = get_desc_for_int(intr_num, cpu_no);
|
||||||
if (handle->vector_desc == NULL)
|
if (handle->vector_desc == NULL)
|
||||||
{
|
{
|
||||||
wlerr("Failed to kmm_calloc\n");
|
wlerr("get_desc_for_int failed\n");
|
||||||
kmm_free(handle);
|
kmm_free(handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->vector_desc->intno = intr_num;
|
|
||||||
handle->vector_desc->cpu = cpu_no;
|
|
||||||
handle->vector_desc->source = intr_source;
|
handle->vector_desc->source = intr_source;
|
||||||
handle->vector_desc->shared_vec_info = NULL;
|
|
||||||
handle->vector_desc->next = NULL;
|
|
||||||
handle->shared_vector_desc = NULL;
|
handle->shared_vector_desc = NULL;
|
||||||
|
|
||||||
esp_set_handle(cpu_no, irq, handle);
|
esp_set_handle(cpu_no, irq, handle);
|
||||||
|
|
||||||
|
err = esp_intr_set_in_iram(handle, false);
|
||||||
|
if (err != ESP_OK)
|
||||||
|
{
|
||||||
|
wlerr("esp_intr_set_in_iram failed: %d\n", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user