P2020 GPIO Model

This section describes the P2020 GPIO device.

GPIO model simulates a 16 pin GPIO device by providing input and output via the SignalIface. Each signal can be set individually to act as input or output, according to application needs. All input ports can optionally generate an interrupt upon changing their state.

Loading the Plugin

import P2020

Configuration

Any device that implements SignalIface can be connected to GPIO and send signals via this interface to GPIO or receive them. GPIO implements 16 usable signals (signal 0 through 15). You can connect the signal interface as follows:

Connecting via Command Line
# Connect GPIO device signal 0 to device model
connect a=gpio.outSignals[0] b=mydevice:SignalIface

# Connect a device signal interface ref to GPIO device
connect a=mydevice.signal b=gpio:SignalIface[1]
Connecting via API
// Connect GPIO device signal 0 to device model
temu_connect(gpio, "outSignals[0]", mydevice, "SignalIface");

// Connect a device signal interface ref to GPIO device
temu_connect(mydevice, "signal", gpio, "SignalIface[1]");

The GPIO programmable registers that occupy memory-mapped space are named according to P2020 QorIQ integrated processor reference manual. You can set resgisters value as follows:

Setting registers via Command Line
# Set signal_0 as an output
gpio.GPDIR = 0x80000000;
Setting registers via API
// Set signal_0 as an output
temu_writeValueU32(gpio, "GPDIR", 0x80000000, 0);

@GPIO Reference

Properties

Name Type Description

Class

*void

Class object

Component

*void

Pointer to component object if part of component

LocalName

*char

Local name (in component, if applicable)

LogMessageFlags

uint64_t

Per-object log message suppression flags

LoggingFlags

uint64_t

Flags for logging info

Name

*char

Object name

ObjectID

uint64_t

Unique ObjectID.

ReplayLoggingFlags

uint64_t

Replay-time category logging flags

TimeSource

*void

Time source object

Commands

Name Description

delete

Dispose instance of @GPIO

new

Create new instance of GPIO

Command new Arguments

Name Type Required Description

name

string

yes

Name of object to create

GPIO Reference

Properties

Name Type Description

Class

*void

Class object

Component

*void

Pointer to component object if part of component

GPDAT

uint32_t

GPIO data register

GPDATColdResetValue

uint32_t

GPIO data register

GPDATForcedBits

uint32_t

GPIO data register

GPDATForcedFlippedBits

uint32_t

GPIO data register

GPDATReadMask

uint32_t

GPIO data register

GPDATResetMask

uint32_t

GPIO data register

GPDATResetValue

uint32_t

GPIO data register

GPDATWriteMask

uint32_t

GPIO data register

GPDIR

uint32_t

GPIO direction register

GPDIRColdResetValue

uint32_t

GPIO direction register

GPDIRForcedBits

uint32_t

GPIO direction register

GPDIRForcedFlippedBits

uint32_t

GPIO direction register

GPDIRReadMask

uint32_t

GPIO direction register

GPDIRResetMask

uint32_t

GPIO direction register

GPDIRResetValue

uint32_t

GPIO direction register

GPDIRWriteMask

uint32_t

GPIO direction register

GPICR

uint32_t

GPIO external interrupt control register

GPICRColdResetValue

uint32_t

GPIO external interrupt control register

GPICRForcedBits

uint32_t

GPIO external interrupt control register

GPICRForcedFlippedBits

uint32_t

GPIO external interrupt control register

GPICRReadMask

uint32_t

GPIO external interrupt control register

GPICRResetMask

uint32_t

GPIO external interrupt control register

GPICRResetValue

uint32_t

GPIO external interrupt control register

GPICRWriteMask

uint32_t

GPIO external interrupt control register

GPIER

uint32_t

GPIO interrupt event register

GPIERColdResetValue

uint32_t

GPIO interrupt event register

GPIERForcedBits

uint32_t

GPIO interrupt event register

GPIERForcedFlippedBits

uint32_t

