changeset 878:89c70b89dca5

gsm-fw: feature at-rvtmux implemented, compiles
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 31 May 2015 08:02:36 +0000
parents cd04c43187cd
children 4661b84260a0
files gsm-fw/cfgmagic/feature.at-rvtmux gsm-fw/g23m-aci/aci/Makefile gsm-fw/g23m-aci/aci/aci_aci.c gsm-fw/g23m-aci/aci/aci_cmh.h gsm-fw/g23m-aci/aci/ati_cmd.c gsm-fw/g23m-aci/aci/ati_src_rvt.c
diffstat 6 files changed, 217 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/cfgmagic/feature.at-rvtmux	Sun May 31 08:02:36 2015 +0000
@@ -0,0 +1,3 @@
+CONFIG_AT_RVTMUX=1
+export_to_c	CONFIG_AT_RVTMUX
+export_to_mk	CONFIG_AT_RVTMUX
--- a/gsm-fw/g23m-aci/aci/Makefile	Sat May 30 08:10:36 2015 +0000
+++ b/gsm-fw/g23m-aci/aci/Makefile	Sun May 31 08:02:36 2015 +0000
@@ -5,6 +5,8 @@
 CPPFLAGS=-I. -I../../include -I../../include/condat -I../../gpf/inc \
 	-I../../cdginc -I../aci_dti_mng -I../aci_ext -I../ati_ext -I../ksd
 
+sinclude ../../include/config.mk
+
 OBJS=	aci_aci.o aci_csf.o aci_em.o aci_lst.o aci_mem.o aci_mfw.o aci_pei.o \
 	aci_tim.o aci_util.o aoc.o \
 	ati_bas.o ati_cc.o ati_cmd.o ati_cphs.o ati_csc.o ati_dti.o ati_em.o \
@@ -26,6 +28,10 @@
 	psa_ssf.o psa_ssp.o psa_sss.o psa_uartp.o psa_uarts.o psa_util.o \
 	sap_dti.o sap_em.o version_dummy.o
 
+ifeq (${CONFIG_AT_RVTMUX},1)
+OBJS+=	ati_src_rvt.o
+endif
+
 all:	xipcode.o
 
 xipcode.o:	${OBJS}
--- a/gsm-fw/g23m-aci/aci/aci_aci.c	Sat May 30 08:10:36 2015 +0000
+++ b/gsm-fw/g23m-aci/aci/aci_aci.c	Sun May 31 08:02:36 2015 +0000
@@ -110,8 +110,15 @@
 | STATE   : code                        ROUTINE : aci_aci_cmd_req    |
 +--------------------------------------------------------------------+
 
-  PURPOSE : handle ACI command request primitive. It is only a
-            signal and must not be freed by PFREE.
+  PURPOSE : handle ACI command request primitive. The original comment
+	    said "It is only a signal and must not be freed by PFREE",
+	    but it appears to have been wrong even before we touched
+	    this code.
+
+  FreeCalypso change: this primitive (not signal!) was originally used
+  for by TI's _SIMULATION_ environment (the code in ati_src_tst.c,
+  removed in the TCS3.2 version we got), but we have repurposed it
+  for our AT-over-RVTMUX implementation in ati_src_rvt.c.
 
 */
 
@@ -125,8 +132,8 @@
     cmd->cmd_seq[cmd->cmd_len] = '\0';
     TRACE_EVENT_P1 ("%s", cmd->cmd_seq);
   }
