annotate gsm-fw/comlib/cl_imei.c @ 664:d36f647c2432

gsm-fw/comlib: initial import of TI's source cl_des.c and cl_imei.c are from the Leonardo semi-src; others are from LoCosto
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 28 Sep 2014 05:09:53 +0000
parents
children b34e5351438e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
664
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 | Project : COMLIB
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 | Modul : cl_imei.c
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 | All rights reserved.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 |
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 | Instruments Berlin, AG
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 | Purpose : Definitions of common library functions: IMEI decryption with
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 DES algorithm
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 +-----------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 * Version 1.0
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 /**********************************************************************************/
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 NOTE:
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 /**********************************************************************************/
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 #ifndef CL_IMEI_C
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 #define CL_IMEI_C
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 #include "typedefs.h"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 #include "vsi.h" /* to get a lot of macros */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 #ifndef _SIMULATION_
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 #include "ffs/ffs.h"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 #include "config/chipset.cfg"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 #include "config/board.cfg"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 #include "memif/mem.h"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 #include "pcm.h"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 #endif /* ifdef SIMULATION */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 #include "cl_imei.h"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 #include "cl_des.h"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 #include <string.h>
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 #if defined(CL_IMEI_CALYPSO_PLUS_PLATFORM) && defined(FF_PROTECTED_IMEI)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 #include "secure_rom/secure_rom.h"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 #endif
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 static UBYTE stored_imei[CL_IMEI_SIZE]; /* when the imei is read once, the value
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 is stored in this buffer */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 static UBYTE imei_flag = 0; /* this flag indicates, if IMEI was successful read
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 and is stored in the stored_imei buffer */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 #if !defined (CL_IMEI_CALYPSO_PLUS_PLATFORM)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 /* Default IMEISV for D-Sample 00440000-350-111-20 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 const UBYTE C_DEFAULT_IMEISV_DSAMPLE[CL_IMEI_SIZE] =
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 {0x00, 0x44, 0x00, 0x00, 0x35, 0x01, 0x11, 0x20};
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 #define CL_IMEI_FFS_PATH "/gsm/imei.enc"
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 #endif /* CL_IMEI_CALYPSO_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 #ifdef CL_IMEI_CALYPSO_PLUS_PLATFORM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 /* Default IMEISV for E-Sample 00440000-351-222-30 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 const UBYTE C_DEFAULT_IMEISV_ESAMPLE[CL_IMEI_SIZE] =
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 {0x00, 0x44, 0x00, 0x00, 0x35, 0x12, 0x22, 0x30};
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 #endif /* CL_IMEI_CALYPSO_PLUS_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 /*==== FUNCTIONS ==================================================*/
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 #ifdef FF_PROTECTED_IMEI
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 #ifdef CL_IMEI_CALYPSO_PLATFORM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 | Function : get_dieID
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 | Description : the function reads the Die-ID from base band processor and
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 | extracts it from 4 BYTEs to 8 BYTEs.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 |
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 | Parameters : inBufSize - size of buffer where to store Die ID, min.8 BYTE
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 | *outBufPtr - pointer to buffer where to store the Die ID
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 | Return : void
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 LOCAL void get_dieID(USHORT inBufSize, UBYTE *outBufPtr)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 int i;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 USHORT *outBuf16 = (USHORT*)&outBufPtr[0];
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 volatile USHORT *reg_p = (USHORT *) CL_IMEI_DIE_ID_REG;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 TRACE_FUNCTION("get_dieID()");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 if(inBufSize < CL_IMEI_DIE_ID_SIZE){
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 TRACE_ERROR("CL IMEI ERROR: buffer size for Die ID to short!");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 #ifdef IMEI_DEBUG
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 TRACE_EVENT_P1("CL IMEI INFO: Die-ID address(0x%x)", CL_IMEI_DIE_ID_REG);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 #endif
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 for (i = 0; i < CL_IMEI_DIE_ID_SIZE; i++) {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 /* Die ID is 4 BYTE long, extract it to 8 BYTE. */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 outBuf16[i] = (USHORT)(*(UINT8*)(reg_p)++);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 | Function : ffs_get_imeisv
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113 | Description : the function reads IMEI from FFS
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 |
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 | Parameters : inBufSize - size of buffer where to store IMEI, min. 8 BYTE
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 | *outBufPtr - pointer to buffer where to store the IMEI
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 | Return : 0 - OK
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 | <0 - ERROR
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 LOCAL BYTE ffs_get_imeisv (USHORT inBufSize, UBYTE *outBufPtr)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 UBYTE i;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 UBYTE isdid_buf[CL_IMEI_ISDID_SIZE];
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 UBYTE r_dieId[CL_DES_KEY_SIZE]; /* read Die ID */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 UBYTE d_dieId[CL_DES_KEY_SIZE]; /* deciphered Die ID */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 SHORT ret;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 TRACE_FUNCTION("ffs_get_imeisv()");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 if(inBufSize < CL_IMEI_SIZE){
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 TRACE_ERROR("CL IMEI ERROR: buffer size for IMEI to short!");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 return CL_IMEI_ERROR;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 * Read ISDID(enciphered IMEISV+DieID) from FFS.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 if((ret = ffs_file_read(CL_IMEI_FFS_PATH, isdid_buf, CL_IMEI_ISDID_SIZE)) >= EFFS_OK)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 * Read Die ID for using as DES key
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 get_dieID(CL_DES_KEY_SIZE, r_dieId);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 * Call DES algorithm routine
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 /* decipher first 8 BYTEs */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 cl_des(&isdid_buf[0], r_dieId, outBufPtr, CL_DES_DECRYPTION);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 /* decipher the rest 8 BYTEs */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 cl_des(&isdid_buf[CL_DES_BUFFER_SIZE], r_dieId, d_dieId, CL_DES_DECRYPTION);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 if(!memcmp(d_dieId, r_dieId, CL_DES_KEY_SIZE))
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 /* Die ID is valid */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 ret = CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 } else {/* Die ID is corrupted */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 char pr_buf[126];
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 TRACE_ERROR("CL IMEI ERROR: Die ID is corrupted");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 sprintf(pr_buf,"Read DieID: %02x %02x %02x %02x %02x %02x %02x %02x",
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160 r_dieId[0], r_dieId[1], r_dieId[2], r_dieId[3],
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 r_dieId[4], r_dieId[5], r_dieId[6], r_dieId[7]);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 TRACE_ERROR(pr_buf);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 sprintf(pr_buf,"Deciphered DieID: %02x %02x %02x %02x %02x %02x %02x %02x",
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 d_dieId[0], d_dieId[1], d_dieId[2], d_dieId[3],
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 d_dieId[4], d_dieId[5], d_dieId[6], d_dieId[7]);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 TRACE_ERROR(pr_buf);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
168 ret = CL_IMEI_INVALID_DIE_ID;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 } else {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
171 ret = CL_IMEI_READ_IMEI_FAILED;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
172 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 return ret;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 }/* ffs_get_imeisv() */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177 #endif /* CL_IMEI_CALYPSO_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 #ifdef CL_IMEI_CALYPSO_PLUS_PLATFORM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183 | Function : securerom_get_imeisv
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 | Description : the function reads IMEI from Secure ROM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 |
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 | Parameters : inBufSize - size of buffer where to store IMEI, min. 8 BYTE
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 | *outBufPtr - pointer to buffer where to store the IMEI
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 | Return : 0 - OK
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 | <0 - ERROR
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 LOCAL BYTE securerom_get_imeisv (USHORT inBufSize, UBYTE *outBufPtr)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
194 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 BYTE ret;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197 TRACE_FUNCTION("securerom_get_imeisv()");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 if((ret = securerom_drv(inBufSize, outBufPtr)) == CL_IMEI_OK){
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200 return CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
201 } else {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202 return CL_IMEI_READ_IMEI_FAILED;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205 #endif /* CL_IMEI_CALYPSO_PLUS_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209 | Function : get_secure_imeisv
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211 | Description : the function reads IMEI either from FFS or from Secure ROM of
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212 | from other locations depended on hardware platform
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
213 |
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
214 | Parameters : inBufSize - size of buffer where to store IMEI, min. 8 BYTE
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215 | *outBufPtr - pointer to buffer where to store the IMEI
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 | Return : 0 - OK
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217 | negative value - ERROR
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
218 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
219 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 LOCAL BYTE get_secure_imeisv(USHORT inBufSize, UBYTE *outBufPtr)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222 BYTE ret = 0;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
223 UBYTE chipset = CHIPSET;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
224 UBYTE board = BOARD;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226 TRACE_FUNCTION("get_secure_imeisv()");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
227
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
228 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229 * SW is running on Calypso platform (D-Sample)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
230 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
231 #ifdef CL_IMEI_CALYPSO_PLATFORM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
232 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233 * Read IMEI from FFS inclusive deciphering with DES.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 if((ret = ffs_get_imeisv (inBufSize, outBufPtr)) == CL_IMEI_OK)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237 /* store IMEI */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 memcpy(stored_imei, outBufPtr, CL_IMEI_SIZE);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 imei_flag = 1;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 return CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
242 #else /* CL_IMEI_CALYPSO_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
243 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
244 * SW is running on Calypso plus platform (E-Sample)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
245 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
246 #ifdef CL_IMEI_CALYPSO_PLUS_PLATFORM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
247 if((ret = securerom_get_imeisv (inBufSize, outBufPtr)) == CL_IMEI_OK)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
248 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
249 /* store IMEI */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
250 memcpy(stored_imei, outBufPtr, CL_IMEI_SIZE);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
251 imei_flag = 1;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
252 return CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
253 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
254 #else /* CL_IMEI_CALYPSO_PLUS_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 * SW is running on an other platform (neither Calypso nor Calypso plus)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258 #ifdef CL_IMEI_OTHER_PLATFORM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 TRACE_EVENT_P2("CL IMEI WARNING: unknown hardware: board=%d, chipset=%d, return default imei",
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261 board, chipset);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262 memcpy(outBufPtr, C_DEFAULT_IMEISV_DSAMPLE, CL_IMEI_SIZE);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 return CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 #endif /* CL_IMEI_OTHER_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266 #endif /* CL_IMEI_CALYPSO_PLUS_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 #endif /* CL_IMEI_CALYPSO_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269 return ret; /* get_secure_imeisv is failed, return error code */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
271 } /* get_secure_imeisv() */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
272
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
273
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274 #endif /* FF_PROTECTED_IMEI */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
278 | Function : cl_get_imeisv
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
279 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280 | Description : Common IMEI getter function
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 |
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
282 | Parameters : imeiBufSize - size of buffer where to store IMEI, min 8 BYTEs
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
283 | *imeiBufPtr - pointer to buffer where to store the IMEI
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284 | imeiType - indicates, if the IMEI should be read from
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
285 | FFS/Secure ROM (value=CL_IMEI_GET_SECURE_IMEI) or
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
286 | if the already read and stored IMEI (if available)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
287 | should be delivered (value=CL_IMEI_GET_STORED_IMEI)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
288 | The second option should be used only by ACI or
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
289 | BMI to show the IMEISV on mobile's display or
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
290 | in terminal window, e.g. if user calls *#06#.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
291 | For IMEI Control reason (used by ACI), the value
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
292 | has to be CL_IMEI_CONTROL_IMEI
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
293 | Return : OK - 0
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
294 | ERROR - negative values
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
295 +------------------------------------------------------------------------------
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
296 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
297 extern BYTE cl_get_imeisv(USHORT imeiBufSize, UBYTE *imeiBufPtr, UBYTE imeiType)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
298 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
299 BYTE ret = 0;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
300
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
301 TRACE_FUNCTION("cl_get_imeisv()");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
302
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
303 #ifdef _SIMULATION_
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
304 memcpy(imeiBufPtr, C_DEFAULT_IMEISV_DSAMPLE, CL_IMEI_SIZE);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
305 return CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
306 #else /* _SIMULATION_ */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
307
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
308 #ifdef FF_PROTECTED_IMEI
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
309 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
310 * The user has required a stored IMEI. If it has been already read
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
311 * and stored, so return stored IMEI
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
312 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
313 if((imeiType == CL_IMEI_GET_STORED_IMEI) && (imei_flag == 1)){
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
314 memcpy(imeiBufPtr, stored_imei, CL_IMEI_SIZE);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
315 return CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
316 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
317 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
318 * The user has required a secure IMEI. Read IMEI from FFS or from Secure ROM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
319 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
320 if((ret = get_secure_imeisv(imeiBufSize, imeiBufPtr)) == CL_IMEI_OK)
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
321 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
322 return CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
323 } else {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
324 TRACE_ERROR("CL IMEI FATAL ERROR: IMEI not available!");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
325 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
326 * Notify the Frame entity about FATAL ERROR, but not in the case,
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
327 * if ACI is checking IMEI, because ACI will take trouble about it.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
328 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
329 if (imeiType != CL_IMEI_CONTROL_IMEI){
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
330 TRACE_ASSERT(ret == CL_IMEI_OK);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
331 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
332 return ret;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
333 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
334 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
335 * The feature flag FF_PROTECTED_IMEI is not enabled.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
336 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
337 #else /* FF_PROTECTED_IMEI */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
338
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
339 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
340 * Return default CALYPSO+ IMEISV value
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
341 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
342 #ifdef CL_IMEI_CALYPSO_PLUS_PLATFORM
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
343
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
344 TRACE_EVENT("CL IMEI INFO: return default IMEI-SV number");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
345 memcpy(imeiBufPtr, C_DEFAULT_IMEISV_ESAMPLE, CL_IMEI_SIZE);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
346
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
347 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
348 * CL_IMEI_CALYPSO_PLATFORM or CL_IMEI_OTHER_PLATFORM is defined.
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
349 * Try to read the IMEI number from the old ffs:/pcm/IMEI file,
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
350 * if it failes, return default CALYPSO IMEISV value
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
351 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
352 #else /* CL_IMEI_CALYPSO_PLUS_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
353 {
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
354 UBYTE version;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
355 USHORT ret;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
356 UBYTE buf[SIZE_EF_IMEI];
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
357
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
358 ret = pcm_ReadFile ((UBYTE *)EF_IMEI_ID, SIZE_EF_IMEI, buf, &version);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
359 if(ret == PCM_OK){
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
360 TRACE_EVENT("CL IMEI INFO: return IMEI-SV number from ffs:/pcm/IMEI");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
361 /*
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
362 * swap digits
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
363 */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
364 imeiBufPtr[0] = ((buf[0] & 0xf0) >> 4) | ((buf[0] & 0x0f) << 4);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
365 imeiBufPtr[1] = ((buf[1] & 0xf0) >> 4) | ((buf[1] & 0x0f) << 4);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
366 imeiBufPtr[2] = ((buf[2] & 0xf0) >> 4) | ((buf[2] & 0x0f) << 4);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
367 imeiBufPtr[3] = ((buf[3] & 0xf0) >> 4) | ((buf[3] & 0x0f) << 4);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
368 imeiBufPtr[4] = ((buf[4] & 0xf0) >> 4) | ((buf[4] & 0x0f) << 4);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
369 imeiBufPtr[5] = ((buf[5] & 0xf0) >> 4) | ((buf[5] & 0x0f) << 4);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
370 imeiBufPtr[6] = ((buf[6] & 0xf0) >> 4) | ((buf[6] & 0x0f) << 4);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
371 imeiBufPtr[7] = ((buf[7] & 0xf0) >> 4) | ((buf[7] & 0x0f) << 4);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
372 /* store IMEI */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
373 memcpy(stored_imei, imeiBufPtr, CL_IMEI_SIZE);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
374 imei_flag = 1;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
375
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
376 }else{
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
377 TRACE_EVENT("CL IMEI INFO: return default IMEI-SV number");
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
378 memcpy(imeiBufPtr, C_DEFAULT_IMEISV_DSAMPLE, CL_IMEI_SIZE);
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
379 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
380 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
381 #endif /* CL_IMEI_CALYPSO_PLUS_PLATFORM */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
382
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
383 return CL_IMEI_OK;
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
384
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
385 #endif /* FF_PROTECTED_IMEI */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
386 #endif /* _SIMULATION_ */
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
387 }
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
388
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
389
d36f647c2432 gsm-fw/comlib: initial import of TI's source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
390 #endif /* CL_IMEI_C */