BUS - Bitfield Read/Write

Description

BUS register and RAM bit/field read/write API.

API to perform bit-band and field set/clear access to RAM and peripherals.

Functions

void BUS_RamBitWrite (volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a 32-bit word in RAM.
unsigned int BUS_RamBitRead (volatile const uint32_t *addr, unsigned int bit)
Perform a single-bit read operation on a 32-bit word in RAM.
void BUS_RegBitWrite (volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.
unsigned int BUS_RegBitRead (volatile const uint32_t *addr, unsigned int bit)
Perform a single-bit read operation on a peripheral register.
void BUS_RegMaskedSet (volatile uint32_t *addr, uint32_t mask)
Perform a masked set operation on a peripheral register address.
void BUS_RegMaskedClear (volatile uint32_t *addr, uint32_t mask)
Perform a masked clear operation on the peripheral register address.
void BUS_RegMaskedWrite (volatile uint32_t *addr, uint32_t mask, uint32_t val)
Perform peripheral register masked write.
uint32_t BUS_RegMaskedRead (volatile const uint32_t *addr, uint32_t mask)
Perform a peripheral register masked read.

Function Documentation

BUS_RamBitWrite()

void BUS_RamBitWrite ( volatile uint32_t * addr,
unsigned int bit,
unsigned int val
)
inline

Perform a single-bit write operation on a 32-bit word in RAM.

This function uses Cortex-M bit-banding hardware to perform an atomic read-modify-write operation on a single bit write on a 32-bit word in RAM. See the reference manual for more details about bit-banding.

Note
This function is atomic on Cortex-M cores with bit-banding support. Bit- banding is a multicycle read-modify-write bus operation. RAM bit-banding is performed using the memory alias region at BITBAND_RAM_BASE.
Parameters
[in] addr An ddress of a 32-bit word in RAM.
[in] bit A bit position to write, 0-31.
[in] val A value to set bit to, 0 or 1.

BUS_RamBitRead()

unsigned int BUS_RamBitRead ( volatile const uint32_t * addr,
unsigned int bit
)
inline

Perform a single-bit read operation on a 32-bit word in RAM.

This function uses Cortex-M bit-banding hardware to perform an atomic read operation on a single register bit. See the reference manual for more details about bit-banding.

Note
This function is atomic on Cortex-M cores with bit-banding support. RAM bit-banding is performed using the memory alias region at BITBAND_RAM_BASE.
Parameters
[in] addr RAM address.
[in] bit A bit position to read, 0-31.
Returns
The requested bit shifted to bit position 0 in the return value.

BUS_RegBitWrite()

void BUS_RegBitWrite ( volatile uint32_t * addr,
unsigned int bit,
unsigned int val
)
inline

Perform a single-bit write operation on a peripheral register.

This function uses Cortex-M bit-banding hardware to perform an atomic read-modify-write operation on a single register bit. See the reference manual for more details about bit-banding.

Note
This function is atomic on Cortex-M cores with bit-banding support. Bit- banding is a multicycle read-modify-write bus operation. Peripheral register bit-banding is performed using the memory alias region at BITBAND_PER_BASE.
Parameters
[in] addr A peripheral register address.
[in] bit A bit position to write, 0-31.
[in] val