blob: 7c9cf58146d39afbabc7984bfc3175bd8db29db0 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2005
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*****************************************************************************
37 *
38 * Filename:
39 * ---------
40 * sbp_task.c
41 *
42 * Project:
43 * --------
44 * MAUI
45 *
46 * Description:
47 * ------------
48 * This file is intends for ...
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *============================================================================
55 * HISTORY
56 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
57 *------------------------------------------------------------------------------
58 * removed!
59 *
60 * removed!
61 * removed!
62 * removed!
63 * removed!
64 *
65 * removed!
66 * removed!
67 * removed!
68 * removed!
69 *
70 * removed!
71 * removed!
72 * removed!
73 * removed!
74 * removed!
75 * removed!
76 *
77 * removed!
78 * removed!
79 * removed!
80 *
81 * removed!
82 * removed!
83 * removed!
84 * removed!
85 *
86 * removed!
87 * removed!
88 * removed!
89 * removed!
90 * removed!
91 *
92 * removed!
93 * removed!
94 * removed!
95 *
96 * removed!
97 * removed!
98 * removed!
99 *
100 * removed!
101 * removed!
102 * removed!
103 * removed!
104 * removed!
105 *
106 * removed!
107 * removed!
108 * removed!
109 *
110 * removed!
111 * removed!
112 * removed!
113 *
114 *
115 *------------------------------------------------------------------------------
116 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
117 *============================================================================
118 ****************************************************************************/
119
120/********************************************************************************
121* Copyright Statement:
122* --------------------
123*
124* This product has been developed using a protocol stack
125* developed by Sasken Communication Technologies Limited.
126*
127********************************************************************************/
128
129#include "syscomp_config.h"
130#include "task_config.h" /* Task creation */
131#include "kal_public_defs.h"
132
133#include "l4_msgid.h"
134#include "dhl_trace.h"
135#ifndef __L1_STANDALONE__
136#include "l4_trc.h"
137#endif /* __L1_STANDALONE__ */
138
139#include "ps_public_enum.h"
140#include "ps_public_struct.h"
141#include "sim_exported_enum.h"
142
143#include "sbp_public_utility.h"
144#include "md_sap.h"
145
146extern sbp_reconfigure_module_info_struct *sbp_get_sbp_reconfigure_mod_tbl();
147extern kal_uint8 sbp_get_num_of_sbp_reconfigure_mod_tbl();
148extern kal_bool nvram_custom_config_sbp(sbp_reconfig_custom_param_struct *param_ptr);
149extern kal_bool nvram_custom_config_mcf_profile(sbp_reconfig_custom_param_struct *param_ptr);
150
151#ifdef __IPC_ADAPTER__
152extern kal_bool ss_nvram_custom_config_non_sbp_nv(protocol_id_enum ps_id, kal_uint32 sim_sbp_id);
153#endif
154
155#ifndef __MTK_TARGET__
156kal_bool sbp_reset(void)
157{
158 return KAL_TRUE;
159}
160#endif
161
162kal_bool sbp_init(void)
163{
164 return KAL_TRUE;
165}
166
167void sbp_dsbp_reconfigure_req_hdlr(ilm_struct *ilm_ptr)
168{
169 kal_uint8 ps_id;
170 kal_uint8 total_mod;
171 sbp_reconfigure_module_info_struct *module_tbl;
172 l4c_sbp_dsbp_reconfigure_req_struct *req_ptr;
173 l4c_me_reconfig_enum type = RECONFIG_DSBP_CHANGE;
174 kal_uint32 i;
175 l4c_sbp_dsbp_reconfigure_cnf_struct *cnf_ptr;
176
177 ps_id = ilm_ptr->dest_mod_id - MOD_SBP;
178 req_ptr = (l4c_sbp_dsbp_reconfigure_req_struct*) ilm_ptr->local_para_ptr;
179
180 if (req_ptr->is_all == KAL_TRUE)
181 type |= RECONFIG_DSBP_CHANGE_ALL;
182
183 // Notify MCF for MCF auto select bin before any DSBP NVRAM operation takes place
184 nvram_custom_config_mcf_profile(&req_ptr->sbp_parameters);
185
186 module_tbl = sbp_get_sbp_reconfigure_mod_tbl();
187 total_mod = sbp_get_num_of_sbp_reconfigure_mod_tbl();
188
189 if (req_ptr->is_all)
190 {
191 nvram_custom_config_sbp(&req_ptr->sbp_parameters);
192 }
193
194 for (i=0; i<total_mod; i++)
195 {
196
197#ifndef __L1_STANDALONE__
198 MD_TRC_INFO_SBP_RECONFIGURE_TBL(i, module_tbl[i].mod_id,
199 module_tbl[i].reconfig_type, module_tbl[i].gemini_check);
200#endif
201
202 /* Only handle RECONFIG_IMS_CHANGE type */
203 if ((module_tbl[i].reconfig_type & type) == 0)
204 {
205 continue;
206 }
207
208 /* Check if Gemini module and right protocol id */
209 if ((module_tbl[i].gemini_check & CFG_MASK_MOD) == CFG_SINGLE_MOD)
210 {
211 if (ps_id != PROTOCOL_1)
212 {
213 continue;
214 }
215 }
216 // Check the numbers of GEMINI_LTE that this module supports:
217 else if ((module_tbl[i].gemini_check & CFG_MASK_MOD) == CFG_GEMINI_LTE_MOD)
218 {
219 if (ps_id >= MAX_LTE_NUM)
220 {
221 continue;
222 }
223 }
224 /*else if (((module_tbl[i].gemini_check & CFG_C2K_MOD) == 0) &&
225 (ps_id != ValCurrentActiveSimIndex()))
226 {
227 continue;
228 }*/
229
230 if (module_tbl[i].custom_func_ptr != NULL)
231 {
232 module_tbl[i].custom_func_ptr(&(req_ptr->sbp_parameters));
233 }
234
235 }
236
237 // titan project Network Code custom function
238#ifdef __IPC_ADAPTER__
239 if (req_ptr->is_all == KAL_TRUE)
240 {
241 ss_nvram_custom_config_non_sbp_nv(ps_id, req_ptr->sbp_parameters.sbp_id);
242 }
243 else
244 {
245 ss_nvram_custom_config_non_sbp_nv(ps_id, sbp_get_sim_sbp_id_for_all(ps_id));
246 }
247#endif /* __IPC_ADAPTER__ */
248
249 // send cnf
250 cnf_ptr = (l4c_sbp_dsbp_reconfigure_cnf_struct *)
251 construct_local_para(sizeof(l4c_sbp_dsbp_reconfigure_cnf_struct), TD_RESET);
252 cnf_ptr->is_all = req_ptr->is_all;
253
254 msg_send5(ilm_ptr->dest_mod_id,
255 MOD_L4C + ps_id,
256 L4C_ME_SAP,
257 MSG_ID_L4C_SBP_DSBP_RECONFIGURE_CNF,
258 (local_para_struct *)cnf_ptr);
259
260}
261
262
263void sbp_task_main( task_entry_struct *task_entry_ptr);
264
265kal_bool sbp_create(comptask_handler_struct **handle)
266{
267 static const comptask_handler_struct l4_handler_info =
268 {
269 sbp_task_main, /* task entry function */
270 sbp_init, /* task initialization function */
271 #ifndef __MTK_TARGET__
272 sbp_reset /* task reset handler */
273 #else
274 NULL
275 #endif
276 };
277
278 *handle = (comptask_handler_struct *)&l4_handler_info;
279 return KAL_TRUE;
280}
281
282void sbp_task_main(task_entry_struct *task_entry_ptr)
283{
284 ilm_struct current_ilm;
285
286 while (1)
287 {
288 msg_receive_extq(&current_ilm);
289
290 //stack_set_active_module_id (my_index, current_ilm.dest_mod_id);
291 kal_set_active_module_id(current_ilm.dest_mod_id);
292
293 // handle ILM
294 if (current_ilm.msg_id == MSG_ID_L4C_SBP_DSBP_RECONFIGURE_REQ)
295 {
296 sbp_dsbp_reconfigure_req_hdlr(&current_ilm);
297 }
298
299 destroy_ilm(&current_ilm);
300 }
301
302}
303
304