1 Ethernet Driver Library

1.1 Introduction

The Ethernet Driver library for MCC Melody provides drivers for the ENC28J60 and ENCX24J600 family of controllers. It allows for quick and easy configuration and code generation for applications using SPI in polling mode.

1.2 Supported Device Families

Table 1-1. 
PIC16F PIC18F tiny AVR AVR

1.3 Required Header Files:

#include "mcc_generated_files/ethernet/physical_layer_interface.h"

1.4 Module Documentation

1.4.1 ENC28J60

This header file provides API prototypes and other data types for the ENC28J60 Ethernet Driver.

1.4.1.1 Module description

This header file provides API prototypes and other data types for the ENC28J60 Ethernet Driver.

Version: ENC28J60 Ethernet Driver Version 6.1.0
1.4.1.1.2 Definitions
  • #define ETH_NCS_HIGH() do{ETH_CS_SetHigh();} while(0)

    Sets Ethernet Chip Select to high.

  • #define ETH_NCS_LOW() do{ETH_CS_SetLow();} while(0)

    Sets Ethernet Chip Select to low.

  • #define ETH_SPI_READ8() SPI1_Host.ByteExchange(0)

    Reads the SPI byte.

  • #define ETH_SPI_WRITE8(a) SPI1_Host.ByteExchange(a)

    Writes the SPI byte.

  • #define ETH_WRITE_IN_PROGRESS (0x0001 << 0)

    Packet write in progress, not ready for transmit.

  • #define ETH_TX_QUEUED (0x0001 << 1)

    Packet complete, in queue for transmit.

  • #define ETH_ALLOCATED (0x0001 << 2)

    Flag for pool management. Set to either free or allocated.

1.4.1.1.3 Enumerations
1.4.1.1.4 Functions
1.4.1.1.5 Variables

1.4.1.2 Definition Documentation

1.4.1.2.1 ETH_ALLOCATED

#define ETH_ALLOCATED (0x0001 << 2)

Flag for pool management. Set to either free or allocated.

1.4.1.2.2 ETH_NCS_HIGH

#define ETH_NCS_HIGH( ) do{ETH_CS_SetHigh();} while(0)

Sets Ethernet Chip Select to high.

1.4.1.2.3 ETH_NCS_LOW

#define ETH_NCS_LOW( ) do{ETH_CS_SetLow();} while(0)

Sets Ethernet Chip Select to low.

1.4.1.2.4 ETH_SPI_READ8

#define ETH_SPI_READ8( ) SPI1_Host.ByteExchange(0)

Reads the SPI byte.

1.4.1.2.5 ETH_SPI_WRITE8

#define ETH_SPI_WRITE8( a) SPI1_Host.ByteExchange(a)

Writes the SPI byte.

1.4.1.2.6 ETH_TX_QUEUED

#define ETH_TX_QUEUED (0x0001 << 1)

Packet complete, in queue for transmit.

1.4.1.2.7 ETH_WRITE_IN_PROGRESS

#define ETH_WRITE_IN_PROGRESS (0x0001 << 0)

Packet write in progress, not ready for transmit.

1.4.1.3 Function Documentation

1.4.1.3.1 ENC28_BankSel()

static void ENC28_BankSel (enc28j60_registers_t r)[static]

Selects the bank.

Parameters:
r

register

Returns:

None.

1.4.1.3.2 ENC28_Bfc()

static void ENC28_Bfc (enc28j60_registers_t a, char bits)[static]

Clears the SFR bit field.

Parameters:
a

register

bits
Returns:

None.

1.4.1.3.3 ENC28_Bfs()

static void ENC28_Bfs (enc28j60_registers_t a, char bits)[static]

Sets the SFR bit field.

Parameters:
a

register

bits
Returns:

None.

1.4.1.3.4 ENC28_PhyRead()

static uint16_t ENC28_PhyRead (enc28j60_phy_registers_t a)[static]

Reads the Physical Layer (PHY) register.

Parameters:
a

register

Returns:

Register data.

1.4.1.3.5 ENC28_PhyWrite()

static void ENC28_PhyWrite (enc28j60_phy_registers_t a, uint16_t d)[static]

Writes the PHY register.

Parameters:
a

register

d

data

Returns:

None.

1.4.1.3.6 ENC28_Rcr16()

static uint16_t ENC28_Rcr16 (enc28j60_registers_t a)[static]

Reads two bytes from SFRs.

Parameters:
a

register

Returns:

Two bytes of SFR value.

1.4.1.3.7 ENC28_Rcr8()

static uint8_t ENC28_Rcr8 (enc28j60_registers_t a)[static]

Reads one byte from Special Function Register (SFR).

Parameters:
a

register

Returns:

One byte of SFR value.

1.4.1.3.8 ENC28_Wcr16()

static void ENC28_Wcr16 (enc28j60_registers_t a, uint16_t v)[static]

Writes two bytes to SFRs.

Parameters:
a

register

v

16-bit value

Returns:

None.

1.4.1.3.9 ENC28_Wcr8()

static void ENC28_Wcr8 (enc28j60_registers_t a, uint8_t v)[static]

Writes one byte to SFRs.

Parameters:
a

register

v

8-bit value

Returns:

None.

1.4.1.3.10 ETH_CloseSPI()

static void ETH_CloseSPI (void )[static]

Releases the Serial Peripheral Interface (SPI) bus.

Parameters:
None.
Returns:

None.

1.4.1.3.11 ETH_ComputeChecksum()

static uint16_t ETH_ComputeChecksum (uint16_t len, uint16_t seed)[static]

Calculates the checksum.

Parameters:
len

length

seed
Returns:

Checksum.

1.4.1.3.12 ETH_NewPacket()

txPacket_t * ETH_NewPacket (void )

Allocates a new packet element and links it to the chained list.

Parameters:
None.
Returns:

Packet address.

1.4.1.3.13 ETH_OpenSPI()

static void ETH_OpenSPI (void )[static]

Connects the SPI bus.

Parameters:
None.
Returns:

None.

1.4.1.3.14 ETH_PacketListReset()

void ETH_PacketListReset (void )

Resets the Ethernet packet list.

Parameters:
None.
Returns:

None.

1.4.1.3.15 ETH_RemovePacket()

void ETH_RemovePacket (txPacket_t * pPacket)

Deallocates a packet element and unlinks it from the chained list.

Parameters:
pPacket

packetHandle

Returns:

None.

1.4.1.3.16 ETH_SendQueued()

phy_error_msg ETH_SendQueued (void )

Enqueues the latest written packet and starts the transmission of a queued packet.

Parameters:
None.
Return values:
PHY_SUCCESS
PHY_BUFFER_BUSY
1.4.1.3.17 ETH_Shift_Tx_Packets()

phy_error_msg ETH_Shift_Tx_Packets (void )

Copies the queued packets to the TX Buffer start address using the DMA setup.

Parameters:
None.
Return values:
PHY_SUCCESS
PHY_DMA_TIMEOUT

1.4.1.4 Enumeration Type Documentation

1.4.1.4.1 enc28j60_phy_registers_t

enum enc28j60_phy_registers_t

ENC28J60 PHY register addresses.

J60_PHCON1

PHY Control Register 1

J60_PHSTAT1

Physical Layer Status Register 1

J60_PHID1

PHY Identifier

J60_PHID2

PHY Identifier, P/N, and Revision

J60_PHCON2

PHY Control Register 2

J60_PHSTAT2

Physical Layer Status Register 2

J60_PHIE

PHY Interrupt Enable Register

J60_PHIR

PHY Interrupt Request Register

J60_PHLCON

PHY Module LED Control Register

1.4.1.4.2 enc28j60_registers_t

enum enc28j60_registers_t

ENC28J60 registers.

J60_ERDPTL

Bank 0: Read Pointer Low Byte

J60_ERDPTH

Bank 0: Read Pointer High Byte

J60_EWRPTL

Bank 0: Write Pointer Low Byte

J60_EWRPTH

Bank 0: Write Pointer High Byte

J60_ETXSTL

Bank 0: TX Start Low Byte

J60_ETXSTH

Bank 0: TX Start High Byte

J60_ETXNDL

Bank 0: TX End Low Byte

J60_ETXNDH

Bank 0: TX End High Byte

J60_ERXSTL

Bank 0: RX Start Low Byte

J60_ERXSTH

Bank 0: RX Start High Byte

J60_ERXNDL

Bank 0: RX End Low Byte

J60_ERXNDH

Bank 0: RX End High Byte

J60_ERXRDPTL

Bank 0: RX RD Pointer Low Byte

J60_ERXRDPTH

Bank 0: RX RD Pointer High Byte

J60_ERXWRPTL

Bank 0: RX WR Pointer Low Byte

J60_ERXWRPTH

Bank 0: RX WR Pointer High Byte

J60_EDMASTL

Bank 0: DMA Start Low Byte

J60_EDMASTH

Bank 0: DMA Start High Byte

J60_EDMANDL

Bank 0: DMA End Low Byte

J60_EDMANDH

Bank 0: DMA End High Byte

J60_EDMADSTL

Bank 0: DMA Destination Low Byte

J60_EDMADSTH

Bank 0: DMA Destination High Byte

J60_EDMACSL

Bank 0: DMA Checksum Low Byte

J60_EDMACSH

Bank 0: DMA Checksum High Byte

RSRV_018

Bank 0: Reserved

RSRV_019

Bank 0: Reserved

RSRV_01A

Bank 0: Reserved

J60_EHT0

Bank 1: Hash Table Byte 0

J60_EHT1

Bank 1: Hash Table Byte 1

J60_EHT2

Bank 1: Hash Table Byte 2

J60_EHT3

Bank 1: Hash Table Byte 3

J60_EHT4

Bank 1: Hash Table Byte 4

J60_EHT5

Bank 1: Hash Table Byte 5

J60_EHT6

