09.12.2012 Views

Cortex-A8 Technical Reference Manual - ARM Information Center

Cortex-A8 Technical Reference Manual - ARM Information Center

Cortex-A8 Technical Reference Manual - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Debug<br />

Example 12-21 Reading a word of memory<br />

uint32 ReadWord(uint32 address, bool &aborted)<br />

{<br />

// Step 1. Save the value of r0.<br />

saved_r0 := ReadRegister(0);<br />

// Step 2. Write the address to r0.<br />

WriteRegister(0, address);<br />

// Step 3. Execute instruction STC p14, c5, [r0] through the ITR.<br />

Execute<strong>ARM</strong>Instruction(0xED905E00);<br />

// Step 4. Read the value from the DTR directly.<br />

datum := ReadDCC();<br />

// Step 5. Restore the corrupted register r0.<br />

WriteRegister(0, saved_r0);<br />

// Step 6. Check the DSCR for a sticky abort.<br />

aborted := CheckForAborts();<br />

return datum;<br />

}<br />

Fast register read/write<br />

When multiple registers must be read in succession, you can optimize the process by placing the<br />

DCC into stall mode and by writing the value 1 to the DCC access mode bits. For more<br />

information, see CP14 c1, Debug Status and Control Register on page 12-15.<br />

Example 12-22 shows the sequence to change the DTR access mode.<br />

SetDTRAccessMode(int mode)<br />

{<br />

// Step 1. Write the mode value to DSCR[21:20].<br />

dscr := ReadDebugRegister(34);<br />

dscr := (dscr & ~(0x3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!