OpenNet
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
OpenNetK::Hardware Class Referenceabstract

This class defines the hardware interface. More...

#include <Hardware.h>

Public Member Functions

void * operator new (size_t aSize_byte, void *aAddress)
 new operator without allocation More...
 
unsigned int GetCommonBufferSize () const
 Retrieve the common buffer size. More...
 
unsigned int GetPacketSize () const
 Retrieve the configured maximum packet size. More...
 
virtual void GetState (Adapter_State *aState)=0
 Retrieve the current state. More...
 
virtual void ResetMemory ()
 Reset all memory regions. More...
 
virtual void SetAdapter (Adapter *aAdapter)
 Connect the adapter. More...
 
virtual void SetCommonBuffer (uint64_t aCommon_PA, void *aCommon_CA)
 Set the common buffer. More...
 
virtual void SetConfig (const Adapter_Config &aConfig)
 Set the configuation. More...
 
virtual bool SetMemory (unsigned int aIndex, void *aMemory_MA, unsigned int aSize_byte)
 Set a memory region. More...
 
virtual void D0_Entry ()
 Enter the D0 state. More...
 
virtual bool D0_Exit ()
 Exit the D0 state. More...
 
virtual void Interrupt_Disable ()
 Disable the interrupts. More...
 
virtual void Interrupt_Enable ()
 Enable the interrupts. More...
 
virtual bool Interrupt_Process (unsigned int aMessageId, bool *aNeedMoreProcessing)
 Process an interrupt. More...
 
virtual void Interrupt_Process2 (bool *aNeedMoreProcessing)
 Process an interrupt at seconde level. More...
 
virtual void Interrupt_Process3 ()
 Process an interrupt at third level. More...
 
void Lock ()
 Lock the hardware. More...
 
void Unlock ()
 Unlock the hardware. More...
 
void Unlock_AfterReceive_FromThread (volatile long *aCounter, unsigned int aPacketQty, uint32_t aFlags)
 Unlock the hardware after programming receive descriptors. More...
 
void Unlock_AfterSend_FromThread (volatile long *aCounter, unsigned int aPacketQty, uint32_t aFlags)
 Unlock the hardware after programming transmit descriptors. More...
 
virtual bool Packet_Drop ()=0
 Add a buffer to the receiving queue. More...
 
virtual void Packet_Receive_NoLock (Packet *aPacket, volatile long *aCounter)=0
 Add the packet to the receiving queue. More...
 
virtual void Packet_Send_NoLock (uint64_t aPacket_PA, const void *aPacket_XA, unsigned int aSize_byte, volatile long *aCounter)=0
 Add the packet to the send queue. More...
 
virtual bool Packet_Send (const void *aPacket, unsigned int aSize_byte, bool aPriority, unsigned int aRepeatCount=1)=0
 Add the packet to the send queue. More...
 
virtual unsigned int Statistics_Get (uint32_t *aOut, unsigned int aOutSize_byte, bool aReset)
 Retrieve statistics. More...
 
virtual void Statistics_Reset ()
 Reset the statistics. More...
 
bool Tx_IsEnabled () const
 Is Tx enabled? More...
 
virtual void Tx_Disable ()
 Disable transmission. More...
 
virtual void Tx_Enable ()
 Enable transmission. More...
 

Protected Member Functions

 Hardware (OpenNetK::Adapter_Type aType, unsigned int aPacketSize_byte)
 The default constructor. More...
 
virtual void Unlock_AfterReceive_Internal ()=0
 Hardware dependent part of the Unlock_AfterReceive. More...
 
virtual void Unlock_AfterSend_Internal ()=0
 Hardware dependent part of the Unlock_AfterSend. More...
 

Static Protected Member Functions

static void SkipDangerousBoundary (uint64_t *aIn_PA, uint8_t **aIn_XA, unsigned int aSize_byte, uint64_t *aOut_PA, uint8_t **aOut_XA)
 Skip the dangerous 64 KiB boundaries. More...
 

Protected Attributes

Adapter_Config mConfig
 The adapter configuration.
 
Adapter_Info mInfo
 The information about the adapter.
 
uint32_t mStatistics [64]
 The adapter configuration.
 
SpinLockmZone0
 The SpinLock used to lock the hardware.
 

Detailed Description

This class defines the hardware interface.

Note
This class is part of the Driver Development Kit (DDK).

Constructor & Destructor Documentation

