mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(twai): Add twai linker.lf to control the placement of driver and hal
- Replace TWAI_ISR_ATTR flag with linker.lf - Use the linker.lf to control the placement of the driver functions
This commit is contained in:
parent
7d87b6f47f
commit
7469f34948
@ -216,7 +216,7 @@ else()
|
|||||||
INCLUDE_DIRS ${includes}
|
INCLUDE_DIRS ${includes}
|
||||||
PRIV_REQUIRES efuse esp_timer
|
PRIV_REQUIRES efuse esp_timer
|
||||||
REQUIRES esp_pm esp_ringbuf freertos soc hal esp_hw_support
|
REQUIRES esp_pm esp_ringbuf freertos soc hal esp_hw_support
|
||||||
LDFRAGMENTS linker.lf gptimer/linker.lf gpio/linker.lf)
|
LDFRAGMENTS linker.lf gptimer/linker.lf gpio/linker.lf twai/linker.lf)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If system needs to monitor USJ connection status, then usb_serial_jtag_connection_monitor object file has to be linked
|
# If system needs to monitor USJ connection status, then usb_serial_jtag_connection_monitor object file has to be linked
|
||||||
|
14
components/driver/twai/linker.lf
Normal file
14
components/driver/twai/linker.lf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[mapping:twai_hal]
|
||||||
|
archive: libhal.a
|
||||||
|
entries:
|
||||||
|
if TWAI_ISR_IN_IRAM = y:
|
||||||
|
twai_hal_iram (noflash)
|
||||||
|
|
||||||
|
[mapping:twai_driver]
|
||||||
|
archive: libdriver.a
|
||||||
|
entries:
|
||||||
|
if TWAI_ISR_IN_IRAM = y:
|
||||||
|
twai: twai_alert_handler (noflash)
|
||||||
|
twai: twai_handle_rx_buffer_frames (noflash)
|
||||||
|
twai: twai_handle_tx_buffer_frame (noflash)
|
||||||
|
twai: twai_intr_handler_main (noflash)
|
@ -44,11 +44,9 @@
|
|||||||
#define TWAI_SET_FLAG(var, mask) ((var) |= (mask))
|
#define TWAI_SET_FLAG(var, mask) ((var) |= (mask))
|
||||||
#define TWAI_RESET_FLAG(var, mask) ((var) &= ~(mask))
|
#define TWAI_RESET_FLAG(var, mask) ((var) &= ~(mask))
|
||||||
#ifdef CONFIG_TWAI_ISR_IN_IRAM
|
#ifdef CONFIG_TWAI_ISR_IN_IRAM
|
||||||
#define TWAI_ISR_ATTR IRAM_ATTR
|
|
||||||
#define TWAI_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
|
#define TWAI_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
|
||||||
#else
|
#else
|
||||||
#define TWAI_TAG "TWAI"
|
#define TWAI_TAG "TWAI"
|
||||||
#define TWAI_ISR_ATTR
|
|
||||||
#define TWAI_MALLOC_CAPS MALLOC_CAP_DEFAULT
|
#define TWAI_MALLOC_CAPS MALLOC_CAP_DEFAULT
|
||||||
#endif //CONFIG_TWAI_ISR_IN_IRAM
|
#endif //CONFIG_TWAI_ISR_IN_IRAM
|
||||||
|
|
||||||
@ -103,7 +101,7 @@ static twai_hal_context_t twai_context;
|
|||||||
|
|
||||||
/* -------------------- Interrupt and Alert Handlers ------------------------ */
|
/* -------------------- Interrupt and Alert Handlers ------------------------ */
|
||||||
|
|
||||||
TWAI_ISR_ATTR static void twai_alert_handler(uint32_t alert_code, int *alert_req)
|
static void twai_alert_handler(uint32_t alert_code, int *alert_req)
|
||||||
{
|
{
|
||||||
if (p_twai_obj->alerts_enabled & alert_code) {
|
if (p_twai_obj->alerts_enabled & alert_code) {
|
||||||
//Signify alert has occurred
|
//Signify alert has occurred
|
||||||
@ -123,7 +121,6 @@ TWAI_ISR_ATTR static void twai_alert_handler(uint32_t alert_code, int *alert_req
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TWAI_ISR_ATTR
|
|
||||||
static inline void twai_handle_rx_buffer_frames(BaseType_t *task_woken, int *alert_req)
|
static inline void twai_handle_rx_buffer_frames(BaseType_t *task_woken, int *alert_req)
|
||||||
{
|
{
|
||||||
#ifdef SOC_TWAI_SUPPORTS_RX_STATUS
|
#ifdef SOC_TWAI_SUPPORTS_RX_STATUS
|
||||||
@ -173,7 +170,6 @@ static inline void twai_handle_rx_buffer_frames(BaseType_t *task_woken, int *ale
|
|||||||
#endif //SOC_TWAI_SUPPORTS_RX_STATUS
|
#endif //SOC_TWAI_SUPPORTS_RX_STATUS
|
||||||
}
|
}
|
||||||
|
|
||||||
TWAI_ISR_ATTR
|
|
||||||
static inline void twai_handle_tx_buffer_frame(BaseType_t *task_woken, int *alert_req)
|
static inline void twai_handle_tx_buffer_frame(BaseType_t *task_woken, int *alert_req)
|
||||||
{
|
{
|
||||||
//Handle previously transmitted frame
|
//Handle previously transmitted frame
|
||||||
@ -203,7 +199,7 @@ static inline void twai_handle_tx_buffer_frame(BaseType_t *task_woken, int *aler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TWAI_ISR_ATTR static void twai_intr_handler_main(void *arg)
|
static void twai_intr_handler_main(void *arg)
|
||||||
{
|
{
|
||||||
BaseType_t task_woken = pdFALSE;
|
BaseType_t task_woken = pdFALSE;
|
||||||
int alert_req = 0;
|
int alert_req = 0;
|
||||||
|
@ -26,8 +26,6 @@ entries:
|
|||||||
wdt_hal_iram (noflash)
|
wdt_hal_iram (noflash)
|
||||||
if SOC_SYSTIMER_SUPPORTED = y && HAL_SYSTIMER_USE_ROM_IMPL = n:
|
if SOC_SYSTIMER_SUPPORTED = y && HAL_SYSTIMER_USE_ROM_IMPL = n:
|
||||||
systimer_hal (noflash)
|
systimer_hal (noflash)
|
||||||
if TWAI_ISR_IN_IRAM = y:
|
|
||||||
twai_hal_iram (noflash)
|
|
||||||
if SOC_GPSPI_SUPPORTED = y && IDF_TARGET_ESP32 = n:
|
if SOC_GPSPI_SUPPORTED = y && IDF_TARGET_ESP32 = n:
|
||||||
spi_flash_hal_gpspi (noflash)
|
spi_flash_hal_gpspi (noflash)
|
||||||
if SOC_PMU_SUPPORTED = y:
|
if SOC_PMU_SUPPORTED = y:
|
||||||
|
Loading…
Reference in New Issue
Block a user