#include <net/net_drvr/net_drvr_b.h>
Public Member Functions | |
tcNetDrvr_B (unsigned char *apMacAddr, void *apAddress, int anLevel=MityDSP::gnAutoLevel, bool abUseTxQdma=true, bool abUseRxQdma=true, int anRxThreadPriority=gnDefaultRxThreadPriority) | |
~tcNetDrvr_B () | |
int | open (tfNetRxCallback afRxCb, void *apUser) |
int | open (tfNetRxCallback afRxCb, tfNetBufCallback afBufCb, void *apUser) |
int | xmit (void *apBuffer, int anLen, bool abAccumulate=false) |
int | mac_filter (unsigned char *apMac, bool abAdd) |
Public Member Functions inherited from tcNetDrvr | |
tcNetDrvr (unsigned char *apMacAddr, void *apAddress, int anLevel, int anNumMacFilters=1) | |
~tcNetDrvr () | |
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 () |
Static Public Attributes | |
static const int | gnDefaultRxThreadPriority = 14 |
Protected Member Functions | |
void | NetB_Isr (void) |
void | RxDmaThread (void) |
int | WaitLastPktOut (void) |
void | ProgramMac (int anIdx, unsigned char *apMac) |
Static Protected Member Functions | |
static int | isr_dispatch (Arg ahMyObject) |
static int | rcvr_dma_dispath (Arg ahMyObject) |
Protected Attributes | |
SEM_Handle | mhTxDataReady |
Semaphore for use by TX DMA engine. | |
SEM_Handle | mhRxDataReady |
Semaphore for use by RX DMA engine. | |
LCK_Handle | mhMutex |
Serialize access, where required. | |
CACHE_L2Mode | msL2Mode |
bool | mbUseTxQdma |
Controls TX DMA usage. | |
bool | mbUseRxQdma |
Controls RX DMA usage. | |
int | mnRxThreadPriority |
Sets RX thread priority (if DMA used) | |
unsigned int | mnPhyAddr |
Default PHY internal address. | |
unsigned int * | maStaging |
DMA staging buffer. | |
unsigned int * | maStagingMem |
Staging buffer pre cache alignment. | |
int | mnTxLength |
Bytes currently in TX FIFO. | |
Protected Attributes inherited from tcNetDrvr | |
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. |
Static Protected Attributes | |
static const int | gnMAX_XFER_SIZE = TCP_MSS + PBUF_LINK_HLEN + 40 |
Max network packet size. | |
static const int | gnETH_HDR_SIZE = PBUF_LINK_HLEN |
Normally 14 bytes for ethernet. | |
static const int | gnCRC_SIZE = 4 |
Firmware CRC on end of packet. | |
static unsigned int | mnTicksPerMSec = CLK_countspms() / CLK_getprd() |
Conversion from low res clock ticks to msecs. |
This class is the MityDSP Ethenet driver class for a 32 bit wide data bus to the FPGA and a FIFO memory map for the FPGA packet buffers.
tcNetDrvr_B::tcNetDrvr_B | ( | unsigned char * | apMacAddr, |
void * | apAddress, | ||
int | anLevel = MityDSP::gnAutoLevel , |
||
bool | abUseTxQdma = true , |
||
bool | abUseRxQdma = true , |
||
int | anRxThreadPriority = gnDefaultRxThreadPriority |
||
) |
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] | abUseTxQdma | Use QDMA for large packet transmits (default: true) |
[in] | abUseRxQdma | Use QDMA for receive (default: true) |
[in] | anRxThreadPriority | Sets priority of the receive DMA thread (used only when abUseRxQdma is true, default: 14) |
tcNetDrvr_B::~tcNetDrvr_B | ( | ) |
Destructor for the Ethernet driver.
|
virtual |
This routine is used to open an ethernet interface. The receive ISR (and receive thread, if DMAs are being used) are installed, the MAC address is set, and the chip is enabled.
[in] | afRxCb | Pointer to the receive data callback function. |
[in] | apUser | User data (for the callback). |
Reimplemented from tcNetDrvr.
|
virtual |
This routine is used to open an ethernet interface, 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 from tcNetDrvr.
|
virtual |
This routine is used to transmit a buffer of data out the ethernet interface.
[in] | apBuffer | Pointer to the data buffer. |
[in] | anLength | Length of the buffer. |
[in] | abAccumulate | True if this is a part of a larger message, buffer will sent to firmware TX FIFO, but not sent. |
Reimplemented from tcNetDrvr.
|
virtual |
External method to add/remove a given MAC filter.
[in] | apMac | Pointer to a six-byte MAC address |
[in] | abAdd | If true, the given MAC is added, otherwise it is removed |
Reimplemented from tcNetDrvr.
|
staticprotected |
Static interrupt dispatch routine. Required because of the hidden this pointer associated with a member function, which cannot be passed directly to the interrupt dispatcher.
[in] | ahMyObject | The "this->" pointer for the instance of tcNetDrvr_B associated with this ISR. |
|
staticprotected |
Static thread dispatch routine. Required because of the hidden this pointer associated with a member function, which cannot be passed directly to the thread dispatcher.
[in] | ahMyObject | The "this->" pointer for the instance of tcNetDrvr_B associated with this thread. |
|
protected |
This routine is the ISR that services ethernet receive interrupts. If DMA transfers are being used, interrupts are disabled and the rcvr_thread is notified via a semaphore to schedule a DMA. Otherwise, data is copied from the device to a staging buffer.
|
protected |
When using DMA transfers, this thread is started to receive data sent from within the ISR. The ISR sets a semaphore, which wakes up this thread to monitor for completion of the DMA. When the DMA is complete, the buffer is sent to the receive callback.
|
protected |
This routine returns whether or not the last packet queued for transmit has been sent.
|
protected |
Internal method to update a particular MAC filter in the core.
[in] | anIdx | Filter number to program |
[in] | apMac | Pointer to a six-byte MAC address |
|
static |
|
staticprotected |
Max network packet size.
|
staticprotected |
Normally 14 bytes for ethernet.
|
staticprotected |
Firmware CRC on end of packet.
|
staticprotected |
Conversion from low res clock ticks to msecs.
|
protected |
Semaphore for use by TX DMA engine.
|
protected |
Semaphore for use by RX DMA engine.
|
protected |
Serialize access, where required.
|
protected |
|
protected |
Controls TX DMA usage.
|
protected |
Controls RX DMA usage.
|
protected |
Sets RX thread priority (if DMA used)
|
protected |
Default PHY internal address.
|
protected |
DMA staging buffer.
|
protected |
Staging buffer pre cache alignment.
|
protected |
Bytes currently in TX FIFO.