4.3.2 Reading a resource

The semantics of reading a resource are peek rather than architectural read. All instance implementations should aim for side-effect free reads, which are a prerequisite for non-intrusive debug, although it might not always be possible.

Undefined bits

This interface can indicate which bits in which registers have an undefined value. It is optional for instances to support this.

Approximate values

It is not always possible to return the exact value of a resource. For example, this is the case when the instance that exposes the resource is not in a debuggable state. The resource_read() function supports reporting approximate values.

Read errors

The resource_read() function does not fail with an error for existing targets and resources. Read errors are indicated in the error member of ResourceReadResult, for each resource.

Examples

resource_read() returns one ResourceReadResult object, which contains the read result of all resources read, comprising values and errors. Numeric resource values and string resource values are split into two different arrays. Numeric resource values occupy one or more NumberU64 values in the array, depending on their width. For example:

  • Reading 3 32-bit resources with the values 1, 2, and 0xf00daaaa respectively:
    ResourceReadResult.data = [1, 2, 0xf00daaaa]
  • Reading one 8-bit, one 64-bit, and one 32-bit resource, with values 1, 2, and 3 respectively:
    ResourceReadResult.data = [1, 2, 3]
  • Reading one 132-bit wide resource which has the value 0x9_ffeeddcc_bbaa9988_77665544_33221100:
    ResourceReadResult.data = [0x7766554433221100, 0xffeeddccbbaa9988, 9]
  • Reading a string resource containing the string "abc":
    ResourceReadResult.data = [] 
    ResourceReadResult.strings = ["abc"]
  • Reading a 32-bit resource with value 1, a string resource with value "abc", and a 32-bit resource with value 3:

    ResourceReadResult.data = [1, 3]
    ResourceReadResult.strings = ["abc"]

    Note:

    The following resource_read() operations give the same result as this example:

    • Reading a string resource with value "abc", a 32-bit resource with value 1, and a 32-bit resource with value 3.
    • Reading a 32-bit resource with value 1, a 32-bit resource with value 3, and a string resource with value "abc".
  • Reading a 32-bit resource with value 1, a noValue resource, and a 32-bit resource with value 3:
     ResourceReadResult.data = [1, 3] 
Non-ConfidentialPDF file icon PDF version101196_0100_00_en
Copyright © 2018 Arm Limited or its affiliates. All rights reserved.