libsigrokdecode  0.2.0
sigrok protocol decoding library
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Groups Pages
Functions
Session handling

Starting and handling decoding sessions. More...

Functions

int srd_session_start (int num_probes, int unitsize, uint64_t samplerate)
 Start a decoding session. More...
 
int srd_session_send (uint64_t start_samplenum, const uint8_t *inbuf, uint64_t inbuflen)
 Send a chunk of logic sample data to a running decoder session. More...
 
int srd_pd_output_callback_add (int output_type, srd_pd_output_callback_t cb, void *cb_data)
 Register/add a decoder output callback function. More...
 

Detailed Description

Starting and handling decoding sessions.

Function Documentation

int srd_pd_output_callback_add ( int  output_type,
srd_pd_output_callback_t  cb,
void *  cb_data 
)

Register/add a decoder output callback function.

The function will be called when a protocol decoder sends output back to the PD controller (except for Python objects, which only go up the stack).

Parameters
output_typeThe output type this callback will receive. Only one callback per output type can be registered.
cbThe function to call. Must not be NULL.
cb_dataPrivate data for the callback function. Can be NULL.
Since
0.1.0

Definition at line 943 of file controller.c.

References srd_pd_callback::cb, srd_pd_callback::cb_data, srd_pd_callback::output_type, SRD_ERR_MALLOC, and SRD_OK.

int srd_session_send ( uint64_t  start_samplenum,
const uint8_t *  inbuf,
uint64_t  inbuflen 
)

Send a chunk of logic sample data to a running decoder session.

Parameters
start_samplenumThe sample number of the first sample in this chunk.
inbufPointer to sample data.
inbuflenLength in bytes of the buffer.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.1.0

Definition at line 910 of file controller.c.

References SRD_OK.

int srd_session_start ( int  num_probes,
int  unitsize,
uint64_t  samplerate 
)

Start a decoding session.

Decoders, instances and stack must have been prepared beforehand.

Parameters
num_probesThe number of probes which the incoming feed will contain.
unitsizeThe number of bytes per sample in the incoming feed.
samplerateThe samplerate of the incoming feed.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.1.0

Definition at line 863 of file controller.c.

References srd_decoder_inst::data_num_probes, srd_decoder_inst::data_samplerate, srd_decoder_inst::data_unitsize, SRD_ERR_PYTHON, and SRD_OK.