EFM32 Leopard Gecko Software Documentation  efm32lg-doc-4.2.1

BUS RAM and register bit/field read/write API

. More...

Functions

__STATIC_INLINE 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. More...
 
__STATIC_INLINE 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. More...
 
__STATIC_INLINE void BUS_RegBitWrite (volatile uint32_t *addr, unsigned int bit, unsigned int val)
 Perform a single-bit write operation on a peripheral register. More...
 
__STATIC_INLINE unsigned int BUS_RegBitRead (volatile const uint32_t *addr, unsigned int bit)
 Perform a single-bit read operation on a peripheral register. More...
 
__STATIC_INLINE void BUS_RegMaskedSet (volatile uint32_t *addr, uint32_t mask)
 Perform a masked set operation on peripheral register address. More...
 
__STATIC_INLINE void BUS_RegMaskedClear (volatile uint32_t *addr, uint32_t mask)
 Perform a masked clear operation on peripheral register address. More...
 
__STATIC_INLINE void BUS_RegMaskedWrite (volatile uint32_t *addr, uint32_t mask, uint32_t val)
 Perform peripheral register masked clear and value write. More...
 
__STATIC_INLINE uint32_t BUS_RegMaskedRead (volatile const uint32_t *addr, uint32_t mask)
 Perform a peripheral register masked read. More...
 

Detailed Description

Function Documentation

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

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. Please refer to the reference manual for further 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]addrAddress of 32-bit word in RAM
[in]bitBit position to write, 0-31
[in]valValue to set bit to, 0 or 1

Definition at line 73 of file em_bus.h.

References BITBAND_RAM_BASE, and SRAM_BASE.

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

This function uses Cortex-M bit-banding hardware to perform an atomic read operation on a single register bit. Please refer to the reference manual for further 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]addrRAM address
[in]bitBit position to read, 0-31
Returns
The requested bit shifted to bit position 0 in the return value

Definition at line 112 of file em_bus.h.

References BITBAND_RAM_BASE, and SRAM_BASE.

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

This function uses Cortex-M bit-banding hardware to perform an atomic read-modify-write operation on a single register bit. Please refer to the reference manual for further 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]addrPeripheral register address
[in]bitBit position to write, 0-31
[in]valValue to set bit to, 0 or 1

Definition at line 146 of file em_bus.h.

References BITBAND_PER_BASE, and PER_MEM_BASE.

Referenced by ACMP_CapsenseInit(), ACMP_Init(), ADC_InitScan(), ADC_InitSingle(), BURTC_CounterReset(), BURTC_Enable(), BURTC_FreezeEnable(), BURTC_Powerdown(), BURTC_Reset(), CMU_CalibrateCont(), CMU_ClockDivSet(), CMU_ClockEnable(), CMU_ClockSelectSet(), CMU_PCNTClockExternalSet(), DAC_Enable(), DAC_Init(), DMA_CfgChannel(), EBI_AltMapEnable(), EBI_BankAddressTimingConfig(), EBI_BankByteLaneEnable(), EBI_BankEnable(), EBI_BankPolaritySet(), EBI_BankReadTimingConfig(), EBI_BankWriteTimingConfig(), EBI_ChipSelectEnable(), EBI_Init(), EBI_PolaritySet(), EMU_BUPDInit(), EMU_BUPinEnable(), EMU_EM2Block(), EMU_EM2UnBlock(), EMU_EM4Lock(), GPIO_DbgSWDClkEnable(), GPIO_DbgSWDIOEnable(), GPIO_DbgSWOEnable(), GPIO_IntConfig(), GPIO_PinOutClear(), GPIO_PinOutSet(), I2C_Enable(), I2C_Init(), LCD_SegmentSet(), LESENSE_AltExConfig(), LESENSE_ChannelConfig(), LESENSE_ChannelEnable(), MSC_EnableAutoCacheFlush(), MSC_EnableCache(), MSC_EnableCacheIRQs(), PCNT_CounterReset(), PCNT_Init(), PCNT_PRSInputEnable(), PCNT_Reset(), RMU_ResetCauseClear(), RMU_ResetControl(), RTC_Enable(), WDOG_Enable(), WDOG_Init(), and WDOG_Lock().

__STATIC_INLINE unsigned int BUS_RegBitRead ( volatile const uint32_t *  addr,
unsigned int  bit 
)

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

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

Definition at line 185 of file em_bus.h.

References BITBAND_PER_BASE, and PER_MEM_BASE.

Referenced by BURTC_Reset(), CMU_Calibrate(), CMU_CalibrateCountGet(), CMU_OscillatorEnable(), CMU_OscillatorTuningSet(), GPIO_PinInGet(), and GPIO_PinOutGet().

__STATIC_INLINE void BUS_RegMaskedSet ( volatile uint32_t *  addr,
uint32_t  mask 
)

Peripheral register masked set provides a single-cycle and atomic set operation of a bit-mask in a peripheral register. All 1's in the mask are set to 1 in the register. All 0's in the mask are not changed in the register. RAMs and special peripherals are not supported. Please refer to the reference manual for further details about peripheral register field set.

Note
This function is single-cycle and atomic on cores with peripheral bit set and clear support. It uses the memory alias region at PER_BITSET_MEM_BASE.
Parameters
[in]addrPeripheral register address
[in]maskMask to set

Definition at line 219 of file em_bus.h.

References PER_MEM_BASE.

Referenced by BUS_RegMaskedWrite(), and GPIO_PortOutSet().

__STATIC_INLINE void BUS_RegMaskedClear ( volatile uint32_t *  addr,
uint32_t  mask 
)

Peripheral register masked clear provides a single-cycle and atomic clear operation of a bit-mask in a peripheral register. All 1's in the mask are set to 0 in the register. All 0's in the mask are not changed in the register. RAMs and special peripherals are not supported. Please refer to the reference manual for further details about peripheral register field clear.

Note
This function is single-cycle and atomic on cores with peripheral bit set and clear support. It uses the memory alias region at PER_BITCLR_MEM_BASE.
Parameters
[in]addrPeripheral register address
[in]maskMask to clear

Definition at line 251 of file em_bus.h.

References PER_MEM_BASE.

Referenced by BUS_RegMaskedWrite(), and GPIO_PortOutClear().

__STATIC_INLINE void BUS_RegMaskedWrite ( volatile uint32_t *  addr,
uint32_t  mask,
uint32_t  val 
)

This function first clears the mask in the peripheral register, then writes the value. Typically the mask is a bit-field in the register, and the value val is within the mask.

Note
This operation is not atomic. Note that the mask is first set to 0 before the val is set.
Parameters
[in]addrPeripheral register address
[in]maskPeripheral register mask
[in]valPeripheral register value. The value must be shifted to the correct bit position in the register.

Definition at line 283 of file em_bus.h.

References BUS_RegMaskedClear(), and BUS_RegMaskedSet().

Referenced by ACMP_CapsenseChannelSet(), ACMP_GPIOSetup(), ADC_Init(), GPIO_IntConfig(), GPIO_PinModeSet(), I2C_BusFreqSet(), and USART_BaudrateSyncSet().

__STATIC_INLINE uint32_t BUS_RegMaskedRead ( volatile const uint32_t *  addr,
uint32_t  mask 
)

Read an unshifted and masked value from a peripheral register.

Note
This operation is not hardware accelerated.
Parameters
[in]addrPeripheral register address
[in]maskPeripheral register mask
Returns
Unshifted and masked register value

Definition at line 313 of file em_bus.h.

Referenced by CMU_OscillatorEnable().