CANopenNode
CO_trace.h
Go to the documentation of this file.
1 
26 #ifndef CO_TRACE_H
27 #define CO_TRACE_H
28 
29 #include "301/CO_driver.h"
30 #include "301/CO_SDOserver.h"
31 
32 /* default configuration, see CO_config.h */
33 #ifndef CO_CONFIG_TRACE
34 #define CO_CONFIG_TRACE (0)
35 #endif
36 
37 #if ((CO_CONFIG_TRACE) & CO_CONFIG_TRACE_ENABLE) || defined CO_DOXYGEN
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
69 #ifndef OD_INDEX_TRACE_CONFIG
70 #define OD_INDEX_TRACE_CONFIG 0x2301
71 #define OD_INDEX_TRACE 0x2401
72 #endif
73 
74 
78 typedef struct {
80  int32_t (*pGetValue) (void *OD_variable);
82  uint32_t (*printPointStart)(char *s, uint32_t size, uint32_t timeStamp, int32_t value);
84  uint32_t (*printPoint)(char *s, uint32_t size, uint32_t timeStamp, int32_t value);
86  uint32_t (*printPointEnd)(char *s, uint32_t size, uint32_t timeStamp, int32_t value);
88 
89 
93 typedef struct {
95  CO_SDO_t *SDO;
99  volatile uint32_t writePtr;
100  volatile uint32_t readPtr;
102  void *OD_variable;
113 } CO_trace_t;
114 
115 
140 void CO_trace_init(
141  CO_trace_t *trace,
142  CO_SDO_t *SDO,
143  uint8_t enabled,
144  uint32_t *timeBuffer,
145  int32_t *valueBuffer,
146  uint32_t bufferSize,
147  uint32_t *map,
148  uint8_t *format,
149  uint8_t *trigger,
150  int32_t *threshold,
151  int32_t *value,
152  int32_t *minValue,
153  int32_t *maxValue,
154  uint32_t *triggerTime,
155  uint16_t idx_OD_traceConfig,
156  uint16_t idx_OD_trace);
157 
158 
169 void CO_trace_process(CO_trace_t *trace, uint32_t timestamp);
170  /* CO_trace */
172 
173 #ifdef __cplusplus
174 }
175 #endif /*__cplusplus*/
176 
177 #endif /* (CO_CONFIG_TRACE) & CO_CONFIG_TRACE_ENABLE */
178 
179 #endif /* CO_TRACE_H */
uint32_t
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition: CO_driver.h:155
CO_driver.h
Interface between CAN hardware and CANopenNode.
CO_trace_t
Trace object.
Definition: CO_trace.h:93
CO_trace_t::minValue
int32_t * minValue
From CO_trace_init().
Definition: CO_trace.h:108
uint16_t
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
CO_trace_t::triggerTime
uint32_t * triggerTime
From CO_trace_init().
Definition: CO_trace.h:110
CO_trace_t::valuePrev
int32_t valuePrev
Previous value of value.
Definition: CO_trace.h:104
CO_trace_t::timeBuffer
uint32_t * timeBuffer
From CO_trace_init().
Definition: CO_trace.h:96
CO_trace_t::bufferSize
uint32_t bufferSize
From CO_trace_init().
Definition: CO_trace.h:98
bool_t
unsigned char bool_t
Boolean data type for general use.
Definition: CO_driver.h:141
int32_t
signed long int int32_t
INTEGER32 in CANopen (0004h), 32-bit signed integer.
Definition: CO_driver.h:147
CO_trace_t::format
uint8_t * format
From CO_trace_init().
Definition: CO_trace.h:106
CO_trace_t::threshold
int32_t * threshold
From CO_trace_init().
Definition: CO_trace.h:112
CO_trace_t::writePtr
volatile uint32_t writePtr
Location in buffer, which will be next written.
Definition: CO_trace.h:99
CO_SDOserver.h
CANopen Service Data Object - server protocol.
CO_trace_t::lastTimeStamp
uint32_t lastTimeStamp
Last time stamp.
Definition: CO_trace.h:101
CO_trace_t::OD_variable
void * OD_variable
Pointer to variable, which is monitored.
Definition: CO_trace.h:102
CO_trace_t::SDO
CO_SDO_t * SDO
From CO_trace_init().
Definition: CO_trace.h:95
CO_trace_dataType_t
structure for reading variables and printing points for specific data type.
Definition: CO_trace.h:78
CO_trace_t::readPtr
volatile uint32_t readPtr
Location in buffer, which will be next read.
Definition: CO_trace.h:100
CO_trace_init
void CO_trace_init(CO_trace_t *trace, CO_SDO_t *SDO, uint8_t enabled, uint32_t *timeBuffer, int32_t *valueBuffer, uint32_t bufferSize, uint32_t *map, uint8_t *format, uint8_t *trigger, int32_t *threshold, int32_t *value, int32_t *minValue, int32_t *maxValue, uint32_t *triggerTime, uint16_t idx_OD_traceConfig, uint16_t idx_OD_trace)
Initialize trace object.
CO_trace_t::value
int32_t * value
From CO_trace_init().
Definition: CO_trace.h:107
CO_trace_t::enabled
bool_t enabled
True, if trace is enabled.
Definition: CO_trace.h:94
CO_trace_t::map
uint32_t * map
From CO_trace_init().
Definition: CO_trace.h:105
CO_trace_t::maxValue
int32_t * maxValue
From CO_trace_init().
Definition: CO_trace.h:109
CO_trace_t::trigger
uint8_t * trigger
From CO_trace_init().
Definition: CO_trace.h:111
CO_trace_process
void CO_trace_process(CO_trace_t *trace, uint32_t timestamp)
Process trace object.
CO_trace_t::dt
const CO_trace_dataType_t * dt
Data type specific function pointers.
Definition: CO_trace.h:103
uint8_t
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition: CO_driver.h:151
CO_trace_t::valueBuffer
int32_t * valueBuffer
From CO_trace_init().
Definition: CO_trace.h:97