Update SGPIO code documentation.

This commit is contained in:
Martin Ling
2024-12-04 16:10:07 +00:00
parent b178c66e6e
commit 8b5a10c26c

View File

@ -134,19 +134,14 @@ within each mode's own loop.
At startup, the main routine sets up registers and memory, then falls through At startup, the main routine sets up registers and memory, then falls through
to the idle loop. to the idle loop.
The idle loop waits for a mode to be set, then jumps to that mode's start The idle loop waits for a mode to be set, then jumps to that mode's loop.
label.
Code following the start label is executed only on a transition from IDLE. It
is at this point that the buffer statistics are reset.
Each mode's start code then falls through to its loop label.
The first step in each loop is to wait for an SGPIO interrupt and clear it, The first step in each loop is to wait for an SGPIO interrupt and clear it,
which is implemented by the await_sgpio macro. which is implemented by the await_sgpio macro.
Then, the mode setting is loaded from memory. If the M4 has reset the mode to Then, the requested mode is loaded from memory. If the M4 has requested a
idle, control jumps back to the idle loop after handling any cleanup needed. mode change, control jumps back to the idle loop after handling any cleanup
needed.
Next, any SGPIO operations are carried out. For RX and TX, this begins with Next, any SGPIO operations are carried out. For RX and TX, this begins with
calculating the buffer margin, and branching if there is a shortfall. Then calculating the buffer margin, and branching if there is a shortfall. Then
@ -161,8 +156,7 @@ multiple load/stores is used to reorder the data in each chunk.
After completing SGPIO operations, counters are updated and the threshold After completing SGPIO operations, counters are updated and the threshold
setting is checked. If the byte count has reached the threshold, the next setting is checked. If the byte count has reached the threshold, the next
mode is set and a jump is made directly to the corresponding loop label. mode is set and a jump is made directly to the corresponding loop label.
Code at the start label of the new mode is not executed, so stats and Stats and counters are maintained across a sequence of TX/RX/WAIT operations.
counters are maintained across a sequence of TX/RX/WAIT operations.
When a shortfall occurs, a branch is taken to a separate handler routine, When a shortfall occurs, a branch is taken to a separate handler routine,
which branches back to the mode's normal loop when complete. which branches back to the mode's normal loop when complete.