GPIO interrupt event register

GPIERReadMask

uint32_t

GPIO interrupt event register

GPIERResetMask

uint32_t

GPIO interrupt event register

GPIERResetValue

uint32_t

GPIO interrupt event register

GPIERWriteMask

uint32_t

GPIO interrupt event register

GPIMR

uint32_t

GPIO interrupt mask register

GPIMRColdResetValue

uint32_t

GPIO interrupt mask register

GPIMRForcedBits

uint32_t

GPIO interrupt mask register

GPIMRForcedFlippedBits

uint32_t

GPIO interrupt mask register

GPIMRReadMask

uint32_t

GPIO interrupt mask register

GPIMRResetMask

uint32_t

GPIO interrupt mask register

GPIMRResetValue

uint32_t

GPIO interrupt mask register

GPIMRWriteMask

uint32_t

GPIO interrupt mask register

GPODR

uint32_t

GPIO open drain register

GPODRColdResetValue

uint32_t

GPIO open drain register

GPODRForcedBits

uint32_t

GPIO open drain register

GPODRForcedFlippedBits

uint32_t

GPIO open drain register

GPODRReadMask

uint32_t

GPIO open drain register

GPODRResetMask

uint32_t

GPIO open drain register

GPODRResetValue

uint32_t

GPIO open drain register

GPODRWriteMask

uint32_t

GPIO open drain register

LocalName

*char

Local name (in component, if applicable)

LogMessageFlags

uint64_t

Per-object log message suppression flags

LoggingFlags

uint64_t

Flags for logging info

Name

*char

Object name

ObjectID

uint64_t

Unique ObjectID.

ReplayLoggingFlags

uint64_t

Replay-time category logging flags

TimeSource

*void

Time source object

inputData

uint16_t

Input data register.

irqCtrl

temu_IfaceRef/ <unknown>

outSignals

[temu_IfaceRef; 16]/ <unknown>

outputData

uint16_t

Output data register.

Interfaces

Name Type Description

DeviceIface

DeviceIface

MemAccessIface

MemAccessIface

RegisterIface

temu::RegisterIface

Auto-generated Register Interface Impl.

ResetIface

ResetIface

SignalIface

SignalIface

Incomming signals

Registers

Register support is currently experimental!

Register Bank Regs

Register GPDIR
Description

GPIO direction register

Reset value

0x00000000

Warm reset mask

0xffff0000

Diagram
Field Mask Reset Description

DRn

0xffff0000

0x0

Direction bits for GPIO[0:n]; 0=input, 1=output

Register GPODR
Description

GPIO open drain register

Reset value

0x00000000

Warm reset mask

0xffff0000

Diagram
Field Mask Reset Description

ODn

0xffff0000

0x0

Open-drain configuration bits for GPIO[0:n]

Register GPDAT
Description

GPIO data register

Reset value

0x00000000

Warm reset mask

0xffff0000

Diagram
Field Mask Reset Description

Dn

0xffff0000

0x0

Data bits for GPIO[0:n]

Register GPIER
Description

GPIO interrupt event register

Reset value

0x00000000

Warm reset mask

0x00000000

Diagram
Field Mask Reset Description

EVn

0xffff0000

-

Interrupt event bits for GPIO[0:n]

Register GPIMR
Description

GPIO interrupt mask register

Reset value

0x00000000

Warm reset mask

0xffff0000

Diagram
Field Mask Reset Description

IMn

0xffff0000

0x0

Interrupt mask bits for GPIO[0:n]; 0=masked, 1=enabled

Register GPICR
Description

GPIO external interrupt control register

Reset value

0x00000000

Warm reset mask

0xffff0000

Diagram
Field Mask Reset Description

EDn

0xffff0000

0x0

Edge detection mode bits for GPIO[0:n]; 0=any change, 1=high-to-low

Commands

Name Description

delete

Dispose instance of GPIO

Limitations

  • Open-drain capability is not supported, GPODR is a dummy register.