A.8.19. CADI::CADIRegRead()

This function reads register values from the target.

virtual CADIReturn_t CADI::CADIRegRead(uint32_t regCount,
                                       CADIReg_t *reg,
                                       uint32_t *numRegsRead,
                                       uint8_t doSideEffects) = 0;
regCount

is the number of requested registers and consequently the size of the reg array.

reg

is an array of CADIReg_t structures each holding the some attributes and an array of bytes containing the contents of an individual register. The number of required bytes for each register is available from the CADIInfo_t structure. The number of registers is returned by the CADIRegGetMap() call..

numRegsRead

on return, is the number of registers actually read. If the value is less than regCount, the function returns an error code. Any value set on input is ignored.

doSideEffects

if this parameter is set to true, it informs the target that it must perform side effects on a read access. Such side effects might be, for example, a clear-on-read.

If the parameter is set to false, the target must always omit side effects. This is the common use case where a debug read of a register must not interfere with the target execution.

Note

If an error occurs, CADIRegRead() must return the error position in numRegsRead. Data is assumed valid up to this position.

The code in Example A.11 shows how to set up the CADI access functions and test reading a register value:

Example A.11. CADI register access

CADI *cadi1 = s1->getCADI(); // cadi1 is a valid CADI interface
uint32_t actual = 0;
CADIRegGroup_t regGroups [2];
cadi1->CADIRegGetGroups(0, 2, &actual, regGroups);
CADIRegInfo_t regs [2];
actual = 0;
cadi1->CADIRegGetMap(regGroups [0].groupID, 0, 2, &actual, regs);
CADIReg_t reg;
reg.regNumber = regs [1].regNumber;
actual = 0;
cadi1->CADIRegRead(1, &reg, &actual, 0);
printf("CADI reg 0x%x\n", reg.bytes [0]);

Copyright © 2014 ARM. All rights reserved.ARM DUI 0842B
Non-ConfidentialID111014