| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef _REPORTING_H |
| 24 |
#define _REPORTING_H |
| 25 |
#include "dsp-protocol.h" |
| 26 |
|
| 27 |
#ifdef DEBUG |
| 28 |
const char *dsp_commands[] = { |
| 29 |
"DSP_CMD_NONE", "No command", |
| 30 |
"DSP_CMD_INIT", "Informs the DSP that the following data is" |
| 31 |
"about initialisation", |
| 32 |
"DSP_CMD_SET_PARAMS", "Informs the DSP that the following " |
| 33 |
"data is parameters", |
| 34 |
"DSP_CMD_DATA_WRITE", "Informs the DSP that the following " |
| 35 |
"data is general data (compressed " "or raw audio or video)", |
| 36 |
"DSP_CMD_PLAY", "Starts audio or video playback or recording", |
| 37 |
"DSP_CMD_PAUSE", "Pauses playback", |
| 38 |
"DSP_CMD_STOP", "Stops playback", |
| 39 |
"DSP_CMD_SET_VOLUME", "Informs the DSP that the following " |
| 40 |
"data is volume", |
| 41 |
"DSP_CMD_STATE", "Requests from the DSP to send information" |
| 42 |
" about current task node state", |
| 43 |
"DSP_CMD_SET_TIME", "Informs the DSP that the following data" |
| 44 |
" is about setting the current" " presentation time", |
| 45 |
"DSP_CMD_GET_TIME", "Informs the DSP that the ARM queries the" |
| 46 |
" current presentation time", |
| 47 |
"ERROR", "This is unused!!!!!", |
| 48 |
"DSP_CMD_SET_POSTPROC", "Informs the DSP that the following data" |
| 49 |
" is about setting video post-processing " "parameters", |
| 50 |
"DSP_CMD_SET_PANNING", "Informs the DSP that the following data " |
| 51 |
"is about setting the panning", |
| 52 |
"DSP_CMD_DISCONT", "Informs the DSP about discontinuity in the " |
| 53 |
"audio stream", |
| 54 |
"DSP_CMD_MUTE", "Mutes the audio playback", |
| 55 |
"DSP_CMD_UNMUTE", "Unmutes the audio playback", |
| 56 |
"ERROR", "This is unused!!!!!", |
| 57 |
"ERROR", "This is unused!!!!!", |
| 58 |
"ERROR", "This is unused!!!!!", |
| 59 |
"DSP_CMD_CLOSE", "Closes the task node" |
| 60 |
}; |
| 61 |
|
| 62 |
const char *dsp_return_values[] = { |
| 63 |
"DSP_NONE", "Error. This isn't a valid return value", |
| 64 |
"DSP_OK", "Operation successful", |
| 65 |
"DSP_ERROR_CMD", "Unrecognised or unsupported command value", |
| 66 |
"DSP_ERROR_FMT", "Unrecognised or unsupported audio format value", |
| 67 |
"DSP_ERROR_RATE", "Unrecognised or unsupported sampling rate value", |
| 68 |
"DSP_ERROR_CHANNELS", "Unrecognised or unsupported number of channels", |
| 69 |
"DSP_ERROR_DS_id", "Destination/source stream id out of range", |
| 70 |
"DSP_ERROR_MEMORY", "Insufficient memory to perform requested action", |
| 71 |
"DSP_ERROR_GENERAL", "Unspecified error", |
| 72 |
"DSP_ERROR_STREAM", "Error in stream (audio or video)", |
| 73 |
"DSP_ERROR_STATE", "Unexpected task node state", |
| 74 |
"DSP_ERROR_SYNC", "Error in synchronisation:" |
| 75 |
"For MP3 – synchronisation marker not found" |
| 76 |
}; |
| 77 |
|
| 78 |
const char *dsp_states[] = { |
| 79 |
"STATE_INITIALISED", "Initialised", |
| 80 |
"STATE_PLAYING", "Playing/recording", |
| 81 |
"STATE_STOPPED", "Stopped", |
| 82 |
"STATE_PAUSED", "Paused", |
| 83 |
"STATE_UNINITIALISED", "Not initialised", |
| 84 |
"STATE_RESET", "Reseted", |
| 85 |
"STATE_MUTED", "Muted" |
| 86 |
}; |
| 87 |
|
| 88 |
const char *dsp_rates[] = { |
| 89 |
"SAMPLE_RATE_96KHZ", "96KHz sampling rate", |
| 90 |
"SAMPLE_RATE_88_2KHZ", "88.2KHz sampling rate", |
| 91 |
"SAMPLE_RATE_64KHZ", "64KHz sampling rate", |
| 92 |
"SAMPLE_RATE_48KHZ", "48KHz sampling rate", |
| 93 |
"SAMPLE_RATE_44_1KHZ", "44.1KHz sampling rate", |
| 94 |
"SAMPLE_RATE_32KHZ", "32KHz sampling rate", |
| 95 |
"SAMPLE_RATE_24KHZ", "24KHz sampling rate", |
| 96 |
"SAMPLE_RATE_22_05KHZ", "22.05KHz sampling rate", |
| 97 |
"SAMPLE_RATE_16KHZ", "16KHz sampling rate", |
| 98 |
"SAMPLE_RATE_12KHZ", "12KHz sampling rate", |
| 99 |
"SAMPLE_RATE_11_025KHZ", "11.025KHz sampling rate", |
| 100 |
"SAMPLE_RATE_8KHZ", "8KHz sampling rate", |
| 101 |
"SAMPLE_RATE_5_5125KHZ", "5.5125Khz sampling rate" |
| 102 |
}; |
| 103 |
|
| 104 |
const char *dsp_channels[] = { |
| 105 |
"0--", "Error - No channel!", |
| 106 |
"CHANNELS_1", "One channel (mono)", |
| 107 |
"CHANNELS_2", "Two channels (stereo)" |
| 108 |
}; |
| 109 |
|
| 110 |
const char *dsp_audio_fmt[] = { |
| 111 |
"0", "Error No format!!!", |
| 112 |
"DSP_AFMT_U8", "Unsigned 8 bits per sample PCM", |
| 113 |
"DSP_AFMT_S16_LE", "Signed 16 bits per sample PCM, little endian", |
| 114 |
"DSP_AFMT_S16_BE", "Signed 16 bits per sample PCM, big endian", |
| 115 |
"DSP_AFMT_S8", "Signed 8 bits per sample PCM", |
| 116 |
"DSP_AFMT_U16_LE", "Unsigned 16 bits per sample PCM, little endian", |
| 117 |
"DSP_AFMT_U16_BE", "Unsigned 16 bits per sample PCM, big endian", |
| 118 |
"DSP_AFMT_ALAW", "A-law encoded PCM", |
| 119 |
"DSP_AFMT_ULAW", "μ-Law encoded PCM", |
| 120 |
"DSP_AFMT_MP3", "MP3 stream", |
| 121 |
"DSP_AFMT_AAC", "AAC stream", |
| 122 |
"DSP_AFMT_AMR", "AMR stream", |
| 123 |
"DSP_AFMT_MP2", "MP2 stream", |
| 124 |
"DSP_AFMT_ILBC", "iLBC stream", |
| 125 |
"DSP_AFMT_G729", "G.729 stream" |
| 126 |
}; |
| 127 |
|
| 128 |
#define ARRAY_SIZE(ary) (sizeof(ary)/sizeof(ary[0])) |
| 129 |
#define report_table(mens,name,value,table)\ |
| 130 |
do{\ |
| 131 |
if ((unsigned)value >= ARRAY_SIZE(table))\ |
| 132 |
DPRINT("%s: %d isnt a valid %s value\n",mens,\ |
| 133 |
value,name);\ |
| 134 |
else\ |
| 135 |
DPRINT("%s: [%d|%s] - %s\n", mens, value, \ |
| 136 |
table[value * 2], \ |
| 137 |
table[value * 2 + 1]);\ |
| 138 |
}while(0) |
| 139 |
|
| 140 |
#define report_command(m,v) report_table(m,"command",v,\ |
| 141 |
dsp_commands) |
| 142 |
#define report_return_value(m,v) report_table(m,"return",v,\ |
| 143 |
dsp_return_values) |
| 144 |
#define report_state(m,v) report_table(m,"state",v,\ |
| 145 |
dsp_states) |
| 146 |
#define report_sample_rate(m,v) report_table(m,"sample rate",v,\ |
| 147 |
dsp_rates) |
| 148 |
#define report_number_channels(m,v) report_table(m,"number of channels",v,\ |
| 149 |
dsp_channels) |
| 150 |
#define report_audio_fmt(m,v) report_table(m,"audio format",v,\ |
| 151 |
dsp_audio_fmt) |
| 152 |
#define report_dsp_protocol(m,dp)\ |
| 153 |
do{\ |
| 154 |
DPRINT("%s:\n"\ |
| 155 |
"fd: %d\n"\ |
| 156 |
"stream_id: %d\n"\ |
| 157 |
"bridge_buffer_size: %d\n"\ |
| 158 |
"mmap_buffer_size: %d\n"\ |
| 159 |
"mmap_buffer: %p\n",\ |
| 160 |
m,\ |
| 161 |
dp->fd,\ |
| 162 |
dp->stream_id,\ |
| 163 |
dp->bridge_buffer_size,\ |
| 164 |
dp->mmap_buffer_size,\ |
| 165 |
dp->mmap_buffer);\ |
| 166 |
report_state("state", dp->state);\ |
| 167 |
}while(0) |
| 168 |
|
| 169 |
#define report_audio_status_info(m, asi)\ |
| 170 |
do{\ |
| 171 |
DPRINT("%s\n", m);\ |
| 172 |
DPRINT("***** Audio status info *****\n");\ |
| 173 |
report_command("\tdsp_cmd", asi.dsp_cmd);\ |
| 174 |
DPRINT("\tstream_id: %d\n", asi.stream_id);\ |
| 175 |
DPRINT("\tds_stream_id: %d\n", asi.ds_stream_id);\ |
| 176 |
DPRINT("\tbridge_buffer_size: %d\n", asi.bridge_buffer_size);\ |
| 177 |
DPRINT("\tmmap_buffer_size: %d\n", asi.mmap_buffer_size);\ |
| 178 |
report_state("\tstatus", asi.status);\ |
| 179 |
DPRINT("\tnum_frames: %d\n", asi.num_frames);\ |
| 180 |
report_sample_rate("\tsample_rate", asi.sample_rate);\ |
| 181 |
report_number_channels("\tnumber_channels", \ |
| 182 |
asi.number_channels);\ |
| 183 |
DPRINT("\tvol_scale: %d\n", asi.vol_scale);\ |
| 184 |
DPRINT("\tvol_power2: %d\n", asi.vol_power2);\ |
| 185 |
DPRINT("\tleft_gain: %d\n", asi.left_gain);\ |
| 186 |
DPRINT("\tright_gain: %d\n", asi.right_gain);\ |
| 187 |
report_audio_fmt("\tdsp_audio_fmt", asi.dsp_audio_fmt);\ |
| 188 |
}while(0) |
| 189 |
|
| 190 |
#define report_audio_init_status(m, ais)\ |
| 191 |
do{\ |
| 192 |
DPRINT("%s\n", m);\ |
| 193 |
DPRINT("***** Audio init status *****\n");\ |
| 194 |
report_command("\tdsp_cmd", ais.dsp_cmd);\ |
| 195 |
DPRINT("\tstream_id: %d\n", ais.stream_id);\ |
| 196 |
DPRINT("\tbridge_buffer_size: %d\n", ais.bridge_buffer_size);\ |
| 197 |
DPRINT("\tmmap_buffer_size: %d\n", ais.mmap_buffer_size);\ |
| 198 |
report_return_value("\tinit_status", ais.init_status);\ |
| 199 |
}while(0) |
| 200 |
|
| 201 |
#define report_audio_params(m,ap)\ |
| 202 |
do{\ |
| 203 |
DPRINT("%s\n",m);\ |
| 204 |
DPRINT("**** Audio parameters *****\n");\ |
| 205 |
report_command("\tdsp_cmd",ap.dsp_cmd);\ |
| 206 |
report_audio_fmt("\taudio_format", ap.dsp_audio_fmt);\ |
| 207 |
report_sample_rate("\tsample_rate", ap.sample_rate);\ |
| 208 |
DPRINT("Number of channels %d\n", ap.number_channels);\ |
| 209 |
DPRINT("ds_stream_id: %d\n", ap.ds_stream_id);\ |
| 210 |
DPRINT("stream_priority: %d\n", ap.stream_priority);\ |
| 211 |
}while(0) |
| 212 |
|
| 213 |
#define report_speech_params(m,sp)\ |
| 214 |
do{\ |
| 215 |
DPRINT("%s\n",m);\ |
| 216 |
DPRINT("**** Speech parameters *****\n");\ |
| 217 |
DPRINT("\tdsp_cmd 0x%x\n",sp.dsp_cmd);\ |
| 218 |
report_audio_fmt("\taudio_format", sp.audio_fmt);\ |
| 219 |
report_sample_rate("\tsample_rate", sp.sample_rate);\ |
| 220 |
DPRINT("ds_stream_id: %d\n", sp.ds_stream_id);\ |
| 221 |
DPRINT("stream_priority: %d\n", sp.stream_priority);\ |
| 222 |
DPRINT("frame_size: %d\n", sp.frame_size);\ |
| 223 |
}while(0) |
| 224 |
#else |
| 225 |
|
| 226 |
#define report_command(m,c) |
| 227 |
#define report_return_value(m,c) |
| 228 |
#define report_state(m,c) |
| 229 |
#define report_sample_rate(m,sr) |
| 230 |
#define report_number_channel(m,nc) |
| 231 |
#define report_audio_fmt(m,af) |
| 232 |
#define report_dsp_protocol(m,dp) |
| 233 |
#define report_audio_status_info(m,asi) |
| 234 |
#define report_audio_init_status(m,ais) |
| 235 |
#define report_audio_params(m,ap) |
| 236 |
#define report_speech_params(m,ap) |
| 237 |
|
| 238 |
#endif |
| 239 |
|
| 240 |
#endif |