Difference between revisions of "Unit SMSC95XX"

From Ultibo.org
Jump to: navigation, search
Line 267: Line 267:
 
! '''Note'''
 
! '''Note'''
 
| Request is passed to worker thread for processing to prevent blocking the USB completion
 
| Request is passed to worker thread for processing to prevent blocking the USB completion
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''SMSC95XX 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 SMSC95XXCheckDevice(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 SMSC95XXReadRegister(Device:PUSBDevice; Index:LongWord; var Data:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read from a register on the SMSC95XX 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 to registers 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 SMSC95XXWriteRegister(Device:PUSBDevice; Index,Data:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write to a register on the SMSC95XX 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 SMSC95XXModifyRegister(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 the SMSC LAN95XX 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 SMSC95XXSetRegisterBits(Device:PUSBDevice; Index,Value:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set bits in a register on the SMSC95XX 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 SMSC95XXClearRegisterBits(Device:PUSBDevice; Index,Value:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Clear bits in a register on the SMSC95XX 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 SMSC95XXSetMacAddress(Device:PUSBDevice; Address:PHardwareAddress):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the MAC address of the SMSC95XX 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 /> 
 +
<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 SMSC95XXGetMacAddress(Device:PUSBDevice; Address:PHardwareAddress):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the MAC address of the SMSC95XX 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
 
|-
 
|-
 
|}
 
|}

Revision as of 01:56, 17 October 2016

Return to Unit Reference


Description


The SMSC LAN95xx has an integrated USB Hub and is technically a compound device. Here we instead use the vendor ID and product ID of the vendor specific class device attached to the hub that is the device we actually need to communicate with. The hub will be detected and bound by the default USB Hub driver when it is enumerated by the USB core.

Constants


To be documented

Type definitions


To be documented

Public variables


To be documented

Function declarations



Initialization functions

procedure SMSC95XXInit;
Description: To be documented
Note None documented


SMSC95XX network functions

function SMSC95XXDeviceOpen(Network:PNetworkDevice):LongWord;
Description: Implementation of NetworkDeviceOpen for the SMSC95XX device
Note None documented


function SMSC95XXDeviceClose(Network:PNetworkDevice):LongWord;
Description: Implementation of NetworkDeviceClose for the SMSC95XX device
Note None documented


function SMSC95XXDeviceRead(Network:PNetworkDevice; Buffer:Pointer; Size:LongWord; var Length:LongWord):LongWord;
Description: Implementation of NetworkDeviceRead for the SMSC95XX device
Note None documented


function SMSC95XXDeviceWrite(Network:PNetworkDevice; Buffer:Pointer; Size:LongWord; var Length:LongWord):LongWord;
Description: Implementation of NetworkDeviceWrite for the SMSC95XX device
Note None documented


function SMSC95XXDeviceControl(Network:PNetworkDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Description: Implementation of NetworkDeviceControl for the SMSC95XX device
Note None documented


function SMSC95XXBufferAllocate(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferAllocate for the SMSC95XX device
Note None documented


function SMSC95XXBufferRelease(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferRelease for the SMSC95XX device
Note None documented


function SMSC95XXBufferReceive(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferReceive for the SMSC95XX device
Note None documented


function SMSC95XXBufferTransmit(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferTransmit for the SMSC95XX device
Note None documented


SMSC95XX USB functions

function SMSC95XXDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Bind the SMSC95XX driver to a USB device if it is suitable
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


function SMSC95XXDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Unbind the SMSC95XX driver from a USB device
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


procedure SMSC95XXReceiveWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request from the SMSC95XX bulk IN endpoint
Request The USB request which has completed


procedure SMSC95XXReceiveComplete(Request:PUSBRequest);
Description: Called when a USB request from the SMSC95XX bulk IN endpoint completes
Request The USB request which has completed
Note Request is passed to worker thread for processing to prevent blocking the USB completion


procedure SMSC95XXTransmitWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request to the SMSC95XX bulk OUT endpoint
Request The USB request which has completed


procedure SMSC95XXTransmitComplete(Request:PUSBRequest);
Description: Called when a USB request to the SMSC95XX bulk OUT endpoint completes
Request The USB request which has completed
Note Request is passed to worker thread for processing to prevent blocking the USB completion


procedure SMSC95XXInterruptWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request from the SMSC95XX interrupt IN endpoint
Request The USB request which has completed


procedure SMSC95XXInterruptComplete(Request:PUSBRequest);
Description: Called when a USB request from the SMSC95XX interrupt IN endpoint completes
Request The USB request which has completed
Note Request is passed to worker thread for processing to prevent blocking the USB completion


SMSC95XX helper functions

function SMSC95XXCheckDevice(Device:PUSBDevice):LongWord;
Description: Check the Vendor and Device ID against the supported devices
Device USB device to check
Return USB_STATUS_SUCCESS if completed or another error code on failure


function SMSC95XXReadRegister(Device:PUSBDevice; Index:LongWord; var Data:LongWord):LongWord;
Description: Read from a register on the SMSC95XX USB Ethernet Adapter
Device USB device to read from
Index Index of the register to read
Data Value to return to registers contents
Return USB_STATUS_SUCCESS if completed or another error code on failure


function SMSC95XXWriteRegister(Device:PUSBDevice; Index,Data:LongWord):LongWord;
Description: Write to a register on the SMSC95XX USB Ethernet Adapter
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


function SMSC95XXModifyRegister(Device:PUSBDevice; Index,Mask,Value:LongWord):LongWord;
Description: Modify the value contained in a register on the SMSC LAN95XX USB Ethernet Adapter
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


function SMSC95XXSetRegisterBits(Device:PUSBDevice; Index,Value:LongWord):LongWord;
Description: Set bits in a register on the SMSC95XX USB Ethernet Adapter
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


function SMSC95XXClearRegisterBits(Device:PUSBDevice; Index,Value:LongWord):LongWord;
Description: Clear bits in a register on the SMSC95XX USB Ethernet Adapter
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


function SMSC95XXSetMacAddress(Device:PUSBDevice; Address:PHardwareAddress):LongWord;
Description: Set the MAC address of the SMSC95XX USB Ethernet Adapter
Device USB device to write to
Address MAC address value to set
Return USB_STATUS_SUCCESS if completed or another error code on failure


function SMSC95XXGetMacAddress(Device:PUSBDevice; Address:PHardwareAddress):LongWord;
Description: Get the MAC address of the SMSC95XX USB Ethernet Adapter
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


Return to Unit Reference