libsigrokdecode
0.4.0
sigrok protocol decoding library
|
Starting and handling decoding sessions. More...
Functions | |
int | srd_session_new (struct srd_session **sess) |
Create a decoding session. More... | |
int | srd_session_start (struct srd_session *sess) |
Start a decoding session. More... | |
int | srd_session_metadata_set (struct srd_session *sess, int key, GVariant *data) |
Set a metadata configuration key in a session. More... | |
int | srd_session_send (struct srd_session *sess, uint64_t start_samplenum, uint64_t end_samplenum, const uint8_t *inbuf, uint64_t inbuflen, uint64_t unitsize) |
Send a chunk of logic sample data to a running decoder session. More... | |
int | srd_session_destroy (struct srd_session *sess) |
Destroy a decoding session. More... | |
int | srd_pd_output_callback_add (struct srd_session *sess, int output_type, srd_pd_output_callback cb, void *cb_data) |
Register/add a decoder output callback function. More... | |
Starting and handling decoding sessions.
int srd_pd_output_callback_add | ( | struct srd_session * | sess, |
int | output_type, | ||
srd_pd_output_callback | 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).
sess | The output session in which to register the callback. |
output_type | The output type this callback will receive. Only one callback per output type can be registered. |
cb | The function to call. Must not be NULL. |
cb_data | Private data for the callback function. Can be NULL. |
Definition at line 299 of file session.c.
References srd_pd_callback::cb, srd_pd_callback::cb_data, srd_pd_callback::output_type, SRD_ERR_ARG, and SRD_OK.
int srd_session_destroy | ( | struct srd_session * | sess | ) |
Destroy a decoding session.
All decoder instances and output callbacks are properly released.
sess | The session to be destroyed. |
Definition at line 262 of file session.c.
References SRD_ERR_ARG, and SRD_OK.
Referenced by srd_exit().
int srd_session_metadata_set | ( | struct srd_session * | sess, |
int | key, | ||
GVariant * | data | ||
) |
Set a metadata configuration key in a session.
sess | The session to configure. |
key | The configuration key (SRD_CONF_*). |
data | The new value for the key, as a GVariant with GVariantType appropriate to that key. A floating reference can be passed in; its refcount will be sunk and unreferenced after use. |
Definition at line 161 of file session.c.
References SRD_CONF_SAMPLERATE, SRD_ERR_ARG, and SRD_OK.
int srd_session_new | ( | struct srd_session ** | sess | ) |
Create a decoding session.
A session holds all decoder instances, their stack relationships and output callbacks.
sess | A pointer which will hold a pointer to a newly initialized session on return. |
Definition at line 71 of file session.c.
References SRD_ERR_ARG, and SRD_OK.
int srd_session_send | ( | struct srd_session * | sess, |
uint64_t | start_samplenum, | ||
uint64_t | end_samplenum, | ||
const uint8_t * | inbuf, | ||
uint64_t | inbuflen, | ||
uint64_t | unitsize | ||
) |
Send a chunk of logic sample data to a running decoder session.
If no channel map has been set up, the logic samples must be arranged in channel order, in the least amount of space possible. The default channel set consists of all required channels + all optional channels.
The size of a sample in inbuf is 'unitsize' bytes. If no channel map has been configured, it is the minimum number of bytes needed to store the default channels.
sess | The session to use. |
start_samplenum | The sample number of the first sample in this chunk. |
end_samplenum | The sample number of the last sample in this chunk. |
inbuf | Pointer to sample data. |
inbuflen | Length in bytes of the buffer. |
unitsize | The number of bytes per sample. |
Definition at line 230 of file session.c.
References SRD_ERR_ARG, and SRD_OK.
int srd_session_start | ( | struct srd_session * | sess | ) |