Add the following application-facing memory domain APIs: k_mem_domain_init() - to initialize a memory domain k_mem_domain_destroy() - to destroy a memory domain k_mem_domain_add_partition() - to add a partition into a domain k_mem_domain_remove_partition() - to remove a partition from a domain k_mem_domain_add_thread() - to add a thread into a domain k_mem_domain_remove_thread() - to remove a thread from a domain A memory domain would contain some number of memory partitions. A memory partition is a memory region (might be RAM, peripheral registers, flash...) with specific attributes (access permission, e.g. privileged read/write, unprivileged read-only, execute never...). Memory partitions would be defined by set of MPU regions or MMU tables underneath. A thread could only belong to a single memory domain any point in time but a memory domain could contain multiple threads. Threads in the same memory domain would have the same access permission to the memory partitions belong to the memory domain. The memory domain APIs are used by unprivileged threads to share data to the threads in the same memory and protect sensitive data from threads outside their domain. It is not only for improving the security but also useful for debugging (unexpected access would cause exception). Jira: ZEP-2281 Signed-off-by: Chunlin Han <chunlin.han@linaro.org>
234 lines
4.9 KiB
ReStructuredText
234 lines
4.9 KiB
ReStructuredText
.. _kernel_apis:
|
|
|
|
Kernel APIs
|
|
###########
|
|
|
|
This section contains APIs for the kernel's core services,
|
|
as described in the :ref:`kernel`.
|
|
|
|
.. important::
|
|
Unless otherwise noted these APIs can be used by threads, but not by ISRs.
|
|
|
|
.. contents::
|
|
:depth: 1
|
|
:local:
|
|
:backlinks: top
|
|
|
|
Threads
|
|
*******
|
|
|
|
A thread is an independently scheduled series of instructions that implements
|
|
a portion of an application's processing. Threads are used to perform processing
|
|
that is too lengthy or too complex to be performed by an ISR.
|
|
(See :ref:`threads_v2`.)
|
|
|
|
.. doxygengroup:: thread_apis
|
|
:project: Zephyr
|
|
|
|
Workqueues
|
|
**********
|
|
|
|
A workqueue processes a series of work items by executing the associated
|
|
functions in a dedicated thread. Workqueues are typically used by an ISR
|
|
or high-priority thread to offload non-urgent processing.
|
|
(See :ref:`workqueues_v2`.)
|
|
|
|
.. doxygengroup:: workqueue_apis
|
|
:project: Zephyr
|
|
|
|
Clocks
|
|
******
|
|
|
|
Kernel clocks enable threads and ISRs to measure the passage of time
|
|
with either normal and high precision.
|
|
(See :ref:`clocks_v2`.)
|
|
|
|
.. doxygengroup:: clock_apis
|
|
:project: Zephyr
|
|
|
|
Timers
|
|
******
|
|
|
|
Timers enable threads to measure the passage of time, and to optionally execute
|
|
an action when the timer expires.
|
|
(See :ref:`timers_v2`.)
|
|
|
|
.. doxygengroup:: timer_apis
|
|
:project: Zephyr
|
|
|
|
Memory Slabs
|
|
************
|
|
|
|
Memory slabs enable the dynamic allocation and release of fixed-size
|
|
memory blocks.
|
|
(See :ref:`memory_slabs_v2`.)
|
|
|
|
.. doxygengroup:: mem_slab_apis
|
|
:project: Zephyr
|
|
|
|
Memory Pools
|
|
************
|
|
|
|
Memory pools enable the dynamic allocation and release of variable-size
|
|
memory blocks.
|
|
(See :ref:`memory_pools_v2`.)
|
|
|
|
.. doxygengroup:: mem_pool_apis
|
|
:project: Zephyr
|
|
|
|
Heap Memory Pool
|
|
****************
|
|
|
|
The heap memory pools enable the dynamic allocation and release of memory
|
|
in a :cpp:func:`malloc()`-like manner.
|
|
(See :ref:`heap_v2`.)
|
|
|
|
.. doxygengroup:: heap_apis
|
|
:project: Zephyr
|
|
|
|
Semaphores
|
|
**********
|
|
|
|
Semaphores provide traditional counting semaphore capabilities.
|
|
(See :ref:`semaphores_v2`.)
|
|
|
|
.. doxygengroup:: semaphore_apis
|
|
:project: Zephyr
|
|
|
|
Mutexes
|
|
*******
|
|
|
|
Mutexes provide traditional reentrant mutex capabilities
|
|
with basic priority inheritance.
|
|
(See :ref:`mutexes_v2`.)
|
|
|
|
.. doxygengroup:: mutex_apis
|
|
:project: Zephyr
|
|
|
|
Alerts
|
|
******
|
|
|
|
Alerts enable an application to perform asynchronous signaling,
|
|
somewhat akin to Unix-style signals.
|
|
(See :ref:`alerts_v2`.)
|
|
|
|
.. doxygengroup:: alert_apis
|
|
:project: Zephyr
|
|
|
|
Fifos
|
|
*****
|
|
|
|
Fifos provide traditional first in, first out (FIFO) queuing of data items
|
|
of any size.
|
|
(See :ref:`fifos_v2`.)
|
|
|
|
.. doxygengroup:: fifo_apis
|
|
:project: Zephyr
|
|
|
|
Lifos
|
|
*****
|
|
|
|
Lifos provide traditional last in, first out (LIFO) queuing of data items
|
|
of any size.
|
|
(See :ref:`lifos_v2`.)
|
|
|
|
.. doxygengroup:: lifo_apis
|
|
:project: Zephyr
|
|
|
|
Stacks
|
|
******
|
|
|
|
Stacks provide traditional last in, first out (LIFO) queuing of 32-bit
|
|
data items.
|
|
(See :ref:`stacks_v2`.)
|
|
|
|
.. doxygengroup:: stack_apis
|
|
:project: Zephyr
|
|
|
|
Message Queues
|
|
**************
|
|
|
|
Message queues provide a simple message queuing mechanism
|
|
for fixed-size data items.
|
|
(See :ref:`message_queues_v2`.)
|
|
|
|
.. doxygengroup:: msgq_apis
|
|
:project: Zephyr
|
|
|
|
Mailboxes
|
|
*********
|
|
|
|
Mailboxes provide an enhanced message queuing mechanism
|
|
for variable-size messages.
|
|
(See :ref:`mailboxes_v2`.)
|
|
|
|
.. doxygengroup:: mailbox_apis
|
|
:project: Zephyr
|
|
|
|
Pipes
|
|
*****
|
|
|
|
Pipes provide a traditional anonymous pipe mechanism for sending
|
|
variable-size chunks of data, in whole or in part.
|
|
(See :ref:`pipes_v2`.)
|
|
|
|
.. doxygengroup:: pipe_apis
|
|
:project: Zephyr
|
|
|
|
Interrupt Service Routines (ISRs)
|
|
*********************************
|
|
|
|
An interrupt service routine is a series of instructions that is
|
|
executed asynchronously in response to a hardware or software interrupt.
|
|
(See :ref:`interrupts_v2`.)
|
|
|
|
.. doxygengroup:: isr_apis
|
|
:project: Zephyr
|
|
|
|
Atomic Services
|
|
***************
|
|
|
|
The atomic services enable multiple threads and ISRs to read and modify
|
|
32-bit variables in an uninterruptible manner.
|
|
(See :ref:`atomic_v2`.)
|
|
|
|
.. important::
|
|
All atomic services APIs can be used by both threads and ISRs.
|
|
|
|
.. doxygengroup:: atomic_apis
|
|
:project: Zephyr
|
|
|
|
Floating Point Services
|
|
***********************
|
|
|
|
The floating point services enable threads to use a board's floating point
|
|
registers.
|
|
(See :ref:`float_v2`.)
|
|
|
|
.. doxygengroup:: float_apis
|
|
:project: Zephyr
|
|
|
|
Ring Buffers
|
|
************
|
|
|
|
Ring buffers enable simple first in, first out (FIFO) queuing
|
|
of variable-size data items.
|
|
(See :ref:`ring_buffers_v2`.)
|
|
|
|
.. doxygengroup:: ring_buffer_apis
|
|
:project: Zephyr
|
|
:content-only:
|
|
|
|
Memory Domain
|
|
*************
|
|
|
|
A memory domain contains some number of memory partitions. Threads can
|
|
specify the range and attribute (access permission) for memory partitions
|
|
in a memory domain. Threads in the same memory domain have the
|
|
same access permissions to the memory partitions belong to the
|
|
memory domain.
|
|
(See :ref:`memory_domain`.)
|
|
|
|
.. doxygengroup:: mem_domain_apis
|
|
:project: Zephyr
|