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