-#ifdef DTI
-#ifdef _SIMULATION_
+
+#if defined _SIMULATION_ AND defined DTI
   if (cmd->cmd_src >= CMD_SRC_EXT AND cmd->cmd_src <= MAX_TST_SRC)
   {
 #ifdef FF_ATI_BAT
@@ -158,9 +165,12 @@
   {
     TRACE_EVENT_P1 ("aci_aci_cmd_req(): [WRN] srcId=%d, but must be 0x01 or 0x02", cmd->cmd_src);
   }
-#endif /* _SIMULATION_ */
-#endif /* DTI */
-#endif
+#elif CONFIG_AT_RVTMUX
+
+  ati_src_rvt_proc_cmd (cmd);
+
+#endif	/* old _SIMULATION_ vs FreeCalypso AT-over-RVTMUX */
+#endif	/* FF_ATI */
 
   PFREE (cmd);
 
--- a/gsm-fw/g23m-aci/aci/aci_cmh.h	Sat May 30 08:10:36 2015 +0000
+++ b/gsm-fw/g23m-aci/aci/aci_cmh.h	Sun May 31 08:02:36 2015 +0000
@@ -554,7 +554,7 @@
   CMD_SRC_ATI_5,           /* added in case of SAT run at cmd
                            THIS DOES NOT MEAN THIS IS THE SAT SOURCE THOUGH !!! */
 #endif /* SIM_TOOLKIT */
-#if defined FF_EOTD  OR  defined _SIMULATION_
+#if defined FF_EOTD OR defined _SIMULATION_ OR defined CONFIG_AT_RVTMUX
   CMD_SRC_ATI_6,           /* added in case of Location Service (test purposes) */
 #endif /* FF_EOTD  OR  _SIMULATION_ */
 #endif /* GOLITE */
--- a/gsm-fw/g23m-aci/aci/ati_cmd.c	Sat May 30 08:10:36 2015 +0000
+++ b/gsm-fw/g23m-aci/aci/ati_cmd.c	Sun May 31 08:02:36 2015 +0000
@@ -1458,6 +1458,10 @@
   aci_sat_cmd_init();
 #endif
 
+#if CONFIG_AT_RVTMUX
+  ati_src_rvt_register();
+#endif
+
   cmd_clearCnmiBuf ();
 
   /* for ATI parameters that are source dependant */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/g23m-aci/aci/ati_src_rvt.c	Sun May 31 08:02:36 2015 +0000
@@ -0,0 +1,186 @@
+/*
+ * This module is a FreeCalypso addition.  Here we are going to implement
+ * a mechanism for passing AT commands and responses over RVTMUX.
+ */
+
+#include "config.h"
+#include "fixedconf.h"
+#include "condat-features.h"
+#include "aci_conf.h"
+
+/* includes copied from ati_cmd.c */
+
+#undef DUMMY_ATI_STRINGS
+
+#include "aci_all.h"
+
+#include "dti.h"      /* functionality of the dti library */
+#include "line_edit.h" /* SKA 2002-09-05 */
+#include "aci_cmh.h"
+#include "ati_cmd.h"
+#include "aci_io.h"
+#include "aci_cmd.h"
+#include "l4_tim.h"
+
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "psa.h"
+#include "cmh.h"
+
+#include "aci_lst.h"
+#include "dti_conn_mng.h"
+#ifdef UART
+#include "psa_uart.h"
+#endif
+#include "ati_io.h"
+#include "aci_mem.h"
+
+#ifdef SIM_TOOLKIT
+#include "ati_src_sat.h"
+#include "psa_cc.h"
+#include "psa_sat.h"
+#endif /* SIM_TOOLKIT */
+
+#ifdef GPRS
+#include "gaci_cmh.h"
+#include "gaci_cmd.h"
+#endif /* GPRS */
+
+#include "aci_prs.h"
+
+
+#ifndef _SIMULATION_
+#ifdef UART
+#include "cmh_uart.h"
+#endif
+#endif
+
+#include "psa_sms.h"
+#include "aci.h"
+#include "ati_ext_mech.h"
+
+#ifdef FF_ATI_BAT
+#include "ati_bat.h"
+#include "aci_bat.h"
+#endif
+
+EXTERN T_ACI_LIST *ati_src_list;
+
+#include "../../riviera/rvt/rvt_gen.h"
+
+static UBYTE rvt_src_id;
+static T_RVT_USER_ID rvt_user_id;
+
+/*
+ * The following function is the callback registered with RVT; it gets
+ * called in RVT HISR context.  We allocate an ACI_CMD_REQ primitive,
+ * copy the received string into it and post it to ACI to be processed
+ * in our own task context.
+ */
+GLOBAL void ati_src_rvt_input_callback (T_RVT_BUFFER in_str, UINT16 in_str_len)
+{
+	PALLOC (aci_cmd_req, ACI_CMD_REQ);
+
+	aci_cmd_req->cmd_src = rvt_src_id;
+	aci_cmd_req->cmd_len = in_str_len;
+	bcopy(in_str, aci_cmd_req->cmd_seq, in_str_len);
+
+	PSENDX (ACI, aci_cmd_req);
+}
+
+/*
+ * The following function is called from aci_aci.c when an ACI_CMD_REQ
+ * primitive (sent by the previous function) has been received.
+ */
+GLOBAL BOOL ati_src_rvt_proc_cmd (T_ACI_CMD_REQ *aci_cmd_req)
+{
+    T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, rvt_src_id,
+						 search_ati_src_id);
+
+    ati_user_output_cfg[rvt_src_id].atE = 0;
+
+    if (src_params->text_mode EQ CMD_MODE)
+    {
+      TRACE_FUNCTION ("ati_src_rvt_proc_cmd () CMD MODE");
+
+      aci_cmd_req->cmd_seq[aci_cmd_req->cmd_len] = '\r';     /* make it V.25 ter compatible */
+      aci_cmd_req->cmd_seq[(aci_cmd_req->cmd_len) + 1] = '\0';
+      aci_cmd_req->cmd_len++;
+    }
+    else /* text has to be terminated by Ctrl-Z */
+    {
+      TRACE_FUNCTION ("ati_src_rvt_proc_cmd () TEXT MODE");
+
+      aci_cmd_req->cmd_seq[aci_cmd_req->cmd_len] = 0x1a;     /* make it V.25 ter compatible */
+      aci_cmd_req->cmd_seq[(aci_cmd_req->cmd_len) + 1] = '\0';
+      aci_cmd_req->cmd_len++;
+    }
+
+    return (ati_execute (rvt_src_id,
+                         aci_cmd_req->cmd_seq,
+                         aci_cmd_req->cmd_len));
+}
+
+/*
+ * The following function is the callback registered with ATI; it gets
+ * called when ATI has something to send to the user.
+ */
+GLOBAL void ati_src_rvt_result_cb (UBYTE              src_id,
+                                   T_ATI_OUTPUT_TYPE  output_type,
+                                   UBYTE              *output,
+                                   USHORT             output_len)
+{
+  TRACE_FUNCTION ("ati_src_rvt_result_cb ()");
+  rvt_send_trace_cpy (output, rvt_user_id, output_len, RVT_ASCII_FORMAT);
+}
+
+/*
+ * The following function is the other callback registered with ATI.
+ */
+GLOBAL void ati_src_rvt_line_state_cb (UBYTE                 src_id,
+                                       T_ATI_LINE_STATE_TYPE line_state_type,
+                                       ULONG                 line_state_param)
+{
+  TRACE_FUNCTION ("ati_src_rvt_line_state_cb ()");
+
+  switch (line_state_type)
+  {
+    case ATI_LINE_STATE_OUTPUT_TYPE:
+      TRACE_EVENT_P1 ("[DBG] ati_src_rvt_line_state_cb (): ATI_LINE_STATE_OUTPUT_TYPE = %d", line_state_param);
+      break;
+
+    case ATI_LINE_STATE_DCD:
+      TRACE_EVENT_P1 ("[DBG] ati_src_rvt_line_state_cb (): ATI_LINE_STATE_DCD = %d", line_state_param);
+      break;
+
+    case ATI_LINE_STATE_RNG:  /* TODO */
+    {
+      T_IO_RING_PARAMS rng_params;
+
+      memcpy (&rng_params, (T_IO_RING_PARAMS*)line_state_param,
+              sizeof(T_IO_RING_PARAMS));
+
+      TRACE_EVENT_P1 ("[DBG] ati_src_rvt_line_state_cb (): ATI_LINE_STATE_RNG = %d", rng_params.ring_stat);
+
+      break;
+    }
+
+    default:
+      TRACE_EVENT_P1 ("[WRN] ati_src_rvt_line_state_cb (): UNKNOWN line_state_type = %d", line_state_type);
+      break;
+  }
+}
+
+/*
+ * The following function is called from ati_cmd_init() in ati_cmd.c
+ * to register our mechanism.
+ */
+GLOBAL void ati_src_rvt_register (void)
+{
+  rvt_register_id ("AT", &rvt_user_id, ati_src_rvt_input_callback);
+  rvt_src_id = ati_init (ATI_SRC_TYPE_TST,
+                         ati_src_rvt_result_cb,
+                         ati_src_rvt_line_state_cb);
+}