Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
bitarray.c File Reference
#include <zephyr.h>
#include <ztest.h>
#include <arch/cpu.h>
#include <tc_util.h>
#include <sys/bitarray.h>
#include <sys/util.h>

Macros

#define BIT_INDEX(bit)   (bit >> 3)
 
#define BIT_VAL(bit)   (1 << (bit & 0x7))
 
#define BITFIELD_SIZE   512
 
#define FAIL_ALLOC_MSG_FMT   "sys_bitarray_alloc with region size %i allocated incorrectly"
 
#define FAIL_ALLOC_RET_MSG_FMT   "sys_bitarray_alloc with region size %i returned incorrect result"
 
#define FAIL_ALLOC_OFFSET_MSG_FMT   "sys_bitarray_alloc with region size %i gave incorrect offset"
 
#define FAIL_FREE_MSG_FMT   "sys_bitarray_free with region size %i and offset %i failed"
 
#define FREE   0U
 

Functions

static bool cmp_u32_arrays (uint32_t *a1, uint32_t *a2, size_t sz)
 
void validate_bitarray_define (sys_bitarray_t *ba, size_t num_bits)
 
void test_bitarray_declare (void)
 Test defining of bitarrays. More...
 
bool bitarray_bundles_is_zero (sys_bitarray_t *ba)
 
void test_bitarray_set_clear (void)
 Test bitarrays set and clear. More...
 
void alloc_and_free_predefined (void)
 
static size_t count_bits (uint32_t val)
 
size_t get_bitarray_popcnt (sys_bitarray_t *ba)
 
void alloc_and_free_loop (int divisor)
 
void alloc_and_free_interval (void)
 
void test_bitarray_alloc_free (void)
 Test bitarrays allocation and free. More...
 
void test_bitarray_region_set_clear (void)
 
void test_ffs (void)
 Test find MSB and LSB operations. More...
 

Macro Definition Documentation

◆ BIT_INDEX

#define BIT_INDEX (   bit)    (bit >> 3)

◆ BIT_VAL

#define BIT_VAL (   bit)    (1 << (bit & 0x7))

◆ BITFIELD_SIZE

#define BITFIELD_SIZE   512