📄 am_hw_primitive_builder_va_vr.cc
字号:
/* (c) Copyright Motorola 1997, 1998, 1999, 2000, 2001, 2002 All rights reserved. Motorola Confidential Proprietary Contains confidential proprietary information of Motorola, Inc. Reverse engineering is prohibited. The copyright notice does not imply publication. DESCRIPTION: This file contains the hardware logic layer of VA/VR primitive builders. *************** REVISION HISTORY ***************************************************************** Date Author Reference ======== ======== ========================== 05-11-29 e42737 LIBhh30827 Protect against getting an interrupt from DSP when not expecting one 05-09-26 a19950 LIBgg45257 Incorrect behavior when try to record Voice Name. 04-11-23 aja099 libff38547 VST VR Port 03-06-13 aaa063 LIBdd01040 Implementation of VST VR functionality 04-02-19 w17860 LIBdd76721 PANIC: When fast forwarding on Voice Record. - This occurs when we FF to end. 04-02-03 w17860 CR - LIBdd72293 FT:Panic when VoiceRecord was playing and fast forward was pressed - Removed the MCU_DSP_VA_PLAYBACK_OFF from the Interrupt handler for VA playback. This is already handled in the audio manager. 03-12-15 w18944 LIBdd61125 T725: Send VR STOP to dsp if VR is exited after first capture 03-06-12 w18944 LIBdd08826 Conditionally compile LIBbb87909 for Talon to fix E380 powerdown 03-17-03 e11237 LIBbb87909 change message order on recognize to support VR wait-for-speech 01-12-02 w18944 LIBbb13452 Integrate VR LITE 2.0 (no global data) 02-06-27 w17860 LIBbb18094 Remove hacks that prevent VA/VR and GPRS from happening at the same time 02-03-29 w17860 LIBbb24274 Phone powers down when ff through new voice note 02-01-09 ppoppert LIBbb15301 Update MDI to handle different size Audio queues based on the patriot. - changed the data_word_size constant to a variable because the size changes based on the dsp version. 01-07-16 qcf001 LIBaa08959 Update AM after FF to end, when we stop playing back. 01-07-03 qcf001 LIBaa07854 Fix powerdown after using voicenotes 01-05-11 qcf001 LIBaa00765 Interface change to use td_mnph_va_vr.h instead of l1_data_idle.h 01-03-16 blamers CSGce90013 Rewind, Fast Forward, and meter does not correspond to voicenote - The device layer does not send a resume after a FF to end command. Therefore the AM must fake the message in the Event Handler layer, but not notify the DL. 01-03-08 mtaraba CSGce91273 Fix is_va_active() to report correctly 01-02-02 mtaraba CSGce85434 MCU: Change VA record processing during training to 1st utterance. 01-01-29 mtaraba CSGce79517 Fix VA record in a call 00-12-21 mtaraba CSGce82934 main_comp_hardware.h within engine_audio vob should be removed 00-12-01 mtaraba CSGce81325 Editing voice shortcut when full does not work 00-09-01 blamers CR - CSGce61298 Complete functionality for VA FF/Rew - Reformat the Stream Start primitive sender - Add processing for the va offset parameter 00-08-23 cfarrel CR - CSGce68862 The Audio Manager causes a TDMA link error. - define l1_data_idle_va_status and l1_data_chanst_isr_state global variables, eventually they should be defined in the TDMA stack 00-08-09 mtaraba CR - CSGce55882 Eliminate file gsm.h from audio manager 00-08-04 dsteh CR - CSGce67931 VR incoming call powerdown fix - Disable layer1 speech coder primitives during VR out-of-call(training,record,etc) to prevent "overloading" DSP in the event of an incoming call 99-12-25 wchoi CR - CSGce39558 - suapi compilancy and added VA/VR functionality back in - removed unnecessary C++ classes for sending suapi messages 99-03-31 blamers PR - CSGce30193 VR with headset - Change in requirements. Do not set the DSP Handsfree bit when using the boom headset handsfree device. The DSP will never reply with "No Match Found" when the handsfree bit is set. It should only be used for Car Kits and other devices where the audio quality is poor and there is a lot of background noise. 99-03-29 blamers PR - CSGce30057 no tag playback using volume keys - Flush the Modem Data buffers after VA/VR stop commands for safety. 99-03-23 blamers CR - CSGce30036 VR Lockup due to missing global data - The stop semaphore was removed and replaced with a volatile BOOL flag. If the semaphore is set when the seem has already halted the stop will incorrectly occur on the next start. - The BOOL flag will be properly set in the initialization function. 99-03-17 blamers CR - CSGce29669 Fixing Delete one in VA/VR - Fix the second best model matching. The second best model may be a voice tag with a smaller number than the original match, so the index must be reset. - Clean up the Audio buffer and reset the global used in Capture completion. 99-03-10 blamers CR - CSGce29457 VR Recognize and VA Count - Fix the VR Recognize and Train complete conditioning functions. When errors are reported by the DSP the FDI must be falted properly to avoid a lock up on the next FDI Streaming request - Build and Send a Delete indication after a voice tag delete. Without this change the MMI will lock on deletion. - Add a class variable for the capture repetition for capture complete handling. 99-02-27 blamers CR - CSGce28847 VA/VR Stream Task Improvements - Change words_accessed to an UINT32 and finished condition_time_ind 99-01-13 jkraisor CR - CSGce26811 VA/VR FDI Interface Completion - Removed references to the Phase1 RAM buffer. - Added primitive sending to the FDI. 98-12-21 blamers CR - CSGce26131 Modify VA/VR to interact with FDI - Added completion code for VR and VA DSP commands. - Removed the do nothing temporary function. - Added code to prevent the CP from writing or reading after a va or vr stop 98-11-07 jkraisor CR - CSGce24216 RAM Interface for VR in Whitecap - Initialized the RAM pointers. 98-11-02 blamers CR - CSGce23508 Whitecap VR Audio Manager Support - Modified the VR commands to update the code to DSP v1.4 - Added the Do Nothing Function. 98-09-28 jkraisor CR - CSGce22626 Audio Manager Support for VA commands to DSP in Whitecap - Modified the VA commands to update the code to DSP v1.4 98-09-08 blamers CR - CSGce17243 Whitecap VA Audio Manager Support - Removed conditional compilation. 98-05-07 mkloza PR - CSGce18412 Hearing downlink audio while in VA before accepting call - Set up the l1_data_idle globals, for AVA just like it was set up for DVA. 98-01-27 slam PR - CSGce15154 97-12-22 slam PR - CSGce15164 97-12-12 slam PR - CSGce15147 97-11-26 slam PR - CSGce15004 97-10-31 slam PR - CSGce14269 97-10-28 slam PR - CSGce14049 97-10-10 slam PR - CSGce13448 97-09-08 slam PR - CSGce12890 97-08-05 slam PR - CSGce11436 97-08-05 slam PR - CSGce11610 97-05-28 slam PR - CSGce10240*//************** INCLUDES ******************************************************/#include <SUAPI/suapi.h>#include <stddef.h>#include <string.h>#include <ENGINE_AUDIO/audio_conditional_compile_def.h>#include <ENGINE_AUDIO/td_va_command.h>#include <ENGINE_AUDIO/td_vr_defs.h>#include <ENGINE_AUDIO/td_vr_group_types.h>#include <ENGINE_AUDIO/td_vr_training_types.h>#include <ENGINE_AUDIO/td_vr_voice_tag.h>#include <ENGINE_AUDIO/td_vr_error_codes.h>#include <ENGINE_AUDIO/td_vr_capture_reps.h>#include <ENGINE_AUDIO/audscm_sdsr_ind.h>#include <ENGINE_AUDIO/aud_interface.h>#if (AUDIO_GSM == TRUE && AUDIO_PATRIOT == TRUE)#include <ENGINE_GSM_STACK/gsm_stack/td_mnph_va_vr.h>#endif#include <audio/aud_tone_req.h>#include <ENGINE_HAPI/hapi_mdi_message_ids.h>#include <ENGINE_SEEM/seem.h>#include <seem/seem_globals.h>#include <seem/seem_data_stream_main_task.h>#include <ENGINE_AUDIO/aud_hw_stub_command_cnf.h>#include <audio/va_command_req.h>#include <ENGINE_AUDIO/aud_va_command_req.h>#include <ENGINE_AUDIO/am_hw_string_primitive.h>#include <audio/am_hw_primitive_builder_vr.h>#include <audio/AM_HW_Primitive_Builder.H>#include <audio/AM_VA_Info.H>#include <audio/am_va_vr_command_types.h>#include <audio/am_app_configuration_server.h>#include <audio/AM_VR_Playback_Record.H>#include <audio/AM_SDVR_Capture_Record.H>#include <audio/AM_SDVR_Delete_Record.H>#include <audio/AM_SDVR_Recog_Record.H>#include <audio/AM_SDVR_Train_Record.H>#include <ENGINE_AUDIO/am_util_bits.h>#include <ENGINE_AUDIO/MMI_UTIL_Bit_Array_Macros.H>#include <audio/am_utils.h>#include <audio/AM_Device_Layer_Interface.H>#include <audio/am_server_task.h>#include <seem/seem_prim_sender.h>#include <ENGINE_SEEM/seem_data_stream.h>#include <audio/AM_Timer_Container.H>#include <audio/AM_Timer_Non_SC.H>#include <audio/AM_Event_Handler.H>#if (AUDIO_DATA_STREAM_CAPABLE == TRUE)/************** GLOBAL DATA ***************************************************/UINT8 audio_gint_interrupt_transfer;UINT8 audio_gint_interrupt_first;/************** LOCAL CONSTANTS ***********************************************/// The maximum number of VA messages to or from the DSP which will fit in the API#if (AUDIO_RAINBOW == TRUE)#define MAX_AM_VA (DSP_MCU_AUDIO_DATA_WORD_SIZE / am_utils_max(DSP_MCU_VA_RECORD_DATA_WORD_LEN,\ MCU_DSP_VA_PLAYBACK_DATA_WORD_LEN))#else#define MAX_AM_VA (hapi_dsp_mcu_audio_data_word_size / am_utils_max(DSP_MCU_VA_RECORD_DATA_WORD_LEN,\ MCU_DSP_VA_PLAYBACK_DATA_WORD_LEN))#endif// N-best models for the DSP to return in recognition#define N_BEST_DSP_MODELS_SHIFT 1 // shift position of the n-best model count in the DSP command#define N_BEST_DSP_MODELS (2 << N_BEST_DSP_MODELS_SHIFT) // always ask for 2 n-best models#define UINT16_TO_BYTE(val) ((val) << 1)#define BYTE_TO_UINT16(val) ((val) >> 1)#define RECORD_ON_ENABLE_PCM_CAPTURE 0x80/************** LOCAL STRUCTURES, ENUMS, AND TYPEDEFS *************************/extern AM_Event_Handler * am_event_handler;extern "C" {BOOL Audio_Utterance_with_VA(void);};typedef struct{ const BOOL* table_ptr; UINT8 max_size;} AM_VR_LOOKUP_INFO;const AM_VR_LOOKUP_INFO vr_lookup_table[] ={ SEEM_vr_pb_valid_record_table, AUDIO_VR_MAX_PB_VOICE_TAGS, SEEM_vr_fa_valid_record_table, AUDIO_VR_MAX_FA_VOICE_TAGS };/************** LOCAL FUNCTION PROTOTYPES *************************************//* Disable interrupts, Call Gint, Enable Interrupts */extern "C"{void am_hw_run_GINT(void);};void am_hw_run_GINT(void){ SU_INTERRUPT int_state = suDisableInt();; GINT_interrupt(); suSetInt(int_state);}void reset_global_data(void){ UINT8 am_global_model_init_array[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; SEEM_STORE_INFO_ELEMENT_REQ *msgptr = NULL; msgptr = (SEEM_STORE_INFO_ELEMENT_REQ*) suCreateMessage((UINT32)sizeof(SEEM_STORE_INFO_ELEMENT_REQ) -0x7BFE + MCU_DSP_VR_GLOBAL_DATA_WORD_LEN + sizeof(UINT16), (UINT32)SEEM_STORE_INFO_ELEMENT_REQ_ID, am_reply_port, NULL); msgptr->pp_seem_element_type = SEEM_VR_GLOBAL_STATISTICS; msgptr->pp_seem_record_number = 1; // msgptr->pp_seem_device_type = 0; // used to be defined in td_seem_device_type.h msgptr->pp_race_tag = 1; memcpy((void*)msgptr->pp_seem_element_value, am_global_model_init_array, MCU_DSP_VR_GLOBAL_DATA_WORD_LEN * sizeof(UINT16)); seem_prim_sender(msgptr); msgptr = (SEEM_STORE_INFO_ELEMENT_REQ*) suReceiveMessageFromQueue(am_reply_queue, SU_WAIT_FOREVER, NULL); suDeleteMessage(msgptr,NULL); }// Calculate the total number of VR Tags for either PB or FAUINT8 total_vr_tags(TD_VR_GROUP_TYPE group_id){ UINT8 index = 0; UINT8 tags = 0; for (; index < vr_lookup_table[group_id].max_size; index++) { if (*(vr_lookup_table[group_id].table_ptr + index) == TRUE) { tags++; } } return tags;}// Set the DSP Handsfree bit. This bit does not correspond to Handsfree mode in the AM.// If the boom headset handsfree device is present do not set the DSP Handfree bit..UINT8 dsp_hf_bit(AM_AUDIO_MODE_MASK mode){ /* get peripheral info */ UINT8 hf_bit; // set hands free indication bit, But not for the Boom Headset if (read_bit (mode, AM_HANDSFREE_AUDIO)) { hf_bit = AM_VR_HANDSFREE_ACTIVE_VALUE; } else { hf_bit = AM_VR_HANDSFREE_NOT_ACTIVE_VALUE; } return (hf_bit);}/************** LOCAL MACROS **************************************************/// Choose the correct seem or stream types#define get_group_info_seem_type(group_id) (group_id == VR_PHONEBOOK_GROUP)?\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -