view src/cs/services/audio/audio_mode.c @ 600:8f50b202e81f

board preprocessor conditionals: prep for more FC hw in the future This change eliminates the CONFIG_TARGET_FCDEV3B preprocessor symbol and all preprocessor conditionals throughout the code base that tested for it, replacing them with CONFIG_TARGET_FCFAM or CONFIG_TARGET_FCMODEM. These new symbols are specified as follows: CONFIG_TARGET_FCFAM is intended to cover all hardware designs created by Mother Mychaela under the FreeCalypso trademark. This family will include modem products (repackagings of the FCDEV3B, possibly with RFFE or even RF transceiver changes), and also my desired FreeCalypso handset product. CONFIG_TARGET_FCMODEM is intended to cover all FreeCalypso modem products (which will be firmware-compatible with the FCDEV3B if they use TI Rita transceiver, or will require a different fw build if we switch to one of Silabs Aero transceivers), but not the handset product. Right now this CONFIG_TARGET_FCMODEM preprocessor symbol is used to conditionalize everything dealing with MCSI. At the present moment the future of FC hardware evolution is still unknown: it is not known whether we will ever have any beyond-FCDEV3B hardware at all (contingent on uncertain funding), and if we do produce further FC hardware designs, it is not known whether they will retain the same FIC modem core (triband), if we are going to have a quadband design that still retains the classic Rita transceiver, or if we are going to switch to Silabs Aero II or some other transceiver. If we produce a quadband modem that still uses Rita, it will run exactly the same fw as the FCDEV3B thanks to the way we define TSPACT signals for the RF_FAM=12 && CONFIG_TARGET_FCFAM combination, and the current fcdev3b build target will be renamed to fcmodem. OTOH, if that putative quadband modem will be Aero-based, then it will require a different fw build target, the fcdev3b target will stay as it is, and the two targets will both define CONFIG_TARGET_FCFAM and CONFIG_TARGET_FCMODEM, but will have different RF_FAM numbers. But no matter which way we are going to evolve, it is not right to have conditionals on CONFIG_TARGET_FCDEV3B in places like ACI, and the present change clears the way for future evolution.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 01 Apr 2019 01:05:24 +0000
parents 838eeafb0051
children
line wrap: on
line source

/****************************************************************************/
/*                                                                          */
/*  File Name:  audio_mode.c                                                */
/*                                                                          */
/*  Purpose:  This file contains all the functions used for audio mode misc */
/*            services.                                                     */
/*                                                                          */
/*  Version   0.1                                                           */
/*                                                                          */
/*  Date        Modification                                                */
/*  ------------------------------------------------------------------------*/
/*  14 Jan 2002  Create                                                     */
/*                                                                          */
/*  Author      Francois Mazard                                             */
/*                                                                          */
/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
/****************************************************************************/

#include "rv/rv_defined_swe.h"

