sound/firewire/fireface/ff-protocol-former.c
Source file repositories/reference/linux-study-clean/sound/firewire/fireface/ff-protocol-former.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/fireface/ff-protocol-former.c- Extension
.c- Size
- 19675 bytes
- Lines
- 734
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hff.h
Detected Declarations
struct ff400_msg_parserfunction parse_clock_bitsfunction former_get_clockfunction former_switch_fetching_modefunction dump_clock_configfunction dump_sync_statusfunction former_dump_statusfunction former_fill_midi_msgfunction allocate_tx_resourcesfunction ff800_allocate_resourcesfunction ff800_begin_sessionfunction ff800_finish_sessionfunction ff800_handle_midi_msgfunction ff400_allocate_resourcesfunction ff400_begin_sessionfunction ff400_finish_sessionfunction parse_midi_msgfunction ff400_has_msgfunction ff400_handle_msgfunction ff400_copy_msg_to_user
Annotated Snippet
struct ff400_msg_parser {
struct {
u32 msg;
u32 tstamp;
} msgs[FF400_QUEUE_SIZE];
size_t push_pos;
size_t pull_pos;
};
static bool ff400_has_msg(struct snd_ff *ff)
{
struct ff400_msg_parser *parser = ff->msg_parser;
return (parser->push_pos != parser->pull_pos);
}
// For Fireface 400, lower 4 bytes of destination address is configured by bit
// flag in quadlet register (little endian) at 0x'0000'801'0051c. Drivers can
// select one of 4 options:
//
// bit flags: offset of destination address
// - 0x04000000: 0x'....'....'0000'0000
// - 0x08000000: 0x'....'....'0000'0080
// - 0x10000000: 0x'....'....'0000'0100
// - 0x20000000: 0x'....'....'0000'0180
//
// Drivers can suppress the device to transfer asynchronous transactions by
// using below 2 bits.
// - 0x01000000: suppress transmission
// - 0x02000000: suppress transmission
//
// Actually, the register is write-only and includes the other options such as
// input attenuation. This driver allocates destination address with '0000'0000
// in its lower offset and expects userspace application to configure the
// register for it.
// When the message is for signal level operation, the upper 4 bits in MSB expresses the pair of
// stereo physical port.
// - 0: Microphone input 0/1
// - 1: Line input 0/1
// - [2-4]: Line output 0-5
// - 5: Headphone output 0/1
// - 6: S/PDIF output 0/1
// - [7-10]: ADAT output 0-7
//
// The value of signal level can be detected by mask of 0x00fffc00. For signal level of microphone
// input:
//
// - 0: 0.0 dB
// - 10: +10.0 dB
// - 11: +11.0 dB
// - 12: +12.0 dB
// - ...
// - 63: +63.0 dB:
// - 64: +64.0 dB:
// - 65: +65.0 dB:
//
// For signal level of line input:
//
// - 0: 0.0 dB
// - 1: +0.5 dB
// - 2: +1.0 dB
// - 3: +1.5 dB
// - ...
// - 34: +17.0 dB:
// - 35: +17.5 dB:
// - 36: +18.0 dB:
//
// For signal level of any type of output:
//
// - 63: -infinite
// - 62: -58.0 dB
// - 61: -56.0 dB
// - 60: -54.0 dB
// - 59: -53.0 dB
// - 58: -52.0 dB
// - ...
// - 7: -1.0 dB
// - 6: 0.0 dB
// - 5: +1.0 dB
// - ...
// - 2: +4.0 dB
// - 1: +5.0 dB
// - 0: +6.0 dB
//
// When the message is not for signal level operation, it's for MIDI bytes. When matching to
// FF400_MSG_FLAG_IS_MIDI_PORT_0, one MIDI byte can be detected by mask of 0x000000ff. When
// matching to FF400_MSG_FLAG_IS_MIDI_PORT_1, one MIDI byte can be detected by mask of 0x00ff0000.
#define FF400_MSG_FLAG_IS_SIGNAL_LEVEL 0x04000000
#define FF400_MSG_FLAG_IS_RIGHT_CHANNEL 0x08000000
Annotation
- Immediate include surface: `linux/delay.h`, `ff.h`.
- Detected declarations: `struct ff400_msg_parser`, `function parse_clock_bits`, `function former_get_clock`, `function former_switch_fetching_mode`, `function dump_clock_config`, `function dump_sync_status`, `function former_dump_status`, `function former_fill_midi_msg`, `function allocate_tx_resources`, `function ff800_allocate_resources`.
- Atlas domain: Driver Families / sound/firewire.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.