diff options
author | Bert Vermeulen <bert@biot.com> | 2013-09-12 23:54:43 +0200 |
---|---|---|
committer | Bert Vermeulen <bert@biot.com> | 2013-10-14 10:43:16 +0200 |
commit | 32cfb920625182c03eb4a4564ffdfa9d2b08f15c (patch) | |
tree | 925fd9152e284d4afcfb473247667149c2aaf1e6 /decoder.c | |
parent | 1f2e00d140ac41a3a61888f67fc6f96c4369bea3 (diff) | |
download | libsigrokdecode-32cfb920625182c03eb4a4564ffdfa9d2b08f15c.tar.gz libsigrokdecode-32cfb920625182c03eb4a4564ffdfa9d2b08f15c.zip |
Move all decoder instances and callbacks into a session struct
The struct srd_session also holds configuration parameters formerly
passed to srd_session_start().
The new call srd_session_new() takes a pointer where a newly allocated
pointer to struct srd_session will be stored. This pointer must be
passed as the first argument to all functions that require it.
The SRD_CONF_NUM_PROBES, SRD_CONF_UNITSIZE and SRD_CONF_SAMPLERATE
keys must be configured with srd_config_set() before srd_session_start()
is called.
A new call srd_session_destroy() is also available. This cleans up all
resources the session holds. This is also called from srd_exit() for
all sessions.
Diffstat (limited to 'decoder.c')
-rw-r--r-- | decoder.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -42,6 +42,8 @@ /* The list of protocol decoders. */ SRD_PRIV GSList *pd_list = NULL; +extern GSList *sessions; + /* module_sigrokdecode.c */ extern SRD_PRIV PyObject *mod_sigrokdecode; @@ -461,6 +463,7 @@ static void free_probes(GSList *probelist) SRD_API int srd_decoder_unload(struct srd_decoder *dec) { struct srd_decoder_option *o; + struct srd_session *sess; GSList *l; srd_dbg("Unloading protocol decoder '%s'.", dec->name); @@ -471,7 +474,10 @@ SRD_API int srd_decoder_unload(struct srd_decoder *dec) * stack. A frontend reloading a decoder thus has to restart all * instances, and rebuild the stack. */ - srd_inst_free_all(NULL); + for (l = sessions; l; l = l->next) { + sess = l->data; + srd_inst_free_all(sess, NULL); + } for (l = dec->options; l; l = l->next) { o = l->data; |