#include <net/net_drvr/net_drvr.h>
Public Member Functions | |
tcNetDrvr (unsigned char *apMacAddr, void *apAddress, int anLevel, int anNumMacFilters=1) | |
~tcNetDrvr () | |
virtual int | open (tfNetRxCallback afRxCb, void *apUser) |
virtual int | open (tfNetRxCallback afRxCb, tfNetBufCallback afBufCb, void *apUser) |
virtual int | xmit (void *apBuffer, int anLen, bool abAccumulate=false) |
virtual int | mac_filter (unsigned char *apMac, bool abAdd) |
const unsigned char * | mac_addr (int anFilter=0) |
void | get_stats (tsNetDrvrStats *apStats) |
unsigned int | PhyProbe (void) |
void | SetPhy (tcDspNetPhy *apPhy) |
unsigned short | GetMIIRegister (unsigned int anRegAddr, unsigned int anPhyAddr=0xFFFFFFFF) |
int | SetMIIRegister (unsigned int anRegAddr, unsigned int anValue, unsigned int anPhyAddr=0xFFFFFFFF) |
bool | LinkUp (void) |
teNetPhyType | GetPhyType (void) |
bool | GetPhyStatus (tsNetPhyStatus &arPhyStatus) |
tcDspNetPhy * | GetPhy () |
Protected Attributes | |
volatile unsigned int * | mpBaseAddr |
firmware base address. | |
unsigned short | mnMyIntMask |
core interrupt mask. | |
int | mnMyIntLevel |
core interrupt level. | |
int | mnMyIntVector |
core interrupt vector. | |
int | mnNumMacFilters |
number of MAC filters available | |
unsigned char ** | maMacAddr |
MAC address for the network interface. | |
bool | mbOpen |
Set to true when the device is open. | |
tsNetDrvrStats | msStats |
Driver stats. | |
tfNetRxCallback | mfRxCallback |
Pointer to packet receive function. | |
tfNetBufCallback | mfRxBufCallback |
Pointer to receive buffer allocation function. | |
void * | mpUserArg |
Receive callback specific data. | |
tcDspNetPhy * | mpPhy |
PHY device in use. |
This class is the MityDSP Ethenet driver base class. Your application will create an object of a class derived from this class, then pass that object to the MityDSP net stack during startup, or if you are using raw network packets rather than the MityDSP net stack you may interface directly to the object derived from this class.
tcNetDrvr::tcNetDrvr | ( | unsigned char * | apMacAddr, |
void * | apAddress, | ||
int | anLevel, | ||
int | anNumMacFilters = 1 |
||
) |
This constructor creates the Ethernet driver.
[in] | apMacAddr | The device's 6 byte MAC address. |
[in] | apAddress | The FPGA base address for the Ethernet device. |
[in] | anLevel | Optional parameter to force a chained interrupt at the specified level. |
[in] | anNumMacFilters | Optional parameter to indicate the number of MAC address filters available in the device (default: 1). |
tcNetDrvr::~tcNetDrvr | ( | ) |
Default destructor.
|
virtual |
This function starts the Ethernet driver.
[in] | afRxCb | Pointer to the packet receive function the driver should call. |
[in] | apUser | Data specific to the packet receive function. |
Reimplemented in tcNetDrvr_B, and tcNetDrvr_645x.
|
virtual |
This routine is used to start the Ethernet driver, and register both a receive data callback, and a receive buffer allocation function.
[in] | afRxCb | Pointer to the receive data callback function. |
[in] | afBufCb | Pointer to the receive buffer allocation function. |
[in] | apUser | User data (for the callback). |
Reimplemented in tcNetDrvr_B, and tcNetDrvr_645x.
|
virtual |
This function transmits an Ethernet packet over the network.
[in] | apBuffer | Pointer to the packet to transmit. |
[in] | anLen | Number of bytes in the Ethernet packet. |
[in] | abAccumulate | True if this is a part of a larger message, buffer will sent to firmware TX FIFO, but not sent. |
Reimplemented in tcNetDrvr_B, and tcNetDrvr_645x.
|
virtual |
This function is the base class version of mac_filter. Unless overridden, there is no MAC filtering and -1 is always returned.
[in] | apMac | Pointer to MAC address to filter. |
[in] | abAdd | If true, the filter is added, otherwise it is removed (if it existed). |
Reimplemented in tcNetDrvr_B, and tcNetDrvr_645x.
const unsigned char * tcNetDrvr::mac_addr | ( | int | anFilter = 0 | ) |
void tcNetDrvr::get_stats | ( | tsNetDrvrStats * | apStats | ) |
This function retrieves the driver stats.
[out] | apStats | Pointer to structure to receive the stats. |
unsigned int tcNetDrvr::PhyProbe | ( | void | ) |
This routine probes for valid MII manufacturer registers.
void tcNetDrvr::SetPhy | ( | tcDspNetPhy * | apPhy | ) |
This routine sets the member phy device to a phy specified by application code
apPhy | the phy for the driver to use |
unsigned short tcNetDrvr::GetMIIRegister | ( | unsigned int | anRegAddr, |
unsigned int | anPhyAddr = 0xFFFFFFFF |
||
) |
This routine is used to read the current value stored in an MII Register.
[in] | anRegAddr | The offset to the desired MII register |
[in] | anPhyAddr | The address of the PHY (default:0) |
Reimplemented in tcNetDrvr_645x.
int tcNetDrvr::SetMIIRegister | ( | unsigned int | anRegAddr, |
unsigned int | anValue, | ||
unsigned int | anPhyAddr = 0xFFFFFFFF |
||
) |
This routine is used to set the specified 16-bit value to an MII Register.
[in] | anRegAddr | The offset to the desired MII register |
[in] | anValue | Value to write to the register. |
[in] | anPhyAddr | The address of the PHY (default:0xFFFFFFFF) |
Reimplemented in tcNetDrvr_645x.
bool tcNetDrvr::LinkUp | ( | void | ) |
This routine returns whether or not the ethernet link is up. Register.
Reimplemented in tcNetDrvr_645x.
teNetPhyType tcNetDrvr::GetPhyType | ( | void | ) |
This routine is used to get the type of PHY in use.
Reimplemented in tcNetDrvr_645x.
bool tcNetDrvr::GetPhyStatus | ( | tsNetPhyStatus & | arPhyStatus | ) |
This routine is used to gather certain status information from the PHY.
[out] | arPhyStatus | Reference to a PHY status structure. |
Reimplemented in tcNetDrvr_645x.
|
inline |
|
protected |
firmware base address.
|
protected |
core interrupt mask.
|
protected |
core interrupt level.
|
protected |
core interrupt vector.
|
protected |
number of MAC filters available
|
protected |
MAC address for the network interface.
|
protected |
Set to true when the device is open.
|
protected |
Driver stats.
|
protected |
Pointer to packet receive function.
|
protected |
Pointer to receive buffer allocation function.
|
protected |
Receive callback specific data.
|
protected |
PHY device in use.