Microchip® Advanced Software Framework

gmac.h File Reference

GMAC (Ethernet MAC) driver for SAM.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"

Data Structures

union  gmac_rx_descriptor::gmac_rx_addr
 
struct  gmac_rx_descriptor::gmac_rx_addr::gmac_rx_addr_bm
 
struct  gmac_rx_descriptor
 Receive buffer descriptor struct. More...
 
union  gmac_rx_descriptor::gmac_rx_status
 
struct  gmac_rx_descriptor::gmac_rx_status::gmac_rx_status_bm
 
struct  gmac_tx_descriptor
 Transmit buffer descriptor struct. More...
 
union  gmac_tx_descriptor::gmac_tx_status
 
struct  gmac_tx_descriptor::gmac_tx_status::gmac_tx_status_bm
 

Macros

#define GMAC_ADDR_LENGTH   6
 GMAC address length. More...
 
#define GMAC_DUPLEX_FULL   1
 
#define GMAC_DUPLEX_HALF   0
 
#define GMAC_FRAME_LENTGH_MAX   1536
 The MAC can support frame lengths up to 1536 bytes. More...
 
#define GMAC_MAN_CODE_VALUE   10
 GMAC maintain code default value. More...
 
#define GMAC_MAN_READ_ONLY   1
 GMAC maintain read only. More...
 
#define GMAC_MAN_RW_TYPE   2
 GMAC maintain read/write. More...
 
#define GMAC_MAN_SOF_VALUE   1
 GMAC maintain start of frame default value. More...
 
#define GMAC_MCK_SPEED_120MHZ   (120*1000*1000)
 
#define GMAC_MCK_SPEED_160MHZ   (160*1000*1000)
 
#define GMAC_MCK_SPEED_20MHZ   (20*1000*1000)
 
#define GMAC_MCK_SPEED_240MHZ   (240*1000*1000)
 GMAC clock speed. More...
 
#define GMAC_MCK_SPEED_40MHZ   (40*1000*1000)
 
#define GMAC_MCK_SPEED_80MHZ   (80*1000*1000)
 
#define GMAC_RX_UNITSIZE   128
 Fixed size for RX buffer. More...
 
#define GMAC_RXD_ADDR   (3ul << 25)
 Address match. More...
 
#define GMAC_RXD_ADDR_FOUND   (1ul << 27)
 Specific address match found. More...
 
#define GMAC_RXD_ADDR_MASK   0xFFFFFFFC
 The buffer addresses written into the descriptors must be aligned, so the last few bits are zero. More...
 
#define GMAC_RXD_BROADCAST   (1ul << 31)
 Broadcast detected. More...
 
#define GMAC_RXD_CFI   (1ul << 16)
 Concatenation Format Indicator only if bit 21 is set. More...
 
#define GMAC_RXD_EOF   (1ul << 15)
 End of frame. More...
 
#define GMAC_RXD_FCS   (1ul << 13)
 Frame check sequence. More...
 
#define GMAC_RXD_LEN_MASK   (0xFFF)
 Length of frame including FCS (if selected) More...
 
#define GMAC_RXD_LENJUMBO_MASK   (0x3FFF)
 Jumbo frame length. More...
 
#define GMAC_RXD_MULTIHASH   (1ul << 30)
 Multicast hash match. More...
 
#define GMAC_RXD_OFFSET_MASK
 Receive buffer offset. More...
 
#define GMAC_RXD_OWNERSHIP   (1ul << 0)
 Ownership bit. More...
 
#define GMAC_RXD_PRIORITY   (1ul << 20)
 Priority tag detected. More...
 
#define GMAC_RXD_PRIORITY_MASK   (3ul << 17)
 VLAN priority. More...
 
#define GMAC_RXD_RXCOEN   (1ul << 24)
 RXCOEN related function. More...
 
#define GMAC_RXD_SOF   (1ul << 14)
 Start of frame. More...
 
#define GMAC_RXD_TYPE   (3ul << 22)
 Type ID match. More...
 
#define GMAC_RXD_UNIHASH   (1ul << 29)
 Unicast hash match. More...
 
#define GMAC_RXD_VLAN   (1ul << 21)
 VLAN tag detected. More...
 
