amdtp-stream.c (02394af3e00df73c3674de0783d3a31c8162c840) | amdtp-stream.c (0dcb4efb1095d0a1f5f681c2b94e98b009cc5d77) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Audio and Music Data Transmission Protocol (IEC 61883-6) streams 4 * with Common Isochronous Packet (IEC 61883-1) headers 5 * 6 * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 7 */ 8 --- 686 unchanged lines hidden (view full) --- 695} 696 697static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, 698 size_t header_length, void *header, 699 void *private_data) 700{ 701 struct amdtp_stream *s = private_data; 702 const __be32 *ctx_header = header; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Audio and Music Data Transmission Protocol (IEC 61883-6) streams 4 * with Common Isochronous Packet (IEC 61883-1) headers 5 * 6 * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 7 */ 8 --- 686 unchanged lines hidden (view full) --- 695} 696 697static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, 698 size_t header_length, void *header, 699 void *private_data) 700{ 701 struct amdtp_stream *s = private_data; 702 const __be32 *ctx_header = header; |
703 unsigned int i, packets = header_length / sizeof(*ctx_header); | 703 unsigned int packets = header_length / sizeof(*ctx_header); 704 int i; |
704 705 if (s->packet_index < 0) 706 return; 707 708 for (i = 0; i < packets; ++i) { 709 u32 cycle; 710 unsigned int syt; | 705 706 if (s->packet_index < 0) 707 return; 708 709 for (i = 0; i < packets; ++i) { 710 u32 cycle; 711 unsigned int syt; |
711 unsigned int data_block; | 712 unsigned int data_blocks; |
712 __be32 *buffer; 713 unsigned int pcm_frames; 714 struct { 715 struct fw_iso_packet params; 716 __be32 header[IT_PKT_HEADER_SIZE_CIP / sizeof(__be32)]; 717 } template = { {0}, {0} }; 718 struct snd_pcm_substream *pcm; 719 720 cycle = compute_it_cycle(*ctx_header); 721 syt = calculate_syt(s, cycle); | 713 __be32 *buffer; 714 unsigned int pcm_frames; 715 struct { 716 struct fw_iso_packet params; 717 __be32 header[IT_PKT_HEADER_SIZE_CIP / sizeof(__be32)]; 718 } template = { {0}, {0} }; 719 struct snd_pcm_substream *pcm; 720 721 cycle = compute_it_cycle(*ctx_header); 722 syt = calculate_syt(s, cycle); |
722 data_block = calculate_data_blocks(s, syt); | 723 data_blocks = calculate_data_blocks(s, syt); |
723 buffer = s->buffer.packets[s->packet_index].buffer; | 724 buffer = s->buffer.packets[s->packet_index].buffer; |
724 pcm_frames = s->process_data_blocks(s, buffer, data_block, &syt); | 725 pcm_frames = s->process_data_blocks(s, buffer, data_blocks, 726 &syt); |
725 | 727 |
726 build_it_pkt_header(s, cycle, &template.params, data_block, syt, 727 i); | 728 build_it_pkt_header(s, cycle, &template.params, data_blocks, 729 syt, i); |
728 729 if (queue_out_packet(s, &template.params) < 0) { 730 cancel_stream(s); 731 return; 732 } 733 734 pcm = READ_ONCE(s->pcm); 735 if (pcm && pcm_frames > 0) --- 343 unchanged lines hidden --- | 730 731 if (queue_out_packet(s, &template.params) < 0) { 732 cancel_stream(s); 733 return; 734 } 735 736 pcm = READ_ONCE(s->pcm); 737 if (pcm && pcm_frames > 0) --- 343 unchanged lines hidden --- |