libsigrokdecode
unreleased development snapshot
sigrok protocol decoding library
|
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_inst * | srd_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_inst * | srd_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... | |
Decoder instance handling.
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).
di | Decoder instance. |
new_channels | A 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. |
Definition at line 231 of file instance.c.
References srd_decoder::channels, srd_decoder_inst::dec_channelmap, srd_decoder_inst::dec_num_channels, srd_decoder_inst::decoder, srd_channel::id, srd_decoder_inst::inst_id, srd_decoder::name, srd_decoder::opt_channels, srd_channel::order, SRD_ERR, SRD_ERR_ARG, and SRD_OK.
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.
sess | The session holding the protocol decoder instance. Must not be NULL. |
inst_id | The instance ID to be found. |
Definition at line 613 of file instance.c.
Referenced by srd_inst_new().
int srd_inst_initial_pins_set_all | ( | struct srd_decoder_inst * | di, |
GArray * | initial_pins | ||
) |
Set the list of initial (assumed) pin values.
di | Decoder instance to use. Must not be NULL. |
initial_pins | A GArray of uint8_t values. Must not be NULL. |
Definition at line 640 of file instance.c.
References srd_decoder_inst::abs_cur_samplenum, srd_decoder_inst::abs_end_samplenum, srd_decoder_inst::abs_start_samplenum, srd_decoder_inst::channel_samples, srd_decoder_inst::communicate_eof, srd_decoder_inst::condition_list, srd_decoder_inst::data_mutex, srd_decoder_inst::data_unitsize, srd_decoder_inst::dec_channelmap, srd_decoder_inst::dec_num_channels, srd_decoder_inst::decoder_state, FALSE, srd_decoder_inst::got_new_samples, srd_decoder_inst::got_new_samples_cond, srd_decoder_inst::handled_all_samples, srd_decoder_inst::handled_all_samples_cond, srd_decoder_inst::inbuf, srd_decoder_inst::inbuflen, srd_decoder_inst::inst_id, srd_decoder_inst::match_array, srd_decoder_inst::next_di, srd_decoder_inst::old_pins_array, srd_decoder_inst::pd_output, srd_pd_output::proto_id, srd_decoder_inst::py_inst, SRD_ERR, SRD_ERR_ARG, SRD_ERR_PYTHON, SRD_ERR_TERM_REQ, SRD_INITIAL_PIN_SAME_AS_SAMPLE0, SRD_OK, SRD_PRIV, srd_decoder_inst::thread_handle, TRUE, and srd_decoder_inst::want_wait_terminate.
struct srd_decoder_inst* srd_inst_new | ( | struct srd_session * | sess, |
const char * | decoder_id, | ||
GHashTable * | options | ||
) |
Create a new protocol decoder instance.
sess | The session holding the protocol decoder instance. Must not be NULL. |
decoder_id | Decoder 'id' field. |
options | GHashtable of options which override the defaults set in the decoder class. May be NULL. |
Definition at line 336 of file instance.c.
References srd_decoder_inst::abs_cur_samplenum, srd_decoder_inst::abs_end_samplenum, srd_decoder_inst::abs_start_samplenum, srd_decoder_inst::channel_samples, srd_decoder::channels, srd_decoder_inst::communicate_eof, srd_decoder_inst::condition_list, srd_decoder_inst::data_mutex, srd_decoder_inst::dec_channelmap, srd_decoder_inst::dec_num_channels, srd_decoder_inst::decoder, srd_decoder_inst::decoder_state, FALSE, srd_decoder_inst::got_new_samples, srd_decoder_inst::got_new_samples_cond, srd_decoder_inst::handled_all_samples, srd_decoder_inst::handled_all_samples_cond, srd_decoder_inst::inbuf, srd_decoder_inst::inbuflen, srd_decoder_inst::inst_id, srd_decoder_inst::match_array, srd_decoder::opt_channels, srd_decoder::py_dec, srd_decoder_inst::py_inst, srd_decoder_inst::sess, srd_decoder_get_by_id(), srd_inst_find_by_id(), srd_inst_option_set(), SRD_OK, srd_decoder_inst::thread_handle, TRUE, and srd_decoder_inst::want_wait_terminate.
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.
di | Decoder instance. |
options | A GHashTable of options to set. |
Definition at line 92 of file instance.c.
References srd_decoder_inst::decoder, srd_decoder_option::def, srd_channel::id, 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.
Referenced by srd_inst_new().
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.
sess | The session holding the protocol decoder instances. Must not be NULL. |
di_bottom | The instance on top of which di_top will be stacked. |
di_top | The instance to go on top. |
Definition at line 521 of file instance.c.
References srd_decoder_inst::decoder, FALSE, srd_decoder::inputs, srd_decoder_inst::inst_id, srd_decoder_inst::next_di, srd_decoder::outputs, SRD_ERR_ARG, SRD_OK, and TRUE.