#define GMAC_RXD_WRAP   (1ul << 1)
 Wrap bit. More...
 
#define GMAC_SPEED_100M   1
 
#define GMAC_SPEED_10M   0
 
#define GMAC_TX_UNITSIZE   1518
 Size for ETH frame length. More...
 
#define GMAC_TXD_CHECKSUM_ERROR   (7ul << 20)
 Checksum error. More...
 
#define GMAC_TXD_ERROR   (1ul << 29)
 Retry limit exceeded, error. More...
 
#define GMAC_TXD_EXHAUSTED   (1ul << 27)
 Buffer exhausted. More...
 
#define GMAC_TXD_LAST   (1ul << 15)
 Last buffer in frame. More...
 
#define GMAC_TXD_LATE   (1ul << 26)
 Late collision,transmit error. More...
 
#define GMAC_TXD_LEN_MASK   (0x1FFF)
 Length of buffer. More...
 
#define GMAC_TXD_NOCRC   (1ul << 16)
 No CRC. More...
 
#define GMAC_TXD_UNDERRUN   (1ul << 28)
 Transmit underrun. More...
 
#define GMAC_TXD_USED   (1ul << 31)
 Frame is transmitted. More...
 
#define GMAC_TXD_WRAP   (1ul << 30)
 Last descriptor. More...
 

Typedefs

typedef struct gmac_rx_descriptor gmac_rx_descriptor_t
 Receive buffer descriptor struct. More...
 
typedef struct gmac_tx_descriptor gmac_tx_descriptor_t
 Transmit buffer descriptor struct. More...
 

Enumerations

enum  gmac_mii_mode_t {
  GMAC_PHY_MII = 0,
  GMAC_PHY_RMII = 1,
  GMAC_PHY_INVALID = 0xFF
}
 Media Independent Interface (MII) type. More...
 
enum  gmac_quelist_t {
  GMAC_QUE_0 = 0,
  GMAC_QUE_1 = 1,
  GMAC_QUE_2 = 2,
  GMAC_QUE_3 = 3,
  GMAC_QUE_4 = 4,
  GMAC_QUE_5 = 5
}
 
enum  gmac_status_t {
  GMAC_OK = 0,
  GMAC_TIMEOUT = 1,
  GMAC_TX_BUSY,
  GMAC_RX_ERROR,
  GMAC_RX_NO_DATA,
  GMAC_SIZE_TOO_SMALL,
  GMAC_PARAM,
  GMAC_INVALID = 0xFF
}
 Return codes for GMAC APIs. More...
 

Functions

static void gmac_clear_rx_status (Gmac *p_gmac, uint32_t ul_status)
 Clear receive status. More...
 
static void gmac_clear_statistics (Gmac *p_gmac)
 Clear all statistics registers. More...
 
static void gmac_clear_tx_status (Gmac *p_gmac, uint32_t ul_status)
 Clear transmit status. More...
 
static void gmac_disable_broadcast (Gmac *p_gmac, uint8_t uc_enable)
 Disable/Enable broadcast receiving. More...
 
static void gmac_disable_interrupt (Gmac *p_gmac, uint32_t ul_source)
 Disable interrupt(s). More...
 
static void gmac_enable_back_pressure (Gmac *p_gmac, uint8_t uc_enable)
 In half-duplex mode, forces collisions on all received frames. More...
 
