FreeCalypso > hg > fc-tourmaline
view src/cs/services/tty/tty.c @ 274:fa22012c4a39
CST: remove AT%Nxxxx old AEC control
This crude method of enabling and configuring AEC is not compatible
with L1_NEW_AEC, and even for the old AEC it did not support every
possible combination. It is time for this hack to go. The new and
proper way of enabling and configuring AEC is via RiViera Audio Service
audio mode facility, either audio mode files or full access write,
most directly accessible via fc-tmsh auw 12 for free experimentation.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 29 Jul 2021 18:57:36 +0000 |
parents | 4e78acac3d88 |
children |
line wrap: on
line source
/****************************************************************************/ /* */ /* File Name: tty.c */ /* */ /* Purpose: This file contains all the functions used to manage the */ /* TTY feature. */ /* */ /* Version 0.1 */ /* */ /* Date Modification */ /* ------------------------------------ */ /* 18 Jan 2003 Create */ /* */ /* Author */ /* Frederic Turgis */ /* */ /* (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved*/ /****************************************************************************/ #ifndef _WINDOWS #include "config/l1sw.cfg" #endif #if (L1_GTT == 1) #include "tty/tty_api.h" #include "tty/tty_i.h" #include "rv/rv_general.h" #include "rvf/rvf_target.h" #include "l1gtt_signa.h" #include "audio/audio_structs_i.h" #include "audio/audio_const_i.h" /* extern variables & prototypes */ extern T_TTY_ENV_CTRL_BLK *tty_env_ctrl_blk_p; extern T_AUDIO_ENV_CTRL_BLK *p_audio_gbl_var; extern void *audio_allocate_l1_message (UINT16 size); extern T_RV_RET audio_send_l1_message (INT16 message_id, void *message); /********************************************************************************/ /* */ /* Function Name: tty_send_status */ /* */ /* Purpose: This function sends the TTY status to the entity. */ /* */ /* Input Parameters: */ /* status, */ /* return path */ /* */ /* Output Parameters: */ /* None. */ /* */ /* Note: */ /* None. */ /* */ /* Revision History: */ /* None. */ /* */ /********************************************************************************/ void tty_send_status (T_AUDIO_RET status, T_RV_RETURN return_path) { T_AUDIO_TTY_STATUS *p_send_message = NULL; T_RVF_MB_STATUS mb_status = RVF_RED; while (mb_status == RVF_RED) { /* allocate the message buffer */ mb_status = rvf_get_buf (p_audio_gbl_var->mb_external, sizeof (T_AUDIO_TTY_STATUS), (T_RVF_BUFFER **) (&p_send_message)); /* If insufficient resources, then report a memory error and abort. */ /* and wait until more ressource is given */ if (mb_status == RVF_RED) { TTY_SEND_TRACE("TTY: Not Enough Memory (Red!) ",RV_TRACE_LEVEL_ERROR); rvf_delay(RVF_MS_TO_TICKS(1000)); } } /* fill the header of the message */ ((T_AUDIO_TTY_STATUS *)p_send_message)->os_hdr.msg_id = AUDIO_TTY_STATUS_MSG; /* fill the status parameters */ ((T_AUDIO_TTY_STATUS *)p_send_message)->status = status; if (return_path.callback_func == NULL) { /* send the message to the entity */ rvf_send_msg (return_path.addr_id, p_send_message); } else { /* call the callback function */ (*return_path.callback_func)((void *)(p_send_message)); rvf_free_buf((T_RVF_BUFFER *)p_send_message); } } /********************************************************************************/ /* */ /* Function Name: tty_manager */ /* */ /* Purpose: This function is called to manage TTY */ /* */ /* Input Parameters: */ /* message */ /* */ /* Output Parameters: */ /* None. */ /* */ /* Note: */ /* None. */ /* */ /* Revision History: */ /* None. */ /* */ /********************************************************************************/ void tty_manager (T_RV_HDR *p_message) { /* Declare local variables. */ void *p_send_message; /**************** tty_manager function begins *********************/ switch(tty_env_ctrl_blk_p->state) { case TTY_IDLE: { switch(p_message->msg_id) { case TTY_START_REQ: { /* save the return path */ tty_env_ctrl_blk_p->return_path.callback_func = ((T_TTY_START *)p_message)->return_path.callback_func; tty_env_ctrl_blk_p->return_path.addr_id = ((T_TTY_START *)p_message)->return_path.addr_id; /* allocate the buffer for the message to the L1 */ p_send_message = audio_allocate_l1_message(0); if (p_send_message != NULL) { /* send the start command to the audio L1 */ audio_send_l1_message(MMI_GTT_START_REQ, p_send_message); } /* change state */ tty_env_ctrl_blk_p->state = TTY_WAIT_START_CON; } break; case TTY_STOP_REQ: { TTY_SEND_TRACE("TTY: STOP ERROR EVENT ",RV_TRACE_LEVEL_ERROR); } break; } } /* case TTY_IDLE */ break; case TTY_WAIT_START_CON: { switch(p_message->msg_id) { case MMI_GTT_START_CON: { /* change state */ tty_env_ctrl_blk_p->state = TTY_WAIT_STOP_COMMAND; } break; case TTY_STOP_REQ: { /* change state */ tty_env_ctrl_blk_p->state = TTY_WAIT_START_CON_TO_STOP; } break; } } /* case TTY_WAIT_START_CON */ break; case TTY_WAIT_START_CON_TO_STOP: { switch(p_message->msg_id) { case MMI_GTT_START_CON: { /* send the stop command to the audio L1 */ p_send_message = audio_allocate_l1_message(0); if (p_send_message != NULL) { audio_send_l1_message(MMI_GTT_STOP_REQ, p_send_message); } /* change state */ tty_env_ctrl_blk_p->state = TTY_WAIT_STOP_CON; } break; case TTY_STOP_REQ: { TTY_SEND_TRACE("TTY: STOP ERROR EVENT ",RV_TRACE_LEVEL_ERROR); } break; } } break; case TTY_WAIT_STOP_COMMAND: { switch(p_message->msg_id) { case TTY_STOP_REQ: { /* send the stop command to the audio L1 */ p_send_message = audio_allocate_l1_message(0); if (p_send_message != NULL) { audio_send_l1_message(MMI_GTT_STOP_REQ, p_send_message); } /* change state */ tty_env_ctrl_blk_p->state = TTY_WAIT_STOP_CON; } break; case MMI_GTT_STOP_CON: { tty_send_status (AUDIO_OK, tty_env_ctrl_blk_p->return_path); /* change state */ tty_env_ctrl_blk_p->state = TTY_IDLE; } break; } } /* case TTY_WAIT_STOP_COMMAND */ break; case TTY_WAIT_STOP_CON: { switch(p_message->msg_id) { case MMI_GTT_STOP_CON: { tty_send_status (AUDIO_OK, tty_env_ctrl_blk_p->return_path); /* change state */ tty_env_ctrl_blk_p->state = TTY_IDLE; } break; case TTY_STOP_REQ: { TTY_SEND_TRACE("TTY: STOP ERROR EVENT ",RV_TRACE_LEVEL_ERROR); } break; } } /* case TTY_WAIT_STOP_CON */ break; } /* switch(tty_env_ctrl_blk_p->state) */ } #endif /* L1_GTT */