Bank 1: Hash Table Byte 6

J60_EHT7

Bank 1: Hash Table Byte 7

J60_EPMM0

Bank 1: Pattern Match Mask Byte 0

J60_EPMM1

Bank 1: Pattern Match Mask Byte 1

J60_EPMM2

Bank 1: Pattern Match Mask Byte 2

J60_EPMM3

Bank 1: Pattern Match Mask Byte 3

J60_EPMM4

Bank 1: Pattern Match Mask Byte 4

J60_EPMM5

Bank 1: Pattern Match Mask Byte 5

J60_EPMM6

Bank 1: Pattern Match Mask Byte 6

J60_EPMM7

Bank 1: Pattern Match Mask Byte 7

J60_EPMCSL

Bank 1: Pattern Match Checksum Low Byte

J60_EPMCSH

Bank 1: Pattern Match Checksum High Byte

RSRV_112

Bank 1: Reserved

RSRV_113

Bank 1: Reserved

J60_EPMOL

Bank 1: Pattern Match Offset Low Byte

J60_EPMOH

Bank 1: Pattern Match Offset High Byte

RSRV_116

Bank 1: Reserved

RSRV_117

Bank 1: Reserved

J60_ERXFCON

Bank 1: Ethernet Receive Filter Control Register

J60_EPKTCNT

Bank 1: Ethernet Packet Count

RSRV_11A

Bank 1: Reserved

J60_MACON1

Bank 2: MAC Control Register 1

RSRV_201

Bank 2: Reserved

J60_MACON3

Bank 2: MAC Control Register 3

J60_MACON4

Bank 2: MAC Control Register 4

J60_MABBIPG

Bank 2: Back-to-Back Inter-Packet Gap

RSRV_205

Bank 2: Reserved

J60_MAIPGL

Bank 2: Non-Back-to-Back Inter-Packet Gap Low Byte

J60_MAIPGH

Bank 2: Non-Back-to-Back Inter-Packet Gap High Byte

J60_MACLCON1

Bank 2: Retransmission Maximum

J60_MACLCON2

Bank 2: Collision Window

J60_MAMXFLL

Bank 2: Maximum Frame Length Low Byte

J60_MAMXFLH

Bank 2: Maximum Frame Length High Byte

RSRV_20C

Bank 2: Reserved

RSRV_20D

Bank 2: Reserved

RSRV_20E

Bank 2: Reserved

RSRV_20F

Bank 2: Reserved

RSRV_210

Bank 2: Reserved

RSRV_211

Bank 2: Reserved

J60_MICMD

Bank 2: MII Command Register

RSRV_213

Bank 2: Reserved

J60_MIREGADR

Bank 2: MII Register Address

RSRV_215

Bank 2: Reserved

J60_MIWRL

Bank 2: MII Write Data Low Byte

J60_MIWRH

Bank 2: MII Write Data High Byte

J60_MIRDL

Bank 2: MII Read Data Low Byte

J60_MIRDH

Bank 2: MII Read Data High Byte

RSRV_21A

Bank 2: Reserved

J60_MAADR5

Bank 3: MAC Address Byte 5

J60_MAADR6

Bank 3: MAC Address Byte 6

J60_MAADR3

Bank 3: MAC Address Byte 3

J60_MAADR4

Bank 3: MAC Address Byte 4

J60_MAADR1

Bank 3: MAC Address Byte 1

J60_MAADR2

Bank 3: MAC Address Byte 2

J60_EBSTSD

Bank 3: Built-in Self-Test Fill Seed

J60_EBSTCON

Bank 3: Ethernet Self-Test Control Register

J60_EBSTCSL

Bank 3: Built-in Self-Test Checksum Low Byte

J60_EBSTCSH

Bank 3: Built-in Self-Test Checksum High Byte

J60_MISTAT

Bank 3: MII Status Register

RSRV_30B

Bank 3: Reserved

RSRV_30C

Bank 3: Reserved

RSRV_30D

Bank 3: Reserved

RSRV_30E

Bank 3: Reserved

RSRV_30F

Bank 3: Reserved

RSRV_310

Bank 3: Reserved

RSRV_311

Bank 3: Reserved

J60_EREVID

Bank 3: Ethernet Revision ID

RSRV_313

Bank 3: Reserved

RSRV_314

Bank 3: Reserved

J60_ECOCON

Bank 3: Clock Output Control Register

RSRV_316

Bank 3: Reserved

J60_EFLOCON

Bank 3: Ethernet Flow Control Register

J60_EPAUSL

Bank 3: Pause Timer Value Low Byte

J60_EPAUSH

Bank 3: Pause Timer Value High Byte

RSRV_31A

Bank 3: Reserved

J60_EIE

Common Bank Registers: Ethernet Interrupt Enable Register

J60_EIR

Common Bank Registers: Ethernet Interrupt Request (Flag) Register

J60_ESTAT

Common Bank Registers: Ethernet Status Register

J60_ECON2

Common Bank Registers: Ethernet Control Register 2

J60_ECON1

Common Bank Registers: Ethernet Control Register 1

1.4.1.4.3 sfr_bank_t

enum sfr_bank_t

SFR banks.

Special Function Register (SFR) Banks.

sfr_bank0

Bank 0

sfr_bank1

Bank 1

sfr_bank2

Bank 2

sfr_bank3

Bank 3

sfr_common

Common Set of Registers (last five locations of each bank)

sfr_bank0

Bank 0

sfr_bank1

Bank 1

sfr_bank2

Bank 2

sfr_bank3

Bank 3

sfr_common

Common Set of Registers (last five locations of each bank)

1.4.1.4.4 spi_inst_t

enum spi_inst_t

SPI instructions.

rcr_inst

Read Control Register

rbm_inst

Read Buffer Memory

wcr_inst

Write Control Register

wbm_inst

Write Buffer Memory

bfs_inst

Bit Field Set

bfc_inst

Bit Field Clear

src_inst

System Reset Command (Soft Reset)

1.4.1.5 Variable Documentation

1.4.1.5.1 Control_Byte

Control_Byte

ENC28J60 Control Byte.

1.4.2 ENCX24J600

This file provides register definitions for the ENCx24J600 controller.

1.4.2.1 Module description

This file provides register definitions for the ENCx24J600 controller.

Version: ENCx24J600 Driver Version 6.1.0
1.4.2.1.2 Definitions
  • #define ETH_WRITE_IN_PROGRESS (0x0001 << 0)

    Packet write in progress, not ready for transmit.

  • #define ETH_TX_QUEUED (0x0001 << 1)

    Packet in queue for transmit.

  • #define ETH_ALLOCATED (0x0001 << 2)

    Flag for pool management. Set to either free or allocated.

  • #define ETH_NCS_HIGH() do{ETH_CS_SetHigh();} while(0)

    Sets Ethernet Chip Select to high.

  • #define ETH_NCS_LOW() do{ETH_CS_SetLow();} while(0)

    Sets Ethernet Chip Select to low.

  • #define ETH_READ8() SPI1_Host.ByteExchange(0)

    Reads the Serial Peripheral Interface (SPI) byte.

  • #define ETH_WRITE8(a) SPI1_Host.ByteExchange(a)

    Packet write in progress, not ready for transmit.

  • #define TXSTART 0x0000ul

    Transmit buffer start.

  • #define TXEND 0x15FFul

    Transmit buffer end.

  • #define RXSTART 0x1600ul

    Receive buffer start (must be an even memory address).

  • #define RXEND (RAMSIZE_ETH - 2)

    Receive buffer end.

  • #define PHCON1_PSLEEP 0x0800

    Bit mask for PHY Sleep Enable bit. Physical Layer (PHY) power is down.

  • #define PHCON1_PWAKE 0xF7FF

    Bit mask for PHY Wake-Up as a normal operation.

1.4.2.1.3 Enumerations
1.4.2.1.4 Functions

1.4.2.2 Definition Documentation

1.4.2.2.1 ETH_ALLOCATED

#define ETH_ALLOCATED (0x0001 << 2)

Flag for pool management. Set to either free or allocated.

1.4.2.2.2 ETH_NCS_HIGH

#define ETH_NCS_HIGH( ) do{ETH_CS_SetHigh();} while(0)

Sets Ethernet Chip Select to high.

1.4.2.2.3 ETH_NCS_LOW

#define ETH_NCS_LOW( ) do{ETH_CS_SetLow();} while(0)

Sets Ethernet Chip Select to low.

1.4.2.2.4 ETH_READ8

#define ETH_READ8( ) SPI1_Host.ByteExchange(0)

Reads the Serial Peripheral Interface (SPI) byte.

1.4.2.2.5 ETH_TX_QUEUED

#define ETH_TX_QUEUED (0x0001 << 1)

Packet in queue for transmit.

1.4.2.2.6 ETH_WRITE8

#define ETH_WRITE8( a) SPI1_Host.ByteExchange(a)

Packet write in progress, not ready for transmit.

1.4.2.2.7 ETH_WRITE_IN_PROGRESS

#define ETH_WRITE_IN_PROGRESS (0x0001 << 0)

Packet write in progress, not ready for transmit.

1.4.2.2.8 PHCON1_PSLEEP

#define PHCON1_PSLEEP 0x0800

Bit mask for PHY Sleep Enable bit. Physical Layer (PHY) power is down.

1.4.2.2.9 PHCON1_PWAKE

#define PHCON1_PWAKE 0xF7FF

Bit mask for PHY Wake-Up as a normal operation.

1.4.2.2.10 RXEND

#define RXEND (RAMSIZE_ETH - 2)

Receive buffer end.

1.4.2.2.11 RXSTART

#define RXSTART 0x1600ul

Receive buffer start (must be an even memory address).

1.4.2.2.12 TXEND

#define TXEND 0x15FFul

Transmit buffer end.

1.4.2.2.13 TXSTART

