comparison chipsetsw/services/etm/etm_api.c @ 48:616f63f3e501 default tip

fixed bug in etm_pkt_send() dealing with max-sized packets: this fix is needed for fc-fsio cpout command to work like it does with Pirelli's firmware (they must have made the same fix)
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Fri, 13 Nov 2015 19:11:07 +0000
parents 58d50d1f238d
children
comparison
equal deleted inserted replaced
47:3cc7897a6582 48:616f63f3e501
262 *********************************************************************************/ 262 *********************************************************************************/
263 263
264 int etm_pkt_send(T_ETM_PKT *pkt) 264 int etm_pkt_send(T_ETM_PKT *pkt)
265 { 265 {
266 extern unsigned char etm_trace_user_id; 266 extern unsigned char etm_trace_user_id;
267 uint8 *buf, cksum = 0, sendsize, size; 267 uint8 *buf, cksum = 0;
268 uint16 sendsize, size;
268 int error = ETM_OK; 269 int error = ETM_OK;
269 270
270 buf = (uint8 *) &pkt->mid; 271 buf = (uint8 *) &pkt->mid;
271 sendsize = size = pkt->size + 2; //one for mid, one for status 272 sendsize = size = pkt->size + 2; //one for mid, one for status
272 273
273 tr_etm(TgTrEtmLow, "ETM API: _pkt_send: size(%d)", sendsize); 274 tr_etm(TgTrEtmLow, "ETM API: _pkt_send: size(%d)", sendsize);
274 275
275 while (size-- ) { 276 while (size-- ) {
276 cksum ^= *buf++; 277 cksum ^= *buf++;
278 *buf = cksum; 279 *buf = cksum;
279 280
280 sendsize += 1; // one for checksum 281 sendsize += 1; // one for checksum
281 282
282 tr_etm_hexdump(TgTrEtmLow, &pkt->mid, sendsize); 283 tr_etm_hexdump(TgTrEtmLow, &pkt->mid, sendsize);
283 284
284 error = rvt_send_trace_cpy((uint8 *) &pkt->mid, etm_trace_user_id, 285 error = rvt_send_trace_cpy((uint8 *) &pkt->mid, etm_trace_user_id,
285 sendsize, RVT_BINARY_FORMAT); 286 sendsize, RVT_BINARY_FORMAT);
286 if(error < 0) 287 if(error < 0)
287 tr_etm(TgTrFatal, "ETM API: _pkt_send: ERROR(%d)", error); 288 tr_etm(TgTrFatal, "ETM API: _pkt_send: ERROR(%d)", error);
288 289
289 return error; 290 return error;