mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
ci(header_check): Add check for public header should not include freertos
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "ble_log/ble_log_spi_out.h"
|
#include "ble_log/ble_log_spi_out.h"
|
||||||
|
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
|
||||||
#define DAC_DMA_PERIPH_SPI_HOST SPI3_HOST
|
#define DAC_DMA_PERIPH_SPI_HOST SPI3_HOST
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,7 @@
|
|||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "esp_intr_alloc.h"
|
#include "esp_intr_alloc.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "esp_private/critical_section.h"
|
||||||
#include "freertos/queue.h"
|
|
||||||
#include "freertos/idf_additions.h"
|
|
||||||
#include "driver/isp_types.h"
|
#include "driver/isp_types.h"
|
||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
#if SOC_ISP_SUPPORTED
|
#if SOC_ISP_SUPPORTED
|
||||||
@@ -69,7 +67,7 @@ typedef struct isp_processor_t {
|
|||||||
void *csi_brg_hw;
|
void *csi_brg_hw;
|
||||||
#endif
|
#endif
|
||||||
ISP_ATOMIC_TYPE(isp_fsm_t) isp_fsm;
|
ISP_ATOMIC_TYPE(isp_fsm_t) isp_fsm;
|
||||||
portMUX_TYPE spinlock;
|
DECLARE_CRIT_SECTION_LOCK_IN_STRUCT(spinlock);
|
||||||
color_space_pixel_format_t in_color_format;
|
color_space_pixel_format_t in_color_format;
|
||||||
color_space_pixel_format_t out_color_format;
|
color_space_pixel_format_t out_color_format;
|
||||||
uint32_t h_res;
|
uint32_t h_res;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ esp_err_t sd_host_slot_enable_io_int(sd_host_slot_handle_t slot);
|
|||||||
* - ESP_ERR_INVALID_ARG: Invalid argument
|
* - ESP_ERR_INVALID_ARG: Invalid argument
|
||||||
* - ESP_ERR_TIMEOUT: Timeout
|
* - ESP_ERR_TIMEOUT: Timeout
|
||||||
*/
|
*/
|
||||||
esp_err_t sd_host_slot_wait_io_int(sd_host_slot_handle_t slot, TickType_t timeout_ticks);
|
esp_err_t sd_host_slot_wait_io_int(sd_host_slot_handle_t slot, uint32_t timeout_ticks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get slot info
|
* @brief Get slot info
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ struct sd_slot_driver_t {
|
|||||||
* - ESP_ERR_INVALID_ARG: Invalid argument
|
* - ESP_ERR_INVALID_ARG: Invalid argument
|
||||||
* - ESP_ERR_TIMEOUT: Timeout
|
* - ESP_ERR_TIMEOUT: Timeout
|
||||||
*/
|
*/
|
||||||
esp_err_t (*wait_io_int)(sd_slot_driver_t *slot_drv, TickType_t timeout_ticks);
|
esp_err_t (*wait_io_int)(sd_slot_driver_t *slot_drv, uint32_t timeout_ticks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get slot info
|
* @brief Get slot info
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "esp_types.h"
|
#include "esp_types.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
@@ -85,7 +86,7 @@ esp_err_t sd_host_slot_enable_io_int(sd_host_slot_handle_t slot)
|
|||||||
return slot->enable_io_int(slot);
|
return slot->enable_io_int(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t sd_host_slot_wait_io_int(sd_host_slot_handle_t slot, TickType_t timeout_ticks)
|
esp_err_t sd_host_slot_wait_io_int(sd_host_slot_handle_t slot, uint32_t timeout_ticks)
|
||||||
{
|
{
|
||||||
SD_HOST_ARG_CHECK(slot);
|
SD_HOST_ARG_CHECK(slot);
|
||||||
SD_HOST_FUNC_CHECK(slot->wait_io_int);
|
SD_HOST_FUNC_CHECK(slot->wait_io_int);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "freertos/FreeRTOS.h" // for TickType_t
|
|
||||||
#include "hal/sdio_slave_types.h"
|
#include "hal/sdio_slave_types.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -160,7 +159,7 @@ esp_err_t sdio_slave_recv_load_buf(sdio_slave_buf_handle_t handle);
|
|||||||
* - ESP_ERR_NOT_FINISHED if returned buffer is not the end of a packet from the host, should call this API again until the end of a packet
|
* - ESP_ERR_NOT_FINISHED if returned buffer is not the end of a packet from the host, should call this API again until the end of a packet
|
||||||
* - ESP_OK if success
|
* - ESP_OK if success
|
||||||
*/
|
*/
|
||||||
esp_err_t sdio_slave_recv_packet(sdio_slave_buf_handle_t* handle_ret, TickType_t wait);
|
esp_err_t sdio_slave_recv_packet(sdio_slave_buf_handle_t* handle_ret, uint32_t wait);
|
||||||
|
|
||||||
/** Get received data if exist. The driver returns the ownership of the buffer to the app.
|
/** Get received data if exist. The driver returns the ownership of the buffer to the app.
|
||||||
*
|
*
|
||||||
@@ -177,7 +176,7 @@ esp_err_t sdio_slave_recv_packet(sdio_slave_buf_handle_t* handle_ret, TickType_t
|
|||||||
* - ESP_ERR_TIMEOUT if timeout before receiving new data
|
* - ESP_ERR_TIMEOUT if timeout before receiving new data
|
||||||
* - ESP_OK if success
|
* - ESP_OK if success
|
||||||
*/
|
*/
|
||||||
esp_err_t sdio_slave_recv(sdio_slave_buf_handle_t* handle_ret, uint8_t **out_addr, size_t *out_len, TickType_t wait);
|
esp_err_t sdio_slave_recv(sdio_slave_buf_handle_t* handle_ret, uint8_t **out_addr, size_t *out_len, uint32_t wait);
|
||||||
|
|
||||||
/** Retrieve the buffer corresponding to a handle.
|
/** Retrieve the buffer corresponding to a handle.
|
||||||
*
|
*
|
||||||
@@ -205,7 +204,7 @@ uint8_t* sdio_slave_recv_get_buf(sdio_slave_buf_handle_t handle, size_t *len_o);
|
|||||||
* - ESP_ERR_TIMEOUT if the queue is still full until timeout.
|
* - ESP_ERR_TIMEOUT if the queue is still full until timeout.
|
||||||
* - ESP_OK if success.
|
* - ESP_OK if success.
|
||||||
*/
|
*/
|
||||||
esp_err_t sdio_slave_send_queue(uint8_t* addr, size_t len, void* arg, TickType_t wait);
|
esp_err_t sdio_slave_send_queue(uint8_t* addr, size_t len, void* arg, uint32_t wait);
|
||||||
|
|
||||||
/** Return the ownership of a finished transaction.
|
/** Return the ownership of a finished transaction.
|
||||||
* @param out_arg Argument of the finished transaction. Set to NULL if unused.
|
* @param out_arg Argument of the finished transaction. Set to NULL if unused.
|
||||||
@@ -213,7 +212,7 @@ esp_err_t sdio_slave_send_queue(uint8_t* addr, size_t len, void* arg, TickType_t
|
|||||||
*
|
*
|
||||||
* @return ESP_ERR_TIMEOUT if no transaction finished, or ESP_OK if succeed.
|
* @return ESP_ERR_TIMEOUT if no transaction finished, or ESP_OK if succeed.
|
||||||
*/
|
*/
|
||||||
esp_err_t sdio_slave_send_get_finished(void** out_arg, TickType_t wait);
|
esp_err_t sdio_slave_send_get_finished(void** out_arg, uint32_t wait);
|
||||||
|
|
||||||
/** Start a new sending transfer, and wait for it (blocked) to be finished.
|
/** Start a new sending transfer, and wait for it (blocked) to be finished.
|
||||||
*
|
*
|
||||||
@@ -289,7 +288,7 @@ void sdio_slave_clear_host_int(sdio_slave_hostint_t mask);
|
|||||||
*
|
*
|
||||||
* @return ESP_OK if success, ESP_ERR_TIMEOUT if timeout.
|
* @return ESP_OK if success, ESP_ERR_TIMEOUT if timeout.
|
||||||
*/
|
*/
|
||||||
esp_err_t sdio_slave_wait_int(int pos, TickType_t wait);
|
esp_err_t sdio_slave_wait_int(int pos, uint32_t wait);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ static void sdio_intr_host(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t sdio_slave_wait_int(int pos, TickType_t wait)
|
esp_err_t sdio_slave_wait_int(int pos, uint32_t wait)
|
||||||
{
|
{
|
||||||
SDIO_SLAVE_CHECK(pos >= 0 && pos < 8, "interrupt num invalid", ESP_ERR_INVALID_ARG);
|
SDIO_SLAVE_CHECK(pos >= 0 && pos < 8, "interrupt num invalid", ESP_ERR_INVALID_ARG);
|
||||||
return xSemaphoreTake(context.events[pos], wait);
|
return xSemaphoreTake(context.events[pos], wait);
|
||||||
@@ -615,7 +615,7 @@ static void sdio_intr_send(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t sdio_slave_send_queue(uint8_t *addr, size_t len, void *arg, TickType_t wait)
|
esp_err_t sdio_slave_send_queue(uint8_t *addr, size_t len, void *arg, uint32_t wait)
|
||||||
{
|
{
|
||||||
SDIO_SLAVE_CHECK(len > 0, "len <= 0", ESP_ERR_INVALID_ARG);
|
SDIO_SLAVE_CHECK(len > 0, "len <= 0", ESP_ERR_INVALID_ARG);
|
||||||
SDIO_SLAVE_CHECK(esp_ptr_dma_capable(addr) && (uint32_t)addr % 4 == 0, "buffer to send should be DMA capable and 32-bit aligned",
|
SDIO_SLAVE_CHECK(esp_ptr_dma_capable(addr) && (uint32_t)addr % 4 == 0, "buffer to send should be DMA capable and 32-bit aligned",
|
||||||
@@ -636,7 +636,7 @@ esp_err_t sdio_slave_send_queue(uint8_t *addr, size_t len, void *arg, TickType_t
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t sdio_slave_send_get_finished(void **out_arg, TickType_t wait)
|
esp_err_t sdio_slave_send_get_finished(void **out_arg, uint32_t wait)
|
||||||
{
|
{
|
||||||
void *arg = NULL;
|
void *arg = NULL;
|
||||||
BaseType_t err = xQueueReceive(context.ret_queue, &arg, wait);
|
BaseType_t err = xQueueReceive(context.ret_queue, &arg, wait);
|
||||||
@@ -783,7 +783,7 @@ sdio_slave_buf_handle_t sdio_slave_recv_register_buf(uint8_t *start)
|
|||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t sdio_slave_recv(sdio_slave_buf_handle_t *handle_ret, uint8_t **out_addr, size_t *out_len, TickType_t wait)
|
esp_err_t sdio_slave_recv(sdio_slave_buf_handle_t *handle_ret, uint8_t **out_addr, size_t *out_len, uint32_t wait)
|
||||||
{
|
{
|
||||||
esp_err_t ret = sdio_slave_recv_packet(handle_ret, wait);
|
esp_err_t ret = sdio_slave_recv_packet(handle_ret, wait);
|
||||||
if (ret == ESP_ERR_NOT_FINISHED) {
|
if (ret == ESP_ERR_NOT_FINISHED) {
|
||||||
@@ -802,7 +802,7 @@ esp_err_t sdio_slave_recv(sdio_slave_buf_handle_t *handle_ret, uint8_t **out_add
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t sdio_slave_recv_packet(sdio_slave_buf_handle_t *handle_ret, TickType_t wait)
|
esp_err_t sdio_slave_recv_packet(sdio_slave_buf_handle_t *handle_ret, uint32_t wait)
|
||||||
{
|
{
|
||||||
SDIO_SLAVE_CHECK(handle_ret != NULL, "handle address cannot be 0", ESP_ERR_INVALID_ARG);
|
SDIO_SLAVE_CHECK(handle_ret != NULL, "handle address cannot be 0", ESP_ERR_INVALID_ARG);
|
||||||
BaseType_t err = xSemaphoreTake(context.recv_event, wait);
|
BaseType_t err = xSemaphoreTake(context.recv_event, wait);
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ esp_err_t sdmmc_host_io_int_enable(int slot);
|
|||||||
* - ESP_OK on success (interrupt received)
|
* - ESP_OK on success (interrupt received)
|
||||||
* - ESP_ERR_TIMEOUT if the interrupt did not occur within timeout_ticks
|
* - ESP_ERR_TIMEOUT if the interrupt did not occur within timeout_ticks
|
||||||
*/
|
*/
|
||||||
esp_err_t sdmmc_host_io_int_wait(int slot, TickType_t timeout_ticks);
|
esp_err_t sdmmc_host_io_int_wait(int slot, uint32_t timeout_ticks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disable SDMMC host and release allocated resources gracefully
|
* @brief Disable SDMMC host and release allocated resources gracefully
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ esp_err_t sdmmc_host_io_int_enable(int slot)
|
|||||||
return sd_host_slot_enable_io_int(hdl);
|
return sd_host_slot_enable_io_int(hdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t sdmmc_host_io_int_wait(int slot, TickType_t timeout_ticks)
|
esp_err_t sdmmc_host_io_int_wait(int slot, uint32_t timeout_ticks)
|
||||||
{
|
{
|
||||||
assert(slot == 0 || slot == 1);
|
assert(slot == 0 || slot == 1);
|
||||||
sd_host_slot_handle_t hdl = sdmmc_get_slot_handle(slot);
|
sd_host_slot_handle_t hdl = sdmmc_get_slot_handle(slot);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "esp_private/esp_cache_private.h"
|
#include "esp_private/esp_cache_private.h"
|
||||||
#include "esp_private/gpio.h"
|
#include "esp_private/gpio.h"
|
||||||
#include "esp_private/sd_host_private.h"
|
#include "esp_private/sd_host_private.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
typedef struct sd_platform_t {
|
typedef struct sd_platform_t {
|
||||||
_lock_t mutex;
|
_lock_t mutex;
|
||||||
|
|||||||
+1
@@ -10,6 +10,7 @@
|
|||||||
#include "hal/gpio_hal.h"
|
#include "hal/gpio_hal.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
#include "sdmmc_test_cd_wp_common.h"
|
#include "sdmmc_test_cd_wp_common.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
|
||||||
void sdmmc_test_cd_input(int gpio_cd_num, const sdmmc_host_t* config)
|
void sdmmc_test_cd_input(int gpio_cd_num, const sdmmc_host_t* config)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
@@ -9,6 +9,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
|
||||||
#define PATTERN_SEED 0x12345678
|
#define PATTERN_SEED 0x12345678
|
||||||
#define FLAG_ERASE_TEST_ADJACENT (1 << 0)
|
#define FLAG_ERASE_TEST_ADJACENT (1 << 0)
|
||||||
|
|||||||
+1
@@ -18,6 +18,7 @@
|
|||||||
#include "sd_protocol_defs.h"
|
#include "sd_protocol_defs.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
#include "sdmmc_test_rw_common.h"
|
#include "sdmmc_test_rw_common.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
static void do_single_rw_perf_test(sdmmc_card_t* card, size_t start_block,
|
static void do_single_rw_perf_test(sdmmc_card_t* card, size_t start_block,
|
||||||
size_t block_count, size_t alignment, FILE* performance_log,
|
size_t block_count, size_t alignment, FILE* performance_log,
|
||||||
|
|||||||
+1
@@ -7,6 +7,7 @@
|
|||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
#include "sdmmc_test_begin_end_sd.h"
|
#include "sdmmc_test_begin_end_sd.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
|
||||||
#define SDMMC_FREQ_CUSTOM_10M 10000
|
#define SDMMC_FREQ_CUSTOM_10M 10000
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ esp_err_t sdspi_host_io_int_enable(sdspi_dev_handle_t handle);
|
|||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t sdspi_host_io_int_wait(sdspi_dev_handle_t handle, TickType_t timeout_ticks);
|
esp_err_t sdspi_host_io_int_wait(sdspi_dev_handle_t handle, uint32_t timeout_ticks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if the buffer meets the alignment requirements
|
* @brief Check if the buffer meets the alignment requirements
|
||||||
|
|||||||
@@ -1024,7 +1024,7 @@ esp_err_t sdspi_host_io_int_enable(sdspi_dev_handle_t handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//the interrupt will give the semaphore and then disable itself
|
//the interrupt will give the semaphore and then disable itself
|
||||||
esp_err_t sdspi_host_io_int_wait(sdspi_dev_handle_t handle, TickType_t timeout_ticks)
|
esp_err_t sdspi_host_io_int_wait(sdspi_dev_handle_t handle, uint32_t timeout_ticks)
|
||||||
{
|
{
|
||||||
slot_info_t* slot = get_slot_info(handle);
|
slot_info_t* slot = get_slot_info(handle);
|
||||||
//skip the interrupt and semaphore if the gpio is already low.
|
//skip the interrupt and semaphore if the gpio is already low.
|
||||||
|
|||||||
+1
@@ -10,6 +10,7 @@
|
|||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
#include "sdmmc_test_begin_end_spi.h"
|
#include "sdmmc_test_begin_end_spi.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
|
||||||
#define PATTERN_SEED 0x12345678
|
#define PATTERN_SEED 0x12345678
|
||||||
#define FLAG_ERASE_TEST_ADJACENT (1 << 0)
|
#define FLAG_ERASE_TEST_ADJACENT (1 << 0)
|
||||||
|
|||||||
+1
@@ -7,6 +7,7 @@
|
|||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
#include "sdmmc_test_begin_end_spi.h"
|
#include "sdmmc_test_begin_end_spi.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
|
||||||
#define SDMMC_FREQ_CUSTOM_10M 10000
|
#define SDMMC_FREQ_CUSTOM_10M 10000
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "hal/spi_types.h"
|
#include "hal/spi_types.h"
|
||||||
//for spi_bus_initialization functions. to be back-compatible
|
//for spi_bus_initialization functions. to be back-compatible
|
||||||
#include "driver/spi_common.h"
|
#include "driver/spi_common.h"
|
||||||
@@ -219,7 +218,7 @@ esp_err_t spi_bus_remove_device(spi_device_handle_t handle);
|
|||||||
* - ESP_ERR_INVALID_STATE if previous transactions are not finished
|
* - ESP_ERR_INVALID_STATE if previous transactions are not finished
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *trans_desc, TickType_t ticks_to_wait);
|
esp_err_t spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *trans_desc, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the result of a SPI transaction queued earlier by ``spi_device_queue_trans``.
|
* @brief Get the result of a SPI transaction queued earlier by ``spi_device_queue_trans``.
|
||||||
@@ -241,7 +240,7 @@ esp_err_t spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *
|
|||||||
* - ESP_ERR_TIMEOUT if there was no completed transaction before ticks_to_wait expired
|
* - ESP_ERR_TIMEOUT if there was no completed transaction before ticks_to_wait expired
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_device_get_trans_result(spi_device_handle_t handle, spi_transaction_t **trans_desc, TickType_t ticks_to_wait);
|
esp_err_t spi_device_get_trans_result(spi_device_handle_t handle, spi_transaction_t **trans_desc, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send a SPI transaction, wait for it to complete, and return the result
|
* @brief Send a SPI transaction, wait for it to complete, and return the result
|
||||||
@@ -282,7 +281,7 @@ esp_err_t spi_device_transmit(spi_device_handle_t handle, spi_transaction_t *tra
|
|||||||
* - ESP_ERR_INVALID_STATE if previous transactions are not finished
|
* - ESP_ERR_INVALID_STATE if previous transactions are not finished
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_device_polling_start(spi_device_handle_t handle, spi_transaction_t *trans_desc, TickType_t ticks_to_wait);
|
esp_err_t spi_device_polling_start(spi_device_handle_t handle, spi_transaction_t *trans_desc, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Poll until the polling transaction ends.
|
* @brief Poll until the polling transaction ends.
|
||||||
@@ -299,7 +298,7 @@ esp_err_t spi_device_polling_start(spi_device_handle_t handle, spi_transaction_t
|
|||||||
* - ESP_ERR_TIMEOUT if the transaction cannot finish before ticks_to_wait expired
|
* - ESP_ERR_TIMEOUT if the transaction cannot finish before ticks_to_wait expired
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_device_polling_end(spi_device_handle_t handle, TickType_t ticks_to_wait);
|
esp_err_t spi_device_polling_end(spi_device_handle_t handle, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send a polling transaction, wait for it to complete, and return the result
|
* @brief Send a polling transaction, wait for it to complete, and return the result
|
||||||
@@ -336,7 +335,7 @@ esp_err_t spi_device_polling_transmit(spi_device_handle_t handle, spi_transactio
|
|||||||
* - ESP_ERR_INVALID_ARG : ``wait`` is not set to portMAX_DELAY.
|
* - ESP_ERR_INVALID_ARG : ``wait`` is not set to portMAX_DELAY.
|
||||||
* - ESP_OK : Success.
|
* - ESP_OK : Success.
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_device_acquire_bus(spi_device_handle_t device, TickType_t wait);
|
esp_err_t spi_device_acquire_bus(spi_device_handle_t device, uint32_t wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Release the SPI bus occupied by the device. All other devices can start sending transactions.
|
* @brief Release the SPI bus occupied by the device. All other devices can start sending transactions.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -8,8 +8,6 @@
|
|||||||
#define _DRIVER_SPI_SLAVE_H_
|
#define _DRIVER_SPI_SLAVE_H_
|
||||||
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/semphr.h"
|
|
||||||
#include "driver/spi_common.h"
|
#include "driver/spi_common.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -167,7 +165,7 @@ esp_err_t spi_slave_disable(spi_host_device_t host);
|
|||||||
* - ESP_ERR_INVALID_STATE if sync data between Cache and memory failed
|
* - ESP_ERR_INVALID_STATE if sync data between Cache and memory failed
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_slave_queue_trans(spi_host_device_t host, const spi_slave_transaction_t *trans_desc, TickType_t ticks_to_wait);
|
esp_err_t spi_slave_queue_trans(spi_host_device_t host, const spi_slave_transaction_t *trans_desc, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the result of a SPI transaction queued earlier
|
* @brief Get the result of a SPI transaction queued earlier
|
||||||
@@ -189,7 +187,7 @@ esp_err_t spi_slave_queue_trans(spi_host_device_t host, const spi_slave_transact
|
|||||||
* - ESP_ERR_NOT_SUPPORTED if flag `SPI_SLAVE_NO_RETURN_RESULT` is set
|
* - ESP_ERR_NOT_SUPPORTED if flag `SPI_SLAVE_NO_RETURN_RESULT` is set
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_slave_get_trans_result(spi_host_device_t host, spi_slave_transaction_t **trans_desc, TickType_t ticks_to_wait);
|
esp_err_t spi_slave_get_trans_result(spi_host_device_t host, spi_slave_transaction_t **trans_desc, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Do a SPI transaction
|
* @brief Do a SPI transaction
|
||||||
@@ -208,7 +206,7 @@ esp_err_t spi_slave_get_trans_result(spi_host_device_t host, spi_slave_transacti
|
|||||||
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_slave_transmit(spi_host_device_t host, spi_slave_transaction_t *trans_desc, TickType_t ticks_to_wait);
|
esp_err_t spi_slave_transmit(spi_host_device_t host, spi_slave_transaction_t *trans_desc, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
#include "esp_types.h"
|
#include "esp_types.h"
|
||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
|
|
||||||
#include "hal/spi_types.h"
|
#include "hal/spi_types.h"
|
||||||
#include "driver/spi_common.h"
|
#include "driver/spi_common.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
@@ -41,7 +39,7 @@ typedef struct {
|
|||||||
} spi_slave_hd_event_t;
|
} spi_slave_hd_event_t;
|
||||||
|
|
||||||
/// Callback for SPI Slave HD
|
/// Callback for SPI Slave HD
|
||||||
typedef bool (*slave_cb_t)(void* arg, spi_slave_hd_event_t* event, BaseType_t* awoken);
|
typedef bool (*slave_cb_t)(void* arg, spi_slave_hd_event_t* event, int* awoken);
|
||||||
|
|
||||||
/// Channel of SPI Slave HD to do data transaction
|
/// Channel of SPI Slave HD to do data transaction
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -153,7 +151,7 @@ esp_err_t spi_slave_hd_disable(spi_host_device_t host_id);
|
|||||||
* - ESP_ERR_TIMEOUT: Cannot queue the data before timeout. Master is still processing previous transaction.
|
* - ESP_ERR_TIMEOUT: Cannot queue the data before timeout. Master is still processing previous transaction.
|
||||||
* - ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under segment mode.
|
* - ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under segment mode.
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_slave_hd_queue_trans(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t* trans, TickType_t timeout);
|
esp_err_t spi_slave_hd_queue_trans(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t* trans, uint32_t timeout);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the result of a data transaction (segment mode)
|
* @brief Get the result of a data transaction (segment mode)
|
||||||
@@ -170,7 +168,7 @@ esp_err_t spi_slave_hd_queue_trans(spi_host_device_t host_id, spi_slave_chan_t c
|
|||||||
* - ESP_ERR_TIMEOUT: There's no transaction done before timeout
|
* - ESP_ERR_TIMEOUT: There's no transaction done before timeout
|
||||||
* - ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under segment mode.
|
* - ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under segment mode.
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_slave_hd_get_trans_res(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t **out_trans, TickType_t timeout);
|
esp_err_t spi_slave_hd_get_trans_res(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t **out_trans, uint32_t timeout);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the shared registers
|
* @brief Read the shared registers
|
||||||
@@ -210,7 +208,7 @@ void spi_slave_hd_write_buffer(spi_host_device_t host_id, int addr, uint8_t *dat
|
|||||||
* - ESP_ERR_TIMEOUT: Master is still processing previous transaction. There is no available transaction for slave to load
|
* - ESP_ERR_TIMEOUT: Master is still processing previous transaction. There is no available transaction for slave to load
|
||||||
* - ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under append mode.
|
* - ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under append mode.
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_slave_hd_append_trans(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t *trans, TickType_t timeout);
|
esp_err_t spi_slave_hd_append_trans(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t *trans, uint32_t timeout);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the result of a data transaction (append mode)
|
* @brief Get the result of a data transaction (append mode)
|
||||||
@@ -227,7 +225,7 @@ esp_err_t spi_slave_hd_append_trans(spi_host_device_t host_id, spi_slave_chan_t
|
|||||||
* - ESP_ERR_TIMEOUT: There's no transaction done before timeout
|
* - ESP_ERR_TIMEOUT: There's no transaction done before timeout
|
||||||
* - ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under append mode.
|
* - ESP_ERR_INVALID_STATE: Function called in invalid state. This API should be called under append mode.
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_slave_hd_get_append_trans_res(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t **out_trans, TickType_t timeout);
|
esp_err_t spi_slave_hd_get_append_trans_res(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t **out_trans, uint32_t timeout);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include <esp_intr_alloc.h>
|
#include <esp_intr_alloc.h>
|
||||||
#include "driver/spi_common.h"
|
#include "driver/spi_common.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "hal/spi_types.h"
|
#include "hal/spi_types.h"
|
||||||
#include "hal/dma_types.h"
|
#include "hal/dma_types.h"
|
||||||
#include "soc/ext_mem_defs.h" //for SOC_NON_CACHEABLE_OFFSET
|
#include "soc/ext_mem_defs.h" //for SOC_NON_CACHEABLE_OFFSET
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ esp_err_t spi_bus_multi_trans_mode_enable(spi_device_handle_t handle, bool enabl
|
|||||||
* - ESP_ERR_INVALID_STATE: Invalid states, e.g.: an SPI polling transaction is ongoing, SCT mode isn't enabled, DMA descriptors not enough, etc.
|
* - ESP_ERR_INVALID_STATE: Invalid states, e.g.: an SPI polling transaction is ongoing, SCT mode isn't enabled, DMA descriptors not enough, etc.
|
||||||
* - ESP_ERR_TIMEOUT: Timeout, this SCT transaction isn't queued successfully
|
* - ESP_ERR_TIMEOUT: Timeout, this SCT transaction isn't queued successfully
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_device_queue_multi_trans(spi_device_handle_t handle, spi_multi_transaction_t *seg_trans_desc, uint32_t trans_num, TickType_t ticks_to_wait);
|
esp_err_t spi_device_queue_multi_trans(spi_device_handle_t handle, spi_multi_transaction_t *seg_trans_desc, uint32_t trans_num, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the result of an SPI Segmented-Configure-Transaction (SCT).
|
* @brief Get the result of an SPI Segmented-Configure-Transaction (SCT).
|
||||||
@@ -114,7 +114,7 @@ esp_err_t spi_device_queue_multi_trans(spi_device_handle_t handle, spi_multi_tra
|
|||||||
* - ESP_ERR_INVALID_STATE: Invalid states, e.g.: SCT mode isn't enabled, etc.
|
* - ESP_ERR_INVALID_STATE: Invalid states, e.g.: SCT mode isn't enabled, etc.
|
||||||
* - ESP_ERR_TIMEOUT: Timeout, didn't get a completed SCT transaction
|
* - ESP_ERR_TIMEOUT: Timeout, didn't get a completed SCT transaction
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_device_get_multi_trans_result(spi_device_handle_t handle, spi_multi_transaction_t **seg_trans_desc, TickType_t ticks_to_wait);
|
esp_err_t spi_device_get_multi_trans_result(spi_device_handle_t handle, spi_multi_transaction_t **seg_trans_desc, uint32_t ticks_to_wait);
|
||||||
#endif //#if SOC_SPI_SCT_SUPPORTED
|
#endif //#if SOC_SPI_SCT_SUPPORTED
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "esp_private/sleep_retention.h"
|
#include "esp_private/sleep_retention.h"
|
||||||
#include "esp_dma_utils.h"
|
#include "esp_dma_utils.h"
|
||||||
#include "hal/spi_hal.h"
|
#include "hal/spi_hal.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
#include "soc/dport_reg.h"
|
#include "soc/dport_reg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -121,6 +121,9 @@ We have two bits to control the interrupt:
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "esp_ipc.h"
|
#include "esp_ipc.h"
|
||||||
|
#include "esp_cache.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
#include "soc/soc_memory_layout.h"
|
#include "soc/soc_memory_layout.h"
|
||||||
@@ -1233,7 +1236,7 @@ clean_up:
|
|||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_MASTER_ATTR spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *trans_desc, TickType_t ticks_to_wait)
|
esp_err_t SPI_MASTER_ATTR spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *trans_desc, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
esp_err_t ret = check_trans_valid(handle, trans_desc);
|
esp_err_t ret = check_trans_valid(handle, trans_desc);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
@@ -1285,7 +1288,7 @@ clean_up:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_MASTER_ATTR spi_device_get_trans_result(spi_device_handle_t handle, spi_transaction_t **trans_desc, TickType_t ticks_to_wait)
|
esp_err_t SPI_MASTER_ATTR spi_device_get_trans_result(spi_device_handle_t handle, spi_transaction_t **trans_desc, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
BaseType_t r;
|
BaseType_t r;
|
||||||
spi_trans_priv_t trans_buf;
|
spi_trans_priv_t trans_buf;
|
||||||
@@ -1332,7 +1335,7 @@ esp_err_t SPI_MASTER_ATTR spi_device_transmit(spi_device_handle_t handle, spi_tr
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_MASTER_ISR_ATTR spi_device_acquire_bus(spi_device_t *device, TickType_t wait)
|
esp_err_t SPI_MASTER_ISR_ATTR spi_device_acquire_bus(spi_device_t *device, uint32_t wait)
|
||||||
{
|
{
|
||||||
spi_host_t *const host = device->host;
|
spi_host_t *const host = device->host;
|
||||||
SPI_CHECK(wait == portMAX_DELAY, "acquire finite time not supported now.", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(wait == portMAX_DELAY, "acquire finite time not supported now.", ESP_ERR_INVALID_ARG);
|
||||||
@@ -1396,7 +1399,7 @@ void SPI_MASTER_ISR_ATTR spi_device_release_bus(spi_device_t *dev)
|
|||||||
(void) ret;
|
(void) ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_start(spi_device_handle_t handle, spi_transaction_t *trans_desc, TickType_t ticks_to_wait)
|
esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_start(spi_device_handle_t handle, spi_transaction_t *trans_desc, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
esp_err_t ret;
|
esp_err_t ret;
|
||||||
SPI_CHECK(ticks_to_wait == portMAX_DELAY, "currently timeout is not available for polling transactions", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(ticks_to_wait == portMAX_DELAY, "currently timeout is not available for polling transactions", ESP_ERR_INVALID_ARG);
|
||||||
@@ -1443,7 +1446,7 @@ esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_start(spi_device_handle_t handl
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_end(spi_device_handle_t handle, TickType_t ticks_to_wait)
|
esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_end(spi_device_handle_t handle, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
SPI_CHECK(handle != NULL, "invalid dev handle", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(handle != NULL, "invalid dev handle", ESP_ERR_INVALID_ARG);
|
||||||
spi_host_t *host = handle->host;
|
spi_host_t *host = handle->host;
|
||||||
@@ -1821,7 +1824,7 @@ static void SPI_MASTER_ATTR s_sct_format_conf_buffer(spi_device_handle_t handle,
|
|||||||
spi_hal_sct_format_conf_buffer(hal, &seg_config, hal_dev, buffer);
|
spi_hal_sct_format_conf_buffer(hal, &seg_config, hal_dev, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_MASTER_ATTR spi_device_queue_multi_trans(spi_device_handle_t handle, spi_multi_transaction_t *seg_trans_desc, uint32_t trans_num, TickType_t ticks_to_wait)
|
esp_err_t SPI_MASTER_ATTR spi_device_queue_multi_trans(spi_device_handle_t handle, spi_multi_transaction_t *seg_trans_desc, uint32_t trans_num, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
SPI_CHECK(handle, "Invalid arguments.", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(handle, "Invalid arguments.", ESP_ERR_INVALID_ARG);
|
||||||
SPI_CHECK(SOC_SPI_SCT_SUPPORTED_PERIPH(handle->host->id), "Invalid arguments", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(SOC_SPI_SCT_SUPPORTED_PERIPH(handle->host->id), "Invalid arguments", ESP_ERR_INVALID_ARG);
|
||||||
@@ -1923,7 +1926,7 @@ esp_err_t SPI_MASTER_ATTR spi_device_queue_multi_trans(spi_device_handle_t handl
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_MASTER_ATTR spi_device_get_multi_trans_result(spi_device_handle_t handle, spi_multi_transaction_t **seg_trans_desc, TickType_t ticks_to_wait)
|
esp_err_t SPI_MASTER_ATTR spi_device_get_multi_trans_result(spi_device_handle_t handle, spi_multi_transaction_t **seg_trans_desc, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
SPI_CHECK(handle, "Invalid arguments.", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(handle, "Invalid arguments.", ESP_ERR_INVALID_ARG);
|
||||||
SPI_CHECK(SOC_SPI_SCT_SUPPORTED_PERIPH(handle->host->id), "Invalid arguments", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(SOC_SPI_SCT_SUPPORTED_PERIPH(handle->host->id), "Invalid arguments", ESP_ERR_INVALID_ARG);
|
||||||
|
|||||||
@@ -473,7 +473,7 @@ static esp_err_t SPI_SLAVE_ISR_ATTR spi_slave_setup_priv_trans(spi_host_device_t
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_SLAVE_ATTR spi_slave_queue_trans(spi_host_device_t host, const spi_slave_transaction_t *trans_desc, TickType_t ticks_to_wait)
|
esp_err_t SPI_SLAVE_ATTR spi_slave_queue_trans(spi_host_device_t host, const spi_slave_transaction_t *trans_desc, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
BaseType_t r;
|
BaseType_t r;
|
||||||
SPI_CHECK(is_valid_host(host), "invalid host", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(is_valid_host(host), "invalid host", ESP_ERR_INVALID_ARG);
|
||||||
@@ -601,7 +601,7 @@ esp_err_t SPI_SLAVE_ISR_ATTR spi_slave_queue_reset_isr(spi_host_device_t host)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_SLAVE_ATTR spi_slave_get_trans_result(spi_host_device_t host, spi_slave_transaction_t **trans_desc, TickType_t ticks_to_wait)
|
esp_err_t SPI_SLAVE_ATTR spi_slave_get_trans_result(spi_host_device_t host, spi_slave_transaction_t **trans_desc, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
BaseType_t r;
|
BaseType_t r;
|
||||||
SPI_CHECK(is_valid_host(host), "invalid host", ESP_ERR_INVALID_ARG);
|
SPI_CHECK(is_valid_host(host), "invalid host", ESP_ERR_INVALID_ARG);
|
||||||
@@ -620,7 +620,7 @@ esp_err_t SPI_SLAVE_ATTR spi_slave_get_trans_result(spi_host_device_t host, spi_
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t SPI_SLAVE_ATTR spi_slave_transmit(spi_host_device_t host, spi_slave_transaction_t *trans_desc, TickType_t ticks_to_wait)
|
esp_err_t SPI_SLAVE_ATTR spi_slave_transmit(spi_host_device_t host, spi_slave_transaction_t *trans_desc, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
esp_err_t ret;
|
esp_err_t ret;
|
||||||
spi_slave_transaction_t *ret_trans;
|
spi_slave_transaction_t *ret_trans;
|
||||||
|
|||||||
@@ -836,7 +836,7 @@ esp_err_t s_spi_slave_hd_append_rxdma(spi_slave_hd_slot_t *host, uint8_t *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------Segment Mode Transaction APIs-----------------------------------------------------------//
|
//---------------------------------------------------------Segment Mode Transaction APIs-----------------------------------------------------------//
|
||||||
esp_err_t spi_slave_hd_queue_trans(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t *trans, TickType_t timeout)
|
esp_err_t spi_slave_hd_queue_trans(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t *trans, uint32_t timeout)
|
||||||
{
|
{
|
||||||
spi_slave_hd_slot_t *host = spihost[host_id];
|
spi_slave_hd_slot_t *host = spihost[host_id];
|
||||||
|
|
||||||
@@ -864,7 +864,7 @@ esp_err_t spi_slave_hd_queue_trans(spi_host_device_t host_id, spi_slave_chan_t c
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t spi_slave_hd_get_trans_res(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t **out_trans, TickType_t timeout)
|
esp_err_t spi_slave_hd_get_trans_res(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t **out_trans, uint32_t timeout)
|
||||||
{
|
{
|
||||||
esp_err_t ret;
|
esp_err_t ret;
|
||||||
spi_slave_hd_slot_t *host = spihost[host_id];
|
spi_slave_hd_slot_t *host = spihost[host_id];
|
||||||
@@ -887,7 +887,7 @@ void spi_slave_hd_write_buffer(spi_host_device_t host_id, int addr, uint8_t *dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------Append Mode Transaction APIs-----------------------------------------------------------//
|
//---------------------------------------------------------Append Mode Transaction APIs-----------------------------------------------------------//
|
||||||
esp_err_t spi_slave_hd_append_trans(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t *trans, TickType_t timeout)
|
esp_err_t spi_slave_hd_append_trans(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t *trans, uint32_t timeout)
|
||||||
{
|
{
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
spi_slave_hd_slot_t *host = spihost[host_id];
|
spi_slave_hd_slot_t *host = spihost[host_id];
|
||||||
@@ -921,7 +921,7 @@ esp_err_t spi_slave_hd_append_trans(spi_host_device_t host_id, spi_slave_chan_t
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t spi_slave_hd_get_append_trans_res(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t **out_trans, TickType_t timeout)
|
esp_err_t spi_slave_hd_get_append_trans_res(spi_host_device_t host_id, spi_slave_chan_t chan, spi_slave_hd_data_t **out_trans, uint32_t timeout)
|
||||||
{
|
{
|
||||||
esp_err_t ret;
|
esp_err_t ret;
|
||||||
spi_slave_hd_slot_t *host = spihost[host_id];
|
spi_slave_hd_slot_t *host = spihost[host_id];
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ esp_err_t uart_intr_config(uart_port_t uart_num, const uart_intr_config_t *intr_
|
|||||||
* - ESP_FAIL Parameter error
|
* - ESP_FAIL Parameter error
|
||||||
* - ESP_ERR_TIMEOUT Timeout
|
* - ESP_ERR_TIMEOUT Timeout
|
||||||
*/
|
*/
|
||||||
esp_err_t uart_wait_tx_done(uart_port_t uart_num, TickType_t ticks_to_wait);
|
esp_err_t uart_wait_tx_done(uart_port_t uart_num, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send data to the UART port from a given buffer and length.
|
* @brief Send data to the UART port from a given buffer and length.
|
||||||
@@ -587,7 +587,7 @@ int uart_write_bytes_with_break(uart_port_t uart_num, const void* src, size_t si
|
|||||||
* - (-1) Error
|
* - (-1) Error
|
||||||
* - OTHERS (>=0) The number of bytes read from UART buffer
|
* - OTHERS (>=0) The number of bytes read from UART buffer
|
||||||
*/
|
*/
|
||||||
int uart_read_bytes(uart_port_t uart_num, void* buf, uint32_t length, TickType_t ticks_to_wait);
|
int uart_read_bytes(uart_port_t uart_num, void* buf, uint32_t length, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Alias of uart_flush_input.
|
* @brief Alias of uart_flush_input.
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/queue.h"
|
|
||||||
#include "driver/uhci_types.h"
|
#include "driver/uhci_types.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -1540,7 +1540,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
esp_err_t uart_wait_tx_done(uart_port_t uart_num, TickType_t ticks_to_wait)
|
esp_err_t uart_wait_tx_done(uart_port_t uart_num, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
|
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
|
||||||
ESP_RETURN_ON_FALSE((p_uart_obj[uart_num]), ESP_FAIL, UART_TAG, "uart driver error");
|
ESP_RETURN_ON_FALSE((p_uart_obj[uart_num]), ESP_FAIL, UART_TAG, "uart driver error");
|
||||||
@@ -1720,7 +1720,7 @@ static bool uart_check_buf_full(uart_port_t uart_num)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int uart_read_bytes(uart_port_t uart_num, void *buf, uint32_t length, TickType_t ticks_to_wait)
|
int uart_read_bytes(uart_port_t uart_num, void *buf, uint32_t length, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), (-1), UART_TAG, "uart_num error");
|
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), (-1), UART_TAG, "uart_num error");
|
||||||
ESP_RETURN_ON_FALSE((buf), (-1), UART_TAG, "uart data null");
|
ESP_RETURN_ON_FALSE((buf), (-1), UART_TAG, "uart data null");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/semphr.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -57,7 +55,7 @@ esp_err_t usb_serial_jtag_driver_install(usb_serial_jtag_driver_config_t *usb_se
|
|||||||
* @return
|
* @return
|
||||||
* - The number of bytes read from USB_SERIAL FIFO
|
* - The number of bytes read from USB_SERIAL FIFO
|
||||||
*/
|
*/
|
||||||
int usb_serial_jtag_read_bytes(void* buf, uint32_t length, TickType_t ticks_to_wait);
|
int usb_serial_jtag_read_bytes(void* buf, uint32_t length, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send data to the USB-UART port from a given buffer and length,
|
* @brief Send data to the USB-UART port from a given buffer and length,
|
||||||
@@ -72,7 +70,7 @@ int usb_serial_jtag_read_bytes(void* buf, uint32_t length, TickType_t ticks_to_w
|
|||||||
* @return
|
* @return
|
||||||
* - The number of bytes pushed to the TX FIFO
|
* - The number of bytes pushed to the TX FIFO
|
||||||
*/
|
*/
|
||||||
int usb_serial_jtag_write_bytes(const void* src, size_t size, TickType_t ticks_to_wait);
|
int usb_serial_jtag_write_bytes(const void* src, size_t size, uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Blocks until all data written using `usb_serial_jtag_write_bytes` is sent to the host, or until timeout.
|
* @brief Blocks until all data written using `usb_serial_jtag_write_bytes` is sent to the host, or until timeout.
|
||||||
@@ -81,7 +79,7 @@ int usb_serial_jtag_write_bytes(const void* src, size_t size, TickType_t ticks_t
|
|||||||
*
|
*
|
||||||
* @return ESP_OK when flushed, ESP_ERR_TIMEOUT on timeout.
|
* @return ESP_OK when flushed, ESP_ERR_TIMEOUT on timeout.
|
||||||
*/
|
*/
|
||||||
esp_err_t usb_serial_jtag_wait_tx_done(TickType_t ticks_to_wait);
|
esp_err_t usb_serial_jtag_wait_tx_done(uint32_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Uninstall USB-SERIAL-JTAG driver.
|
* @brief Uninstall USB-SERIAL-JTAG driver.
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ typedef enum {
|
|||||||
USJ_SELECT_ERROR_NOTIF,
|
USJ_SELECT_ERROR_NOTIF,
|
||||||
} usj_select_notif_t;
|
} usj_select_notif_t;
|
||||||
|
|
||||||
typedef void (*usj_select_notif_callback_t)(usj_select_notif_t usb_serial_jtag_select_notif, BaseType_t *task_woken);
|
typedef void (*usj_select_notif_callback_t)(usj_select_notif_t usb_serial_jtag_select_notif, int *task_woken);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set notification callback function for select() events
|
* @brief Set notification callback function for select() events
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ _exit:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int usb_serial_jtag_read_bytes(void* buf, uint32_t length, TickType_t ticks_to_wait)
|
int usb_serial_jtag_read_bytes(void* buf, uint32_t length, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
uint8_t *data = NULL;
|
uint8_t *data = NULL;
|
||||||
size_t data_read_len = 0;
|
size_t data_read_len = 0;
|
||||||
@@ -262,7 +262,7 @@ int usb_serial_jtag_read_bytes(void* buf, uint32_t length, TickType_t ticks_to_w
|
|||||||
return data_read_len;
|
return data_read_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int usb_serial_jtag_write_bytes(const void* src, size_t size, TickType_t ticks_to_wait)
|
int usb_serial_jtag_write_bytes(const void* src, size_t size, uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(src && size, 0, USB_SERIAL_JTAG_TAG, "invalid buffer or size");
|
ESP_RETURN_ON_FALSE(src && size, 0, USB_SERIAL_JTAG_TAG, "invalid buffer or size");
|
||||||
ESP_RETURN_ON_FALSE(p_usb_serial_jtag_obj != NULL, 0, USB_SERIAL_JTAG_TAG, "driver is not initialized yet");
|
ESP_RETURN_ON_FALSE(p_usb_serial_jtag_obj != NULL, 0, USB_SERIAL_JTAG_TAG, "driver is not initialized yet");
|
||||||
@@ -288,7 +288,7 @@ int usb_serial_jtag_write_bytes(const void* src, size_t size, TickType_t ticks_t
|
|||||||
return (result == pdFALSE) ? 0 : size;
|
return (result == pdFALSE) ? 0 : size;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t usb_serial_jtag_wait_tx_done(TickType_t ticks_to_wait)
|
esp_err_t usb_serial_jtag_wait_tx_done(uint32_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
TimeOut_t timeout;
|
TimeOut_t timeout;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "driver/usb_serial_jtag.h"
|
#include "driver/usb_serial_jtag.h"
|
||||||
#include "hal/usb_serial_jtag_ll.h"
|
#include "hal/usb_serial_jtag_ll.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "esp_private/startup_internal.h"
|
#include "esp_private/startup_internal.h"
|
||||||
#include "esp_freertos_hooks.h"
|
#include "esp_freertos_hooks.h"
|
||||||
#include "esp_pm.h"
|
#include "esp_pm.h"
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ static int usb_serial_jtag_fsync(int fd)
|
|||||||
|
|
||||||
#ifdef CONFIG_VFS_SUPPORT_SELECT
|
#ifdef CONFIG_VFS_SUPPORT_SELECT
|
||||||
|
|
||||||
static void select_notif_callback_isr(usj_select_notif_t usj_select_notif, BaseType_t *task_woken)
|
static void select_notif_callback_isr(usj_select_notif_t usj_select_notif, int *task_woken)
|
||||||
{
|
{
|
||||||
portENTER_CRITICAL_ISR(&s_registered_select_lock);
|
portENTER_CRITICAL_ISR(&s_registered_select_lock);
|
||||||
for (int i = 0; i < s_registered_select_num; ++i) {
|
for (int i = 0; i < s_registered_select_num; ++i) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "soc/spi_periph.h"
|
#include "soc/spi_periph.h"
|
||||||
#include "soc/gpio_struct.h"
|
#include "soc/gpio_struct.h"
|
||||||
#include "esp_private/periph_ctrl.h"
|
#include "esp_private/periph_ctrl.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "esp_err.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -334,7 +334,7 @@ bool spi_bus_lock_touch(spi_bus_lock_dev_handle_t dev_handle);
|
|||||||
* - ESP_OK: on success
|
* - ESP_OK: on success
|
||||||
* - ESP_ERR_INVALID_ARG: timeout is not portMAX_DELAY
|
* - ESP_ERR_INVALID_ARG: timeout is not portMAX_DELAY
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_bus_lock_acquire_start(spi_bus_lock_dev_handle_t dev_handle, TickType_t wait);
|
esp_err_t spi_bus_lock_acquire_start(spi_bus_lock_dev_handle_t dev_handle, uint32_t wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release the bus acquired. Will pass the acquiring processor to other blocked
|
* Release the bus acquired. Will pass the acquiring processor to other blocked
|
||||||
@@ -395,7 +395,7 @@ esp_err_t spi_bus_lock_bg_request(spi_bus_lock_dev_handle_t dev_handle);
|
|||||||
* - ESP_ERR_INVALID_STATE: The device is not the acquiring bus.
|
* - ESP_ERR_INVALID_STATE: The device is not the acquiring bus.
|
||||||
* - ESP_ERR_INVALID_ARG: Timeout is not portMAX_DELAY.
|
* - ESP_ERR_INVALID_ARG: Timeout is not portMAX_DELAY.
|
||||||
*/
|
*/
|
||||||
esp_err_t spi_bus_lock_wait_bg_done(spi_bus_lock_dev_handle_t dev_handle, TickType_t wait);
|
esp_err_t spi_bus_lock_wait_bg_done(spi_bus_lock_dev_handle_t dev_handle, uint32_t wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle interrupt and closure of last operation. Should be called at the beginning of the ISR,
|
* Handle interrupt and closure of last operation. Should be called at the beginning of the ISR,
|
||||||
@@ -437,7 +437,7 @@ bool spi_bus_lock_bg_entry(spi_bus_lock_handle_t lock);
|
|||||||
* @return false if retry is required, indicating that there is pending BG request.
|
* @return false if retry is required, indicating that there is pending BG request.
|
||||||
* otherwise true and quit ISR is allowed.
|
* otherwise true and quit ISR is allowed.
|
||||||
*/
|
*/
|
||||||
bool spi_bus_lock_bg_exit(spi_bus_lock_handle_t lock, bool wip, BaseType_t* do_yield);
|
bool spi_bus_lock_bg_exit(spi_bus_lock_handle_t lock, bool wip, int* do_yield);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether there is device asking for the acquiring device, and the desired
|
* Check whether there is device asking for the acquiring device, and the desired
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "soc/soc.h"
|
#include "soc/soc.h"
|
||||||
#include "freertos/FreeRTOSConfig.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -32,7 +31,7 @@ typedef enum {
|
|||||||
* - ESP_FAIL: Called in ISR context
|
* - ESP_FAIL: Called in ISR context
|
||||||
* - ESP_ERR_TIMEOUT: Timeout waiting for battery charging to complete
|
* - ESP_ERR_TIMEOUT: Timeout waiting for battery charging to complete
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_vbat_wait_battery_charge_done(TickType_t checking_period);
|
esp_err_t esp_vbat_wait_battery_charge_done(uint32_t checking_period);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ IRAM_ATTR static void vbat_isr_handler(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_ESP_VBAT_USE_RECHARGEABLE_BATTERY
|
#if CONFIG_ESP_VBAT_USE_RECHARGEABLE_BATTERY
|
||||||
esp_err_t esp_vbat_wait_battery_charge_done(TickType_t checking_period)
|
esp_err_t esp_vbat_wait_battery_charge_done(uint32_t checking_period)
|
||||||
{
|
{
|
||||||
BaseType_t ret;
|
BaseType_t ret;
|
||||||
if (!xPortInIsrContext()) {
|
if (!xPortInIsrContext()) {
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ IRAM_ATTR bool spi_bus_lock_touch(spi_bus_lock_dev_handle_t dev_handle)
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Acquiring service
|
* Acquiring service
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
IRAM_ATTR esp_err_t spi_bus_lock_acquire_start(spi_bus_lock_dev_t *dev_handle, TickType_t wait)
|
IRAM_ATTR esp_err_t spi_bus_lock_acquire_start(spi_bus_lock_dev_t *dev_handle, uint32_t wait)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE_ISR(wait == portMAX_DELAY, ESP_ERR_INVALID_ARG, TAG, "timeout other than portMAX_DELAY not supported");
|
ESP_RETURN_ON_FALSE_ISR(wait == portMAX_DELAY, ESP_ERR_INVALID_ARG, TAG, "timeout other than portMAX_DELAY not supported");
|
||||||
|
|
||||||
@@ -774,9 +774,9 @@ SPI_BUS_LOCK_ISR_ATTR bool spi_bus_lock_bg_entry(spi_bus_lock_t* lock)
|
|||||||
return bg_entry_core(lock);
|
return bg_entry_core(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPI_BUS_LOCK_ISR_ATTR bool spi_bus_lock_bg_exit(spi_bus_lock_t* lock, bool wip, BaseType_t* do_yield)
|
SPI_BUS_LOCK_ISR_ATTR bool spi_bus_lock_bg_exit(spi_bus_lock_t* lock, bool wip, int* do_yield)
|
||||||
{
|
{
|
||||||
return bg_exit_core(lock, wip, do_yield);
|
return bg_exit_core(lock, wip, (BaseType_t*)do_yield);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPI_BUSLOCK_ATTR esp_err_t spi_bus_lock_bg_request(spi_bus_lock_dev_t *dev_handle)
|
SPI_BUSLOCK_ATTR esp_err_t spi_bus_lock_bg_request(spi_bus_lock_dev_t *dev_handle)
|
||||||
@@ -785,7 +785,7 @@ SPI_BUSLOCK_ATTR esp_err_t spi_bus_lock_bg_request(spi_bus_lock_dev_t *dev_handl
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
IRAM_ATTR esp_err_t spi_bus_lock_wait_bg_done(spi_bus_lock_dev_handle_t dev_handle, TickType_t wait)
|
IRAM_ATTR esp_err_t spi_bus_lock_wait_bg_done(spi_bus_lock_dev_handle_t dev_handle, uint32_t wait)
|
||||||
{
|
{
|
||||||
spi_bus_lock_t *lock = dev_handle->parent;
|
spi_bus_lock_t *lock = dev_handle->parent;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "esp_lcd_common.h"
|
#include "esp_lcd_common.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
static const char *TAG = "lcd_panel.io.spi";
|
static const char *TAG = "lcd_panel.io.spi";
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "hal/wdt_hal.h"
|
#include "hal/wdt_hal.h"
|
||||||
#include "hal/uart_types.h"
|
#include "hal/uart_types.h"
|
||||||
#include "hal/uart_ll.h"
|
#include "hal/uart_ll.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
||||||
#include "private/esp_coexist_internal.h"
|
#include "private/esp_coexist_internal.h"
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "sd_protocol_defs.h"
|
#include "sd_protocol_defs.h"
|
||||||
#include "sd_protocol_types.h"
|
#include "sd_protocol_types.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "sd_pwr_ctrl.h"
|
#include "sd_pwr_ctrl.h"
|
||||||
#include "esp_dma_utils.h"
|
#include "esp_dma_utils.h"
|
||||||
#include "hal/sd_types.h"
|
#include "hal/sd_types.h"
|
||||||
@@ -218,7 +217,7 @@ typedef struct {
|
|||||||
esp_err_t (*deinit_p)(int slot); /*!< host function to deinitialize the driver, called with the `slot` */
|
esp_err_t (*deinit_p)(int slot); /*!< host function to deinitialize the driver, called with the `slot` */
|
||||||
};
|
};
|
||||||
esp_err_t (*io_int_enable)(int slot); /*!< Host function to enable SDIO interrupt line */
|
esp_err_t (*io_int_enable)(int slot); /*!< Host function to enable SDIO interrupt line */
|
||||||
esp_err_t (*io_int_wait)(int slot, TickType_t timeout_ticks); /*!< Host function to wait for SDIO interrupt line to be active */
|
esp_err_t (*io_int_wait)(int slot, uint32_t timeout_ticks); /*!< Host function to wait for SDIO interrupt line to be active */
|
||||||
int command_timeout_ms; /*!< timeout, in milliseconds, of a single command. Set to 0 to use the default value. */
|
int command_timeout_ms; /*!< timeout, in milliseconds, of a single command. Set to 0 to use the default value. */
|
||||||
esp_err_t (*get_real_freq)(int slot, int* real_freq); /*!< Host function to provide real working freq, based on SDMMC controller setup */
|
esp_err_t (*get_real_freq)(int slot, int* real_freq); /*!< Host function to provide real working freq, based on SDMMC controller setup */
|
||||||
sdmmc_delay_phase_t input_delay_phase; /*!< input delay phase, this will only take into effect when the host works in SDMMC_FREQ_HIGHSPEED or SDMMC_FREQ_52M. Driver will print out how long the delay is*/
|
sdmmc_delay_phase_t input_delay_phase; /*!< input delay phase, this will only take into effect when the host works in SDMMC_FREQ_HIGHSPEED or SDMMC_FREQ_52M. Driver will print out how long the delay is*/
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ esp_err_t sdmmc_io_enable_int(sdmmc_card_t* card);
|
|||||||
* IO interrupts
|
* IO interrupts
|
||||||
* - ESP_ERR_TIMEOUT if the interrupt does not happen in timeout_ticks
|
* - ESP_ERR_TIMEOUT if the interrupt does not happen in timeout_ticks
|
||||||
*/
|
*/
|
||||||
esp_err_t sdmmc_io_wait_int(sdmmc_card_t* card, TickType_t timeout_ticks);
|
esp_err_t sdmmc_io_wait_int(sdmmc_card_t* card, uint32_t timeout_ticks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data of CIS region of an SDIO card.
|
* Get the data of CIS region of an SDIO card.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "esp_private/sdmmc_common.h"
|
#include "esp_private/sdmmc_common.h"
|
||||||
|
|
||||||
static const char* TAG = "sdmmc_cmd";
|
static const char* TAG = "sdmmc_cmd";
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "esp_timer.h"
|
#include "esp_timer.h"
|
||||||
#include "esp_private/sdmmc_common.h"
|
#include "esp_private/sdmmc_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "esp_private/sdmmc_common.h"
|
#include "esp_private/sdmmc_common.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
#include "esp_compiler.h"
|
#include "esp_compiler.h"
|
||||||
|
|
||||||
@@ -497,7 +498,7 @@ esp_err_t sdmmc_io_enable_int(sdmmc_card_t* card)
|
|||||||
return (*card->host.io_int_enable)(card->host.slot);
|
return (*card->host.io_int_enable)(card->host.slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t sdmmc_io_wait_int(sdmmc_card_t* card, TickType_t timeout_ticks)
|
esp_err_t sdmmc_io_wait_int(sdmmc_card_t* card, uint32_t timeout_ticks)
|
||||||
{
|
{
|
||||||
if (card->host.io_int_wait == NULL) {
|
if (card->host.io_int_wait == NULL) {
|
||||||
return ESP_ERR_NOT_SUPPORTED;
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "esp_timer.h"
|
#include "esp_timer.h"
|
||||||
#include "esp_cache.h"
|
#include "esp_cache.h"
|
||||||
#include "esp_private/sdmmc_common.h"
|
#include "esp_private/sdmmc_common.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
#define SDMMC_DELAY_NUMS_MAX 10
|
#define SDMMC_DELAY_NUMS_MAX 10
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "hal/efuse_hal.h"
|
#include "hal/efuse_hal.h"
|
||||||
#include "soc/chip_revision.h"
|
#include "soc/chip_revision.h"
|
||||||
|
#include "esp_cpu.h"
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32S2
|
#if CONFIG_IDF_TARGET_ESP32S2
|
||||||
#include "esp_crypto_lock.h" // for locking flash encryption peripheral
|
#include "esp_crypto_lock.h" // for locking flash encryption peripheral
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ RTC Subsystem Control
|
|||||||
|
|
||||||
Low power modules usually share some common resources like interrupt number. To avoid conflicts, some private APIs are created in the ``esp_private/rtc_ctrl.h`` header file to manage these shared resources with ease. There used to be another header file ``driver/rtc_cntl.h`` for the same purpose, which is now removed.
|
Low power modules usually share some common resources like interrupt number. To avoid conflicts, some private APIs are created in the ``esp_private/rtc_ctrl.h`` header file to manage these shared resources with ease. There used to be another header file ``driver/rtc_cntl.h`` for the same purpose, which is now removed.
|
||||||
|
|
||||||
|
Removal of FreeRTOS Dependencies from Driver Header Files
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Starting from v6.0, to improve the portability of IDF drivers, all public driver header files no longer include operating-system–specific (FreeRTOS) headers. Therefore, application code that previously relied on this implicit inclusion must explicitly include the corresponding FreeRTOS headers when using v6.0 or later.
|
||||||
|
|
||||||
ADC
|
ADC
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ RTC 子系统控制
|
|||||||
|
|
||||||
低功耗模块通常会共享一些资源,比如中断号。为避免资源冲突,私有头文件 ``esp_private/rtc_ctrl.h`` 提供了相关 API 方便管理这些共享资源。原先用于同样目的的头文件 ``driver/rtc_cntl.h`` 已被移除。
|
低功耗模块通常会共享一些资源,比如中断号。为避免资源冲突,私有头文件 ``esp_private/rtc_ctrl.h`` 提供了相关 API 方便管理这些共享资源。原先用于同样目的的头文件 ``driver/rtc_cntl.h`` 已被移除。
|
||||||
|
|
||||||
|
驱动头文件移除 FreeRTOS 依赖
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
自 v6.0 起,为了增强 IDF 驱动的通用性,所有公开的驱动头文件不再包含具体操作系统(FreeRTOS)相关的头文件。因此,以前依赖这种隐式包含逻辑的应用代码,在 v6.0 之后需要显示添加对应的 FreeRTOS 头文件。
|
||||||
|
|
||||||
ADC
|
ADC
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
espressif/led_strip: "^2.4.1"
|
espressif/led_strip: "^3.0.0"
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
espressif/led_strip: "^2.4.1"
|
espressif/led_strip: "^3.0.0"
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
espressif/led_strip: "^2.4.1"
|
espressif/led_strip: "^3.0.0"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "esp_pm.h"
|
#include "esp_pm.h"
|
||||||
#include "esp_rtc_time.h"
|
#include "esp_rtc_time.h"
|
||||||
#include "esp_sleep.h"
|
#include "esp_sleep.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
espressif/led_strip: "^2.4.1"
|
espressif/led_strip: "^3.0.0"
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "sys/queue.h"
|
#include "sys/queue.h"
|
||||||
#include "soc/soc.h"
|
#include "soc/soc.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/ringbuf.h"
|
#include "freertos/ringbuf.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
@@ -38,12 +39,12 @@
|
|||||||
- 0 is the register to hold tasks. Bits:
|
- 0 is the register to hold tasks. Bits:
|
||||||
- 0: the slave should reset.
|
- 0: the slave should reset.
|
||||||
- 1: the slave should send interrupts.
|
- 1: the slave should send interrupts.
|
||||||
- 2: the slave should write the shared registers acoording to the value in register 1.
|
- 2: the slave should write the shared registers according to the value in register 1.
|
||||||
- 1 is the register to hold test value.
|
- 1 is the register to hold test value.
|
||||||
- other registers will be written by the slave for testing.
|
- other registers will be written by the slave for testing.
|
||||||
|
|
||||||
- FIFO:
|
- FIFO:
|
||||||
The receving FIFO is size of 256 bytes.
|
The receiving FIFO is size of 256 bytes.
|
||||||
When the host writes something to slave recv FIFO, the slave should return it as is to the sending FIFO.
|
When the host writes something to slave recv FIFO, the slave should return it as is to the sending FIFO.
|
||||||
|
|
||||||
The host works as following process:
|
The host works as following process:
|
||||||
@@ -99,7 +100,7 @@ static esp_err_t slave_reset(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Since the buffer will not be sent any more, we return them back to receving driver
|
//Since the buffer will not be sent any more, we return them back to receiving driver
|
||||||
while (1) {
|
while (1) {
|
||||||
sdio_slave_buf_handle_t handle;
|
sdio_slave_buf_handle_t handle;
|
||||||
ret = sdio_slave_send_get_finished(&handle, 0);
|
ret = sdio_slave_send_get_finished(&handle, 0);
|
||||||
@@ -145,7 +146,7 @@ static esp_err_t task_write_reg(void)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//we use the event callback (in ISR) in this example to get higer responding speed
|
//we use the event callback (in ISR) in this example to get higher responding speed
|
||||||
//note you can't do delay in the ISR
|
//note you can't do delay in the ISR
|
||||||
//``sdio_slave_wait_int`` is another way to handle interrupts
|
//``sdio_slave_wait_int`` is another way to handle interrupts
|
||||||
static void event_cb(uint8_t pos)
|
static void event_cb(uint8_t pos)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "wear_levelling.h"
|
#include "wear_levelling.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "perf_benchmark_example_tests.h"
|
#include "perf_benchmark_example_tests.h"
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ class HeaderFailedContainsStaticAssert(HeaderFailed):
|
|||||||
return 'Header uses _Static_assert or static_assert instead of ESP_STATIC_ASSERT'
|
return 'Header uses _Static_assert or static_assert instead of ESP_STATIC_ASSERT'
|
||||||
|
|
||||||
|
|
||||||
|
class HeaderFailedForbiddenFreertosInclude(HeaderFailed):
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return 'Header includes forbidden "freertos/*" dependency'
|
||||||
|
|
||||||
|
|
||||||
# Creates a temp file and returns both output as a string and a file name
|
# Creates a temp file and returns both output as a string and a file name
|
||||||
#
|
#
|
||||||
def exec_cmd_to_temp_file(what: list, suffix: str = '') -> tuple[int, str, str, str, str]:
|
def exec_cmd_to_temp_file(what: list, suffix: str = '') -> tuple[int, str, str, str, str]:
|
||||||
@@ -102,6 +107,18 @@ class PublicHeaderChecker:
|
|||||||
r'(soc|modem|hw_ver(?:\d+|_[A-Za-z0-9]+)/soc)/'
|
r'(soc|modem|hw_ver(?:\d+|_[A-Za-z0-9]+)/soc)/'
|
||||||
r'[a-zA-Z0-9_]+\.h$'
|
r'[a-zA-Z0-9_]+\.h$'
|
||||||
)
|
)
|
||||||
|
self.freertos_forbidden_include = re.compile(r'(?m)^\s*#\s*include\s*"freertos/[^"]+"')
|
||||||
|
# Scope for enforcing freertos include rule:
|
||||||
|
# - components/esp_adc/**
|
||||||
|
# - components/esp_driver_*/**
|
||||||
|
# - components/esp_hw_support/**
|
||||||
|
# - components/sdmmc/**
|
||||||
|
# - components/ieee802154/**
|
||||||
|
# - components/esp_eth/**
|
||||||
|
# - components/esp_lcd/**
|
||||||
|
self.freertos_scope = re.compile(
|
||||||
|
r'^(components/(esp_adc|esp_hw_support|sdmmc|ieee802154|esp_eth|esp_lcd)/|components/esp_driver_[^/]+/)'
|
||||||
|
)
|
||||||
self.assembly_nocode = r'^\s*(\.file|\.text|\.ident|\.option|\.attribute|(\.section)?).*$'
|
self.assembly_nocode = r'^\s*(\.file|\.text|\.ident|\.option|\.attribute|(\.section)?).*$'
|
||||||
self.check_threads: list[Thread] = []
|
self.check_threads: list[Thread] = []
|
||||||
self.stdc = '--std=c99'
|
self.stdc = '--std=c99'
|
||||||
@@ -112,6 +129,11 @@ class PublicHeaderChecker:
|
|||||||
self.failed_queue: queue.Queue = queue.Queue()
|
self.failed_queue: queue.Queue = queue.Queue()
|
||||||
self.terminate = Event()
|
self.terminate = Event()
|
||||||
self.build_dir = tempfile.mkdtemp()
|
self.build_dir = tempfile.mkdtemp()
|
||||||
|
# Get IDF_PATH early to avoid dependency on method execution order
|
||||||
|
idf_path = os.getenv('IDF_PATH')
|
||||||
|
if idf_path is None:
|
||||||
|
raise RuntimeError("Environment variable 'IDF_PATH' wasn't set.")
|
||||||
|
self.idf_path = idf_path
|
||||||
|
|
||||||
def __enter__(self) -> 'PublicHeaderChecker':
|
def __enter__(self) -> 'PublicHeaderChecker':
|
||||||
for i in range(self.jobs):
|
for i in range(self.jobs):
|
||||||
@@ -230,6 +252,18 @@ class PublicHeaderChecker:
|
|||||||
# we ignore the rc here, as the `-fpreprocessed` flag expects the file to have macros already expanded,
|
# we ignore the rc here, as the `-fpreprocessed` flag expects the file to have macros already expanded,
|
||||||
# so we might get some errors here we use it only to remove comments (even if the command returns non-zero
|
# so we might get some errors here we use it only to remove comments (even if the command returns non-zero
|
||||||
# code it produces the correct output)
|
# code it produces the correct output)
|
||||||
|
# forbid direct inclusion of FreeRTOS headers via quotes (only in scoped components)
|
||||||
|
if re.search(self.freertos_forbidden_include, out):
|
||||||
|
# Determine if current header is inside the scoped component folders
|
||||||
|
rel_path_for_scope = os.path.normpath(header)
|
||||||
|
try:
|
||||||
|
# self.idf_path is set in list_public_headers
|
||||||
|
rel_path_for_scope = os.path.relpath(rel_path_for_scope, self.idf_path)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
if re.search(self.freertos_scope, rel_path_for_scope):
|
||||||
|
# Raise, let final summary print the failure; avoid noisy intermediate logs
|
||||||
|
raise HeaderFailedForbiddenFreertosInclude()
|
||||||
if re.search(self.kconfig_macro, out):
|
if re.search(self.kconfig_macro, out):
|
||||||
# enable defined #error if sdkconfig.h not included
|
# enable defined #error if sdkconfig.h not included
|
||||||
all_compilation_flags.append('-DIDF_CHECK_SDKCONFIG_INCLUDED')
|
all_compilation_flags.append('-DIDF_CHECK_SDKCONFIG_INCLUDED')
|
||||||
@@ -301,9 +335,7 @@ class PublicHeaderChecker:
|
|||||||
|
|
||||||
# Get compilation data from an example to list all public header files
|
# Get compilation data from an example to list all public header files
|
||||||
def list_public_headers(self, ignore_dirs: list, ignore_files: list | set, only_dir: str | None = None) -> None:
|
def list_public_headers(self, ignore_dirs: list, ignore_files: list | set, only_dir: str | None = None) -> None:
|
||||||
idf_path = os.getenv('IDF_PATH')
|
idf_path = self.idf_path
|
||||||
if idf_path is None:
|
|
||||||
raise RuntimeError("Environment variable 'IDF_PATH' wasn't set.")
|
|
||||||
project_dir = os.path.join(idf_path, 'examples', 'get-started', 'blink')
|
project_dir = os.path.join(idf_path, 'examples', 'get-started', 'blink')
|
||||||
sdkconfig = os.path.join(self.build_dir, 'sdkconfig')
|
sdkconfig = os.path.join(self.build_dir, 'sdkconfig')
|
||||||
if self.libc_type == 'newlib':
|
if self.libc_type == 'newlib':
|
||||||
@@ -410,6 +442,8 @@ def check_all_headers() -> None:
|
|||||||
* Check if no definition is present in the offending header file
|
* Check if no definition is present in the offending header file
|
||||||
5) "Header contains _Static_assert or static_assert": Makes the use of _Static_assert or static_assert
|
5) "Header contains _Static_assert or static_assert": Makes the use of _Static_assert or static_assert
|
||||||
functions instead of using ESP_STATIC_ASSERT macro
|
functions instead of using ESP_STATIC_ASSERT macro
|
||||||
|
6) "Header includes forbidden \\"freertos/*\\" dependency": Using #include "freertos/..." inside
|
||||||
|
* public headers is not allowed
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
* The script validates *all* header files (recursively) in public folders for all components.
|
* The script validates *all* header files (recursively) in public folders for all components.
|
||||||
|
|||||||
@@ -123,4 +123,7 @@ components/riscv/include/riscv/rvruntime-frames.h
|
|||||||
# should be private include, but 'private_include' is a subdir of public includes
|
# should be private include, but 'private_include' is a subdir of public includes
|
||||||
components/console/private_include/console_private.h
|
components/console/private_include/console_private.h
|
||||||
|
|
||||||
# Missing extern "C"
|
# Public driver headers contain FreeRTOS headers
|
||||||
|
|
||||||
|
components/esp_driver_uart/include/driver/uart.h
|
||||||
|
components/esp_driver_sdmmc/include/esp_private/sd_host_private.h
|
||||||
|
|||||||
Reference in New Issue
Block a user