docs: General improvements

Import aiohttp and asyncio only when needed.
Better warning for unknown signals, params.
Use pattern matching in regmap parsing.
Fixup bundle count.
Add lists clarification to guidelines.
Enforce #1229 rules.
Clean-up Makefile.
Use non-breaking hyphen.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
main
Jorge Marques 2023-11-21 09:56:25 -03:00 committed by Jorge Marques
parent 39b2a2b8bb
commit 9f4d5ff71f
8 changed files with 78 additions and 102 deletions

View File

@ -5,72 +5,9 @@ SOURCEDIR = .
BUILDDIR = _build BUILDDIR = _build
help: help:
@echo "For help about the container instance, do \`make container-help\`"
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile .PHONY: help Makefile
%: Makefile %: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
#------------------------------------------------------------------------------
# Container commands
#------------------------------------------------------------------------------
CONTAINER_IMG ?=hdl-docs
CONTAINER_ENGINE =podman
CONTAINER_REPO =${CONTAINER_IMG}
CONTAINER_IMAGE =${CONTAINER_IMG}_build
CONTAINER_VERSION ?=0.1
CONTAINER_SHELL ?=bash -l
CONTAINER_RUN_EXTRA ?=
CONTAINER_FORMAT =$(if $(filter podman,${CONTAINER_ENGINE}),--format docker,)
IF_CONTAINER_RUNS=$(shell ${CONTAINER_ENFINE} container inspect -f '{{.State.Running}}' ${CONTAINER_IMAGE} 2>/dev/null)
CONTAINER_RUN_PARAMS = -it --rm --name=${CONTAINER_IMG} \
--name=${CONTAINER_IMAGE} \
--workdir=/${CONTAINER_IMG} \
--mount type=bind,source=${CURDIR}/../,target=/${CONTAINER_IMG} \
${CONTAINER_RUN_EXTRA} \
${CONTAINER_REPO}/${CONTAINER_IMAGE}:${CONTAINER_VERSION}
container-login:
@if [ "${IF_CONTAINER_RUNS}" != "true" ]; then \
${CONTAINER_ENGINE} run ${CONTAINER_RUN_PARAMS} \
${CONTAINER_SHELL}; \
else \
${CONTAINER_ENGINE} exec -it ${CONTAINER_IMAGE} \
${CONTAINER_SHELL}; \
fi
container-build:
@printf "Building container image\n"
@${CONTAINER_ENGINE} build --no-cache=true ${CONTAINER_FORMAT} -t ${CONTAINER_REPO}/${CONTAINER_IMAGE}:${CONTAINER_VERSION} -f ./Containerfile .
container-html:
@${CONTAINER_ENGINE} run ${CONTAINER_RUN_PARAMS} ${CONTAINER_SHELL} -c \
"source /.venv/bin/activate ; cd docs ; make html"
container-pdf:
@${CONTAINER_ENGINE} run ${CONTAINER_RUN_PARAMS} ${CONTAINER_SHELL} -c \
"source /.venv/bin/activate ; cd docs ; make latexpdf"
container-clean:
@${CONTAINER_ENGINE} run ${CONTAINER_RUN_PARAMS} ${CONTAINER_SHELL} -c \
"source /.venv/bin/activate ; cd docs ; make clean"
.PHONY: container-build container-login container-html container-pdf container-clean
container-help:
@printf "The container commands allow to use a container to build the documentation.\n"
@printf "Both podman and docker are supported, change the CONTAINER_ENGINE variable to select which to use.\n\n"
@printf "Usage: make [options]\n"
@printf "\
Options:\n\
container-build Build the container image with dependencies (do once).\n\
container-login Access the container shell.\n\
container-html Build html documentation.\n\
container-latexpdf Build pdf documentation.\n\
\n"

View File

