view src/g23m-aci/uart/uart_rts.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 53929b40109c
children
line wrap: on
line source

/*
+-----------------------------------------------------------------------------
|  Project :
|  Modul   :
+-----------------------------------------------------------------------------
|  Copyright 2002 Texas Instruments Berlin, AG
|                 All rights reserved.
|
|                 This file is confidential and a trade secret of Texas
|                 Instruments Berlin, AG
|                 The receipt of or possession of this file does not convey
|                 any rights to reproduce or disclose its contents or to
|                 manufacture, use, or sell anything it may describe, in
|                 whole, or in part, without the specific written consent of
|                 Texas Instruments Berlin, AG.
+-----------------------------------------------------------------------------
|  Purpose :  This modul is part of the entity UART and implements all
|             functions to handle the incoming process internal signals as
|             described in the SDL-documentation (RT-statemachine)
+-----------------------------------------------------------------------------
*/

#ifndef UART_RTS_C
#define UART_RTS_C
#endif /* !UART_RTS_C */

#define ENTITY_UART

/*==== INCLUDES =============================================================*/

#ifdef _SIMULATION_
#include <stdio.h>
#endif

#ifdef WIN32
#include "nucleus.h"
#endif /* WIN32 */
#include "typedefs.h"   /* to get Condat data types */
#include "vsi.h"        /* to get a lot of macros */
#include "macdef.h"     /* to get a lot of macros */
#include "custom.h"
#include "gsm.h"        /* to get a lot of macros */
#include "cnf_uart.h"   /* to get cnf-definitions */
#include "mon_uart.h"   /* to get mon-definitions */
#include "prim.h"       /* to get the definitions of used SAP and directions */
#ifdef DTILIB
#include "dti.h"        /* to get dti lib */
#endif /* DTILIB */
#include "pei.h"        /* to get PEI interface */
#ifdef FF_MULTI_PORT
#include "gsi.h"        /* to get definitions of serial driver */
#else /* FF_MULTI_PORT */
#ifdef _TARGET_
#include "uart/serialswitch.h"
#include "uart/traceswitch.h"
#else /* _TARGET_ */
#include "serial_dat.h" /* to get definitions of serial driver */
#endif /* _TARGET_ */
#endif /* FF_MULTI_PORT */
#include "uart.h"       /* to get the global entity definitions */

/*==== CONST ================================================================*/

/*==== LOCAL VARS ===========================================================*/

/*==== PRIVATE FUNCTIONS ====================================================*/

/*==== PUBLIC FUNCTIONS =====================================================*/



/*
+------------------------------------------------------------------------------
| Function    : sig_ker_rt_parameters_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_KER_RT_PARAMETERS_REQ
|               This signal sets new start values for the three multiplexer
|               timers:
|               T1 - acknowledgement timer (in units of 10 ms)
|               T2 - response timer for multiplexer control channel
|                    (in units of 10 ms)
|               T3 - wake-up response timer (in seconds)
|
| Parameters  : t1 - new start value of timer T1
|               t2 - new start value of timer T2
|               t3 - new start value of timer T3
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_ker_rt_parameters_req (UBYTE t1, UBYTE t2, UBYTE t3)
{
  TRACE_ISIG( "sig_ker_rt_parameters_req" );

  /*
   * set set new start values of timers
   */
  uart_data->rt.t1 = (T_TIME)t1 * 10;
  uart_data->rt.t2 = (T_TIME)t2 * 10;
  uart_data->rt.t3 = (T_TIME)t3 * 1000;
} /* sig_ker_rt_parameters_req() */



/*
+------------------------------------------------------------------------------
| Function    : sig_ker_rt_start_t1_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_KER_RT_START_T1_REQ
|               which is used to (re-)start the timer t1
|
| Parameters  : none
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_ker_rt_start_t1_req ()
{
  TRACE_ISIG( "sig_ker_rt_start_t1_req" );

  if(TIMER_START(UART_handle, uart_data->timer_t1_index, uart_data->rt.t1 ) NEQ VSI_OK)
  {
    TRACE_ERROR_P1("VSI entity: Can't start timer t1, uart_rts.c(%d)", __LINE__);
  }

  uart_data->rt.state_t1 = UART_RT_STARTED;

} /* sig_ker_rt_start_t1_req() */



/*
+------------------------------------------------------------------------------
| Function    : sig_ker_rt_start_t2_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_KER_RT_START_T2_REQ
|               which is used to (re-)start the timer t2
|
| Parameters  : none
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_ker_rt_start_t2_req ()
{
  TRACE_ISIG( "sig_ker_rt_start_t2_req" );


  if(TIMER_START(UART_handle, uart_data->timer_t2_index, uart_data->rt.t2 ) NEQ VSI_OK)
  {
    TRACE_ERROR_P1("VSI entity: Can't start timer t2, uart_rts.c(%d)", __LINE__);
  }

  uart_data->rt.state_t2 = UART_RT_STARTED;

} /* sig_ker_rt_start_t2_req() */



/*
+------------------------------------------------------------------------------
| Function    : sig_ker_rt_start_t3_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_KER_RT_START_T3_REQ
|               which is used to (re-)start the timer t3
|
| Parameters  : none
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_ker_rt_start_t3_req ()
{
  TRACE_ISIG( "sig_ker_rt_start_t3_req" );


  if(TIMER_START(UART_handle, uart_data->timer_t3_index, uart_data->rt.t3 ) NEQ VSI_OK)
  {
    TRACE_ERROR_P1("VSI entity: Can't start timer t3, uart_rts.c(%d)", __LINE__);
  }

  uart_data->rt.state_t3 = UART_RT_STARTED;

} /* sig_ker_rt_start_t3_req() */