#define TXSTART 0x0000ul

Transmit buffer start.

1.4.2.3 Function Documentation

1.4.2.3.1 ENCx24_BankselSPI()

static void ENCx24_BankselSPI (encX24J600_registers_t a)[static]

Selects the SPI bank.

Parameters:
a

register

Returns:

None.

1.4.2.3.2 ENCx24_BFC()

void ENCx24_BFC (encX24J600_registers_t a, uint16_t bitMask)

Clears the SFR bit field.

Parameters:
a

register

bitMask
Returns:

None.

1.4.2.3.3 ENCx24_BFS()

void ENCx24_BFS (encX24J600_registers_t a, uint16_t bitMask)

Sets the SFR bit field.

Parameters:
a

register

bitMask
Returns:

None.

1.4.2.3.4 ENCx24_PhyRead()

uint16_t ENCx24_PhyRead (encX24J600_phy_registers_t a)

Reads the PHY register.

Parameters:
a

register

Returns:

Two bytes of data.

1.4.2.3.5 ENCx24_PHYWrite()

void ENCx24_PHYWrite (encX24J600_phy_registers_t a, uint16_t data)

Writes the PHY register.

Parameters:
a

register

data
Returns:

None.

1.4.2.3.6 ENCx24_Read()

uint16_t ENCx24_Read (encX24J600_registers_t a)

Reads from Special Function Register (SFR).

Parameters:
a

register

Returns:

Two bytes of SFR value.

1.4.2.3.7 ENCx24_Write()

void ENCx24_Write (encX24J600_registers_t a, uint16_t data)

Writes to SFRs.

Parameters:
a

register

data
Returns:

None.

1.4.2.3.8 ETH_CloseSPI()

static void ETH_CloseSPI (void )[static]

Releases the Serial Peripheral Interface (SPI) bus.

Parameters:
None.
Returns:

None.

1.4.2.3.9 ETH_DMAComputeChecksum()

static uint16_t ETH_DMAComputeChecksum (uint16_t rxPtr, uint16_t len, uint16_t seed)[static]

Calculates the checksum.

Parameters:
rxPtr

RX pointer

len

length

seed
Returns:

Checksum.

1.4.2.3.10 ETH_EdataRead()

uint8_t ETH_EdataRead (encX24J600_registers_t a)

Reads the 8-bit data from the ENCx24J600 register (work around for Errata).

Parameters:
a

register

Returns:

One byte of data.

1.4.2.3.11 ETH_MACRead8()

uint8_t ETH_MACRead8 (encX24J600_registers_t a)

Reads the 8-bit MAC-related data from ENCx24J600 registers.

Parameters:
a

register

Returns:

One byte of data.

1.4.2.3.12 ETH_MACWrite8()

void ETH_MACWrite8 (encX24J600_registers_t a, uint8_t data)

Writes the 8-bit MAC-related data to ENCx24J600 registers.

Parameters:
a

register

data
Returns:

None.

1.4.2.3.13 ETH_NewPacket()

txPacket_t* ETH_NewPacket (void )

Allocates a new packet element and links it to the chained list.

Parameters:
None.
Returns:

Packet address.

1.4.2.3.14 ETH_OpenSPI()

static void ETH_OpenSPI (void )[static]

Connects the SPI bus.

Parameters:
None.
Returns:

None.

1.4.2.3.15 ETH_PacketListReset()

void ETH_PacketListReset (void )

Resets the Ethernet packet list.

Parameters:
None.
Returns:

None.

1.4.2.3.16 ETH_readLinkStatus()

inline static uint32_t ETH_readLinkStatus (void )

Checks for the link status.

Parameters:
None.
Return values:
PHY_SUCCESS

link found

PHY_LINK_NOT_FOUND

link is not present

1.4.2.3.17 ETH_RemovePacket()

void ETH_RemovePacket (txPacket_t * pPacket)

Deallocates a packet element and unlinks it from the chained list.

Parameters:
*pPacket

packetHandle

Returns:

None.

1.4.2.3.18 ETH_SendQueued()

phy_error_msg ETH_SendQueued (void )

Enqueues the latest written packet and starts the transmission of a queued packet.

Parameters:
None.
Return values:
PHY_SUCCESS
PHY_BUFFER_BUSY
1.4.2.3.19 ETH_Set_TXRTS()

void ETH_Set_TXRTS (void )

Packet transmission request.

Parameters:
None.
Returns:

None.

1.4.2.3.20 ETH_SetPktDec()

void ETH_SetPktDec (void )

Decrements packet count.

Parameters:
None.
Returns:

None.

1.4.2.3.21 ETH_SetRXptr()

void ETH_SetRXptr (uint16_t address)

RX packet read pointer.

Parameters:
address
Returns:

None.

1.4.2.3.22 ETH_Shift_Tx_Packets()

phy_error_msg ETH_Shift_Tx_Packets (void )

Copies all the queued packets to the TX Buffer start address using the DMA setup.

Parameters:
None.
Return values:
PHY_SUCCESS
PHY_DMA_TIMEOUT
1.4.2.3.23 waitForDMA()

inline static void waitForDMA (void )

Waits for the DMA.

Parameters:
None.
Returns:

None.

1.4.2.4 Enumeration Type Documentation

1.4.2.4.1 encX24J600_1_byte_instructions_t

enum encX24J600_1_byte_instructions_t

SPI single byte instructions.

b0sel_inst

Bank 0 Select

b1sel_inst

Bank 1 Select

b2sel_inst

Bank 2 Select

b3sel_inst

Bank 3 Select

setethrst_inst

System Reset

fcdisable_inst

Flow Control Disable

fcsingle_inst

Flow Control Single

fcmultiple_inst

Flow Control Multiple

fcclear_inst

Flow Control Clear

setpktdec_inst

Decrement Packet Counter

dmastop_inst

DMA Stop

dmacksum_inst

DMA Start Checksum

dmacksums_inst

DMA Start Checksum with Seed

dmacopy_inst

DMA Start Copy

dmacopys_inst

DMA Start Copy and Checksum with Seed

settxrts_inst

Request Packet Transmission

enablerx_inst

Enable RX

disablerx_inst

Disable RX

seteie_inst

Enable Interrupts

clreie_inst

Disable Interrupts

1.4.2.4.2 encX24J600_2_byte_instructions_t

enum encX24J600_2_byte_instructions_t

SPI two byte instructions.

rbsel_inst

Read Bank Select

1.4.2.4.3 encX24J600_3_byte_instructions_t

enum encX24J600_3_byte_instructions_t

SPI three byte instructions.

rgprdpt_inst

Read EGPRDPT

rrxrdpt_inst

Read ERXRDPT

rgpwrpt_inst

Read EGPWRPT

rrxwrpt_inst

Read ERXRDPT

rudawrpt_inst

Read EUDAWRPT

wgprdpt_inst

Write EGPRDPT

wrxrdpt_inst

Write ERXRDPT

wgpwrpt_inst

Write EGPWRPT

wrxwrpt_inst

Write ERXWRPT

wudawrpt_inst

Write EUDAWRPT

1.4.2.4.4 encX24J600_N_byte_instructions_t

enum encX24J600_N_byte_instructions_t

SPI N byte instructions.

rcr_inst

Banked register read

wcr_inst

Banked register write

bfs_inst

Banked bit set

bfc_inst

Banked bit clear

rcru_inst

Unbanked SFR operation

wcru_inst

Unbanked SFR writes

bfsu_inst

Unbanked bit set

bfcu_inst

Unbanked bit clear

rgpdata_inst

SRAM data EGPDATA read

rrxdata_inst

SRAM data RXDATA read

rudadata_inst

SRAM data UDADATA read

wgpdata_inst

SRAM writes

wrxdata_inst

SRAM data write from ERXDATA

wudadata_inst

SRAM data write from EUDADATA

1.4.2.4.5 encX24J600_phy_registers_t

enum encX24J600_phy_registers_t

ENCX24J600 PHY registers.

PHCON1

PHY Control Register 1

PHSTAT1

Physical Layer Status Register 1

PHANA

PHY Auto-Negotiation Advertisement Register

PHANLPA

PHY Auto-Negotiation Link Partner Ability Register

PHANE

PHY Auto-Negotiation Expansion Register

PHCON2

PHY Control Register 2

PHSTAT2

Physical Layer Status Register 2

PHSTAT3

Physical Layer Status Register 3

1.4.2.4.6 encX24J600_registers_t

enum encX24J600_registers_t

SFR addresses for the ENCx24J600 SPI mode.

XJ600_ETXSTL

TX Start Address

XJ600_ETXLENL

TX Length

XJ600_ERXSTL

RX Buffer Start Address

XJ600_ERXTAILL

RX Tail Pointer

XJ600_ERXHEADL

RX Head Pointer

XJ600_EDMASTL

DMA Start Address

XJ600_EDMALENL

DMA Length

XJ600_EDMADSTL

DMA Destination Address

XJ600_EDMACSL

DMA Checksum

XJ600_ETXSTATL

TX Status

XJ600_ETXWIREL

Transmit Byte Count on Wire (including collision bytes)

XJ600_EHT1L

Hash Table Filter 1

XJ600_EHT2L

Hash Table Filter 2

XJ600_EHT3L

Hash Table Filter 3

XJ600_EHT4L

Hash Table Filter 4

XJ600_EPMM1L

Pattern Match Filter Mask 1

XJ600_EPMM2L

Pattern Match Filter Mask 2

XJ600_EPMM3L

Pattern Match Filter Mask 3

XJ600_EPMM4L

Pattern Match Filter Mask 4

XJ600_EPMCSL

Pattern Match Filter Checksum

XJ600_EPMOL

Pattern Match Filter Offset

XJ600_ERXFCONL

Ethernet RX Filter Control Register

XJ600_MACON1L

MAC Control Register 1

XJ600_MACON2L

