Zephyr API 3.6.99
Loading...
Searching...
No Matches
bitarray.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/util.h>

Go to the source code of this file.

Macros

#define SYS_BITARRAY_DEFINE(name, total_bits)
 Create a bitarray object.
 
#define SYS_BITARRAY_DEFINE_STATIC(name, total_bits)
 Create a static bitarray object.
 

Typedefs

typedef struct sys_bitarray sys_bitarray_t
 Bitarray structure.
 

Functions

int sys_bitarray_set_bit (sys_bitarray_t *bitarray, size_t bit)
 Set a bit in a bit array.
 
int sys_bitarray_clear_bit (sys_bitarray_t *bitarray, size_t bit)
 Clear a bit in a bit array.
 
int sys_bitarray_test_bit (sys_bitarray_t *bitarray, size_t bit, int *val)
 Test whether a bit is set or not.
 
int sys_bitarray_test_and_set_bit (sys_bitarray_t *bitarray, size_t bit, int *prev_val)
 Test the bit and set it.
 
int sys_bitarray_test_and_clear_bit (sys_bitarray_t *bitarray, size_t bit, int *prev_val)
 Test the bit and clear it.
 
int sys_bitarray_alloc (sys_bitarray_t *bitarray, size_t num_bits, size_t *offset)
 Allocate bits in a bit array.
 
int sys_bitarray_xor (sys_bitarray_t *dst, sys_bitarray_t *other, size_t num_bits, size_t offset)
 Calculates the bit-wise XOR of two bitarrays in a region.
 
int sys_bitarray_find_nth_set (sys_bitarray_t *bitarray, size_t n, size_t num_bits, size_t offset, size_t *found_at)
 Find nth bit set in region.
 
int sys_bitarray_popcount_region (sys_bitarray_t *bitarray, size_t num_bits, size_t offset, size_t *count)
 Count bits set in a bit array region.
 
int sys_bitarray_free (sys_bitarray_t *bitarray, size_t num_bits, size_t offset)
 Free bits in a bit array.
 
bool sys_bitarray_is_region_set (sys_bitarray_t *bitarray, size_t num_bits, size_t offset)
 Test if bits in a region is all set.
 
bool sys_bitarray_is_region_cleared (sys_bitarray_t *bitarray, size_t num_bits, size_t offset)
 Test if bits in a region is all cleared.
 
int sys_bitarray_set_region (sys_bitarray_t *bitarray, size_t num_bits, size_t offset)
 Set all bits in a region.
 
int sys_bitarray_test_and_set_region (sys_bitarray_t *bitarray, size_t num_bits, size_t offset, bool to_set)
 Test if all bits in a region are cleared/set and set/clear them in a single atomic operation.
 
int sys_bitarray_clear_region (sys_bitarray_t *bitarray, size_t num_bits, size_t offset)
 Clear all bits in a region.