#ifdef RVM_AUDIO_MAIN_SWE
  #ifndef _WINDOWS
    #include "config/swconfig.cfg"
    #include "config/sys.cfg"
    #include "config/chipset.cfg"
  #endif

  #include "l1_confg.h"
  #include "rv/rv_general.h"
  #include "rvm/rvm_gen.h"
  #include "audio/audio_ffs_i.h"
  #include "audio/audio_api.h"
  #include "audio/audio_structs_i.h"
  #include "audio/audio_error_hdlr_i.h"
  #include "audio/audio_var_i.h"
  #include "audio/audio_messages_i.h"
  #include "audio/audio_macro_i.h"
  #include "rvf/rvf_target.h"
  #include "audio/audio_const_i.h"

  /* include the usefull L1 header */
  #ifdef _WINDOWS
    #define BOOL_FLAG
    //#define CHAR_FLAG
  #endif
  #include "l1_types.h"
  #include "l1audio_const.h"
  #include "l1audio_cust.h"
  #include "l1audio_defty.h"
  #include "l1audio_msgty.h"
  #include "l1audio_signa.h"
  #if TESTMODE
   #include "l1tm_defty.h"
  #endif
  #if (L1_GTT == 1)
    #include "l1gtt_const.h"
    #include "l1gtt_defty.h"
  #endif
  #include "l1_const.h"
  #include "l1_defty.h"
  #include "l1_msgty.h"
  #include "l1_signa.h"
  #ifdef _WINDOWS
    #define L1_ASYNC_C
  #endif
  #include "l1_varex.h"

  /* external functions */
  extern void audio_mode_full_access_write_send_status (T_AUDIO_RET status, T_RV_RETURN return_path);
  extern void audio_mode_load_send_status              (T_AUDIO_RET status, T_RV_RETURN return_path);
  extern void audio_mode_save_send_status              (T_AUDIO_RET status, T_RV_RETURN return_path);
  extern void audio_mode_speaker_volume_send_status    (T_AUDIO_RET status, T_RV_RETURN return_path);

  /********************************************************************************/
  /*                                                                              */
  /*    Function Name:   audio_mode_message_switch                                */
  /*                                                                              */
  /*    Purpose:  This function manages the dispatching of the message usefull    */
  /*              for audio mode services.                                        */
  /*                                                                              */
  /*    Input Parameters:                                                         */
  /*        Audio message.                                                        */
  /*                                                                              */
  /*    Output Parameters:                                                        */
  /*        ID of the message receptor.                                           */
  /*                                                                              */
  /*    Note:                                                                     */
  /*        None.                                                                 */
  /*                                                                              */
  /*    Revision History:                                                         */
  /*        None.                                                                 */
  /*                                                                              */
  /********************************************************************************/
  UINT8 audio_mode_message_switch(T_RV_HDR *p_message)
  {
    switch(p_message->msg_id)
    {
      case AUDIO_MODE_LOAD_REQ :
      {
        if ( (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE) ||
             (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE) )
        {
          AUDIO_SEND_TRACE("AUDIO MODE LOAD: an entity already uses this service", RV_TRACE_LEVEL_ERROR);
          audio_mode_load_send_status (AUDIO_ERROR, ((T_AUDIO_MODE_LOAD_REQ *)p_message)->return_path);
          p_audio_gbl_var->message_processed = TRUE;
          return (AUDIO_MODE_NONE);
        }
        return(AUDIO_MODE_LOAD);
        break;
      }
      case AUDIO_MODE_SAVE_REQ :
      {
        if ( (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE) ||
             (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE) )
        {
          AUDIO_SEND_TRACE("AUDIO MODE SAVE: an entity currently changes the audio mode", RV_TRACE_LEVEL_ERROR);
          audio_mode_save_send_status (AUDIO_ERROR, ((T_AUDIO_MODE_SAVE_REQ *)p_message)->return_path);
          p_audio_gbl_var->message_processed = TRUE;
          return (AUDIO_MODE_NONE);
        }
        return(AUDIO_MODE_SAVE);
        break;
      }
      case AUDIO_MODE_WRITE_REQ :
      {
        if ( (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE) ||
             (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE) )
        {
          AUDIO_SEND_TRACE("AUDIO MODE FULL ACCESS WRITE: an entity currently changes the audio mode", RV_TRACE_LEVEL_ERROR);
          audio_mode_full_access_write_send_status (AUDIO_ERROR,
            ((T_AUDIO_MODE_FULL_ACCESS_WRITE_REQ *)p_message)->return_path);
          p_audio_gbl_var->message_processed = TRUE;
          return (AUDIO_MODE_NONE);
        }
        return(AUDIO_FULL_ACCESS_WRITE);
        break;
      }
      case OML1_START_DAI_TEST_CON :
      case OML1_STOP_DAI_TEST_CON :
      #if (AUDIO_MODE)
        case MMI_AUDIO_MODE_CON :
      #endif
      #if (FIR)
        case MMI_AUDIO_FIR_CON :
      #endif
      case MMI_AEC_CON :
      {
        if (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE)
        {
          return(AUDIO_MODE_LOAD);
        }
        else
        if (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE)
        {
          return(AUDIO_FULL_ACCESS_WRITE);
        }
        break;
      }
      case AUDIO_SPEAKER_VOLUME_REQ:
      {
        if ( (p_audio_gbl_var->audio_mode_var.audio_mode_load_var.state != AUDIO_MODE_LOAD_IDLE) ||
             (p_audio_gbl_var->audio_mode_var.full_access_write_var.state != AUDIO_MODE_FULL_WRITE_IDLE) )
        {
          AUDIO_SEND_TRACE("AUDIO MODE SPEAKER VOLUME: an entity currently changes the audio mode", RV_TRACE_LEVEL_ERROR);
          audio_mode_speaker_volume_send_status (AUDIO_ERROR,
            ((T_AUDIO_SPEAKER_VOLUME_REQ *)p_message)->return_path);
          p_audio_gbl_var->message_processed = TRUE;
          return (AUDIO_MODE_NONE);
        }
        return(AUDIO_SPEAKER_VOLUME);
        break;
      }
    }
    return (AUDIO_MODE_NONE);
  }
#endif /*RVM_AUDIO_MAIN_SWE*/