MAC Control Register 2

XJ600_MABBIPGL

MAC Back-to-Back Inter-Packet Gap

XJ600_MAIPGL

MAC Inter-Packet Gap

XJ600_MACLCONL

MAC Colision Control Register

XJ600_MAMXFLL

MAC Maximum Frame Length

XJ600_MICMDL

MII Management Command

XJ600_MIREGADRL

MII Management Adresses

XJ600_MAADR3L

MAC Address Byte 5

XJ600_MAADR3H

MAC Address Byte 6

XJ600_MAADR2L

MAC Address Byte 3

XJ600_MAADR2H

MAC Address Byte 4

XJ600_MAADR1L

MAC Address Byte 1

XJ600_MAADR1H

MAC Address Byte 2

XJ600_MIWRL

MII Management Write Data

XJ600_MIRDL

MII Management Read Data

XJ600_MISTATL

MII Management Status Register

XJ600_EPAUSL

Pause Timer Value

XJ600_ECON2L

Ethernet Control Register 2

XJ600_ERXWML

Receive Watermark

XJ600_EIEL

Ethernet Interrupt Enable Register

XJ600_EIDLEDL

Ethernet ID Status/LED Control Register

XJ600_EGPDATAL

Use the SRAM Instructions

XJ600_ERXDATAL

Use the SRAM Instructions

XJ600_EUDADATAL

Use the SRAM Instructions

XJ600_EGPRDPTL

General Purpose Data Window Register

XJ600_EGPWRPTL

General Purpose Window Write Pointer

XJ600_ERXRDPTL

RX Window Read Pointer

XJ600_ERXWRPTL

RX Window Write Pointer

XJ600_EUDARDPTL

UDA Window Read Pointer

XJ600_EUDAWRPTL

UDA Window Write Pointer

XJ600_EUDASTL

User-Defined Area Start Pointer

XJ600_EUDANDL

User-Defined Area End Pointer

XJ600_ESTATL

Ethernet Status Register

XJ600_EIRL

Ethernet Interrupt Flag Register 1

XJ600_ECON1L

Ethernet Control Register 1

1.4.3 Ethernet Driver 8-Bit Interface

This file includes definitions of public interface for an Ethernet driver. See individual Ethernet drivers for specific implementations of this interface.

1.4.3.1 Module description

This file includes definitions of public interface for an Ethernet driver. See individual Ethernet drivers for specific implementations of this interface.

Version: Ethernet Driver 8-Bit Interface Version 6.0.0
1.4.3.1.3 Functions
  • void ETH_Init (void)

    Sets up the Ethernet and starts the execution. Initializes the TX/RX buffer, the MAC and the PHY.

  • void ETH_EventHandler (void)

    Manages the MAC events. Can be used for polling or for new events in Interrupt Service Routine (ISR).

  • void ETH_NextPacketUpdate (void)

    Updates the pointers for the next available RX packets. Retrieves information about the last received packet and the address of the next ones.

  • void ETH_ResetReceiver (void)

    Resets the receiver buffer.

  • void ETH_SendSystemReset (void)

    Resets the system software.

  • const mac48Address_t * MAC_getAddress (void)

    Returns the MAC address of type mac48Address_t.

  • uint16_t ETH_ReadBlock (void *buffer, uint16_t length)

    Reads a block of data from the RX buffer MAC.

  • uint8_t ETH_Read8 (void)

    Reads one byte of data from the RX buffer MAC.

  • uint16_t ETH_Read16 (void)

    Reads two bytes of data from the RX buffer and returns them in host order.

  • uint32_t ETH_Read24 (void)

    Reads three bytes of data from the RX buffer and returns them in host order.

  • uint32_t ETH_Read32 (void)

    Reads four bytes of data from the RX buffer and returns them in host order.

  • void ETH_Dump (uint16_t length)

    Drops the N bytes from a packet list when the data is lost. Clears a number of bytes (length) from the RX buffer.

  • void ETH_Flush (void)

    Drops the rest of this packet and release the buffer. Clears all bytes from the RX buffer.

  • uint16_t ETH_GetFreeTxBufferSize (void)

    Returns the available space size in the Ethernet TX buffer.

  • phy_error_msg ETH_WriteStart (const mac48Address_t *dest_mac, uint16_t type)

    Starts a packet if the Ethernet transmitter is idle.

  • uint16_t ETH_WriteString (const char *string)

    Writes a string of data into the MAC.

  • uint16_t ETH_WriteBlock (const char *data, uint16_t length)

    Writes a block of data into the TX buffer MAC.

  • void ETH_Write8 (uint8_t data)

    Writes one byte of data into the TX buffer MAC.

  • void ETH_Write16 (uint16_t data)

    Writes two bytes into the TX buffer MAC in Network order.

  • void ETH_Write24 (uint32_t data)

    Writes three bytes into the TX buffer MAC in Network order.

  • void ETH_Write32 (uint32_t data)

    Writes four bytes into the TX buffer MAC in Network order.

  • void ETH_Insert (char *data, uint16_t len, uint16_t offset)

    Inserts N data bytes into a specific offset in the TX buffer/packet.

  • phy_error_msg ETH_Copy (uint16_t len)

    Copies N bytes from the saved read location (RX buffer) into the current TX location (TX buffer) using the DMA set up. This is used for ICMP ECHO to eliminate the need to extract the arbitrary payload.

  • phy_error_msg ETH_Send (void)

    Sends the TX packet. Starts the transmission of packet or queues the packet that has been created.

  • uint16_t ETH_TxComputeChecksum (uint16_t position, uint16_t length, uint16_t seed)

    Calculates the hardware checksum of length bytes starting with the position.

  • uint16_t ETH_RxComputeChecksum (uint16_t len, uint16_t seed)

    Calculates the RX software checksum.

  • void ETH_GetMAC (uint8_t *macAddr)

    Reads the MAC address.

  • void ETH_SetMAC (uint8_t *macAddr)

    Sets the MAC address.

  • uint16_t ETH_GetWritePtr (void)

    Returns the value of the write pointer.

  • void ETH_SaveRDPT (void)

    Saves the receive pointer for copy.

  • void ETH_ResetReadPtr (void)

    Resets the receive pointer to the Init.

  • uint16_t ETH_GetReadPtr (void)

    Returns the value of the read pointer.

  • void ETH_SetReadPtr (uint16_t rdptr)

    Sets the read pointer to a specific address.

  • uint16_t ETH_GetStatusVectorByteCount (void)

    Returns the Status Vector's byte count.

  • void ETH_SetStatusVectorByteCount (uint16_t bc)

    Sets the Status Vector's byte count.

  • void ETH_ResetByteCount (void)

    Resets the driver's byte count.

  • uint16_t ETH_GetByteCount (void)

    Returns the the driver's byte count.

  • uint16_t ETH_ReadSavedWRPT (void)

    Returns the saved write pointer.

  • void ETH_SaveWRPT (void)

    Saves the write pointer for copy.

  • void ETH_SetRxByteCount (uint16_t count)

    Sets the receiver's byte count.

  • uint16_t ETH_GetRxByteCount (void)

    Returns the receiver's byte count.

  • bool ETH_CheckLinkUp (void)

    Checks for the link.

  • void ETH_TxReset (void)

    Resets the transmitter.

  • void ETH_MoveBackReadPtr (uint16_t offset)

    Moves back the read pointer.

1.4.3.2 Function Documentation

1.4.3.2.1 ETH_CheckLinkUp()

bool ETH_CheckLinkUp (void )

Checks for the link.

Parameters:
None.
Return values:
True

if the link is present.

False

if the link is not present.

1.4.3.2.2 ETH_Copy()

phy_error_msg ETH_Copy (uint16_t len)

Copies N bytes from the saved read location (RX buffer) into the current TX location (TX buffer) using the DMA set up. This is used for ICMP ECHO to eliminate the need to extract the arbitrary payload.

Parameters:
len

length

Return values:
PHY_SUCCESS
PHY_DMA_TIMEOUT
1.4.3.2.3 ETH_Dump()

void ETH_Dump (uint16_t length)

Drops the N bytes from a packet list when the data is lost. Clears a number of bytes (length) from the RX buffer.

Parameters:
length
Returns:

None.

1.4.3.2.4 ETH_EventHandler()

void ETH_EventHandler (void )

Manages the MAC events. Can be used for polling or for new events in Interrupt Service Routine (ISR).

Parameters:
None.
Returns:

None.

1.4.3.2.5 ETH_Flush()

void ETH_Flush (void )

Drops the rest of this packet and release the buffer. Clears all bytes from the RX buffer.

Parameters:
None.
Returns:

None.

1.4.3.2.6 ETH_GetByteCount()

uint16_t ETH_GetByteCount (void )

Returns the the driver's byte count.

Parameters:
None.
Returns:

Byte count.

1.4.3.2.7 ETH_GetFreeTxBufferSize()

uint16_t ETH_GetFreeTxBufferSize (void )

Returns the available space size in the Ethernet TX buffer.

Parameters:
None.
Returns:

Available space left in the TX buffer.

1.4.3.2.8 ETH_GetMAC()

void ETH_GetMAC (uint8_t * macAddr)

Reads the MAC address.

Parameters:
*macAddr
Returns:

None.

1.4.3.2.9 ETH_GetReadPtr()

uint16_t ETH_GetReadPtr (void )

Returns the value of the read pointer.

Parameters:
None.
Returns:

Pointer value.

1.4.3.2.10 ETH_GetRxByteCount()

uint16_t ETH_GetRxByteCount (void )

Returns the receiver's byte count.

Parameters:
None.
Returns:

Byte count.

1.4.3.2.11 ETH_GetStatusVectorByteCount()

uint16_t ETH_GetStatusVectorByteCount (void )

Returns the Status Vector's byte count.

Parameters:
None.
Returns:

Byte count.

