distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
STM32-bit-banding.h File Reference

Header with definitions for bit-banding for STM32. More...

#include "distortos/architecture/ARMv7-M-bit-banding.h"
#include <stddef.h>
Include dependency graph for STM32-bit-banding.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STM32_BITBAND_IMPLEMENTATION(base, type, member, mask)   BITBAND_PERIPHERAL_ADDRESS(base + offsetof(type, member), __builtin_ctzl(mask))
 implementation of STM32_BITBAND_ADDRESS() and STM32_BITBAND() More...
 
#define STM32_BITBAND_ADDRESS(registerr, member, bit)
 address of bit-band alias for peripheral region, alternate form for struct member and bitmask More...
 
#define STM32_BITBAND(registerr, member, bit)
 bit-band alias in peripheral region, alternate form for struct member and bitmask More...
 
#define STM32_BITBAND_FLASH_ADDRESS(member, bit)   STM32_BITBAND_IMPLEMENTATION(FLASH_R_BASE, FLASH_TypeDef, member, FLASH_ ## member ## _ ## bit)
 address of bit-band alias for FLASH registers, alternate form for struct member and bitmask More...
 
#define STM32_BITBAND_FLASH(member, bit)
 bit-band alias for FLASH registers, alternate form for struct member and bitmask More...
 

Detailed Description

Header with definitions for bit-banding for STM32.

Author
Copyright (C) 2017-2019 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
License
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Macro Definition Documentation

◆ STM32_BITBAND

#define STM32_BITBAND (   registerr,
  member,
  bit 
)
Value:
(*(volatile unsigned long*)STM32_BITBAND_IMPLEMENTATION(registerr ## _BASE, registerr ## _TypeDef, member, \
registerr ## _ ## member ## _ ## bit))
#define STM32_BITBAND_IMPLEMENTATION(base, type, member, mask)
implementation of STM32_BITBAND_ADDRESS() and STM32_BITBAND()
Definition: STM32-bit-banding.h:36

bit-band alias in peripheral region, alternate form for struct member and bitmask

Warning
This macro must not be used for FLASH registers! Use STM32_BITBAND_FLASH() instead
Parameters
[in]registerris the name of object with peripheral registers, e.g. RCC, GPIOA, USART1, ...
[in]memberis the name of member of registerr, e.g. BDCR (for RCC), ODR (for GPIOA), CR1 (for USART1), ...
[in]bitis the name of bit in member, e.g. RTCEN (in RCC->BDCR), ODR0 (in GPIOA->ODR), TXEIE (in USART1->CR1), ...
Returns
reference to bit-band alias of bit in registerr->member

◆ STM32_BITBAND_ADDRESS

#define STM32_BITBAND_ADDRESS (   registerr,
  member,
  bit 
)
Value:
STM32_BITBAND_IMPLEMENTATION(registerr ## _BASE, registerr ## _TypeDef, member, \
registerr ## _ ## member ## _ ## bit)
#define STM32_BITBAND_IMPLEMENTATION(base, type, member, mask)
implementation of STM32_BITBAND_ADDRESS() and STM32_BITBAND()
Definition: STM32-bit-banding.h:36

address of bit-band alias for peripheral region, alternate form for struct member and bitmask

Warning
This macro must not be used for FLASH registers! Use STM32_BITBAND_FLASH_ADDRESS() instead
Parameters
[in]registerris the name of object with peripheral registers, e.g. RCC, GPIOA, USART1, ...
[in]memberis the name of member of registerr, e.g. BDCR (for RCC), ODR (for GPIOA), CR1 (for USART1), ...
[in]bitis the name of bit in member, e.g. RTCEN (in RCC->BDCR), ODR0 (in GPIOA->ODR), TXEIE (in USART1->CR1), ...
Returns
address of bit-band alias of bit in registerr->member

◆ STM32_BITBAND_FLASH

#define STM32_BITBAND_FLASH (   member,
  bit 
)
Value:
(*(volatile unsigned long*)STM32_BITBAND_IMPLEMENTATION(FLASH_R_BASE, FLASH_TypeDef, member, \
FLASH_ ## member ## _ ## bit))
#define STM32_BITBAND_IMPLEMENTATION(base, type, member, mask)
implementation of STM32_BITBAND_ADDRESS() and STM32_BITBAND()
Definition: STM32-bit-banding.h:36

bit-band alias for FLASH registers, alternate form for struct member and bitmask

Parameters
[in]memberis the name of member of FLASH, e.g. SR, CR, ...
[in]bitis the name of bit in member, e.g. BSY (in FLASH->SR), LOCK (in FLASH->CR), ...
Returns
reference to bit-band alias of bit in FLASH->member

◆ STM32_BITBAND_FLASH_ADDRESS

#define STM32_BITBAND_FLASH_ADDRESS (   member,
  bit 
)    STM32_BITBAND_IMPLEMENTATION(FLASH_R_BASE, FLASH_TypeDef, member, FLASH_ ## member ## _ ## bit)

address of bit-band alias for FLASH registers, alternate form for struct member and bitmask

Parameters
[in]memberis the name of member of FLASH, e.g. SR, CR, ...
[in]bitis the name of bit in member, e.g. BSY (in FLASH->SR), LOCK (in FLASH->CR), ...
Returns
address of bit-band alias of bit in FLASH->member

◆ STM32_BITBAND_IMPLEMENTATION

#define STM32_BITBAND_IMPLEMENTATION (   base,
  type,
  member,
  mask 
)    BITBAND_PERIPHERAL_ADDRESS(base + offsetof(type, member), __builtin_ctzl(mask))

implementation of STM32_BITBAND_ADDRESS() and STM32_BITBAND()

Parameters
[in]baseis the base address of peripheral, [bitbandPeripheralBegin; bitbandPeripheralEnd]
[in]typeis the type of struct with peripheral registers
[in]memberis the member of type struct with peripheral registers
[in]maskis the mask of bit in member
Returns
address of bit-band alias of bit described by provided arguments