libsigrokdecode  0.5.2
sigrok protocol decoding library
Functions
Decoder instances

Decoder instance handling. More...

Functions

int srd_inst_option_set (struct srd_decoder_inst *di, GHashTable *options)
 Set one or more options in a decoder instance. More...
 
int srd_inst_channel_set_all (struct srd_decoder_inst *di, GHashTable *new_channels)
 Set all channels in a decoder instance. More...
 
struct srd_decoder_instsrd_inst_new (struct srd_session *sess, const char *decoder_id, GHashTable *options)
 Create a new protocol decoder instance. More...
 
int srd_inst_stack (struct srd_session *sess, struct srd_decoder_inst *di_bottom, struct srd_decoder_inst *di_top)
 Stack a decoder instance on top of another. More...
 
struct srd_decoder_instsrd_inst_find_by_id (struct srd_session *sess, const char *inst_id)
 Find a decoder instance by its instance ID. More...
 
int srd_inst_initial_pins_set_all (struct srd_decoder_inst *di, GArray *initial_pins)
 Set the list of initial (assumed) pin values. More...
 

Detailed Description

Decoder instance handling.

Function Documentation

◆ srd_inst_channel_set_all()

int srd_inst_channel_set_all ( struct srd_decoder_inst di,
GHashTable *  new_channels 
)

Set all channels in a decoder instance.

This function sets all channels for the specified decoder instance, i.e., it overwrites any channels that were already defined (if any).

Parameters
diDecoder instance.
new_channelsA GHashTable of channels to set. Key is channel name, value is the channel number. Samples passed to this instance will be arranged in this order.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.4.0

Definition at line 202 of file instance.c.

References srd_decoder::channels, srd_decoder_inst::dec_num_channels, srd_decoder_inst::decoder, srd_decoder_inst::inst_id, srd_decoder::name, SRD_ERR_ARG, and SRD_OK.

◆ srd_inst_find_by_id()

struct srd_decoder_inst* srd_inst_find_by_id ( struct srd_session *  sess,
const char *  inst_id 
)

Find a decoder instance by its instance ID.

This will recurse to find the instance anywhere in the stack tree of the given session.

Parameters
sessThe session holding the protocol decoder instance. Must not be NULL.
inst_idThe instance ID to be found.
Returns
Pointer to struct srd_decoder_inst, or NULL if not found.
Since
0.3.0

Definition at line 562 of file instance.c.

References srd_decoder_inst::sess.

Referenced by srd_inst_new().

+ Here is the caller graph for this function:

◆ srd_inst_initial_pins_set_all()

int srd_inst_initial_pins_set_all ( struct srd_decoder_inst di,
GArray *  initial_pins 
)

Set the list of initial (assumed) pin values.

Parameters
diDecoder instance to use. Must not be NULL.
initial_pinsA GArray of uint8_t values. Must not be NULL.
Since
0.5.0

Definition at line 589 of file instance.c.

References srd_decoder_inst::dec_num_channels, and SRD_ERR_ARG.

◆ srd_inst_new()

struct srd_decoder_inst* srd_inst_new ( struct srd_session *  sess,
const char *  decoder_id,
GHashTable *  options 
)

Create a new protocol decoder instance.

Parameters
sessThe session holding the protocol decoder instance. Must not be NULL.
decoder_idDecoder 'id' field.
optionsGHashtable of options which override the defaults set in the decoder class. May be NULL.
Returns
Pointer to a newly allocated struct srd_decoder_inst, or NULL in case of failure.
Since
0.3.0

Definition at line 307 of file instance.c.

References srd_decoder_inst::channel_samples, srd_decoder::channels, srd_decoder_inst::dec_channelmap, srd_decoder_inst::dec_num_channels, srd_decoder_inst::decoder, srd_decoder_inst::inst_id, srd_decoder::opt_channels, srd_decoder_inst::sess, srd_decoder_get_by_id(), and srd_inst_find_by_id().

+ Here is the call graph for this function:

◆ srd_inst_option_set()

int srd_inst_option_set ( struct srd_decoder_inst di,
GHashTable *  options 
)

Set one or more options in a decoder instance.

Handled options are removed from the hash.

Parameters
diDecoder instance.
optionsA GHashTable of options to set.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.1.0

Definition at line 66 of file instance.c.

References srd_decoder_inst::decoder, srd_decoder_option::def, srd_decoder_option::id, srd_decoder_inst::inst_id, srd_decoder::options, srd_decoder::py_dec, srd_decoder_inst::py_inst, SRD_ERR_ARG, SRD_ERR_PYTHON, and SRD_OK.

◆ srd_inst_stack()

int srd_inst_stack ( struct srd_session *  sess,
struct srd_decoder_inst di_bottom,
struct srd_decoder_inst di_top 
)

Stack a decoder instance on top of another.

Parameters
sessThe session holding the protocol decoder instances. Must not be NULL.
di_bottomThe instance on top of which di_top will be stacked.
di_topThe instance to go on top.
Returns
SRD_OK upon success, a (negative) error code otherwise.
Since
0.3.0

Definition at line 491 of file instance.c.

References srd_decoder_inst::inst_id, srd_decoder_inst::next_di, srd_decoder_inst::sess, SRD_ERR_ARG, and SRD_OK.