@ -4,6 +4,8 @@
############################################################################### ###############################################################################
import os.path import os.path
import contextlib
import re
from docutils import nodes from docutils import nodes
from docutils.statemachine import ViewList from docutils.statemachine import ViewList
from docutils.parsers.rst import Directive, directives from docutils.parsers.rst import Directive, directives
@ -13,7 +15,6 @@ from lxml import etree
from adi_hdl_static import hdl_strings from adi_hdl_static import hdl_strings
from uuid import uuid4 from uuid import uuid4
from hashlib import sha1 from hashlib import sha1
import contextlib
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -340,7 +341,7 @@ class directive_interfaces(directive_base):
for tag in description: for tag in description:
if tag not in bs and tag not in pr: if tag not in bs and tag not in pr:
logger.warning(f"Signal {tag} defined in the directive does not exist in the source code!") logger.warning(f"Signal {tag} defined in the directive does not exist in the IP-XACT (component.xml)!")
return subnode return subnode
@ -523,7 +524,7 @@ class directive_parameters(directive_base):
for tag in description: for tag in description:
if tag not in parameter: if tag not in parameter:
logger.warning(f"{tag} defined in the directive does not exist in the source code!") logger.warning(f"{tag} defined in the directive does not exist in the IP-XACT (component.xml)!")
return table return table
@ -893,13 +894,17 @@ def manage_hdl_regmaps(env, docnames):
if not os.path.isfile(f): if not os.path.isfile(f):
del rm[lib] del rm[lib]
# Inconsistent naming convention, need to parse all in directory. # Inconsistent naming convention, need to parse all in directory.
files = [] regmaps = []
for (dirpath, dirnames, filenames) in os.walk("regmap"): for (dirpath, dirnames, filenames) in os.walk("regmap"):
files.extend(filenames) for file in filenames:
break m = re.search("adi_regmap_(\w+)\.txt", file)
regmaps = [f.replace('adi_regmap_','').replace('.txt','') for f in files] if not bool(m):
for reg_name in regmaps: continue
ctime = os.path.getctime(f"regmap/adi_regmap_{reg_name}.txt")
reg_name = m.group(1)
regmaps.extend(reg_name)
ctime = os.path.getctime(f"regmap/{file}")
if reg_name in rm and rm[reg_name]['ctime'] < ctime: if reg_name in rm and rm[reg_name]['ctime'] < ctime:
for o in rm[reg_name]['owners']: for o in rm[reg_name]['owners']:
if o not in docnames: if o not in docnames:

View File

@ -3,11 +3,9 @@
### SPDX short identifier: ADIBSD ### SPDX short identifier: ADIBSD
############################################################################### ###############################################################################
import subprocess
from docutils import nodes from docutils import nodes
from sphinx.util import logging from sphinx.util import logging
import subprocess
import asyncio
import aiohttp
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
validate_links_user_agent = 'Status resolver (Python/Sphinx)' validate_links_user_agent = 'Status resolver (Python/Sphinx)'
@ -151,6 +149,10 @@ def validate_links(app, env):
logger.info(f"Skipping {len(env.links)} URLs checks-ups. Set validate_links to True to enable this.") logger.info(f"Skipping {len(env.links)} URLs checks-ups. Set validate_links to True to enable this.")
return return
global asyncio, aiohttp
import asyncio
import aiohttp
asyncio.run( asyncio.run(
async_validate_links(app, env) async_validate_links(app, env)
) )
@ -177,7 +179,7 @@ async def async_validate_links(app, env):
step = 25 step = 25
links = list(env.links) links = list(env.links)
leng = total%step+2 if total%step != 0 else total%step+1 leng = int(total/step)+1 if total%step != 0 else int(total/step)
for i in range(0, leng): for i in range(0, leng):
cur = i*step cur = i*step
end = total if (i+1)*step > total else (i+1)*step end = total if (i+1)*step > total else (i+1)*step

View File

@ -591,7 +591,7 @@ the following order:
* - Size * - Size
- Name - Name
- Description - Description
* - 32-bit * - 32bit
- flags - flags
- | This field includes 2 control bits: - | This field includes 2 control bits:
@ -600,25 +600,25 @@ the following order:
next DMA descriptor pointed to by ``next_sg_addr`` will be loaded. next DMA descriptor pointed to by ``next_sg_addr`` will be loaded.
* bit1: if set, an end-of-transfer interrupt will be raised after the * bit1: if set, an end-of-transfer interrupt will be raised after the
memory segment pointed to by this descriptor has been transferred. memory segment pointed to by this descriptor has been transferred.
* - 32-bit * - 32bit
- id - id
- This field corresponds to an identifier of the descriptor. - This field corresponds to an identifier of the descriptor.
* - 64-bit * - 64bit
- dest_addr - dest_addr
- This field contains the destination address of the transfer. - This field contains the destination address of the transfer.
* - 64-bit * - 64bit
- src_addr - src_addr
- This field contains the source address of the transfer. - This field contains the source address of the transfer.
* - 64-bit * - 64bit
- next_sg_addr - next_sg_addr
- This field contains the address of the next descriptor. - This field contains the address of the next descriptor.
* - 32-bit * - 32bit
- y_len - y_len
- This field contains the number of rows to transfer, minus one. - This field contains the number of rows to transfer, minus one.
* - 32-bit * - 32bit
- x_len - x_len
- This field contains the number of bytes to transfer, minus one. - This field contains the number of bytes to transfer, minus one.
* - 32-bit * - 32bit
- src_stride - src_stride
- This field contains the number of bytes between the start of one row and - This field contains the number of bytes between the start of one row and
the next row for the source address. the next row for the source address.

