docs: update api-ref system docs for C2

This commit is contained in:
Marius Vikhammer
2022-07-25 18:40:31 +08:00
parent 0330e952d1
commit 9d599c207f
7 changed files with 31 additions and 127 deletions

View File

@@ -4,13 +4,7 @@ Call function with external stack
Overview
--------
A given function can be executed with a user allocated stack space
which is independent of current task stack, this mechanism can be
used to save stack space wasted by tasks which call a common function
with intensive stack usage such as `printf`. The given function can
be called inside the shared stack space which is a callback function
deferred by calling :cpp:func:`esp_execute_shared_stack_function`,
passing that function as parameter
A given function can be executed with a user allocated stack space which is independent of current task stack, this mechanism can be used to save stack space wasted by tasks which call a common function with intensive stack usage such as `printf`. The given function can be called inside the shared stack space which is a callback function deferred by calling :cpp:func:`esp_execute_shared_stack_function`, passing that function as parameter.
Usage
-----
@@ -22,9 +16,7 @@ Usage
- the size of stack in bytes
- a pointer to the shared stack function
The user defined function will be deferred as a callback
and can be called using the user allocated space without
taking space from current task stack.
The user defined function will be deferred as a callback and can be called using the user allocated space without taking space from current task stack.
The usage may look like the code below:
@@ -46,15 +38,15 @@ The usage may look like the code below:
//Allocate a mutex to protect its usage:
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
assert(printf_lock != NULL);
//Call the desired function using the macro helper:
esp_execute_shared_stack_function(printf_lock,
esp_execute_shared_stack_function(printf_lock,
shared_stack,
8192,
external_stack_function);
vSemaphoreDelete(printf_lock);
free(shared_stack);
vSemaphoreDelete(printf_lock);
free(shared_stack);
}
.. _esp-call-with-stack-basic_usage: