赞
踩
Cortex-M3 存储器映射有2个32MB别名区,它们被映射为两个1MB的bit-band 区:
映射公式显示如何将别名区中的字与 bit-band 区中的对应位或目标位关联,映射公式如下:
bit_word_offset = (byte_offset x 32) + (bit_number x 4)
bit_word_addr = bit_band_base + bit_word_offset
- /**
- * \brief Calculate bit band alias address.
- *
- * Calculate the bit band alias address and return a pointer address to word.
- *
- * \param addr The byte address of bitbanding bit.
- * \param bit The bit position of bitbanding bit.
- * \callergraph
- */
- #define BITBAND_ALIAS_ADDRESS(addr, bit) \
- ((volatile uint32_t*)((((uint32_t)(addr) & 0xF0000000) + 0x02000000) \
- +((((uint32_t)(addr)&0xFFFFF)*32)\
- +( (uint32_t)(bit)*4))))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。