sound/firewire/tascam/tascam-transaction.c
Source file repositories/reference/linux-study-clean/sound/firewire/tascam/tascam-transaction.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/tascam/tascam-transaction.c- Extension
.c- Size
- 10462 bytes
- Lines
- 400
- Domain
- Driver Families
- Bucket
- sound/firewire
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
tascam.h
Detected Declarations
function Copyrightfunction fill_messagefunction async_midi_port_callbackfunction midi_port_workfunction snd_fw_async_midi_port_initfunction handle_midi_txfunction snd_tscm_transaction_registerfunction snd_tscm_transaction_reregisterfunction snd_tscm_transaction_unregister
Annotated Snippet
switch (status & 0xf0) {
case 0x80: /* Note on. */
case 0x90: /* Note off. */
case 0xa0: /* Polyphonic key pressure. */
case 0xb0: /* Control change and Mode change. */
case 0xe0: /* Pitch bend change. */
return 3;
case 0xc0: /* Program change. */
case 0xd0: /* Channel pressure. */
return 2;
default:
break;
}
break;
}
return -EINVAL;
}
static int fill_message(struct snd_fw_async_midi_port *port,
struct snd_rawmidi_substream *substream)
{
int i, len, consume;
u8 *label, *msg;
u8 status;
/* The first byte is used for label, the rest for MIDI bytes. */
label = port->buf;
msg = port->buf + 1;
consume = snd_rawmidi_transmit_peek(substream, msg, 3);
if (consume == 0)
return 0;
/* On exclusive message. */
if (port->on_sysex) {
/* Seek the end of exclusives. */
for (i = 0; i < consume; ++i) {
if (msg[i] == 0xf7) {
port->on_sysex = false;
break;
}
}
/* At the end of exclusive message, use label 0x07. */
if (!port->on_sysex) {
consume = i + 1;
*label = (substream->number << 4) | 0x07;
/* During exclusive message, use label 0x04. */
} else if (consume == 3) {
*label = (substream->number << 4) | 0x04;
/* We need to fill whole 3 bytes. Go to next change. */
} else {
return 0;
}
len = consume;
} else {
/* The beginning of exclusives. */
if (msg[0] == 0xf0) {
/* Transfer it in next chance in another condition. */
port->on_sysex = true;
return 0;
} else {
/* On running-status. */
if ((msg[0] & 0x80) != 0x80)
status = port->running_status;
else
status = msg[0];
/* Calculate consume bytes. */
len = calculate_message_bytes(status);
if (len <= 0)
return 0;
/* On running-status. */
if ((msg[0] & 0x80) != 0x80) {
/* Enough MIDI bytes were not retrieved. */
if (consume < len - 1)
return 0;
consume = len - 1;
msg[2] = msg[1];
msg[1] = msg[0];
msg[0] = port->running_status;
} else {
/* Enough MIDI bytes were not retrieved. */
if (consume < len)
return 0;
consume = len;
Annotation
- Immediate include surface: `tascam.h`.
- Detected declarations: `function Copyright`, `function fill_message`, `function async_midi_port_callback`, `function midi_port_work`, `function snd_fw_async_midi_port_init`, `function handle_midi_tx`, `function snd_tscm_transaction_register`, `function snd_tscm_transaction_reregister`, `function snd_tscm_transaction_unregister`.
- Atlas domain: Driver Families / sound/firewire.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.