FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/services/etm/etm_tmpwr.c @ 586:25a3095e8a98
L1: dsp subdir added to the build
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Fri, 15 Aug 2014 22:29:30 +0000 |
parents | d78219c43fbf |
children |
rev | line source |
---|---|
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * Enhanced TestMode (PWR) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * Copyright Texas Instruments, 2003 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * Svend Kristian Lindholm, skl@ti.com |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * $Id: tmpwr.c 1.1 Wed, 20 Aug 2003 10:22:37 +0200 skl $ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 ******************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "etm/etm.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "etm/etm_trace.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "etm/etm.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "etm/etm_env.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "etm/etm_api.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include "etm/etm_misc.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 #include "rv/rv_general.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 #include "rv/rv_defined_swe.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 #include "memif/mem.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 #include <string.h> |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 #include "rv/rv_defined_swe.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 #define TRACE_WANTED 1 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 #include "lcc/lcc_api.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 #include "lcc/lcc_cfg_i.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 #include "lcc/lcc.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 #include "lcc/lcc_trace.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 #include "lcc/lcc_tm_i.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 #include "lcc/lcc_task.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 #include "lcc/lcc_modulate.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 #include "ffs/ffs.h" |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 * Globals |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 extern T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 extern T_PWR_CTRL_BLOCK *pwr_ctrl; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 extern T_PWR_CFG_BLOCK *pwr_cfg; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 * EMT PWR Version |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 /* |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 The version of the etm pwr module can be found in the file etm_version.h |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 * ETM PWR Module |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 // pwr uplink packet structure for pwr read/write : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 // |fid|index|--data(W)--| |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 int etm_pwr(uint8 *indata, int insize); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 /****************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 * Register the PWR Module to the ETM database |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 *****************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 int etm_pwr_init(void) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 return etm_register("PWR", ETM_PWR, 0, 0, etm_pwr); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 int etm_pwr(uint8 *buf, int insize) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 int error = ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 uint8 fid, size, index,i; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 T_ETM_PKT *pkt = NULL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 T_FFS_STAT stat; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 char name[20], id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 ttw(pwr_ttr(TTrInit, "etm_pwr(%d)" NL, 0)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 fid = *buf; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 ttw(pwr_ttr(TTrInit, "insize = %d " NL, insize)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 /* Create TestMode return Packet */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 if ((pkt = (T_ETM_PKT *) etm_malloc(sizeof(T_ETM_PKT))) == NULL) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 return ETM_NOMEM; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 // Init. of return packet |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 pkt->mid = ETM_PWR; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 pkt->status = ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 pkt->size = 0; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 pkt->index = 0; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 etm_pkt_put8(pkt, fid); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 index = *(buf+1); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 etm_pkt_put8(pkt, index); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 name[0] = 0; // FIXME: Really needed? |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 for (i=0; i<insize; i++) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 ttw(ttr(TTrTmpwr, "buf[%d]=%d" NL,i, (*(buf+i)))); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 switch (fid) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 case 'R': |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 ttw(ttr(TTrTmpwr,"pwr (%d)" NL, 0)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 // All reads start from index 2 since the fid + index is kept |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 switch (index) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 case PWR_CFG_ID : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 // We can read different configurations swiching between them using pwtw |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 size = PWR_CFG_ID_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 *(buf+2) = pwr_ctrl->cfg_id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 *(buf+3) = pwr_ctrl->chg_cfg_id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 ttw(ttr(TTrTmpwr,"Using cfg_id %d" NL, *(buf+2))); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 ttw(ttr(TTrTmpwr,"Using chg_cfg_id %d" NL, *(buf+3))); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 // If either the bat.cfg or the chg.cfg lacks object not found is returned |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 // If (battery) file can't be stat'ed then the configuration doesn't exist |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 id = *(buf+2) + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 build_name("/pwr/bat/bat", &id, 12, ".cfg", name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 error = ffs_stat(name, &stat); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 // If charger file can't be stat'ed then the configuration doesn't exist |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 id = *(buf+3) + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 build_name("/pwr/chg/chg", &id, 12, ".cfg", name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 error = ffs_stat(name, &stat); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 case PWR_COMMON : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 // Read the /pwr/common.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 // NOTE: sizeof(pwr_cfg->common) = 16 <> (14 byte alignment) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 size = PWR_COMMON_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 error = ffs_fread("/pwr/common.cfg", buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 ttw(ttr(TTrTmpwr,"Read %d bytes" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 case PWR_CHG : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 // Read the /pwr/chg/chg<cfgid>.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 size = PWR_CHG_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 id = pwr_ctrl->chg_cfg_id + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 build_name("/pwr/chg/chg", &id, 12, ".cfg", name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 error = ffs_fread(name, buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 ttw(ttr(TTrTmpwr, "Read %d bytes " NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 case PWR_BAT : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 // Read the /pwr/bat/bat<cfgid>.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 size = PWR_BAT_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 id = pwr_ctrl->cfg_id + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 build_name("/pwr/bat/bat", &id, 12, ".cfg", name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 error = ffs_fread(name, buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 ttw(ttr(TTrTmpwr,"Read %d bytes" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 case PWR_TEMP : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 // Read the /pwr/bat/temp<cfgid>.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 size = PWR_TEMP_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 id = pwr_ctrl->cfg_id + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 build_name("/pwr/bat/temp", &id, 13, ".cfg", name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 error = ffs_fread(name, buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 ttw(ttr(TTrTmpwr,"Read %d bytes" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 case PWR_MMI: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 // Read the /mmi/pwr/bsie.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 size = PWR_MMI_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 error = ffs_fread("/mmi/pwr/bsie.cfg", buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 ttw(ttr(TTrTmpwr,"Read %d bytes" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 case PWR_I2V_CAL : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 // Read the /pwr/i2v.cal file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 size = PWR_I2V_CAL_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 error = ffs_fread("/pwr/i2v.cal", buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 ttw(ttr(TTrTmpwr,"Read %d bytes" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 case PWR_VBAT_CAL : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 // Read the /pwr/vbat.cal file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 size = PWR_VBAT_CAL_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 error = ffs_fread("/pwr/vbat.cal", buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 ttw(ttr(TTrTmpwr,"Read %d bytes" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 case PWR_MMI_TEST : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 #if (TEST_PWR_MMI_INTERFACE == 1) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 // Trigger MMI registration |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 return_path.callback_func = mmi_test_cb_function; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 ttw(ttr(TTrInit,"before: &mmi_test_cb_function=(0x%x)" NL, return_path.callback_func)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 return_path.addr_id = NULL; // FIXME?? |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 ttw(ttr(TTrTmpwr,"MMI testing callback: %d" NL, 0x0)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 size = 1; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 *(buf+2) = 0xBA; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 pwr_register(&return_path, &mmi_data); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 ttw(ttr(TTrInit,"after: &mmi_test_cb_function=(0x%x)" NL, pwr_ctrl->rpath.callback_func)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
190 ttw(ttr(TTrTmpwr,"MMI testing callback: %d" NL, 0xFF)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 #endif |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
192 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 case PWR_DYNAMIC : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
194 // Dump 'dynamic' configuration data to trace |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
195 size = PWR_DYNAMIC_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 *(buf+2) = 0xBA; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 ttr(TTrAll,"*PWR Module Version = 0x%x" NL, PWRVERSION ); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 ttr(TTrAll,"*bat_id = %d" NL, pwr_cfg->data.bat_id ); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 ttr(TTrAll,"*state = %d" NL, pwr_ctrl->state); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 ttr(TTrAll,"*chg_id = %d" NL, pwr_cfg->data.chg_id ); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 ttr(TTrAll,"*Vbat = %d" NL, pwr_cfg->data.Vbat); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 ttr(TTrAll,"*Vbat_avg = %d" NL, pwr_cfg->data.Vbat_avg); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 ttr(TTrAll,"*Vbat_avg_mV = %d" NL, pwr_cfg->data.Vbat_avg_mV); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 ttr(TTrAll,"*Tbat = %d" NL, pwr_cfg->data.Tbat); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 ttr(TTrAll,"*Tbat_avg = %d" NL, pwr_cfg->data.Tbat_avg); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 ttr(TTrAll,"*Vchg = %d" NL, pwr_cfg->data.Vchg); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 ttr(TTrAll,"*Ichg = %d" NL, pwr_cfg->data.Ichg); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 ttr(TTrAll,"*Cbat = %d" NL, pwr_cfg->data.Cbat); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 ttr(TTrAll,"*cfg_id = %d" NL, pwr_cfg->data.cfg_id); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 ttr(TTrAll,"*chg_cfg_id = %d" NL, pwr_cfg->data.chg_cfg_id); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 ttr(TTrAll,"*bforce = %d" NL, pwr_cfg->data.bforce); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 ttr(TTrAll,"*cforce = %d" NL, pwr_cfg->data.cforce); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 ttr(TTrAll,"*k = %d" NL, pwr_cfg->data.k); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 ttr(TTrAll,"*T4 = %d" NL, pwr_cfg->data.T4); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 ttr(TTrAll,"*T1 elapsed = %d" NL, pwr_ctrl->time_elapsed_T1); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 ttr(TTrAll,"*T2 elapsed = %d" NL, pwr_ctrl->time_elapsed_T2); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 ttr(TTrAll,"*T3 elapsed = %d" NL, pwr_ctrl->time_elapsed_T3); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 ttr(TTrAll,"*MMI timer elapsed = %d" NL, pwr_ctrl->time_elapsed_mmi_rep); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 error = PWR_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 case PWR_TRACE_MASK: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 // Read the trace mask of the PWR module |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 size = PWR_TMASK_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 memcpy(buf+2, &pwr_ctrl->tmask, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 ttw(ttr(TTrTmpwr,"tmask: 0x%x" NL, pwr_ctrl->tmask)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 default : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
228 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
229 // Unknown index |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 error = PWR_INDEX; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 ttr(TTrWarning, "Unknown index! %d" NL, index); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 etm_pkt_putdata(pkt, buf+2 , size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 case 'W': |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 ttw(ttr(TTrTmpwr,"pww (%d)" NL, 0)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 switch (index) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 case PWR_CFG_ID : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 // Write the configuration id to be used |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 pwr_ctrl->cfg_id = *(buf+2); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 pwr_ctrl->chg_cfg_id = *(buf+3); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 pwr_cfg->data.cfg_id = pwr_ctrl->cfg_id + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 pwr_cfg->data.chg_cfg_id = pwr_ctrl->chg_cfg_id + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 ttw(ttr(TTrTmpwr,"Switched to bat id=%d" NL, pwr_ctrl->cfg_id)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 ttw(ttr(TTrTmpwr,"Switched to chg id=%d" NL, pwr_ctrl->chg_cfg_id)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 case PWR_COMMON : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 // Write the /pwr/common.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 // Blocking version of ffs_fwrite is used since this is a test mode command |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 error = ffs_fwrite("/pwr/common.cfg", buf+2, PWR_COMMON_CFG_SIZE); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 ttw(ttr(TTrTmpwr,"Wrote %d bytes" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 case PWR_CHG : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 // Write the /pwr/chg/chg<cfgid>.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 size = PWR_CHG_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 id = pwr_ctrl->chg_cfg_id + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 build_name("/pwr/chg/chg", &id, 12, ".cfg", name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 error = ffs_fwrite(name, buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 ttw(ttr(TTrTmpwr, "Wrote %d bytes = %d" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
263 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 case PWR_BAT : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 // Write the /pwr/bat/bat<cfgid>.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
266 size = PWR_BAT_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
267 id = pwr_ctrl->cfg_id + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
268 build_name("/pwr/bat/bat", &id, 12, ".cfg", name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
269 error = ffs_fwrite(name, buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
270 ttw(ttr(TTrTmpwr, "Wrote %d bytes = %d" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
271 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
272 case PWR_TEMP : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
273 // Write the /pwr/bat/temp<cfgid>.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
274 size = PWR_TEMP_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
275 id = pwr_ctrl->cfg_id + '0'; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
276 build_name("/pwr/bat/temp", &id, 13, ".cfg", name); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
277 error = ffs_fwrite(name, buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
278 ttw(ttr(TTrTmpwr, "Wrote %d bytes = %d" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
279 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
280 case PWR_MMI: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
281 // Write the /mmi/pwr/bsie.cfg file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
282 size = PWR_MMI_CFG_SIZE; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
283 error = ffs_fwrite("/mmi/pwr/bsie.cfg", buf+2, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
284 ttw(ttr(TTrTmpwr, "Wrote %d bytes = %d" NL, error)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
285 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
286 case PWR_I2V_CAL : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
287 // Write the /pwr/i2v.cal file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
288 error = ffs_fwrite("/pwr/i2v.cal", buf+2, PWR_I2V_CAL_SIZE); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
289 ttw(ttr(TTrTmpwr,"Wrote %d bytes" NL, PWR_I2V_CAL_SIZE)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
290 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
291 case PWR_VBAT_CAL: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
292 // Write the /pwr/vbat.cal file |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
293 error = ffs_fwrite("/pwr/vbat.cal", buf+2, PWR_VBAT_CAL_SIZE); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
294 ttw(ttr(TTrTmpwr,"Wrote %d bytes" NL, PWR_VBAT_CAL_SIZE)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
295 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
296 case PWR_MMI_TEST : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
297 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
298 case PWR_TRACE_MASK: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
299 // Write the trace mask of the PWR module |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
300 memcpy(&pwr_ctrl->tmask, buf+2, sizeof(pwr_ctrl->tmask)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
301 ttw(ttr(TTrTmpwr,"Wrote tmask 0x%x" NL, pwr_ctrl->tmask)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
302 pwr_ttr_init(pwr_ctrl->tmask); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
303 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
304 default : |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
305 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
306 // Unknown index |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
307 error = PWR_INDEX; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
308 ttr(TTrWarning, "Unknown index! %d" NL, index); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
309 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
310 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
311 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
312 size = 0; // Size of write message reply is always 0 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
313 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
314 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
315 default: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
316 pwr_ttr(TTrWarning, "etm_pwr: fid unknown (%d)" NL, fid); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
317 error = ETM_NOSYS; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
318 break; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
319 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
320 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
321 for (i=0; i<size+2; i++) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
322 ttw(ttr(TTrTmpwr, "buf[%d]=0x%x" NL, i, (*(buf+i)))); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
323 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
324 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
325 if (error < 0) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
326 pwr_ttr(TTrWarning, "etm_pwr: error %d" NL, error); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
327 pkt->status = -error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
328 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
329 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
330 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
331 pkt->size += size; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
332 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
333 etm_pkt_send(pkt); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
334 etm_free(pkt); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
335 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
336 ttw(pwr_ttr(TTrInit, "etm_pwr(%d)" NL, 0xFF)); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
337 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
338 } |