sound/firewire/oxfw/oxfw-scs1x.c
Source file repositories/reference/linux-study-clean/sound/firewire/oxfw/oxfw-scs1x.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/oxfw/oxfw-scs1x.c- Extension
.c- Size
- 10545 bytes
- Lines
- 421
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
oxfw.h
Detected Declarations
struct fw_scs1xfunction midi_input_escaped_bytefunction midi_input_bytefunction midi_input_packetfunction handle_hssfunction scs_write_callbackfunction is_valid_running_statusfunction is_one_byte_cmdfunction is_two_bytes_cmdfunction is_three_bytes_cmdfunction is_invalid_cmdfunction scs_output_workfunction expectsfunction midi_capture_openfunction midi_capture_closefunction midi_capture_triggerfunction midi_playback_openfunction midi_playback_closefunction midi_playback_triggerfunction midi_playback_drainfunction register_addressfunction remove_scs1xfunction snd_oxfw_scs1x_updatefunction snd_oxfw_scs1x_add
Annotated Snippet
struct fw_scs1x {
struct fw_address_handler hss_handler;
u8 input_escape_count;
struct snd_rawmidi_substream *input;
/* For MIDI playback. */
struct snd_rawmidi_substream *output;
bool output_idle;
u8 output_status;
u8 output_bytes;
bool output_escaped;
bool output_escape_high_nibble;
struct work_struct work;
wait_queue_head_t idle_wait;
u8 buffer[HSS1394_MAX_PACKET_SIZE];
bool transaction_running;
struct fw_transaction transaction;
unsigned int transaction_bytes;
bool error;
struct fw_device *fw_dev;
};
static const u8 sysex_escape_prefix[] = {
0xf0, /* SysEx begin */
0x00, 0x01, 0x60, /* Stanton DJ */
0x48, 0x53, 0x53, /* "HSS" */
};
static void midi_input_escaped_byte(struct snd_rawmidi_substream *stream,
u8 byte)
{
u8 nibbles[2];
nibbles[0] = byte >> 4;
nibbles[1] = byte & 0x0f;
snd_rawmidi_receive(stream, nibbles, 2);
}
static void midi_input_byte(struct fw_scs1x *scs,
struct snd_rawmidi_substream *stream, u8 byte)
{
const u8 eox = 0xf7;
if (scs->input_escape_count > 0) {
midi_input_escaped_byte(stream, byte);
scs->input_escape_count--;
if (scs->input_escape_count == 0)
snd_rawmidi_receive(stream, &eox, sizeof(eox));
} else if (byte == 0xf9) {
snd_rawmidi_receive(stream, sysex_escape_prefix,
ARRAY_SIZE(sysex_escape_prefix));
midi_input_escaped_byte(stream, 0x00);
midi_input_escaped_byte(stream, 0xf9);
scs->input_escape_count = 3;
} else {
snd_rawmidi_receive(stream, &byte, 1);
}
}
static void midi_input_packet(struct fw_scs1x *scs,
struct snd_rawmidi_substream *stream,
const u8 *data, unsigned int bytes)
{
unsigned int i;
const u8 eox = 0xf7;
if (data[0] == HSS1394_TAG_USER_DATA) {
for (i = 1; i < bytes; ++i)
midi_input_byte(scs, stream, data[i]);
} else {
snd_rawmidi_receive(stream, sysex_escape_prefix,
ARRAY_SIZE(sysex_escape_prefix));
for (i = 0; i < bytes; ++i)
midi_input_escaped_byte(stream, data[i]);
snd_rawmidi_receive(stream, &eox, sizeof(eox));
}
}
static void handle_hss(struct fw_card *card, struct fw_request *request,
int tcode, int destination, int source, int generation,
unsigned long long offset, void *data, size_t length,
void *callback_data)
{
struct fw_scs1x *scs = callback_data;
struct snd_rawmidi_substream *stream;
int rcode;
if (offset != scs->hss_handler.offset) {
rcode = RCODE_ADDRESS_ERROR;
goto end;
Annotation
- Immediate include surface: `oxfw.h`.
- Detected declarations: `struct fw_scs1x`, `function midi_input_escaped_byte`, `function midi_input_byte`, `function midi_input_packet`, `function handle_hss`, `function scs_write_callback`, `function is_valid_running_status`, `function is_one_byte_cmd`, `function is_two_bytes_cmd`, `function is_three_bytes_cmd`.
- 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.