Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
bitarray.c File Reference
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/tc_util.h>
#include <zephyr/sys/bitarray.h>
#include <zephyr/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)
 
 ZTEST (bitarray, test_bitarray_declare)
 Test defining of bitarrays.
 
bool bitarray_bundles_is_zero (sys_bitarray_t *ba)
 
 ZTEST (bitarray, test_bitarray_set_clear)
 Test bitarrays set and clear.
 
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)
 
 ZTEST (bitarray, test_bitarray_alloc_free)
 Test bitarrays allocation and free.
 
 ZTEST (bitarray, test_bitarray_popcount_region)
 
 ZTEST (bitarray, test_bitarray_xor)
 
 ZTEST (bitarray, test_bitarray_find_nth_set)
 
 ZTEST (bitarray, test_bitarray_region_set_clear)
 
 ZTEST (bitarray, test_ffs)
 Test find MSB and LSB operations.
 
void * common_setup (void)
 
 ZTEST_SUITE (bitarray, NULL, common_setup, NULL, NULL, NULL)
 

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