Skip to main content
Glama
README.md
# Pioneer DJ TORAIZ SP-16 — Clean-Room Hardware & Firmware Atlas (`sp16-atlas`)

[![Code License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/labestiaroot/sp16-atlas/blob/main/LICENSE)
[![Docs License: CC BY-SA 4.0](https://img.shields.io/badge/Docs-CC--BY--SA--4.0-lightgrey.svg)](https://github.com/labestiaroot/sp16-atlas/blob/main/LICENSE-DOCS)
[![Node.js >= 20](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg)](https://nodejs.org/)
[![Zero Dependencies](https://img.shields.io/badge/dependencies-0-success.svg)](#)
[![Clean-Room](https://img.shields.io/badge/Clean--Room-INV--FW--03-informational.svg)](#clean-room--legal-notice-inv-fw-03)

**Live Documentation Portal:** [https://labestiaroot.github.io/sp16-atlas/](https://labestiaroot.github.io/sp16-atlas/)

**`sp16-atlas`** is a clean-room, zero-dependency Node.js (`>= 20.0.0`) toolkit, JavaScript SDK, CLI, **Model Context Protocol (`MCP`)** server, **Agent Skill (`SKILL.md`)**, and **Megasonda** C11/POSIX diagnostic reference for the **Pioneer DJ TORAIZ SP-16** (`TSP-16`, NXP `i.MX6Quad`, stock firmware `v1.60` / `Rev.6550`, `Linux 3.0.101`).

---

## Dual-Mode Architecture (`Lite < 2 MB` + `BYO-UPD`)

| Mode | Footprint | Included Capabilities | Clean-Room Guarantee (`INV-FW-03`) |
| :--- | :---: | :--- | :--- |
| **Mode 1: Lite Out-of-the-Box** | **`< 2 MB`** | Bundled `3` JSON hardware catalogs (`QRT1001` 72-page schematic catalog, `Megasonda` live hardware overlay, `136`-node interconnection graph), full canonical English Knowledge Base (`docs/`), safety preflight guardrails (`H-05`, `INV-MS-BL`, `INV-MS-WDG`), `.UPD` header/CRC32 inspection, CLI, JS SDK, MCP server (`5` tools + `5` resources), and `SKILL.md`. | **0** proprietary binaries, **0** decompiled dumps, **0** `dm-crypt` key material, **0** external `npm` dependencies. |
| **Mode 2: Full Corpus (`BYO-UPD`)** | Local (`SP16_ATLAS_CORPUS_DIR`) | Point `SP16_ATLAS_CORPUS_DIR` (or `--corpus-dir <path>`) to a corpus locally hydrated from your own legally owned `TORAIZSP16.UPD` (`v1.60`) to unlock function lookups, xrefs, string queries, and `skin16` layout queries via `sp16-atlas corpus` and `sp16_corpus_query`. | Key buffers are zeroized in volatile RAM and never written to the corpus or repository. |

---

## Quickstart

> **Full BYO-UPD Decryption, Disassembly & Hydration Guide:** See **[`USAGE.md`](https://github.com/labestiaroot/sp16-atlas/blob/main/USAGE.md)** (`docs/05-sdk-cli-mcp-and-agent-guide/byo-upd-decompilation-howto.md` · **[Web Docs](https://labestiaroot.github.io/sp16-atlas/05-sdk-cli-mcp-and-agent-guide/byo-upd-decompilation-howto/)**).

### 1. Run via `npx` (Zero Install)

```sh
npx -y github:labestiaroot/sp16-atlas summary --json
npx -y github:labestiaroot/sp16-atlas hw pcbs --json
npx -y github:labestiaroot/sp16-atlas kb search "AK5386VT" --json
npx -y github:labestiaroot/sp16-atlas safety-check --code 'int fd = open("/dev/gpiodrv", O_RDONLY); read(fd, &val, 93);' --lang c --json
```

### 2. CLI Commands (`sp16-atlas`)

```sh
npm install -g github:labestiaroot/sp16-atlas

sp16-atlas summary --json
sp16-atlas hw <summary|pcbs|bom|buses|prophet6|test_mode|live_limits|errata> --json
sp16-atlas kb list --json
sp16-atlas kb search "<query>" --limit 10 --json
sp16-atlas kb read "01-hardware-protocols/audio-codecs-alsa.md" --json
sp16-atlas safety-check --code 'int fd = open("/dev/gpiodrv", O_RDONLY); read(fd, &val, 93);' --lang c --json
sp16-atlas upd inspect --file ./TORAIZSP16.UPD --json
sp16-atlas corpus summary --json
sp16-atlas mcp
```

Deterministic exit codes across all CLI subcommands: `0` (success), `2` (invalid argument/schema), `3` (path traversal / `INV-FW-03` violation / missing index / I/O), `4` (not found), `5` (integrity failure).

### 3. JavaScript SDK (`require` / `import`)

```js
const path = require("node:path");
const atlas = require("sp16-atlas");

const docsDir = path.join(__dirname, "docs");
const dataDir = path.join(__dirname, "data");

const docs = atlas.listKbDocs(docsDir);
const hits = atlas.searchKb(docsDir, "DSX1128", { limit: 5 });
const doc = atlas.readKbDoc(docsDir, "01-hardware-protocols/touchscreen-and-display.md");

const errata = atlas.queryHardwareCatalog(dataDir, { domain: "errata" });
const preflight = atlas.analyzeHardwareSafety({
  code: 'int fd = open("/dev/gpiodrv", O_RDONLY); read(fd, &val, 93);',
  language: "c"
});
// -> { ok: true, safe: false, verdict: "BLOCK", summary: { criticalCount: 1, highCount: 0, mediumCount: 0, totalFindings: 1 }, findings: [{ id: "H-05", ... }] }
```

### 4. MCP Server Configuration (`stdio` JSON-RPC 2.0)

Add to `.mcp.json`, `.cursor/mcp.json`, or Antigravity `mcp_config.json` (supports both `NDJSON` and `Content-Length` framing with zero logging on `stdout`):

```json
{
  "mcpServers": {
    "sp16-atlas": {
      "command": "npx",
      "args": ["-y", "github:labestiaroot/sp16-atlas", "mcp"],
      "env": {
        "SP16_ATLAS_CORPUS_DIR": ""
      }
    }
  }
}
```

**Exposed MCP Tools (`5`):** `sp16_vault_search`, `sp16_vault_read`, `sp16_hardware_query`, `sp16_safety_preflight`, `sp16_corpus_query`.  
**Exposed MCP Resources (`5`):** `sp16://readme`, `sp16://hardware/summary`, `sp16://hardware/errata`, `sp16://hardware/test-mode`, `sp16://safety/invariants`.

### 5. Agent Skill (`SKILL.md`)

Install the portable skill into your AI coding agent workspace so it automatically enforces SP-16 silicon errata and safety preflight checks:

```sh
SKILL_SRC="$(node -e "console.log(require.resolve('sp16-atlas/skill/SKILL.md'))")"
mkdir -p .gemini/skills/sp16-atlas .claude/skills/sp16-atlas
cp "$SKILL_SRC" .gemini/skills/sp16-atlas/SKILL.md
cp "$SKILL_SRC" .claude/skills/sp16-atlas/SKILL.md
```

---

## BYO-UPD Local Hydration Guide (`SP16_ATLAS_CORPUS_DIR`)

For the complete step-by-step clean-room pipeline (ephemeral RAM decryption, SquashFS/rootfs extraction, Ghidra headless & GNU Binutils disassembly across all `11` firmware binaries, and `SP16_ATLAS_CORPUS_DIR` indexing), see **[`USAGE.md`](https://github.com/labestiaroot/sp16-atlas/blob/main/USAGE.md)** (`docs/05-sdk-cli-mcp-and-agent-guide/byo-upd-decompilation-howto.md` · **[Web Docs](https://labestiaroot.github.io/sp16-atlas/05-sdk-cli-mcp-and-agent-guide/byo-upd-decompilation-howto/)**).

1. Obtain a legal copy of stock Pioneer DJ **`TORAIZSP16.UPD`** (`v1.60`, `Rev.6550`, `99,495,956 B`, SHA-256 `ff1cc60c4b6e2a3793196486826e78eb223e2f86cd95b5c968f6fca3ade537a4`) and your unit's `dm-crypt symmetric volume key` (`<unit-key-file>` from `/usr/local/pdj/`).
2. Verify container framing offline without touching keys:
   ```sh
   sp16-atlas upd inspect --file ./TORAIZSP16.UPD --json
   ```
3. Decrypt, unpack, and index into a local private directory outside this repository (zeroizing key buffers in RAM immediately), then point `SP16_ATLAS_CORPUS_DIR` to it:
   ```sh
   export SP16_ATLAS_CORPUS_DIR="/path/to/local-sp16-corpus"
   sp16-atlas corpus summary --json
   ```

---

## Triangulated Hardware Summary (`QRT1001` + Stock `v1.60` + `Megasonda` Live)

| Subsystem | Verified Silicon / Device Node | Bus / Format / Rate | Triangulated Truth & Critical Errata |
| :--- | :--- | :--- | :--- |
| **SoC & ABI** | `IC2000 MCIMX6Q5EYM10AD` (`996 MHz`) | `armel` `VFPv3-D32` `softfp`, `GLIBC_2.13` | `[OBSERVED-HW-LIVE]` `Linux 3.0.101` SMP PREEMPT; `106.43 MFLOPS` FTZ; `musl` requires `>= 1 MiB` stacks + `time32` ALSA shim. |
| **Main Audio DAC** | `IC5400 AK4458VN` (`0-0010`) | `AUD4/SSI1` `16ch S16_LE TDM256` @ `44.1 kHz` | `[OBSERVED-HW-LIVE]` Active **even slots**: `12/14` Main, `8/10` Out 3/4, `4/6` Out 5/6, `0/2` Out 7/8 (`ERR-03`, `QRT-ERR-09`). |
| **Line ADC & Phones** | `IC5203 AK5386VT` + `IC6600 AK4452AN/VN` | `AUD5/SSI2` Master `S24_LE` @ `44.1 kHz` | `[OBSERVED-SCHEMATIC]` `[OBSERVED-HW-LIVE]` `AK5386VT` `+16 dBu` / `33 kOhm` (misnamed `AK5358` in GPL kernel, `ERR-02`); Phones requires `S24_LE -6 dB` (rejects `S32_LE`, `ERR-04`). |
| **Prophet-6 Filter** | `RY6200/RY5400 VSR1008`, `IC6400 DAC7811IDGS`, `IC6000/IC6001` | `AUD6/SSI3` Slave `S24_LE` + `ECSPI5` `2 B LE` | `[OBSERVED-HW-LIVE]` No `snd_pcm_link()` / no multi-process SSI open (`imx-ssi.c:384` freeze, `ERR-09`); HPF CV `4..3276`; net lag `36` samples (`0.816 ms`). |
| **Panel & Touch** | `IC8005/IC8008` (`R5F364AENFA-U0`), `DSX1128`, `IC7700 AD7147` | `ECSPI1` `128 B @ 3 ms` + `ECSPI3` `4 B @ 3 ms` | `[OBSERVED-SCHEMATIC]` `[OBSERVED-HW-LIVE]` Power button is `RX[5] bit 4` active-LOW; `DSX1128` 4-wire resistive routes via `M2 uCOM` SPI (**NO `/dev/input/ts0`**, `ERR-01`). |
| **Display & GPU** | `CWX4352` (`800x480`), `IC7000 BU90R104`, `GC2000` | `LVDS0` (`/dev/fb0`+`/dev/fb1`), `156 MHz`, `SZ_16M` | `[OBSERVED-HW-LIVE]` `LVDS0` (not `LVDS1`, `QRT-ERR-02`); use `pwm-backlight.1` (`/sys/class/backlight/backlight/*` Oopses, `INV-MS-BL`). |
| **GPIO & Watchdog** | `/dev/gpiodrv`, `/dev/watchdog` | Char drivers | `[OBSERVED-FW-STATIC]` `[OBSERVED-HW-LIVE]` **NEVER `read()` pins `{5, 93, 126, 133, 134}`** (`H-05`, pin `93` cuts power); `/dev/watchdog` is `NOWAYOUT` (`INV-MS-WDG`). |
| **MIDI, Net & Storage** | `IC3203 TLP2368`, `IC2602 LAN8720A-CP`, `IC2601` NAND, `IC3800` eMMC | `UART2` `31.25k`, `100Base-TX RMII`, `mtd0..15`, `8 GB` | `[OBSERVED-SCHEMATIC]` `[OBSERVED-HW-LIVE]` DIN MIDI uses `UART2` (`QRT-ERR-01`); `LAN8720A-CP` is `100Base-TX` only (`ERR-05`); `mtd5 <= 2,422,834 B`, `mtd6 <= 4,561,658 B`. |

---

## Clean-Room & Legal Notice (`INV-FW-03`)

1. **No Proprietary Firmware or Binaries:** This repository contains **zero** `.UPD`, `.iso`, `.sfs`, `.bin`, vendor headers, extracted GUI assets, or raw decompiled firmware dumps.
2. **No Cryptographic Key Material:** Zero raw key bytes, hex, Base64, or literal `<unit-key-file>` names appear anywhere in code, tests, JSON catalogs, or documentation.
3. **No Environment Leaks:** Private LAN IPv4 addresses (`${SP16_IP}`) and local host paths (`${WORKSPACE_ROOT}`) are sanitized across all public artifacts.
4. **Dual Licensing:** Source code (`src/`, `bin/`, `tools/`, `tests/`) is licensed under the **[MIT License](https://github.com/labestiaroot/sp16-atlas/blob/main/LICENSE)**. Technical documentation and clean-room hardware catalogs (`docs/`, `skill/SKILL.md`) are licensed under **[CC-BY-SA-4.0](https://github.com/labestiaroot/sp16-atlas/blob/main/LICENSE-DOCS)**.