bcm2835_vcaudioreg.h revision 1.4 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 #define VC_AUDIO_WRITE_COOKIE1 MAKE_FOURCC("BCMA")
37 #define VC_AUDIO_WRITE_COOKIE2 MAKE_FOURCC("DATA")
38
39 // Maximum message length
40 #define VC_AUDIO_MAX_MSG_LEN (sizeof( VC_AUDIO_MSG_T ))
41
42 // List of screens that are currently supported
43 // All message types supported for HOST->VC direction
44 typedef enum
45 {
46 VC_AUDIO_MSG_TYPE_RESULT, // Generic result
47 VC_AUDIO_MSG_TYPE_COMPLETE, // playback of samples complete
48 VC_AUDIO_MSG_TYPE_CONFIG, // Configure
49 VC_AUDIO_MSG_TYPE_CONTROL, // control
50 VC_AUDIO_MSG_TYPE_OPEN, // open
51 VC_AUDIO_MSG_TYPE_CLOSE, // close/shutdown
52 VC_AUDIO_MSG_TYPE_START, // start output (i.e. resume)
53 VC_AUDIO_MSG_TYPE_STOP, // stop output (i.e. pause)
54 VC_AUDIO_MSG_TYPE_WRITE, // write samples
55 VC_AUDIO_MSG_TYPE_MAX
56
57 } VC_AUDIO_MSG_TYPE;
58
59 #if 0
60 static const char *vc_audio_msg_type_names[] = {
61 "VC_AUDIO_MSG_TYPE_RESULT",
62 "VC_AUDIO_MSG_TYPE_COMPLETE",
63 "VC_AUDIO_MSG_TYPE_CONFIG",
64 "VC_AUDIO_MSG_TYPE_CONTROL",
65 "VC_AUDIO_MSG_TYPE_OPEN",
66 "VC_AUDIO_MSG_TYPE_CLOSE",
67 "VC_AUDIO_MSG_TYPE_START",
68 "VC_AUDIO_MSG_TYPE_STOP",
69 "VC_AUDIO_MSG_TYPE_WRITE",
70 "VC_AUDIO_MSG_TYPE_MAX"
71 };
72 #endif
73
74 // configure the audio
75 typedef struct
76 {
77 uint32_t channels;
78 uint32_t samplerate;
79 uint32_t bps;
80
81 } VC_AUDIO_CONFIG_T;
82
83 typedef struct
84 {
85 uint32_t volume;
86 uint32_t dest;
87
88 } VC_AUDIO_CONTROL_T;
89
90 // audio
91 typedef struct
92 {
93 uint32_t dummy;
94
95 } VC_AUDIO_OPEN_T;
96
97 // audio
98 typedef struct
99 {
100 uint32_t dummy;
101
102 } VC_AUDIO_CLOSE_T;
103 // audio
104 typedef struct
105 {
106 uint32_t dummy;
107
108 } VC_AUDIO_START_T;
109 // audio
110 typedef struct
111 {
112 uint32_t draining;
113
114 } VC_AUDIO_STOP_T;
115
116 // configure the write audio samples
117 typedef struct
118 {
119 uint32_t count; // in bytes
120 uint32_t cookie1;
121 uint32_t cookie2;
122 uint16_t silence;
123 uint16_t max_packet;
124 } VC_AUDIO_WRITE_T;
125
126 // Generic result for a request (VC->HOST)
127 typedef struct
128 {
129 int32_t success; // Success value
130
131 } VC_AUDIO_RESULT_T;
132
133 // Generic result for a request (VC->HOST)
134 typedef struct
135 {
136 int32_t count; // Success value
137 uint32_t cookie1;
138 uint32_t cookie2;
139 } VC_AUDIO_COMPLETE_T;
140
141 // Message header for all messages in HOST->VC direction
142 typedef struct
143 {
144 int32_t type; // Message type (VC_AUDIO_MSG_TYPE)
145 union
146 {
147 VC_AUDIO_CONFIG_T config;
148 VC_AUDIO_CONTROL_T control;
149 VC_AUDIO_OPEN_T open;
150 VC_AUDIO_CLOSE_T close;
151 VC_AUDIO_START_T start;
152 VC_AUDIO_STOP_T stop;
153 VC_AUDIO_WRITE_T write;
154 VC_AUDIO_RESULT_T result;
155 VC_AUDIO_COMPLETE_T complete;
156 } u;
157 } VC_AUDIO_MSG_T;
158
159
160 #endif // _VC_AUDIO_DEFS_H_
161