login|Register
Forum > Other languages
Post|
看10677|回10|Favorite
rpidmx512 看全部
2018-6-15 19:20:29
Edited by rpidmx512 at 2018-6-15 12:23

Example for how to read the 64-bit counter

code:

  1. .macro FUNC name
  2. .text
  3. .code 32
  4. .global \name
  5. \name:
  6. .endm

  7. FUNC h3_read_cnt64
  8.         mov        r2, #0x1e00
  9.         mov r0, #2
  10.         movt r2, #0x1f0
  11.         str r0, [r2,#0x80]
  12. 1:
  13.         ldr r3, [r2,#0x80]
  14.         tst r3, #2
  15.         bne 1b
  16.         ldrd r0,r1,[r2,#0x84]
  17.         bx lr
ImmortanJoe 看全部
2018-6-30 14:12:12

quote:

dmx512 replied at 2018-6-27 00:58
What is this code used for ?

It's used for reading the 64 bit counter.

I was using the memory mapped register method for a system timer until I realised that just using the coprocessor interface for it was far simpler.
That single line I provided reads the 64 bit counter via the coprocessor interface instead of the memory mapped interface. That's all. It grabs the whole 64 bits at once and puts them into two registers. My example uses a1 and a2, or if you like R0 and R1. Same thing. I believe they cn be any general purpose registers though.


ImmortanJoe 看全部
2018-6-23 09:45:36
Edited by ImmortanJoe at 2018-6-23 09:48

    MRRC   p15, 0, a1, a2, c14

copypasted from my code. a1 is low word. a2 is high word.
e:This is for the H3. It'd probably be similar on other SoCs.
dmx512 看全部
2018-6-27 00:58:46

code:

  1. MRRC   p15, 0, a1, a2, c14

What is this code used for ?
ImmortanJoe 看全部
2018-7-1 10:51:28
Edited by ImmortanJoe at 2018-7-1 10:59

Besides the H3 datasheet, the following documents are extremely useful regarding working with the H3:

* ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition
* Cortex -A7 MPCore Technical Reference Manual
* CoreLink GIC-400 Generic Interrupt Controller Technical Reference Manual
* Allwinner DE2.0 Specification
* Enhanced Host Controller Interface Specification for Universal Serial Bus
* i.MX 6Dual/6Quad Applications Processor Reference Manual (for the graphics hardware)
e: Forgot to say before the MPCore TRM is where a lot of useful things are like coprocessor interface information. The H3 core doesn't really seem to have been altered from the A7 MPCore design in any significant way.
123NextPage

OrangePi En

Powered by Discuz! X3.4

homepage|Simple edition|Touch edition|PC