Path: blob/main/sys/arm/broadcom/bcm2835/vc_vchi_audioserv_defs.h
39566 views
/*1* Copyright (c) 2012, Broadcom Europe Ltd2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions are met:6* 1. Redistributions of source code must retain the above copyright7* notice, this list of conditions and the following disclaimer.8* 2. Redistributions in binary form must reproduce the above copyright9* notice, this list of conditions and the following disclaimer in the10* documentation and/or other materials provided with the distribution.11* 3. Neither the name of the copyright holder nor the12* names of its contributors may be used to endorse or promote products13* derived from this software without specific prior written permission.14*15* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE18* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.25*/2627#ifndef _VC_AUDIO_DEFS_H_28#define _VC_AUDIO_DEFS_H_2930#define VC_AUDIOSERV_MIN_VER 131#define VC_AUDIOSERV_VER 23233/* FourCC code used for VCHI connection */34#define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS")3536/* Maximum message length */37#define VC_AUDIO_MAX_MSG_LEN (sizeof( VC_AUDIO_MSG_T ))3839/*40* List of screens that are currently supported41* All message types supported for HOST->VC direction42*/43typedef enum44{45VC_AUDIO_MSG_TYPE_RESULT, /* Generic result */46VC_AUDIO_MSG_TYPE_COMPLETE, /* playback of samples complete */47VC_AUDIO_MSG_TYPE_CONFIG, /* Configure */48VC_AUDIO_MSG_TYPE_CONTROL, /* control */49VC_AUDIO_MSG_TYPE_OPEN, /* open */50VC_AUDIO_MSG_TYPE_CLOSE, /* close/shutdown */51VC_AUDIO_MSG_TYPE_START, /* start output (i.e. resume) */52VC_AUDIO_MSG_TYPE_STOP, /* stop output (i.e. pause) */53VC_AUDIO_MSG_TYPE_WRITE, /* write samples */54VC_AUDIO_MSG_TYPE_MAX5556} VC_AUDIO_MSG_TYPE;5758static 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};7071/* configure the audio */72typedef struct73{74uint32_t channels;75uint32_t samplerate;76uint32_t bps;7778} VC_AUDIO_CONFIG_T;7980typedef struct81{82uint32_t volume;83uint32_t dest;8485} VC_AUDIO_CONTROL_T;8687typedef struct88{89uint32_t dummy;9091} VC_AUDIO_OPEN_T;9293typedef struct94{95uint32_t dummy;9697} VC_AUDIO_CLOSE_T;9899typedef struct100{101uint32_t dummy;102103} VC_AUDIO_START_T;104105typedef struct106{107uint32_t draining;108109} VC_AUDIO_STOP_T;110111typedef struct112{113uint32_t count; /* in bytes */114void *callback;115void *cookie;116uint16_t silence;117uint16_t max_packet;118} VC_AUDIO_WRITE_T;119120/* Generic result for a request (VC->HOST) */121typedef struct122{123int32_t success; /* Success value */124125} VC_AUDIO_RESULT_T;126127/* Generic result for a request (VC->HOST) */128typedef struct129{130int32_t count; /* Success value */131void *callback;132void *cookie;133} VC_AUDIO_COMPLETE_T;134135/* Message header for all messages in HOST->VC direction */136typedef struct137{138int32_t type; /* Message type (VC_AUDIO_MSG_TYPE) */139union140{141VC_AUDIO_CONFIG_T config;142VC_AUDIO_CONTROL_T control;143VC_AUDIO_OPEN_T open;144VC_AUDIO_CLOSE_T close;145VC_AUDIO_START_T start;146VC_AUDIO_STOP_T stop;147VC_AUDIO_WRITE_T write;148VC_AUDIO_RESULT_T result;149VC_AUDIO_COMPLETE_T complete;150} u;151} VC_AUDIO_MSG_T;152153#endif /* _VC_AUDIO_DEFS_H_ */154155156