abm_main.h
17 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
/*****************************************************************************
* 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:
* ---------
* ABM_MAIN.H
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* This file is intends for creating ABM module.
*
* 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!
*
* 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!!
*============================================================================
****************************************************************************/
#ifndef _ABM_MAIN_H
#define _ABM_MAIN_H
#include "abm_feature.h"
#include "abm_api.h"
#include "abm_def.h"
#include "cbm_consts.h"
#include "abm_soc_enums.h"
#include "abm2soc_struct.h"
#include "app2soc_struct.h"
#include "mmi2abm_struct.h"
#include "custom_data_account.h"
#include "stacklib.h"
#include "event_shed.h" /* event schedulet */
#include "stack_timer.h"
#include "kal_public_api.h"
#include "kal_general_types.h"
#include "stack_config.h"
#include "nvram_editor_data_item.h"
#include "kal_public_defs.h"
typedef void (*Wifi_FuncPtr) (void *);
#if defined(__ABM_GPRS_GUARD_TIMER_SUPPORT__) && defined(__PS_SERVICE__)
typedef struct
{
kal_bool is_used;
kal_uint8 timer_id;
kal_uint8 qos_id;
eventid event_id;
kal_uint32 account_id;
} abm_timer_info_struct;
typedef struct
{
event_scheduler *evt_scheduler;
} abm_timer_struct;
#endif /* defined(__ABM_GPRS_GUARD_TIMER_SUPPORT__) && defined(__PS_SERVICE__) */
typedef struct
{
kal_uint16 ps_qos_rec_num; /* total PS QoS profile record numbers */
kal_uint16 ps_qos_rec_size; /* one PS QoS profile record size */
kal_uint16 ps_qos_batch_num; /* batch PS QoS profile record numbers */
kal_uint16 ps_qos_current_rec; /* current PS QoS profile record number */
} abm_nvram_struct;
typedef struct
{
module_type mod_id;
kal_uint32 type;
} abm_app_report_mod_id;
/* Application id */
typedef struct
{
module_type activate_mod_id; /* activated module id */
abm_app_report_mod_id report_mod_id[ABM_MAX_REPORT_BEARER_NUM]; /* module id set by application */
kal_uint8 ap_id; /* application id */
} abm_app_id_struct;
typedef struct
{
module_type mod_id;
kal_uint8 event; /* whcih bearer info ind will be reported */
kal_uint8 type;
} abm_send_bearer_info_struct;
/* ABM application pool */
typedef struct
{
#ifdef __ABM_DISALLOW_NWK_SRV_SUPPRT__
kal_uint32 allow_bearer;
#endif
kal_uint32 app_event; /* application current events */
kal_uint32 ori_account_id[ABM_MAX_APP_ACCT_NUM]; /* original account id: account id + ap id */
kal_uint32 account_id[ABM_MAX_APP_ACCT_NUM]; /* sim id+ account id */
abm_app_id_struct app; /* application id */
abm_bearer_state_enum app_state[ABM_MAX_APP_ACCT_NUM]; /* bearer is activated or deactivated by SOC */
kal_uint8 account_state[ABM_MAX_APP_ACCT_NUM]; /* application's account state */
kal_uint8 reg_state; /* application's registered bearer status */
kal_uint8 reg_type; /* application's registered bearer type */
#ifdef __APP_SECONDARY_PDP_SUPPORT__
kal_uint8 qos_profile_id[ABM_MAX_APP_ACCT_NUM]; /* qos profile id*/
kal_uint8 context_id[ABM_MAX_APP_ACCT_NUM]; /* context id */
#endif /* __APP_SECONDARY_PDP_SUPPORT__ */
#ifdef __CBM_BEARER_SWITCH__
kal_uint8 cur_fb_status;
kal_uint8 next_acct_num; /* next account id whcih will be used to activate the bearer */
#endif /* __CBM_BEARER_SWITCH__ */
#if defined(__APP_STATIC_QOS_PROFILE_SUPPORT__) || defined(__APP_DYNAMIC_QOS_PROFILE_SUPPORT__)
kal_uint8 qos_profile_idx; /* qos profile index */
nvram_ef_abm_ps_qos_profile_struct *qos_profile;
#endif /* defined(__APP_STATIC_QOS_PROFILE_SUPPORT__) || defined(__APP_DYNAMIC_QOS_PROFILE_SUPPORT__) */
} abm_app_proc_struct;
/* ABM WIFI account pool */
typedef struct
{
kal_uint8 account_id;
kal_uint8 state;
abm_bearer_state_enum app_state;
kal_bool is_activated_by_soc;
/* abm is in waiting the connection request sent from MMI */
kal_bool is_waiting_connect;
/* abm is in waiting the disconnection request sent from MMI */
kal_bool is_waiting_disconnect;
#ifdef __OP01__
abm_portal_state_enum portal_verify_state;
kal_uint8 portal_app_id;
#endif
kal_bool use_dhcp;
kal_uint8 dhcp_state;
kal_uint8 ip_addr[4];
kal_uint8 gateway[4];
kal_uint8 netmask[4];
kal_uint8 pri_dns_addr[4];
kal_uint8 sec_dns_addr[4];
kal_bool ip_update_pending;
kal_uint8 ip_addr_new[4];
kal_uint8 gateway_new[4];
kal_uint8 netmask_new[4];
kal_uint8 pri_dns_addr_new[4];
kal_uint8 sec_dns_addr_new[4];
kal_uint8 mac_addr[6];
kal_uint8 wndrv_handle;
Wifi_FuncPtr todo;
void *data;
#ifdef __GAS_SUPPORT__
kal_bool use_gas;
kal_uint8 gas_src_id;
#endif /* __GAS_SUPPORT__ */
} abm_wifi_bearer_struct;
/* ABM CSD account pool */
typedef struct
{
kal_uint8 state;
kal_uint32 account_id; /* sim id + account id*/
abm_bearer_state_enum app_state; /* bearer is deactivated by SOC or MMI CBM */
kal_uint8 ip_addr[4];
kal_uint8 pri_dns_addr[4];
kal_uint8 sec_dns_addr[4];
kal_uint16 mtu;
void *profile;
} abm_csd_bearer_struct;
typedef struct
{
kal_uint32 account_id; /* sim id + account id*/
#ifdef __HOTSPOT_SUPPORT__
void *profile;
#endif
kal_uint16 mtu;
abm_dhcp_state_enum dhcp_state;
cbm_bearer_enum bearer;
kal_bool is_activate;
#ifdef __USB_TETHERING__
kal_bool is_suspend;
#endif
kal_uint8 state;
kal_uint8 ip_addr[4];
kal_uint8 dns1[4];
kal_uint8 dns2[4];
#ifdef __HOTSPOT_SUPPORT__
kal_uint8 mac_addr[6];
kal_bool is_waiting_init_rsp;
#endif /* __HOTSPOT_SUPPORT__*/
} abm_share_bearer_struct;
#ifdef __PS_SERVICE__
/* ABM PS account pool */
typedef struct
{
kal_uint8 account_id;
#ifdef __APP_SECONDARY_PDP_SUPPORT__
kal_uint8 context_id;
#endif
kal_uint8 *profile;
} abm_ps_nwk_neg_qos_struct;
typedef struct
{
#ifdef __GPRS_BEARER_REPORT_NEGOTIATED_QOS__
abm_ps_nwk_neg_qos_struct *nwk_neg_qos;
#endif
void *profile;
kal_uint32 account_id;
kal_uint8 state;
kal_uint8 app_state;
kal_uint8 ip_addr[4];
kal_uint8 pri_dns_addr[4];
kal_uint8 sec_dns_addr[4];
kal_uint8 context_id;
#ifdef __APP_SECONDARY_PDP_SUPPORT__
kal_uint8 qos_profile_id;
#endif /* __APP_SECONDARY_PDP_SUPPORT__ */
} abm_ps_bearer_struct;
#endif /* __PS_SERVICE__ */
/* ABM DCD account pool */
typedef struct
{
kal_uint8 state;
kal_uint8 account_id;
kal_uint8 ip_addr[4];
kal_uint8 pri_dns_addr[4];
kal_uint8 sec_dns_addr[4];
} abm_internal_ps_bearer_struct;
/* ABM Account Pool */
#if defined(__TCPIP_OVER_CSD__) || defined(__PS_SERVICE__) || defined(__HOTSPOT_SUPPORT__) || defined(__USB_TETHERING__)
typedef struct
{
#ifdef __TCPIP_OVER_CSD__
/* CSD account table */
abm_csd_bearer_struct csd_bearer;
#endif
#if defined(__HOTSPOT_SUPPORT__) || defined(__USB_TETHERING__)
abm_share_bearer_struct share_bearer;
#endif
#ifdef __PS_SERVICE__
/* GPRS table size can be adjusted by the customer */
abm_ps_bearer_struct ps_bearer[GPRS_MAX_PDP_SUPPORT];
#endif /* __PS_SERVICE__ */
} abm_account_pool_struct;
#endif /* defined(__TCPIP_OVER_CSD__) || defined(__PS_SERVICE__) || defined(__HOTSPOT_SUPPORT__) || defined(__USB_TETHERING__) */
typedef struct
{
void *data;
void *func;
kal_uint8 type;
} abm_app_callback_struct;
typedef struct
{
kal_uint64 app_type;
kal_uint16 app_str_id;
kal_uint16 app_icon_id;
abm_app_callback_struct callback[MAX_APP_CALLBACK_NUM];
kal_uint8 valid;
kal_uint8 app_id;
} abm_app_id_table_struct;
typedef struct
{
kal_uint32 acct_id;
kal_uint16 bandwidth;
kal_uint8 qos_profile_id; /* return to application */
kal_uint8 app_type; /* applicatoin type for encode function */
soc_abm_dl_filter_struct dl_filters[ABM_MAX_DL_FILTERS];
kal_uint8 dl_filter_num;
} abm_app_qos_struct;
#ifdef __APP_STATIC_QOS_PROFILE_SUPPORT__
typedef struct
{
kal_uint8 qos_profile_idx;
module_type mod_id;
} abm_qos_report_event_struct;
typedef struct
{
abm_qos_report_event_struct event[ABM_MAX_APP_NUM];
} abm_qos_event_struct;
#endif /* __APP_STATIC_QOS_PROFILE_SUPPORT__ */
typedef struct
{
kal_uint32 account_id;
cbm_bearer_enum bearer_type;
} abm_account_info_struct;
typedef struct
{
mmi_abm_dialup_struct info;
kal_uint32 state;
kal_uint32 app_state;
} abm_dialup_info_struct;
/* ABM context */
typedef struct
{
kal_mutexid lock;
kal_uint32 app_id_list[ABM_MAX_APP_ID_LIST_NUM];
#ifdef __APP_DYNAMIC_QOS_PROFILE_SUPPORT__
kal_uint32 dynamic_qos_id;
#endif
#ifdef __APP_STATIC_QOS_PROFILE_SUPPORT__
abm_qos_event_struct *static_qos_event;
#endif
#if defined(__TCPIP_OVER_CSD__) || defined(__PS_SERVICE__)
abm_account_pool_struct account_pool;
#endif
abm_app_proc_struct app_pool[ABM_MAX_APP_NUM]; /* applicaiton pool */
#ifdef __APP_SECONDARY_PDP_SUPPORT__
/* pool to store the pdp context data whcih will be used when we in reactive state */
abm_app_qos_struct pdp_context_pool[ABM_MAX_APP_NUM];
#endif /* __APP_SECONDARY_PDP_SUPPORT__ */
abm_app_id_table_struct app_tbl_pool[ABM_MAX_APP_NUM]; /* MMI CBM application table */
abm_send_bearer_info_struct bearer_event[ABM_MAX_APP_NUM]; /* Define which bearer info should be reported */
#if defined(__ABM_GPRS_GUARD_TIMER_SUPPORT__) && defined(__PS_SERVICE__)
abm_timer_struct abm_timer; /* GPRS guard timer */
#endif
#ifdef __APP_STATIC_QOS_PROFILE_SUPPORT__
abm_nvram_struct nvram_info;
#endif
abm_account_info_struct acct_info[MAX_ACCOUNT_UPDATE_NUM]; /* updated account list */
#ifdef __ABM_DISALLOW_NWK_SRV_SUPPRT__
cbm_bearer_enum nwk_srv_disallow[CBM_SIM_ID_TOTAL]; /* disallow network service or not*/
mmi_abm_nwk_srv_req_struct *nwk_srv_req;
#endif /* __ABM_DISALLOW_NWK_SRV_SUPPRT__ */
kal_uint8 avail_app_id; /* current available global app id */
#if !defined(EMPTY_MMI) && defined(__GEMINI__)
kal_uint8 rcv_approve_src; /* received response from L4C */
kal_bool rcv_approve_rsp; /* received result from L4C */
#endif /* !defined(EMPTY_MMI) && defined(__GEMINI__) */
#ifdef __PS_SERVICE__
cbm_bearer_enum bearer_type; /* real packet swith service type */
kal_uint8 gprs_status[CBM_SIM_ID_TOTAL];
#endif /* __PS_SERVICE__ */
abm_dialup_info_struct dialup_info[ABM_MAX_DIALUP_NUM];
kal_uint32 disc_bearer_type;
cbm_sim_id_enum disc_sim_id;
mmi_abm_update_app_info_struct invalid_app_info[ABM_MAX_APP_NUM]; /* invalid app list */
} abm_context_struct;
extern abm_context_struct *const abm_cxt_ptr;
#define ABM_CTX(x) (abm_cxt_ptr->x)
#if defined(__TCPIP_OVER_CSD__) || defined(__PS_SERVICE__)
#define ABM_ACCT_PTR(X) (&ABM_CTX(account_pool.X))
#endif
#define ABM_APP_PTR(_s_) (&ABM_CTX(app_pool[_s_]))
#define ABM_BEARER_INFO_PTR(_s_) (&ABM_CTX(bearer_event[_s_]))
#ifdef __PS_SERVICE__
#define ABM_TIMER(X) ABM_CTX(abm_timer.X)
#define ABM_PS_ACCT_POOL_STATE(_s_) (ABM_CTX(account_pool).ps_bearer[_s_].state)
#define ABM_PS_ACCT_POOL_APP_STATE(_s_) (ABM_CTX(account_pool).ps_bearer[_s_].app_state)
#define ABM_PS_ACCT_POOL_ACCT_ID(_s_) (ABM_CTX(account_pool).ps_bearer[_s_].account_id)
#define ABM_PS_ACCT_POOL_IP_ADDR(_s_) (ABM_CTX(account_pool).ps_bearer[_s_].ip_addr)
#define ABM_PS_ACCT_POOL_PRI_DNS_ADDR(_s_) (ABM_CTX(account_pool).ps_bearer[_s_].pri_dns_addr)
#define ABM_PS_ACCT_POOL_SEC_DNS_ADDR(_s_) (ABM_CTX(account_pool).ps_bearer[_s_].sec_dns_addr)
#define ABM_PS_ACCT_POOL_CTX_ID(_s_) (ABM_CTX(account_pool).ps_bearer[_s_].context_id)
#ifdef __APP_SECONDARY_PDP_SUPPORT__
#define ABM_QOS_POOL_PTR(_s_) (&ABM_CTX(pdp_context_pool[_s_]))
#define ABM_PS_ACCT_POOL_QOS_ID(_s_) (ABM_CTX(account_pool).ps_bearer[_s_].qos_profile_id)
#endif /* __APP_SECONDARY_PDP_SUPPORT */
#endif /* __PS_SERVICE__ */
#define ABM_GLOBAL_LOCK kal_take_mutex(ABM_CTX(lock))
#define ABM_GLOBAL_UNLOCK kal_give_mutex(ABM_CTX(lock))
#define ABM_APP_TBL_PTR(_s_) (&ABM_CTX(app_tbl_pool[_s_]))
typedef union
{
kal_uint32 acct_id;
struct
{
kal_uint8 ori_acct_id[2]; /* 1 bit:always-ask 7 bits: account id*/
kal_uint8 sim_id;
kal_uint8 app_data; /* 8 bits: ap id*/
} acct_mask;
} abm_acct_union_struct;
#define ABM_ENCODE_MASK_ALWAYS_ASK (0x80)
#define ABM_ENCODE_MASK_APP_ID (0xff)
#define ABM_ENCODE_MASK_ACCT_ID (0x7f)
#define ABM_ENCODE_ACCT_MASK (0xffffffff)
#endif /* _ABM_MAIN_H */