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

LoggingFlags

uint64_t

Flags for logging info

Name

*char

Object name

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

GPDIR

uint32_t

GPICR

uint32_t

GPIER

uint32_t

GPIMR

uint32_t

GPODR

uint32_t

LoggingFlags

uint64_t

Flags for logging info

Name

*char

Object name

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

ResetIface

ResetIface

SignalIface

SignalIface

Incomming signals

Commands

Name Description

delete

Dispose instance of GPIO

Limitations

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