Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Block

A block helps with grouping objects in your driver and is ultimately a collection of other objects. This can be great to e.g. logically pool related registers together or to repeat them en masse.

Blocks have an address offset which is applied to all child objects. Keep the offset at 0 if you want to use the global addresses for the sub objects.

Blocks are accessed as an operation on the parent block or device it’s part of.

All objects are generated globally so child objects still need a globally unique name and are not generated in a module.

Example usage:

// MyDevice is the root block
let mut device = MyDevice::new(DeviceInterface::new());

// Foo is a block
let mut foo = device.foo();
// Access any operation defined on the block
foo.bar().dispatch()?;

// Or in one go
device.foo().bar().dispatch()?;

Example

/// doc comment line
block Example[8 stride 4] {
    address-offset: 0,
    default-access: RW,

    block node,
    register node,
    command node,
    buffer node,
    fieldset node,
    enum node,
    extern node,
}

Table

PropertyValue
Identifier namespaceAll
Supports repeatyes
Supports basetypeno
Supports conversion typeno
Supports short propertiesno
Supports propertiesyes, see below
Supports subnodesyes, see below

Long properties

These properties are specified in the node body.

address-offset

Defines the address offset of this block. All objects in the block are relative to the block. For example, a block with an address offset of 10 which has a register at address 5, will have defined the register at address 15. If this is not desired, then keep the address offset at 0.

// number
address-offset: 0

Info

  • required: yes
  • multiple allowed: no
  • supports doc comments: no

default-access

When set, all subobjects use this value as their access value (unless overridden) and don’t require an access specifier anymore

// access specifier
default-access: RW

Info

  • required: no
  • multiple allowed: no
  • supports doc comments: no

Possible subnodes

Subnodes of the following types are allowed in the node body.