Lines Matching refs:trace

92 static void findVariable(CO_trace_t *trace) {  in findVariable()  argument
101 index = (uint16_t) ((*trace->map) >> 16); in findVariable()
102 subIndex = (uint8_t) ((*trace->map) >> 8); in findVariable()
103 dataLen = (uint8_t) (*trace->map); in findVariable()
114 uint16_t entryNo = CO_OD_find(trace->SDO, index); in findVariable()
116 … if(index >= 0x1000 && entryNo != 0xFFFF && subIndex <= trace->SDO->OD[entryNo].maxSubIndex) { in findVariable()
117 OdDataPtr = CO_OD_getDataPointer(trace->SDO, entryNo, subIndex); in findVariable()
121 uint16_t len = CO_OD_getLength(trace->SDO, entryNo, subIndex); in findVariable()
142 if(((*trace->format) & 1) == 1) { in findVariable()
146 dtIndex += ((*trace->format) >> 1) * 6; in findVariable()
156 trace->OD_variable = OdDataPtr; in findVariable()
159 trace->OD_variable = trace->value; in findVariable()
161 trace->dt = &dataTypes[dtIndex]; in findVariable()
164 trace->OD_variable = NULL; in findVariable()
165 trace->dt = NULL; in findVariable()
173 CO_trace_t *trace; in CO_ODF_traceConfig() local
176 trace = (CO_trace_t*) ODF_arg->object; in CO_ODF_traceConfig()
181 CO_setUint32(ODF_arg->data, trace->bufferSize); in CO_ODF_traceConfig()
188 if(!trace->enabled) { in CO_ODF_traceConfig()
196 trace->enabled = false; in CO_ODF_traceConfig()
198 else if(!trace->enabled) { in CO_ODF_traceConfig()
199 if(trace->bufferSize == 0) { in CO_ODF_traceConfig()
204 findVariable(trace); in CO_ODF_traceConfig()
206 if(trace->OD_variable != NULL) { in CO_ODF_traceConfig()
207 *trace->value = 0; in CO_ODF_traceConfig()
208 *trace->minValue = 0; in CO_ODF_traceConfig()
209 *trace->maxValue = 0; in CO_ODF_traceConfig()
210 *trace->triggerTime = 0; in CO_ODF_traceConfig()
211 trace->valuePrev = 0; in CO_ODF_traceConfig()
212 trace->readPtr = 0; in CO_ODF_traceConfig()
213 trace->writePtr = 0; in CO_ODF_traceConfig()
214 trace->enabled = true; in CO_ODF_traceConfig()
227 if(trace->enabled) { in CO_ODF_traceConfig()
241 CO_trace_t *trace; in CO_ODF_trace() local
244 trace = (CO_trace_t*) ODF_arg->object; in CO_ODF_trace()
249 uint32_t size = trace->bufferSize; in CO_ODF_trace()
250 uint32_t wp = trace->writePtr; in CO_ODF_trace()
251 uint32_t rp = trace->readPtr; in CO_ODF_trace()
263 while(trace->readPtr != 0 || trace->writePtr != 0) { in CO_ODF_trace()
264 trace->readPtr = 0; in CO_ODF_trace()
265 trace->writePtr = 0; in CO_ODF_trace()
266 *trace->triggerTime = 0; in CO_ODF_trace()
286 if(trace->bufferSize == 0 || ODF_arg->dataLength < 100) { in CO_ODF_trace()
289 else if(trace->readPtr == trace->writePtr) { in CO_ODF_trace()
303 rp = trace->readPtr; in CO_ODF_trace()
307 t = trace->timeBuffer[rp]; in CO_ODF_trace()
308 v = trace->valueBuffer[rp]; in CO_ODF_trace()
310 if(++trace->readPtr == trace->bufferSize) { in CO_ODF_trace()
311 trace->readPtr = 0; in CO_ODF_trace()
312 if(rp != trace->bufferSize) { in CO_ODF_trace()
318 if(rp != trace->readPtr) { in CO_ODF_trace()
322 len = trace->dt->printPointStart(s, freeLen, t, v); in CO_ODF_trace()
328 if(rp != trace->writePtr) { in CO_ODF_trace()
330 t = trace->timeBuffer[rp]; in CO_ODF_trace()
331 v = trace->valueBuffer[rp]; in CO_ODF_trace()
333 if(++trace->readPtr == trace->bufferSize) { in CO_ODF_trace()
334 trace->readPtr = 0; in CO_ODF_trace()
335 if(rp != trace->bufferSize && ODF_arg->firstSegment) { in CO_ODF_trace()
341 if(rp != trace->readPtr && ODF_arg->firstSegment) { in CO_ODF_trace()
347 if(rp == trace->writePtr) { in CO_ODF_trace()
349 if(t != trace->lastTimeStamp) { in CO_ODF_trace()
350 len = trace->dt->printPoint(s, freeLen, t, v); in CO_ODF_trace()
357 len = trace->dt->printPoint(s, freeLen, t, v); in CO_ODF_trace()
371 v = trace->valuePrev; in CO_ODF_trace()
372 t = trace->lastTimeStamp; in CO_ODF_trace()
373 len = trace->dt->printPointEnd(s, freeLen, t, v); in CO_ODF_trace()
391 CO_trace_t *trace, in CO_trace_init() argument
408 trace->SDO = SDO; in CO_trace_init()
409 trace->enabled = (enabled != 0) ? true : false; in CO_trace_init()
410 trace->timeBuffer = timeBuffer; in CO_trace_init()
411 trace->valueBuffer = valueBuffer; in CO_trace_init()
412 trace->bufferSize = bufferSize; in CO_trace_init()
413 trace->writePtr = 0; in CO_trace_init()
414 trace->readPtr = 0; in CO_trace_init()
415 trace->lastTimeStamp = 0; in CO_trace_init()
416 trace->map = map; in CO_trace_init()
417 trace->format = format; in CO_trace_init()
418 trace->trigger = trigger; in CO_trace_init()
419 trace->threshold = threshold; in CO_trace_init()
420 trace->value = value; in CO_trace_init()
421 trace->minValue = minValue; in CO_trace_init()
422 trace->maxValue = maxValue; in CO_trace_init()
423 trace->triggerTime = triggerTime; in CO_trace_init()
424 *trace->value = 0; in CO_trace_init()
425 *trace->minValue = 0; in CO_trace_init()
426 *trace->maxValue = 0; in CO_trace_init()
427 *trace->triggerTime = 0; in CO_trace_init()
428 trace->valuePrev = 0; in CO_trace_init()
431 findVariable(trace); in CO_trace_init()
434 trace->bufferSize = 0; in CO_trace_init()
437 if( trace->bufferSize == 0 || trace->OD_variable == NULL) { in CO_trace_init()
438 trace->enabled = false; in CO_trace_init()
441 CO_OD_configure(SDO, idx_OD_traceConfig, CO_ODF_traceConfig, (void*)trace, 0, 0); in CO_trace_init()
442 CO_OD_configure(SDO, idx_OD_trace, CO_ODF_trace, (void*)trace, 0, 0); in CO_trace_init()
447 void CO_trace_process(CO_trace_t *trace, uint32_t timestamp) { in CO_trace_process() argument
448 if(trace->enabled) { in CO_trace_process()
450 int32_t val = trace->dt->pGetValue(trace->OD_variable); in CO_trace_process()
452 if(val != trace->valuePrev) { in CO_trace_process()
454 …if((*trace->trigger & 1) != 0 && trace->valuePrev < *trace->threshold && val >= *trace->threshold)… in CO_trace_process()
455 *trace->triggerTime = timestamp; in CO_trace_process()
457 …if((*trace->trigger & 2) != 0 && trace->valuePrev < *trace->threshold && val >= *trace->threshold)… in CO_trace_process()
458 *trace->triggerTime = timestamp; in CO_trace_process()
462 if(trace->value != trace->OD_variable) { in CO_trace_process()
463 *trace->value = val; in CO_trace_process()
465 trace->valuePrev = val; in CO_trace_process()
466 if(*trace->minValue > val) { in CO_trace_process()
467 *trace->minValue = val; in CO_trace_process()
469 if(*trace->maxValue < val) { in CO_trace_process()
470 *trace->maxValue = val; in CO_trace_process()
474 trace->timeBuffer[trace->writePtr] = timestamp; in CO_trace_process()
475 trace->valueBuffer[trace->writePtr] = val; in CO_trace_process()
476 if(++trace->writePtr == trace->bufferSize) { in CO_trace_process()
477 trace->writePtr = 0; in CO_trace_process()
479 if(trace->writePtr == trace->readPtr) { in CO_trace_process()
480 if(++trace->readPtr == trace->bufferSize) { in CO_trace_process()
481 trace->readPtr = 0; in CO_trace_process()
487 if(trace->writePtr == trace->readPtr) { in CO_trace_process()
489 trace->timeBuffer[trace->writePtr] = timestamp; in CO_trace_process()
490 trace->valueBuffer[trace->writePtr] = val; in CO_trace_process()
491 if(++trace->writePtr == trace->bufferSize) { in CO_trace_process()
492 trace->writePtr = 0; in CO_trace_process()
496 trace->lastTimeStamp = timestamp; in CO_trace_process()