comparison src/cs/services/etm/etm_api.c @ 109:45ceec943347

src/cs/services/etm/etm_{api,env}.c: non-8-character tab cleanup
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 05 Oct 2016 23:44:54 +0000
parents 945cf7f506b2
children
comparison
equal deleted inserted replaced
108:94170d82d926 109:45ceec943347
1 /******************************************************************************** 1 /*******************************************************************************
2 * Enhanced TestMode (ETM) 2 * Enhanced TestMode (ETM)
3 * @file etm_api.c 3 * @file etm_api.c
4 * 4 *
5 * API for ETM SWE. 5 * API for ETM SWE.
6 * 6 *
7 * @author Kim T. Peteren (ktp@ti.com) 7 * @author Kim T. Peteren (ktp@ti.com)
8 * @version 0.1 8 * @version 0.1
9 * 9 *
10 10
11 * 11 *
12 * History: 12 * History:
13 * 13 *
14 * Date Modification 14 * Date Modification
15 * ------------------------------------ 15 * ------------------------------------
16 * 11/06/2003 Creation 16 * 11/06/2003 Creation
17 * 17 *
18 * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved 18 * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved
19 *********************************************************************************/ 19 ******************************************************************************/
20 20
21 21
22 #include "etm/etm.h" 22 #include "etm/etm.h"
23 #include "etm/etm_env.h" 23 #include "etm/etm_env.h"
24 #include "etm/etm_messages_i.h" 24 #include "etm/etm_messages_i.h"
31 #include <string.h> 31 #include <string.h>
32 32
33 extern T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk; 33 extern T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk;
34 34
35 35
36 /******************************************************************************** 36 /*******************************************************************************
37 * Registers the SWE to the ETM instance. 37 * Registers the SWE to the ETM instance.
38 * 38 *
39 * This is a bridge function. It sends the T_ETM_REGISTRATION_REQ 39 * This is a bridge function. It sends the T_ETM_REGISTRATION_REQ
40 * message to the ETM SWE. 40 * message to the ETM SWE.
41 * It is the first function that should be called. 41 * It is the first function that should be called.
42 * 42 *
43 * @return ETM_NOMEM in case of a memory error, 43 * @return ETM_NOMEM in case of a memory error,
44 * the return value of rvf_send_msg otherwise. 44 * the return value of rvf_send_msg otherwise.
45 *********************************************************************************/ 45 ******************************************************************************/
46 46
47 int etm_register(char name[], int mid, int task_id, T_RVF_ADDR_ID addr_id, ETM_CALLBACK_FUNC callback) 47 int etm_register(char name[], int mid, int task_id, T_RVF_ADDR_ID addr_id, ETM_CALLBACK_FUNC callback)
48 { 48 {
49 /* Type for a registration event. */ 49 /* Type for a registration event. */
50 T_ETM_REGISTER_REQ *etm_registration_p; 50 T_ETM_REGISTER_REQ *etm_registration_p;
51 51
52 tr_etm(TgTrEtmLow, "ETM API: _register bridge function(%s)", name); 52 tr_etm(TgTrEtmLow, "ETM API: _register bridge function(%s)", name);
53 53
54 /* Allocate the memory for the message to send */ 54 /* Allocate the memory for the message to send */
55 if ((etm_registration_p = (T_ETM_REGISTER_REQ*) etm_malloc(sizeof(T_ETM_REGISTER_REQ))) == NULL) 55 if ((etm_registration_p = (T_ETM_REGISTER_REQ*) etm_malloc(sizeof(T_ETM_REGISTER_REQ))) == NULL)
56 return ETM_NOMEM; 56 return ETM_NOMEM;
57 57
63 etm_registration_p->header.dest_addr_id = etm_env_ctrl_blk->addr_id; 63 etm_registration_p->header.dest_addr_id = etm_env_ctrl_blk->addr_id;
64 etm_registration_p->header.callback_func = NULL; 64 etm_registration_p->header.callback_func = NULL;
65 65
66 /* Fill the message parameters */ 66 /* Fill the message parameters */
67 memcpy(etm_registration_p->name, name, strlen(name)); 67 memcpy(etm_registration_p->name, name, strlen(name));
68 etm_registration_p->mid = mid; 68 etm_registration_p->mid = mid;
69 etm_registration_p->task_id = task_id; 69 etm_registration_p->task_id = task_id;
70 etm_registration_p->addr_id = addr_id; 70 etm_registration_p->addr_id = addr_id;
71 etm_registration_p->rx_callback_func = callback; 71 etm_registration_p->rx_callback_func = callback;
72 72
73 /* Send the message using mailbox. */ 73 /* Send the message using mailbox. */
74 return rvf_send_msg(etm_env_ctrl_blk->addr_id, 74 return rvf_send_msg(etm_env_ctrl_blk->addr_id,
75 (void*) etm_registration_p); 75 (void*) etm_registration_p);
76 } 76 }
77 77
78 78
79 /******************************************************************************** 79 /*******************************************************************************
80 * Cleans ETM register tables, i.e. set/clean the variable at their initialization 80 * Cleans ETM register tables, i.e. set/clean the variable at their initialization
81 * state for a specific entity. 81 * state for a specific entity.
82 * This function can be used to reinitialize ETM register database without having to 82 * This function can be used to reinitialize ETM register database without having to
83 * start/stop it. 83 * start/stop it.
84 * 84 *
85 * This is a bridge function. It sends ETM_UNREGISTER message to ETM. 85 * This is a bridge function. It sends ETM_UNREGISTER message to ETM.
86 * 86 *
87 * @return ETM_NOMEM in case of a memory error, 87 * @return ETM_NOMEM in case of a memory error,
88 * the return value of rvf_send_msg otherwise. 88 * the return value of rvf_send_msg otherwise.
89 *********************************************************************************/ 89 ******************************************************************************/
90 90
91 int etm_unregister(char name[], int mid, int task_id, T_RVF_ADDR_ID addr_id, ETM_CALLBACK_FUNC callback) 91 int etm_unregister(char name[], int mid, int task_id, T_RVF_ADDR_ID addr_id, ETM_CALLBACK_FUNC callback)
92 { 92 {
93 /* Type for a start input event. */ 93 /* Type for a start input event. */
94 T_ETM_UNREGISTER *etm_unregister_p; 94 T_ETM_UNREGISTER *etm_unregister_p;
95 95
96 tr_etm(TgTrEtmLow, "ETM API: _unregister bridge function"); 96 tr_etm(TgTrEtmLow, "ETM API: _unregister bridge function");
97 97
98 /* Allocate the memory for the message to send */ 98 /* Allocate the memory for the message to send */
99 if ((etm_unregister_p = (T_ETM_UNREGISTER*) etm_malloc(sizeof(T_ETM_UNREGISTER))) == NULL) 99 if ((etm_unregister_p = (T_ETM_UNREGISTER*) etm_malloc(sizeof(T_ETM_UNREGISTER))) == NULL)
100 return ETM_NOMEM; 100 return ETM_NOMEM;
101 101
107 etm_unregister_p->header.dest_addr_id = etm_env_ctrl_blk->addr_id; 107 etm_unregister_p->header.dest_addr_id = etm_env_ctrl_blk->addr_id;
108 etm_unregister_p->header.callback_func = NULL; 108 etm_unregister_p->header.callback_func = NULL;
109 109
110 /* Fill the message parameters */ 110 /* Fill the message parameters */
111 memcpy(etm_unregister_p->name, name, strlen(name)); 111 memcpy(etm_unregister_p->name, name, strlen(name));
112 etm_unregister_p->mid = mid; 112 etm_unregister_p->mid = mid;
113 etm_unregister_p->task_id = task_id; 113 etm_unregister_p->task_id = task_id;
114 etm_unregister_p->addr_id = addr_id; 114 etm_unregister_p->addr_id = addr_id;
115 etm_unregister_p->rx_callback_func = callback; 115 etm_unregister_p->rx_callback_func = callback;
116 116
117 /* Send the message using mailbox. */ 117 /* Send the message using mailbox. */
118 return rvf_send_msg(etm_env_ctrl_blk->addr_id, 118 return rvf_send_msg(etm_env_ctrl_blk->addr_id,
119 (void*) etm_unregister_p); 119 (void*) etm_unregister_p);
120 } 120 }
121 121
122 122
123 /******************************************************************************** 123 /*******************************************************************************
124 * Get data from a ETM packet structur. Get either 8, 16 or 32 value 124 * Get data from a ETM packet structur. Get either 8, 16 or 32 value
125 * Used to unpack data 125 * Used to unpack data
126 * 126 *
127 * This is helpers 127 * This is helpers
128 * 128 *
129 * @return the return value of the point of the ETM packet. 129 * @return the return value of the point of the ETM packet.
130 *********************************************************************************/ 130 ******************************************************************************/
131 131
132 int etm_get8(void *buf) 132 int etm_get8(void *buf)
133 { 133 {
134 unsigned char *p = buf; 134 unsigned char *p = buf;
135 135
169 169
170 return value; 170 return value;
171 } 171 }
172 172
173 173
174 /******************************************************************************** 174 /*******************************************************************************
175 * Put data into a ETM packet structur. Put either 8, 16 or 32 value 175 * Put data into a ETM packet structur. Put either 8, 16 or 32 value
176 * Used to pack data 176 * Used to pack data
177 * 177 *
178 * This is helpers 178 * This is helpers
179 * 179 *
180 * @return Return ETM_PACKET of ETM_OK. 180 * @return Return ETM_PACKET of ETM_OK.
181 *********************************************************************************/ 181 ******************************************************************************/
182 182
183 #define max_ul_data_size 240 183 #define max_ul_data_size 240
184 184
185 int etm_pkt_put8(T_ETM_PKT *pkt, int value) 185 int etm_pkt_put8(T_ETM_PKT *pkt, int value)
186 { 186 {
240 240
241 return ETM_OK; 241 return ETM_OK;
242 } 242 }
243 243
244 244
245 /******************************************************************************** 245 /*******************************************************************************
246 * This function is used to send an ETM Packet to the PC 246 * This function is used to send an ETM Packet to the PC
247 * 247 *
248 * This is helpers 248 * This is helpers
249 * 249 *
250 * @return Return value of rvf_send_trace_cpy. 250 * @return Return value of rvf_send_trace_cpy.
251 *********************************************************************************/ 251 ******************************************************************************/
252 252
253 int etm_pkt_send(T_ETM_PKT *pkt) 253 int etm_pkt_send(T_ETM_PKT *pkt)
254 { 254 {
255 extern unsigned char etm_trace_user_id; 255 extern unsigned char etm_trace_user_id;
256 uint8 *buf, cksum = 0; 256 uint8 *buf, cksum = 0;