Unit SMC91X

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


SMSC 91C9x/91C1xx Ethernet Driver unit

The SMSC 91C9x/91C1xx are a family of Non-PCI 10/100 Ethernet Single Chip MAC + PHY devices.

This driver is primarily intended to support the LAN91C111 Ethernet device included in the QEMU Versatile PB emulation however the driver is based on the equivalent Linux driver and as such includes (untested) support for a number of chip variants (see SMC91X_CHIP_* constants below).

The QEMU emulation does not include support for a number of the features provided in the real chip so they are either currently not supported or are untested without access to a physical chip implementation for testing.

Constants



[Expand]
SMC91X specific constants SMC91X_*


[Expand]
SMC91X transmit control register SMC91X_TCR_*


[Expand]
SMC91X EPH status (Ethernet Protocol Handler) SMC91X_EPH_STATUS_*


[Expand]
SMC91X receive control register SMC91X_RCR_*


[Expand]
SMC91X receive/PHY control SMC91X_RPC_*


[Expand]
SMC91X configuration SMC91X_CONFIG_*


[Expand]
SMC91X control SMC91X_CTL_*


[Expand]
SMC91X MMU command SMC91X_MMU_CMD_*


[Expand]
SMC91X allocation result SMC91X_AR_*


[Expand]
SMC91X TX FIFO ports SMC91X_TXFIFO_*


[Expand]
SMC91X RX FIFO ports SMC91X_RXFIFO_*


[Expand]
SMC91X pointer SMC91X_PTR_*


[Expand]
SMC91X interrupt mask SMC91X_IM_*


[Expand]
SMC91X management interface SMC91X_MII_*


[Expand]
SMC91X receive SMC91X_RCV_THRESHOLD*


[Expand]
SMC91X receive status SMC91X_RCV_*


[Expand]
SMC91X bank select SMC91X_BANK_SELECT_*


[Expand]
SMC91X chip SMC91X_CHIP_*


[Expand]
SMC91X PHY Ids SMC91X_PHY_*


Type definitions



SMC91X bank 0 registers

[Expand]

TSMC91XBank0Registers = packed record

SMC91X bank 1 registers

[Expand]

TSMC91XBank1Registers = packed record

SMC91X FIFO registers

[Expand]

TSMC91XFIFORegisters = packed record

SMC91X DATA registers

[Expand]

TSMC91XDATARegisters = packed record

SMC91X bank 2 registers

[Expand]

TSMC91XBank2Registers = packed record

SMC91X bank 3 registers

[Expand]

TSMC91XBank3Registers = packed record

SMC91X registers

[Expand]

PSMC91XRegisters = ^TSMC91XRegisters;

TSMC91XRegisters = packed record

SMC91X network

[Expand]

PSMC91XNetwork = ^TSMC91XNetwork;

TSMC91XNetwork = record


Public variables



SMC91X specific variables

SMC91X_ALLOCATE_WAIT_COUNT:LongWord = 16; How long to wait for the SMC91X to allocate memory before deferring a packet
SMC91X_MAX_IRQ_COUNT:LongWord = 8; How many iterations of the interrupt handler are allowed on each interrupt
SMC91X_THROTTLE_TRANSMIT:Boolean = False; Determines if TX packets are sent one at a time or queued into SMC91X internal memory


Function declarations



SMC91X functions

[Expand]
function SMC91XNetworkCreate(Address:PtrUInt; const Name:String; IRQ:LongWord):PNetworkDevice;
Description: Create and register a new SMC91X Network device which can be accessed using the Network API


[Expand]
function SMC91XNetworkDestroy(Network:PNetworkDevice):LongWord;
Description: Close, deregister and destroy an SMC91X Network device created by this driver


SMC91X network functions

[Expand]
function SMC91XNetworkOpen(Network:PNetworkDevice):LongWord;
Description: Implementation of NetworkDeviceOpen API for SMC91X Network


[Expand]
function SMC91XNetworkClose(Network:PNetworkDevice):LongWord;
Description: Implementation of NetworkDeviceClose API for SMC91X Network


