1.. _mipi_stp_decoder: 2 3MIPI STP Decoder 4################ 5 6The MIPI System Trace Protocol (MIPI STP) was developed as a generic base protocol that can 7be shared by multiple application-specific trace protocols. It serves as a wrapper protocol 8that merges disparate streams that typically contain different trace protocols from different 9trace sources. Stream consists of opcode (shortest is 4 bit long) followed by optional data and 10optional timestamp. There are opcodes for data (8, 16, 32, 64 bit data marked/not marked, with or 11without timestamp), stream recognition (master and channel), synchronization (ASYNC opcode) and 12others. 13 14One example where protocol is used is ARM Coresight STM (System Trace Macrocell) where data 15written to Stimulus Port registers maps directly to STP stream. 16 17This module can be used to perform on-chip decoding of the data stream. STP v2 is used. 18 19Usage 20***** 21 22Decoder is initialized with a callback. A callback is called on each decoded opcode. 23Decoder has internal state since there are dependency between opcodes (e.g. timestamp can be 24relative). Decoder can be in synchronization or not. Initial state is configurable. 25If decoder is not synchronized to the stream then it decodes each nibble in search for ASYNC opcode. 26Loss of synchronization can be indicated to the decoder by calling 27:c:func:`mipi_stp_decoder_sync_loss`. :c:func:`mipi_stp_decoder_decode` is used to decode the data. 28 29Limitations 30*********** 31 32There are following limitations: 33 34* Decoder supports only little endian architectures. 35* When decoding nibbles, it is more efficient when core supports unaligned memory access. 36 Implementation supports optimized version with unaligned memory access and generic one. 37 Optimized version is used for ARM Cortex-M (expect for M0). 38* Limited set of the most common opcodes is implemented. 39 40API documentation 41***************** 42 43.. doxygengroup:: mipi_stp_decoder_apis 44