Skip to content

Conversation

sipke
Copy link

@sipke sipke commented Sep 8, 2025

Correct the vring code snippet generation by doxygen

the code snippet was missing a @code, @encode block so not generating the doxygen documentation correctly, so add @code{.c} block for highlighted c code of the vring struct.

Will address OpenAMP/openamp-docs#63 once git submodules updated in openamp-docs

the code snippet was missing a @code, @encode block so not generating
the doxygen documentation correctly, so add @code{.c} block for
highlighted c code of the vring struct.

Signed-off-by: Sipke Vriend <[email protected]>
@arnopo
Copy link
Collaborator

arnopo commented Sep 9, 2025

If I understand correctly, the fact that the structure is described twice leads to an issue in the code generation, right?
What about replacing the struct with an ASCII array to explain the memory mapping?

@sipke
Copy link
Author

sipke commented Sep 15, 2025

If I understand your first question right, not exactly. Any "code snippet or example" within doxygen comment needs the @code block to tell doxygen to render a code snippet. That was missing, so this PR adds it.
I've temporarily rendered it here to demonstrate what it becomes with the code block: https://sipke-openamp-docs.readthedocs.io/en/sv-develop/docs/data_structures_content.html#shared-virtqueue-structure
As you can see there is a formatted code block inside the documentation now.
If you've previously viewed the sv-develop branch, you have to force load the web page as previous cached page showed first.

@sipke
Copy link
Author

sipke commented Sep 15, 2025

For your second question, I presume you mean replace the code block with a Markdown table https://www.doxygen.nl/manual/markdown.html#md_tables.
This should be possible if the intent is to replace the "code snippet example", rather than render it within the documentation.

@arnopo
Copy link
Collaborator

arnopo commented Sep 16, 2025

My concern is that we should not have c code in comments. So instead of introducing @code tag I would prefer that we remove it.

We could have something like this instead ( probably to be improved)

vring memory mapping ( n represent the number of descriptor)

size           | type                         |  structure 
-------------- | --------------------------|------------------------------------------------------------------------ 
16 * n       |  struct vring_desc |  actual descriptors (16 bytes each)
 4 + 2 * n  | struct vring_avail  | available descriptors  table
 2               | u16                          | used_event_idx
 x               | x                               | padding for memory alignment specified by users
 4 + 8 * n  | struct vring_used  | used descriptors table
 2               | u16                          | avail_event_idx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants