FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/services/etm/etm_at.c @ 376:754e72d134a0
os_mem_fl.c: os_GetPartitionPoolStatus() done
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 09 Jun 2014 04:53:32 +0000 |
parents | d78219c43fbf |
children |
rev | line source |
---|---|
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /******************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * Enhanced TestMode (ETM) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * @file etm_at.c (Support for AT-commands) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * @author Kim T. Peteren (ktp@ti.com) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * @version 0.2 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 * History: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 * Date Modification |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 * ------------------------------------ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 * 16/06/2003 Creation |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 * 06/11/2003 Small updates |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 * 18/02/2004 Major updating, the event handling has been updated |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 *********************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 //#include "aci_msg.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 #include "etm/etm.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 #include "etm/etm_api.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 #include "etm/etm_at.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 #include "etm/etm_trace.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 #include "rv/rv_general.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 #include "rvf/rvf_api.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 #include "atp/atp_env.h" // FixMe |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 #include "atp/atp_i.h" // FixMe |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 //#include "atp/atp_general.h" // FixMe |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 #include "atp/atp_api.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 #include "atp/atp_messages.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 #include <string.h> |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 // Defined in aci_msg.h |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 extern T_XAT_SYNC_MESSAGE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 extern SYNC_PORT_NUM; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 extern ASYNC_PORT_NUM; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 extern T_RAT_CALLBACK_MESSAGE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 * Globals |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 static T_ATP_SW_ENTITY_NAME ETM_AT_ADAPTER = "ETMATA"; // max 5 caracter |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 static T_ATP_SW_ENTITY_ID etm_at_id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 static T_ATP_PORT_NB etm_at_to_aaa_port = 0x01; // equal to SYNC_PORT_NUM |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 static T_ATP_SW_ENTITY_NAME aaa_name = "AAA"; // ACIA ADAPTER |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 //static T_ATP_SW_ENTITY_NAME aaa_name = "GSM"; // GSM ADAPTER |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 static T_ATP_SW_ENTITY_ID aaa_entity_id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 static T_ATP_ENTITY_MODE aaa_mode; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 static T_ATP_CALLBACK etm_at_return_path; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 static T_ATP_ENTITY_MODE etm_at_mode; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 //extern T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 static int etm_at_initialized = 0; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 static int etm_at_event_status = 0; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 static char etm_at_latest_cmd[9] = { 0 }; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 * Internal prototypes |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 int etm_at_init(void); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 int etm_at_reg_req(void); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 int etm_at_open_port_req(void); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 //T_RV_HDR *etm_at_wait_for_atp_event (UINT16 event_code); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 int etm_at_atp_txt_cmd_rdy( T_ATP_TXT_CMD_RDY *msg); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 void etm_at_callback_for_ATP(void *event_from_atp_p); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 * AT commands List |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 struct at_async_trans_s { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 // const short index; // index for ... |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 const char *name; // parameter |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 }; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 static struct at_async_trans_s at_cmd[] = |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 { "TEST" }, |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 { "atd" }, |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 { NULL } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 }; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 int at_cmd_search(char *at_string) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 struct at_async_trans_s *at_p = at_cmd; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 int size, error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 size = strlen(at_string); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 tr_etm(TgTrCore, "ETM CORE: _cmd_search: at_string size(%d)", size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 if (size > 8) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 strncpy(&etm_at_latest_cmd[0], at_string, 8); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 else |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 strncpy(&etm_at_latest_cmd[0], at_string, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 // if ((etm_at_latest_cmd[2]== '+') || (etm_at_latest_cmd[2] == '%')) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 // return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 while (at_p->name) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 error = strncmp(&etm_at_latest_cmd[0], at_p->name, strlen(at_p->name)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 if (error == 0) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 strcpy(&etm_at_latest_cmd[0], at_p->name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 tr_etm(TgTrCore, "ETM CORE: _cmd_search: AT list(%s)", at_p->name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 at_p++; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 tr_etm(TgTrCore, "ETM CORE: _cmd_search: text(%s)", &etm_at_latest_cmd[0]); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 * AT command to ACI |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 int etm_at_adapter(char *command) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 int error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 T_ATP_TXT_CMD txt_cmd_p = NULL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 if (!etm_at_initialized){ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 if ((etm_at_init() == ETM_OK) && (etm_at_event_status == ETM_OK)) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 // read etm_at_event_status |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 tr_etm(TgTrCore, "ETM CORE: _at_adapter: initialization - OK"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 etm_at_initialized = 1; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 else { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 tr_etm(TgTrCore, "ETM CORE: _at_adapter: initialization - FAILED"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 return ETM_FATAL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 // Creating ETM_AT data buffer, will be fread by atp_send_txt_cmd() |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 if ((txt_cmd_p = etm_malloc(strlen(command)+1)) == NULL) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 return ETM_NOMEM; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 strcpy(txt_cmd_p, command); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 // Find AT command |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 //at_cmd_search(command); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 // Send AT command to AAA |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 if ((error = atp_send_txt_cmd(etm_at_id, etm_at_to_aaa_port, AT_CMD, txt_cmd_p)) != RV_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 tr_etm(TgTrCore, "ETM CORE: _at_adapter: send_txt_cmd - FAILED"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 return ETM_FATAL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 * ETM AT Adapter Initialization |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 int etm_at_init(void) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 int error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 // Check if ATP has been started if NOT |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 // Turn ATP module ON - necessary for RVM |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 if (atp_swe_state != ATP_STARTED) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 if (atp_start() != RV_OK) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 return ETM_FATAL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 // Registration of ETM_AT to ATP |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 if ((error = etm_at_reg_req()) != ETM_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 tr_etm(TgTrCore, "ETM CORE: _at_init: Registration ERROR(%d)", error); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
190 return error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
192 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 // Open a port to ACI adapter |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
194 if ((error = etm_at_open_port_req()) != ETM_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
195 tr_etm(TgTrCore, "ETM CORE: _at_init: Open port ERROR(%d)", error); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 return error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 // Register of ETM AT adapter with ATP. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 int etm_at_reg_req(void) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 int result; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 // Registration of ETM_AT in ATP |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 etm_at_return_path.addr_id = NULL; // mailbox identifier - unused when callback mechanism in use |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 etm_at_return_path.callback_func = etm_at_callback_for_ATP; // Pointer to callback fn ... |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 // Set modes supported by SWE |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 etm_at_mode.cmd_mode = TXT_MODE; // INTERPRETED_MODE/TXT_MODE |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 etm_at_mode.cp_mode = COPY_OFF; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 etm_at_mode.cmd_support_mode = CMD_SUPPORT_ON; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 // Registration of ETM_AT to ATP |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 if ((result = (atp_reg(ETM_AT_ADAPTER, etm_at_return_path, etm_at_mode, &etm_at_id))) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 != RV_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 tr_etm(TgTrCore, "ETM CORE: _at_reg_req: ERROR(%d)", result); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 return ETM_RV_FATAL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 // Check ETM_AT Registration |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 if ((result = (atp_reg_info(ETM_AT_ADAPTER, &etm_at_id, &etm_at_mode))) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 != RV_OK){ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
228 tr_etm(TgTrCore, "ETM CORE: _at_reg_req: FAILED"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
229 return ETM_RV_NOT_SUPPORTED; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 // Open a port with ATP. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 int etm_at_open_port_req(void) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 int result; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 T_ATP_NO_COPY_INFO etm_no_copy_info; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 T_ATP_PORT_INFO etm_port_info; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 T_ATP_CUSTOM_INFO *cust_info_p = NULL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 // T_RV_HDR *message_p; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 T_RVF_MB_ID etm_mb_id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 if (rvf_get_mb_id("ETM_PRIM", &etm_mb_id) != RVF_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 tr_etm(TgTrCore, "ETM CORE: _at_open_port_req: Memory bank ETM does not exist!"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 return ETM_RV_FATAL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 /* Test header and trailer removal from ATP so: trailers and headers equal 0 */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 etm_no_copy_info.tx_mb = etm_mb_id; /* MB used by ATP is from ETM */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 etm_no_copy_info.rx_mb = etm_mb_id; /* MB used by ATP is from ETM */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 etm_no_copy_info.rx_head_mode = RX_HEADER_OFF; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 etm_no_copy_info.rx_head_size = 0x00; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 etm_no_copy_info.rx_trail_size = 0x00; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 etm_no_copy_info.tx_head_mode = TX_HEADER_OFF; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 etm_no_copy_info.tx_head_size = 0x00; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 etm_no_copy_info.tx_trail_size = 0x00; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 etm_no_copy_info.packet_mode = NORMAL_PACKET; /* No L2CAP packet... */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
263 // Port info |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 etm_port_info.port_config = NOT_DEFINED_CONFIG; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 etm_port_info.ring_type = ATP_NO_RING_TYPE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
266 etm_port_info.signal_mask = (T_ATP_SIGNAL_MASK) ATP_ALL_THE_SIGNAL_UNMASK; /* Get all signal changed event */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
267 etm_port_info.dce_mask[0] = 0x0000; /* No requirement in term of DCE */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
268 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
269 // Test AA Adapter Registration |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
270 if (atp_reg_info(aaa_name, &aaa_entity_id, &aaa_mode) != RV_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
271 tr_etm(TgTrCore, "ETM CORE: _at_open_port_req: AAA is not registered to ATP"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
272 return ETM_RV_NOT_SUPPORTED; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
273 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
274 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
275 // Open a virtual port between ETM AT adapter and ACI adapter |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
276 if ((result = atp_open_port_rqst(etm_at_id, aaa_entity_id, etm_at_to_aaa_port, |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
277 etm_port_info, etm_no_copy_info, cust_info_p)) != RV_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
278 tr_etm(TgTrCore, "ETM CORE: _at_open_port_req: FAILED"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
279 return ETM_RV_FATAL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
280 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
281 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
282 // etm_at_callback_for_ATP should receive event: ATP_OPEN_PORT_CFM |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
283 rvf_wait(0xffff, 100); // Timeout 100 ticks |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
284 tr_etm(TgTrCore, "ETM CORE: _at_open_port_req: STATUS(%d)", etm_at_event_status); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
285 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
286 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
287 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
288 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
289 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
290 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
291 * Close Port |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
292 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
293 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
294 int etm_at_port_close_req(void) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
295 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
296 int error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
297 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
298 error = atp_close_port(etm_at_id, etm_at_to_aaa_port); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
299 if (error != RV_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
300 tr_etm(TgTrCore, "ETM CORE: _at_port_close_req: FAILED"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
301 return ETM_FATAL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
302 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
303 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
304 // etm_at_callback_for_ATP should receive event: ATP_PORT_CLOSED |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
305 rvf_wait(0xffff, 100); // Timeout 100 ticks |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
306 tr_etm(TgTrCore, "ETM CORE: _at_open_port_req: STATUS(%d)", etm_at_event_status); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
307 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
308 etm_at_initialized = 0; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
309 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
310 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
311 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
312 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
313 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
314 * Callback function for ATP |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
315 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
316 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
317 // PURPOSE : Decipher and route incoming messages from ATP. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
318 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
319 void etm_at_callback_for_ATP(void *event_from_atp_p) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
320 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
321 // This function is ATP context. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
322 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
323 // tr_etm(TgTrEtmLow,"ETM: CORE: etm_at_callback_for_ATP: recv. event (0x%x)", ((T_RV_HDR *) event_from_atp_p)->msg_id); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
324 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
325 // What type of event? |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
326 switch (((T_RV_HDR *) event_from_atp_p)->msg_id) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
327 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
328 case ATP_CMD_RDY: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
329 tr_etm(TgTrCore,"ETM CORE: _at_callback_for_AT: UNSUPPORTED"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
330 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
331 case ATP_OPEN_PORT_CFM: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
332 if (((T_ATP_OPEN_PORT_CFM *) event_from_atp_p)->result == OPEN_PORT_OK) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
333 tr_etm(TgTrCore, "ETM CORE: _at_callback_for_ATP: rev. event ATP_OPEN_PORT_CFM - OPEN_PORT_OK"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
334 // tr_etm(TgTrCore, "ETM CORE: _at_callback_for_ATP: rev. event ATP_OPEN_PORT_CFM - Port Number (%d)", |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
335 // ((T_ATP_OPEN_PORT_CFM *) event_from_atp_p)->initiator_port_nb); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
336 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
337 else { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
338 tr_etm(TgTrCore, "ETM CORE: _at_callback_for_ATP: rev. event ATP_OPEN_PORT_CFM - OPEN_PORT_NOK"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
339 etm_at_event_status = ETM_FATAL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
340 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
341 // tr_etm(TgTrCore, "ETM CORE: _at_callback_for_ATP: rev. event ATP_OPEN_PORT_CFM - Port Number (%d)", |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
342 // ((T_ATP_OPEN_PORT_CFM *) event_from_atp_p)->initiator_port_nb); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
343 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
344 case ATP_TXT_CMD_RDY: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
345 etm_at_atp_txt_cmd_rdy((T_ATP_TXT_CMD_RDY *) event_from_atp_p); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
346 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
347 case ATP_PORT_CLOSED: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
348 tr_etm(TgTrCore, "ETM CORE: _at_callback_for_ATP: rev. event ATP_PORT_CLOSED"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
349 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
350 case ATP_OPEN_PORT_IND: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
351 tr_etm(TgTrCore, "ETM CORE: _at_callback_for_ATP: rev. event ATP_OPEN_PORT_IND"); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
352 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
353 default: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
354 tr_etm(TgTrCore, "ETM CORE: _at_callback_for_ATP: rev. unknown event(0x%x)- UNSUPPORTED", |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
355 ((T_RV_HDR *) event_from_atp_p)->msg_id); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
356 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
357 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
358 /* Free memmory that is allocated within ATP */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
359 etm_free(event_from_atp_p); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
360 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
361 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
362 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
363 // This is called when the result of the AT cmd is received |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
364 // (in a primetive) from the ATP entity. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
365 int etm_at_atp_txt_cmd_rdy(T_ATP_TXT_CMD_RDY *msg) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
366 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
367 /* Send reply to PC |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
368 The status type depend of the event from ATP module: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
369 last_result = 0, means more data is sent to HOST (PC) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
370 last_result = 1, means last data is sent to HOST (PC) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
371 last_result = 2, means data is not sent to HOST (PC) */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
372 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
373 T_ETM_PKT *pkt; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
374 char *text, last_result = 1; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
375 int error = 0, length; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
376 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
377 if ((pkt = (T_ETM_PKT *) etm_malloc(sizeof(T_ETM_PKT))) == NULL) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
378 rvf_dump_mem(); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
379 return ETM_NOMEM; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
380 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
381 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
382 // Init. of return packet |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
383 pkt->mid = ETM_CORE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
384 pkt->status = ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
385 pkt->size = 0; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
386 pkt->index = 0; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
387 etm_pkt_put8(pkt, 'G'); // 'G' is indcator for AT command respons |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
388 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
389 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
390 tr_etm(TgTrCore, "ETM CORE: _at_atp_txt_cmd_rdy: ATP_TXT_CMD_RDY with cmd_type(%d)", |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
391 msg->cmd_type); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
392 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
393 switch (msg->cmd_type){ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
394 case AT_CMD: // Type: 0 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
395 case CUSTOM_CMD: // Type: 4 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
396 case CMD_ABORT: // Type: 5 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
397 case UNKNOWN: error = ETM_MESSAGE; break; // Type: 6 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
398 case PRELIMINARY_RESULT_CODE: last_result = 0; break; // Type: 7 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
399 // case INFORMATION_TXT: last_result = 0; break; // Type: 3 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
400 case RESULT_CODE: last_result = 1; break; // Type: 1 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
401 case UNSOLICITED_RESULT: last_result = 2; break; // Type: 2 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
402 default: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
403 tr_etm(TgTrCore,"ETM CORE: _at_atp_txt_cmd_rdy: cmd_tpye(%d) - FAILED", msg->cmd_type); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
404 error = ETM_NOSYS; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
405 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
406 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
407 if (last_result == 2) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
408 goto etm_at_atp_txt_cmd_rdy_end; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
409 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
410 text = ((char *) msg->txt_cmd_p); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
411 length = strlen(text); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
412 etm_pkt_putdata(pkt, text, length); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
413 tr_etm(TgTrCore, "ETM CORE: _at_atp_txt_cmd_rdy: text(%s) length(%d)", text, length); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
414 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
415 // Status will be set to ETM_OK_MORE when more data is send. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
416 // Add one because of string length is also returned as part of the result |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
417 pkt->status = (last_result ? ETM_OK : -ETM_OK_MORE); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
418 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
419 if (error < 0) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
420 // tr_etm(TgTrCore,"ETM CORE: _at_atp_txt_cmd_rdy: ERROR(%d)", error); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
421 pkt->status = -error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
422 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
423 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
424 etm_pkt_send(pkt); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
425 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
426 etm_at_atp_txt_cmd_rdy_end: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
427 etm_free(pkt); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
428 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
429 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
430 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
431 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
432 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
433 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
434 * ETM AT - Main Task |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
435 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
436 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
437 // Structur of protocol data dl-link: |target|at_cmd| |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
438 int etm_at(T_ETM_PKT *pkt, char *buf) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
439 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
440 int error = ETM_NOSYS; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
441 int sw_entity; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
442 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
443 // sw_entity = *buf++; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
444 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
445 // FIXME pkt should be use in etm_at_adapter() |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
446 error = etm_at_adapter((char *) buf); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
447 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
448 #if 0 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
449 switch (sw_entity) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
450 case GSM: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
451 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
452 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
453 case BLUE: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
454 //error = etm_at_blue(*buf++); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
455 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
456 default: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
457 tr_etm(TgTrCore,"ETM CORE: _at: ERROR(%d)", error); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
458 error = ETM_NOSYS; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
459 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
460 #endif |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
461 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
462 return error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
463 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
464 |