Add updatable ADAU1701 program via flash partition and HTTP API.
Decouple the SigmaStudio RAM download from compiled-in adau1701_program.c: DRAD v1 blobs in the dsp partition with embedded fallback, POST /api/dsp/program, and host-tested blob parse/serialize helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -121,7 +121,7 @@ the DSP program and writes it into RAM after each reset.
|
||||
\node[step, fill=black!6, below=of rst] (i2c)
|
||||
{Create I\textsuperscript{2}C master @ 100\,kHz, address 0x34};
|
||||
\node[step, fill=black!8, below=of i2c] (dl)
|
||||
{\texttt{default\_download\_IC\_1()} --- control, program, param RAM};
|
||||
{Replay \texttt{DspProgram} from flash or embedded export};
|
||||
\node[step, fill=black!6, below=of dl] (ready)
|
||||
{\texttt{Adau1701Driver::isBooted()} = true};
|
||||
\node[step, fill=black!10, below=of ready] (prof)
|
||||
@@ -135,7 +135,10 @@ the DSP program and writes it into RAM after each reset.
|
||||
\end{figure}
|
||||
|
||||
\texttt{SIGMA\_WRITE\_REGISTER\_BLOCK} streams each write in 64-byte I\textsuperscript{2}C
|
||||
chunks. After download, \texttt{loadAndApply()} restores the saved
|
||||
chunks (payloads may exceed 255 bytes). The active script comes from the
|
||||
\texttt{dsp} data partition when a valid \texttt{DRAD} blob is present; otherwise
|
||||
the embedded SigmaStudio export is used (Section~\ref{sec:api-dsp-program}).
|
||||
After download, \texttt{loadAndApply()} restores the saved
|
||||
\texttt{core::AudioProfile} from NVS (or factory defaults) so user settings
|
||||
survive power cycles without re-writing the whole program.
|
||||
|
||||
|
||||
@@ -225,6 +225,26 @@ the ADAU1701 and writes NVS key \texttt{audio\_profile\_json}.
|
||||
HTTP status: \textbf{200 OK}; \textbf{400} for parse/validation failures;
|
||||
\textbf{500} when safeload or NVS persistence fails.
|
||||
|
||||
\subsection{\texttt{POST /api/dsp/program}}
|
||||
\label{sec:api-dsp-program}
|
||||
|
||||
Uploads a framed ADAU1701 RAM download blob (\texttt{DRAD} v1, see
|
||||
\texttt{core::parseDspProgramBlob()}). The body is raw bytes
|
||||
(\texttt{application/octet-stream} or any content type). On success the blob
|
||||
is written to the \texttt{dsp} flash partition and the device reboots; the
|
||||
next boot replays the new program before \texttt{loadAndApply()}.
|
||||
|
||||
\begin{drnote}[Success response]
|
||||
\begin{drcode}[JSON]
|
||||
{"status":"stored","reboot_sec":3}
|
||||
\end{drcode}
|
||||
\end{drnote}
|
||||
|
||||
HTTP status: \textbf{200 OK}; \textbf{400} with \texttt{\{"error":"..."\}}
|
||||
for invalid/truncated/CRC failures; \textbf{413} when the body exceeds
|
||||
200\,KiB; \textbf{500} on flash write failure. Pack blobs with
|
||||
\texttt{tools/pack\_dsp\_program.py} or \texttt{core::serializeDspProgramBlob()}.
|
||||
|
||||
\subsection{\texttt{POST /api/audio/reset}}
|
||||
\label{sec:api-audio-reset}
|
||||
|
||||
|
||||
@@ -183,6 +183,30 @@ audio control to safeload I\textsuperscript{2}C transactions without exposing
|
||||
parameter RAM addresses to services (Chapter~\ref{ch:adau1701},
|
||||
Section~\ref{sec:adau1701-stack}).
|
||||
|
||||
\section{RegisterWrite}\label{cls:RegisterWrite}
|
||||
One SigmaStudio \texttt{SIGMA\_WRITE\_REGISTER\_BLOCK} step: 16-bit address
|
||||
plus payload bytes. Aggregated by \texttt{DspProgram}.
|
||||
|
||||
\section{DspProgram}\label{cls:DspProgram}
|
||||
Ordered ADAU1701 RAM download script (pure domain). Parsed from a framed
|
||||
\texttt{DRAD} flash blob or built by \texttt{EmbeddedDspProgramSource}.
|
||||
|
||||
\section{IDspProgramSource}\label{cls:IDspProgramSource}
|
||||
Port supplying \texttt{DspProgram} to \texttt{Adau1701Driver::boot()}.
|
||||
Implementations: flash partition, embedded export, and fallback composite.
|
||||
|
||||
\section{EmbeddedDspProgramSource}\label{cls:EmbeddedDspProgramSource}
|
||||
Builds the factory \texttt{DspProgram} from \texttt{DigiRadio\_IC\_1.h}
|
||||
(five writes matching \texttt{default\_download\_IC\_1()}).
|
||||
|
||||
\section{FlashDspProgramSource}\label{cls:FlashDspProgramSource}
|
||||
Reads and parses the \texttt{dsp} flash partition; \texttt{storeBlob()} erases
|
||||
and writes a validated blob from \texttt{POST /api/dsp/program}.
|
||||
|
||||
\section{FallbackDspProgramSource}\label{cls:FallbackDspProgramSource}
|
||||
Tries \texttt{FlashDspProgramSource} first, then
|
||||
\texttt{EmbeddedDspProgramSource} when the partition is empty or invalid.
|
||||
|
||||
% ------------------------------------------------------------------
|
||||
% Domain core — audio (Slice 5)
|
||||
% ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user