0
mirror of https://github.com/torvalds/GuitarPedal.git synced 2026-08-19 05:33:46 +00:00
Files
Linus Torvalds 0c1b9c3db3 Split Software/ into the four things it actually was
'Software' was the directory everything that was not KiCad ended up in,
which stopped describing anything a while ago - Validation and the web
app are software too.  Worse, it put the shared parts inside the
firmware, where they read as the firmware's own.

They are not.  Effects/ has three consumers built from it: the firmware,
Validation's bench, and the web app's controls, all generated from the
same POT: comments by gen_effects.py.  Audio/ has two - the bench
compiles the same biquads, the same envelope followers and the same
single_sample(), which is the whole reason a measurement on a
workstation says anything about the pedal.  Neither belongs under
Firmware/, so neither is under it any more:

  Effects/    one file per effect
  Audio/      the DSP they are built from, and the audio loop
  Firmware/   the rest of what runs on the pedal, and the submodules
  WebMIDI/    the web app
  scripts/    what the build runs
  Validation/ unchanged
  Hardware/, Documentation/, Images/

CMakeLists.txt and the wrapper Makefile move to the top with them,
because the build now consumes four of those directories and generates
into a fifth.  board.local and build/ come along; MIDI_CC_MAP.md is
generated into Documentation/ rather than into the old Software/ root.

scripts/ goes with the build rather than staying under the firmware,
because six of the ten had nothing to do with the firmware: gen_effects.py
reads Effects/ and writes to three different places, pow2/log2/quarter_sine
generate Audio/'s tables, check-readme.py compares Effects/ against the
README, and server.py serves the web app.  Four of them are invoked from
Validation, which was reaching into Firmware/ for tooling - the same
burying this commit is undoing.  The four that really are about the
firmware are ELF checks the top-level build drives anyway, and a second
scripts directory would only be a second place to look.

C includes say "Audio/foo.h" and the generated map says
"Effects/bar.h", with the repository root on the include path for both
the firmware and the bench.  Spelling the directory out rather than
relying on a bare name is what keeps Audio/cycles.h shimmable: a quoted
include searches the including file's own directory first.

The submodules are renamed as well as moved.  git mv updates their paths
but leaves the section names, and 'Software/pico-sdk' surviving in
.gitmodules would be the word this commit removes, still load-bearing.
That meant the nested modules under pico-sdk too - six .git files
pointing into .git/modules/Software - which is why 'git submodule update
--init --recursive' is worth running once after pulling this.

Verified rather than assumed: a clean configure and build, make check
(failing only on the missing-eeprom case it already failed on),
check-effects, all four analysis pages reproducing every series and
drawing every chart, and a flash to the board that still measures a
routed reverb where it did before.

One latent bug fell out of it.  bench/coeff declared only quarter_sine.h
of the three generated math tables, and Audio/util.h includes pow2.h and
log2.h as well - so building that target with an empty gen/ could never
have worked.  'make bench' builds bench/bench first, which generates all
three, so it stayed hidden until this rebuilt everything from nothing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-08-11 13:48:26 -07:00

53 lines
2.2 KiB
C

#include "pico.h"
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#define CFG_TUD_ENABLED 1
#define CFG_TUD_AUDIO 1
#define CFG_TUD_MIDI 1
#define CFG_TUD_ENDPOINT0_SIZE 64
#define CFG_TUD_MIDI_RX_BUFSIZE 64
#define CFG_TUD_MIDI_TX_BUFSIZE 8192
#define CFG_TUD_MIDI_EP_BUFSIZE 64
//
// One sample more than nominal, and the extra one is the whole point.
//
// This is an asynchronous capture endpoint: the pedal samples on its own
// clock and the host frames on its own, and the two will never agree.
// The way that is supposed to work is that the device sends however many
// samples it actually has - 47, 48, 49 - and the host takes them.
//
// Sized at exactly 48 it can only ever send *fewer*, so a pedal running
// the tiniest bit fast has nowhere to put the surplus, the ring fills,
// and get_output_samples() throws away a chunk to catch up. Which is
// audible as a step in the waveform, several times a second.
//
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX (49 * 4 * 2)
//
// Three packets, and counted in the same samples the endpoint is.
//
// This is what the audio endpoint has to live on while core 0 is busy
// elsewhere. A long SysEx reply - the state dump the web app asks for
// when it connects is fifteen kilobytes - is written in one pass of the
// main loop, and usb_audio_task() is at the bottom of that loop, so the
// endpoint gets nothing until the reply is done.
//
// One dump costs nothing measurable at any depth. Two back to back
// cost about nine breaks in the stream at two packets and about six at
// three, measured five runs each - see Validation/test-audio.py.
//
// Counted from 49 rather than 48 because the endpoint is 49: written
// the other way this came out at 1.96 packets, which is a strange thing
// to have meant.
//
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ (49 * 4 * 2 * 3)
#define CFG_TUD_AUDIO_ENABLE_EP_IN (1)
#define CFG_TUD_AUDIO_FUNC_1_FORMAT_1_N_BYTES_PER_SAMPLE_TX (4)
#define CFG_TUD_AUDIO_FUNC_1_FORMAT_1_RESOLUTION_TX (32)
#define CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX (48 * 4 * 2)
#define CFG_TUD_AUDIO_FUNC_1_EP_OUT_SW_BUF_SZ (48 * 4 * 2 * 2)
#define CFG_TUD_AUDIO_ENABLE_EP_OUT (1)
#define CFG_TUD_AUDIO_FUNC_1_FORMAT_1_N_BYTES_PER_SAMPLE_RX (4)
#define CFG_TUD_AUDIO_FUNC_1_FORMAT_1_RESOLUTION_RX (32)