[Expand]
function SMC91XNetworkControl(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
Description: Implementation of NetworkDeviceControl API for SMC91X Network


[Expand]
function SMC91XBufferAllocate(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferAllocate API for SMC91X Network


[Expand]
function SMC91XBufferRelease(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferRelease API for SMC91X Network


[Expand]
function SMC91XBufferReceive(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferReceive API for SMC91X Network


[Expand]
function SMC91XBufferTransmit(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferTransmit API for SMC91X Network


[Expand]
procedure SMC91XInterruptHandler(Network:PSMC91XNetwork);
Description: Interrupt handler for the SMC91X Network device


[Expand]
procedure SMC91XInterruptReceive(Network:PSMC91XNetwork);
Description: Interrupt receive handler for the SMC91X Network device


[Expand]
procedure SMC91XInterruptTransmit(Network:PSMC91XNetwork);
Description: Interrupt transmit handler for the SMC91X Network device


[Expand]
function SMC91XCompletionExecute(Network:PSMC91XNetwork):PtrInt;
Description: Completion handler thread for the SMC91X Network device


[Expand]
procedure SMC91XTransmitStart(Network:PSMC91XNetwork);
Description: Transmit start function for the SMC91X Network device


[Expand]
procedure SMC91XTransmitPacket(Network:PSMC91XNetwork; Entry:PNetworkEntry; Packet:PNetworkPacket);
Description: Transmit packet function for the SMC91X Network device


SMC91X helper functions

[Expand]
function SMC91XCurrentBank(Network:PSMC91XNetwork):Word; inline;
Description: Get the currently selected bank from the bank select register


[Expand]
procedure SMC91XSelectBank(Network:PSMC91XNetwork; Bank:Byte); inline;
Description: Set the currently selected bank in the bank select register


[Expand]
function SMC91XGetBase(Network:PSMC91XNetwork):Word; inline;
Description: Get the base address register from a SMC91X Network device


[Expand]
function SMC91XGetRevision(Network:PSMC91XNetwork):Word; inline;
Description: Get the revision register from a SMC91X Network device


[Expand]
procedure SMC91XWaitMMUBusy(Network:PSMC91XNetwork); inline;
Description: Wait for the MMU command register BUSY bit to be cleared for a SMC91X Network device


[Expand]
procedure SMC91XSetMMUCommand(Network:PSMC91XNetwork; Command:Word); inline;
Description: Set the MMU command register of a SMC91X Network device


[Expand]
procedure SMC91XSetInterruptMask(Network:PSMC91XNetwork; Mask:Byte); inline;
Description: Enable the specified mask in the interrupt mask register of a SMC91X Network device


[Expand]
procedure SMC91XEnableInterrupt(Network:PSMC91XNetwork; Interrupt:Byte);
Description: Enable the specified interrupt in the interrupt mask register of a SMC91X Network device


[Expand]
procedure SMC91XDisableInterrupt(Network:PSMC91XNetwork; Interrupt:Byte); 
Description: Disable the specified interrupt in the interrupt mask register of a SMC91X Network device


[Expand]
function SMC91XReset(Network:PSMC91XNetwork):LongWord;
Description: Reset a SMC91X Network device


[Expand]
function SMC91XEnable(Network:PSMC91XNetwork):LongWord;
Description: Enable a SMC91X Network device and start sending and receiving


[Expand]
function SMC91XShutdown(Network:PSMC91XNetwork):LongWord;
Description: Shutdown a SMC91X Network device and stop sending and receiving


[Expand]
function SMC91XGetMACAddress(Network:PSMC91XNetwork; Address:PHardwareAddress):LongWord;
Description: Get the current MAC address from a SMC91X Network device


[Expand]
function SMC91XSetMACAddress(Network:PSMC91XNetwork; Address:PHardwareAddress):LongWord;
Description: Set the current MAC address for a SMC91X Network device


[Expand]
function SMC91XMIIIn(Network:PSMC91XNetwork; Bits:LongWord):LongWord;
Description: Input data from the MII Management serial interface


[Expand]
procedure SMC91XMIIOut(Network:PSMC91XNetwork; Value,Bits:LongWord);
Description: Output data to the MII Management serial interface


[Expand]
function SMC91XPHYRead(Network:PSMC91XNetwork; Addr,Reg:LongWord):LongWord;
Description: Reads a register from the MII Management serial interface


[Expand]
procedure SMC91XPHYWrite(Network:PSMC91XNetwork; Addr,Reg,Data:LongWord);
Description: Writes a register to the MII Management serial interface


[Expand]
function SMC91XPHYDetect(Network:PSMC91XNetwork):LongWord;
Description: Detect the PHY type used in a SMC91X device


[Expand]
function SMC91XPHYReset(Network:PSMC91XNetwork):LongWord;
Description: Perform a software reset on the PHY in a SMC91X device


[Expand]
function SMC91XPHYFixed(Network:PSMC91XNetwork):LongWord;
Description: Configure the PHY with a fixed configuration on a SMC91x device


[Expand]
function SMC91XPHYConfigure(Network:PSMC91XNetwork):LongWord;
Description: Configure the PHY using auto-negotiation on a SMC91x device


[Expand]
function SMC91XPHYPowerdown(Network:PSMC91XNetwork):LongWord;
Description: Power down a PHY on a SMC91X device


[Expand]
function SMC91XPHYCheckMedia(Network:PSMC91XNetwork):LongWord;
Description: Check the media status of a PHY on a SMC91X device


Return to Unit Reference