libsigrok
0.4.0
sigrok hardware access and backend library
|
Initializing and shutting down libsigrok. More...
Functions | |
int | sr_init (struct sr_context **ctx) |
Initialize libsigrok. More... | |
int | sr_exit (struct sr_context *ctx) |
Shutdown libsigrok. More... | |
Initializing and shutting down libsigrok.
Before using any of the libsigrok functionality (except for sr_log_loglevel_set()), sr_init() must be called to initialize the library, which will return a struct sr_context when the initialization was successful.
When libsigrok functionality is no longer needed, sr_exit() should be called, which will (among other things) free the struct sr_context.
Example for a minimal program using libsigrok:
int sr_exit | ( | struct sr_context * | ctx | ) |
Shutdown libsigrok.
ctx | Pointer to a libsigrok context struct. Must not be NULL. |
SR_OK | Success |
other | Error code SR_ERR, ... |
Definition at line 550 of file backend.c.
References sr_driver_list(), SR_ERR, and SR_OK.
int sr_init | ( | struct sr_context ** | ctx | ) |
Initialize libsigrok.
This function must be called before any other libsigrok function.
ctx | Pointer to a libsigrok context struct pointer. Must not be NULL. This will be a pointer to a newly allocated libsigrok context object upon success, and is undefined upon errors. |
Definition at line 464 of file backend.c.
References sr_dev_driver::context, SR_ERR, SR_OK, and sr_resource_set_hooks().