static void gmac_enable_big_frame (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable big frames (over 1518, up to 1536). More...
 
static void gmac_enable_copy_all (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable Copy(Receive) All Valid Frames. More...
 
static void gmac_enable_discard_fcs (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable discarding FCS field of received frames. More...
 
static void gmac_enable_efrhd (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable frames to be received in half-duplex mode while transmitting. More...
 
static void gmac_enable_full_duplex (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable Full-Duplex mode. More...
 
static void gmac_enable_ignore_rx_fcs (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable ignore RX FCS. More...
 
static void gmac_enable_interrupt (Gmac *p_gmac, uint32_t ul_source)
 Enable interrupt(s). More...
 
static void gmac_enable_jumbo_frames (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable jumbo frames (up to 10240 bytes). More...
 
static void gmac_enable_management (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable GMAC management. More...
 
static void gmac_enable_multicast_hash (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable multicast hash. More...
 
static void gmac_enable_pause_frame (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable pause (when a valid pause frame is received). More...
 
static void gmac_enable_pfc_pause_frame (Gmac *p_gmac, uint8_t uc_enable)
 Enable PFC priority-based pause reception. More...
 
static void gmac_enable_receive (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable GMAC receive. More...
 
static void gmac_enable_retry_test (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable retry test. More...
 
static void gmac_enable_rx_length_check (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable receive length field checking. More...
 
static void gmac_enable_statistics_write (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable statistics registers writing. More...
 
static void gmac_enable_transmit (Gmac *p_gmac, uint8_t uc_enable)
 Enable/Disable GMAC transmit. More...
 
static void gmac_flush_next_packet (Gmac *p_gmac)
 Flush next packet. More...
 
static uint32_t gmac_get_config (Gmac *p_gmac)
 Get network configuration. More...
 
static uint32_t gmac_get_interrupt_mask (Gmac *p_gmac)
 Return interrupt mask. More...
 
static uint32_t gmac_get_interrupt_status (Gmac *p_gmac)
 Return interrupt status. More...
 
static uint8_t gmac_get_MDIO (Gmac *p_gmac)
 Get MDIO IN pin status. More...
 
static uint32_t gmac_get_network_control (Gmac *p_gmac)
 Get network control value. More...
 
static uint16_t gmac_get_phy_data (Gmac *p_gmac)
 Get PHY maintenance data returned. More...
 
static uint32_t gmac_get_rx_queue (Gmac *p_gmac)
 Get Rx Queue Address. More...
 
static uint32_t gmac_get_rx_status (Gmac *p_gmac)
 Return receive status. More...
 
static uint32_t gmac_get_status (Gmac *p_gmac)
 Get Network Status. More...
 
static uint32_t gmac_get_tx_queue (Gmac *p_gmac)
 Get Tx Queue. More...
 
static uint32_t gmac_get_tx_status (Gmac *p_gmac)
 Return transmit status. More...
 
static void gmac_halt_transmission (Gmac *p_gmac)
 Halt transmission. More...
 
static void gmac_increase_statistics (Gmac *p_gmac)
 Increase all statistics registers. More...
 
static uint8_t gmac_is_phy_idle (Gmac *p_gmac)
 Check if PHY is idle. More...
 
static void gmac_maintain_phy (Gmac *p_gmac, uint8_t uc_phy_addr, uint8_t uc_reg_addr, uint8_t uc_rw, uint16_t us_data)
 Execute PHY maintenance command. More...
 
static void gmac_network_control (Gmac *p_gmac, uint32_t ul_ncr)
 Write network control value. More...
 
uint8_t gmac_phy_read (Gmac *p_gmac, uint8_t uc_phy_address, uint8_t uc_address, uint32_t *p_value)
 Read the PHY register. More...
 
uint8_t gmac_phy_write (Gmac *p_gmac, uint8_t uc_phy_address, uint8_t uc_address, uint32_t ul_value)
 Write the PHY register. More...
 
static void gmac_select_mii_mode (Gmac *p_gmac, gmac_mii_mode_t mode)
 Select media independent interface mode. More...
 
static void gmac_set_address (Gmac *p_gmac, uint8_t uc_index, uint8_t *p_mac_addr)
 Set MAC Address. More...
 
static void gmac_set_address32 (Gmac *p_gmac, uint8_t uc_index, uint32_t ul_mac_top, uint32_t ul_mac_bottom)
 Set MAC Address via 2 dword. More...
 
static void gmac_set_address64 (Gmac *p_gmac, uint8_t uc_index, uint64_t ull_mac)
 Set MAC Address via int64. More...
 
static void gmac_set_config (Gmac *p_gmac, uint32_t ul_cfg)
 Set up network configuration register. More...
 
static void gmac_set_hash (Gmac *p_gmac, uint32_t ul_hash_top, uint32_t ul_hash_bottom)
 Set Hash. More...
 
static void gmac_set_hash64 (Gmac *p_gmac, uint64_t ull_hash)
 Set 64 bits Hash. More...
 
static uint8_t gmac_set_mdc_clock (Gmac *p_gmac, uint32_t ul_mck)
 Set MDC clock divider. More...
 
static void gmac_set_rx_buffer_offset (Gmac *p_gmac, uint8_t uc_offset)
 Set receive buffer offset to 0 ~ 3. More...
 
static void gmac_set_rx_bufsize (Gmac *p_gmac, uint32_t ul_code)
 Set Rx buffer size. More...
 
static void gmac_set_rx_queue (Gmac *p_gmac, uint32_t ul_addr)
 Set Rx Queue. More...
 
static void gmac_set_speed (Gmac *p_gmac, uint8_t uc_speed)
 Set speed. More...
 
static void gmac_set_tx_queue (Gmac *p_gmac, uint32_t ul_addr)
 Set Tx Queue. More...
 
static void gmac_start_transmission (Gmac *p_gmac)
 Start transmission. More...
 
static void gmac_store_rx_time_stamp (Gmac *p_gmac, uint8_t uc_enable)
 Store receivetime stamp to memory. More...
 
static void gmac_transmit_pfc_pause_frame (Gmac *p_gmac)
 Transmit PFC priority-based pause reception. More...
 
static void gmac_tx_pause_frame (Gmac *p_gmac)
 Transmit pause frame. More...
 
static void gmac_tx_pause_zero_quantum_frame (Gmac *p_gmac)
 Transmit zero quantum pause frame. More...
 

#define GMAC_ADDR_LENGTH   6

GMAC address length.

#define GMAC_DUPLEX_FULL   1
#define GMAC_DUPLEX_HALF   0
#define GMAC_FRAME_LENTGH_MAX   1536

The MAC can support frame lengths up to 1536 bytes.

Referenced by gmac_rx_populate_queue().

#define GMAC_MAN_CODE_VALUE   10

GMAC maintain code default value.

Referenced by gmac_maintain_phy().

#define GMAC_MAN_READ_ONLY   1

GMAC maintain read only.

Referenced by gmac_maintain_phy().

#define GMAC_MAN_RW_TYPE   2

GMAC maintain read/write.

Referenced by gmac_maintain_phy().

#define GMAC_MAN_SOF_VALUE   1

GMAC maintain start of frame default value.

#define GMAC_MCK_SPEED_120MHZ   (120*1000*1000)

Referenced by gmac_set_mdc_clock().

#define GMAC_MCK_SPEED_160MHZ   (160*1000*1000)

Referenced by gmac_set_mdc_clock().

#define GMAC_MCK_SPEED_20MHZ   (20*1000*1000)

Referenced by gmac_set_mdc_clock().

#define GMAC_MCK_SPEED_240MHZ   (240*1000*1000)

GMAC clock speed.

Referenced by gmac_set_mdc_clock().

#define GMAC_MCK_SPEED_40MHZ   (40*1000*1000)

Referenced by gmac_set_mdc_clock().

#define GMAC_MCK_SPEED_80MHZ   (80*1000*1000)

Referenced by gmac_set_mdc_clock().

#define GMAC_RX_UNITSIZE   128

Fixed size for RX buffer.

#define GMAC_RXD_ADDR   (3ul << 25)

Address match.

#define GMAC_RXD_ADDR_FOUND   (1ul << 27)

Specific address match found.

#define GMAC_RXD_ADDR_MASK   0xFFFFFFFC

The buffer addresses written into the descriptors must be aligned, so the last few bits are zero.

These bits have special meaning for the GMAC peripheral and cannot be used as part of the address.

Referenced by gmac_low_level_init().

#define GMAC_RXD_BROADCAST   (1ul << 31)

Broadcast detected.

#define GMAC_RXD_CFI   (1ul << 16)

Concatenation Format Indicator only if bit 21 is set.

#define GMAC_RXD_EOF   (1ul << 15)

End of frame.

#define GMAC_RXD_FCS   (1ul << 13)

Frame check sequence.

#define GMAC_RXD_LEN_MASK   (0xFFF)

Length of frame including FCS (if selected)

Referenced by gmac_low_level_input().

#define GMAC_RXD_LENJUMBO_MASK   (0x3FFF)

Jumbo frame length.

#define GMAC_RXD_MULTIHASH   (1ul << 30)

Multicast hash match.

#define GMAC_RXD_OFFSET_MASK

Receive buffer offset.

#define GMAC_RXD_OWNERSHIP   (1ul << 0)

Ownership bit.

Referenced by gmac_low_level_input().

#define GMAC_RXD_PRIORITY   (1ul << 20)

Priority tag detected.

#define GMAC_RXD_PRIORITY_MASK   (3ul << 17)

VLAN priority.

#define GMAC_RXD_RXCOEN   (1ul << 24)

RXCOEN related function.

#define GMAC_RXD_SOF   (1ul << 14)

Start of frame.

#define GMAC_RXD_TYPE   (3ul << 22)

Type ID match.

#define GMAC_RXD_UNIHASH   (1ul << 29)

Unicast hash match.

#define GMAC_RXD_VLAN   (1ul << 21)

VLAN tag detected.

#define GMAC_RXD_WRAP   (1ul << 1)
#define GMAC_SPEED_100M   1
#define GMAC_SPEED_10M   0
#define GMAC_TX_UNITSIZE   1518

Size for ETH frame length.

#define GMAC_TXD_CHECKSUM_ERROR   (7ul << 20)

Checksum error.

#define GMAC_TXD_ERROR   (1ul << 29)

Retry limit exceeded, error.

#define GMAC_TXD_EXHAUSTED   (1ul << 27)

Buffer exhausted.

#define GMAC_TXD_LAST   (1ul << 15)

Last buffer in frame.

Referenced by gmac_tx_init().

#define GMAC_TXD_LATE   (1ul << 26)

Late collision,transmit error.

#define GMAC_TXD_LEN_MASK   (0x1FFF)

Length of buffer.

#define GMAC_TXD_NOCRC   (1ul << 16)

No CRC.

#define GMAC_TXD_UNDERRUN   (1ul << 28)

Transmit underrun.

#define GMAC_TXD_USED   (1ul << 31)

Frame is transmitted.

Referenced by gmac_low_level_init(), and gmac_tx_init().

#define GMAC_TXD_WRAP   (1ul << 30)

Last descriptor.

Referenced by gmac_low_level_init(), and gmac_tx_init().

Receive buffer descriptor struct.

Transmit buffer descriptor struct.

Media Independent Interface (MII) type.

Enumerator
GMAC_PHY_MII 
GMAC_PHY_RMII 

MII mode.

GMAC_PHY_INVALID 

Reduced MII mode.

Enumerator
GMAC_QUE_0 
GMAC_QUE_1 
GMAC_QUE_2 
GMAC_QUE_3 
GMAC_QUE_4 
GMAC_QUE_5 

Return codes for GMAC APIs.

Enumerator
GMAC_OK 
GMAC_TIMEOUT 

Operation OK.

GMAC_TX_BUSY 

GMAC operation timeout.

GMAC_RX_ERROR 

TX in progress.

GMAC_RX_NO_DATA 

RX error.

GMAC_SIZE_TOO_SMALL 

No data received.

GMAC_PARAM 

Buffer size not enough.

GMAC_INVALID 

Parameter error, TX packet invalid or RX size too small.

static void gmac_clear_rx_status ( Gmac *  p_gmac,
uint32_t  ul_status 
)
inlinestatic

Clear receive status.

Parameters
p_gmacPointer to the GMAC instance.
ul_statusReceive status.

Referenced by gmac_low_level_init(), and gmac_low_level_input().

static void gmac_clear_statistics ( Gmac *  p_gmac)
inlinestatic

Clear all statistics registers.

Parameters
p_gmacPointer to the GMAC instance.

Referenced by gmac_low_level_init().

static void gmac_clear_tx_status ( Gmac *  p_gmac,
uint32_t  ul_status 
)
inlinestatic

Clear transmit status.

Parameters
p_gmacPointer to the GMAC instance.
ul_statusTransmit status.

Referenced by gmac_low_level_init(), and gmac_low_level_output().

static void gmac_disable_broadcast ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Disable/Enable broadcast receiving.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable1 to disable the broadcast, else to enable it.

Referenced by gmac_low_level_init().

static void gmac_disable_interrupt ( Gmac *  p_gmac,
uint32_t  ul_source 
)
inlinestatic

Disable interrupt(s).

Parameters
p_gmacPointer to the GMAC instance.
ul_sourceInterrupt source(s) to be disabled.

Referenced by gmac_low_level_init().

static void gmac_enable_back_pressure ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

In half-duplex mode, forces collisions on all received frames.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable the back pressure, else to enable it.
static void gmac_enable_big_frame ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable big frames (over 1518, up to 1536).

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable big frames else to enable it.
static void gmac_enable_copy_all ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable Copy(Receive) All Valid Frames.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable copying all valid frames, else to enable it.

Referenced by gmac_low_level_init().

static void gmac_enable_discard_fcs ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable discarding FCS field of received frames.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable discarding FCS field of received frames, else to enable it.
static void gmac_enable_efrhd ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable frames to be received in half-duplex mode while transmitting.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable the received in half-duplex mode, else to enable it.
static void gmac_enable_full_duplex ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable Full-Duplex mode.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable the Full-Duplex mode, else to enable it.

Referenced by ethernet_phy_auto_negotiate(), and ethernet_phy_set_link().

static void gmac_enable_ignore_rx_fcs ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable ignore RX FCS.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable ignore RX FCS, else to enable it.
static void gmac_enable_interrupt ( Gmac *  p_gmac,
uint32_t  ul_source 
)
inlinestatic

Enable interrupt(s).

Parameters
p_gmacPointer to the GMAC instance.
ul_sourceInterrupt source(s) to be enabled.

Referenced by gmac_low_level_init().

static void gmac_enable_jumbo_frames ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable jumbo frames (up to 10240 bytes).

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable the jumbo frames, else to enable it.
static void gmac_enable_management ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable GMAC management.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable GMAC management, else to enable it.

Referenced by ethernet_phy_auto_negotiate(), ethernet_phy_find_valid(), ethernet_phy_reset(), and ethernet_phy_set_link().

static void gmac_enable_multicast_hash ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable multicast hash.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable the multicast hash, else to enable it.
static void gmac_enable_pause_frame ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable pause (when a valid pause frame is received).

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable pause frame, else to enable it.
static void gmac_enable_pfc_pause_frame ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable PFC priority-based pause reception.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable1 to set the reception, 0 to disable.
static void gmac_enable_receive ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable GMAC receive.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable GMAC receiver, else to enable it.

Referenced by ethernet_phy_auto_negotiate(), gmac_low_level_init(), and gmac_low_level_input().

static void gmac_enable_retry_test ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable retry test.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable the GMAC receiver, else to enable it.
static void gmac_enable_rx_length_check ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable receive length field checking.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable receive length field checking, else to enable it.
static void gmac_enable_statistics_write ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable statistics registers writing.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable the statistics registers writing, else to enable it.

Referenced by gmac_low_level_init().

static void gmac_enable_transmit ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Enable/Disable GMAC transmit.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to disable GMAC transmit, else to enable it.

Referenced by ethernet_phy_auto_negotiate(), gmac_low_level_init(), and gmac_low_level_output().

static void gmac_flush_next_packet ( Gmac *  p_gmac)
inlinestatic

Flush next packet.

Parameters
p_gmacPointer to the GMAC instance.
static uint32_t gmac_get_config ( Gmac *  p_gmac)
inlinestatic

Get network configuration.

Parameters
p_gmacPointer to the GMAC instance.
Returns
Network configuration.
static uint32_t gmac_get_interrupt_mask ( Gmac *  p_gmac)
inlinestatic

Return interrupt mask.

Parameters
p_gmacPointer to the GMAC instance.
Returns
Interrupt mask.
static uint32_t gmac_get_interrupt_status ( Gmac *  p_gmac)
inlinestatic

Return interrupt status.

Parameters
p_gmacPointer to the GMAC instance.
Returns
Interrupt status.

Referenced by GMAC_Handler(), and gmac_low_level_init().

static uint8_t gmac_get_MDIO ( Gmac *  p_gmac)
inlinestatic

Get MDIO IN pin status.

Parameters
p_gmacPointer to the GMAC instance.
Returns
MDIO IN pin status.
static uint32_t gmac_get_network_control ( Gmac *  p_gmac)
inlinestatic

Get network control value.

Parameters
p_gmacPointer to the GMAC instance.
static uint16_t gmac_get_phy_data ( Gmac *  p_gmac)
inlinestatic

Get PHY maintenance data returned.

Parameters
p_gmacPointer to the GMAC instance.
Returns
Get PHY data.

Referenced by gmac_phy_read().

static uint32_t gmac_get_rx_queue ( Gmac *  p_gmac)
inlinestatic

Get Rx Queue Address.

Parameters
p_gmacPointer to the GMAC instance.
Returns
Rx queue address.
static uint32_t gmac_get_rx_status ( Gmac *  p_gmac)
inlinestatic

Return receive status.

Parameters
p_gmacPointer to the GMAC instance.

Referenced by gmac_low_level_input().

static uint32_t gmac_get_status ( Gmac *  p_gmac)
inlinestatic

Get Network Status.

Parameters
p_gmacPointer to the GMAC instance.
Returns
Network status.
static uint32_t gmac_get_tx_queue ( Gmac *  p_gmac)
inlinestatic

Get Tx Queue.

Parameters
p_gmacPointer to the GMAC instance.
Returns
Rx queue address.
static uint32_t gmac_get_tx_status ( Gmac *  p_gmac)
inlinestatic

Return transmit status.

Parameters
p_gmacPointer to the GMAC instance.
Returns
Transmit status.

Referenced by gmac_low_level_output().

static void gmac_halt_transmission ( Gmac *  p_gmac)
inlinestatic

Halt transmission.

Parameters
p_gmacPointer to the GMAC instance.
static void gmac_increase_statistics ( Gmac *  p_gmac)
inlinestatic

Increase all statistics registers.

Parameters
p_gmacPointer to the GMAC instance.
static uint8_t gmac_is_phy_idle ( Gmac *  p_gmac)
inlinestatic

Check if PHY is idle.

Parameters
p_gmacPointer to the GMAC instance.
Returns
1 if PHY is idle.

Referenced by gmac_phy_wait().

static void gmac_maintain_phy ( Gmac *  p_gmac,
uint8_t  uc_phy_addr,
uint8_t  uc_reg_addr,
uint8_t  uc_rw,
uint16_t  us_data 
)
inlinestatic

Execute PHY maintenance command.

Parameters
p_gmacPointer to the GMAC instance.
uc_phy_addrPHY address.
uc_reg_addrRegister address.
uc_rw1 to Read, 0 to write.
us_dataData to be performed, write only.

References GMAC_MAN_CODE_VALUE, GMAC_MAN_READ_ONLY, and GMAC_MAN_RW_TYPE.

Referenced by gmac_phy_read(), and gmac_phy_write().

static void gmac_network_control ( Gmac *  p_gmac,
uint32_t  ul_ncr 
)
inlinestatic

Write network control value.

Parameters
p_gmacPointer to the GMAC instance.
ul_ncrNetwork control value.

Referenced by gmac_low_level_init().

static void gmac_select_mii_mode ( Gmac *  p_gmac,
gmac_mii_mode_t  mode 
)
inlinestatic

Select media independent interface mode.

Parameters
p_gmacPointer to the GMAC instance.
modeMedia independent interface mode.

References GMAC_PHY_MII, and GMAC_PHY_RMII.

Referenced by ethernet_phy_auto_negotiate().

static void gmac_set_address ( Gmac *  p_gmac,
uint8_t  uc_index,
uint8_t *  p_mac_addr 
)
inlinestatic

Set MAC Address.

Parameters
p_gmacPointer to the GMAC instance.
uc_indexGMAC specific address register index.
p_mac_addrGMAC address.

Referenced by gmac_low_level_init().

static void gmac_set_address32 ( Gmac *  p_gmac,
uint8_t  uc_index,
uint32_t  ul_mac_top,
uint32_t  ul_mac_bottom 
)
inlinestatic

Set MAC Address via 2 dword.

Parameters
p_gmacPointer to the GMAC instance.
uc_indexGMAC specific address register index.
ul_mac_topGMAC top address.
ul_mac_bottomGMAC bottom address.
static void gmac_set_address64 ( Gmac *  p_gmac,
uint8_t  uc_index,
uint64_t  ull_mac 
)
inlinestatic

Set MAC Address via int64.

Parameters
p_gmacPointer to the GMAC instance.
uc_indexGMAC specific address register index.
ull_mac64-bit GMAC address.
static void gmac_set_config ( Gmac *  p_gmac,
uint32_t  ul_cfg 
)
inlinestatic

Set up network configuration register.

Parameters
p_gmacPointer to the GMAC instance.
ul_cfgNetwork configuration value.
static void gmac_set_hash ( Gmac *  p_gmac,
uint32_t  ul_hash_top,
uint32_t  ul_hash_bottom 
)
inlinestatic

Set Hash.

Parameters
p_gmacPointer to the GMAC instance.
ul_hash_topHash top.
ul_hash_bottomHash bottom.
static void gmac_set_hash64 ( Gmac *  p_gmac,
uint64_t  ull_hash 
)
inlinestatic

Set 64 bits Hash.

Parameters
p_gmacPointer to the GMAC instance.
ull_hash64 bits hash value.
static uint8_t gmac_set_mdc_clock ( Gmac *  p_gmac,
uint32_t  ul_mck 
)
inlinestatic

Set MDC clock divider.

Parameters
p_gmacPointer to the GMAC instance.
ul_mckGMAC MCK.
Returns
GMAC_OK if successfully.

References GMAC_INVALID, GMAC_MCK_SPEED_120MHZ, GMAC_MCK_SPEED_160MHZ, GMAC_MCK_SPEED_20MHZ, GMAC_MCK_SPEED_240MHZ, GMAC_MCK_SPEED_40MHZ, GMAC_MCK_SPEED_80MHZ, and GMAC_OK.

Referenced by ethernet_phy_init().

static void gmac_set_rx_buffer_offset ( Gmac *  p_gmac,
uint8_t  uc_offset 
)
inlinestatic

Set receive buffer offset to 0 ~ 3.

Parameters
p_gmacPointer to the GMAC instance.
static void gmac_set_rx_bufsize ( Gmac *  p_gmac,
uint32_t  ul_code 
)
inlinestatic

Set Rx buffer size.

Parameters
p_gmacPointer to the GMAC instance.
ul_addrRx buffer.

Referenced by gmac_low_level_init().

static void gmac_set_rx_queue ( Gmac *  p_gmac,
uint32_t  ul_addr 
)
inlinestatic

Set Rx Queue.

Parameters
p_gmacPointer to the GMAC instance.
ul_addrRx queue address.

Referenced by gmac_rx_init().

static void gmac_set_speed ( Gmac *  p_gmac,
uint8_t  uc_speed 
)
inlinestatic

Set speed.

Parameters
p_gmacPointer to the GMAC instance.
uc_speed1 to indicate 100Mbps, 0 to 10Mbps.

Referenced by ethernet_phy_auto_negotiate(), and ethernet_phy_set_link().

static void gmac_set_tx_queue ( Gmac *  p_gmac,
uint32_t  ul_addr 
)
inlinestatic

Set Tx Queue.

Parameters
p_gmacPointer to the GMAC instance.
ul_addrTx queue address.

Referenced by gmac_tx_init().

static void gmac_start_transmission ( Gmac *  p_gmac)
inlinestatic

Start transmission.

Parameters
p_gmacPointer to the GMAC instance.

Referenced by gmac_low_level_output().

static void gmac_store_rx_time_stamp ( Gmac *  p_gmac,
uint8_t  uc_enable 
)
inlinestatic

Store receivetime stamp to memory.

Parameters
p_gmacPointer to the GMAC instance.
uc_enable0 to normal operation, else to enable the store.
static void gmac_transmit_pfc_pause_frame ( Gmac *  p_gmac)
inlinestatic

Transmit PFC priority-based pause reception.

Parameters
p_gmacPointer to the GMAC instance.
static void gmac_tx_pause_frame ( Gmac *  p_gmac)
inlinestatic

Transmit pause frame.

Parameters
p_gmacPointer to the GMAC instance.
static void gmac_tx_pause_zero_quantum_frame ( Gmac *  p_gmac)
inlinestatic

Transmit zero quantum pause frame.

Parameters
p_gmacPointer to the GMAC instance.