forked from espressif/esp-idf
feat(i2c): Add config option for i2c isr handler can put in flash
This commit is contained in:
@@ -2,6 +2,7 @@ menu "ESP-Driver:I2C Configurations"
|
|||||||
depends on SOC_I2C_SUPPORTED
|
depends on SOC_I2C_SUPPORTED
|
||||||
config I2C_ISR_IRAM_SAFE
|
config I2C_ISR_IRAM_SAFE
|
||||||
bool "I2C ISR IRAM-Safe"
|
bool "I2C ISR IRAM-Safe"
|
||||||
|
select I2C_MASTER_ISR_HANDLER_IN_IRAM
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Ensure the I2C interrupt is IRAM-Safe by allowing the interrupt handler to be
|
Ensure the I2C interrupt is IRAM-Safe by allowing the interrupt handler to be
|
||||||
@@ -23,4 +24,10 @@ menu "ESP-Driver:I2C Configurations"
|
|||||||
help
|
help
|
||||||
I2C slave version 2 solves some existing known issues. Such as write/read workflow, stretch handling, etc.
|
I2C slave version 2 solves some existing known issues. Such as write/read workflow, stretch handling, etc.
|
||||||
|
|
||||||
|
config I2C_MASTER_ISR_HANDLER_IN_IRAM
|
||||||
|
bool "Place I2C master ISR handler into IRAM"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Place I2C master ISR handler into IRAM for better performance and fewer cache misses.
|
||||||
|
|
||||||
endmenu # I2C Configurations
|
endmenu # I2C Configurations
|
||||||
|
@@ -646,7 +646,7 @@ static esp_err_t s_i2c_transaction_start(i2c_master_dev_handle_t i2c_dev, int xf
|
|||||||
|
|
||||||
///////////////////////////////I2C DRIVERS//////////////////////////////////////////////////////////////
|
///////////////////////////////I2C DRIVERS//////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
IRAM_ATTR static void i2c_isr_receive_handler(i2c_master_bus_t *i2c_master)
|
I2C_MASTER_ISR_ATTR static void i2c_isr_receive_handler(i2c_master_bus_t *i2c_master)
|
||||||
{
|
{
|
||||||
i2c_hal_context_t *hal = &i2c_master->base->hal;
|
i2c_hal_context_t *hal = &i2c_master->base->hal;
|
||||||
|
|
||||||
@@ -681,7 +681,7 @@ IRAM_ATTR static void i2c_isr_receive_handler(i2c_master_bus_t *i2c_master)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void IRAM_ATTR i2c_master_isr_handler_default(void *arg)
|
static void i2c_master_isr_handler_default(void *arg)
|
||||||
{
|
{
|
||||||
i2c_master_bus_handle_t i2c_master = (i2c_master_bus_t*) arg;
|
i2c_master_bus_handle_t i2c_master = (i2c_master_bus_t*) arg;
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -42,6 +42,12 @@ extern "C" {
|
|||||||
#define LP_I2C_BUS_CLK_ATOMIC() PERIPH_RCC_ATOMIC()
|
#define LP_I2C_BUS_CLK_ATOMIC() PERIPH_RCC_ATOMIC()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2C_MASTER_ISR_HANDLER_IN_IRAM
|
||||||
|
#define I2C_MASTER_ISR_ATTR IRAM_ATTR
|
||||||
|
#else
|
||||||
|
#define I2C_MASTER_ISR_ATTR
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_I2C_ISR_IRAM_SAFE
|
#if CONFIG_I2C_ISR_IRAM_SAFE
|
||||||
#define I2C_MEM_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
|
#define I2C_MEM_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
|
||||||
#else
|
#else
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
[mapping:i2c_driver]
|
[mapping:i2c_driver]
|
||||||
archive: libesp_driver_i2c.a
|
archive: libesp_driver_i2c.a
|
||||||
entries:
|
entries:
|
||||||
|
if I2C_MASTER_ISR_HANDLER_IN_IRAM = y:
|
||||||
|
i2c_master: i2c_master_isr_handler_default (noflash)
|
||||||
if I2C_ISR_IRAM_SAFE = y:
|
if I2C_ISR_IRAM_SAFE = y:
|
||||||
i2c_master: s_i2c_send_command_async (noflash)
|
i2c_master: s_i2c_send_command_async (noflash)
|
||||||
i2c_master: s_i2c_write_command (noflash)
|
i2c_master: s_i2c_write_command (noflash)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
import pytest
|
import pytest
|
||||||
from pytest_embedded import Dut
|
from pytest_embedded import Dut
|
||||||
|
Reference in New Issue
Block a user