ipc.rst 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Inter-Processor Call
  2. ====================
  3. Overview
  4. --------
  5. Due to the dual core nature of the {IDF_TARGET_NAME}, there are instances where a certain
  6. function must be run in the context of a particular core (e.g. allocating
  7. ISR to an interrupt source of a particular core). The IPC (Inter-Processor
  8. Call) feature allows for the execution of functions on a particular CPU.
  9. A given function can be executed on a particular core by calling
  10. :cpp:func:`esp_ipc_call` or :cpp:func:`esp_ipc_call_blocking`. IPC is
  11. implemented via two high priority FreeRTOS tasks pinned to each CPU known as
  12. the IPC Tasks. The two IPC Tasks remain inactive (blocked) until
  13. :cpp:func:`esp_ipc_call` or :cpp:func:`esp_ipc_call_blocking` is called. When
  14. an IPC Task of a particular core is unblocked, it will preempt the current
  15. running task on that core and execute a given function.
  16. Usage
  17. -----
  18. :cpp:func:`esp_ipc_call` unblocks the IPC task on a particular core to execute
  19. a given function. The task that calls :cpp:func:`esp_ipc_call` will be blocked
  20. until the IPC Task begins execution of the given function.
  21. :cpp:func:`esp_ipc_call_blocking` is similar but will block the calling task
  22. until the IPC Task has completed execution of the given function.
  23. Functions executed by IPCs must be functions of type
  24. `void func(void *arg)`. To run more complex functions which require a larger
  25. stack, the IPC tasks' stack size can be configured by modifying
  26. :ref:`CONFIG_ESP_IPC_TASK_STACK_SIZE` in `menuconfig`. The IPC API is protected by a
  27. mutex hence simultaneous IPC calls are not possible.
  28. Care should taken to avoid deadlock when writing functions to be executed by
  29. IPC, especially when attempting to take a mutex within the function.
  30. API Reference
  31. -------------
  32. .. include-build-file:: inc/esp_ipc.inc