This source file includes following definitions.
- func_to_g_audio
- num_channels
1
2
3
4
5
6
7
8
9 #ifndef __U_AUDIO_H
10 #define __U_AUDIO_H
11
12 #include <linux/usb/composite.h>
13
14 struct uac_params {
15
16 int p_chmask;
17 int p_srate;
18 int p_ssize;
19
20
21 int c_chmask;
22 int c_srate;
23 int c_ssize;
24
25 int req_number;
26 };
27
28 struct g_audio {
29 struct usb_function func;
30 struct usb_gadget *gadget;
31
32 struct usb_ep *in_ep;
33 struct usb_ep *out_ep;
34
35
36 unsigned int in_ep_maxpsize;
37
38 unsigned int out_ep_maxpsize;
39
40
41 struct snd_uac_chip *uac;
42
43 struct uac_params params;
44 };
45
46 static inline struct g_audio *func_to_g_audio(struct usb_function *f)
47 {
48 return container_of(f, struct g_audio, func);
49 }
50
51 static inline uint num_channels(uint chanmask)
52 {
53 uint num = 0;
54
55 while (chanmask) {
56 num += (chanmask & 1);
57 chanmask >>= 1;
58 }
59
60 return num;
61 }
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
77 const char *card_name);
78 void g_audio_cleanup(struct g_audio *g_audio);
79
80 int u_audio_start_capture(struct g_audio *g_audio);
81 void u_audio_stop_capture(struct g_audio *g_audio);
82 int u_audio_start_playback(struct g_audio *g_audio);
83 void u_audio_stop_playback(struct g_audio *g_audio);
84
85 #endif