5.6 Resources API

A resource is either a parameter or a register. Parameters allow you to parameterize an instance, either at startup, these are called init-time parameters, or at run-time. Registers represent a piece of state of an instance that can be read and might be modifiable.

Clients first query a list of the available resources of an instance by calling resource_getList().

In the Resources API, each resource is uniquely identified by an opaque resource id. The resource_read() and resource_write() functions accept lists of resource ids to allow efficient reading and writing of multiple resources.

Clients typically inspect the meta information of the ResourceInfo objects returned by resource_getList() and extract the resource ids of the resources they are interested in. These are the ResourceInfo fields that are typically used to discover or filter resources:

If present, the resource is a register.
If present, the resource is a parameter.
For registers, this is the architectural name.
This field is usually set for core CPU registers, for instance DWARF register numbers, see 5.6.7 ElfDwarf scheme for canonical register numbers.
tags.isPc and other tags
These tags allow clients to understand the semantics of the most important registers found in CPU cores, for example PC, stack pointer, instruction counter.

To access resources by name or by canonicalRn, clients typically build maps from names to resource ids or from canonicalRns to resource ids, because the resource_read() and resource_write() functions only accept resource ids.

Clients can also query resource groups by calling resource_getListOfResourceGroups(). This function returns lists of resource ids that are suitable for reading or writing all resources of a group.

Target instances can expose zero or more resources. Target instances that expose no resources must either return E_function_not_supported_by_instance for all resource_*() functions or resource_getList() must return an empty list.

State that consists of smaller chunks that can be addressed and accessed in a uniform way should be represented as memory or a table instead of resources, see 5.7 Memory API and 5.9 Tables API.

$PVLIB_HOME/Iris/Examples/Client/Register/ contains an example client application that demonstrates how to use this API.

This section contains the following subsections:
Non-ConfidentialPDF file icon PDF version101196_0100_03_en
Copyright © 2018, 2019 Arm Limited or its affiliates. All rights reserved.