历史上的今天
今天是:2025年01月06日(星期一)
2020年01月06日 | ARM Memory Copy
2020-01-06 来源:eefocus
1 MODULE ARM_MEMORY
2
3 PUBLIC ARM_MEMCPY
4 PUBLIC ARM_MEMSET
5 PUBLIC ARM_MEMSET8
6 PUBLIC ARM_MEMSET16
7 PUBLIC ARM_MEMSET32
8
9 SECTION .text:CODE:NOROOT(2)
10 CODE32
11
12 ;-------------------------------------------------------------------------------
13 ; void ARM_MEMCPY(void* pDest, void* pSrc, U32 NumBytes)
14 ;
15 ; Function description
16 ; Copy data in memory from source address to destination address.
17 ;
18 ; Register usage:
19 ;
20 ; R0 pDest
21 ; R1 pSrc
22 ; R2 NumBytes
23 ;
24 ; R3 Used for data transfers
25 ; R4 Used for data transfers
26 ; R12 Used for data transfers
27 ; R14 Used for data transfers
28 ;
29 ; R13 SP
30 ; R14 LR (contains return address)
31 ; R15 PC
32 ;
33 ;-------------------------------------------------------------------------------
34 ARM_MEMCPY:
35 ;-------------------------------------------------------------------------------
36 cmp R2, #+3 ; R2 = NumBytes
37 bls ARM_MEMCPY_HandleTrailingBytes ; If we have less than one complete word, use single byte transfer
38
39 ands R12, R0, #+3 ; R0 = destination address
40 beq ARM_MEMCPY_DestIsDWordAligned ; Is destination address already word aligned ?
41
42 ;-------------------------------------------------------------------------------
43 ; Handle as much bytes as necessary to align destination address
44 ;
45 ldrb R3, [R1], #+1 ; We need at least one byte to the next word alignment, so we read one.
46 cmp R12, #+2 ; Set condition codes according to the mis-alignment
47 add R2, R2, R12 ; Adjust NumBytes : 1, 2, 3
48 ldrbls R12, [R1], #+1 ; Lower or same (LS)? -> We need one or two bytes to the next word aligned address
49 strb R3, [R0], #+1
50 ldrbcc R3, [R1], #+1 ; Carry clear (CC)? -> We need one more byte
51 strbls R12, [R0], #+1
52 sub R2, R2, #+4 ; Adjust NumBytes
53 strbcc R3, [R0], #+1 ; now destination address already is word aligned
54
55 ;-------------------------------------------------------------------------------
56 ; Choose best way to transfer data
57 ;
58 ARM_MEMCPY_DestIsDWordAligned:
59 ands R3, R1, #+3
60 beq ARM_MEMCPY_HandleBulkWordData ; If source and destination are aligned, use bulk word transfer
61
62 subs R2, R2, #+4
63 bcc ARM_MEMCPY_HandleTrailingBytes ; If we have less than one complete word left, use single byte transfer
64
65 ldr R12, [R1, -R3]! ; Read first mis-aligned data word and word align source address
66 cmp R3, #+2
67 beq ARM_MEMCPY_Loop16BitShift
68
69 bhi ARM_MEMCPY_Loop24BitShift
70
71 ;-------------------------------------------------------------------------------
72 ; Handle data in units of word
73 ;
74 ; This is done by reading mis-aligned words from source address and
75 ; shift them into the right alignment. After this the next data word
76 ; will be read to complete the missing data part.
77 ;
78 ARM_MEMCPY_Loop8BitShift:
79 mov R3, R12, LSR #+8 ; Shift data word into right position
80 ldr R12, [R1, #+4]! ; Load next mis-aligned data word
81 subs R2, R2, #+4 ; Decrement NumBytes
82 orr R3, R3, R12, LSL #+24 ; Combine missing part of data to build full data word
83 str R3, [R0], #+4 ; Store complete word
84 bcs ARM_MEMCPY_Loop8BitShift
85
86 add R1, R1, #+1 ; Adjust source address
87 b ARM_MEMCPY_HandleTrailingBytes ; Handle trailing bytes
88
89 ARM_MEMCPY_Loop16BitShift:
90 mov R3, R12, LSR #+16 ; Shift data word into right position
91 ldr R12, [R1, #+4]! ; Load next mis-aligned data word
92 subs R2, R2, #+4 ; Decrement NumBytes
93 orr R3, R3, R12, LSL #+16 ; Combine missing part of data to build full data word
94 str R3, [R0], #+4 ; Store complete word
95 bcs ARM_MEMCPY_Loop16BitShift
96
97 add R1, R1, #+2 ; Adjust source address
98 b ARM_MEMCPY_HandleTrailingBytes ; Handle trailing bytes
99
100 ARM_MEMCPY_Loop24BitShift:
101 mov R3, R12, LSR #+24 ; Shift data word into right position
102 ldr R12, [R1, #+4]! ; Load next mis-aligned data word
103 subs R2, R2, #+4 ; Decrement NumBytes
104 orr R3, R3, R12, LSL #+8 ; Combine missing part of data to build full data word
105 str R3, [R0], #+4 ; Store complete word
106 bcs ARM_MEMCPY_Loop24BitShift
107
108 add R1, R1, #+3 ; Adjust source address
109 b ARM_MEMCPY_HandleTrailingBytes ; Handle trailing bytes
110
111 ;-------------------------------------------------------------------------------
史海拾趣
|
电源技术对电子变压器的要求,像所有作为商品的产品一样,是在具体使用条件下完成具体的功能中追求性能价格比最好。有时可能偏重价格和成本,有时可能偏重效率和性能。现在,轻、薄、短、小成为电子变压器的发展方向,是强调降低成本。从总的要求出 ...… 查看全部问答> |
|
菜鸟才接触89c51,写的如下代码,但是中断不响应,我在INT0输入的是方波信号,还有这块是16位寻址哈 也就是unsigned int 型最大值是65536哈,我想是让int0为高电平时,计数器开始计数,当int0下一个高电平到来 之后计数器重新计数,一直这样循环 ...… 查看全部问答> |
|
招聘要求: 岗位:嵌入式设计工程师 1, 统招大学本科电子,仪器仪表,机电,电信等相关专业 2, 熟悉8位,32位单片机系统软硬件设计 3, 熟悉模拟,数字电路及各种工具软件使用 4, 具有团队精神,具备良好的学习能 ...… 查看全部问答> |
|
我用的单片机是F149,在程序中发现有只用一次的屏幕显示函数被调用多次,请大家给分析一下,我自己认为是TimerA引起的。 我的这段程序是单片机C语言,在运行时发现屏幕显示函数被多次调用,实际我只用了一次。大家给点意思看看是哪里的问题。我自 ...… 查看全部问答> |
|
下面这个框图是UC2843芯片的内部框图,现在想请教的是反馈电压、反馈电流和输出占空比的计算公式,手册上都没有介绍这个计算关系到底是什么样子的。谢谢!… 查看全部问答> |
|
本设计要求作出一种多路模拟信号采集模块,从多个通道轮流采集数据一次,并将数据保存于记录。本系统采用AT89C52作为控制系统,核心器件采用TI公司的高精度12BIT ,11通道一步采样AD芯片TLC2543。分别从11路采样模拟信号,实现11路数据采集。为了做 ...… 查看全部问答> |
|
晒WEBENCH设计的过程+Arria系列10AT090电源驱动电路设计 需求:输入,14到22V 输出: # Name VLoad ILoad Description 1. LOAD #1 3.3 V 0.5 A VoutRipple=10% 2. LOAD #2 5 V 0.5 A VoutRipple=10% 3. VCC 0.9 V 41.304 A VoutRipple=10% 4. VCCA_PLL 1.8 V ...… 查看全部问答> |
|
【瑞萨R7F0C80212试用】一步一步玩R7F0C80212之第二弹 上电初实验 根据第一弹的描述,相信大家对于板子的所有套件以及板子的布局已经了如指掌了,既然已经开始拿到板子了,我们就开始来上电试试有什么效果吧。。 开发板 ...… 查看全部问答> |




