From 48256fd1a6e0a7a990ad826bfcdae96c9b805688 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 23 Mar 2022 13:24:18 +0000 Subject: [PATCH] iio.h: Add API functions to create and destroy channels masks Add functions iio_create_channels_mask() and iio_channels_mask_destroy(), to allow users to create/destroy channels masks. Signed-off-by: Paul Cercueil --- iio-private.h | 2 -- include/iio/iio.h | 14 ++++++++++++++ mask.c | 5 +++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/iio-private.h b/iio-private.h index 6d7c4e01c..fff93470f 100644 --- a/iio-private.h +++ b/iio-private.h @@ -161,8 +161,6 @@ struct iio_channels_mask { uint32_t mask[]; }; -struct iio_channels_mask *iio_create_channels_mask(unsigned int nb_channels); - int iio_channels_mask_copy(struct iio_channels_mask *dst, const struct iio_channels_mask *src); diff --git a/include/iio/iio.h b/include/iio/iio.h index e95ac404b..7ef6f0fd6 100644 --- a/include/iio/iio.h +++ b/include/iio/iio.h @@ -1407,6 +1407,20 @@ struct iio_data_format { }; +/** @brief Create a new empty channels mask + * @param nb_channels The number of channels in the mask + * @return On success, a pointer to an iio_channels_mask structure + * @return On error, NULL is returned */ +__api struct iio_channels_mask * +iio_create_channels_mask(unsigned int nb_channels); + + +/** @brief Destroy a channels mask + * @param mask A pointer to an iio_channels_mask structure */ +__api void +iio_channels_mask_destroy(struct iio_channels_mask *mask); + + /** @brief Get a mask of the currently enabled channels * @param dev A pointer to an iio_device structure * @return A pointer to an iio_channels_mask structure */ diff --git a/mask.c b/mask.c index 39f9c96c6..c7be62d92 100644 --- a/mask.c +++ b/mask.c @@ -36,3 +36,8 @@ int iio_channels_mask_copy(struct iio_channels_mask *dst, return 0; } + +void iio_channels_mask_destroy(struct iio_channels_mask *mask) +{ + free(mask); +}