Unit GENET

From Ultibo.org
Revision as of 07:06, 19 June 2021 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


Broadcom GENET Gigabit Ethernet Driver

This driver supports members of the Broadcom family of Gigabit Ethernet devices including the BCM54213PE contained in the Raspberry Pi 4B.

These devices support speeds of 10BASE-T, 100BASE-TX and 1000BASE-T and include a range of features including WOL and EEE.

The device included in the Raspberry Pi 4B uses a memory mapped interface which supports multiple TX and RX queues with priority queueing, hardware filtering and DMA bus master transfers.

Constants


To be documented

Type definitions


To be documented

Public variables



GENET specific variables

GENET_PHY_MODE:String;
GENET_PHY_ADDR:LongWord;
GENET_SKIP_UMAC_RESET:Boolean;
GENET_NO_PHY_INTERRUPT:Boolean;


Function declarations



GENET functions

function GENETNetworkCreate(Address:PtrUInt; MDIOOffset:LongWord; IRQ0,IRQ1:LongWord):PNetworkDevice;
Description: Create and register a new GENET Network device which can be accessed using the Network API
Address The address of the GENET registers
MDIOOffset The offset from address of the MDIO registers
IRQ0 The interrupt number for interrupt 0 of the GENET
IRQ1 The interrupt number for interrupt 1 of the GENET
Return Pointer to the new Network device or nil if the Network device could not be created


function GENETNetworkDestroy(Network:PNetworkDevice):LongWord;
Description: Close, deregister and destroy a GENET Network device created by this driver
Network The Network device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


GENET network functions

function GENETNetworkOpen(Network:PNetworkDevice):LongWord;
Description: Implementation of NetworkDeviceOpen API for GENET Network
Note Not intended to be called directly by applications, use NetworkDeviceOpen instead.


function GENETNetworkClose(Network:PNetworkDevice):LongWord;
Description: Implementation of NetworkDeviceClose API for GENET Network
Note Not intended to be called directly by applications, use NetworkDeviceClose instead.


