diff options
author | Bert Vermeulen <bert@biot.com> | 2012-01-15 23:20:39 +0100 |
---|---|---|
committer | Bert Vermeulen <bert@biot.com> | 2012-01-15 23:25:58 +0100 |
commit | 86528298fa2abfe825d6763b806095972e8bd8f4 (patch) | |
tree | 3960705cb28fdb72d8986569aed8d200c582b6d6 /controller.c | |
parent | a2c2afd9357fab233a4f09531618faa81d54d4d9 (diff) | |
download | libsigrokdecode-86528298fa2abfe825d6763b806095972e8bd8f4.tar.gz libsigrokdecode-86528298fa2abfe825d6763b806095972e8bd8f4.zip |
srd: PDs now get a logic feed with sample numbers, not time/duration
Diffstat (limited to 'controller.c')
-rw-r--r-- | controller.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/controller.c b/controller.c index 963345c..9a663ff 100644 --- a/controller.c +++ b/controller.c @@ -283,11 +283,12 @@ int srd_instance_start(struct srd_decoder_instance *di, PyObject *args) * * @return SRD_OK upon success, a (negative) error code otherwise. */ -int srd_instance_decode(uint64_t timeoffset, uint64_t duration, +int srd_instance_decode(uint64_t start_samplenum, struct srd_decoder_instance *di, uint8_t *inbuf, uint64_t inbuflen) { PyObject *py_instance, *py_res; srd_logic *logic; + uint64_t end_samplenum; /* Return an error upon unusable input. */ if (di == NULL) @@ -304,14 +305,16 @@ int srd_instance_decode(uint64_t timeoffset, uint64_t duration, logic = PyObject_New(srd_logic, &srd_logic_type); Py_INCREF(logic); logic->di = di; + logic->start_samplenum = start_samplenum; logic->itercnt = 0; logic->inbuf = inbuf; logic->inbuflen = inbuflen; logic->sample = PyList_New(2); Py_INCREF(logic->sample); + end_samplenum = start_samplenum + inbuflen / di->unitsize; if (!(py_res = PyObject_CallMethod(py_instance, "decode", - "KKO", timeoffset, duration, logic))) { + "KKO", logic->start_samplenum, end_samplenum, logic))) { if (PyErr_Occurred()) PyErr_Print(); /* Returns void. */ @@ -360,14 +363,13 @@ int srd_session_start(int num_probes, int unitsize, uint64_t samplerate) } /* Feed logic samples to decoder session. */ -int srd_session_feed(uint64_t timeoffset, uint64_t duration, uint8_t *inbuf, - uint64_t inbuflen) +int srd_session_feed(uint64_t start_samplenum, uint8_t *inbuf, uint64_t inbuflen) { GSList *d; int ret; for (d = di_list; d; d = d->next) { - if ((ret = srd_instance_decode(timeoffset, duration, d->data, inbuf, + if ((ret = srd_instance_decode(start_samplenum, d->data, inbuf, inbuflen)) != SRD_OK) return ret; } |