Working with trace buffer
The trace buffer is passed to the user as a message, enveloping the trace buffer in the message. This means that a task has to open the message via PxMsgGetData() to get access to the trace buffer. It will get read permissions for the buffer area. A message received from PxTraceGetBuffer() is a regular message object that can be manipulated accordingly. The data are not copied, so the user is responsible for ensuring the data`s integrity.
/* Get trace buffer as a message enveloped */
PxMsg_t traceBufferHnd = PxTraceGetBuffer(PXOpoolTaskdefault);
/* Open the message to get access to the trace buffer */
TraceEntry_t * traceBufferPtr = (TraceEntry_t *) PxMsgGetData(traceBufferHnd);
/* Release the message back to object pool where the message comes from */
traceBufferHnd = PxMsgRelease(traceBufferHnd);
if (PxMsgIdIsValid (traceBufferHnd))
PxPanic();