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