Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Memory bit manipulation APIs

Functions

static ALWAYS_INLINE void sys_set_bit (mem_addr_t addr, unsigned int bit)
 Set the designated bit from addr to 1.
static ALWAYS_INLINE void sys_set_bits (mem_addr_t addr, unsigned int mask)
 Masking the designated bits from addr to 1.
static ALWAYS_INLINE void sys_clear_bits (mem_addr_t addr, unsigned int mask)
 Masking the designated bits from addr to 0.
static ALWAYS_INLINE void sys_clear_bit (mem_addr_t addr, unsigned int bit)
 Clear the designated bit from addr to 0.
static ALWAYS_INLINE int sys_test_bit (mem_addr_t addr, unsigned int bit)
 Test the bit if it is set or not.
static ALWAYS_INLINE int sys_test_and_set_bit (mem_addr_t addr, unsigned int bit)
 Test the bit and set it.
static ALWAYS_INLINE int sys_test_and_clear_bit (mem_addr_t addr, unsigned int bit)
 Test the bit and clear it.
static ALWAYS_INLINE void sys_bitfield_set_bit (mem_addr_t addr, unsigned int bit)
 Set the designated bit from addr to 1.
static ALWAYS_INLINE void sys_bitfield_clear_bit (mem_addr_t addr, unsigned int bit)
 Clear the designated bit from addr to 0.
static ALWAYS_INLINE int sys_bitfield_test_bit (mem_addr_t addr, unsigned int bit)
 Test the bit if it is set or not.
static ALWAYS_INLINE int sys_bitfield_test_and_set_bit (mem_addr_t addr, unsigned int bit)
 Test the bit and set it.
static ALWAYS_INLINE int sys_bitfield_test_and_clear_bit (mem_addr_t addr, unsigned int bit)
 Test the bit and clear it.

Detailed Description

Function Documentation

◆ sys_bitfield_clear_bit()

ALWAYS_INLINE void sys_bitfield_clear_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Clear the designated bit from addr to 0.

This functions takes the designated bit starting from addr and sets it to 0.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to clear (arbitrary)

◆ sys_bitfield_set_bit()

ALWAYS_INLINE void sys_bitfield_set_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Set the designated bit from addr to 1.

This functions takes the designated bit starting from addr and sets it to 1.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to set (arbitrary)

◆ sys_bitfield_test_and_clear_bit()

ALWAYS_INLINE int sys_bitfield_test_and_clear_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Test the bit and clear it.

This functions takes the designated bit starting from addr, test its current setting and clears it. It will return the previous setting.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to test and clear (arbitrary)
Returns
the bitwise AND result of addr content and (1 << bit) before target bit is cleared. Result is 0 only if the bit was cleared otherwise result is a non-0 value.

◆ sys_bitfield_test_and_set_bit()

ALWAYS_INLINE int sys_bitfield_test_and_set_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Test the bit and set it.

This functions takes the designated bit starting from addr, tests its current setting and sets it. It will return the previous setting.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to test and set (arbitrary)
Returns
the bitwise AND result of addr content and (1 << bit) before target bit is set. Result is 0 only if the bit was cleared otherwise result is a non-0 value.

◆ sys_bitfield_test_bit()

ALWAYS_INLINE int sys_bitfield_test_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Test the bit if it is set or not.

This functions takes the designated bit starting from addr and tests its current setting. It will return the current setting.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to test (arbitrary)
Returns
the bitwise AND result of addr content and (1 << bit). Result is 0 only if the bit is cleared otherwise result is a non-0 value.

◆ sys_clear_bit()

ALWAYS_INLINE void sys_clear_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Clear the designated bit from addr to 0.

This functions takes the designated bit starting from addr and sets it to 0.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to clear (from 0 to 31)

◆ sys_clear_bits()

ALWAYS_INLINE void sys_clear_bits ( mem_addr_t addr,
unsigned int mask )
static

#include <zephyr/sys/sys_io.h>

Masking the designated bits from addr to 0.

This functions masking designated bits from addr to 0.

Parameters
addrthe memory address from where to look for the bits
maskthe bit mask of a 32 bits data to set

◆ sys_set_bit()

ALWAYS_INLINE void sys_set_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Set the designated bit from addr to 1.

This functions takes the designated bit starting from addr and sets it to 1.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to set (from 0 to 31)

◆ sys_set_bits()

ALWAYS_INLINE void sys_set_bits ( mem_addr_t addr,
unsigned int mask )
static

#include <zephyr/sys/sys_io.h>

Masking the designated bits from addr to 1.

This functions masking designated bits from addr to 1.

Parameters
addrthe memory address from where to look for the bits
maskthe bit mask of a 32 bits data to set

◆ sys_test_and_clear_bit()

ALWAYS_INLINE int sys_test_and_clear_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Test the bit and clear it.

This functions takes the designated bit starting from addr, test its current setting and clears it. It will return the previous setting.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to test and clear (from 0 to 31)
Returns
the bitwise AND result of addr content and (1 << bit) before target bit is cleared. Result is 0 only if the bit was cleared otherwise result is a non-0 value.

◆ sys_test_and_set_bit()

ALWAYS_INLINE int sys_test_and_set_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Test the bit and set it.

This functions takes the designated bit starting from addr, tests its current setting and sets it. It will return the previous setting.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to test and set (from 0 to 31)
Returns
the bitwise AND result of addr content and (1 << bit) before target bit is set. Result is 0 only if the bit was cleared otherwise result is a non-0 value.

◆ sys_test_bit()

ALWAYS_INLINE int sys_test_bit ( mem_addr_t addr,
unsigned int bit )
static

#include <zephyr/sys/sys_io.h>

Test the bit if it is set or not.

This functions takes the designated bit starting from addr and tests its current setting. It will return the current setting.

Parameters
addrthe memory address from where to look for the bit
bitthe designated bit to test (from 0 to 31)
Returns
the bitwise AND result of addr content and (1 << bit). Result is 0 only if the bit is cleared otherwise result is a non-0 value.