bcm2835_vcaudioreg.h revision 1.3.2.2 1 1.3.2.2 yamt /*
2 1.3.2.2 yamt Copyright (c) 2012, Broadcom Europe Ltd
3 1.3.2.2 yamt All rights reserved.
4 1.3.2.2 yamt
5 1.3.2.2 yamt Redistribution and use in source and binary forms, with or without
6 1.3.2.2 yamt modification, are permitted provided that the following conditions are met:
7 1.3.2.2 yamt * Redistributions of source code must retain the above copyright
8 1.3.2.2 yamt notice, this list of conditions and the following disclaimer.
9 1.3.2.2 yamt * Redistributions in binary form must reproduce the above copyright
10 1.3.2.2 yamt notice, this list of conditions and the following disclaimer in the
11 1.3.2.2 yamt documentation and/or other materials provided with the distribution.
12 1.3.2.2 yamt * Neither the name of the copyright holder nor the
13 1.3.2.2 yamt names of its contributors may be used to endorse or promote products
14 1.3.2.2 yamt derived from this software without specific prior written permission.
15 1.3.2.2 yamt
16 1.3.2.2 yamt THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 1.3.2.2 yamt ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 1.3.2.2 yamt WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 1.3.2.2 yamt DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 1.3.2.2 yamt DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 1.3.2.2 yamt (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.3.2.2 yamt LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 1.3.2.2 yamt ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 1.3.2.2 yamt (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 1.3.2.2 yamt SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 1.3.2.2 yamt */
27 1.3.2.2 yamt
28 1.3.2.2 yamt #ifndef _VC_AUDIO_DEFS_H_
29 1.3.2.2 yamt #define _VC_AUDIO_DEFS_H_
30 1.3.2.2 yamt
31 1.3.2.2 yamt #define VC_AUDIOSERV_MIN_VER 1
32 1.3.2.2 yamt #define VC_AUDIOSERV_VER 2
33 1.3.2.2 yamt
34 1.3.2.2 yamt // FourCC code used for VCHI connection
35 1.3.2.2 yamt #define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS")
36 1.3.2.2 yamt
37 1.3.2.2 yamt // Maximum message length
38 1.3.2.2 yamt #define VC_AUDIO_MAX_MSG_LEN (sizeof( VC_AUDIO_MSG_T ))
39 1.3.2.2 yamt
40 1.3.2.2 yamt // List of screens that are currently supported
41 1.3.2.2 yamt // All message types supported for HOST->VC direction
42 1.3.2.2 yamt typedef enum
43 1.3.2.2 yamt {
44 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_RESULT, // Generic result
45 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_COMPLETE, // playback of samples complete
46 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_CONFIG, // Configure
47 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_CONTROL, // control
48 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_OPEN, // open
49 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_CLOSE, // close/shutdown
50 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_START, // start output (i.e. resume)
51 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_STOP, // stop output (i.e. pause)
52 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_WRITE, // write samples
53 1.3.2.2 yamt VC_AUDIO_MSG_TYPE_MAX
54 1.3.2.2 yamt
55 1.3.2.2 yamt } VC_AUDIO_MSG_TYPE;
56 1.3.2.2 yamt
57 1.3.2.2 yamt #if 0
58 1.3.2.2 yamt static const char *vc_audio_msg_type_names[] = {
59 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_RESULT",
60 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_COMPLETE",
61 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_CONFIG",
62 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_CONTROL",
63 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_OPEN",
64 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_CLOSE",
65 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_START",
66 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_STOP",
67 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_WRITE",
68 1.3.2.2 yamt "VC_AUDIO_MSG_TYPE_MAX"
69 1.3.2.2 yamt };
70 1.3.2.2 yamt #endif
71 1.3.2.2 yamt
72 1.3.2.2 yamt // configure the audio
73 1.3.2.2 yamt typedef struct
74 1.3.2.2 yamt {
75 1.3.2.2 yamt uint32_t channels;
76 1.3.2.2 yamt uint32_t samplerate;
77 1.3.2.2 yamt uint32_t bps;
78 1.3.2.2 yamt
79 1.3.2.2 yamt } VC_AUDIO_CONFIG_T;
80 1.3.2.2 yamt
81 1.3.2.2 yamt typedef struct
82 1.3.2.2 yamt {
83 1.3.2.2 yamt uint32_t volume;
84 1.3.2.2 yamt uint32_t dest;
85 1.3.2.2 yamt
86 1.3.2.2 yamt } VC_AUDIO_CONTROL_T;
87 1.3.2.2 yamt
88 1.3.2.2 yamt // audio
89 1.3.2.2 yamt typedef struct
90 1.3.2.2 yamt {
91 1.3.2.2 yamt uint32_t dummy;
92 1.3.2.2 yamt
93 1.3.2.2 yamt } VC_AUDIO_OPEN_T;
94 1.3.2.2 yamt
95 1.3.2.2 yamt // audio
96 1.3.2.2 yamt typedef struct
97 1.3.2.2 yamt {
98 1.3.2.2 yamt uint32_t dummy;
99 1.3.2.2 yamt
100 1.3.2.2 yamt } VC_AUDIO_CLOSE_T;
101 1.3.2.2 yamt // audio
102 1.3.2.2 yamt typedef struct
103 1.3.2.2 yamt {
104 1.3.2.2 yamt uint32_t dummy;
105 1.3.2.2 yamt
106 1.3.2.2 yamt } VC_AUDIO_START_T;
107 1.3.2.2 yamt // audio
108 1.3.2.2 yamt typedef struct
109 1.3.2.2 yamt {
110 1.3.2.2 yamt uint32_t draining;
111 1.3.2.2 yamt
112 1.3.2.2 yamt } VC_AUDIO_STOP_T;
113 1.3.2.2 yamt
114 1.3.2.2 yamt // configure the write audio samples
115 1.3.2.2 yamt typedef struct
116 1.3.2.2 yamt {
117 1.3.2.2 yamt uint32_t count; // in bytes
118 1.3.2.2 yamt void *callback;
119 1.3.2.2 yamt void *cookie;
120 1.3.2.2 yamt uint16_t silence;
121 1.3.2.2 yamt uint16_t max_packet;
122 1.3.2.2 yamt } VC_AUDIO_WRITE_T;
123 1.3.2.2 yamt
124 1.3.2.2 yamt // Generic result for a request (VC->HOST)
125 1.3.2.2 yamt typedef struct
126 1.3.2.2 yamt {
127 1.3.2.2 yamt int32_t success; // Success value
128 1.3.2.2 yamt
129 1.3.2.2 yamt } VC_AUDIO_RESULT_T;
130 1.3.2.2 yamt
131 1.3.2.2 yamt // Generic result for a request (VC->HOST)
132 1.3.2.2 yamt typedef struct
133 1.3.2.2 yamt {
134 1.3.2.2 yamt int32_t count; // Success value
135 1.3.2.2 yamt void *callback;
136 1.3.2.2 yamt void *cookie;
137 1.3.2.2 yamt } VC_AUDIO_COMPLETE_T;
138 1.3.2.2 yamt
139 1.3.2.2 yamt // Message header for all messages in HOST->VC direction
140 1.3.2.2 yamt typedef struct
141 1.3.2.2 yamt {
142 1.3.2.2 yamt int32_t type; // Message type (VC_AUDIO_MSG_TYPE)
143 1.3.2.2 yamt union
144 1.3.2.2 yamt {
145 1.3.2.2 yamt VC_AUDIO_CONFIG_T config;
146 1.3.2.2 yamt VC_AUDIO_CONTROL_T control;
147 1.3.2.2 yamt VC_AUDIO_OPEN_T open;
148 1.3.2.2 yamt VC_AUDIO_CLOSE_T close;
149 1.3.2.2 yamt VC_AUDIO_START_T start;
150 1.3.2.2 yamt VC_AUDIO_STOP_T stop;
151 1.3.2.2 yamt VC_AUDIO_WRITE_T write;
152 1.3.2.2 yamt VC_AUDIO_RESULT_T result;
153 1.3.2.2 yamt VC_AUDIO_COMPLETE_T complete;
154 1.3.2.2 yamt } u;
155 1.3.2.2 yamt } VC_AUDIO_MSG_T;
156 1.3.2.2 yamt
157 1.3.2.2 yamt
158 1.3.2.2 yamt #endif // _VC_AUDIO_DEFS_H_
159