FreeCalypso > hg > fc-selenite
comparison src/cs/services/Audio/audio_structs_i.h @ 0:b6a5e36de839
src/cs: initial import from Magnetite
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sun, 15 Jul 2018 04:39:26 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:b6a5e36de839 |
|---|---|
| 1 /********************************************************************************/ | |
| 2 /* */ | |
| 3 /* File Name: audio_structs_i.h */ | |
| 4 /* */ | |
| 5 /* Purpose: This file contains constants, data type, and data */ | |
| 6 /* structures that are used by the AUDIO's task. */ | |
| 7 /* */ | |
| 8 /* Note: */ | |
| 9 /* None. */ | |
| 10 /* */ | |
| 11 /* Revision History: */ | |
| 12 /* 11 May 01 Francois Mazard - Stephanie Gerthoux Create */ | |
| 13 /* */ | |
| 14 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved. */ | |
| 15 /* */ | |
| 16 /********************************************************************************/ | |
| 17 #include "rv/rv_defined_swe.h" | |
| 18 #ifdef RVM_AUDIO_MAIN_SWE | |
| 19 #ifndef _AUDIO_STRUCTS_I_ | |
| 20 #define _AUDIO_STRUCTS_I_ | |
| 21 | |
| 22 #ifndef _WINDOWS | |
| 23 #include "config/sys.cfg" | |
| 24 #include "config/chipset.cfg" | |
| 25 #endif | |
| 26 #include "l1_confg.h" | |
| 27 #include "rvm/rvm_gen.h" | |
| 28 #include "audio/audio_features_i.h" | |
| 29 #include "audio/audio_ffs_i.h" | |
| 30 #include "audio/audio_const_i.h" | |
| 31 | |
| 32 #include "ffs/ffs_api.h" | |
| 33 | |
| 34 #ifdef __cplusplus | |
| 35 extern "C" | |
| 36 { | |
| 37 #endif | |
| 38 | |
| 39 /****************************** AUDIO'S ENVIRONMENT *****************************/ | |
| 40 /* Define a structure used to store all information related to the AUDIO's task */ | |
| 41 /* & memory bank identifiers. */ | |
| 42 | |
| 43 #if (KEYBEEP) | |
| 44 typedef struct | |
| 45 { | |
| 46 UINT8 state; /* keybeep state */ | |
| 47 T_RVF_ADDR_ID task_id; /* keybeep task_id */ | |
| 48 T_RV_RETURN return_path; /* return path of the function that previously start the keybeep */ | |
| 49 } T_AUDIO_KEYBEEP_VAR; | |
| 50 #endif /* #if (KEYBEEP) */ | |
| 51 | |
| 52 #if (TONE) | |
| 53 typedef struct | |
| 54 { | |
| 55 UINT8 state; /* tones state */ | |
| 56 T_RVF_ADDR_ID task_id; /* tones task_id */ | |
| 57 T_RV_RETURN return_path; /* return path of the function that previously start the tones */ | |
| 58 } T_AUDIO_TONES_VAR; | |
| 59 #endif | |
| 60 | |
| 61 #if (MELODY_E1) | |
| 62 typedef struct | |
| 63 { | |
| 64 UINT8 state; /* melody state */ | |
| 65 T_RVF_ADDR_ID task_id; /* melody task_id */ | |
| 66 char melody_name[AUDIO_PATH_NAME_MAX_SIZE]; /* name and path of the word to enroll */ | |
| 67 BOOLEAN loopback; | |
| 68 T_RV_RETURN return_path; /* return path of the function that previously start the melody */ | |
| 69 } T_AUDIO_MELODY_E1_VAR; | |
| 70 #endif | |
| 71 | |
| 72 #if (MELODY_E2) | |
| 73 typedef struct | |
| 74 { | |
| 75 UINT8 state; /* melody state */ | |
| 76 T_RVF_ADDR_ID task_id; /* melody task_id */ | |
| 77 char melody_name[AUDIO_PATH_NAME_MAX_SIZE]; /* name of the melody E2 */ | |
| 78 BOOLEAN loopback; | |
| 79 T_RV_RETURN return_path; /* return path of the function that previously start the melody */ | |
| 80 } T_AUDIO_MELODY_E2_VAR; | |
| 81 | |
| 82 typedef struct | |
| 83 { | |
| 84 BOOLEAN file_downloaded; | |
| 85 UINT8 nb_of_instruments; | |
| 86 char instrument_file_name[AUDIO_PATH_NAME_MAX_SIZE]; | |
| 87 } T_AUDIO_MELODY_E2_LOAD_FILE_VAR; | |
| 88 | |
| 89 typedef struct | |
| 90 { | |
| 91 INT8 id; /* id of the melody in the .lsi file*/ | |
| 92 char melody_name[AUDIO_PATH_NAME_MAX_SIZE]; /* name of the melody E2 */ | |
| 93 | |
| 94 } T_AUDIO_MELODY_E2_ID_NAME; | |
| 95 | |
| 96 | |
| 97 #endif | |
| 98 | |
| 99 | |
| 100 #if (VOICE_MEMO) | |
| 101 typedef struct | |
| 102 { | |
| 103 UINT8 state; /* voice memo state */ | |
| 104 T_RVF_ADDR_ID task_id; /* voice memo task_id */ | |
| 105 UINT32 recorded_size; /* voice memo recorded size */ | |
| 106 T_RV_RETURN return_path; /* return path of the function that previously start the voice memo */ | |
| 107 void *p_l1_send_message; /* address to the message to send to the L1 */ | |
| 108 } T_AUDIO_VOICE_MEMO_RECORD_VAR; | |
| 109 | |
| 110 typedef struct | |
| 111 { | |
| 112 UINT8 state; /* voice memo state */ | |
| 113 T_RVF_ADDR_ID task_id; /* voice memo task_id */ | |
| 114 T_RV_RETURN return_path; /* return path of the function that previously start the voice memo */ | |
| 115 } T_AUDIO_VOICE_MEMO_PLAY_VAR; | |
| 116 | |
| 117 #endif | |
| 118 | |
| 119 #if (L1_VOICE_MEMO_AMR) | |
| 120 typedef struct | |
| 121 { | |
| 122 UINT8 state; /* voice memo state */ | |
| 123 T_RV_RETURN return_path; /* return path of the function that previously start the voice memo */ | |
| 124 UINT8 channel_id; | |
| 125 #if (AUDIO_NEW_FFS_MANAGER) | |
| 126 T_FFS_FD ffs_fd; | |
| 127 #endif | |
| 128 #if (AUDIO_RAM_MANAGER) | |
| 129 UINT8 *audio_ram_fd; | |
| 130 #endif | |
| 131 } T_AUDIO_VOICE_MEMO_AMR_RECORD_TO_MEM_VAR; | |
| 132 | |
| 133 typedef struct | |
| 134 { | |
| 135 UINT8 state; /* voice memo state */ | |
| 136 T_RV_RETURN return_path; /* return path of the function that previously start the voice memo */ | |
| 137 UINT8 channel_id; | |
| 138 #if (AUDIO_NEW_FFS_MANAGER) | |
| 139 T_FFS_FD ffs_fd; | |
| 140 #endif | |
| 141 #if (AUDIO_RAM_MANAGER) | |
| 142 UINT8 *audio_ram_fd; | |
| 143 UINT16 audio_ram_size; | |
| 144 #endif | |
| 145 } T_AUDIO_VOICE_MEMO_AMR_PLAY_FROM_MEM_VAR; | |
| 146 #endif | |
| 147 | |
| 148 #if (MELODY_E1) || (MELODY_E2) || (VOICE_MEMO) | |
| 149 | |
| 150 typedef struct | |
| 151 { | |
| 152 UINT8 *p_start_pointer; | |
| 153 UINT8 *p_stop_pointer; | |
| 154 UINT16 size; | |
| 155 } T_AUDIO_FFS_BUFFER_INFO; | |
| 156 | |
| 157 typedef struct | |
| 158 { | |
| 159 /* validity of the session: */ | |
| 160 /* 0: this session isn't started */ | |
| 161 /* 1: this session is running */ | |
| 162 BOOLEAN valid_channel; | |
| 163 /* file descriptor */ | |
| 164 T_FFS_FD audio_ffs_fd; | |
| 165 /*initial size requested before to start the L1 */ | |
| 166 UINT16 size; | |
| 167 /* loop mode is used or not during this session */ | |
| 168 BOOLEAN loop_mode; | |
| 169 /* mode of the session: */ | |
| 170 /* 0: FLASH to RAM download */ | |
| 171 /* 1: RAM to FLASH download */ | |
| 172 BOOLEAN session_mode; | |
| 173 UINT8 session_id; | |
| 174 } T_AUDIO_FFS_SESSION_REQ; | |
| 175 | |
| 176 typedef struct | |
| 177 { | |
| 178 /* index of the next buffer will be used by the L1 */ | |
| 179 UINT8 index_l1; | |
| 180 /* index of the current buffer used by the FFS */ | |
| 181 UINT8 index_ffs; | |
| 182 T_AUDIO_FFS_BUFFER_INFO buffer[AUDIO_MAX_FFS_BUFFER_PER_SESSION]; | |
| 183 /* state of the cust_get_pointer function */ | |
| 184 UINT8 cust_get_pointer_state; | |
| 185 } T_AUDIO_FFS_SESSION_INFO; | |
| 186 | |
| 187 typedef struct | |
| 188 { | |
| 189 /* Request of the current session */ | |
| 190 T_AUDIO_FFS_SESSION_REQ session_req; | |
| 191 /* information of the current session */ | |
| 192 T_AUDIO_FFS_SESSION_INFO session_info; | |
| 193 } T_AUDIO_FFS_SESSION; | |
| 194 #endif | |
| 195 | |
| 196 #if (AUDIO_MEM_MANAGER) | |
| 197 typedef struct | |
| 198 { | |
| 199 // file or RAM buffer descriptor | |
| 200 #if (AUDIO_NEW_FFS_MANAGER) | |
| 201 T_FFS_FD audio_ffs_fd; | |
| 202 #endif | |
| 203 #if (AUDIO_RAM_MANAGER) | |
| 204 UINT8 *audio_ram_fd; | |
| 205 UINT16 audio_ram_size; | |
| 206 #endif | |
| 207 | |
| 208 // size of temporary RAM buffers (8-bit unit) | |
| 209 UINT16 size; | |
| 210 | |
| 211 // session_id and channel_id to identify feature | |
| 212 UINT8 session_id; | |
| 213 UINT8 channel_id; | |
| 214 } T_AUDIO_MEM_SESSION_REQ; | |
| 215 | |
| 216 typedef struct | |
| 217 { | |
| 218 UINT8 state; // state machine | |
| 219 UINT8 size_left; // sample split between 2 RAM buffers | |
| 220 UINT8 previous_type; // last sample type processed | |
| 221 UINT32 recorded_size; /* voice memo recorded size */ | |
| 222 BOOL stop_req_allowed;// TRUE first then FALSE | |
| 223 } T_AUDIO_MEM_SESSION_INFO; | |
| 224 | |
| 225 typedef struct | |
| 226 { | |
| 227 /* Request of the current session */ | |
| 228 T_AUDIO_MEM_SESSION_REQ session_req; | |
| 229 /* information of the current session */ | |
| 230 T_AUDIO_MEM_SESSION_INFO session_info; | |
| 231 } T_AUDIO_MEM_SESSION; | |
| 232 #endif | |
| 233 | |
| 234 #if (MELODY_E1) || (MELODY_E2) || (VOICE_MEMO) | |
| 235 | |
| 236 typedef struct | |
| 237 { | |
| 238 UINT8 *p_start_pointer; | |
| 239 UINT16 size; | |
| 240 } T_AUDIO_DRIVER_BUFFER_INFO; | |
| 241 | |
| 242 typedef struct | |
| 243 { | |
| 244 UINT16 size; // initial size requested before to start the L1 | |
| 245 UINT8 nb_buffer; // nb buffer | |
| 246 UINT8 session_id; | |
| 247 void *p_l1_send_message; /* address to the message to send to the L1 */ | |
| 248 T_RV_RETURN return_path; | |
| 249 } T_AUDIO_DRIVER_SESSION_REQ; | |
| 250 | |
| 251 typedef struct | |
| 252 { | |
| 253 UINT8 index_l1; // index of the next buffer will be used by the L1 | |
| 254 UINT8 index_appli; // index of the current buffer used by the FFS | |
| 255 | |
| 256 T_AUDIO_DRIVER_BUFFER_INFO *buffer; // pointers on temporary RAM buffers | |
| 257 | |
| 258 UINT8 state; | |
| 259 UINT8 play_api_state;// only play | |
| 260 UINT8 stop_request;// 0 first then 1 when stop request | |
| 261 } T_AUDIO_DRIVER_SESSION_INFO; | |
| 262 | |
| 263 typedef struct | |
| 264 { | |
| 265 /* Request of the current session */ | |
| 266 T_AUDIO_DRIVER_SESSION_REQ session_req; | |
| 267 /* information of the current session */ | |
| 268 T_AUDIO_DRIVER_SESSION_INFO session_info; | |
| 269 } T_AUDIO_DRIVER_SESSION; | |
| 270 #endif | |
| 271 | |
| 272 #if (SPEECH_RECO) | |
| 273 typedef struct | |
| 274 { | |
| 275 /* enroll speech reco state */ | |
| 276 UINT8 state; | |
| 277 /* voice sample file descriptor */ | |
| 278 T_FFS_FD voice_ffs_fd; | |
| 279 /* speech reco sample file descriptor */ | |
| 280 T_FFS_FD sr_ffs_fd; | |
| 281 /* task_id */ | |
| 282 UINT16 task_id; | |
| 283 /* Speech buffer address */ | |
| 284 void *p_speech_address; | |
| 285 /* return path of the function that previously start the sppeech reco */ | |
| 286 T_RV_RETURN return_path; | |
| 287 } T_AUDIO_SR_ENROLL_VAR; | |
| 288 | |
| 289 typedef struct | |
| 290 { | |
| 291 /* update speech reco state */ | |
| 292 UINT8 state; | |
| 293 /* task_id */ | |
| 294 UINT16 task_id; | |
| 295 /* Speech buffer address */ | |
| 296 void *p_speech_address; | |
| 297 /* Temporary model buffer address */ | |
| 298 void *p_model_address; | |
| 299 /* vocabulary size */ | |
| 300 UINT8 vocabulary_size; | |
| 301 /* model index to update */ | |
| 302 UINT8 model_index; | |
| 303 /* flag to mention if the speech must be recorded */ | |
| 304 BOOL record_speech; | |
| 305 /* return path of the function that previously start the sppeech reco */ | |
| 306 T_RV_RETURN return_path; | |
| 307 /* pointer to the vocabulary database */ | |
| 308 void *p_database; | |
| 309 } T_AUDIO_SR_UPDATE_VAR; | |
| 310 | |
| 311 typedef struct | |
| 312 { | |
| 313 /* update speech reco state */ | |
| 314 UINT8 state; | |
| 315 /* task_id */ | |
| 316 UINT16 task_id; | |
| 317 /* vocabulary size */ | |
| 318 UINT8 vocabulary_size; | |
| 319 /* return path of the function that previously start the sppeech reco */ | |
| 320 T_RV_RETURN return_path; | |
| 321 /* pointer to the vocabulary database */ | |
| 322 void *p_database; | |
| 323 } T_AUDIO_SR_RECO_VAR; | |
| 324 | |
| 325 typedef struct | |
| 326 { | |
| 327 /* speech reco enroll variables */ | |
| 328 T_AUDIO_SR_ENROLL_VAR sr_enroll; | |
| 329 T_AUDIO_SR_UPDATE_VAR sr_update; | |
| 330 T_AUDIO_SR_RECO_VAR sr_reco; | |
| 331 } T_AUDIO_SPEECH_RECO_VAR; | |
| 332 #endif | |
| 333 | |
| 334 #if (L1_MIDI==1) | |
| 335 typedef struct | |
| 336 { | |
| 337 UINT8 state; // midi state | |
| 338 T_RV_RETURN return_path; // return path of the function that previously started midi | |
| 339 UINT8 channel_id; | |
| 340 UINT16 size; | |
| 341 T_FFS_FD ffs_fd; | |
| 342 BOOL stop_req_allowed; | |
| 343 #ifdef _WINDOWS | |
| 344 UINT8 l1_state; | |
| 345 INT16 counter; | |
| 346 #endif | |
| 347 } T_AUDIO_MIDI_VAR; | |
| 348 #endif | |
| 349 | |
| 350 | |
| 351 /* audio configuration variable */ | |
| 352 typedef struct | |
| 353 { | |
| 354 /* full access write state */ | |
| 355 UINT8 state; | |
| 356 /* Number of message to receive */ | |
| 357 UINT8 number_of_message; | |
| 358 /* address to the data buffer */ | |
| 359 void *buffer; | |
| 360 /* flag to know if the data buffer need to be deallocate or not */ | |
| 361 BOOLEAN deallocate_buffer; | |
| 362 /* return path of the function that previously start the full access write */ | |
| 363 T_RV_RETURN return_path; | |
| 364 } | |
| 365 T_AUDIO_FULL_ACCESS_WRITE_VAR; | |
| 366 | |
| 367 typedef struct | |
| 368 { | |
| 369 /* state of the audio mode load state machine */ | |
| 370 UINT8 state; | |
| 371 /* Number of message to receive */ | |
| 372 UINT8 number_of_message; | |
| 373 /* pointer to the RAM buffer */ | |
| 374 T_AUDIO_MODE *p_audio_mode; | |
| 375 /* return path */ | |
| 376 T_RV_RETURN return_path; | |
| 377 } | |
| 378 T_AUDIO_MODE_LOAD_VAR; | |
| 379 | |
| 380 typedef struct | |
| 381 { | |
| 382 char audio_volume_path_name[AUDIO_PATH_NAME_MAX_SIZE]; | |
| 383 } | |
| 384 T_AUDIO_VOLUME_VAR; | |
| 385 | |
| 386 typedef struct | |
| 387 { | |
| 388 T_AUDIO_FULL_ACCESS_WRITE_VAR full_access_write_var; | |
| 389 T_AUDIO_MODE_LOAD_VAR audio_mode_load_var; | |
| 390 T_AUDIO_VOLUME_VAR audio_volume_var; | |
| 391 } T_AUDIO_MODE_VAR; | |
| 392 | |
| 393 typedef struct | |
| 394 { | |
| 395 T_RVF_ADDR_ID addrId; /* AUDIO address ID. */ | |
| 396 T_RVF_ADDR_ID audio_ffs_addrId; /* AUDIO FFS manager address ID. */ | |
| 397 | |
| 398 T_RVF_MB_ID mb_internal; /* AUDIO internal memory bank. */ | |
| 399 T_RVF_MB_ID mb_external; /* AUDIO external memory bank. */ | |
| 400 T_RVF_MB_ID mb_audio_ffs; /* AUDIO FFS memory bank */ | |
| 401 T_RVM_RETURN (*callBackFct) (T_RVM_NAME SWEntName, | |
| 402 T_RVM_RETURN errorCause, | |
| 403 T_RVM_ERROR_TYPE errorType, | |
| 404 T_RVM_STRING errorMsg); | |
| 405 | |
| 406 BOOLEAN message_processed; | |
| 407 | |
| 408 #if (KEYBEEP) | |
| 409 /* Keybeep global variable */ | |
| 410 T_AUDIO_KEYBEEP_VAR keybeep; | |
| 411 #endif | |
| 412 #if (TONE) | |
| 413 /* Tones global variable */ | |
| 414 T_AUDIO_TONES_VAR tones; | |
| 415 #endif | |
| 416 #if (MELODY_E1) | |
| 417 /* Melody_E1 global variable */ | |
| 418 BOOLEAN melody_E1_mode; | |
| 419 T_AUDIO_MELODY_E1_VAR melody_E1_0; | |
| 420 T_AUDIO_MELODY_E1_VAR melody_E1_1; | |
| 421 #endif | |
| 422 #if (MELODY_E2) | |
| 423 /* Melody_E2 global variable */ | |
| 424 BOOLEAN melody_E2_mode; | |
| 425 T_AUDIO_MELODY_E2_VAR melody_E2_0; | |
| 426 T_AUDIO_MELODY_E2_VAR melody_E2_1; | |
| 427 T_AUDIO_MELODY_E2_LOAD_FILE_VAR melody_E2_load_file_instruments; | |
| 428 #endif | |
| 429 #if (VOICE_MEMO) | |
| 430 /* Voice Memo global variable */ | |
| 431 T_AUDIO_VOICE_MEMO_PLAY_VAR vm_play; | |
| 432 T_AUDIO_VOICE_MEMO_RECORD_VAR vm_record; | |
| 433 #endif | |
| 434 #if (L1_VOICE_MEMO_AMR) | |
| 435 /* Voice Memo global variable */ | |
| 436 T_AUDIO_VOICE_MEMO_AMR_RECORD_TO_MEM_VAR audio_vm_amr_record; | |
| 437 T_AUDIO_VOICE_MEMO_AMR_PLAY_FROM_MEM_VAR audio_vm_amr_play; | |
| 438 #endif | |
| 439 #if (SPEECH_RECO) | |
| 440 /* Speech reco global variable */ | |
| 441 T_AUDIO_SPEECH_RECO_VAR speech_reco; | |
| 442 #endif | |
| 443 | |
| 444 #if (L1_MIDI==1) | |
| 445 // Midi global variable | |
| 446 T_AUDIO_MIDI_VAR midi; | |
| 447 #endif | |
| 448 | |
| 449 /* audio mode variable */ | |
| 450 T_AUDIO_MODE_VAR audio_mode_var; | |
| 451 | |
| 452 #if (MELODY_E1) ||(MELODY_E2) || (VOICE_MEMO) | |
| 453 /* Audio FFS global variable */ | |
| 454 T_AUDIO_FFS_SESSION audio_ffs_session[AUDIO_FFS_MAX_CHANNEL]; | |
| 455 #endif | |
| 456 #if (AUDIO_MEM_MANAGER) | |
| 457 T_AUDIO_MEM_SESSION audio_mem_session[AUDIO_MEM_MAX_CHANNEL]; | |
| 458 #endif | |
| 459 #if (MELODY_E1) ||(MELODY_E2) || (VOICE_MEMO) || (L1_VOICE_MEMO_AMR) | |
| 460 /* Audio FFS global variable */ | |
| 461 T_AUDIO_DRIVER_SESSION audio_driver_session[AUDIO_DRIVER_MAX_CHANNEL]; | |
| 462 #endif | |
| 463 } | |
| 464 T_AUDIO_ENV_CTRL_BLK; | |
| 465 | |
| 466 #ifdef __cplusplus | |
| 467 } | |
| 468 #endif | |
| 469 #endif /* _AUDIO_STRUCTS_I_ */ | |
| 470 #endif /* #ifdef RVM_AUDIO_MAIN_SWE */ |
