2021-09-16 23:14:32 -04:00
|
|
|
/*
|
2023-11-25 10:32:47 -05:00
|
|
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
2021-09-16 23:14:32 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2016-09-12 06:54:45 -04:00
|
|
|
|
2021-10-26 09:12:26 -04:00
|
|
|
#pragma once
|
2016-09-12 06:54:45 -04:00
|
|
|
|
|
|
|
#include <esp_err.h>
|
|
|
|
|
2017-05-31 05:20:17 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2021-08-03 02:35:29 -04:00
|
|
|
|
2021-08-12 01:52:15 -04:00
|
|
|
#if !defined(CONFIG_FREERTOS_UNICORE) || defined(CONFIG_APPTRACE_GCOV_ENABLE)
|
2021-08-03 02:35:29 -04:00
|
|
|
|
2017-11-22 02:16:29 -05:00
|
|
|
/*
|
|
|
|
* Inter-processor call APIs
|
2016-09-12 06:54:45 -04:00
|
|
|
*
|
2021-10-26 09:12:26 -04:00
|
|
|
* FreeRTOS provides several APIs which can be used to communicate between different tasks, including tasks running on
|
|
|
|
* different CPUs. This module provides additional APIs to run some code on the other CPU. These APIs can only be used
|
|
|
|
* when FreeRTOS scheduler is running.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief IPC Callback
|
2016-09-12 07:54:35 -04:00
|
|
|
*
|
2021-10-26 09:12:26 -04:00
|
|
|
* A callback of this type should be provided as an argument when calling esp_ipc_call() or esp_ipc_call_blocking().
|
2016-09-12 06:54:45 -04:00
|
|
|
*/
|
2021-10-26 09:12:26 -04:00
|
|
|
typedef void (*esp_ipc_func_t)(void* arg);
|
2016-09-12 06:54:45 -04:00
|
|
|
|
|
|
|
/**
|
2021-10-26 09:12:26 -04:00
|
|
|
* @brief Execute a callback on a given CPU
|
|
|
|
*
|
|
|
|
* Execute a given callback on a particular CPU. The callback must be of type "esp_ipc_func_t" and will be invoked in
|
|
|
|
* the context of the target CPU's IPC task.
|
2016-09-12 06:54:45 -04:00
|
|
|
*
|
2021-10-26 09:12:26 -04:00
|
|
|
* - This function will block the target CPU's IPC task has begun execution of the callback
|
|
|
|
* - If another IPC call is ongoing, this function will block until the ongoing IPC call completes
|
|
|
|
* - The stack size of the IPC task can be configured via the CONFIG_ESP_IPC_TASK_STACK_SIZE option
|
2016-09-12 06:54:45 -04:00
|
|
|
*
|
2017-11-22 02:16:29 -05:00
|
|
|
* @note In single-core mode, returns ESP_ERR_INVALID_ARG for cpu_id 1.
|
2017-06-29 19:39:54 -04:00
|
|
|
*
|
2017-11-22 02:16:29 -05:00
|
|
|
* @param[in] cpu_id CPU where the given function should be executed (0 or 1)
|
|
|
|
* @param[in] func Pointer to a function of type void func(void* arg) to be executed
|
|
|
|
* @param[in] arg Arbitrary argument of type void* to be passed into the function
|
2016-09-12 06:54:45 -04:00
|
|
|
*
|
2017-11-22 02:16:29 -05:00
|
|
|
* @return
|
|
|
|
* - ESP_ERR_INVALID_ARG if cpu_id is invalid
|
|
|
|
* - ESP_ERR_INVALID_STATE if the FreeRTOS scheduler is not running
|
|
|
|
* - ESP_OK otherwise
|
2016-09-12 06:54:45 -04:00
|
|
|
*/
|
|
|
|
esp_err_t esp_ipc_call(uint32_t cpu_id, esp_ipc_func_t func, void* arg);
|
|
|
|
|
|
|
|
/**
|
2021-10-26 09:12:26 -04:00
|
|
|
* @brief Execute a callback on a given CPU until and block until it completes
|
2016-09-12 06:54:45 -04:00
|
|
|
*
|
2021-10-26 09:12:26 -04:00
|
|
|
* This function is identical to esp_ipc_call() except that this function will block until the execution of the callback
|
|
|
|
* completes.
|
2016-09-12 06:54:45 -04:00
|
|
|
*
|
2017-11-22 02:16:29 -05:00
|
|
|
* @note In single-core mode, returns ESP_ERR_INVALID_ARG for cpu_id 1.
|
2016-09-12 06:54:45 -04:00
|
|
|
*
|
2017-11-22 02:16:29 -05:00
|
|
|
* @param[in] cpu_id CPU where the given function should be executed (0 or 1)
|
|
|
|
* @param[in] func Pointer to a function of type void func(void* arg) to be executed
|
|
|
|
* @param[in] arg Arbitrary argument of type void* to be passed into the function
|
2016-09-12 06:54:45 -04:00
|
|
|
*
|
2017-11-22 02:16:29 -05:00
|
|
|
* @return
|
|
|
|
* - ESP_ERR_INVALID_ARG if cpu_id is invalid
|
|
|
|
* - ESP_ERR_INVALID_STATE if the FreeRTOS scheduler is not running
|
|
|
|
* - ESP_OK otherwise
|
2016-09-12 06:54:45 -04:00
|
|
|
*/
|
|
|
|
esp_err_t esp_ipc_call_blocking(uint32_t cpu_id, esp_ipc_func_t func, void* arg);
|
|
|
|
|
2021-10-26 09:12:26 -04:00
|
|
|
#endif // !defined(CONFIG_FREERTOS_UNICORE) || defined(CONFIG_APPTRACE_GCOV_ENABLE)
|
2016-09-12 06:54:45 -04:00
|
|
|
|
2017-05-31 05:20:17 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|