QP/C  7.0.0
Real-Time Embedded Framework
qs_rx.c File Reference

QS/C receive channel services. More...

#include "qs_port.h"
#include "qs_pkg.h"
#include "qassert.h"

Go to the source code of this file.

Functions

void QS_rxInitBuf (uint8_t sto[], uint16_t stoSize)
 
bool QS_RX_PUT (uint8_t const b)
 
uint16_t QS_rxGetNfree (void)
 
void QS_setCurrObj (uint8_t obj_kind, void *obj_ptr)
 
void QS_queryCurrObj (uint8_t obj_kind)
 
void QS_rxParse (void)
 
static void QS_rxParseData_ (uint8_t b)
 
static void QS_rxHandleGoodFrame_ (uint8_t state)
 
static void QS_rxHandleBadFrame_ (uint8_t state)
 
static void QS_rxReportAck_ (int8_t recId)
 
static void QS_rxReportError_ (int8_t code)
 
static void QS_rxReportDone_ (int8_t recId)
 
static void QS_rxPoke_ (void)
 
uint32_t QS_getTestProbe_ (void(*const api)(void))
 
QSTimeCtr QS_onGetTime (void)
 

Variables

QSrxPrivAttr QS_rxPriv_
 

Detailed Description

Date
Last updated on: 2021-12-23
Version
Last updated for: Version 7.0.0, 2022-04-30

Definition in file qs_rx.c.

Function Documentation

◆ QS_rxInitBuf()

void QS_rxInitBuf ( uint8_t  sto[],
uint16_t  stoSize 
)

This function should be called from QS_onStartup() to provide QS-RX with the receive data buffer.

Parameters
[in]sto[]the address of the memory block
[in]stoSizethe size of this block [bytes]. The size of the QS RX buffer cannot exceed 64KB.
Note
QS-RX can work with quite small data buffers, but you will start losing data if the buffer is not drained fast enough in the idle task.
If the data input rate exceeds the QS-RX processing rate, the data will be lost, but the QS protocol will notice that: (1) that the checksum in the incomplete QS records will fail; and (2) the sequence counter in QS records will show discontinuities.

The QS-RX channel will report any data errors by sending the QS_RX_DATA_ERROR trace record.

Definition at line 236 of file qs_rx.c.

◆ QS_RX_PUT()

bool QS_RX_PUT ( uint8_t const  b)

put one byte into the QS RX lock-free buffer

Definition at line 268 of file qs_rx.c.

◆ QS_rxGetNfree()

uint16_t QS_rxGetNfree ( void  )

This function is intended to be called from the ISR that reads the QS-RX bytes from the QSPY host application. The function returns the conservative number of free bytes currently available in the buffer, assuming that the head pointer is not being moved concurrently. The tail pointer might be moving, meaning that bytes can be concurrently removed from the buffer.

Definition at line 292 of file qs_rx.c.

◆ QS_setCurrObj()

void QS_setCurrObj ( uint8_t  obj_kind,
void *  obj_ptr 
)

This function programmatically sets the "current object" in the Target.

Definition at line 310 of file qs_rx.c.

◆ QS_queryCurrObj()

void QS_queryCurrObj ( uint8_t  obj_kind)

This function programmatically generates the response to the query for a "current object".

Definition at line 321 of file qs_rx.c.

◆ QS_rxParse()

void QS_rxParse ( void  )

Definition at line 375 of file qs_rx.c.

◆ QS_rxParseData_()

static void QS_rxParseData_ ( uint8_t  b)
static

Definition at line 420 of file qs_rx.c.

◆ QS_rxHandleGoodFrame_()

static void QS_rxHandleGoodFrame_ ( uint8_t  state)
static

Definition at line 860 of file qs_rx.c.

◆ QS_rxHandleBadFrame_()

static void QS_rxHandleBadFrame_ ( uint8_t  state)
static

Definition at line 1176 of file qs_rx.c.

◆ QS_rxReportAck_()

static void QS_rxReportAck_ ( int8_t  recId)
static

Definition at line 1192 of file qs_rx.c.

◆ QS_rxReportError_()

static void QS_rxReportError_ ( int8_t  code)
static

Definition at line 1204 of file qs_rx.c.

◆ QS_rxReportDone_()

static void QS_rxReportDone_ ( int8_t  recId)
static

Definition at line 1216 of file qs_rx.c.

◆ QS_rxPoke_()

static void QS_rxPoke_ ( void  )
static

Definition at line 1229 of file qs_rx.c.

◆ QS_getTestProbe_()

uint32_t QS_getTestProbe_ ( void(*)(void)  api)

This function obtains the Test-Probe for a given API.

Parameters
[in]apipointer to the API function that requests its Test-Probe
Returns
Test-Probe data that has been received for the given API from the Host (running qutest). For any ginve API, the function returns the Test-Probe data in the same order as it was received from the Host. If there is no Test-Probe for a ginve API, or no more Test-Probes for a given API, the function returns zero.

Definition at line 1268 of file qs_rx.c.

◆ QS_onGetTime()

QSTimeCtr QS_onGetTime ( void  )

Definition at line 1301 of file qs_rx.c.

Variable Documentation

◆ QS_rxPriv_

QSrxPrivAttr QS_rxPriv_

Definition at line 40 of file qs_rx.c.