Skip to content

Generated device driver docs #30104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ file(GLOB_RECURSE DOXY_SOURCES
${ZEPHYR_BASE}/lib/libc/*.[c,h,S]
${ZEPHYR_BASE}/subsys/testsuite/ztest/include/*.[h,c,S]
${ZEPHYR_BASE}/tests/*.[h,c,S]
${ZEPHYR_BASE}/drivers/*.[c,h,S]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worries me a little: until now headers that were private to a driver subsystem would never be accessed outside that subsystem, so there was little concern about ensuring public identifiers are globally unique.

Now MISRA apparently wants every identifier anywhere in the program to be unique, though that's not really feasible, and maybe this isn't going to bite us too bad, but it leaves me nervous.

)
# For debug. Also find generated list in doc/_build/(build.ninja|CMakeFiles/)
# message("DOXY_SOURCES= " ${DOXY_SOURCES})
Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
'zephyr.application',
'zephyr.html_redirects',
'only.eager_only',
'zephyr.dtcompatible-role',
'zephyr.link-roles',
'sphinx_tabs.tabs'
]
Expand Down
44 changes: 44 additions & 0 deletions doc/extensions/zephyr/dtcompatible-role.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0

"""
A Sphinx extension for documenting devicetree content. It adds a role and a
directive with the same name, 'dtcompatible'.

:dtcompatible:`vnd,foo`

This role can be used inline to make a reference to the generated
documentation for a devicetree
compatible given as argument.

For example, :dtcompatible:`vnd,foo` would create a reference to the
generated documentation page for the devicetree binding handling
compatible "vnd,foo".

There may be more than page for a single compatible. For example,
that happens if a binding behaves differently depending on the bus the
node is on. If that occurs, the reference points at a "disambiguation"
page which links out to all the possibilities, similarly to how Wikipedia
disambiguation pages work.

The Zephyr documentation uses the standard :option: role to refer
to Kconfig options. The :dtcompatible: option is like that, except
using its own role to avoid using one that already has a standard meaning.
(The :option: role is meant for documenting options to command-line programs,
not Kconfig symbols.)

.. dtcompatible:: vnd,foo

This directive marks the page where the :dtcompatible: role link goes.
Users should not use it directly. The generated bindings documentation will
define these in the right places.
"""

def setup(app):
app.add_crossref_type('dtcompatible', 'dtcompatible')

return {
'parallel_read_safe': True,
'parallel_write_safe': True,
}
19 changes: 19 additions & 0 deletions doc/extensions/zephyr/link-roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@

# based on http://protips.readthedocs.io/link-roles.html

"""
This file contains Sphinx extensions for the following Zephyr-specific
documentation roles:

:zephyr_file:
Create a link to a file within the zephyr repository tree.
The link is to an HTML view of the file as a blob on a Git forge.

The version displayed corresponds to the current tag if
HEAD points at a tag, or the 'master' branch otherwise.

For example, :zephyr_file:`doc/extensions/zephyr/link-roles.py`
creates a link to this file on GitHub by default.

:zephyr_raw:
Like ``:zephyr_file:``, but for "raw" output, rather than
the usual fancy UI for viewing a git blob's contents.
"""

from __future__ import print_function
from __future__ import unicode_literals
import re
Expand Down
5 changes: 5 additions & 0 deletions doc/guides/dts/bindings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ dt-schema tools used by the Linux kernel). With one exception in
:ref:`dt-inferred-bindings` the build system uses bindings when generating
code for :ref:`dt-from-c`.

.. note::

See the :ref:`devicetree_binding_index` for information on existing
bindings.

.. _dt-binding-compat:

Mapping nodes to bindings
Expand Down
Loading