GRLIB GRETH Model

The GRETH model is available in the GrEth plugin. The model needs to be combined with a MDIOBus, PHY and Ethernet model.

The GRETH model implements the behaviour of both GRETH and GRETH_GBIT.

Loading the Plugin

import BusModels
import GrEth
GRETH.new name=greth0
GenericPHY.new name=phy0
EthernetLink.new name=eth0
connect a=greth0.phy b=phy0:PHYIface
connect a=greth0.mdioBus b=phy0:MDIOIface
connect a=apbctrl0.slaves b=greth0:ApbIface
greth0.setMAC mac="00:00:00:00:00:01"
connect a=phy0.mac b=greth0:MACIface
eth0.connect device=phy0:PHYIface

Configuration

The config.gbitVariant property can be set to enable GRETH_GBIT extensions. The extensions includes:

  • Gigabit speed.

  • IP header checksum offloading.

  • TCP checksum offloading.

  • UDP checksum offloading.

  • Scatter / gather send lists.

@GRETH 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 @GRETH

new

Create new instance of GRETH

Command new Arguments

Name Type Required Description

name

string

yes

Name of object to create

GRETH Reference

Properties

Name Type Description

Class

*void

Class object

Component

*void

Pointer to component object if part of component

ETHCTR

uint32_t

Ethernet Control Register

ETHMDC

uint32_t

Ethernet MDIO Control and Status Register

ETHRDP

uint32_t

Ethernet Receiver Descriptor Pointer Register

ETHSIS

uint32_t

Ethernet Status and Interrupt Source Register

ETHTDP

uint32_t

Ethernet Transmitter Descriptor Pointer Register

LoggingFlags

uint64_t

Flags for logging info

MACLSB

uint32_t

Ethernet MAC Address LSB

MACMSB

uint32_t

Ethernet MAC Address MSB

Name

*char

Object name

TimeSource

*void

Time source object

config.checkCrc

uint8_t

Enable ethernet frame CRC checking.

config.checkIpCrc

uint8_t

Enable IP header CRC checking.

config.checkTcpCrc

uint8_t

Enable TCP header CRC checking.

config.checkUdpCrc

uint8_t

Enable UDP header CRC checking.

config.gbitVariant

uint8_t

Enable GRETH_GBIT behaviour.

config.generateCrc

uint8_t

Enable ethernet frame CRC generation.

config.irq

uint8_t

IRQ

config.logTraffic

uint8_t

Enable traffic logging

irqCtrl

temu_IfaceRef/ <unknown>

IRQ controller.

mac

*char

Set MAC by string

mdioBus

temu_IfaceRef/ <unknown>

MDIO bus.

memAccess

temu_IfaceRef/ <unknown>

Memory access (for DMA).

memory

temu_IfaceRef/ <unknown>

Memory (deprecated)

phy

temu_IfaceRef/ <unknown>

PHY device.

Interfaces

Name Type Description

ApbIface

ApbIface

APB P&P interface

DeviceIface

DeviceIface

MACIface

temu::MACIface

MAC interface

MemAccessIface

MemAccessIface

Mem access interface

ResetIface

ResetIface

Registers

Register support is currently experimental!

Register Bank registers

Register ETHCTR
Description

Ethernet Control Register

Reset value

0x00000000

Warm reset mask

0x00000000

Diagram
Field Mask Reset Description

EA

0x80000000

0x0

EDCL available

BS

0x70000000

0x0

EDCL buffer size

GA

0x08000000

0x0

Gigabit MAC

MA

0x04000000

0x0

MDIO interrupts supported

MC

0x02000000

0x0

Multicast supported

SP

0x00000080

0x0

Speed

RS

0x00000040

0x0

Reset

PM

0x00000020

0x0

Open Packet Mode

FD

0x00000010

0x0

Full Duplex

RI

0x00000008

0x0

Enable Receiver Interrupts

TI

0x00000004

0x0

Enable Transmitter Interrupts

RE

0x00000002

0x0

Receive Enable

TE

0x00000001

0x0

Transmit Enable

Register ETHMDC
Description

Ethernet MDIO Control and Status Register

Reset value

0x00000000

Warm reset mask

0x00000000

Diagram
Field Mask Reset Description

Data

0xffff0000

0x0

Data for MMI read / write

PHY_ADDR

0x0000f800

0x0

PHY address

REG_ADDR

0x000007c0

0x0

MII reg addr

NV

0x00000010

0x0

Not valid

BU

0x00000008

0x0

Busy

LF

0x00000004

0x0

Link fail

RD

0x00000002

0x0

Read

WR

0x00000001

0x0

Write

Register ETHRDP
Description

Ethernet Receiver Descriptor Pointer Register

Reset value

0x00000000

Warm reset mask

0x00000000

Diagram
Field Mask Reset Description

RXDTRA

0xfffff800

0x0

Rx desc base address

RX_DESCRIPTOR_PTR

0x000003f8

0x0

Rx desc offset

Register ETHSIS
Description

Ethernet Status and Interrupt Source Register

Reset value

0x00000000

Warm reset mask

0x00000000

Diagram
Field Mask Reset Description

IA

0x00000080

0x0

Invalid Address

TS

0x00000040

0x0

Too Small

TA

0x00000020

0x0

Transmitter AHB Error

RA

0x00000010

0x0

Receiver AHB Error

TI

0x00000008

0x0

Transmitter Interrupt

RI

0x00000004

0x0

Receiver Interrupt

TE

0x00000002

0x0

Transmitter Error

RE

0x00000001

0x0

Receiver Error

Register ETHTDP
Description

Ethernet Transmitter Descriptor Pointer Register

Reset value

0x00000000

Warm reset mask

0xfffffbf8

Diagram
Field Mask Reset Description

TXDTRA

0xfffff800

0x0

Tx desc base address

TX_DESCRIPTOR_PTR

0x000003f8

0x0

Tx desc offset

Register MACLSB
Description

Ethernet MAC Address LSB

Reset value

0x00000000

Warm reset mask

0x00000000

Diagram
Field Mask Reset Description

LSB

0xffffffff

0x0

Four LSB of MAC

Register MACMSB
Description

Ethernet MAC Address MSB

Reset value

0x00000000

Warm reset mask

0x00000000

Diagram
Field Mask Reset Description

MSB

0x0000ffff

0x0

Two MSB of MAC

Commands

Name Description

delete

Dispose instance of GRETH

sendFrame

Send frame

setMAC

Set MAC address

Command sendFrame Arguments

Name Type Required Description

mac

string

yes

MAC address of target

Command setMAC Arguments

Name Type Required Description

mac

string

yes

MAC address to set

Limitations

  • Multicast groups are not yet supported.

  • ECDL mode is not supported.