Loading...
Searching...
No Matches
Gaisler GRETH Ethernet MAC driver

Driver for the Gaisler GRETH Ethernet MAC with EDCL support. More...

Detailed Description

Driver for the Gaisler GRETH Ethernet MAC with EDCL support.

Overview

GRETH is a DMA-based Ethernet MAC from Frontgrade Gaisler, commonly found in GRLIB-based FPGA designs (LEON, NOEL-V). This driver implements the RIOT netdev interface for Ethernet.

Hardware operation

The controller uses two rings of buffer descriptors in RAM — one for TX, one for RX. Each descriptor is 8 bytes: a 32-bit control word and a 32-bit buffer address. The CPU prepares descriptors with EN=1 (owned by DMA). The DMA engine processes them and clears EN=0 when done, then raises IRQ 5.

Files

file  greth.h
 Interface definitions for the GRETH Ethernet driver.
 
file  greth_params.h
 Default configuration for the GRETH Ethernet driver.
 
file  greth_regs.h
 Register definitions for the Gaisler GRETH Ethernet MAC.
 

Data Structures

struct  greth_desc_t
 GRETH buffer descriptor (8 bytes, must be kept at natural alignment) More...
 
struct  greth_params_t
 GRETH driver parameters (board-level configuration) More...
 
struct  greth_t
 GRETH driver device descriptor. More...
 

Functions

void greth_setup (greth_t *dev, const greth_params_t *params, uint8_t index)
 Set up the GRETH device descriptor.
 

Driver configuration constants

#define CONFIG_GRETH_RX_DESC_NUM   (8U)
 Number of RX descriptors (and pre-allocated RX buffers)
 
#define CONFIG_GRETH_TX_DESC_NUM   (4U)
 Number of TX descriptors.
 
#define GRETH_MAX_FRAME_LEN   (1518U)
 Maximum Ethernet frame size (excluding FCS added by MAC)
 
#define GRETH_BUF_SIZE   (1536U)
 RX/TX buffer size — rounded up to 32-byte boundary.
 
#define GRETH_ANEG_TIMEOUT   (100000U)
 PHY auto-negotiate timeout in poll iterations.
 

Macro Definition Documentation

◆ CONFIG_GRETH_RX_DESC_NUM

#define CONFIG_GRETH_RX_DESC_NUM   (8U)

Number of RX descriptors (and pre-allocated RX buffers)

Must be a power of 2. More descriptors = better throughput at cost of RAM.

Definition at line 55 of file greth.h.

◆ CONFIG_GRETH_TX_DESC_NUM

#define CONFIG_GRETH_TX_DESC_NUM   (4U)

Number of TX descriptors.

Must be a power of 2.

Definition at line 64 of file greth.h.

◆ GRETH_ANEG_TIMEOUT

#define GRETH_ANEG_TIMEOUT   (100000U)

PHY auto-negotiate timeout in poll iterations.

Definition at line 80 of file greth.h.

◆ GRETH_BUF_SIZE

#define GRETH_BUF_SIZE   (1536U)

RX/TX buffer size — rounded up to 32-byte boundary.

Definition at line 75 of file greth.h.

◆ GRETH_MAX_FRAME_LEN

#define GRETH_MAX_FRAME_LEN   (1518U)

Maximum Ethernet frame size (excluding FCS added by MAC)

Definition at line 70 of file greth.h.

Function Documentation

◆ greth_setup()

void greth_setup ( greth_t * dev,
const greth_params_t * params,
uint8_t index )

Set up the GRETH device descriptor.

Must be called before the netdev init callback. Wires the netdev driver pointer and stores the board parameters. Does not touch hardware.

Parameters
[out]devDriver state to initialise
[in]paramsBoard-level configuration (address, IRQ, MAC)
[in]indexInstance index for netdev_register