1.4.3.2.12 ETH_GetWritePtr()

uint16_t ETH_GetWritePtr (void )

Returns the value of the write pointer.

Parameters:
None.
Returns:

Pointer value.

1.4.3.2.13 ETH_Init()

void ETH_Init (void )

Sets up the Ethernet and starts the execution. Initializes the TX/RX buffer, the MAC and the PHY.

Parameters:
None.
Returns:

None.

1.4.3.2.14 ETH_Insert()

void ETH_Insert (char * data, uint16_t len, uint16_t offset)

Inserts N data bytes into a specific offset in the TX buffer/packet.

Parameters:
*data
len

length

offset
Returns:

None.

1.4.3.2.15 ETH_MoveBackReadPtr()

void ETH_MoveBackReadPtr (uint16_t offset)

Moves back the read pointer.

Parameters:
offset
Returns:

None.

1.4.3.2.16 ETH_NextPacketUpdate()

void ETH_NextPacketUpdate (void )

Updates the pointers for the next available RX packets. Retrieves information about the last received packet and the address of the next ones.

Parameters:
None.
Returns:

None.

1.4.3.2.17 ETH_Read16()

uint16_t ETH_Read16 (void )

Reads two bytes of data from the RX buffer and returns them in host order.

Parameters:
None.
Returns:

Two bytes of data.

1.4.3.2.18 ETH_Read24()

uint32_t ETH_Read24 (void )

Reads three bytes of data from the RX buffer and returns them in host order.

Parameters:
None.
Returns:

Three bytes of data.

1.4.3.2.19 ETH_Read32()

uint32_t ETH_Read32 (void )

Reads four bytes of data from the RX buffer and returns them in host order.

Parameters:
None.
Returns:

Four bytes of data.

1.4.3.2.20 ETH_Read8()

uint8_t ETH_Read8 (void )

Reads one byte of data from the RX buffer MAC.

Parameters:
None.
Returns:

One byte of data.

1.4.3.2.21 ETH_ReadBlock()

uint16_t ETH_ReadBlock (void * buffer, uint16_t length)

Reads a block of data from the RX buffer MAC.

Parameters:
*buffer
length
Returns:

Read count.

1.4.3.2.22 ETH_ReadSavedWRPT()

uint16_t ETH_ReadSavedWRPT (void )

Returns the saved write pointer.

Parameters:
None.
Returns:

Pointer value.

1.4.3.2.23 ETH_ResetByteCount()

void ETH_ResetByteCount (void )

Resets the driver's byte count.

Parameters:
None.
Returns:

None.

1.4.3.2.24 ETH_ResetReadPtr()

void ETH_ResetReadPtr (void )

Resets the receive pointer to the Init.

Parameters:
None.
Returns:

None.

1.4.3.2.25 ETH_ResetReceiver()

void ETH_ResetReceiver (void )

Resets the receiver buffer.

Parameters:
None.
Returns:

None.

1.4.3.2.26 ETH_RxComputeChecksum()

uint16_t ETH_RxComputeChecksum (uint16_t len, uint16_t seed)

Calculates the RX software checksum.

Parameters:
len

length

seed
Returns:

Checksum.

1.4.3.2.27 ETH_SaveRDPT()

void ETH_SaveRDPT (void )

Saves the receive pointer for copy.

Parameters:
None.
Returns:

None.

1.4.3.2.28 ETH_SaveWRPT()

void ETH_SaveWRPT (void )

Saves the write pointer for copy.

Parameters:
None.
Returns:

None.

1.4.3.2.29 ETH_Send()

phy_error_msg ETH_Send (void )

Sends the TX packet. Starts the transmission of packet or queues the packet that has been created.

Parameters:
None.
Return values:
PHY_SUCCESS
PHY_BUFFER_BUSY
PHY_LINK_NOT_FOUND
PHY_TX_QUEUED
PHY_TX_LOGIC_NOT_IDLE
1.4.3.2.30 ETH_SendSystemReset()

void ETH_SendSystemReset (void )

Resets the system software.

Parameters:
None.
Returns:

None.

1.4.3.2.31 ETH_SetMAC()

void ETH_SetMAC (uint8_t * macAddr)

Sets the MAC address.

Parameters:
*macAddr
Returns:

None.

1.4.3.2.32 ETH_SetReadPtr()

void ETH_SetReadPtr (uint16_t rdptr)

Sets the read pointer to a specific address.

Parameters:
rdptr

Read pointer

Returns:

None.

1.4.3.2.33 ETH_SetRxByteCount()

void ETH_SetRxByteCount (uint16_t count)

Sets the receiver's byte count.

Parameters:
count

byte count

Returns:

None.

1.4.3.2.34 ETH_SetStatusVectorByteCount()

void ETH_SetStatusVectorByteCount (uint16_t bc)

Sets the Status Vector's byte count.

Parameters:
bc

Byte count

Returns:

None.

1.4.3.2.35 ETH_TxComputeChecksum()

uint16_t ETH_TxComputeChecksum (uint16_t position, uint16_t length, uint16_t seed)

Calculates the hardware checksum of length bytes starting with the position.

Parameters:
position
length
seed
Returns:

Checksum.

1.4.3.2.36 ETH_TxReset()

void ETH_TxReset (void )

Resets the transmitter.

Parameters:
None.
Returns:

None.

1.4.3.2.37 ETH_Write16()

void ETH_Write16 (uint16_t data)

Writes two bytes into the TX buffer MAC in Network order.

Parameters:
data
Returns:

None.

1.4.3.2.38 ETH_Write24()

void ETH_Write24 (uint32_t data)

Writes three bytes into the TX buffer MAC in Network order.

Parameters:
data
Returns:

None.

1.4.3.2.39 ETH_Write32()

void ETH_Write32 (uint32_t data)

Writes four bytes into the TX buffer MAC in Network order.

Parameters:
data
Returns:

None.

1.4.3.2.40 ETH_Write8()

void ETH_Write8 (uint8_t data)

Writes one byte of data into the TX buffer MAC.

Parameters:
data
Returns:

None.

1.4.3.2.41 ETH_WriteBlock()

uint16_t ETH_WriteBlock (const char * data, uint16_t length)

Writes a block of data into the TX buffer MAC.

Parameters:
*data
length
Returns:

Length.

1.4.3.2.42 ETH_WriteStart()

phy_error_msg ETH_WriteStart (const mac48Address_t * dest_mac, uint16_t type)

Starts a packet if the Ethernet transmitter is idle.

Parameters:
*dest_mac
type
Return values:
PHY_SUCCESS

Packet started

PHY_BUFFER_BUSY

Buffer is busy

PHY_TX_LOGIC_NOT_IDLE

Transmitter is busy

1.4.3.2.43 ETH_WriteString()

uint16_t ETH_WriteString (const char * string)

Writes a string of data into the MAC.

Parameters:
*string
Returns:

None.

1.4.3.2.44 MAC_getAddress()

const mac48Address_t* MAC_getAddress (void )

Returns the MAC address of type mac48Address_t.

Parameters:
None.
Returns:

MAC address.

1.4.3.3 Enumeration Type Documentation

1.4.3.3.1 phy_error_msg

enum phy_error_msg

PHY status/errors.

PHY_ERROR
PHY_SUCCESS
PHY_LINK_NOT_FOUND
PHY_BUFFER_BUSY
PHY_TX_LOGIC_NOT_IDLE
PHY_TX_QUEUED
PHY_DMA_TIMEOUT

1.5 Class Documentation

1.5.1 eir_t Union Reference

ENC28J60 EIR register.

1.5.1.1 Detailed Description

ENC28J60 EIR register.

#include <enc28j60.h>

1.5.1.2 Member Data Documentation

The documentation for this union was generated from the following file:

source/

enc28j60.h

1.5.1.2.1 @1

struct { ... }

1.5.1.2.2 __pad0__

unsigned __pad0__

1.5.1.2.3 __pad1__

unsigned __pad1__

1.5.1.2.4 DMAIF

unsigned DMAIF

DMA Interrupt Flag bit

1.5.1.2.5 LINKIF

unsigned LINKIF

Link Change Interrupt Flag bit

1.5.1.2.6 PKTIF

unsigned PKTIF

Receive Packet Pending Interrupt Flag bit

1.5.1.2.7 RXERIF

unsigned RXERIF

Receive Error Interrupt Flag bit

1.5.1.2.8 TXERIF

unsigned TXERIF

Transmit Error Interrupt Flag bit

1.5.1.2.9 TXIF

unsigned TXIF

Transmit Interrupt Flag bit

1.5.1.2.10 val

char val

1.5.2 ethernetDriver_t Struct Reference

#include <physical_layer_interface.h>

1.5.2.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

physical_layer_interface.h

1.5.2.2.1 __pad0__

unsigned __pad0__

1.5.2.2.2 bufferBusy

unsigned bufferBusy

1.5.2.2.3 error

unsigned error

1.5.2.2.4 idle

unsigned idle

1.5.2.2.5 linkChange

unsigned linkChange

1.5.2.2.6 pktReady

unsigned pktReady

1.5.2.2.7 saveRDPT

uint16_t saveRDPT

1.5.2.2.8 saveWRPT

uint16_t saveWRPT

1.5.2.2.9 up

unsigned up

1.5.3 mac48Address_t Union Reference

MAC Address (48-bits).

1.5.3.1 Detailed Description

MAC Address (48-bits).

#include <physical_layer_interface.h>

1.5.3.2 Member Data Documentation

The documentation for this union was generated from the following file:

source/

physical_layer_interface.h

1.5.3.2.1 byte1

uint8_t byte1

1.5.3.2.2 byte2

uint8_t byte2

1.5.3.2.3 byte3

uint8_t byte3

1.5.3.2.4 byte4

uint8_t byte4

1.5.3.2.5 byte5

uint8_t byte5

1.5.3.2.6 byte6

