FreeCalypso > hg > freecalypso-citrine
comparison g23m-gsm/sms/sms_csf.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : SMS_CSF | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This Modul defines the custom specific functions | |
18 | for the component SMS of the mobile station | |
19 | | |
20 | Use this module to integrate the entity | |
21 | in your target system ! | |
22 +----------------------------------------------------------------------------- | |
23 */ | |
24 | |
25 #ifndef SMS_CSF_C | |
26 #define SMS_CSF_C | |
27 | |
28 #include "config.h" | |
29 #include "fixedconf.h" | |
30 #include "condat-features.h" | |
31 | |
32 #define ENTITY_SMS | |
33 | |
34 /*==== INCLUDES ===================================================*/ | |
35 | |
36 #include <string.h> | |
37 #include <stdlib.h> | |
38 #include <stddef.h> | |
39 #include "typedefs.h" | |
40 #include "pcm.h" | |
41 #include "vsi.h" | |
42 #include "custom.h" | |
43 #include "gsm.h" | |
44 #include "message.h" | |
45 #include "ccdapi.h" | |
46 #include "prim.h" | |
47 #include "cus_sms.h" | |
48 #include "cnf_sms.h" | |
49 #include "mon_sms.h" | |
50 #include "pei.h" | |
51 #include "tok.h" | |
52 #include "sms.h" | |
53 | |
54 /*==== EXPORT =====================================================*/ | |
55 | |
56 /*==== PRIVAT =====================================================*/ | |
57 | |
58 /*==== VARIABLES ==================================================*/ | |
59 | |
60 /*==== FUNCTIONS ==================================================*/ | |
61 | |
62 /* | |
63 +--------------------------------------------------------------------+ | |
64 | PROJECT : GSM-PS (8410) MODULE : SMS_CSF | | |
65 | STATE : code ROUTINE : csf_get_sms_instance | | |
66 +--------------------------------------------------------------------+ | |
67 | |
68 PURPOSE : Checks the transaction identitfier and sets the instance. | |
69 | |
70 */ | |
71 | |
72 GLOBAL T_SMS_DATA* csf_get_sms_instance (UBYTE ti) | |
73 { | |
74 GET_INSTANCE_DATA; | |
75 | |
76 TRACE_FUNCTION ("csf_get_sms_instance()"); | |
77 | |
78 if (ti < 8) | |
79 { | |
80 /* | |
81 * mobile originated transaction | |
82 */ | |
83 sms_data->inst = INST_MO; | |
84 | |
85 return sms_data; | |
86 } | |
87 | |
88 if (ti >= 8) | |
89 { | |
90 /* | |
91 * mobile terminated transaction | |
92 */ | |
93 if (sms_data->data[INST_MT].ti EQ ti) | |
94 { | |
95 sms_data->inst = INST_MT; | |
96 | |
97 return sms_data; | |
98 } | |
99 else | |
100 return NULL; | |
101 } | |
102 | |
103 return NULL; | |
104 } | |
105 | |
106 /* | |
107 +--------------------------------------------------------------------+ | |
108 | PROJECT : GSM-PS (8410) MODULE : SMS_CSF | | |
109 | STATE : code ROUTINE : csf_get_new_sms_instance | | |
110 +--------------------------------------------------------------------+ | |
111 | |
112 PURPOSE : Checks the transaction identitfier and sets the instance. | |
113 | |
114 */ | |
115 GLOBAL UBYTE csf_get_new_mo_ti() | |
116 { | |
117 T_SMS_DATA *sms_data = GET_INSTANCE(0); | |
118 UBYTE ti = sms_data->data[INST_MO].ti+1; | |
119 /* | |
120 * mobile originated transaction, valid ti has to be in set [0..6] | |
121 */ | |
122 if (ti >= 7) | |
123 { | |
124 ti=0; | |
125 } | |
126 return ti; | |
127 } | |
128 | |
129 GLOBAL T_SMS_DATA * csf_get_new_sms_instance (UBYTE ti) | |
130 { | |
131 T_SMS_DATA *sms_data = GET_INSTANCE(0); | |
132 | |
133 TRACE_FUNCTION ("csf_get_new_sms_instance()"); | |
134 | |
135 if (ti < 8) | |
136 { | |
137 /* | |
138 * mobile originated transaction, valid ti has to be in set [0..6] | |
139 */ | |
140 sms_data->inst = INST_MO; | |
141 // sms_data->data[INST_MO].ti++; | |
142 // if (sms_data->data[INST_MO].ti >= 7) | |
143 // sms_data->data[INST_MO].ti = 0; | |
144 | |
145 return sms_data; | |
146 } | |
147 | |
148 if (ti >= 8) | |
149 { | |
150 /* | |
151 * mobile terminated transaction | |
152 */ | |
153 if (sms_data->data[INST_MT].ti EQ 0) | |
154 { | |
155 /* | |
156 * The mobile terminated part of SMS is IDLE | |
157 */ | |
158 sms_data->inst = INST_MT; | |
159 sms_data->data[INST_MT].ti = ti; | |
160 | |
161 return sms_data; | |
162 } | |
163 } | |
164 | |
165 return NULL; | |
166 } | |
167 | |
168 /* | |
169 +--------------------------------------------------------------------+ | |
170 | PROJECT : GSM-PS (8410) MODULE : SMS_CSF | | |
171 | STATE : code ROUTINE : csf_free_sms_instance | | |
172 +--------------------------------------------------------------------+ | |
173 | |
174 PURPOSE : Checks the transaction identifier and frees the instance. | |
175 | |
176 */ | |
177 | |
178 GLOBAL void csf_free_sms_instance (UBYTE ti) | |
179 { | |
180 T_SMS_DATA *sms_data = GET_INSTANCE(0); | |
181 | |
182 TRACE_FUNCTION_P1 ("csf_free_sms_instance(TI=%u)", ti); | |
183 | |
184 //#if defined (GPRS) | |
185 // SMS_INST.downlink = SMS_DOWNLINK_NONE; | |
186 //#endif | |
187 | |
188 if (ti >= 8) | |
189 { | |
190 /* | |
191 * mobile terminated transaction | |
192 */ | |
193 if (sms_data->data[INST_MT].ti EQ ti) | |
194 sms_data->data[INST_MT].ti = 0; | |
195 | |
196 if (SMS_RP_RCVD(sms_data) NEQ NULL) | |
197 { | |
198 MFREE (SMS_RP_RCVD(sms_data)); | |
199 SMS_RP_RCVD(sms_data) = NULL; | |
200 } | |
201 } | |
202 /* Commented out as this is used for | |
203 retransmission of the failed message | |
204 if (SMS_DATA_REQ(sms_data) NEQ NULL) | |
205 { | |
206 PFREE (SMS_DATA_REQ(sms_data)); | |
207 SMS_DATA_REQ(sms_data) = NULL; | |
208 } | |
209 */ | |
210 if (SMS_SDU(sms_data) NEQ NULL) | |
211 { | |
212 MFREE (SMS_SDU(sms_data)); | |
213 SMS_SDU(sms_data) = NULL; | |
214 } | |
215 if (SMS_SIM_READ(sms_data) NEQ NULL) | |
216 { | |
217 PFREE (SMS_SIM_READ(sms_data)); | |
218 SMS_SIM_READ(sms_data) = NULL; | |
219 } | |
220 } | |
221 | |
222 #endif /* #ifndef SMS_CSF_C */ |