Difference between revisions of "Unit LAN78XX"
(One intermediate revision by the same user not shown) | |||
Line 3,568: | Line 3,568: | ||
---- | ---- | ||
− | |||
+ | '''Initialization functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure LAN78XXInit;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the LAN78XX unit, create and register the driver</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Called only during system startup | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''LAN78XX network functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXNetworkOpen(Network:PNetworkDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkDeviceOpen for the LAN78XX device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use NetworkDeviceOpen instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXNetworkClose(Network:PNetworkDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkDeviceClose for the LAN78XX device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use NetworkDeviceClose instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXNetworkControl(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkDeviceControl for the LAN78XX device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use NetworkDeviceControl instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXBufferAllocate(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkBufferAllocate for the LAN78XX device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use NetworkBufferAllocate instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXBufferRelease(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkBufferRelease for the LAN78XX device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use NetworkBufferRelease instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXBufferReceive(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkBufferReceive for the LAN78XX device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use NetworkBufferReceive instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXBufferTransmit(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkBufferTransmit for the LAN78XX device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use NetworkBufferTransmit instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure LAN78XXTransmitStart(Network:PLAN78XXNetwork);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Transmit start function for the LAN78XX Network device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications | ||
+ | Caller must hold the network lock | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''LAN78XX USB functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Bind the LAN78XX driver to a USB device if it is suitable</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | The USB device to attempt to bind to | ||
+ | |- | ||
+ | ! Interrface | ||
+ | | The USB interface to attempt to bind to (or nil for whole device) | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the LAN78XX driver from a USB device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | The USB device to unbind from | ||
+ | |- | ||
+ | ! Interrface | ||
+ | | The USB interface to unbind from (or nil for whole device) | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure LAN78XXReceiveWorker(Request:PUSBRequest);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called (by a Worker thread) to process a completed USB request from the LAN78XX bulk IN endpoint</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Request | ||
+ | | The USB request which has completed | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure LAN78XXReceiveComplete(Request:PUSBRequest);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from the LAN78XX bulk IN endpoint completes</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Request | ||
+ | | The USB request which has completed | ||
+ | |- | ||
+ | ! Note | ||
+ | | Request is passed to worker thread for processing to prevent blocking the USB completion | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure LAN78XXTransmitWorker(Request:PUSBRequest);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called (by a Worker thread) to process a completed USB request to the LAN78XX bulk OUT endpoint</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Request | ||
+ | | The USB request which has completed | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure LAN78XXTransmitComplete(Request:PUSBRequest);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request to the LAN78XX bulk OUT endpoint completes</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Request | ||
+ | | The USB request which has completed | ||
+ | |- | ||
+ | ! Note | ||
+ | | Request is passed to worker thread for processing to prevent blocking the USB completion | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure LAN78XXInterruptWorker(Request:PUSBRequest);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called (by a Worker thread) to process a completed USB request from the LAN78XX interrupt IN endpoint</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Request | ||
+ | | The USB request which has completed | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure LAN78XXInterruptComplete(Request:PUSBRequest);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from the LAN78XX interrupt IN endpoint completes</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Request | ||
+ | | The USB request which has completed | ||
+ | |- | ||
+ | ! Note | ||
+ | | Request is passed to worker thread for processing to prevent blocking the USB completion | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''LAN78XX helper functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXCheckDevice(Device:PUSBDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check the Vendor and Device ID against the supported devices</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to check | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXReadRegister(Device:PUSBDevice; Index:LongWord; var Data:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read from a register on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to read from | ||
+ | |- | ||
+ | ! Index | ||
+ | | Index of the register to read | ||
+ | |- | ||
+ | ! Data | ||
+ | | Value to return the register contents | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXWriteRegister(Device:PUSBDevice; Index,Data:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write to a register on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to write to | ||
+ | |- | ||
+ | ! Index | ||
+ | | Index of the register to write | ||
+ | |- | ||
+ | ! Data | ||
+ | | Value to write to the register | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXModifyRegister(Device:PUSBDevice; Index,Mask,Value:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Modify the value contained in a register on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to modify | ||
+ | |- | ||
+ | ! Index | ||
+ | | Index of the register to modify | ||
+ | |- | ||
+ | ! Mask | ||
+ | | Mask that contains 1 for the bits where the old value in the register will be kept rather than cleared (unless those bits also appear in Value, in which case they will still be set). | ||
+ | |- | ||
+ | ! Value | ||
+ | | Mask of bits to set in the register | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXSetRegisterBits(Device:PUSBDevice; Index,Value:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set bits in a register on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to write to | ||
+ | |- | ||
+ | ! Index | ||
+ | | Index of the register to modify | ||
+ | |- | ||
+ | ! Value | ||
+ | | Bits to set in the register. At positions where there is a 0, the old value in the register will be written. | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXClearRegisterBits(Device:PUSBDevice; Index,Value:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Clear bits in a register on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to write to | ||
+ | |- | ||
+ | ! Index | ||
+ | | Index of the register to modify | ||
+ | |- | ||
+ | ! Value | ||
+ | | Bits to clear in the register. At positions where there is a 0, the old value in the register will be written. | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXPHYRead(Device:PUSBDevice; Index:LongWord; var Value:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read a register from the MII Management serial interface on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to read from | ||
+ | |- | ||
+ | ! Index | ||
+ | | Index of the register to read | ||
+ | |- | ||
+ | ! Value | ||
+ | | Value to return the register contents | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXPHYWrite(Device:PUSBDevice; Index:LongWord; Value:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write a register to the MII Management serial interface on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to write to | ||
+ | |- | ||
+ | ! Index | ||
+ | | Index of the register to write | ||
+ | |- | ||
+ | ! Value | ||
+ | | Value to write to the register | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXPHYInitialize(Device:PUSBDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize default MII Management serial interface options on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to initialize | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXPHYWaitNotBusy(Device:PUSBDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Wait for the MII Management serial interface to be not busy on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to wait for | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | ! Note | ||
+ | | Caller must hold the PHY Lock | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXReadEEPROM(Device:PUSBDevice; Offset,Length:LongWord; Data:PByte):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read from the EEPROM (if present) on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to read from | ||
+ | |- | ||
+ | ! Offset | ||
+ | | The byte offset to start reading | ||
+ | |- | ||
+ | ! Length | ||
+ | | The number of bytes to read | ||
+ | |- | ||
+ | ! Data | ||
+ | | Pointer to a buffer to receive the data | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXReadRawEEPROM(Device:PUSBDevice; Offset,Length:LongWord; Data:PByte):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read from the EEPROM (if present) without signature check on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to read from | ||
+ | |- | ||
+ | ! Offset | ||
+ | | The byte offset to start reading | ||
+ | |- | ||
+ | ! Length | ||
+ | | The number of bytes to read | ||
+ | |- | ||
+ | ! Data | ||
+ | | Pointer to a buffer to receive the data | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXReadOTP(Device:PUSBDevice; Offset,Length:LongWord; Data:PByte):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read from the OTP (if present) on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to read from | ||
+ | |- | ||
+ | ! Offset | ||
+ | | The byte offset to start reading | ||
+ | |- | ||
+ | ! Length | ||
+ | | The number of bytes to read | ||
+ | |- | ||
+ | ! Data | ||
+ | | Pointer to a buffer to receive the data | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXReadRawOTP(Device:PUSBDevice; Offset,Length:LongWord; Data:PByte):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read from the OTP (if present) without signature check on a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to read from | ||
+ | |- | ||
+ | ! Offset | ||
+ | | The byte offset to start reading | ||
+ | |- | ||
+ | ! Length | ||
+ | | The number of bytes to read | ||
+ | |- | ||
+ | ! Data | ||
+ | | Pointer to a buffer to receive the data | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXGetStatistics(Device:PUSBDevice; var Statistics:TLAN78XXStatistics):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the statistics from a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to read from | ||
+ | |- | ||
+ | ! Statistics | ||
+ | | The returned statistics from the device | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXGetMacAddress(Device:PUSBDevice; Address:PHardwareAddress):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the MAC address of a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device read from | ||
+ | |- | ||
+ | ! Address | ||
+ | | Value to read the MAC address into | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LAN78XXSetMacAddress(Device:PUSBDevice; Address:PHardwareAddress):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the MAC address of a LAN78XX USB Ethernet Adapter</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Device | ||
+ | | USB device to write to | ||
+ | |- | ||
+ | ! Address | ||
+ | | MAC address value to set | ||
+ | |- | ||
+ | ! Return | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
Return to [[Unit_Reference|Unit Reference]] | Return to [[Unit_Reference|Unit Reference]] |
Latest revision as of 04:33, 24 April 2018
Return to Unit Reference
Contents
[hide]Description
Microchip LAN78xx USB Ethernet Driver unit
The Microchip LAN78xx is a USB 3.1 to 10/100/1000 Gigabit Ethernet bridge device which supports 10BASE-T, 100BASE-TX and 1000BASE-T. Both USB 2.0 High Speed and USB 3.1 Super Speed interfaces are supported using a pair of Bulk Endpoints and an Interrupt Endpoint for signalling status changes and other events. The Raspberry Pi 3B+ contains a variant of this device called a LAN7515 which is a combination device containing a LAN78xx Gigabit Ethernet controller and two 4 port USB 2.0 compatible hubs. The hubs will be detected and bound by the default USB Hub driver when they are enumerated by the USB core.
Constants
LAN78XX_*
LAN78XX_USB_VENDOR_*
LAN78XX_INT_ENP_*
LAN78XX_*_PKT_ALIGNMENT
LAN78XX_TX_CMD_A_*
LAN78XX_TX_CMD_B_*
LAN78XX_RX_CMD_A_*
LAN78XX_RX_CMD_B_*
LAN78XX_RX_CMD_C_*
LAN78XX_NUMBER_*
LAN78XX_ID_REV_*
LAN78XX_FPGA_REV_*
LAN78XX_INT_STS_*
LAN78XX_HW_CFG_*
LAN78XX_PMT_CTL_*
LAN78XX_GPIO_CFG0_*
LAN78XX_GPIO_CFG1_*
LAN78XX_GPIO_WAKE_*
LAN78XX_DP_SEL_*
LAN78XX_DP_CMD_*
LAN78XX_DP_ADDR_*
LAN78XX_DP_DATA_*
LAN78XX_E2P_CMD_*
LAN78XX_E2P_DATA_*
LAN78XX_BOS_ATTR_*
LAN78XX_SS_ATTR_*
LAN78XX_HS_ATTR_*
LAN78XX_FS_ATTR_*
LAN78XX_STR_ATTR0_*
LAN78XX_STR_ATTR1_*
LAN78XX_STR_FLAG_*
LAN78XX_USB_CFG0_*
LAN78XX_USB_CFG1_*
LAN78XX_USB_CFG2_*
LAN78XX_BURST_CAP_*
LAN78XX_BULK_IN_*
LAN78XX_INT_EP*
LAN78XX_PIPE_CTL_*
LAN78XX_U1_LATENCY_*
LAN78XX_U2_LATENCY_*
LAN78XX_USB_STATUS_*
LAN78XX_USB_CFG3_*
LAN78XX_RFE_CTL_*
LAN78XX_VLAN_TYPE_*
LAN78XX_FCT_RX_*
LAN78XX_FCT_TX_*
LAN78XX_FCT_RX_FIFO_*
LAN78XX_FCT_TX_FIFO_*
LAN78XX_FCT_FLOW_*
LAN78XX_RX_DP_STOR*
LAN78XX_TX_DP_STOR_*
LAN78XX_LTM_BELT_IDLE0_*
LAN78XX_LTM_BELT_IDLE1_*
LAN78XX_LTM_BELT_ACT0_*
LAN78XX_LTM_BELT_ACT1_*
LAN78XX_LTM_INACTIVE0_*
LAN78XX_LTM_INACTIVE1_*
LAN78XX_MAC_CR_*
LAN78XX_MAC_RX_*
LAN78XX_MAC_TX_*
LAN78XX_FLOW_*
LAN78XX_RAND_SEED_*
LAN78XX_ERR_STS_*
LAN78XX_RX_ADDRH_*
LAN78XX_RX_ADDRL_*
LAN78XX_MII_ACC_*
LAN78XX_MII_DATA_*
LAN78XX_MAC_RGMII_ID_*
LAN78XX_EEE_TX_LPI_REQ_*
LAN78XX_EEE_TW_TX_*
LAN78XX_EEE_TX_LPI_REM_*
LAN78XX_WUCSR_*
LAN78XX_WK_SRC_*
LAN78XX_WUF_CFG0_*
LAN78XX_WUF_MASK_*
LAN78XX_MAF_*
LAN78XX_WUCSR2_*
LAN78XX_NS1_IPV6_ADDR_DEST_*
LAN78XX_NS1_IPV6_ADDR_SRC_*
LAN78XX_NS1_ICMPV6_ADDR_*
LAN78XX_NS1_ICMPV6_ADDR1_*
LAN78XX_NS2_IPV6_ADDR_DEST_*
LAN78XX_NS2_IPV6_ADDR_SRC_*
LAN78XX_NS2_ICMPV6_ADDR0_*
LAN78XX_NS2_ICMPV6_ADDR1_*
LAN78XX_SYN_IPV4_ADDR_SRC_*
LAN78XX_SYN_IPV4_ADDR_DEST_*
LAN78XX_SYN_IPV4_TCP_PORTS_*
LAN78XX_SYN_IPV6_ADDR_SRC_*
LAN78XX_SYN_IPV6_ADDR_DEST_*
LAN78XX_SYN_IPV6_TCP_PORTS_*
LAN78XX_ARP_SPA_*
LAN78XX_ARP_TPA_*
LAN78XX_PHY_DEV_ID_*
LAN78XX_OTP_*
LAN88XX_INT_MASK_*
LAN88XX_INT_STS_*
LAN88XX_EXT_PAGE_*
LAN88XX_EXT_MODE_CTRL_*
LAN88XX_MMD3_*
Type definitions
LAN78XX network
LAN78XX statistics
Public variables
None defined
Function declarations
Initialization functions
procedure LAN78XXInit;
LAN78XX network functions
function LAN78XXNetworkOpen(Network:PNetworkDevice):LongWord;
function LAN78XXNetworkClose(Network:PNetworkDevice):LongWord;
function LAN78XXNetworkControl(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
function LAN78XXBufferAllocate(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
function LAN78XXBufferRelease(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
function LAN78XXBufferReceive(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
function LAN78XXBufferTransmit(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
procedure LAN78XXTransmitStart(Network:PLAN78XXNetwork);
LAN78XX USB functions
function LAN78XXDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
function LAN78XXDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
procedure LAN78XXReceiveWorker(Request:PUSBRequest);
procedure LAN78XXReceiveComplete(Request:PUSBRequest);
procedure LAN78XXTransmitWorker(Request:PUSBRequest);
procedure LAN78XXTransmitComplete(Request:PUSBRequest);
procedure LAN78XXInterruptWorker(Request:PUSBRequest);
procedure LAN78XXInterruptComplete(Request:PUSBRequest);
LAN78XX helper functions
function LAN78XXCheckDevice(Device:PUSBDevice):LongWord;
function LAN78XXReadRegister(Device:PUSBDevice; Index:LongWord; var Data:LongWord):LongWord;
function LAN78XXWriteRegister(Device:PUSBDevice; Index,Data:LongWord):LongWord;
function LAN78XXModifyRegister(Device:PUSBDevice; Index,Mask,Value:LongWord):LongWord;
function LAN78XXSetRegisterBits(Device:PUSBDevice; Index,Value:LongWord):LongWord;
function LAN78XXClearRegisterBits(Device:PUSBDevice; Index,Value:LongWord):LongWord;
function LAN78XXPHYRead(Device:PUSBDevice; Index:LongWord; var Value:Word):LongWord;
function LAN78XXPHYWrite(Device:PUSBDevice; Index:LongWord; Value:Word):LongWord;
function LAN78XXPHYInitialize(Device:PUSBDevice):LongWord;
function LAN78XXPHYWaitNotBusy(Device:PUSBDevice):LongWord;
function LAN78XXReadEEPROM(Device:PUSBDevice; Offset,Length:LongWord; Data:PByte):LongWord;
function LAN78XXReadRawEEPROM(Device:PUSBDevice; Offset,Length:LongWord; Data:PByte):LongWord;
function LAN78XXReadOTP(Device:PUSBDevice; Offset,Length:LongWord; Data:PByte):LongWord;
function LAN78XXReadRawOTP(Device:PUSBDevice; Offset,Length:LongWord; Data:PByte):LongWord;
function LAN78XXGetStatistics(Device:PUSBDevice; var Statistics:TLAN78XXStatistics):LongWord;
function LAN78XXGetMacAddress(Device:PUSBDevice; Address:PHardwareAddress):LongWord;
function LAN78XXSetMacAddress(Device:PUSBDevice; Address:PHardwareAddress):LongWord;
Return to Unit Reference