FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/services/etm/etm_api.c @ 197:fa7174faa9aa
fc-tmsh: option to invoke rvinterf "behind the scenes"
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 15 Dec 2013 07:31:52 +0000 |
parents | f9ac53d8e999 |
children | 6de5661d1fe1 |
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 (ETM) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * @file etm_api.c |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * API for ETM SWE. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * @author Kim T. Peteren (ktp@ti.com) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 * @version 0.1 |
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 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 * History: |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 * Date Modification |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 * ------------------------------------ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 * 11/06/2003 Creation |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved |
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 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
22 #include "etm.h" |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
23 #include "etm_env.h" |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
24 #include "etm_messages_i.h" |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
25 #include "etm_trace.h" |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
27 #include "etm_misc.h" |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
29 #include "../../riviera/rvf/rvf_api.h" |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 #include <string.h> |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 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
|
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 /******************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 * Registers the SWE to the ETM instance. |
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 * This is a bridge function. It sends the T_ETM_REGISTRATION_REQ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 * message to the ETM SWE. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 * It is the first function that should be called. |
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 * @return ETM_NOMEM in case of a memory error, |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 * the return value of rvf_send_msg otherwise. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 *********************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
47 int etm_register(char name[], int mid, int task_id, T_RVF_ADDR_ID addr_id, |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
48 ETM_CALLBACK_FUNC callback) |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 { |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
50 /* Type for a registration event. */ |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
51 T_ETM_REGISTER_REQ *etm_registration_p; |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
53 tr_etm(TgTrEtmLow, "ETM API: _register bridge function(%s)", name); |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 /* Allocate the memory for the message to send */ |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
56 if ((etm_registration_p = (T_ETM_REGISTER_REQ*) |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
57 etm_malloc(sizeof(T_ETM_REGISTER_REQ))) == NULL) |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 return ETM_NOMEM; |
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 /* Fill the message id */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 etm_registration_p->header.msg_id = ETM_REGISTER_REQ; |
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 /* Fill the address source id */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 etm_registration_p->header.src_addr_id = rvf_get_taskid(); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 etm_registration_p->header.dest_addr_id = etm_env_ctrl_blk->addr_id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 etm_registration_p->header.callback_func = NULL; |
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 /* Fill the message parameters */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 memcpy(etm_registration_p->name, name, strlen(name)); |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
70 etm_registration_p->mid = mid; |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
71 etm_registration_p->task_id = task_id; |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
72 etm_registration_p->addr_id = addr_id; |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
73 etm_registration_p->rx_callback_func = callback; |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
75 /* Send the message using mailbox. */ |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
76 return rvf_send_msg(etm_env_ctrl_blk->addr_id, (void*) etm_registration_p); |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 } |
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 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 /******************************************************************************** |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
81 * Cleans ETM register tables, i.e. set/clean the variable at their |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
82 * initialization state for a specific entity. |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
83 * This function can be used to reinitialize ETM register database without |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
84 * having to start/stop it. |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 * This is a bridge function. It sends ETM_UNREGISTER message to ETM. |
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 * @return ETM_NOMEM in case of a memory error, |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 * the return value of rvf_send_msg otherwise. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 *********************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 int etm_unregister(char name[], int mid, int task_id, T_RVF_ADDR_ID addr_id, ETM_CALLBACK_FUNC callback) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 { |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
94 /* Type for a start input event. */ |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
95 T_ETM_UNREGISTER *etm_unregister_p; |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
96 |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
97 tr_etm(TgTrEtmLow, "ETM API: _unregister bridge function"); |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
98 |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 /* Allocate the memory for the message to send */ |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
100 if ((etm_unregister_p = (T_ETM_UNREGISTER*) |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
101 etm_malloc(sizeof(T_ETM_UNREGISTER))) == NULL) |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 return ETM_NOMEM; |
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 /* Fill the message id */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 etm_unregister_p->header.msg_id = ETM_UNREGISTER; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 /* Fill the address source id */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 etm_unregister_p->header.src_addr_id = rvf_get_taskid(); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 etm_unregister_p->header.dest_addr_id = etm_env_ctrl_blk->addr_id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 etm_unregister_p->header.callback_func = NULL; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 /* Fill the message parameters */ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 memcpy(etm_unregister_p->name, name, strlen(name)); |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
114 etm_unregister_p->mid = mid; |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
115 etm_unregister_p->task_id = task_id; |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
116 etm_unregister_p->addr_id = addr_id; |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
117 etm_unregister_p->rx_callback_func = callback; |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
119 /* Send the message using mailbox. */ |
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
120 return rvf_send_msg(etm_env_ctrl_blk->addr_id, (void*) etm_unregister_p); |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 |
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 * Get data from a ETM packet structur. Get either 8, 16 or 32 value |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 * Used to unpack data |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 * This is helpers |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 * @return the return value of the point of the ETM packet. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 *********************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 int etm_get8(void *buf) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 unsigned char *p = buf; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 int value = *p; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 tr_etm(TgTrEtmLow, "ETM API: _get8(%d)", value); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 return value; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 int etm_get16(void *buf) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 { |
165
9dbf3248a197
starting to compile ETM
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
164
diff
changeset
|
146 unsigned char *p = buf; |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 |
193
f9ac53d8e999
gsm-fw/services/etm: etm_get16(): fix for bad C (sequence points violation)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
165
diff
changeset
|
148 int value = (p[0] | (p[1] << 8)); |
164
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 tr_etm(TgTrEtmLow, "ETM API: _get16(%d)", value); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 return value; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 int etm_get32(void *buf) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 unsigned char *p = buf; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 int value = 0; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 value = *p; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 p++; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 value |= (*p << 8); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 p++; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 value |= (*p << 16); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 p++; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 value |= (*p << 24); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 tr_etm(TgTrEtmLow, "ETM API: _get32(%d)", value); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 return value; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 /******************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 * Put data into a ETM packet structur. Put either 8, 16 or 32 value |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 * Used to pack data |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 * This is helpers |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 * @return Return ETM_PACKET of ETM_OK. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 *********************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 #define max_ul_data_size 240 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 int etm_pkt_put8(T_ETM_PKT *pkt, int value) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 tr_etm(TgTrEtmLow, "ETM API: _pkt_put8(*, %d)", value); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 if (pkt->index + 1 > max_ul_data_size) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
190 return ETM_PACKET; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
192 pkt->data[pkt->index] = value; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 pkt->index += 1; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
194 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
195 pkt->size += 1; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 int etm_pkt_put16(T_ETM_PKT *pkt, int value) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 tr_etm(TgTrEtmLow, "ETM API: _pkt_put16(*, %d)", value); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 if (pkt->index + 2 > max_ul_data_size) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 return ETM_PACKET; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 memcpy(&pkt->data[pkt->index], &value, 2); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 pkt->index += 2; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 pkt->size += 2; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 int etm_pkt_put32(T_ETM_PKT *pkt, int value) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 tr_etm(TgTrEtmLow, "ETM API: _pkt_put32(*, %d)", value); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 if (pkt->index + 4 > max_ul_data_size) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 return ETM_PACKET; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 memcpy(&pkt->data[pkt->index], &value, 4); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 pkt->index += 4; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 pkt->size += 4; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 return ETM_OK; |
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 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 int etm_pkt_putdata(T_ETM_PKT *pkt, const void *buf, int size) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 tr_etm(TgTrEtmLow, "ETM API: _pkt_putdata(*, %d)", size); |
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 if (pkt->index + size > max_ul_data_size) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 return ETM_PACKET; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 memcpy(&pkt->data[pkt->index], buf, size); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 pkt->index += size; |
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 pkt->size += size; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 return ETM_OK; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 /******************************************************************************** |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 * This function is used to send an ETM Packet to the PC |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 * This is helpers |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 * |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 * @return Return value of rvf_send_trace_cpy. |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 *********************************************************************************/ |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 int etm_pkt_send(T_ETM_PKT *pkt) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 extern unsigned char etm_trace_user_id; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 uint8 *buf, cksum = 0, sendsize, size; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 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
|
258 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 buf = (uint8 *) &pkt->mid; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 sendsize = size = pkt->size + 2; //one for mid, one for status |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 tr_etm(TgTrEtmLow, "ETM API: _pkt_send: size(%d)", sendsize); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
263 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 while (size-- ) { |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 cksum ^= *buf++; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
266 } |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
267 *buf = cksum; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
268 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
269 sendsize += 1; // one for checksum |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
270 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
271 tr_etm_hexdump(TgTrEtmLow, &pkt->mid, sendsize); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
272 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
273 error = rvt_send_trace_cpy((uint8 *) &pkt->mid, etm_trace_user_id, |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
274 sendsize, RVT_BINARY_FORMAT); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
275 if(error < 0) |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
276 tr_etm(TgTrFatal, "ETM API: _pkt_send: ERROR(%d)", error); |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
277 |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
278 return error; |
d78219c43fbf
gsm-fw/services/etm: initial import from the Leonardo semi-src
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
279 } |