view src/aci2/aci/psa_pktiop.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 93999a60b835
children
line wrap: on
line source

/*
+------------------------------------------------------------------------------
|  File:       psa_pktiop.c
+------------------------------------------------------------------------------
|  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 module defines the processing functions for the
|              primitives send to the protocol stack adapter by the
|              packet i/o managment (MNPKTIO).
+------------------------------------------------------------------------------
*/

#ifdef GPRS
#ifdef FF_PKTIO
#ifndef PSA_PKTIOP_C
#define PSA_PKTIOP_C
#endif

#include "aci_all.h"
/*==== INCLUDES ===================================================*/
#include "dti.h"      /* functionality of the dti library */
#include "aci_cmh.h"
#include "ati_cmd.h"
#include "aci_cmd.h"
#include "aci_lst.h"
#include "aci_mem.h"
#include "aci.h"
#include "psa.h"
#include "psa_pktio.h"

#include "cmh.h"
/*#include "dti_mng.h"*/
#include "dti_conn_mng.h"
#include "dti_cntrl_mng.h"
#include "cmh_pktio.h"


/*==== CONSTANTS ==================================================*/


/*==== TYPES ======================================================*/
GLOBAL T_ACI_LIST *pktio_dev_list=NULL;


/*==== EXPORT =====================================================*/


/*==== VARIABLES ==================================================*/


/*==== FUNCTIONS ==================================================*/
LOCAL BOOL find_pkt_dev_no ( UBYTE deviceNum, void * elem );
LOCAL BOOL mng_pkt_dev_list ( T_PKT_CONNECT_IND *pkt_connect_ind  );
/*
+----------------------------------------------------------------------+
| PROJECT : GPRS (8441)         MODULE  : PSA_PKTIOP                   |
| STATE   : finished            ROUTINE : find_pkt_dev_no              |
+----------------------------------------------------------------------+

  PURPOSE : search pktio device number in pktio device list
*/
LOCAL BOOL find_pkt_dev_no ( UBYTE deviceNum, void * elem )
{
  T_ACI_PKTIO *compared = (T_ACI_PKTIO *)elem;

  if (compared NEQ NULL)
    if (compared->device_no EQ deviceNum )
      return TRUE;
    return FALSE; 
}

/*
+----------------------------------------------------------------------+
| PROJECT : GPRS (8441)          MODULE  : PSA_PKTIOP                  |
| STATE   : finished             ROUTINE : mng_pkt_dev_list            |
+----------------------------------------------------------------------+

  PURPOSE : manage pktio device list
*/
LOCAL BOOL mng_pkt_dev_list ( T_PKT_CONNECT_IND *pkt_connect_ind  )
{
  T_ACI_PKTIO *  msg_ptr = NULL;

  if(pktio_dev_list EQ NULL)
  {/* there is no pktio device list */
    pktio_dev_list = new_list();
  }
  msg_ptr = find_element(pktio_dev_list, pkt_connect_ind->device_no,
                         find_pkt_dev_no);
  if(msg_ptr EQ NULL)
  {/* added new device */
    if((pkt_connect_ind->dio_dcb.convergence >= DTI_CPBLTY_CMD ) 
              AND 
       (pkt_connect_ind->dio_dcb.convergence <=(DTI_CPBLTY_CMD|DTI_CPBLTY_PKT|DTI_CPBLTY_SER)))
    {
      ACI_MALLOC(msg_ptr,sizeof(T_ACI_PKTIO));
      msg_ptr->device_no = pkt_connect_ind->device_no;
      memcpy(&msg_ptr->pktio_cap, &pkt_connect_ind->dio_dcb,sizeof(T_ACI_PKTIO_CAP));
      insert_list(pktio_dev_list,msg_ptr);
      return (TRUE);
    }
    else
    {/* neither CMD, SER nor PKT mode */
      return (FALSE);           
    }
  }
  else
  {/* new DIO capabilities for existing device */
    return (FALSE);
  }
}

/*
+----------------------------------------------------------------------+
| PROJECT : GPRS (8441)           MODULE  : PSA_PKTIOP                 |
| STATE   : finished              ROUTINE : psa_pkt_connect_ind        |
+----------------------------------------------------------------------+

  PURPOSE : processes the PKT_CONNECTION_IND primitive send by PKTIO.
                   add new device to pktio device list
                   register the DIO capabilities in ACI
*/
GLOBAL const void psa_pkt_connect_ind ( T_PKT_CONNECT_IND *pkt_connect_ind )
{
  T_ACI_PKTIO *  msg_ptr;

  TRACE_FUNCTION ("psa_pkt_connect_ind()");
  
  if(mng_pkt_dev_list(pkt_connect_ind) EQ TRUE)
  {
    msg_ptr = find_element(pktio_dev_list, pkt_connect_ind->device_no,
                                           find_pkt_dev_no);
    cmhPKT_Ind(msg_ptr);
  }
  else
  {/* second PKT_CONNECT_IND from same device or wrong convergence (mode) in 
        DIO capabilities */
    psaPKT_ConnectRej(pkt_connect_ind->device_no);
  }
  /* free the primitive buffer */
  PFREE (pkt_connect_ind);
}

