-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
mbolivar-nordic
wants to merge
11
commits into
zephyrproject-rtos:master
from
mbolivar-nordic:dt-driver-docs
Closed
Generated device driver docs #30104
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
97111d0
doc: dts: add link from bindings guide to bindings index
mbolivar-nordic 4e1d179
scripts: dts: gen_defines: don't include descriptions
mbolivar-nordic 6c289c0
doc: add @dtcompatible to doxygen ALIASES
mbolivar-nordic 358b0f0
[wip] doc: add some more macros to PREDEFINED
mbolivar-nordic 34a4713
doc: add docstring to link-roles.py
mbolivar-nordic 700206d
doc: add new :dtcompatible: role / directive
mbolivar-nordic 799644a
doc: add drivers subdirectories to doxygen
mbolivar-nordic 2235d39
doc: add @zephyrdriver to doxygen ALIASES
mbolivar-nordic c6d8ff4
[wip] dts: bindings: improve documentation for Nordic IPs
mbolivar-nordic 383c3ea
[wip] drivers: add doxygen for Nordic peripheral drivers
mbolivar-nordic 65bc4f4
[wip] doc: add driver index
mbolivar-nordic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.. _device_drivers: | ||
|
||
Device Drivers | ||
############## | ||
|
||
This page is an index of device drivers. Each device driver implements a Zephyr | ||
:ref:`API <api_overview>`. Device drivers are responsible for creating the | ||
:c:struct:`device` structures at the heart of Zephyr's :ref:`device and driver | ||
model <device_model_api>`. | ||
|
||
To enable a device driver -- i.e. compile and link the driver source code into | ||
your Zephyr :ref:`application <application>` -- you will typically need to: | ||
|
||
- enable the driver using :ref:`Kconfig <kconfig>` | ||
- configure one or more devices using :ref:`devicetree <dt-guide>` | ||
|
||
In order to use the device driver, you will need a pointer to a ``struct | ||
device`` created by the driver source. This is done with the | ||
:c:func:`device_get_binding` function, which requires the name of the device. | ||
For help getting a pointer to a device configured in the devicetree, see | ||
:ref:`dt-get-device`. | ||
|
||
.. Note: there's nothing else in this directory because the toctree is pulling | ||
in files created by gen_driver_rest.py. | ||
|
||
.. TODO: figure out how to glob this; "*/index.rst" didn't work with plain :glob: | ||
|
||
.. toctree:: | ||
|
||
adc/index.rst | ||
clock_control/index.rst | ||
counter/index.rst | ||
entropy/index.rst | ||
flash/index.rst | ||
gpio/index.rst | ||
hwinfo/index.rst | ||
i2c/index.rst | ||
ipm/index.rst | ||
pwm/index.rst | ||
sensor/index.rst | ||
serial/index.rst | ||
spi/index.rst | ||
usb/index.rst | ||
watchdog/index.rst |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.