Configuration Reference

Normative

The configuration items a conformant SPI driver MUST support (CHI-SPI-MUST-23). The configuration toolchain, data structure, and file schema are implementation-defined; vendor extensions are allowed. For a worked example see Configuration. The model follows the common configuration structure in the General part.

General
General options

Property

Type

Description

enable_development_error_reporting

bool

If true, development error checking and reporting is enabled (see Errors).

Configuration set and channels
ConfigSet

Property

Type

Description

config_set_name

str

Name of the configuration set; must be a valid C identifier.

channel

List[ControllerChannel | TargetChannel]

Per-channel configurations. Size ≥ 1; maximum is implementation-defined.

ControllerChannel

Property

Type

Description

node_type

Literal[‘Controller’]

Marks the channel as a controller.

channel_id

int

Logical channel id. Starts at 0, unique within a ConfigSet.

hw_channel

impl-defined

Hardware channel assigned to this logical channel.

event_handling_mode

EventHandlingMode

Interrupt or Polling (polled events serviced by Spi_PollFunction).

data_width

int

Bits per transfer element. Range [1, 32] (allowable range depends on HW).

bit_order

BitOrder

LSBFirst or MSBFirst.

default_data

int

Data sent when a TX buffer pointer is null. Range [0, 4294967295] (size follows data_width).

clock_divider

int

SPI hardware clock divider; derives the bitrate. Range ≥ 1 (maximum implementation-defined).

cs_ctrl

CsControl

Chip-select control: ViaHW or ViaGPIO (Spi_Callout_CsControl).

device_config

List[ControllerDeviceConfig]

External SPI devices on this channel (one per chip select). Size ≥ 1.

ControllerDeviceConfig

Property

Type

Description

cs_hw_id

int

Hardware chip-select id. Range [0, ] (typically up to 4).

cs_polarity

CsPolarity

High or Low.

data_shift_edge

DataShiftEdge

Data shift clock edge: Leading or Trailing.

shift_clock_idle_level

ShiftClockIdleLevel

High or Low.

cs_logical_id

int

Logical chip-select id used in the API csId parameter. Starts at 0, consecutive.

TargetChannel

Property

Type

Description

node_type

Literal[‘Target’]

Marks the channel as a target.

channel_id

int

Logical channel id. Starts at 0, unique within a ConfigSet.

hw_channel

impl-defined

Hardware channel assigned to this logical channel.

event_handling_mode

EventHandlingMode

Interrupt or Polling.

data_width

int

Bits per transfer element. Range [1, 32].

bit_order

BitOrder

LSBFirst or MSBFirst.

default_data

int

Data sent when no TX buffer is staged. Range [0, 4294967295] (size follows data_width).

device_config

TargetDeviceConfig

This target’s external device configuration.

TargetDeviceConfig

Property

Type

Description

cs_hw_id

int

Hardware chip-select id. Range [0, ] (typically up to 4).

cs_polarity

CsPolarity

High or Low.

data_shift_edge

DataShiftEdge

Data shift clock edge: Leading or Trailing.

shift_clock_idle_level

ShiftClockIdleLevel

High or Low.

Note

Controller channels carry clock_divider, cs_ctrl, and a list of device_config (one per chip select, each with a cs_logical_id). Target channels carry a single device_config and no cs_ctrl — the target does not drive the chip select.