RKH
rkhtrc_stream.h File Reference

Specifies the trace stream manager (circular buffer). More...

#include "rkhtrc_out.h"
Include dependency graph for rkhtrc_stream.h:

Go to the source code of this file.

Functions

void rkh_trcStream_init (void)
 Initializes the RKH's trace stream. More...
 
rui8_t * rkh_trc_get (void)
 Retrieves a pointer to oldest stored byte in the trace stream. Frequently, this function is used by the called trace analyzer. More...
 
rui8_t * rkh_trc_get_block (TRCQTY_T *nget)
 Retrieves a pointer to a contiguous block of data from the trace stream. More...
 
void rkh_trc_put (rui8_t b)
 Put a data byte into the trace stream. More...
 
TRCQTY_T rkh_trc_getWholeBlock (rui8_t *destBlock, TRCQTY_T nElem)
 Copies the last nElem bytes of the stream to destBlock.
Frequently, this function is used by the called trace analyzer. More...
 

Detailed Description

Specifies the trace stream manager (circular buffer).

Definition in file rkhtrc_stream.h.

Function Documentation

◆ rkh_trcStream_init()

void rkh_trcStream_init ( void  )

Initializes the RKH's trace stream.

Note
rkh_trcStream_init() is NOT protected with a critical section.

◆ rkh_trc_get()

rui8_t* rkh_trc_get ( void  )

Retrieves a pointer to oldest stored byte in the trace stream. Frequently, this function is used by the called trace analyzer.

Note
The data is stored in a single ring buffer, called trace stream. In this manner the recorder always holds the most recent history. rkh_trc_get() is NOT protected with a critical section.
Returns
A pointer to the oldest stored byte if trace stream was not empty, otherwise NULL pointer.

◆ rkh_trc_get_block()

rui8_t* rkh_trc_get_block ( TRCQTY_T *  nget)

Retrieves a pointer to a contiguous block of data from the trace stream.

The function returns the pointer to the beginning of the block, and writes the number of bytes in the block to the location pointed to by nget. The argument nget is also used as input to provide the maximum size of the data block that the caller can accept. Frequently, this function is used by the called trace analyzer.

Parameters
[in]ngetwhen this function is invoked nget is used as an input to provide the maximum size of the data block to be retrieved. Also, it is used as an output retrieving the size of block.
Returns
The pointer to the beginning of the block, and writes the number of bytes in the block to the location pointed to by nget. If this number differs from the nget parameter, the end-of-stream was reached. If the trace stream is empty, the function returns NULL and the content pointed by nget is set to zero.
Note
The data is stored in a single ring buffer, called trace stream. In this manner the recorder always holds the most recent history. rkh_trc_get_block() is NOT protected with a critical section.

◆ rkh_trc_put()

void rkh_trc_put ( rui8_t  b)

Put a data byte into the trace stream.

Parameters
[in]bdata to be written in the trace stream.
Note
The data is stored in a single ring buffer, called trace stream. In this manner the recorder always holds the most recent history. rkh_trc_put() is NOT protected with a critical section.

◆ rkh_trc_getWholeBlock()

TRCQTY_T rkh_trc_getWholeBlock ( rui8_t *  destBlock,
TRCQTY_T  nElem 
)

Copies the last nElem bytes of the stream to destBlock.
Frequently, this function is used by the called trace analyzer.

Parameters
[in]destBlockpointer to the destination array where the required stream content is copied.
[in]nElemmaximum number of bytes to be copied from the stream.
Returns
Number of bytes copies to destBlock. If this number differs from the nElem parameter, i.e. it is less than nElem, the end-of-stream was reached. If the trace stream is empty, this function returns zero.
Note
The data is stored in a single ring buffer, called trace stream. In this manner the recorder always holds the most recent history. rkh_trc_getWholeBlock() is NOT protected with a critical section.