关于cortex-M3/M4中Bit-banding的笔记

关于cortex-M3/M4中Bit-banding的笔记Bit-bandingBit-bandingmapsacompletewordofmemoryontoasinglebitinthebit-bandregion.Forexample,writingtooneofthealiaswordswillsetorclearthecorrespondingbitinthebitbandre

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

Bit-banding

Bit-banding maps a complete word of memoryonto a single bit in the bit-band region. For example, writing to one of thealias words will set or clear the corresponding bit in the bitband region.

This allows every individual bit in thebit-banding region to be directly accessible from a word-aligned address usinga single LDR instruction. It also allows individual bits to be toggled from Cwithout performing a read-modify-write sequence of instructions.

Address translation

The Cortex-M3 has two 32MB regions that maponto the two 1MB bit-band regions. The two regions are separate, one in theSRAM region and one in the peripheral region.

Each bit in the bit-band region is addressedsequentially in the 32MB alias region. For example, the eighth bit in thebit-band region can be accessed using the eighth word in the 32MB alias region.

Reading and writing to the bit-bandingregion

When writing to the alias regions bit 0 ofthe 32 bit word is used to set the value at the bit-banding region. Readingfrom the alias address will return the value from the bit-band region in bit 0and the other bits will be cleared.

You can also access the base bit-bandregion itself in the same way as normal memory, using word, half word, and byteaccesses.

 关于cortex-M3/M4中Bit-banding的笔记

The internal SRAM of the Stellaris® devicesis located at address 0x2000.0000 of the device memory
map. To reduce the number of time consuming read-modify-write (RMW) operations,ARM has
introduced bit-banding technology in the Cortex-M3 processor. With abit-band-enabled processor,
certain regions in the memory map (SRAM and peripheral space) can use addressaliases to access
individual bits in a single, atomic operation. The bit-band base is located ataddress 0x2200.0000.

 

The bit-band alias is calculated by usingthe formula:
bit-band alias = bit-band base + (byte offset * 32) + (bit number * 4)
For example, if bit 3 at address 0x2000.1000 is to be modified, the bit-bandalias is calculated as:
0x2200.0000 + (0x1000 * 32) + (3 * 4) = 0x2202.000C
With the alias address calculated, an instruction performing a read/write toaddress 0x2202.000C
allows direct access to only bit 3 of the byte at address 0x2000.1000.

 

//Hw_types.h   以Bit-banding方式访问双字寄存器x中的第b位

#define HWREGBITW(x, b)         \

       HWREG(((unsigned long)(x) & 0xF0000000) | 0x02000000 | \

              (((unsigned long)(x) &0x000FFFFF) << 5) | ((b) << 2))

 

#define HWREG(x)                                          \

       (*((volatile unsigned long *)(x)))

 

Example:

 

ulValue = 1234;

for(ulIdx = 0; ulIdx < 32; ulIdx++)

{

//set every bitof ulValue(word) to 1

         HWREGBITW(&ulValue,31 – ulIdx) = (0xFFFFFFFF >> (31-ulIdx)) & 1;

         UARTprintf(“\r%08x”,ulValue);

         Delay(1);

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/182482.html原文链接:https://javaforall.net

(0)
上一篇 2022年10月13日 下午12:00
下一篇 2022年10月13日 下午12:00


相关推荐

  • 通达OA工作流-表单设计

    通达OA工作流-表单设计第1章什么是工作流 1.1工作流的用途 随着企业管理信息化进程的不断深入,协同应用软件的概念已深入人心,而工作流系统正是协同应用软件的核心。通过应用IT技术来规范工作流程、提高工作的执行效率和准确度、使企业运营更加高效、规范、稳健,是工作流系统主要解决的问题。OfficeAnywhere内置的工作流系统,适用于各行各业,实现企业各类业务的申请、审批…

    2022年6月23日
    43
  • js生成二维码,扫码实现跳转_如何把一个链接生成二维码

    js生成二维码,扫码实现跳转_如何把一个链接生成二维码<!DOCTYPEhtmlPUBLIC”-//W3C//DTDXHTML1.0Transitional//EN””http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”><htmlxmlns=”http://www.w3.org/1999/xhtml”xml:lang=”ko”lang=”ko”&gt…

    2022年10月17日
    4
  • Pandas 创建DataFrame提示:type object ‘object‘ has no attribute ‘dtype‘

    Pandas 创建DataFrame提示:type object ‘object‘ has no attribute ‘dtype‘pandas版本0.25.3importpandasaspdsymbol_info_columns=[‘1′,’持仓方向’,’持仓量’,’持仓收益率’,’持仓收益’,’持仓均价’,’当前价格’,’最大杠杆’]#v3symbol_config={‘BTC’:’BTC-USDT-210924′,’LTC’:’LTC-USDT-210924′,’EOS’:’EOS-USDT-210924′,’ETH’:’ETH-USDT-210924′,’XRP’:’

    2022年5月11日
    116
  • mysql mvvc 简单理解

    mysql mvvc 简单理解先说下我自己的理解 总结为图如下 MVCC 的全称是 多版本并发控制 这项技术使得 InnoDB 的事务隔离级别下执行一致性读操作有了保证 换言之 就是为了查询一些正在被另一个事务更新的行 并且可以看到它们被更新之前的值 这是一个可以用来增强并发性的强大的技术 因为这样的一来的话查询就不用等待另一个事务释放锁 这项技术在数据库领域并不是普遍使用的 一些其它的数据库产品 以及 mysql 其它的存储

    2026年3月18日
    3
  • C#中File和FileStream的用法

    C#中File和FileStream的用法在近期的工作过程中发现自己的基础比较薄弱,所以最近在恶补基础知识。下面就对我所学习的File类和FileStream进行简单的总结。1.首先先介绍File类和FileStream文件流1.1File类,是一个静态类,支持对文件的基本操作,包括创建,拷贝,移动,删除和打开一个文件。File类方法的参量很多时候都是路径path。主要提供有关文件的各种操作,在使用时需要引用System.IO命名…

    2022年7月24日
    22
  • Midjourney开发者必看:MJ V7接口API Key获取及使用全攻略

    Midjourney开发者必看:MJ V7接口API Key获取及使用全攻略

    2026年3月15日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号