Public Member Functions |
| tcNetDrvr_645x (unsigned char *apMacAddr, int anHWILevel) |
| ~tcNetDrvr_645x () |
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) |
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) |
| 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) |
tcDspNetPhy * | GetPhy () |
This class is the TMS320645x Ethenet driver class. It is currently an alpha level driver. Support for nominal MDIO querying, transmission and reception of packets for the 100 MBit standard MII interface is available. This class is intended to integrate with the MityDSP lwIP TCP/IP stack implementation.
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.
- Parameters:
-
[in] | afRxCb | Pointer to the receive data callback function. |
[in] | apUser | User data (for the callback). |
- Returns:
- 0 if successful, -1 otherwise.
From SPRU975
- If enabled, clear the device interrupt enable in EWCTL.
- Clear the MACCONTROL, RXCONTROL, and TXCONTROL registers (not necessary immediately after reset).
- Initialize all 16 Head Descriptor Pointer registers (RX n HDP and TX n HDP) to 0.
- Clear all 36 statistics registers by writing 0 (not necessary immediately after reset).
- Initialize all 32 receive address RAM locations to 0. Set up the addresses to be matched to the eight receive channels and the addresses to be filtered, through programming the MACINDEX, MACADDRHI, and MACADDRLO registers.
- Initialize the RX n FREEBUFFER, RX n FLOWTHRESH, and RXFILTERLOWTHRESH registers, if buffer flow control is to be enabled. Program the FIFOCONTROL register is FIFO flow control is desired.
- Most device drivers open with no multicast addresses, so clear the MACHASH1 and MACHASH2 registers.
- Write the RXBUFFEROFFSET register value (typically zero).
- Initially clear all unicast channels by writing FFh to the RXUNICASTCLEAR register. If unicast is desired, it can be enabled now by writing the RXUNICASTSET register. Some drivers will default to unicast on device open while others will not.
If you desire to transfer jumbo frames, set the RXMAXLEN register to the maximum frame length you want to allow to be received.
- Set up the RXMBPENABLE register with an initial configuration. The configuration is based on the current receive filter settings of the device driver. Some drivers may enable things like broadcast and multicast packets immediately, while others may not.
- Set the appropriate configuration bits in the MACCONTROL register (do not set the GMIIEN bit yet).
- Clear all unused channel interrupt bits by writing RXINTMASKCLEAR and TXINTMASKCLEAR.
- Enable the receive and transmit channel interrupt bits in RXINTMASKSET and TXINTMASKSET for the channels to be used, and enable the HOSTMASK and STATMASK bits using the MACINTMASKSET register.
- Initialize the receive and transmit descriptor list queues using the 8K descriptor memory block contained in the EMAC control module.
- Prepare receive by writing a pointer to the head of the receive buffer descriptor list to RX n HDP.
- Enable the receive and transmit DMA controllers by setting the RXEN bit in the RXCONTROL register and the TXEN bit in the TXCONTROL register. Then set the GMIIEN bit in MACCONTROL.
- If the gigabit mode is desired (available only if using GMII or RGMII interface), set the GIG bit in the MACCONTROL register.
- When using RMII, release the interface logic from reset by clearing the RMII_RST field of the EMAC Configuration register (EMACCFG), found at device level.
- Enable the device interrupt in EWCTL.
Reimplemented from tcNetDrvr.
int tcNetDrvr_645x::dispatcher |
( |
void |
| ) |
|
|
protected |
Interrupt handler for EMAC transmit or receive.
Upon receipt of interrupt: 1) If receive interrupt, pop the descriptor off active descriptor list, extract receive packet PBUF and pass to the lwIP input thread. Notify rxallocator that a new receive PBUF should be chained in.
2) If a transmit interrupt, check and see if more transmit PBUFS are queued and restart transmit engine.
- Todo:
- need to handle stats interrupt, and error interrupt and restart the core if they occur...