Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
amdtp.h
Go to the documentation of this file.
1 #ifndef SOUND_FIREWIRE_AMDTP_H_INCLUDED
2 #define SOUND_FIREWIRE_AMDTP_H_INCLUDED
3 
4 #include <linux/interrupt.h>
5 #include <linux/mutex.h>
6 #include <linux/spinlock.h>
7 #include "packets-buffer.h"
8 
18 };
19 
23 enum cip_sfc {
31 };
32 
33 #define AMDTP_OUT_PCM_FORMAT_BITS (SNDRV_PCM_FMTBIT_S16 | \
34  SNDRV_PCM_FMTBIT_S32)
35 
36 struct fw_unit;
37 struct fw_iso_context;
38 struct snd_pcm_substream;
39 
41  struct fw_unit *unit;
44  struct mutex mutex;
45 
46  enum cip_sfc sfc;
47  unsigned int data_block_quadlets;
48  unsigned int pcm_channels;
49  unsigned int midi_ports;
51  struct snd_pcm_substream *pcm,
52  __be32 *buffer, unsigned int frames);
53 
54  unsigned int syt_interval;
55  unsigned int source_node_id_field;
57 
60 
62  unsigned int data_block_counter;
63 
64  unsigned int data_block_state;
65 
66  unsigned int last_syt_offset;
67  unsigned int syt_offset_state;
68 
69  unsigned int pcm_buffer_pointer;
70  unsigned int pcm_period_pointer;
72 };
73 
75  enum cip_out_flags flags);
77 
78 void amdtp_out_stream_set_rate(struct amdtp_out_stream *s, unsigned int rate);
80 
81 int amdtp_out_stream_start(struct amdtp_out_stream *s, int channel, int speed);
84 
88 unsigned long amdtp_out_stream_pcm_pointer(struct amdtp_out_stream *s);
90 
99 static inline void amdtp_out_stream_set_pcm(struct amdtp_out_stream *s,
100  unsigned int pcm_channels)
101 {
102  s->pcm_channels = pcm_channels;
103 }
104 
112 static inline void amdtp_out_stream_set_midi(struct amdtp_out_stream *s,
113  unsigned int midi_ports)
114 {
115  s->midi_ports = midi_ports;
116 }
117 
125 static inline bool amdtp_out_streaming_error(struct amdtp_out_stream *s)
126 {
127  return s->packet_index < 0;
128 }
129 
139 static inline void amdtp_out_stream_pcm_trigger(struct amdtp_out_stream *s,
140  struct snd_pcm_substream *pcm)
141 {
142  ACCESS_ONCE(s->pcm) = pcm;
143 }
144 
145 static inline bool cip_sfc_is_base_44100(enum cip_sfc sfc)
146 {
147  return sfc & 1;
148 }
149 
150 #endif