FreeNOS
|
Network device of the Allwinner Sun8i family System-on-Chips. More...
#include <Sun8iEmac.h>
Data Structures | |
struct | FrameDescriptor |
Transmit/receive frame descriptor. More... | |
Public Member Functions | |
Sun8iEmac (const u32 inode, NetworkServer &server) | |
Constructor. More... | |
virtual | ~Sun8iEmac () |
Destructor. More... | |
virtual FileSystem::Result | initialize () |
Initialize the device. More... | |
virtual FileSystem::Result | getAddress (Ethernet::Address *address) |
Read ethernet address. More... | |
virtual FileSystem::Result | setAddress (const Ethernet::Address *address) |
Set ethernet address. More... | |
virtual FileSystem::Result | interrupt (const Size vector) |
Called when an interrupt has been triggered for this device. More... | |
virtual FileSystem::Result | transmit (NetworkQueue::Packet *pkt) |
Add a network packet to the transmit queue. More... | |
virtual FileSystem::Result | startDMA () |
Start DMA processing. More... | |
Public Member Functions inherited from NetworkDevice | |
NetworkDevice (const u32 inode, NetworkServer &server) | |
Constructor. More... | |
virtual | ~NetworkDevice () |
Destructor. More... | |
const Size | getMaximumPacketSize () const |
Get maximum packet size. More... | |
NetworkQueue * | getReceiveQueue () |
Get receive queue. More... | |
NetworkQueue * | getTransmitQueue () |
Get transmit queue. More... | |
void | unregisterSockets (const ProcessID pid) |
Remove sockets for a process. More... | |
virtual FileSystem::Result | process (const NetworkQueue::Packet *packet, const Size offset=0) |
Process a received network packet. More... | |
Public Member Functions inherited from Device | |
Device (const u32 inode, const FileSystem::FileType type) | |
Constructor. More... | |
virtual | ~Device () |
Destructor. More... | |
virtual const String & | getIdentifier () const |
Get unique device identifier. More... | |
Public Member Functions inherited from File | |
File (const u32 inode, const FileSystem::FileType type=FileSystem::RegularFile, const UserID uid=ZERO, const GroupID gid=ZERO) | |
Constructor function. More... | |
virtual | ~File () |
Destructor function. More... | |
u32 | getInode () const |
Get inode number. More... | |
FileSystem::FileType | getType () const |
Retrieve our filetype. More... | |
virtual FileSystem::Result | read (IOBuffer &buffer, Size &size, const Size offset) |
Read bytes from the file. More... | |
virtual FileSystem::Result | write (IOBuffer &buffer, Size &size, const Size offset) |
Write bytes to the file. More... | |
virtual FileSystem::Result | status (FileSystem::FileStat &st) |
Retrieve file statistics. More... | |
virtual bool | canRead () const |
Check if the File has data ready for reading. More... | |
virtual bool | canWrite () const |
Check if the File can be written to. More... | |
Static Public Attributes | |
static const Size | InterruptNumber = 114 |
Interrupt number for this device on a sun8i family SoC. More... | |
Private Types | |
enum | Registers { BasicCtl0 = 0x0000, BasicCtl1 = 0x0004, IntStatus = 0x0008, IntEnable = 0x000C, TransmitCtl0 = 0x0010, TransmitCtl1 = 0x0014, TransmitFlowCtl = 0x001C, TransmitDescList = 0x0020, ReceiveCtl0 = 0x0024, ReceiveCtl1 = 0x0028, ReceiveDescList = 0x0034, ReceiveFrmFilter = 0x0038, ReceiveHash0 = 0x0040, ReceiveHash1 = 0x0044, MiiCmd = 0x0048, MiiData = 0x004C, AddrHigh = 0x0050, AddrLow = 0x0054, TransmitStatus = 0x00B0, TransmitCurDesc = 0x00B4, TransmitCurBuf = 0x00B8, ReceiveStatus = 0x00C0, ReceiveCurDesc = 0x00C4, ReceiveCurBuf = 0x00C8, RgmiiStatus = 0x00D0 } |
Hardware registers. More... | |
enum | BasicCtl0Flags { BasicCtl0FullDup = (1 << 0), BasicCtl0SpeedMask = ((1 << 2) | (1 << 3)), BasicCtl0Speed100 = (0x3 << 2) } |
Flags for the Basic Control 0 register. More... | |
enum | BasicCtl1Flags { BasicCtl1Reset = (1 << 0), BasicCtl1BurstShift = 24 } |
Flags for the Basic Control 1 register. More... | |
enum | IntStatusFlags { IntStatusReceive = (1 << 8), IntStatusTransmit = (1 << 0) } |
Flags for the Interrupt Status register. More... | |
enum | IntEnableFlags { IntEnableReceive = (1 << 8), IntEnableTransmit = (1 << 0) } |
Flags for the Interrupt Enable register. More... | |
enum | MiiCmdFlags { MiiCmdPhyAddrShift = 12, MiiCmdPhyAddrMask = 0xf000, MiiCmdPhyRegShift = 4, MiiCmdPhyRegMask = 0xf0, MiiCmdPhyCsrDiv128 = 0x3, MiiCmdPhyCsrShift = 20, MiiCmdPhyWrite = (1 << 1), MiiCmdPhyBusy = (1 << 0) } |
Flags for Media-Independent-Interface (MII) Command register. More... | |
enum | MiiRegisters { MiiRegControl = (0x0), MiiRegStatus = (0x1), MiiRegIdHigh = (0x2), MiiRegIdLow = (0x3), MiiRegAdv = (0x4), MiiRegLink = (0x5) } |
Registers provided by the PHY on the Media-Independent-Interface (MII) More... | |
enum | MiiControlFlags { MiiControlFullDuplex = 0x0100, MiiControlAutoRestart = 0x0200, MiiControlAutoEnable = 0x1000, MiiControlSpeed100 = 0x2000, MiiControlReset = 0x8000 } |
Flags in the Mii Control register. More... | |
enum | MiiStatusFlags { MiiStatusExt = 0x0001, MiiStatusLink = 0x0004, MiiStatusAutoCap = 0x0008, MiiStatusAutoCompl = 0x0020 } |
Flags in the Mii Status register. More... | |
enum | MiiAdvFlags { MiiAdvSpeed10Full = 0x0040, MiiAdvSpeed100Full = 0x0100 } |
Flags in the Mii Advertised abilities register. More... | |
enum | TransmitCtl0Flags { TransmitCtl0Enable = (1 << 31) } |
Flags for the Transmit Control 0 register. More... | |
enum | TransmitCtl1Flags { TransmitCtl1DmaStart = (1 << 31), TransmitCtl1DmaEnable = (1 << 30), TransmitCtl1NextFrame = (1 << 2), TransmitCtl1FullFrame = (1 << 1) } |
Flags for the Transmit Control 1 register. More... | |
enum | ReceiveCtl0Flags { ReceiveCtl0Enable = (1 << 31) } |
Flags for the Receive Control 0 register. More... | |
enum | ReceiveCtl1Flags { ReceiveCtl1DmaStart = (1 << 31), ReceiveCtl1DmaEnable = (1 << 30), ReceiveCtl1ErrorFrame = (1 << 3), ReceiveCtl1UnderFrame = (1 << 2), ReceiveCtl1FullFrame = (1 << 1) } |
Flags for the Receive Control 1 register. More... | |
enum | FrameDescriptorFlags { FrameDescriptorCtl = (1 << 31), TransmitDescRaiseInt = (1 << 31), TransmitDescFirst = (1 << 29), TransmitDescLast = (1 << 30), TransmitDescChained = (1 << 24), ReceiveDescLast = (1 << 8), ReceiveDescFrmShift = 16, ReceiveDescFrmMask = (0x3fff) } |
Flags for frame descriptors. More... | |
Private Member Functions | |
FileSystem::Result | receive () |
Receive packets. More... | |
bool | miiBusyWait () const |
Wait until the PHY comes out of busy state. More... | |
u32 | miiRead (const u8 phyAddr, const u8 regAddr) |
Read a Media-Independent-Interface (MII) register on the PHY. More... | |
void | miiWrite (const u8 phyAddr, const u8 regAddr, const u32 data) |
Write a Media-Independent-Interface (MII) register on the PHY. More... | |
FileSystem::Result | configPhy () |
Configure the PHY connected to the MAC controller. More... | |
FileSystem::Result | resetPhy () |
Reset the PHY connected to the MAC controller. More... | |
FileSystem::Result | resetReceive () |
Reset receive control functions. More... | |
FileSystem::Result | resetTransmit () |
Reset transmit control functions. More... | |
FileSystem::Result | reset () |
Reset the controller. More... | |
void | printRx () |
Print diagnostic information about the receive queue (RX) More... | |
void | printTx () |
Print diagnostic information about the transmit queue (TX) More... | |
Static Private Attributes | |
static const Address | MemoryAddress = 0x01c30000 |
Physical memory address of the device memory mapped registers. More... | |
static const u8 | PhyMdioAddress = 0x1 |
Fixed address of the PHY on the MDIO bus. More... | |
static const Size | MaximumMiiPoll = 100000 |
Maximum number of polling reads for MII-busy flag. More... | |
static const Size | MaximumResetPoll = 100000 |
Maximum number of polling reset iterations. More... | |
Additional Inherited Members | |
Protected Attributes inherited from NetworkDevice | |
Size | m_maximumPacketSize |
Maximum size of each packet. More... | |
NetworkQueue | m_receive |
NetworkQueue | m_transmit |
NetworkServer & | m_server |
Ethernet * | m_eth |
ARP * | m_arp |
IPV4 * | m_ipv4 |
ICMP * | m_icmp |
UDP * | m_udp |
Protected Attributes inherited from Device | |
String | m_identifier |
Unique identifier for this Device. More... | |
Protected Attributes inherited from File | |
const u32 | m_inode |
Inode number. More... | |
const FileSystem::FileType | m_type |
Type of this file. More... | |
UserID | m_uid |
Owner of the file. More... | |
GroupID | m_gid |
Group of the file. More... | |
FileSystem::FileModes | m_access |
Access permissions. More... | |
Size | m_size |
Size of the file, in bytes. More... | |
Network device of the Allwinner Sun8i family System-on-Chips.
Definition at line 41 of file Sun8iEmac.h.
|
private |
Flags for the Basic Control 0 register.
Enumerator | |
---|---|
BasicCtl0FullDup | |
BasicCtl0SpeedMask | |
BasicCtl0Speed100 |
Definition at line 97 of file Sun8iEmac.h.
|
private |
Flags for the Basic Control 1 register.
Enumerator | |
---|---|
BasicCtl1Reset | |
BasicCtl1BurstShift |
Definition at line 107 of file Sun8iEmac.h.
|
private |
Flags for frame descriptors.
Enumerator | |
---|---|
FrameDescriptorCtl | |
TransmitDescRaiseInt | |
TransmitDescFirst | |
TransmitDescLast | |
TransmitDescChained | |
ReceiveDescLast | |
ReceiveDescFrmShift | |
ReceiveDescFrmMask |
Definition at line 244 of file Sun8iEmac.h.
|
private |
Flags for the Interrupt Enable register.
Enumerator | |
---|---|
IntEnableReceive | |
IntEnableTransmit |
Definition at line 125 of file Sun8iEmac.h.
|
private |
Flags for the Interrupt Status register.
Enumerator | |
---|---|
IntStatusReceive | |
IntStatusTransmit |
Definition at line 116 of file Sun8iEmac.h.
|
private |
Flags in the Mii Advertised abilities register.
Enumerator | |
---|---|
MiiAdvSpeed10Full | |
MiiAdvSpeed100Full |
Definition at line 185 of file Sun8iEmac.h.
|
private |
Flags for Media-Independent-Interface (MII) Command register.
Enumerator | |
---|---|
MiiCmdPhyAddrShift | |
MiiCmdPhyAddrMask | |
MiiCmdPhyRegShift | |
MiiCmdPhyRegMask | |
MiiCmdPhyCsrDiv128 | |
MiiCmdPhyCsrShift | |
MiiCmdPhyWrite | |
MiiCmdPhyBusy |
Definition at line 134 of file Sun8iEmac.h.
|
private |
Flags in the Mii Control register.
Enumerator | |
---|---|
MiiControlFullDuplex | |
MiiControlAutoRestart | |
MiiControlAutoEnable | |
MiiControlSpeed100 | |
MiiControlReset |
Definition at line 162 of file Sun8iEmac.h.
|
private |
Registers provided by the PHY on the Media-Independent-Interface (MII)
Enumerator | |
---|---|
MiiRegControl | |
MiiRegStatus | < Control |
MiiRegIdHigh | < Status |
MiiRegIdLow | < Identifier High |
MiiRegAdv | < Identifier Low |
MiiRegLink | < Advertised abilities |
Definition at line 149 of file Sun8iEmac.h.
|
private |
Flags in the Mii Status register.
Enumerator | |
---|---|
MiiStatusExt | |
MiiStatusLink | |
MiiStatusAutoCap | |
MiiStatusAutoCompl |
Definition at line 174 of file Sun8iEmac.h.
|
private |
Flags for the Receive Control 0 register.
Enumerator | |
---|---|
ReceiveCtl0Enable |
Definition at line 213 of file Sun8iEmac.h.
|
private |
Flags for the Receive Control 1 register.
Enumerator | |
---|---|
ReceiveCtl1DmaStart | |
ReceiveCtl1DmaEnable | |
ReceiveCtl1ErrorFrame | |
ReceiveCtl1UnderFrame | |
ReceiveCtl1FullFrame |
Definition at line 221 of file Sun8iEmac.h.
|
private |
Hardware registers.
Enumerator | |
---|---|
BasicCtl0 | |
BasicCtl1 | < Basic Control 0 |
IntStatus | < Basic Control 1 |
IntEnable | < Interrupt Status |
TransmitCtl0 | < Interrupt Enable |
TransmitCtl1 | < Transmit Control 0 |
TransmitFlowCtl | < Transmit Control 1 |
TransmitDescList | < Transmit Flow Control |
ReceiveCtl0 | < Transmit Descriptor List Address |
ReceiveCtl1 | < Receive Control 0 |
ReceiveDescList | < Receive Control 1 |
ReceiveFrmFilter | < Receive Descriptor List Address |
ReceiveHash0 | < Receive Frame Filter |
ReceiveHash1 | < Receive Hash Table 0 |
MiiCmd | < Receive Hash Table 1 |
MiiData | < Management Interface Command |
AddrHigh | < Management Interface Data |
AddrLow | < MAC Address High |
TransmitStatus | < MAC Address Low |
TransmitCurDesc | < Transmit DMA Status |
TransmitCurBuf | < Transmit Current Descriptor |
ReceiveStatus | < Transmit Current Buffer |
ReceiveCurDesc | < Receive DMA Status |
ReceiveCurBuf | < Receive Current Descriptor |
RgmiiStatus | < Receive Current Buffer |
Definition at line 65 of file Sun8iEmac.h.
|
private |
Flags for the Transmit Control 0 register.
Enumerator | |
---|---|
TransmitCtl0Enable |
Definition at line 194 of file Sun8iEmac.h.
|
private |
Flags for the Transmit Control 1 register.
Enumerator | |
---|---|
TransmitCtl1DmaStart | |
TransmitCtl1DmaEnable | |
TransmitCtl1NextFrame | |
TransmitCtl1FullFrame |
Definition at line 202 of file Sun8iEmac.h.
Sun8iEmac::Sun8iEmac | ( | const u32 | inode, |
NetworkServer & | server | ||
) |
Constructor.
inode | Inode number |
server | NetworkServer reference |
Definition at line 26 of file Sun8iEmac.cpp.
References DEBUG.
|
virtual |
|
private |
Configure the PHY connected to the MAC controller.
Definition at line 477 of file Sun8iEmac.cpp.
References DEBUG, MaximumMiiPoll, MiiAdvSpeed100Full, MiiAdvSpeed10Full, MiiControlAutoEnable, MiiControlAutoRestart, MiiControlFullDuplex, MiiControlSpeed100, miiRead(), MiiRegAdv, MiiRegControl, MiiRegStatus, MiiStatusAutoCompl, MiiStatusLink, miiWrite(), PhyMdioAddress, FileSystem::Success, and WARNING.
Referenced by reset().
|
virtual |
Read ethernet address.
address | Ethernet address reference for output |
Implements NetworkDevice.
Definition at line 123 of file Sun8iEmac.cpp.
References Ethernet::Address::addr, AddrHigh, AddrLow, DEBUG, m_io, ARMIO::read(), and FileSystem::Success.
Referenced by reset().
|
virtual |
Initialize the device.
Reimplemented from NetworkDevice.
Definition at line 39 of file Sun8iEmac.cpp.
References Memory::Range::access, assert, DEBUG, Memory::Device, EnableIRQ, ERROR, NetworkDevice::initialize(), SunxiSystemControl::initialize(), SunxiClockControl::initialize(), InterruptNumber, FileSystem::IOError, m_ccu, m_io, m_receiveDescRange, m_syscon, m_transmitDescRange, IO::map(), MapContiguous, NetworkQueue::MaxPackets, MemoryAddress, PAGESIZE, Memory::Range::phys, ProcessCtl(), Memory::Readable, reset(), SELF, Memory::Range::size, IO::Success, FileSystem::Success, API::Success, SunxiSystemControl::Success, SunxiClockControl::Success, Memory::User, Memory::Range::virt, VMCtl(), and Memory::Writable.
|
virtual |
Called when an interrupt has been triggered for this device.
vector | Vector number of the interrupt. |
Reimplemented from Device.
Definition at line 175 of file Sun8iEmac.cpp.
References Queue< T, N >::count(), DEBUG, EnableIRQ, ERROR, IntEnable, IntEnableReceive, IntEnableTransmit, InterruptNumber, IntStatus, IntStatusTransmit, m_io, NetworkDevice::m_transmit, m_transmitPackets, Queue< T, N >::pop(), printTx(), ProcessCtl(), ARMIO::read(), receive(), ReceiveCtl1, NetworkQueue::release(), SELF, File::status(), FileSystem::Success, TransmitCtl1, and ARMIO::write().
|
private |
Wait until the PHY comes out of busy state.
Definition at line 348 of file Sun8iEmac.cpp.
References DEBUG, ERROR, m_io, MaximumMiiPoll, MiiCmd, MiiCmdPhyBusy, and ARMIO::read().
Referenced by miiRead(), and miiWrite().
Read a Media-Independent-Interface (MII) register on the PHY.
phyAddr | Address of the PHY on the MDIO bus |
regAddr | MII-register to read |
Definition at line 373 of file Sun8iEmac.cpp.
References DEBUG, m_io, miiBusyWait(), MiiCmd, MiiCmdPhyAddrMask, MiiCmdPhyAddrShift, MiiCmdPhyBusy, MiiCmdPhyCsrDiv128, MiiCmdPhyCsrShift, MiiCmdPhyRegMask, MiiCmdPhyRegShift, MiiData, ARMIO::read(), and ARMIO::write().
Referenced by configPhy(), and resetPhy().
Write a Media-Independent-Interface (MII) register on the PHY.
phyAddr | Address of the PHY on the MDIO bus |
regAddr | MII-register to write |
data | Value for the register |
Definition at line 390 of file Sun8iEmac.cpp.
References DEBUG, m_io, miiBusyWait(), MiiCmd, MiiCmdPhyAddrMask, MiiCmdPhyAddrShift, MiiCmdPhyBusy, MiiCmdPhyCsrDiv128, MiiCmdPhyCsrShift, MiiCmdPhyRegMask, MiiCmdPhyRegShift, MiiCmdPhyWrite, MiiData, and ARMIO::write().
Referenced by configPhy(), and resetPhy().
|
private |
Print diagnostic information about the receive queue (RX)
Definition at line 143 of file Sun8iEmac.cpp.
References Sun8iEmac::FrameDescriptor::bufaddr, Sun8iEmac::FrameDescriptor::bufsize, DEBUG, m_io, m_receiveDesc, m_receiveDescRange, m_receiveIndex, Sun8iEmac::FrameDescriptor::next, Memory::Range::phys, ARMIO::read(), ReceiveCurDesc, ReceiveStatus, and Sun8iEmac::FrameDescriptor::status.
Referenced by receive().
|
private |
Print diagnostic information about the transmit queue (TX)
Definition at line 164 of file Sun8iEmac.cpp.
References DEBUG, m_io, m_transmitDesc, m_transmitDescRange, m_transmitIndex, Memory::Range::phys, ARMIO::read(), Sun8iEmac::FrameDescriptor::status, TransmitCurDesc, and TransmitStatus.
Referenced by interrupt(), and startDMA().
|
private |
Receive packets.
Definition at line 290 of file Sun8iEmac.cpp.
References assert, CacheInvalidate, NetworkQueue::Packet::data, DEBUG, dsb(), ERROR, FrameDescriptorCtl, FileSystem::IOError, m_receiveDesc, m_receiveIndex, m_receivePackets, NetworkQueue::MaxPackets, PAGESIZE, printRx(), NetworkDevice::process(), ReceiveDescFrmMask, ReceiveDescFrmShift, ReceiveDescLast, SELF, NetworkQueue::Packet::size, Memory::Range::size, Sun8iEmac::FrameDescriptor::status, FileSystem::Success, API::Success, Memory::Range::virt, VMCtl(), and ZERO.
Referenced by interrupt().
|
private |
Reset the controller.
Definition at line 599 of file Sun8iEmac.cpp.
References BasicCtl0, BasicCtl0FullDup, BasicCtl0Speed100, BasicCtl0SpeedMask, BasicCtl1, BasicCtl1BurstShift, BasicCtl1Reset, configPhy(), DEBUG, ERROR, getAddress(), IntEnable, IntEnableReceive, IntEnableTransmit, IntStatus, FileSystem::IOError, m_io, MaximumResetPoll, ARMIO::read(), resetPhy(), resetReceive(), resetTransmit(), ARMIO::set(), setAddress(), FileSystem::Success, and ARMIO::write().
Referenced by initialize().
|
private |
Reset the PHY connected to the MAC controller.
Definition at line 405 of file Sun8iEmac.cpp.
References SunxiClockControl::ClockEmacTx, SunxiClockControl::ClockEphy, SunxiClockControl::deassert(), DEBUG, SunxiClockControl::enable(), ERROR, FileSystem::IOError, m_ccu, m_syscon, MaximumMiiPoll, MiiControlReset, miiRead(), MiiRegControl, MiiRegIdHigh, MiiRegIdLow, miiWrite(), PhyMdioAddress, SunxiClockControl::ResetEmacTx, SunxiClockControl::ResetEphy, SunxiSystemControl::setupEmac(), FileSystem::Success, SunxiClockControl::Success, and WARNING.
Referenced by reset().
|
private |
Reset receive control functions.
Definition at line 515 of file Sun8iEmac.cpp.
References assert, Sun8iEmac::FrameDescriptor::bufaddr, Sun8iEmac::FrameDescriptor::bufsize, NetworkQueue::Packet::data, DEBUG, dsb(), ERROR, FrameDescriptorCtl, NetworkQueue::get(), Index< T, N >::insertAt(), FileSystem::IOError, LookupVirtual, m_io, NetworkDevice::m_maximumPacketSize, NetworkDevice::m_receive, m_receiveDesc, m_receiveDescRange, m_receiveIndex, m_receivePackets, NetworkQueue::MaxPackets, Sun8iEmac::FrameDescriptor::next, PAGESIZE, Memory::Range::phys, ReceiveCtl0, ReceiveCtl0Enable, ReceiveCtl1, ReceiveCtl1DmaEnable, ReceiveCtl1DmaStart, ReceiveCtl1ErrorFrame, ReceiveCtl1FullFrame, ReceiveCtl1UnderFrame, ReceiveDescList, SELF, Memory::Range::size, Sun8iEmac::FrameDescriptor::status, FileSystem::Success, API::Success, Memory::Range::virt, VMCtl(), ARMIO::write(), and ZERO.
Referenced by reset().
|
private |
Reset transmit control functions.
Definition at line 566 of file Sun8iEmac.cpp.
References Sun8iEmac::FrameDescriptor::bufaddr, Sun8iEmac::FrameDescriptor::bufsize, DEBUG, m_io, m_transmitDesc, m_transmitDescRange, m_transmitIndex, NetworkQueue::MaxPackets, Sun8iEmac::FrameDescriptor::next, Memory::Range::phys, Sun8iEmac::FrameDescriptor::status, FileSystem::Success, TransmitCtl0, TransmitCtl0Enable, TransmitCtl1, TransmitCtl1FullFrame, TransmitCtl1NextFrame, TransmitDescList, Memory::Range::virt, and ARMIO::write().
Referenced by reset().
|
virtual |
Set ethernet address.
address | New ethernet address to set |
Implements NetworkDevice.
Definition at line 133 of file Sun8iEmac.cpp.
References Ethernet::Address::addr, AddrHigh, AddrLow, DEBUG, m_io, FileSystem::Success, and ARMIO::write().
Referenced by reset().
|
virtual |
Start DMA processing.
Reimplemented from NetworkDevice.
Definition at line 228 of file Sun8iEmac.cpp.
References Sun8iEmac::FrameDescriptor::bufaddr, Sun8iEmac::FrameDescriptor::bufsize, CacheClean, Queue< T, N >::count(), NetworkQueue::Packet::data, DEBUG, dsb(), ERROR, FrameDescriptorCtl, FileSystem::IOError, LookupVirtual, m_io, m_transmitDesc, m_transmitIndex, m_transmitPackets, m_transmitPending, NetworkQueue::MaxPackets, PAGESIZE, Memory::Range::phys, Queue< T, N >::pop(), printTx(), Queue< T, N >::push(), SELF, ARMIO::set(), NetworkQueue::Packet::size, Memory::Range::size, Sun8iEmac::FrameDescriptor::status, FileSystem::Success, API::Success, TransmitCtl1, TransmitCtl1DmaEnable, TransmitCtl1DmaStart, TransmitDescChained, TransmitDescFirst, TransmitDescLast, TransmitDescRaiseInt, Memory::Range::virt, and VMCtl().
|
virtual |
Add a network packet to the transmit queue.
pkt | Network packet buffer |
Implements NetworkDevice.
Definition at line 214 of file Sun8iEmac.cpp.
References Queue< T, N >::count(), DEBUG, ERROR, FileSystem::IOError, m_transmitPending, NetworkQueue::MaxPackets, Queue< T, N >::push(), NetworkQueue::Packet::size, and FileSystem::Success.
|
static |
Interrupt number for this device on a sun8i family SoC.
Definition at line 46 of file Sun8iEmac.h.
Referenced by initialize(), interrupt(), and main().
|
private |
Clock Control Unit.
Definition at line 411 of file Sun8iEmac.h.
Referenced by initialize(), and resetPhy().
|
private |
Memory mapped registers.
Definition at line 408 of file Sun8iEmac.h.
Referenced by getAddress(), initialize(), interrupt(), miiBusyWait(), miiRead(), miiWrite(), printRx(), printTx(), reset(), resetReceive(), resetTransmit(), setAddress(), and startDMA().
|
private |
List of pointers to receive descriptors.
Definition at line 420 of file Sun8iEmac.h.
Referenced by printRx(), receive(), and resetReceive().
|
private |
Memory range for receive descriptors.
Definition at line 417 of file Sun8iEmac.h.
Referenced by initialize(), printRx(), and resetReceive().
|
private |
Current receive packet index.
Definition at line 426 of file Sun8iEmac.h.
Referenced by printRx(), receive(), and resetReceive().
|
private |
List of pointers to receive packets.
Definition at line 423 of file Sun8iEmac.h.
Referenced by receive(), and resetReceive().
|
private |
System Control Unit.
Definition at line 414 of file Sun8iEmac.h.
Referenced by initialize(), and resetPhy().
|
private |
List of pointers to transmit descriptors.
Definition at line 432 of file Sun8iEmac.h.
Referenced by printTx(), resetTransmit(), and startDMA().
|
private |
Memory range for transmit descriptors.
Definition at line 429 of file Sun8iEmac.h.
Referenced by initialize(), printTx(), and resetTransmit().
|
private |
Current transmit packet index.
Definition at line 441 of file Sun8iEmac.h.
Referenced by printTx(), resetTransmit(), and startDMA().
|
private |
List of pointers to packets that the driver has submitted for transmission.
Definition at line 438 of file Sun8iEmac.h.
Referenced by interrupt(), and startDMA().
|
private |
List of pointers to packets pending transmission.
Definition at line 435 of file Sun8iEmac.h.
Referenced by startDMA(), and transmit().
|
staticprivate |
Maximum number of polling reads for MII-busy flag.
Definition at line 57 of file Sun8iEmac.h.
Referenced by configPhy(), miiBusyWait(), and resetPhy().
|
staticprivate |
Maximum number of polling reset iterations.
Definition at line 60 of file Sun8iEmac.h.
Referenced by reset().
|
staticprivate |
Physical memory address of the device memory mapped registers.
Definition at line 51 of file Sun8iEmac.h.
Referenced by initialize().
|
staticprivate |
Fixed address of the PHY on the MDIO bus.
Definition at line 54 of file Sun8iEmac.h.
Referenced by configPhy(), and resetPhy().