OpenNetK::Hardware::Hardware ( OpenNetK::Adapter_Type  aType,
unsigned int  aPacketSize_byte 
)
protected

The default constructor.

Parameters
aTypeType of adapter
aPacketSize_byteThe maximum and default packet size
Note
Thread = Initialisation

Member Function Documentation

virtual void OpenNetK::Hardware::D0_Entry ( )
virtual

Enter the D0 state.

Note
Level = Thread, Thread = Initialisation
See also
D0_Exit
virtual bool OpenNetK::Hardware::D0_Exit ( )
virtual

Exit the D0 state.

Return values
falseError
trueOK
Note
Level = Thread, Thread = Uninitialisation
See also
D0_Exit
unsigned int OpenNetK::Hardware::GetCommonBufferSize ( ) const

Retrieve the common buffer size.

Returns
This methode return the needed common buffer size in bytes.
unsigned int OpenNetK::Hardware::GetPacketSize ( ) const

Retrieve the configured maximum packet size.

Returns
This methode return the configured maximum packet size in bytes.
virtual void OpenNetK::Hardware::GetState ( Adapter_State aState)
pure virtual

Retrieve the current state.

Parameters
aStateThe OpenNet_State instance
Note
Level = SoftInt or Thread, Thread = Queue
virtual void OpenNetK::Hardware::Interrupt_Disable ( )
virtual

Disable the interrupts.

See also
Interrupt_Enable
virtual void OpenNetK::Hardware::Interrupt_Enable ( )
virtual

Enable the interrupts.

See also
Interrupt_Disable, Interrupt_Process
virtual bool OpenNetK::Hardware::Interrupt_Process ( unsigned int  aMessageId,
bool *  aNeedMoreProcessing 
)
virtual

Process an interrupt.

Parameters
aMessageIdThe message associated to the interrupt
aNeedMoreProcessing
Return values
Theadapter did not cause the interrupt.
Theadapter caused the interrupt.
Note
This method is a part of the critical path.
See also
Interrupt_Disable, Interrupt_Enable, Interrupt_Process2
virtual void OpenNetK::Hardware::Interrupt_Process2 ( bool *  aNeedMoreProcessing)
virtual

Process an interrupt at seconde level.

Parameters
aNeedMoreProcessing
Note
This method is a part of the critical path.
See also
Interrupt_Process, Interrupt_Process3
virtual void OpenNetK::Hardware::Interrupt_Process3 ( )
virtual

Process an interrupt at third level.

See also
Interrupt_Process2
void OpenNetK::Hardware::Lock ( )
inline

Lock the hardware.

Note
This method is a part of the critical path.
See also
Unlock, Unlock_AfterReceive, Unlock_AfterReceive_FromThread, Unlock_AfterSend, Unlock_AfterSend_FromThread
void* OpenNetK::Hardware::operator new ( size_t  aSize_byte,
void *  aAddress 
)

new operator without allocation

Parameters
aSize_byteThe size
aAddressThe address
Note
Level = Thread, Thread = Initialisation
virtual bool OpenNetK::Hardware::Packet_Drop ( )
pure virtual

Add a buffer to the receiving queue.

Return values
falseNo available buffer
trueOK
virtual void OpenNetK::Hardware::Packet_Receive_NoLock ( Packet aPacket,
volatile long *  aCounter 
)
pure virtual

Add the packet to the receiving queue.

Parameters
aPacketThe Packet
aCounterThe operation counter
Note
This method is a part of the critical path.
See also
Lock, Unlock_AfterReceive
virtual bool OpenNetK::Hardware::Packet_Send ( const void *  aPacket,
unsigned int  aSize_byte,
bool  aPriority,
unsigned int  aRepeatCount = 1 
)
pure virtual

Add the packet to the send queue.

Parameters
aPacketThe packet
aSize_byteThe packet size
aPrioritySet to true for packet with high priority
aRepeatCountThe repeat count
Return values
falseError
Note
Level = SoftInt or Thread, Thread = Users
Return values
trueOK
virtual void OpenNetK::Hardware::Packet_Send_NoLock ( uint64_t  aPacket_PA,
const void *  aPacket_XA,
unsigned int  aSize_byte,
volatile long *  aCounter 
)
pure virtual

Add the packet to the send queue.