/*
+------------------------------------------------------------------------------
| Function    : sig_dtx_rt_start_tesd_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_DTX_RT_START_TESD_REQ
|               which is used to start the timer tesd
|
| Parameters  : tesd_value  - startvalue of TESD
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_dtx_rt_start_tesd_req (T_TIME tesd_value)
{
  TRACE_ISIG( "sig_dtx_rt_start_tesd_req" );
  /*
   * store lowest value
   */
  if (tesd_value < uart_data->rt.tesd)
  {
#ifdef _SIMULATION_
    TRACE_EVENT_P1("ESD: New start value uart_data->rt.tesd: %d", tesd_value);
#endif /* _SIMULATION_ */
    uart_data->rt.tesd = tesd_value;
  }
  /*
   * 1. This is the "first" call to sig_dtx_rt_start_tesd_req:
   *    state is UART_RT_STOPPED
   * 2. Called from sig_ker_dtx_timeout_tesd_req:
   *    state is still UART_RT_STARTED (is reset to UART_RT_STOPPED when none
   *    of the DLCs wants to restart TESD)
   */
  if (uart_data->rt.state_tesd EQ UART_RT_STOPPED)
  {
#ifdef _SIMULATION_
    TRACE_EVENT_P1("ESD: Start timer TESD( %d )", uart_data->rt.tesd);
#endif /* _SIMULATION_ */

    if(TIMER_START (UART_handle, uart_data->timer_tesd_index, uart_data->rt.tesd ) NEQ VSI_OK)
    {
      TRACE_ERROR_P1("VSI entity: Can't start timer, uart_rts.c(%d)", __LINE__);
    }
    uart_data->rt.state_tesd = UART_RT_STARTED;
  }
#ifdef _SIMULATION_
  else
  {
    TRACE_EVENT("ESD: Timer TESD will be started later !");
  }
#endif /* _SIMULATION_ */
} /* sig_dtx_rt_start_tesd_req() */


/*
+------------------------------------------------------------------------------
| Function    : sig_ker_rt_stop_t1_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_KER_RT_STOP_T1_REQ
|
| Parameters  : none
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_ker_rt_stop_t1_req ()
{
  TRACE_ISIG( "sig_ker_rt_stop_t1_req" );

  if( uart_data->rt.state_t1 EQ UART_RT_STARTED )
  {
    if(TIMER_STOP(UART_handle, uart_data->timer_t1_index ) NEQ VSI_OK)
    {
      TRACE_ERROR_P1("VSI entity: Can't stop timer t1, uartrts.c(%d)", __LINE__);
    }
  }

  uart_data->rt.state_t1 = UART_RT_STOPPED;
} /* sig_ker_rt_stop_t1_req() */



/*
+------------------------------------------------------------------------------
| Function    : sig_ker_rt_stop_t2_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_KER_RT_STOP_T2_REQ
|
| Parameters  : none
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_ker_rt_stop_t2_req ()
{
  TRACE_ISIG( "sig_ker_rt_stop_t2_req" );

  if( uart_data->rt.state_t2 EQ UART_RT_STARTED )
  {
    if(TIMER_STOP(UART_handle, uart_data->timer_t2_index ) NEQ VSI_OK)
    {
      TRACE_ERROR_P1("VSI entity: Can't stop timer t2, uart_rts.c(%d)",__LINE__);
    }
  }

  uart_data->rt.state_t2 = UART_RT_STOPPED;
} /* sig_ker_rt_stop_t2_req() */



/*
+------------------------------------------------------------------------------
| Function    : sig_ker_rt_stop_t3_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_KER_RT_STOP_T3_REQ
|
| Parameters  : none
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_ker_rt_stop_t3_req ()
{
  TRACE_ISIG( "sig_ker_rt_stop_t3_req" );

  if( uart_data->rt.state_t3 EQ UART_RT_STARTED )
  {
    if(TIMER_STOP(UART_handle, uart_data->timer_t3_index ) NEQ VSI_OK)
    {
      TRACE_ERROR_P1("VSI entity: Can't stop timer t3, uart_rts.c(%d)", __LINE__);
    }
  }

  uart_data->rt.state_t3 = UART_RT_STOPPED;
} /* sig_ker_rt_stop_t3_req() */


/*
+------------------------------------------------------------------------------
| Function    : sig_dtx_rt_stop_tesd_req
+------------------------------------------------------------------------------
| Description : Handles the internal signal SIG_DTX_RT_STOP_TESD_REQ
|
| Parameters  : none
|
+------------------------------------------------------------------------------
*/
GLOBAL void sig_dtx_rt_stop_tesd_req ()
{
  TRACE_ISIG( "sig_dtx_rt_stop_tesd_req" );

  if( uart_data->rt.state_tesd EQ UART_RT_STARTED )
  {
    if(TIMER_STOP(UART_handle, uart_data->timer_tesd_index ) NEQ VSI_OK)
    {
      TRACE_ERROR_P1("VSI entity: Can't stop timer, uart_rts.c(%d)", __LINE__);
    }
}

  uart_data->rt.state_tesd = UART_RT_STOPPED;
} /* sig_dtx_rt_stop_tesd_req() */