data &= ~CLOCK_RATE_MASK; for (i = 0; i < ARRAY_SIZE(snd_dice_rates); ++i) { if (snd_dice_rates[i] == rate) break;
} if (i == ARRAY_SIZE(snd_dice_rates)) return -EINVAL;
data |= i << CLOCK_RATE_SHIFT;
if (completion_done(&dice->clock_accepted))
reinit_completion(&dice->clock_accepted);
new = cpu_to_be32(data);
err = snd_dice_transaction_write_global(dice, GLOBAL_CLOCK_SELECT,
&new, sizeof(new)); if (err < 0) return err;
if (wait_for_completion_timeout(&dice->clock_accepted,
msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0) { if (reg != new) return -ETIMEDOUT;
}
// At 176.4/192.0 kHz, Dice has a quirk to transfer two PCM frames in // one data block of AMDTP packet. Thus sampling transfer frequency is // a half of PCM sampling frequency, i.e. PCM frames at 192.0 kHz are // transferred on AMDTP packets at 96 kHz. Two successive samples of a // channel are stored consecutively in the packet. This quirk is called // as 'Dual Wire'. // For this quirk, blocking mode is required and PCM buffer size should // be aligned to SYT_INTERVAL.
double_pcm_frames = (rate > 96000 && !dice->disable_double_pcm_frames); if (double_pcm_frames) {
rate /= 2;
pcm_chs *= 2;
}
// These are important for developer of this driver. if (pcm_chs != pcm_cache) {
dev_info(&dice->unit->device, "cache mismatch: pcm: %u:%u, midi: %u\n",
pcm_chs, pcm_cache, midi_ports); return -EPROTO;
}
// Just after owning the unit (GLOBAL_OWNER), the unit can // return invalid stream formats. Selecting clock parameters // have an effect for the unit to refine it.
err = select_clock(dice, rate); if (err < 0) return err;
// After changing sampling transfer frequency, the value of // register can be changed.
err = get_register_params(dice, &tx_params, &rx_params); if (err < 0) return err;
// Check error of packet streaming. for (i = 0; i < MAX_STREAMS; ++i) { if (amdtp_streaming_error(&dice->tx_stream[i]) ||
amdtp_streaming_error(&dice->rx_stream[i])) {
amdtp_domain_stop(&dice->domain);
finish_session(dice, &tx_params, &rx_params); break;
}
}
if (generation != fw_parent_device(dice->unit)->card->generation) { for (i = 0; i < MAX_STREAMS; ++i) { if (i < tx_params.count)
fw_iso_resources_update(dice->tx_resources + i); if (i < rx_params.count)
fw_iso_resources_update(dice->rx_resources + i);
}
}
// Check required streams are running or not.
err = snd_dice_transaction_get_rate(dice, &rate); if (err < 0) return err;
err = snd_dice_stream_get_rate_mode(dice, rate, &mode); if (err < 0) return err; for (i = 0; i < MAX_STREAMS; ++i) { if (dice->tx_pcm_chs[i][mode] > 0 &&
!amdtp_stream_running(&dice->tx_stream[i])) break; if (dice->rx_pcm_chs[i][mode] > 0 &&
!amdtp_stream_running(&dice->rx_stream[i])) break;
} if (i < MAX_STREAMS) { // Start both streams.
err = start_streams(dice, AMDTP_IN_STREAM, rate, &tx_params); if (err < 0) goto error;
err = snd_dice_transaction_set_enable(dice); if (err < 0) {
dev_err(&dice->unit->device, "fail to enable interface\n"); goto error;
}
// MEMO: The device immediately starts packet transmission when enabled. Some // devices are strictly to generate any discontinuity in the sequence of tx packet // when they receives invalid sequence of presentation time in CIP header. The // sequence replay for media clock recovery can suppress the behaviour.
err = amdtp_domain_start(&dice->domain, 0, true, false); if (err < 0) goto error;
int snd_dice_stream_init_duplex(struct snd_dice *dice)
{ int i, err;
for (i = 0; i < MAX_STREAMS; i++) {
err = init_stream(dice, AMDTP_IN_STREAM, i); if (err < 0) { for (; i >= 0; i--)
destroy_stream(dice, AMDTP_IN_STREAM, i); goto end;
}
}
for (i = 0; i < MAX_STREAMS; i++) {
err = init_stream(dice, AMDTP_OUT_STREAM, i); if (err < 0) { for (; i >= 0; i--)
destroy_stream(dice, AMDTP_OUT_STREAM, i); for (i = 0; i < MAX_STREAMS; i++)
destroy_stream(dice, AMDTP_IN_STREAM, i); goto end;
}
}
err = amdtp_domain_init(&dice->domain); if (err < 0) { for (i = 0; i < MAX_STREAMS; ++i) {
destroy_stream(dice, AMDTP_OUT_STREAM, i);
destroy_stream(dice, AMDTP_IN_STREAM, i);
}
}
end: return err;
}
if (--dice->dev_lock_count == 0)
dice_lock_changed(dice);
out:
spin_unlock_irq(&dice->lock);
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.13Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.