phb_context.c
23.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* phb_context.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
*
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#undef _FILE_CODE_
#define _FILE_CODE_ _PHB_CONTEXT_C_
#include "kal_release.h" /* Basic data type */
//#include "stack_common.h"
//#include "stack_msgs.h"
//#include "app_ltlcom.h" /* Task message communiction */
#include "sim_common_enums.h"
// #include "nvram_editor_data_item.h"
//#include "custom_nvram_editor_data_item.h"
//#include "l4_common.h"
#include "ps2sim_struct.h"
//#include "l4c2phb_enums.h"
//#include "l4c2phb_struct.h"
//#include "kal_trace.h"
//#include "phb_trc.h"
/* Prerequisite of phb_context.h */
#include "phb_defs.h"
#include "phb_control_block.h"
#include "phb_config.h"
#include "phb_data_desc.h"
#include "phb_data_entry_table.h"
//#include "phb_pindex.h"
//#include "phb_name_num_index.h"
#include "phb_context.h"
#include "phb_config.h"
#if defined(__GEMINI__) || defined(GEMINI_PLUS)
#include "sim_common_enums.h"
#endif /* defined(__GEMINI__) || defined(GEMINI_PLUS) */
#include "stack_config.h"
#include "kal_general_types.h"
#include "kal_public_api.h"
/*
* Dual SIM: phb_ptr assignment will be done in layer4_module_context_selection
* Single SIM: phb_ptr assignment will be done in phb_init
*/
phb_context_type phb_context[PHB_SIM_NUM];
phb_context_type *phb_ptr;
#if defined(__GEMINI__) || defined(GEMINI_PLUS)
module_type phb_current_mod;
extern ext_index_struct *ext_index_table;
extern ext_index_struct ext_index_table_context[PHB_SIM_NUM][EXT1_MAX_ENTRIES_COUNT];
#ifdef __PHB_USIM_SUPPORT__
extern ext_index_struct ext5_index_table_context[PHB_SIM_NUM][EXT5_MAX_ENTRIES_COUNT];
extern ext_index_struct *ext5_index_table;
/*
extern kal_uint8 *anr_index_table;
extern kal_uint8 anr_index_table_context[PHB_SIM_NUM][ANR_INDEX_MAX_ENTRIES_COUNT];
extern kal_uint8 *email_index_table;
extern kal_uint8 email_index_table_context[PHB_SIM_NUM][EMAIL_INDEX_MAX_ENTRIES_COUNT];
extern kal_uint8 *sne_index_table;
extern kal_uint8 sne_index_table_context[PHB_SIM_NUM][SNE_INDEX_MAX_ENTRIES_COUNT];
*/
#endif /* __PHB_USIM_SUPPORT__ */
#if defined(__PINYIN_SORTING_ZI__) || defined(__PINYIN_SORTING_KA__)
extern alpha_id_type *alpha_id_pinyin_PHB;
extern alpha_id_type alpha_id_pinyin_PHB_context[PHB_SIM_NUM][PHB_INDEX_MAX_ENTRIES_COUNT];
#endif /* defined(__PINYIN_SORTING_ZI__) || defined(__PINYIN_SORTING_KA__) */
#if defined(__PHB_FDN_GET_NAME__) || defined(__ECALL_SUPPORT__)
l4_addr_bcd_struct *fdn_num_ptr;
l4_addr_bcd_struct fdn_num_context[PHB_SIM_NUM][FDN_INDEX_MAX_ENTRIES_COUNT];
l4_name_struct *fdn_name_ptr;
l4_name_struct fdn_name_context[PHB_SIM_NUM][FDN_INDEX_MAX_ENTRIES_COUNT];
#endif /* __PHB_FDN_GET_NAME__ */
#if defined(__ECALL_SUPPORT__)
l4_addr_bcd_struct *sdn_num_ptr;
l4_addr_bcd_struct sdn_num_context[PHB_SIM_NUM][2];
#endif /* __PHB_FDN_GET_NAME__ */
#else /* __GEMINI__ */
#if defined(__PHB_FDN_GET_NAME__) || defined(__ECALL_SUPPORT__)
l4_addr_bcd_struct fdn_num_context[FDN_INDEX_MAX_ENTRIES_COUNT];
l4_addr_bcd_struct *fdn_num_ptr = fdn_num_context;
l4_name_struct fdn_name_context[FDN_INDEX_MAX_ENTRIES_COUNT];
l4_name_struct *fdn_name_ptr = fdn_name_context;
#endif /* __PHB_FDN_GET_NAME__ */
#if defined(__ECALL_SUPPORT__)
l4_addr_bcd_struct sdn_num_context[2];
l4_addr_bcd_struct *sdn_num_ptr = sdn_num_context;
#endif /* __PHB_FDN_GET_NAME__ */
#endif /* __GEMINI__ */
#if !defined(__PHB_NO_CALL_LOG__)
#ifdef __PHB_RECORD_LN_TYPE_SEQ__
#if defined(__GEMINI__) || defined(GEMINI_PLUS)
kal_uint8 phb_ln_type_seq_context[PHB_SIM_NUM][PHB_TOTAL_LN_ENTRIES];
kal_uint8 *phb_ln_type_seq;
#else /* __GEMINI__ */
kal_uint8 phb_ln_type_seq[PHB_TOTAL_LN_ENTRIES];
#endif /* __GEMINI__ */
#endif /* __PHB_RECORD_LN_TYPE_SEQ__ */
#if (MAX_PHB_LN_ENTRY > 20)
phb_ln_entry_struct shifted_entry;
#endif
#endif /* !defined(__PHB_NO_CALL_LOG__) */
/*****************************************************************************
* FUNCTION
* phb_context_reset
* DESCRIPTION
* Reset context of PHB. Including:
* 1. Clean ECC.
* 2. Reset dn_type to TYPE_NONE.
* 3. Construct control_blocks.
* 4. Reset state to STATE_NOT_READY.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void phb_context_reset()
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* PHB context shall not be NULL) */
ASSERT(phb_ptr != NULL);
kal_mem_set(&phb_ptr->ecc, 0, sizeof(sim_ecc_struct));
phb_ptr->dn_type = TYPE_NONE;
for (i = 0; i < PHB_CONCURRENCY_DEGREE; ++i)
{
phb_control_block_construct(&phb_ptr->control_block[i], i);
}
phb_ptr->state = PHB_STATE_NOT_READY;
#ifdef __PHB_USIM_SUPPORT__
// for Emergency Service Category
phb_desc_set_alpha_len(DATA_DESC_ECC, 30);
phb_ptr->is_global = KAL_TRUE;
#ifdef __PHB_USIM_ADDITIONAL_SUPPORT__
phb_ptr->anr_count = 0;
phb_ptr->sne_count= 0;
phb_ptr->email_count= 0;
#endif /* __PHB_USIM_ADDITIONAL_SUPPORT__ */
#endif /* __PHB_USIM_SUPPORT__ */
phb_desc_set_alpha_len(DATA_DESC_ADN, 30);
phb_desc_set_alpha_len(DATA_DESC_FDN, 30);
phb_desc_set_alpha_len(DATA_DESC_BDN, 30);
phb_desc_set_alpha_len(DATA_DESC_MSISDN, 30);
phb_ptr->compare_digit = 0;
}
#if defined(__PHB_FDN_GET_NAME__) || defined(__ECALL_SUPPORT__)
/*****************************************************************************
* FUNCTION
* phb_init_fdn_context
* DESCRIPTION
* This is for init fdn context
* PARAMETERS
* ilm_ptr [IN] The primitives
* RETURNS
* void
*****************************************************************************/
void phb_init_fdn_context(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#if defined(__GEMINI__) || defined(GEMINI_PLUS)
kal_uint8 i;
for (i = 0; i < PHB_SIM_NUM; i++)
{
fdn_name_ptr = fdn_name_context[i];
fdn_num_ptr = fdn_num_context[i];
memset((kal_uint8*) fdn_name_ptr, 0x00, sizeof(l4_name_struct) * FDN_INDEX_MAX_ENTRIES_COUNT);
memset((kal_uint8*) fdn_num_ptr, 0x00, sizeof(l4_addr_bcd_struct) * FDN_INDEX_MAX_ENTRIES_COUNT);
}
#else /* __GEMINI__ */
memset((kal_uint8*) fdn_name_ptr, 0x00, sizeof(l4_name_struct) * FDN_INDEX_MAX_ENTRIES_COUNT);
memset((kal_uint8*) fdn_num_ptr, 0x00, sizeof(l4_addr_bcd_struct) * FDN_INDEX_MAX_ENTRIES_COUNT);
#endif /* __GEMINI__ */
}
/*****************************************************************************
* FUNCTION
* phb_update_fdn_context
* DESCRIPTION
* This is for update fdn context
* PARAMETERS
* ilm_ptr [IN] The primitives
* RETURNS
* void
*****************************************************************************/
void phb_update_fdn_context(kal_uint16 record_index, l4_name_struct* alpha_id, l4_addr_bcd_struct* tel_number)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
l4_name_struct* name = &fdn_name_ptr[record_index - 1];
l4_addr_bcd_struct* num = &fdn_num_ptr[record_index - 1];
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (alpha_id != NULL)
{
memcpy((kal_uint8*) name, (kal_uint8*) alpha_id, sizeof(l4_name_struct));
}
else
{
memset((kal_uint8*) name, 0x00, sizeof(l4_name_struct));
}
if (tel_number != NULL)
{
memcpy((kal_uint8*) num, (kal_uint8*) tel_number, sizeof(l4_addr_bcd_struct));
}
else
{
memset((kal_uint8*) num, 0x00, sizeof(l4_addr_bcd_struct));
}
}
#endif /* __PHB_FDN_GET_NAME__ */
#if defined(__ECALL_SUPPORT__)
/*****************************************************************************
* FUNCTION
* phb_init_fdn_context
* DESCRIPTION
* This is for init fdn context
* PARAMETERS
* ilm_ptr [IN] The primitives
* RETURNS
* void
*****************************************************************************/
void phb_init_sdn_context(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#if defined(__GEMINI__) || defined(GEMINI_PLUS)
kal_uint8 i;
for (i = 0; i < PHB_SIM_NUM; i++)
{
sdn_num_ptr = sdn_num_context[i];
memset((kal_uint8*) sdn_num_ptr, 0x00, sizeof(l4_addr_bcd_struct) * 2);
}
#else /* __GEMINI__ */
memset((kal_uint8*) sdn_num_ptr, 0x00, sizeof(l4_addr_bcd_struct) * 2);
#endif /* __GEMINI__ */
}
/*****************************************************************************
* FUNCTION
* phb_update_fdn_context
* DESCRIPTION
* This is for update fdn context
* PARAMETERS
* ilm_ptr [IN] The primitives
* RETURNS
* void
*****************************************************************************/
void phb_update_sdn_context(kal_uint16 record_index, l4_name_struct* alpha_id, l4_addr_bcd_struct* tel_number)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
l4_addr_bcd_struct* num;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (record_index == phb_ptr->data_desc[DATA_DESC_SDN].record_num)
{
num = &sdn_num_ptr[1];
}
else if (record_index == phb_ptr->data_desc[DATA_DESC_SDN].record_num - 1)
{
num = &sdn_num_ptr[0];
}
else
{
return;
}
if (tel_number != NULL)
{
memcpy((kal_uint8*) num, (kal_uint8*) tel_number, sizeof(l4_addr_bcd_struct));
}
else
{
memset((kal_uint8*) num, 0x00, sizeof(l4_addr_bcd_struct));
}
}
#endif /* __PHB_FDN_GET_NAME__ */
#if !defined(__PHB_NO_CALL_LOG__)
#ifdef __PHB_RECORD_LN_TYPE_SEQ__
#ifdef __PHB_ALWAYS_SYNC_SIM_LN__
/*****************************************************************************
* FUNCTION
* phb_clear_lnd_type_seq
* DESCRIPTION
* Clear the lnd type sequence.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void phb_clear_lnd_type_seq(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint16 i = 0, j = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
while (j < PHB_TOTAL_LN_ENTRIES || phb_ln_type_seq[j] == 0xff)
{
if (phb_ln_type_seq[j] != PHB_LND)
{
phb_ln_type_seq[i] = phb_ln_type_seq[j];
i++;
}
j++;
}
while (i < PHB_TOTAL_LN_ENTRIES)
{
phb_ln_type_seq[i] = 0xff;
i++;
}
}
#endif /* __PHB_ALWAYS_SYNC_SIM_LN__ */
/*****************************************************************************
* FUNCTION
* phb_set_ln_type_seq
* DESCRIPTION
* Set the ln type sequence by given type.
* PARAMETERS
* num [IN]
* type [IN]
* RETURNS
* void
*****************************************************************************/
void phb_set_ln_type_seq(kal_uint16 num, kal_uint8 type)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint16 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (num > PHB_TOTAL_LN_ENTRIES)
{
ASSERT(0);
num = PHB_TOTAL_LN_ENTRIES;
}
for (i = 0; i < num; i++)
{
phb_ln_type_seq[i] = type;
}
}
#if (MAX_PHB_LN_ENTRY > 20)
/*****************************************************************************
* FUNCTION
* phb_get_ln_total_entry
* DESCRIPTION
* Get the total number of ln entry by the given type.
* PARAMETERS
* type [IN]
* RETURNS
*
*****************************************************************************/
kal_uint16 phb_get_ln_total_entry(kal_uint8 type)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint16 i = 0;
kal_uint16 total = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
while (i < PHB_TOTAL_LN_ENTRIES && phb_ln_type_seq[i] != 0xff)
{
if (phb_ln_type_seq[i] == type)
{
total++;
}
i++;
}
return total;
}
#endif /* (MAX_PHB_LN_ENTRY > 20) */ /* MAX_PHB_LN_ENTRY > 20 */
#endif /* __PHB_RECORD_LN_TYPE_SEQ__ */
#endif /* !defined(__PHB_NO_CALL_LOG__) */
/*****************************************************************************
* FUNCTION
* phb_alloc_control_block
* DESCRIPTION
* Allocate of control_block.
* PARAMETERS
* void
* control_block(?) [IN] The control_block
* RETURNS
* The allocated control_block is success, NULL otherwise.
*****************************************************************************/
control_block_type *phb_alloc_control_block()
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint8 i;
control_block_type *control_block = NULL;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* PHB context shall not be NULL) */
ASSERT(phb_ptr != NULL);
for (i = 0; i < PHB_CONCURRENCY_DEGREE; ++i)
{
if (phb_ptr->control_block[i].is_allocated == KAL_TRUE)
{
continue;
}
control_block = &phb_ptr->control_block[i];
phb_control_block_construct(control_block, i);
control_block->is_allocated = KAL_TRUE;
break;
}
return control_block;
}
/*****************************************************************************
* FUNCTION
* phb_free_control_block
* DESCRIPTION
* Destructs / resets the control block.
* PARAMETERS
* control_block [IN] The control_block to set
* RETURNS
* void
*****************************************************************************/
void phb_free_control_block(control_block_type *control_block)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
ASSERT(control_block->is_allocated == KAL_TRUE);
kal_mem_set(control_block, 0, sizeof(control_block_type));
/* control_block->is_allocated = KAL_FALSE; */
} /* end of control_block_set_destruct */
/*****************************************************************************
* FUNCTION
* phb_reset_all_control_blocks
* DESCRIPTION
* Reset all control_blocks
* PARAMETERS
* void
* control_block(?) [IN] The control_block
* RETURNS
* First control_block.(?)
*****************************************************************************/
void phb_reset_all_control_blocks()
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint8 i;
control_block_type *control_block = NULL;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* PHB context shall not be NULL) */
ASSERT(phb_ptr != NULL);
for (i = 0; i < PHB_CONCURRENCY_DEGREE; ++i)
{
control_block = &phb_ptr->control_block[i];
phb_control_block_construct(control_block, i);
control_block->is_allocated = KAL_FALSE;
}
}
#if defined(__GEMINI__) || defined(GEMINI_PLUS)
/*****************************************************************************
* FUNCTION
* phb_context_selection
* DESCRIPTION
* This is deinit() function of PHB module.
* This function finalize all the context variables required for PHB module
* PARAMETERS
* void
* RETURNS
* True if succeed.
*****************************************************************************/
void phb_context_selection(kal_uint8 sim_interface)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint8 which_sim = sim_interface;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#if defined(__GEMINI__) || defined(GEMINI_PLUS)
phb_current_mod = (module_type) (MOD_PHB + which_sim);
#endif
/* assign context */
phb_ptr = &phb_context[which_sim];
#ifdef __PHB_RECORD_LN_TYPE_SEQ__
phb_ln_type_seq = phb_ln_type_seq_context[which_sim];
#endif
ext_index_table = ext_index_table_context[which_sim];
#ifdef __PHB_USIM_SUPPORT__
ext5_index_table = ext5_index_table_context[which_sim];
#endif /* __PHB_USIM_SUPPORT__ */
#if defined(__PINYIN_SORTING_ZI__) || defined(__PINYIN_SORTING_KA__)
alpha_id_pinyin_PHB = alpha_id_pinyin_PHB_context[which_sim];
#endif /* defined(__PINYIN_SORTING_ZI__) || defined(__PINYIN_SORTING_KA__) */
#if defined(__PHB_FDN_GET_NAME__) || defined(__ECALL_SUPPORT__)
fdn_name_ptr = fdn_name_context[which_sim];
fdn_num_ptr = fdn_num_context[which_sim];
#endif
#if defined(__ECALL_SUPPORT__)
sdn_num_ptr = sdn_num_context[which_sim];
#endif
}
#endif /* __GEMINI__ */