uint8_t byte6

1.5.3.2.7 mac_array

uint8_t mac_array[6]

1.5.3.2.8 s

struct { ... } s

1.5.4 mac64Address_t Union Reference

MAC Address (64-bits).

1.5.4.1 Detailed Description

MAC Address (64-bits).

#include <physical_layer_interface.h>

1.5.4.2 Member Data Documentation

The documentation for this union was generated from the following file:

source/

physical_layer_interface.h

1.5.4.2.1 byte1

uint8_t byte1

1.5.4.2.2 byte2

uint8_t byte2

1.5.4.2.3 byte3

uint8_t byte3

1.5.4.2.4 byte4

uint8_t byte4

1.5.4.2.5 byte5

uint8_t byte5

1.5.4.2.6 byte6

uint8_t byte6

1.5.4.2.7 byte7

uint8_t byte7

1.5.4.2.8 byte8

uint8_t byte8

1.5.4.2.9 mac_array

uint8_t mac_array[8]

1.5.4.2.10 s

struct { ... } s

1.5.5 phstat2_t Union Reference

ENC28J60 PHSTAT2 register.

1.5.5.2 Member Data Documentation

The documentation for this union was generated from the following file:

source/

enc28j60.h

1.5.5.2.1 @3

struct { ... }

1.5.5.2.2 __pad0__

unsigned __pad0__

1.5.5.2.3 __pad1__

unsigned __pad1__

1.5.5.2.4 __pad2__

unsigned __pad2__

1.5.5.2.5 COLSTAT

unsigned COLSTAT

PHY Collision Status bit

1.5.5.2.6 DPXSTAT

unsigned DPXSTAT

PHY Duplex Status bit

1.5.5.2.7 LSTAT

unsigned LSTAT

PHY Link Status bit (non-latching)

1.5.5.2.8 PLRITY

unsigned PLRITY

Polarity Status bit

1.5.5.2.9 RXSTAT

unsigned RXSTAT

PHY Receive Status bit

1.5.5.2.10 TXSTAT

unsigned TXSTAT

PHY Transmit Status bit

1.5.5.2.11 val

unsigned int val

1.5.6 receiveStatusVector_t Union Reference

ENC28J60 receive status vector.

1.5.6.1 Detailed Description

ENC28J60 receive status vector.

Receive status vector.

#include <enc28j60.h>

1.5.6.1.1 Public Attributes

1.5.6.2 Member Data Documentation

The documentation for this union was generated from the following files:

source/

enc28j60.h

source/

encx24j600_spi.h

1.5.6.2.1 @5

struct { ... }

1.5.6.2.2 @7

struct { ... }

1.5.6.2.3 __pad0__

unsigned __pad0__

1.5.6.2.4 __pad1__

unsigned __pad1__

1.5.6.2.5 Broadcast

unsigned Broadcast

Receive Broadcast Packet

1.5.6.2.6 BroadcastMatch

unsigned BroadcastMatch

Broadcast Filter Match

1.5.6.2.7 byteCount

uint16_t byteCount

Received Byte Count

1.5.6.2.8 CarrierPreviouslySeen

unsigned CarrierPreviouslySeen

Carrier Event Previously Seen

1.5.6.2.9 CodeViolation

unsigned CodeViolation

Code Violation

1.5.6.2.10 ControlFrame

unsigned ControlFrame

Receive Control Frame

1.5.6.2.11 controlFrame

unsigned controlFrame

Receive Control Frame

1.5.6.2.12 CRCError

unsigned CRCError

CRC Error

1.5.6.2.13 crcError

unsigned crcError

CRC Error

1.5.6.2.14 DribbleNibble

unsigned DribbleNibble

Dribble Nibble

1.5.6.2.15 dribbleNibble

unsigned dribbleNibble

Dribble Nibble

1.5.6.2.16 excessCarrierEvent

unsigned excessCarrierEvent

Carrier Event Previously Seen

1.5.6.2.17 filler

unsigned filler

Not-Me Filter Match

1.5.6.2.18 HashMatch

unsigned HashMatch

Hash Filter Match

1.5.6.2.19 LengthCheckError

unsigned LengthCheckError

Length Check Error

1.5.6.2.20 lengthCheckError

unsigned lengthCheckError

Length Check Error

1.5.6.2.21 lengthLongError

unsigned lengthLongError

Length Out of Range

1.5.6.2.22 LengthOutOfRange

unsigned LengthOutOfRange

Length Out of Range

1.5.6.2.23 long_drop_event

unsigned long_drop_event

Long Event/Drop Event

1.5.6.2.24 MagicPacketMatch

unsigned MagicPacketMatch

Magic Packet(TM) Filter Match

1.5.6.2.25 Multicast

unsigned Multicast

Receive Multicast Packet

1.5.6.2.26 MulticastMatch

unsigned MulticastMatch

Multicast Filter Match

1.5.6.2.27 PatternMatch

unsigned PatternMatch

Pattern Match Filter Match

1.5.6.2.28 PauseControlFrame

unsigned PauseControlFrame

Receive Pause Control Frame

1.5.6.2.29 pauseControlFrame

unsigned pauseControlFrame

Receive Pause Control Frame

1.5.6.2.30 PreviouslyIgnored

unsigned PreviouslyIgnored

Packet Previously Ignored

1.5.6.2.31 ReceiveOk

unsigned ReceiveOk

Received Ok

1.5.6.2.32 RuntMatch

unsigned RuntMatch

Runt Filter Match

1.5.6.2.33 rxBroadcast

unsigned rxBroadcast

Receive Broadcast Packet

1.5.6.2.34 RXDCPreviouslySeen

unsigned RXDCPreviouslySeen

RXDC Previously Seen

1.5.6.2.35 rxMulticast

unsigned rxMulticast

Receive Multicast Packet

1.5.6.2.36 rxOK

unsigned rxOK

Received Ok

1.5.6.2.37 UnicastMatch

unsigned UnicastMatch

Unicast Filter Match

1.5.6.2.38 unknownContrlFrame

unsigned unknownContrlFrame

Receive Unknown Opcode

1.5.6.2.39 UnsupportedOpcode

unsigned UnsupportedOpcode

Receive Unknown Opcode

1.5.6.2.40 v

uint8_t v

1.5.6.2.41 vlanTagPresent

unsigned vlanTagPresent

Receive VLAN Type Detected

1.5.6.2.42 VLANType

unsigned VLANType

Receive VLAN Type Detected

1.5.6.2.43 Zero

unsigned char Zero

1.5.6.2.44 zero

unsigned zero

Zero

1.5.6.2.45 ZeroH

unsigned ZeroH

Zero

1.5.7 txPacket_t Struct Reference

#include <physical_layer_interface.h>

1.5.7.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

physical_layer_interface.h

1.5.7.2.1 flags

uint16_t flags

1.5.7.2.2 nextPacket

void* nextPacket

1.5.7.2.3 packetEnd

uint16_t packetEnd

1.5.7.2.4 packetStart

uint16_t packetStart

1.5.7.2.5 prevPacket

void* prevPacket

1.6 File Documentation

1.6.1 source/enc28j60.c File Reference

This file provides the Ethernet driver API implementation for the ENC28J60 device.

#include <xc.h>
#include <stdint.h>
#include <stddef.h>
#include "../enc28j60.h"
#include "../../system/system.h"
#include "../physical_layer_interface.h"
#include "../../spi/spi_interface.h"
#include "../../timer/delay.h"

1.6.1.1 Functions

1.6.1.2 Macros

1.6.1.4 Detailed Description

This file provides the Ethernet driver API implementation for the ENC28J60 device.

ENC28J60 Ethernet Driver Source File

Version: ENC28J60 Ethernet Driver Version 6.1.0

1.6.1.5 Macro Definition Documentation

1.6.1.5.1 BROADCAST_MAC

#define BROADCAST_MAC {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}

1.6.1.5.2 CheckBit

#define CheckBit( bitField, bitMask) (bool)(bitField & bitMask)

1.6.1.5.3 ClearBit

#define ClearBit( bitField, bitMask) do{ bitField = bitField & (~bitMask); } while(0)

1.6.1.5.4 MAC_ADDRESS

#define MAC_ADDRESS {0x02, 0x00, 0x00, 0x00, 0x00, 0x01}

1.6.1.5.5 MAX_TX_PACKET_SIZE

#define MAX_TX_PACKET_SIZE (1518)

1.6.1.5.6 MAX_TX_PACKETS

#define MAX_TX_PACKETS (20)

1.6.1.5.7 MIN_TX_PACKET

#define MIN_TX_PACKET (MIN_TX_PACKET_SIZE + TX_STATUS_VECTOR_SIZE)

1.6.1.5.8 MIN_TX_PACKET_SIZE

#define MIN_TX_PACKET_SIZE (64)

1.6.1.5.9 RAMSIZE_ETH

#define RAMSIZE_ETH (0x1FFF)

1.6.1.5.10 RXEND

#define RXEND (TXSTART - 2)

1.6.1.5.11 RXSTART

#define RXSTART (0)

1.6.1.5.12 SetBit

#define SetBit( bitField, bitMask) do{ bitField = bitField | bitMask; } while(0)

1.6.1.5.13 TX_BUFFER_MID

#define TX_BUFFER_MID ((TXSTART) + ((TX_BUFFER_SIZE) >> 1))

1.6.1.5.14 TX_BUFFER_SIZE

#define TX_BUFFER_SIZE ((MAX_TX_PACKET_SIZE + TX_STATUS_VECTOR_SIZE) << 1)

1.6.1.5.15 TX_STATUS_VECTOR_SIZE

#define TX_STATUS_VECTOR_SIZE (7)

1.6.1.5.16 TXEND

#define TXEND (RAMSIZE_ETH)

1.6.1.5.17 TXSTART

#define TXSTART (RAMSIZE_ETH - TX_BUFFER_SIZE)

