comparison src/g23m-aci/aci/phb.h @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : MMI-Framework (8417)
4 | Modul : PSA_PHB
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 : Definitions for phonebook management of MMI framework
18 +-----------------------------------------------------------------------------
19 */
20 #ifndef PHB_H
21 #define PHB_H
22
23 #ifdef TI_PS_FFS_PHB
24
25 /*
26 * Include the header files needed for the FFS based SIM phonebook.
27 */
28 #include "db.h"
29 #include "phb_sim.h"
30 #include "phb_aci.h"
31
32 #else
33
34 /*
35 * Old RAM based SIM phonebook.
36 */
37
38 /* A definition to avoid TI_PS_FFS_PHB sometimes */
39 typedef UBYTE T_PHB_STAT;
40
41 #define PHB_BUSY 4
42 #define PHB_READY 5
43 #define PHB_UNKNOWN 6
44 #define PHB_WRITE_FAIL 7
45
46 #define PHB_NUMBER 1
47 #define PHB_NAME 2
48 #define PHB_INDEX 3
49
50 #define PHB_NO_EXT 0
51 #define PHB_NUMBER_EXT 1
52 #define PHB_SUBADDR1_EXT 2
53 #define PHB_SUBADDR2_EXT 3
54
55 /* SIM operation mode */
56
57 #define NO_OPERATION 0
58 #define FDN_DISABLE 1
59 #define FDN_ENABLE 2
60
61 /* definition for the maximal records in the phone book. */
62 #define MAX_PHB_LIST 10
63
64 #define MAX_ECC_RCD 5
65 #define PHB_MAX_TAG_LEN 20
66
67 #ifdef PHONEBOOK_EXTENSION
68 #define PHB_PACKED_NUM_LEN 22
69 #else
70 #define PHB_PACKED_NUM_LEN 10
71 #endif /* #ifdef PHONEBOOK_EXTENSION */
72
73 #define PHB_EXT_RCD 4
74
75 #define MAX_PHB_ENTRY 5
76 #if !defined(FAX_AND_DATA) AND !defined(GPRS)
77 /*
78 * for GoLite decreased to 200 entries
79 */
80 #define MAX_AFB_RECORDS 200
81 #else
82
83 #ifndef _SIMULATION
84 /*
85 * Increased from 255 to 300 entries -
86 * now 16bit encoded - might be even
87 * larger to maintain all SIM phb entries
88 */
89 #define MAX_AFB_RECORDS 300
90 #else /* _SIMULATION */
91
92 /* The number is decreased iin case of simulation for
93 phonebook testing purpose */
94 #define MAX_AFB_RECORDS 8
95 #endif /* _SIMULATION */
96
97 #endif
98
99 #define MAX_RDM_RECORDS 30
100
101 #define MAX_ADN_BITMAP 32
102 #define MAX_FDN_BITMAP 10
103 #define MAX_BDN_BITMAP 5
104 #define MAX_SDN_BITMAP 5
105 #define MAX_ECC_BITMAP 1
106 #define MAX_UPN_BITMAP 1
107 #define PHB_ELEMENT_FREE 0
108 #define PHB_ELEMENT_USED 1
109
110 #ifdef PHONEBOOK_EXTENSION
111 #define MAX_EXT1_BITMAP 8
112 #define MAX_EXT2_BITMAP 4
113 #define MAX_EXT3_BITMAP 4
114 #define MAX_EXT4_BITMAP 4
115
116 typedef enum
117 {
118 EXT1 = 0, /* ADN, LDN phonebook Extention */
119 EXT2, /* FDN phonebook Extention */
120 EXT3,
121 EXT4,
122 MAX_PHB_EXT
123 } T_PHB_EXT_TYPE;
124
125 typedef struct
126 {
127 UBYTE mem;
128 UBYTE max_rcd;
129 UBYTE *rcd_bitmap;
130 } T_PHB_EXT_RECORDS;
131 #endif /* PHONEBOOK_EXTENSION */
132
133 typedef enum
134 {
135 NO_PHB_ENTRY = 0,
136 SIM_MEMORY,
137 TE_MEMORY
138 } T_PHB_MEMORY;
139
140 #ifndef NO_ASCIIZ
141 #define NO_ASCIIZ
142 #endif
143
144 #ifndef TI_PS_FFS_PHB
145 typedef enum
146 {
147 ECC = 0, /* Emergency call numbers */
148 ADN, /* Abbreviated dialing number */
149 FDN, /* Fixed dialing number */
150 BDN, /* Barred dialing number */
151 LDN, /* Last dialing number */
152 LRN, /* Last received number */
153 SDN, /* Service dialing number */
154 LMN, /* last missed number */
155 ADN_FDN, /* merged ADN and FDN */
156 UPN, /* User person number */
157 MAX_PHONEBOOK
158 } T_PHB_TYPE;
159 #endif
160
161 /* Phonebook functional return codes */
162 typedef enum
163 {
164 PHB_FAIL = -1, /* execution of command failed */
165 PHB_OK, /* execution of command completed */
166 PHB_FULL, /* Phonebook is full */
167 PHB_EXCT, /* execution (writing to SIM) is running */
168 PHB_INVALID_IDX, /* invalid index requested */
169 PHB_TAG_EXCEEDED, /* entry is too long to fit on SIM */
170 PHB_EXT_FULL /* Phonebook Extension is full */
171 } T_PHB_RETURN;
172
173 /* Phonebook search flag */
174 typedef enum
175 {
176 PHB_NEW_SEARCH = 0, /* execution of command failed */
177 PHB_NEXT_SEARCH /* execution of command completed */
178 } T_PHB_SEARCH;
179
180 typedef struct
181 {
182 UBYTE book;
183 UBYTE index; /* record number ( might be > 255) */
184 UBYTE tag_len; /* Length of Alpha identifier */
185 UBYTE tag[PHB_MAX_TAG_LEN]; /* Alpha identifier */
186 UBYTE len; /* Length of BCD number/SSC contens */
187 UBYTE ton_npi; /* TON and NPI */
188 UBYTE number[PHB_PACKED_NUM_LEN]; /* Dialing number/SSC string */
189 UBYTE subaddr[PHB_PACKED_NUM_LEN];
190 UBYTE cc_id; /* Capability/Configuration identifier */
191 UBYTE year;
192 UBYTE month;
193 UBYTE day;
194 UBYTE hour;
195 UBYTE minute;
196 UBYTE second;
197 UBYTE line; /* MC line call was made from/received upon */
198 } T_PHB_RECORD;
199
200 typedef struct
201 {
202 UBYTE index; /* record number */
203 UBYTE tag_len; /* Length of Alpha identifier */
204 UBYTE tag[PHB_MAX_TAG_LEN]; /* Alpha identifier */
205 UBYTE len; /* Length of BCD number/SSC contens */
206 UBYTE ton_npi; /* TON and NPI */
207 UBYTE number[PHB_PACKED_NUM_LEN]; /* Dialing number/SSC string */
208 #ifdef PHONEBOOK_EXTENSION
209 UBYTE subaddr[PHB_PACKED_NUM_LEN];
210 UBYTE ext_rcd_num; /* number of the extention record (0xFF => not used) */
211 #endif
212 UBYTE cc_id; /* Capability/Configuration identifier */
213 } T_AFB_RECORD;
214
215 /* Phone book entries */
216
217 /* define UNUSED_INDEX 0xFFFF */
218 #define UNUSED_INDEX (-1)
219 #define UNUSED_BYTE_INDEX 0xFF
220
221 typedef struct T_PHB_AFB_ELEMENT
222 {
223 UBYTE free;
224 UBYTE type;
225 SHORT prev_rcd;
226 SHORT next_rcd;
227 SHORT prev_trcd;
228 SHORT next_trcd;
229 SHORT prev_nrcd;
230 SHORT next_nrcd;
231 SHORT prev_mtrcd;
232 SHORT next_mtrcd;
233 SHORT prev_mnrcd;
234 SHORT next_mnrcd;
235 T_AFB_RECORD entry;
236 } T_PHB_AFB_ELEMENT;
237
238 typedef struct
239 {
240 UBYTE index; /* record number */
241 UBYTE tag_len; /* Length of Alpha identifier */
242 UBYTE tag[PHB_MAX_TAG_LEN]; /* Alpha identifier */
243 UBYTE year;
244 UBYTE month;
245 UBYTE day;
246 UBYTE hour;
247 UBYTE minute;
248 UBYTE second;
249 UBYTE len; /* Length of BCD number/SSC contens */
250 UBYTE ton_npi; /* TON and NPI */
251 UBYTE number[PHB_PACKED_NUM_LEN]; /* Dialing number/SSC string */
252 #ifdef PHONEBOOK_EXTENSION
253 UBYTE subaddr[PHB_PACKED_NUM_LEN];
254 #endif
255 UBYTE cc_id; /* Capability/Configuration identifier */
256 UBYTE line; /* line call was made from/received upon....*/
257 } T_RDM_RECORD;
258
259 /* Phone book entries */
260 typedef struct T_PHB_RDM_ELEMENT
261 {
262 UBYTE free;
263 UBYTE type;
264 UBYTE prev_rcd;
265 UBYTE next_rcd;
266 T_RDM_RECORD entry;
267 } T_PHB_RDM_ELEMENT;
268
269 /*
270 typedef struct T_PHB_RDM_ELEMENT
271 {
272 UBYTE free;
273 UBYTE type;
274 SHORT prev_rcd;
275 SHORT next_rcd;
276 T_RDM_RECORD entry;
277 } T_PHB_RDM_ELEMENT;
278 */
279
280 /* Control block for phone book */
281 typedef struct
282 {
283 UBYTE mem;
284 UBYTE type;
285 UBYTE service;
286 UBYTE alpha_len;
287 SHORT max_rcd;
288 SHORT used_rcd;
289 SHORT first_rcd;
290 SHORT first_trcd;
291 SHORT first_nrcd;
292 SHORT first_mtrcd;
293 SHORT first_mnrcd;
294 UBYTE *rcd_bitmap;
295 } T_PHB_CTB;
296
297 /*
298 typedef struct
299 {
300 UBYTE mem;
301 UBYTE type;
302 UBYTE service;
303 UBYTE alpha_len;
304 UBYTE max_rcd;
305 UBYTE used_rcd;
306 SHORT first_rcd;
307 SHORT first_trcd;
308 SHORT first_nrcd;
309 SHORT first_mtrcd;
310 SHORT first_mnrcd;
311 UBYTE *rcd_bitmap;
312 } T_PHB_CTB;
313 */
314
315 typedef SHORT (*T_PHB_EXT_CMP_FCT)(UBYTE*, USHORT, UBYTE*, USHORT);
316
317 EXTERN void pb_set_compare_fct (T_PHB_EXT_CMP_FCT fct_compare);
318 EXTERN void phb_Init (void);
319 EXTERN void pb_init (void);
320 EXTERN void pb_init_afb (void);
321 EXTERN void pb_exit (void);
322 EXTERN void pb_reset (void);
323 EXTERN T_PHB_RETURN pb_read_ecc (USHORT error, UBYTE ecc_len, UBYTE *sim_ecc);
324 EXTERN BOOL pb_read_sim (USHORT data_id, UBYTE rcd_num, UBYTE len);
325 EXTERN void pb_copy_sim_entry (SHORT cur_index);
326 EXTERN void pb_read_cb (SHORT table_id);
327 EXTERN void pb_read_ext_cb (SHORT table_id);
328 EXTERN void pb_build_req (T_SIM_MMI_INSERT_IND *sim_mmi_insert_ind);
329 EXTERN T_PHB_RETURN pb_start_build (BOOL unchanged);
330 EXTERN T_PHB_RETURN pb_read_eeprom_req (void);
331 EXTERN void pb_read_sim_req (void);
332 EXTERN T_PHB_RETURN pb_write_sim (UBYTE type, UBYTE rcd_num);
333 EXTERN void pb_write_eeprom (void);
334 EXTERN UBYTE pb_ssc (UBYTE nr, UBYTE * serv_table);
335 EXTERN void pb_record_sort (SHORT cur_index);
336 EXTERN void pb_l_record_sort (SHORT cur_index);
337 EXTERN void pb_alpha_sort (SHORT cur_index);
338 EXTERN void pb_num_sort (SHORT cur_index);
339 EXTERN void pb_malpha_sort (SHORT cur_index);
340 EXTERN void pb_mnum_sort (SHORT cur_index);
341 EXTERN T_PHB_RETURN pb_add_record (UBYTE type, UBYTE index, T_PHB_RECORD *entry);
342 EXTERN T_PHB_RETURN pb_delete_record (UBYTE type, UBYTE index, UBYTE *ext_rcd_num, BOOL permanent);
343 EXTERN T_PHB_RETURN pb_read_phys_record (UBYTE type, SHORT index, T_PHB_RECORD *entry);
344 EXTERN T_PHB_RETURN pb_read_index_record (UBYTE type, SHORT index, T_PHB_RECORD *entry);
345 EXTERN T_PHB_RETURN pb_read_alpha_record (UBYTE type, SHORT index, T_PHB_RECORD *entry);
346 EXTERN T_PHB_RETURN pb_read_number_record (UBYTE type, SHORT index, T_PHB_RECORD *entry);
347 EXTERN T_PHB_RETURN pb_search_name (T_ACI_CMD_SRC srcId,
348 UBYTE type,
349 T_ACI_PB_TEXT *searchName,
350 UBYTE mode,
351 SHORT *first_ind,
352 SHORT *result,
353 T_PHB_RECORD *entry);
354 EXTERN T_PHB_RETURN pb_search_number (UBYTE type, UBYTE *number,
355 UBYTE mode,
356 SHORT *first_ind,
357 SHORT *result,
358 T_PHB_RECORD *entry);
359 EXTERN void pb_rcd_chain (UBYTE type,
360 SHORT prev_index,
361 SHORT cur_index,
362 SHORT next_index);
363 EXTERN void pb_l_rcd_chain (UBYTE type,
364 SHORT prev_index,
365 SHORT cur_index,
366 SHORT next_index);
367 EXTERN void pb_name_chain (UBYTE type,
368 SHORT prev_index,
369 SHORT cur_index,
370 SHORT next_index);
371 EXTERN void pb_num_chain (UBYTE type,
372 SHORT prev_index,
373 SHORT cur_index,
374 SHORT next_index);
375 EXTERN void pb_mname_chain (UBYTE type,
376 SHORT prev_index,
377 SHORT cur_index,
378 SHORT next_index);
379 EXTERN void pb_mnum_chain (UBYTE type,
380 SHORT prev_index,
381 SHORT cur_index,
382 SHORT next_index);
383 EXTERN T_PHB_RETURN pb_read_status (UBYTE type, UBYTE *service,
384 SHORT *max_rcd, SHORT *used_rcd,
385 UBYTE *tag_len, SHORT *avail_rcd,
386 SHORT *max_ext, SHORT *used_ext);
387 EXTERN void pb_status_req (UBYTE *mode);
388 EXTERN T_PHB_RETURN pb_first_free (UBYTE type,SHORT *first_free);
389 EXTERN T_PHB_RETURN pb_check_fdn (UBYTE toa, const UBYTE *number);
390 EXTERN UBYTE pb_check_number (char *cur_number, char *number);
391 #ifdef PHONEBOOK_EXTENSION
392 EXTERN T_PHB_RETURN pb_write_sim_ext (USHORT data_id, UBYTE rcd_num);
393 #endif
394 EXTERN T_PHB_RETURN pb_switch_adn_fdn (UBYTE mode, T_ACI_CLASS classFDN);
395 EXTERN void pb_copy_ldn_record (SHORT index, UBYTE flag);
396 EXTERN void pb_copy_lrn_record (SHORT index, UBYTE flag);
397 EXTERN void pb_copy_lmn_record (SHORT index, UBYTE flag);
398 EXTERN T_PHB_RETURN pb_delete_book (UBYTE book);
399 EXTERN void pb_delete_sim_book (UBYTE book);
400 EXTERN void pb_update_ecc (void);
401 EXTERN int pb_get_entry_len (const UBYTE *pb_tag, UBYTE max_pb_len);
402 EXTERN T_ACI_CLASS pb_get_fdn_classtype (void);
403 EXTERN void pb_set_fdn_input_classtype (T_ACI_CLASS classtype);
404 EXTERN UBYTE pb_get_fdn_mode (void);
405 EXTERN void pb_set_fdn_mode (UBYTE fdnmode);
406 #endif /* else, #ifdef TI_PS_FFS_PHB */
407 #endif /* #ifndef PHB_H */