function GENETNetworkControl(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
Description: Implementation of NetworkDeviceControl API for GENET Network
Note Not intended to be called directly by applications, use NetworkDeviceControl instead.


function GENETBufferAllocate(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferAllocate API for GENET Network
Note Not intended to be called directly by applications, use NetworkBufferAllocate instead.


function GENETBufferRelease(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferRelease API for GENET Network
Note Not intended to be called directly by applications, use NetworkBufferRelease instead.


function GENETBufferReceive(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferReceive API for GENET Network
Note Not intended to be called directly by applications, use NetworkBufferReceive instead.


function GENETBufferTransmit(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferTransmit API for GENET Network
Note Not intended to be called directly by applications, use NetworkBufferTransmit instead.


GENET helper functions

function GENETGetHardwareParameters(Network:PGENETNetwork):LongWord;
Description: To be documented
Note Caller must hold the network lock


function GENETGetMACAddress(Network:PGENETNetwork; Address:PHardwareAddress):LongWord;
Description: Get the current MAC address from a GENET Network device
Address Pointer to a buffer to return the hardware address
Network The GENET Network device to get from
Return ERROR_SUCCESS if completed or another error code on failure
Note Caller must hold the network lock


function GENETSetMACAddress(Network:PGENETNetwork; Address:PHardwareAddress):LongWord;
Description: Set the current MAC address for a GENET Network device
Address Pointer to the hardware address to set
Network The GENET Network device to set for
Return ERROR_SUCCESS if completed or another error code on failure
Note Caller must hold the network lock


procedure GENETPowerUp(Network:PGENETNetwork; Mode:LongWord);
Description: To be documented
Note Caller must hold the network lock


function GENETPowerDown(Network:PGENETNetwork; Mode:LongWord):LongWord;
Description: Power down the unimac, based on mode
Note Caller must hold the network lock


procedure GENETResetUMAC(Network:PGENETNetwork);
Description: To be documented
Note Caller must hold the network lock


procedure GENETUMACReset(Network:PGENETNetwork);
Description: To be documented
Note Caller must hold the network lock


procedure GENETInitUMAC(Network:PGENETNetwork);
Description: To be documented
Note Caller must hold the network lock


function GENETInitializeDMA(Network:PGENETNetwork):LongWord;
Description: To be documented
Note Caller must hold the network lock


function GENETFinalizeDMA(Network:PGENETNetwork):LongWord;
Description: To be documented
Note Caller must hold the network lock


function GENETShutdownDMA(Network:PGENETNetwork):LongWord;
Description: To be documented
Note Caller must hold the network lock


function GENETDisableDMA(Network:PGENETNetwork; FlushRX:Boolean):LongWord;
Description: Returns a reusable DMA control register value
Note Caller must hold the network lock


procedure GENETEnableDMA(Network:PGENETNetwork; DMAControl:LongWord);
Description: To be documented
Note Caller must hold the network lock


function GENETInitRXQueues(Network:PGENETNetwork):LongWord;
Description: Initialize RX queues
Note Queues 0-15 are priority queues. Hardware Filtering Block (HFB) can be used to direct traffic to these queues. Queue 16 is the default RX queue with Q16RXDescriptorCount descriptors.

Caller must hold the network lock


procedure GENETInitTXQueues(Network:PGENETNetwork);
Description: Initialize TX queues
Note Queues 0-3 are priority-based, each one has 32 descriptors, with queue 0 being the highest priority queue. Queue 16 is the default TX queue with Q16TXDescriptorCount = 256 - 4 * 32 = 128 descriptors. The transmit control block pool is then partitioned as follows: TX queue 0 uses TXControlBlocks[0..31] TX queue 1 uses TXControlBlocks[32..63] TX queue 2 uses TXControlBlocks[64..95] TX queue 3 uses TXControlBlocks[96..127] TX queue 16 uses TXControlBlocks[128..255]

Caller must hold the network lock


function GENETInitRXRing(Network:PGENETNetwork; Index,Size,First,Last:LongWord):LongWord;
Description: Initialize an RX DMA ring
Note Caller must hold the network lock


procedure GENETInitTXRing(Network:PGENETNetwork; Index,Size,First,Last:LongWord);
Description: Initialize a TX DMA ring along with corresponding hardware registers
Note Caller must hold the network lock


function GENETAllocRXBuffers(Network:PGENETNetwork; Ring:PGENETRXRing):LongWord;
Description: Assign buffer to RX DMA descriptor
Note Caller must hold the network lock


procedure GENETFreeRXBuffers(Network:PGENETNetwork);
Description: To be documented
Note Caller must hold the network lock


procedure GENETHFBInit(Network:PGENETNetwork);
Description: To be documented
Note Caller must hold the network lock


procedure GENETHFBClear(Network:PGENETNetwork);
Description: Clear Hardware Filter Block and disable all filtering
Note Caller must hold the network lock


procedure GENETInterfaceStart(Network:PGENETNetwork);
Description: To be documented
Note Caller must hold the network lock


procedure GENETInterfaceStop(Network:PGENETNetwork);
Description: To be documented
Note Caller must hold the network lock


function GENETMIIProbe(Network:PGENETNetwork):LongWord;
Description: To be documented
Note Caller must hold the network lock


procedure GENETMIISetup(Network:PGENETNetwork);
Description: Setup netdev link state when PHY link status change and update UMAC and RGMII block when link up
Note Caller must hold the network lock


function GENETMIIConfig(Network:PGENETNetwork):LongWord;
Description: To be documented
Note Caller must hold the network lock


function GENETMIIWait(Network:PGENETNetwork):LongWord;
Description: To be documented
Note Caller must hold the network lock


function GENETPhyReadStatus(Network:PGENETNetwork):LongWord;
Description: Check the link status and update current link state
Note Caller must hold the network lock


UniMAC helper functions

procedure UniMACMDIOStart(Network:PGENETNetwork);
Description: To be documented
Note None documented


function UniMACMDIOBusy(Network:PGENETNetwork):LongWord;
Description: To be documented
Note None documented


function UniMACMDIOPoll(Network:PGENETNetwork):LongWord;
Description: To be documented
Note None documented


function UniMACMDIORead(Network:PGENETNetwork; Reg:LongWord; var Value:Word):LongWord;
Description: To be documented
Note None documented


function UniMACMDIOWrite(Network:PGENETNetwork; Reg:LongWord; Value:Word):LongWord;
Description: To be documented
Note None documented


function UniMACMDIOReset(Network:PGENETNetwork):LongWord;
Description: To be documented
Note None documented


Return to Unit Reference