comparison chipsetsw/services/etm/etm_api.c @ 18:4346e5e95d3c

etm_pkt_send() fix from tcs211-c139
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 23 Sep 2016 06:05:38 +0000
parents 509db1a7b7b8
children
comparison
equal deleted inserted replaced
17:8eeb95391563 18:4346e5e95d3c
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, sendsize, size; 256 uint8 *buf, cksum = 0;
257 uint16 sendsize, size;
257 int error = ETM_OK; 258 int error = ETM_OK;
258 259
259 buf = (uint8 *) &pkt->mid; 260 buf = (uint8 *) &pkt->mid;
260 sendsize = size = pkt->size + 2; //one for mid, one for status 261 sendsize = size = pkt->size + 2; //one for mid, one for status
261 262
262 tr_etm(TgTrEtmLow, "ETM API: _pkt_send: size(%d)", sendsize); 263 tr_etm(TgTrEtmLow, "ETM API: _pkt_send: size(%d)", sendsize);
263 264
264 while (size-- ) { 265 while (size-- ) {
265 cksum ^= *buf++; 266 cksum ^= *buf++;
267 *buf = cksum; 268 *buf = cksum;
268 269
269 sendsize += 1; // one for checksum 270 sendsize += 1; // one for checksum
270 271
271 tr_etm_hexdump(TgTrEtmLow, &pkt->mid, sendsize); 272 tr_etm_hexdump(TgTrEtmLow, &pkt->mid, sendsize);
272 273
273 error = rvt_send_trace_cpy((uint8 *) &pkt->mid, etm_trace_user_id, 274 error = rvt_send_trace_cpy((uint8 *) &pkt->mid, etm_trace_user_id,
274 sendsize, RVT_BINARY_FORMAT); 275 sendsize, RVT_BINARY_FORMAT);
275 if(error < 0) 276 if(error < 0)
276 tr_etm(TgTrFatal, "ETM API: _pkt_send: ERROR(%d)", error); 277 tr_etm(TgTrFatal, "ETM API: _pkt_send: ERROR(%d)", error);
277 278
278 return error; 279 return error;