Header with definitions for bit-banding for STM32.
More...
Go to the source code of this file.
|
#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...
|
|
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/.
◆ STM32_BITBAND
#define STM32_BITBAND |
( |
|
registerr, |
|
|
|
member, |
|
|
|
bit |
|
) |
| |
Value: 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] | registerr | is the name of object with peripheral registers, e.g. RCC , GPIOA , USART1 , ... |
[in] | member | is the name of member of registerr, e.g. BDCR (for RCC ), ODR (for GPIOA ), CR1 (for USART1 ), ... |
[in] | bit | is 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: 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] | registerr | is the name of object with peripheral registers, e.g. RCC , GPIOA , USART1 , ... |
[in] | member | is the name of member of registerr, e.g. BDCR (for RCC ), ODR (for GPIOA ), CR1 (for USART1 ), ... |
[in] | bit | is 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: 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] | member | is the name of member of FLASH , e.g. SR , CR , ... |
[in] | bit | is 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] | member | is the name of member of FLASH , e.g. SR , CR , ... |
[in] | bit | is 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] | base | is the base address of peripheral, [bitbandPeripheralBegin; bitbandPeripheralEnd] |
[in] | type | is the type of struct with peripheral registers |
[in] | member | is the member of type struct with peripheral registers |
[in] | mask | is the mask of bit in member |
- Returns
- address of bit-band alias of bit described by provided arguments