View File

@ -87,19 +87,22 @@ Block design
Block diagram Block diagram
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\**\* MUST HAVE \**\* The data path and clock domains are depicted in
the below diagram:
\*\* TIP: upload the .svg file for the diagram to have high quality \*\*
If the project has multiple ways of configuration, then make subsections to If the project has multiple ways of configuration, then make subsections to
this section and show the default configuration and some other popular modes. this section and show the default configuration and some other popular modes.
\**\* KEEP THIS PARAGRAPH \**\*
The data path and clock domains are depicted in the below diagram:
.. image:: ../ad9783_ebz/ad9783_zcu102_block_diagram.svg .. image:: ../ad9783_ebz/ad9783_zcu102_block_diagram.svg
:width: 800 :width: 800
:align: center :align: center
:alt: AD9783-EBZ/ZCU102 block diagram :alt: AD9783-EBZ/ZCU102 block diagram
\*\* MUST: Use SVG format for the diagram \*\*
\*\* TIP: Block diagrams should contain subtitles only if there are at least two
different diagrams \*\*
Configuration modes Configuration modes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -146,8 +149,7 @@ Clock scheme
- SYSREF clocks are LVDS - SYSREF clocks are LVDS
- ADCCLK and REFCLK are LVPECL - ADCCLK and REFCLK are LVPECL
\*\* ADD IMAGE IF APPLIES! TIP: upload the .svg file for the diagram to have \*\* ADD IMAGE IF APPLIES! MUST: Use SVG format \*\*
high quality \*\*
**\*DESCRIBE OTHER COMPONENTS FROM THE PROJECT, EX: SYNCHRONA**\ \* **\*DESCRIBE OTHER COMPONENTS FROM THE PROJECT, EX: SYNCHRONA**\ \*
@ -185,6 +187,7 @@ chains are merged together and transferred to the DDR with a single DMA.
CPU/Memory interconnects addresses CPU/Memory interconnects addresses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\**\* KEEP THIS PARAGRAPH \**\*
The addresses are dependent on the architecture of the FPGA, having an offset The addresses are dependent on the architecture of the FPGA, having an offset
added to the base address from HDL (see more at :ref:`architecture`). added to the base address from HDL (see more at :ref:`architecture`).
@ -197,6 +200,8 @@ some IPs are instatiated and some are not.
Check-out the table below to find out the conditions. Check-out the table below to find out the conditions.
\*\* MUST: Hexadecimal addresses are written in caps and separated by an underscore. \*\*
==================== ================================= =============== =========== ============ ==================== ================================= =============== =========== ============
Instance Depends on parameter Zynq/Microblaze ZynqMP Versal Instance Depends on parameter Zynq/Microblaze ZynqMP Versal
==================== ================================= =============== =========== ============ ==================== ================================= =============== =========== ============
@ -293,6 +298,9 @@ GPIOs
- 117:86 - 117:86
- 141:110 - 141:110
\*\* MUST: GPIOs should be listed in descending order and should have the number
of bits specified next to their name \*\*
Interrupts Interrupts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -1,4 +1,5 @@
sphinx sphinx
regex
lxml lxml
furo furo
wavedrom wavedrom

View File

@ -60,9 +60,6 @@ table.regmap {
table.regmap .caption-text{ table.regmap .caption-text{
font-size: 1rem; font-size: 1rem;
} }
td {
min-width: 4em;
}
th, td.type { th, td.type {
white-space: nowrap; white-space: nowrap;
} }

View File

@ -128,6 +128,32 @@ an option, you shall remove it and export in the *grid* table format.
Now you only have to adjust the widths and give the final touches, like using Now you only have to adjust the widths and give the final touches, like using
the correct directives and roles. the correct directives and roles.
Lists
--------------------------------------------------------------------------------
Unordered lists use ``*`` or ``-`` and ordered lists ``#.``.
Child items must be aligned with the first letter of the parent item, that means,
2 spaces for unordered list and 3 spaces for ordered lists, for example:
.. code-block:: rst
#. Parent ordered item.
* Child unordeded item.
#. Child ordered item.
#. Child ordered item.
Renders as:
#. Parent numbered item.
* Child unordered item.
#. Child ordered item.
#. Child ordered item.
Code Code
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------