1.6.1.6 Variable Documentation

1.6.1.6.1 broadcastMAC

const mac48Address_t broadcastMAC = {BROADCAST_MAC}

1.6.1.6.2 eth_MAC

const mac48Address_t* eth_MAC

1.6.1.6.3 ethData

volatile ethernetDriver_t ethData

1.6.1.6.4 ethListSize

uint8_t ethListSize

1.6.1.6.5 lastBank

sfr_bank_t lastBank

1.6.1.6.6 macAddress

mac48Address_t macAddress = {MAC_ADDRESS}

1.6.1.6.7 nextPacketPointer

uint16_t nextPacketPointer[static]

1.6.1.6.8 pHead

txPacket_t* pHead[static]

1.6.1.6.9 pTail

txPacket_t* pTail[static]

1.6.1.6.10 rxPacketStatusVector

receiveStatusVector_t rxPacketStatusVector[static]

1.6.1.6.11 txData

txPacket_t txData[MAX_TX_PACKETS][static]

1.6.1.6.12 TXPacketSize

uint16_t TXPacketSize

1.6.2 source/enc28j60.h File Reference

1.6.2.2 Macros

1.6.2.3 Enumerations

1.6.2.4 Variables

1.6.2.5 Detailed Description

ENC28J60 Ethernet Driver Header File

1.6.2.6 Macro Definition Documentation

1.6.2.6.1 BANK_MASK

#define BANK_MASK 0xE0

1.6.2.6.2 byteReverse24

#define byteReverse24( a) (((((uint32_t)a & (uint32_t)0x00FF00) >> 8) | (((uint32_t)a & (uint32_t)0x0000FF) << 8)) << 8 | (uint32_t)a >> 0x10)

1.6.2.6.3 byteReverse32

#define byteReverse32( a)

Value:

((((uint32_t)a & (uint32_t)0xff000000) >> 24) | \
                          (((uint32_t)a & (uint32_t)0x00ff0000) >> 8)  | \
                          (((uint32_t)a & (uint32_t)0x0000ff00) << 8)  | \
                          (((uint32_t)a & (uint32_t)0x000000ff) << 24))
1.6.2.6.4 byteSwap16

#define byteSwap16( a) ((((uint16_t)a & (uint16_t)0xFF00) >> 8) | (((uint16_t)a & (uint16_t)0x00FF) << 8))

1.6.2.6.5 convert_hton24

#define convert_hton24( a) byteReverse24(a)

1.6.2.6.6 htonl

#define htonl( a) byteReverse32(a)

1.6.2.6.7 htons

#define htons( a) byteSwap16(a)

1.6.2.6.8 ntohl

#define ntohl( a) byteReverse32(a)

1.6.2.6.9 ntohs

#define ntohs( a) byteSwap16(a)

1.6.2.6.10 SFR_BANK0

#define SFR_BANK0 0x00

1.6.2.6.11 SFR_BANK1

#define SFR_BANK1 0x40

1.6.2.6.12 SFR_BANK2

#define SFR_BANK2 0x80

1.6.2.6.13 SFR_BANK3

#define SFR_BANK3 0xC0

1.6.2.6.14 SFR_COMMON

#define SFR_COMMON 0xE0

1.6.2.6.15 SFR_MASK

#define SFR_MASK 0x1F

1.6.3 source/encx24j600_driver.c File Reference

This file provides the Ethernet driver API implementation for the ENCx24J600 family devices.

#include <xc.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "../../system/system.h"
#include "../physical_layer_interface.h"
#include "../encx24j600_spi.h"
#include "../../spi/spi_interface.h"
#include "../../timer/delay.h"

1.6.3.1 Functions

1.6.3.2 Macros

1.6.3.4 Detailed Description

This file provides the Ethernet driver API implementation for the ENCx24J600 family devices.

ENCx24J600 Ethernet Driver source file

Version: ENCx24J600 Driver Version 6.1.0

1.6.3.5 Macro Definition Documentation

1.6.3.5.1 BROADCAST_MAC

#define BROADCAST_MAC {0xff,0xff,0xff,0xff,0xff,0xff}

1.6.3.5.2 CheckBit

#define CheckBit( bitField, bitMask) (bool)(bitField & bitMask)

1.6.3.5.3 ClearBit

#define ClearBit( bitField, bitMask) do{bitField = bitField & (~bitMask); } while(0)

1.6.3.5.4 MAC_ADDRESS

#define MAC_ADDRESS {0x02, 0x00, 0x00, 0x00, 0x00, 0x01}

1.6.3.5.5 MAX_TX_PACKET_SIZE

#define MAX_TX_PACKET_SIZE (1518)

1.6.3.5.6 MAX_TX_PACKETS

#define MAX_TX_PACKETS (20)

1.6.3.5.7 MIN_TX_PACKET

#define MIN_TX_PACKET (MIN_TX_PACKET_SIZE)

1.6.3.5.8 MIN_TX_PACKET_SIZE

#define MIN_TX_PACKET_SIZE (64)

1.6.3.5.9 SetBit

#define SetBit( bitField, bitMask) do{bitField = bitField | bitMask; } while(0)

1.6.3.5.10 TX_BUFFER_MID

#define TX_BUFFER_MID ((TXSTART + TXEND) >> 1)

1.6.3.5.11 TX_BUFFER_SIZE

#define TX_BUFFER_SIZE (TXEND - TXSTART)

1.6.3.6 Variable Documentation

1.6.3.6.1 broadcastMAC

const mac48Address_t broadcastMAC = {BROADCAST_MAC}

1.6.3.6.2 ethData

volatile ethernetDriver_t ethData

1.6.3.6.3 ethListSize

uint8_t ethListSize

1.6.3.6.4 ethMAC

mac48Address_t ethMAC

1.6.3.6.5 macAddress

mac48Address_t macAddress = {MAC_ADDRESS}

1.6.3.6.6 nextPacketPointer

uint16_t nextPacketPointer[static]

1.6.3.6.7 pHead

txPacket_t* pHead[static]

1.6.3.6.8 pTail

txPacket_t* pTail[static]

1.6.3.6.9 txData

txPacket_t txData[MAX_TX_PACKETS][static]

1.6.4 source/encx24j600_spi.c File Reference

This file provides the SPI Interface Ethernet driver API implementation for the ENCx24J600 family devices.

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "../../system/system.h"
#include "../encx24j600_spi.h"
#include "../physical_layer_interface.h"

1.6.4.1 Functions

1.6.4.3 Detailed Description

This file provides the SPI Interface Ethernet driver API implementation for the ENCx24J600 family devices.

ENCx24J600 SPI Driver File

Version: ENCx24J600 Driver Version 6.1.0

1.6.4.4 Variable Documentation

1.6.4.4.1 last_bank

sfr_bank_t last_bank

1.6.4.4.2 rxPacketStatusVector

receiveStatusVector_t rxPacketStatusVector = {{0, 0, 0, 0, 0, 0}}

1.6.4.4.3 TXPacketSize

uint16_t TXPacketSize

1.6.5 source/encx24j600_spi.h File Reference

This header file provides the serial interface API for the ENCx24J600 devices.

#include "encx24j600_types.h"
#include "../system/system.h"
#include "../spi/spi_interface.h"

1.6.5.2 Functions

1.6.5.3 Macros

1.6.5.4 Enumerations

1.6.5.6 Detailed Description

This header file provides the serial interface API for the ENCx24J600 devices.

ENCx24J600 spi Header File

Version: ENCx24J600 Driver Version 6.1.0

1.6.5.7 Macro Definition Documentation

1.6.5.7.1 BANK_MASK

#define BANK_MASK 0xE0

1.6.5.7.2 byteReverse24

#define byteReverse24( a) (((((uint32_t)a & (uint32_t)0x00FF00) >> 8) | (((uint32_t)a & (uint32_t)0x0000FF) << 8)) << 8 | (uint32_t)a >> 0x10)

1.6.5.7.3 byteReverse32

#define byteReverse32( a)

Value:

((((uint32_t)a & (uint32_t)0xff000000) >> 24) | \
                          (((uint32_t)a & (uint32_t)0x00ff0000) >> 8)  | \
                          (((uint32_t)a & (uint32_t)0x0000ff00) << 8)  | \
                          (((uint32_t)a & (uint32_t)0x000000ff) << 24))
1.6.5.7.4 byteSwap16

#define byteSwap16( a) ((((uint16_t)a & (uint16_t)0xFF00) >> 8) | (((uint16_t)a & (uint16_t)0x00FF) << 8))

1.6.5.7.5 convert_hton24

#define convert_hton24( a) byteReverse24(a)

1.6.5.7.6 htonl

#define htonl( a) byteReverse32(a)

1.6.5.7.7 htons

#define htons( a) byteSwap16(a)

1.6.5.7.8 ntohl

#define ntohl( a) byteReverse32(a)

1.6.5.7.9 ntohs

#define ntohs( a) byteSwap16(a)

1.6.5.7.10 SFR_BANK0

#define SFR_BANK0 0x00

1.6.5.7.11 SFR_BANK1

#define SFR_BANK1 0x20

1.6.5.7.12 SFR_BANK2

#define SFR_BANK2 0x40

1.6.5.7.13 SFR_BANK3

#define SFR_BANK3 0x60

1.6.5.7.14 SFR_COMMON

#define SFR_COMMON 0xE0

1.6.5.7.15 SFR_MASK

#define SFR_MASK 0x1F

1.6.5.7.16 UNBANKED

#define UNBANKED 0X80

1.6.5.8 Enumeration Type Documentation

1.6.5.8.1 sfr_bank_t

enum sfr_bank_t

sfr_bank0

Bank 0

sfr_bank1

Bank 1

sfr_bank2

Bank 2

sfr_bank3

Bank 3

sfr_common

Common Set of Registers (last five locations of each bank)

