4.10.1. ARMul_BusRegisterPeripFunc

A peripheral model must call this function to register the peripheral with the ARMulator. This enables ARMulator to call the model whenever it makes accesses to memory locations belonging to the peripheral.

Syntax


int ARMul_BusRegisterPeripFunc(enum BusRegAct act,                               ARMul_BusPeripAccessRegistration *breg);

where:

act

is the action you want. act must have one of the following values: insert or remove.

breg

is a structure containing information for the ARMulator. You can obtain this structure by calling ARMulif_ReadBusRange (see ARMulif_ReadBusRange).

breg is a structure of type ARMul_BusPeripAccessRegistration (see ARMul_BusPeripAccessRegistration for details).

ARMul_BusPeripAccessRegistration

This structure and type are declared in armul_bus.h, in install_directory\ARMulate\armulif. The declaration is as follows:


typedef struct ARMul_BusPeripAccessRegistration {
    ARMul_BusPeripAccessFunc *access_func;
    void *access_handle;
    uint32 capabilities; /* See PeripAccessCapability_* below */
    struct ARMul_Bus *bus;
    /* 0=> normal peripheral, earlier in list than anything it
     * overlaps with. */    
    unsigned priority;
     /* 0..100%
      * A higher number will be placed earlier in the list than
      * anything that it doesn't overlap with and has a lower access_frequency.
      */
    unsigned access_frequency;
    unsigned addr_size; /* Number of elements in range[] */
    AddressRange range[1];
} ARMul_BusPeripAccessRegistration;

where:

access_func

Pointer to the function to call for a memory access in the given address range.

access_handle

Pointer to object data for access_func.

capabilities

See PeripAccessCapability.

bus

This is returned by ARMulif_QueryBus. Do not alter it.

priority

Use this field to assign a priority to peripherals. Zero is the highest priority. If peripherals have overlapping address ranges, the highest priority peripheral is accessed first. Lower priority peripherals are only accessed if higher priority peripherals return without processing the call.

access_frequency

Use this field to inform ARMulator which peripheral you expect to be accessed more frequently. This allows ARMulator to access peripherals more efficiently. Assign the frequency as a percentage in the range 0% to 100%.

addr_size

This is for future expansion. 1 is for 32-bit addresses. This is the only address size currently supported.

range

The address range occupied by this peripheral.

PeripAccessCapability

This parameter defines the capabilities of the peripheral. It is the sum of the values of the individual capabilities (see Table 4.6).

For example:

  • A value of 0x20020 means that the peripheral can handle word data accesses, but not bytes, halfwords, or double words, and understands the Endian signal. This value is predefined as PeripAccessCapability_Minimum.

  • A value of 0x20038 means that the peripheral can handle byte, halfword, and word data accesses, but not doubleword, and understands the Endian signal. This value is predefined as PeripAccessCapability_Typical.

Table 4.6. Peripheral access capabilities

CapabilityPredefined nameValue
BytePeripAccessCapability_Byte0x8
Half wordPeripAccessCapability_HWord0x10
WordPeripAccessCapability_Word0x20
Double wordPeripAccessCapability_DWord0x40
Peripheral accepts idle cyclesPeripAccessCapability_Idles0x10000 (unsigned long)
Peripheral understands Endian signalPeripAccessCapability_Endian0x20000 (unsigned long)
Peripheral understands bytelanesPeripAccessCapability_Bytelane0x40000 (unsigned long)
Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI0058D
Non-Confidential