Skip to content

Commit

Permalink
iio.h: Add API functions to create and destroy channels masks
Browse files Browse the repository at this point in the history
Add functions iio_create_channels_mask() and
iio_channels_mask_destroy(), to allow users to create/destroy channels
masks.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed Aug 23, 2022
1 parent 9958d44 commit 48256fd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 0 additions & 2 deletions iio-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
14 changes: 14 additions & 0 deletions include/iio/iio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 5 additions & 0 deletions mask.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 48256fd

Please sign in to comment.