2 * oxfw_stream.c - a part of driver for OXFW970/971 based devices
4 * Copyright (c) 2014 Takashi Sakamoto
6 * Licensed under the terms of the GNU General Public License, version 2.
11 int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw)
15 err = cmp_connection_init(&oxfw->in_conn, oxfw->unit,
20 err = amdtp_stream_init(&oxfw->rx_stream, oxfw->unit,
21 AMDTP_OUT_STREAM, CIP_NONBLOCKING);
23 amdtp_stream_destroy(&oxfw->rx_stream);
24 cmp_connection_destroy(&oxfw->in_conn);
30 static void stop_stream(struct snd_oxfw *oxfw)
32 amdtp_stream_pcm_abort(&oxfw->rx_stream);
33 amdtp_stream_stop(&oxfw->rx_stream);
34 cmp_connection_break(&oxfw->in_conn);
37 int snd_oxfw_stream_start_simplex(struct snd_oxfw *oxfw)
41 if (amdtp_streaming_error(&oxfw->rx_stream))
44 if (amdtp_stream_running(&oxfw->rx_stream))
47 err = cmp_connection_establish(&oxfw->in_conn,
48 amdtp_stream_get_max_payload(&oxfw->rx_stream));
52 err = amdtp_stream_start(&oxfw->rx_stream,
53 oxfw->in_conn.resources.channel,
61 void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw)
66 void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw)
70 amdtp_stream_destroy(&oxfw->rx_stream);
71 cmp_connection_destroy(&oxfw->in_conn);
74 void snd_oxfw_stream_update_simplex(struct snd_oxfw *oxfw)
76 if (cmp_connection_update(&oxfw->in_conn) < 0)
79 amdtp_stream_update(&oxfw->rx_stream);