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