sfr_bank0

Bank 0

sfr_bank1

Bank 1

sfr_bank2

Bank 2

sfr_bank3

Bank 3

sfr_common

Common Set of Registers (last five locations of each bank)

1.6.5.9 Variable Documentation

1.6.5.9.1 rxPacketStatusVector

receiveStatusVector_t rxPacketStatusVector

1.6.5.9.2 TXPacketSize

uint16_t TXPacketSize

1.6.6 source/encx24j600_types.h File Reference

1.6.6.1 Macros

1.6.6.3 Detailed Description

ENCx24J600 Ethernet Controller Header File

1.6.6.4 Macro Definition Documentation

1.6.6.4.1 ECON1_AESST

#define ECON1_AESST 0x0800

1.6.6.4.2 ECON1_DMACPY

#define ECON1_DMACPY 0x0010

1.6.6.4.3 ECON1_DMACSSD

#define ECON1_DMACSSD 0x0008

1.6.6.4.4 ECON1_DMANOCS

#define ECON1_DMANOCS 0x0004

1.6.6.4.5 ECON1_DMAST

#define ECON1_DMAST 0x0020

1.6.6.4.6 ECON1_HASHEN

#define ECON1_HASHEN 0x4000

1.6.6.4.7 ECON1_HASHLST

#define ECON1_HASHLST 0x1000

1.6.6.4.8 ECON1_HASHOP

#define ECON1_HASHOP 0x2000

1.6.6.4.9 ECON1_MODEXST

#define ECON1_MODEXST 0x8000

1.6.6.4.10 ECON1_PKTDEC

#define ECON1_PKTDEC 0x0100

1.6.6.4.11 ECON1_RXEN

#define ECON1_RXEN 0x0001

1.6.6.4.12 ECON1_TXRTS

#define ECON1_TXRTS 0x0002

1.6.6.4.13 ECON2_AUTOFC

#define ECON2_AUTOFC 0x0080

1.6.6.4.14 ECON2_ETHEN

#define ECON2_ETHEN 0x8000

1.6.6.4.15 ECON2_ETHRST

#define ECON2_ETHRST 0x0010

1.6.6.4.16 ECON2_RXRST

#define ECON2_RXRST 0x0020

1.6.6.4.17 ECON2_STRCH

#define ECON2_STRCH 0x4000

1.6.6.4.18 EIR_CRYPTEN

#define EIR_CRYPTEN 0x8000

1.6.6.4.19 EIR_LINKIF

#define EIR_LINKIF 0x0800

1.6.6.4.20 EIR_PCFULIF

#define EIR_PCFULIF 0x0001

1.6.6.4.21 EIR_PKTIF

#define EIR_PKTIF 0x0040

1.6.6.4.22 EIR_RXABTIF

#define EIR_RXABTIF 0x0002

1.6.6.4.23 EIR_TXIF

#define EIR_TXIF 0x0008

1.6.6.4.24 ESTAT_CLKRDY

#define ESTAT_CLKRDY 0x1000

1.6.6.4.25 ESTAT_PHYDPX

#define ESTAT_PHYDPX 0x0400

1.6.6.4.26 ESTAT_PHYLINK

#define ESTAT_PHYLINK 0x0100

1.6.6.4.27 ESTAT_PHYRDY

#define ESTAT_PHYRDY 0x0200

1.6.6.4.28 ESTAT_PKTCNT

#define ESTAT_PKTCNT 0x00FF

1.6.6.4.29 ESTAT_RSTDONE

#define ESTAT_RSTDONE 0x0800

1.6.6.4.30 ESTAT_RXBUSY

#define ESTAT_RXBUSY 0x2000

1.6.6.4.31 ETH_HEADER_SIZE

#define ETH_HEADER_SIZE 14

1.6.6.4.32 IP_PROTOCOL_POS

#define IP_PROTOCOL_POS 23

1.6.6.4.33 MACON2_FULDPX_OFF

#define MACON2_FULDPX_OFF 0xFFFE

1.6.6.4.34 MACON2_FULDPX_ON

#define MACON2_FULDPX_ON 0x0001

1.6.6.4.35 RAMSIZE_ETH

#define RAMSIZE_ETH 0x6000ul

1.6.7 source/physical_layer_interface.h File Reference

#include <stdbool.h>
#include <stdint.h>

1.6.7.2 Functions

  • void ETH_Init (void)

    Sets up the Ethernet and starts the execution. Initializes the TX/RX buffer, the MAC and the PHY.

  • void ETH_EventHandler (void)

    Manages the MAC events. Can be used for polling or for new events in Interrupt Service Routine (ISR).

  • void ETH_NextPacketUpdate (void)

    Updates the pointers for the next available RX packets. Retrieves information about the last received packet and the address of the next ones.

  • void ETH_ResetReceiver (void)

    Resets the receiver buffer.

  • void ETH_SendSystemReset (void)

    Resets the system software.

  • const mac48Address_t * MAC_getAddress (void)

    Returns the MAC address of type mac48Address_t.

  • uint16_t ETH_ReadBlock (void *buffer, uint16_t length)

    Reads a block of data from the RX buffer MAC.

  • uint8_t ETH_Read8 (void)

    Reads one byte of data from the RX buffer MAC.

  • uint16_t ETH_Read16 (void)

    Reads two bytes of data from the RX buffer and returns them in host order.

  • uint32_t ETH_Read24 (void)

    Reads three bytes of data from the RX buffer and returns them in host order.

  • uint32_t ETH_Read32 (void)

    Reads four bytes of data from the RX buffer and returns them in host order.

  • void ETH_Dump (uint16_t length)

    Drops the N bytes from a packet list when the data is lost. Clears a number of bytes (length) from the RX buffer.

  • void ETH_Flush (void)

    Drops the rest of this packet and release the buffer. Clears all bytes from the RX buffer.

  • uint16_t ETH_GetFreeTxBufferSize (void)

    Returns the available space size in the Ethernet TX buffer.

  • phy_error_msg ETH_WriteStart (const mac48Address_t *dest_mac, uint16_t type)

    Starts a packet if the Ethernet transmitter is idle.

  • uint16_t ETH_WriteString (const char *string)

    Writes a string of data into the MAC.

  • uint16_t ETH_WriteBlock (const char *data, uint16_t length)

    Writes a block of data into the TX buffer MAC.

  • void ETH_Write8 (uint8_t data)

    Writes one byte of data into the TX buffer MAC.

  • void ETH_Write16 (uint16_t data)

    Writes two bytes into the TX buffer MAC in Network order.

  • void ETH_Write24 (uint32_t data)

    Writes three bytes into the TX buffer MAC in Network order.

  • void ETH_Write32 (uint32_t data)

    Writes four bytes into the TX buffer MAC in Network order.

  • void ETH_Insert (char *data, uint16_t len, uint16_t offset)

    Inserts N data bytes into a specific offset in the TX buffer/packet.

  • phy_error_msg ETH_Copy (uint16_t len)

    Copies N bytes from the saved read location (RX buffer) into the current TX location (TX buffer) using the DMA set up. This is used for ICMP ECHO to eliminate the need to extract the arbitrary payload.

  • phy_error_msg ETH_Send (void)

    Sends the TX packet. Starts the transmission of packet or queues the packet that has been created.

  • uint16_t ETH_TxComputeChecksum (uint16_t position, uint16_t length, uint16_t seed)

    Calculates the hardware checksum of length bytes starting with the position.

  • uint16_t ETH_RxComputeChecksum (uint16_t len, uint16_t seed)

    Calculates the RX software checksum.

  • void ETH_GetMAC (uint8_t *macAddr)

    Reads the MAC address.

  • void ETH_SetMAC (uint8_t *macAddr)

    Sets the MAC address.

  • uint16_t ETH_GetWritePtr (void)

    Returns the value of the write pointer.

  • void ETH_SaveRDPT (void)

    Saves the receive pointer for copy.

  • void ETH_ResetReadPtr (void)

    Resets the receive pointer to the Init.

  • uint16_t ETH_GetReadPtr (void)

    Returns the value of the read pointer.

  • void ETH_SetReadPtr (uint16_t rdptr)

    Sets the read pointer to a specific address.

  • uint16_t ETH_GetStatusVectorByteCount (void)

    Returns the Status Vector's byte count.

  • void ETH_SetStatusVectorByteCount (uint16_t bc)

    Sets the Status Vector's byte count.

  • void ETH_ResetByteCount (void)

    Resets the driver's byte count.

  • uint16_t ETH_GetByteCount (void)

    Returns the the driver's byte count.

  • uint16_t ETH_ReadSavedWRPT (void)

    Returns the saved write pointer.

  • void ETH_SaveWRPT (void)

    Saves the write pointer for copy.

  • void ETH_SetRxByteCount (uint16_t count)

    Sets the receiver's byte count.

  • uint16_t ETH_GetRxByteCount (void)

    Returns the receiver's byte count.

  • bool ETH_CheckLinkUp (void)

    Checks for the link.

  • void ETH_TxReset (void)

    Resets the transmitter.

  • void ETH_MoveBackReadPtr (uint16_t offset)

    Moves back the read pointer.

1.6.7.6 Detailed Description

Physical Layer Interface Header File

1.6.7.7 Macro Definition Documentation

1.6.7.7.1 ETH_linkChanged

#define ETH_linkChanged( ) ethData.linkChange

1.6.7.7.2 ETH_linkCheck

#define ETH_linkCheck( ) ethData.up

1.6.7.7.3 ETH_packetReady

#define ETH_packetReady( ) ethData.pktReady

1.6.7.8 Variable Documentation

1.6.7.8.1 broadcastMAC

const mac48Address_t broadcastMAC

1.6.7.8.2 ethData

volatile ethernetDriver_t ethData

1.6.7.8.3 hostMacAddress

mac48Address_t hostMacAddress