109 lines
4.2 KiB
Plaintext
109 lines
4.2 KiB
Plaintext
Document Version: 14.0
|
|
Date: 2026-01-19
|
|
Subject: Technical Specification for TASCAM US-144 MKII Linux Driver
|
|
Device: TEAC Corp. US-144 MKII (ID 0644:8020)
|
|
Status: Implemented
|
|
|
|
Executive Summary
|
|
|
|
This document describes the implementation details of the Linux ALSA driver for the TASCAM US-144 MKII. The driver is implemented as a vendor-specific USB audio driver using the ALSA kernel API. It handles audio streaming, sample rate control, and MIDI I/O using a proprietary protocol over High-Speed USB 2.0.
|
|
|
|
Hardware Interface (Derived from Device Descriptors)
|
|
|
|
Vendor ID: 0x0644 (TEAC Corp.)
|
|
Product ID: 0x8020 (US-144 MKII)
|
|
Speed: High Speed (480 Mbps)
|
|
|
|
2.1. Interfaces
|
|
The device exposes two interfaces. Both must be set to Alternate Setting 1 to enable functionality.
|
|
|
|
Interface 0 (Audio Output & MIDI):
|
|
- Endpoint 0x02 (OUT): Isochronous, Asynchronous. Used for Playback Data.
|
|
- Endpoint 0x83 (IN): Bulk. Used for MIDI Input.
|
|
- Endpoint 0x04 (OUT): Bulk. Used for MIDI Output.
|
|
|
|
Interface 1 (Audio Input & Clock):
|
|
- Endpoint 0x81 (IN): Isochronous, Asynchronous. Used for explicit Feedback (Clock).
|
|
- Endpoint 0x86 (IN): Bulk. Used for Capture Data.
|
|
|
|
Driver Architecture
|
|
|
|
3.1. Implicit Feedback / Ghost Stream Mechanism
|
|
The device requires the Playback stream (EP 0x02) to be active for any other function (Capture, MIDI, Feedback) to work. To support cases where the user is recording or using MIDI without playing audio, the driver implements an "Implicit Stream" reference counter (stream_refs).
|
|
|
|
If stream_refs > 0 and no ALSA Playback is active: The driver submits "Ghost" URBs to EP 0x02 containing zeroed-out (silent) buffers.
|
|
|
|
If ALSA Playback starts: The driver seamlessly transitions the active URBs to carry real audio data.
|
|
|
|
If ALSA Playback stops but stream_refs > 0: The driver transitions back to sending silence.
|
|
|
|
Audio Streaming Implementation
|
|
|
|
4.1. Playback (Endpoint 0x02)
|
|
- Format: 24-bit Little Endian, 4 Channels (Interleaved).
|
|
- URB Structure:
|
|
- 4 active URBs (Double/Quad buffering).
|
|
- 8 Packets per URB (Aligns with 1ms at High Speed).
|
|
- Packet Size: Variable, determined by the Feedback Loop.
|
|
- Frame Size: 12 bytes (4 channels * 3 bytes).
|
|
|
|
4.2. Capture (Endpoint 0x86)
|
|
- Format: Bulk Transfer.
|
|
- Packet Size: 4096 bytes (Driver buffer size).
|
|
- Data Format: Proprietary bit-shuffled format.
|
|
- Decoding: The driver applies a software "Butterfly" bit-transposition to decode the incoming 64-byte chunks into standard PCM 32-bit integer format.
|
|
|
|
4.3. Clock Synchronization (Feedback Endpoint 0x81)
|
|
- Format: 3 bytes per packet.
|
|
- Algorithm:
|
|
1. Sum the bytes received in the packet.
|
|
2. Convert to Q16.16 frequency format.
|
|
3. Apply a recursive moving average filter (Weight 3:1) to smooth jitter.
|
|
4. Use this frequency to calculate the exact number of frames to send in the next Playback URB.
|
|
|
|
MIDI Implementation
|
|
|
|
5.1. Protocol
|
|
MIDI is encapsulated in a custom 9-byte packet format sent over Bulk endpoints.
|
|
|
|
Packet Structure:
|
|
Byte 0: 0xE0 (Header)
|
|
Byte 1-8: MIDI Payload (Up to 8 bytes)
|
|
|
|
Padding: If the MIDI message is shorter than 8 bytes, the remaining bytes are padded with 0xFD.
|
|
|
|
5.2. Endpoints
|
|
|
|
Output: Endpoint 0x04.
|
|
|
|
Input: Endpoint 0x83.
|
|
|
|
5.3. Dependency
|
|
MIDI I/O requires the implicit playback stream to be active. The driver automatically increments stream_refs on MIDI Open and decrements on MIDI Close.
|
|
|
|
Control Messages (Sample Rate)
|
|
|
|
Sample rate changes are strictly ordered using USB Control Messages to Interface 0.
|
|
|
|
Sequence:
|
|
|
|
VENDOR_REQ_MODE_CONTROL (0x49): Value 0x0010 (Config Mode).
|
|
|
|
UAC_SET_CUR (0x01): Set Rate on EP 0x86 (Capture).
|
|
|
|
UAC_SET_CUR (0x01): Set Rate on EP 0x02 (Playback).
|
|
|
|
VENDOR_REQ_REGISTER_WRITE (0x41): Write hardware register settings.
|
|
|
|
44.1 kHz: Reg 0x1000
|
|
|
|
48.0 kHz: Reg 0x1002
|
|
|
|
88.2 kHz: Reg 0x1008
|
|
|
|
96.0 kHz: Reg 0x100a
|
|
|
|
VENDOR_REQ_MODE_CONTROL (0x49): Value 0x0030 (Start Stream).
|
|
|
|
Supported Rates: 44100, 48000, 88200, 96000 Hz.
|