Skip to content

Commit

Permalink
doc: Enable Kernel Primer links to macro-type APIs
Browse files Browse the repository at this point in the history
Also adds a link to function-type API that was missing.

Change-Id: Ie671ad2f239cdca3ac1a2eb33248dfecfa251c79
Signed-off-by: Allan Stephens <[email protected]>
  • Loading branch information
ajstephens authored and Anas Nashif committed Nov 18, 2016
1 parent 5e892b7 commit 3acb1c9
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 20 deletions.
3 changes: 2 additions & 1 deletion doc/kernel_v2/data_passing/fifos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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()`
Expand Down
3 changes: 2 additions & 1 deletion doc/kernel_v2/data_passing/lifos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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()`
4 changes: 3 additions & 1 deletion doc/kernel_v2/data_passing/mailboxes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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()`
Expand Down
3 changes: 2 additions & 1 deletion doc/kernel_v2/data_passing/message_queues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()`
Expand Down
3 changes: 2 additions & 1 deletion doc/kernel_v2/data_passing/pipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()`
Expand Down
3 changes: 2 additions & 1 deletion doc/kernel_v2/data_passing/stacks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()`
3 changes: 2 additions & 1 deletion doc/kernel_v2/memory/pools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()`
3 changes: 2 additions & 1 deletion doc/kernel_v2/memory/slabs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()`
Expand Down
8 changes: 4 additions & 4 deletions doc/kernel_v2/other/atomic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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()`
Expand Down
2 changes: 1 addition & 1 deletion doc/kernel_v2/other/float.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/kernel_v2/other/interrupts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down Expand Up @@ -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()`
Expand Down
3 changes: 2 additions & 1 deletion doc/kernel_v2/synchronization/alerts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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()`
3 changes: 2 additions & 1 deletion doc/kernel_v2/synchronization/mutexes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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()`
3 changes: 2 additions & 1 deletion doc/kernel_v2/synchronization/semaphores.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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()`
Expand Down
3 changes: 2 additions & 1 deletion doc/kernel_v2/threads/lifecycle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()`
Expand Down
3 changes: 2 additions & 1 deletion doc/kernel_v2/timing/timers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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()`
Expand Down

0 comments on commit 3acb1c9

Please sign in to comment.