/*
+----------------------------------------------------------------------+
| PROJECT : GPRS (8441)           MODULE  : PSA_PKTIOP                 |
| STATE   : finished              ROUTINE : psa_pkt_disconnect_ind     |
+----------------------------------------------------------------------+

  PURPOSE : processes the PKT_DISCONNECTION_IND primitive send by PKTIO.
            Removes the device from the pktio device list.
*/
GLOBAL const void psa_pkt_disconnect_ind ( T_PKT_DISCONNECT_IND *
                                           pkt_disconnect_ind )
{

  TRACE_FUNCTION ("psa_pkt_disconnect_ind()");    

  remove_element(pktio_dev_list, pkt_disconnect_ind->device_no, find_pkt_dev_no);

  /* free the primitive buffer */
  PFREE (pkt_disconnect_ind);
}

/*
+----------------------------------------------------------------------+
| PROJECT : GPRS (8441)           MODULE  : PSA_PKTIOP                 |
| STATE   : finished              ROUTINE : psa_pkt_dti_close_cnf      |
+----------------------------------------------------------------------+

  PURPOSE : processes the PKT_DTI_CLOSE_CNF primitive send by PKTIO.
     this confirms the dti disconnection requested by PKT_DTI_CLOSE_REQ 
*/
GLOBAL const void psa_pkt_dti_close_cnf ( T_PKT_DTI_CLOSE_CNF *
                                          pkt_dti_close_cnf )
{
  T_ACI_PKTIO * msg_ptr;
        
  TRACE_FUNCTION ("psa_pkt_dti_close_cnf()");    
  msg_ptr = find_element(pktio_dev_list, pkt_dti_close_cnf->device_no, 
                                          find_pkt_dev_no);
  /* if the device_no does not exist in the pktio_dev_list
       the primitive is ignored */
  if(msg_ptr NEQ NULL)
  {                    
    cmhPKT_Close(pkt_dti_close_cnf->device_no, DTI_CLOSE_CNF);          
  }
  /* free the primitive buffer */
  PFREE (pkt_dti_close_cnf);
}

/*
+----------------------------------------------------------------------+
| PROJECT : GPRS (8441)           MODULE  : PSA_PKTIOP                 |
| STATE   : finished              ROUTINE : psa_pkt_dti_close_ind      |
+----------------------------------------------------------------------+

  PURPOSE : processes the PKT_DTI_CLOSE_IND primitive send by PKTIO.
            this indicates the dti disconnection caused by the DIO driver
*/
GLOBAL const void psa_pkt_dti_close_ind ( T_PKT_DTI_CLOSE_IND *
                                          pkt_dti_close_ind )
{
  T_ACI_PKTIO * msg_ptr;
     
  TRACE_FUNCTION ("psa_pkt_dti_close_ind()");

  msg_ptr = find_element(pktio_dev_list, pkt_dti_close_ind->device_no, 
                                          find_pkt_dev_no);
  /* if the device_no does not exist in the pktio_dev_list
     the primitive is ignored */
  if(msg_ptr NEQ NULL)
  {            
    cmhPKT_Close(pkt_dti_close_ind->device_no, DTI_CLOSE_IND);
  } 
  /* free the primitive buffer */
  PFREE (pkt_dti_close_ind);
}

/*
+----------------------------------------------------------------------+
| PROJECT : GPRS (8441)          MODULE  : PSA_PKTIOP                  |
| STATE   : finished             ROUTINE : psa_pkt_dti_open_cnf        |
+----------------------------------------------------------------------+

  PURPOSE : processes the PKT_DTI_OPEN_CNF primitive send by PKTIO.
            this confirms the dti connection requested by PKT_DTI_OPEN_REQ
*/
GLOBAL const void psa_pkt_dti_open_cnf ( T_PKT_DTI_OPEN_CNF *
                                         pkt_dti_open_cnf )
{
  T_ACI_PKTIO * msg_ptr;
     
  TRACE_FUNCTION ("psa_pkt_dti_open_cnf()");

  msg_ptr = find_element(pktio_dev_list, pkt_dti_open_cnf->device_no, 
                                          find_pkt_dev_no);
  /* if the device_no does not exist in the pktio_dev_list
     the primitive is ignored */
  if(msg_ptr NEQ NULL)
  {
    switch(pkt_dti_open_cnf->cause)
    {
      case PKTCS_SUCCESS:
        cmhPKT_OpenCnf(pkt_dti_open_cnf->device_no,DTI_OK);
        break;
      case PKTCS_INVALID_PARAMS:
      case PKTCS_INVALID_PEER:
      case PKTCS_DISCONNECT:
      case PKTCS_INTERNAL_DRV_ERROR:
      default:
        cmhPKT_OpenCnf(pkt_dti_open_cnf->device_no,DTI_ERROR);
        break;
    }              
 }
 /* free the primitive buffer */
 PFREE (pkt_dti_open_cnf);
}

/*
+----------------------------------------------------------------------+
| PROJECT : GPRS (8441)           MODULE  : PSA_PKTIOP                 |
| STATE   : finished              ROUTINE : psa_pkt_modify_cnf         |
+----------------------------------------------------------------------+

  PURPOSE : processes the PKT_MODIFY_CNF primitive send by PKTIO.
            this confirms the modification fo channel parameters
            requested by PKT_MODIFY_REQ
*/
GLOBAL const void psa_pkt_modify_cnf ( T_PKT_MODIFY_CNF *pkt_modify_cnf )
{
  TRACE_FUNCTION ("psa_pkt_modify_cnf()");
 
  /* free the primitive buffer */
  PFREE (pkt_modify_cnf);
}
#endif /* FF_PKTIO */
#endif  /* GPRS */
/*==== EOF =========================================================*/