-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better backend API #1138
Better backend API #1138
Conversation
Sort attributes as soon as a new one has been added. Signed-off-by: Paul Cercueil <[email protected]>
A backend API function iio_context_add_device() will be introduced; rename the old function so that it won't get in the way. Signed-off-by: Paul Cercueil <[email protected]>
This API function can be used to create and add a iio_device to the iio_context. Signed-off-by: Paul Cercueil <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've played with a few of these functions and they provide a good alternative to the iio_create_context_from_xml
function which uses libxml2 which grows the .text area of the binary about 3 times in my tests (100k -> 300k)
what Paul did here is very good for embedding tinyiiod on small embedded devices
b4b7b92
to
e1c3a9d
Compare
This API function can be used to create and add a iio_channel to the iio_device. Signed-off-by: Paul Cercueil <[email protected]>
These functions can be used to add an attribute to an iio_context, iio_device and iio_channel respectively. Signed-off-by: Paul Cercueil <[email protected]>
Change its prototype so that it takes a iio_context_params pointer, as well as major/minor/git_tag version information. Signed-off-by: Paul Cercueil <[email protected]>
Use the new backend functions to create the iio_context, iio_device and iio_channel objects. By doing so, the XML backend is now fully decoupled from the private API, and it only uses public headers. Note that we don't need to print the channel or device names with the debug macros, as they already do that for us. Signed-off-by: Paul Cercueil <[email protected]>
Rework the code to use the new iio_context_add_device() from the backend API, instead of using Libiio's internal functions directly. Signed-off-by: Paul Cercueil <[email protected]>
This function is not used anywhere anymore. Signed-off-by: Paul Cercueil <[email protected]>
Signed-off-by: Paul Cercueil <[email protected]>
f87886f
to
6ad613a
Compare
@pcercuei you may merge this |
Only people from ADI can merge 🙃 |
Gentle ping. |
Modify/add functions:
iio_context_add_device
, which will create aiio_device
and add it to the context;iio_device_add_channel
, which will create aiio_channel
and add it to the device;iio_{context,device,channel}_add_attr
to add attributes to contexts/devices/channels are now backend APIiio_create_context_from_backend
now takes a few extra parameters that will be used to create the iio_context.With these changes, the XML backend was updated to be fully implemented on top of the public API (be it iio.h or iio-backend.h) and does not use iio-private.h anymore.
In theory, the local backend could do that too but it's a lot more work (due to how it currently creates the context).
The code should be considered very experimental, it was not thoroughly tested.