Parameters
aPacket_PAThe data
aPacket_XAThe data (C or M)
aSize_byteThe data size
aCounterThe operation counter
Note
This method is a part of the critical path.
See also
Lock, Unlock_AfterSend
virtual void OpenNetK::Hardware::ResetMemory ( )
virtual

Reset all memory regions.

Note
Level = Thread, Thread = Uninitialisation
See also
SetMemory
virtual void OpenNetK::Hardware::SetAdapter ( Adapter aAdapter)
virtual

Connect the adapter.

Parameters
aAdapterThe Adapter
Note
Level = Thread, Thread = Initialisation
virtual void OpenNetK::Hardware::SetCommonBuffer ( uint64_t  aCommon_PA,
void *  aCommon_CA 
)
virtual

Set the common buffer.

aCommon_PA The physical address the hardware uses aCommon_CA The virtual address the software uses

Note
Level = Thread, Thread = Initialisation
virtual void OpenNetK::Hardware::SetConfig ( const Adapter_Config aConfig)
virtual

Set the configuation.

Parameters
aConfigThe configuration
Note
Level = SoftInt or Thread, Thread = Users
virtual bool OpenNetK::Hardware::SetMemory ( unsigned int  aIndex,
void *  aMemory_MA,
unsigned int  aSize_byte 
)
virtual

Set a memory region.

Parameters
aIndexThe index
aMemory_MAThe virtual address
aSize_byteThe size
Return values
falseError
trueOK
Note
Level = Thread, Thread = Initialisation
See also
ResetMemory
static void OpenNetK::Hardware::SkipDangerousBoundary ( uint64_t *  aIn_PA,
uint8_t **  aIn_XA,
unsigned int  aSize_byte,
uint64_t *  aOut_PA,
uint8_t **  aOut_XA 
)
staticprotected

Skip the dangerous 64 KiB boundaries.

Parameters
aIn_PA
aIn_XA(C or M)
aSize_byte
aOut_PA
aOut_XA(C or M)
Note
Thread = Initialisation
virtual unsigned int OpenNetK::Hardware::Statistics_Get ( uint32_t *  aOut,
unsigned int  aOutSize_byte,
bool  aReset 
)
virtual

Retrieve statistics.

Parameters
aOutThe output buffer
aOutSize_byteThe output buffer size
aResetReset the statitics after getting them
Returns
This method returns the size of statistics writen into the output buffer.
Note
Level = SoftInt or Thread, Thread = Users
virtual void OpenNetK::Hardware::Statistics_Reset ( )
virtual

Reset the statistics.

Note
Level = SoftInt or Thread, Thread = Users
virtual void OpenNetK::Hardware::Tx_Disable ( )
virtual

Disable transmission.

Note
Level = SoftInt or Thread, Thread = Users
virtual void OpenNetK::Hardware::Tx_Enable ( )
virtual

Enable transmission.

Note
Level = SoftInt or Thread, Thread = Users
bool OpenNetK::Hardware::Tx_IsEnabled ( ) const
inline

Is Tx enabled?

Return values
false
true
Note
Level = SoftInt or Thread, Thread = Users
void OpenNetK::Hardware::Unlock ( )
inline

Unlock the hardware.

Note
This method is a part of the critical path.
See also
Lock
void OpenNetK::Hardware::Unlock_AfterReceive_FromThread ( volatile long *  aCounter,
unsigned int  aPacketQty,
uint32_t  aFlags 
)

Unlock the hardware after programming receive descriptors.

Parameters
aCounterThe counter to increment
aPacketQtyThe number of descriptor programmed
aFlagsValue to pass to SpinLock::UnlockFromThread
See also
Lock
virtual void OpenNetK::Hardware::Unlock_AfterReceive_Internal ( )
protectedpure virtual

Hardware dependent part of the Unlock_AfterReceive.

Note
This method is a part of the critical path.
void OpenNetK::Hardware::Unlock_AfterSend_FromThread ( volatile long *  aCounter,
unsigned int  aPacketQty,
uint32_t  aFlags 
)

Unlock the hardware after programming transmit descriptors.

Parameters
aCounterThe counter to increment
aPacketQtyThe number of descriptor programmed
aFlagsValue to pass to SpinLock::UnlockFromThread
See also
Lock
virtual void OpenNetK::Hardware::Unlock_AfterSend_Internal ( )
protectedpure virtual

Hardware dependent part of the Unlock_AfterSend.

Note
This method is a part of the critical path.

The documentation for this class was generated from the following file: