doc: Enable Kernel Primer links to macro-type APIs
Also adds a link to function-type API that was missing. Change-Id: Ie671ad2f239cdca3ac1a2eb33248dfecfa251c79 Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
parent
5e892b7e1e
commit
3acb1c97a3
16 changed files with 34 additions and 20 deletions
|
@ -71,7 +71,7 @@ The following code defines and initializes an empty fifo.
|
|||
k_fifo_init(&my_fifo);
|
||||
|
||||
Alternatively, an empty fifo can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_FIFO_DEFINE()`.
|
||||
by calling :c:macro:`K_FIFO_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above.
|
||||
|
||||
|
@ -153,6 +153,7 @@ APIs
|
|||
|
||||
The following fifo APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_FIFO_DEFINE`
|
||||
* :cpp:func:`k_fifo_init()`
|
||||
* :cpp:func:`k_fifo_put()`
|
||||
* :cpp:func:`k_fifo_put_list()`
|
||||
|
|
|
@ -62,7 +62,7 @@ The following defines and initializes an empty lifo.
|
|||
k_lifo_init(&my_lifo);
|
||||
|
||||
Alternatively, an empty lifo can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_LIFO_DEFINE()`.
|
||||
by calling :c:macro:`K_LIFO_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above.
|
||||
|
||||
|
@ -141,6 +141,7 @@ APIs
|
|||
|
||||
The following lifo APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_LIFO_DEFINE`
|
||||
* :cpp:func:`k_lifo_init()`
|
||||
* :cpp:func:`k_lifo_put()`
|
||||
* :cpp:func:`k_lifo_get()`
|
||||
|
|
|
@ -130,7 +130,7 @@ The following code defines and initializes an empty mailbox.
|
|||
k_mbox_init(&my_mailbox);
|
||||
|
||||
Alternatively, a mailbox can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_MBOX_DEFINE()`.
|
||||
by calling :c:macro:`K_MBOX_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above.
|
||||
|
||||
|
@ -634,6 +634,8 @@ APIs
|
|||
|
||||
The following APIs for a mailbox are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_MBOX_DEFINE`
|
||||
* :cpp:func:`k_mbox_init()`
|
||||
* :cpp:func:`k_mbox_put()`
|
||||
* :cpp:func:`k_mbox_async_put()`
|
||||
* :cpp:func:`k_mbox_get()`
|
||||
|
|
|
@ -85,7 +85,7 @@ that is capable of holding 10 items, each of which is 12 bytes long.
|
|||
k_msgq_init(&my_msgq, my_msgq_buffer, sizeof(data_item_type), 10);
|
||||
|
||||
Alternatively, a message queue can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_MSGQ_DEFINE()`.
|
||||
by calling :c:macro:`K_MSGQ_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above. Observe
|
||||
that the macro defines both the message queue and its buffer.
|
||||
|
@ -176,6 +176,7 @@ APIs
|
|||
|
||||
The following message queue APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_MSGQ_DEFINE`
|
||||
* :cpp:func:`k_msgq_init()`
|
||||
* :cpp:func:`k_msgq_put()`
|
||||
* :cpp:func:`k_msgq_get()`
|
||||
|
|
|
@ -68,7 +68,7 @@ buffer capable of holding 100 bytes and is aligned to a 4-byte boundary.
|
|||
k_pipe_init(&my_pipe, my_ring_buffer, sizeof(my_ring_buffer));
|
||||
|
||||
Alternatively, a pipe can be defined and initialized at compile time by
|
||||
calling :c:macro:`K_PIPE_DEFINE()`.
|
||||
calling :c:macro:`K_PIPE_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above. Observe
|
||||
that that macro defines both the pipe and its ring buffer.
|
||||
|
@ -179,6 +179,7 @@ APIs
|
|||
|
||||
The following message queue APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_PIPE_DEFINE`
|
||||
* :cpp:func:`k_pipe_init()`
|
||||
* :cpp:func:`k_pipe_put()`
|
||||
* :cpp:func:`k_pipe_get()`
|
||||
|
|
|
@ -69,7 +69,7 @@ up to ten 32-bit data values.
|
|||
k_stack_init(&my_stack, my_stack_array, MAX_ITEMS);
|
||||
|
||||
Alternatively, a stack can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_STACK_DEFINE()`.
|
||||
by calling :c:macro:`K_STACK_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above. Observe
|
||||
that the macro defines both the stack and its array of data values.
|
||||
|
@ -136,6 +136,7 @@ APIs
|
|||
|
||||
The following stack APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_STACK_DEFINE`
|
||||
* :cpp:func:`k_stack_init()`
|
||||
* :cpp:func:`k_stack_push()`
|
||||
* :cpp:func:`k_stack_pop()`
|
||||
|
|
|
@ -122,7 +122,7 @@ However, since a memory pool also requires a number of variable-size data
|
|||
structures to represent its block sets and the status of its quad-blocks,
|
||||
the kernel does not support the run-time definition of a memory pool.
|
||||
A memory pool can only be defined and initialized at compile time
|
||||
by calling :c:macro:`K_MEM_POOL_DEFINE()`.
|
||||
by calling :c:macro:`K_MEM_POOL_DEFINE`.
|
||||
|
||||
The following code defines and initializes a memory pool that has 3 blocks
|
||||
of 4096 bytes each, which can be partitioned into blocks as small as 64 bytes
|
||||
|
@ -212,6 +212,7 @@ APIs
|
|||
|
||||
The following memory pool APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_MEM_POOL_DEFINE`
|
||||
* :cpp:func:`k_mem_pool_alloc()`
|
||||
* :cpp:func:`k_mem_pool_free()`
|
||||
* :cpp:func:`k_mem_pool_defrag()`
|
||||
|
|
|
@ -81,7 +81,7 @@ that are 400 bytes long, each of which is aligned to a 4-byte boundary..
|
|||
k_mem_slab_init(&my_slab, my_slab_buffer, 400, 6);
|
||||
|
||||
Alternatively, a memory slab can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_MEM_SLAB_DEFINE()`.
|
||||
by calling :c:macro:`K_MEM_SLAB_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above. Observe
|
||||
that the macro defines both the memory slab and its buffer.
|
||||
|
@ -146,6 +146,7 @@ APIs
|
|||
|
||||
The following memory slab APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_MEM_SLAB_DEFINE`
|
||||
* :cpp:func:`k_mem_slab_init()`
|
||||
* :cpp:func:`k_mem_slab_alloc()`
|
||||
* :cpp:func:`k_mem_slab_free()`
|
||||
|
|
|
@ -31,7 +31,7 @@ Defining an Atomic Variable
|
|||
An atomic variable is defined using a variable of type :c:type:`atomic_t`.
|
||||
|
||||
By default an atomic variable is initialized to zero. However, it can be given
|
||||
a different value using :c:macro:`ATOMIC_INIT()`:
|
||||
a different value using :c:macro:`ATOMIC_INIT`:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
|
@ -67,7 +67,7 @@ Manipulating an Array of Atomic Variables
|
|||
|
||||
An array of 32-bit atomic variables can be defined in the conventional manner.
|
||||
However, you can also define an N-bit array of atomic variables using
|
||||
:c:macro:`ATOMIC_DEFINE()`.
|
||||
:c:macro:`ATOMIC_DEFINE`.
|
||||
|
||||
A single bit in array of atomic variables can be manipulated using
|
||||
the APIs listed at the end of this section that end with :cpp:func:`_bit`.
|
||||
|
@ -115,8 +115,8 @@ APIs
|
|||
|
||||
The following atomic operation APIs are provided by :file:`atomic.h`:
|
||||
|
||||
* :c:macro:`ATOMIC_INIT()`
|
||||
* :c:macro:`ATOMIC_DEFINE()`
|
||||
* :c:macro:`ATOMIC_INIT`
|
||||
* :c:macro:`ATOMIC_DEFINE`
|
||||
* :cpp:func:`atomic_get()`
|
||||
* :cpp:func:`atomic_set()`
|
||||
* :cpp:func:`atomic_clear()`
|
||||
|
|
|
@ -102,7 +102,7 @@ pre-tag a thread using one of the techniques listed below.
|
|||
|
||||
* A statically-spawned x86 thread can be pre-tagged by passing the
|
||||
:c:macro:`K_FP_REGS` or :c:macro:`K_SSE_REGS` option to
|
||||
:c:macro:`K_THREAD_DEFINE()`.
|
||||
:c:macro:`K_THREAD_DEFINE`.
|
||||
|
||||
* A dynamically-spawned x86 thread can be pre-tagged by passing the
|
||||
:c:macro:`K_FP_REGS` or :c:macro:`K_SSE_REGS` option to
|
||||
|
|
|
@ -127,7 +127,7 @@ Implementation
|
|||
Defining an ISR
|
||||
===============
|
||||
|
||||
An ISR is defined at run-time by calling :c:macro:`IRQ_CONNECT()`. It must
|
||||
An ISR is defined at run-time by calling :c:macro:`IRQ_CONNECT`. It must
|
||||
then be enabled by calling :cpp:func:`irq_enable()`.
|
||||
|
||||
.. important::
|
||||
|
@ -185,7 +185,7 @@ APIs
|
|||
|
||||
The following interrupt-related APIs are provided by :file:`irq.h`:
|
||||
|
||||
* :c:macro:`IRQ_CONNECT()`
|
||||
* :c:macro:`IRQ_CONNECT`
|
||||
* :cpp:func:`irq_lock()`
|
||||
* :cpp:func:`irq_unlock()`
|
||||
* :cpp:func:`irq_enable()`
|
||||
|
|
|
@ -103,7 +103,7 @@ new pending alerts.
|
|||
k_alert_init(&my_alert, my_alert_handler, 10);
|
||||
|
||||
Alternatively, an alert can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_ALERT_DEFINE()`.
|
||||
by calling :c:macro:`K_ALERT_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above.
|
||||
|
||||
|
@ -234,6 +234,7 @@ APIs
|
|||
|
||||
The following alert APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_ALERT_DEFINE`
|
||||
* :cpp:func:`k_alert_init()`
|
||||
* :cpp:func:`k_alert_send()`
|
||||
* :cpp:func:`k_alert_recv()`
|
||||
|
|
|
@ -105,7 +105,7 @@ The following code defines and initializes a mutex.
|
|||
k_mutex_init(&my_mutex);
|
||||
|
||||
Alternatively, a mutex can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_MUTEX_DEFINE()`.
|
||||
by calling :c:macro:`K_MUTEX_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above.
|
||||
|
||||
|
@ -166,6 +166,7 @@ APIs
|
|||
|
||||
The following mutex APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_MUTEX_DEFINE`
|
||||
* :cpp:func:`k_mutex_init()`
|
||||
* :cpp:func:`k_mutex_lock()`
|
||||
* :cpp:func:`k_mutex_unlock()`
|
||||
|
|
|
@ -60,7 +60,7 @@ semaphore by setting its count to 0 and its limit to 1.
|
|||
k_sem_init(&my_sem, 0, 1);
|
||||
|
||||
Alternatively, a semaphore can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_SEM_DEFINE()`.
|
||||
by calling :c:macro:`K_SEM_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above.
|
||||
|
||||
|
@ -130,6 +130,7 @@ APIs
|
|||
|
||||
The following semaphore APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_SEM_DEFINE`
|
||||
* :cpp:func:`k_sem_init()`
|
||||
* :cpp:func:`k_sem_give()`
|
||||
* :cpp:func:`k_sem_take()`
|
||||
|
|
|
@ -169,7 +169,7 @@ The following code spawns a thread that starts immediately.
|
|||
MY_PRIORITY, 0, K_NO_WAIT);
|
||||
|
||||
Alternatively, a thread can be spawned at compile time by calling
|
||||
:c:macro:`K_THREAD_DEFINE()`. Observe that the macro defines
|
||||
:c:macro:`K_THREAD_DEFINE`. Observe that the macro defines
|
||||
the stack area and thread id variables automatically.
|
||||
|
||||
The following code has the same effect as the code segment above.
|
||||
|
@ -228,6 +228,7 @@ APIs
|
|||
|
||||
The following thread APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_THREAD_DEFINE`
|
||||
* :cpp:func:`k_thread_spawn()`
|
||||
* :cpp:func:`k_thread_cancel()`
|
||||
* :cpp:func:`k_thread_abort()`
|
||||
|
|
|
@ -112,7 +112,7 @@ The following code defines and initializes a timer.
|
|||
k_timer_init(&my_timer, my_expiry_function, NULL);
|
||||
|
||||
Alternatively, a timer can be defined and initialized at compile time
|
||||
by calling :c:macro:`K_TIMER_DEFINE()`.
|
||||
by calling :c:macro:`K_TIMER_DEFINE`.
|
||||
|
||||
The following code has the same effect as the code segment above.
|
||||
|
||||
|
@ -241,6 +241,7 @@ APIs
|
|||
|
||||
The following timer APIs are provided by :file:`kernel.h`:
|
||||
|
||||
* :c:macro:`K_TIMER_DEFINE`
|
||||
* :cpp:func:`k_timer_init()`
|
||||
* :cpp:func:`k_timer_start()`
|
||||
* :cpp:func:`k_timer_stop()`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue