📄 3c90x.h
字号:
tc90x_CheckIfEEPROMBusy(
IN PNIC_INFORMATION Adapter
);
NIC_STATUS
tc90x_ReadEEPROM(
IN PNIC_INFORMATION Adapter,
IN USHORT EEPROMAddress,
OUT PUSHORT Contents
);
NIC_STATUS
tc90x_WriteEEPROM(
IN PNIC_INFORMATION Adapter,
IN USHORT EEPROMAddress,
IN USHORT Data
);
USHORT
tc90x_CalculateEEPROMChecksum1(
IN PNIC_INFORMATION Adapter
) ;
//
// --------------------- ISR.C definitions -------------------
//
VOID
NICInterrupt IRQ(
INT Irq,
PVOID DeviceId,
PTREGS Registers
);
VOID
tc90x_HostErrorEvent(
IN PNIC_INFORMATION Adapter
);
VOID
tc90x_CountDownTimerEvent(
IN PNIC_INFORMATION Adapter
);
VOID
tc90x_UpdateStatisticsEvent(
IN PNIC_INFORMATION Adapter
);
//
// --------------------- RECEIVE.C definitions -------------------
//
VOID
tc90x_UpCompleteEvent(
IN PNIC_INFORMATION Adapter
);
NIC_STATUS
tc90x_ResetAndEnableReceiver(
IN PNIC_INFORMATION Adapter
);
//
// --------------------- TIMER.C definitions -------------------
//
VOID
NICTimer(
IN ULONG Data
);
VOID
WaitTimerHandler(
IN ULONG Data
);
//
// --------------------- CMDLINE.C definitions -------------------
//
NIC_STATUS
tc90x_ReadCommandLineChanges(
IN PNIC_INFORMATION Adapter
);
//
// --------------------- XCVR.C definitions -------------------
//
NIC_STATUS
tc90x_SetupMedia(
IN PDEVICE Device
);
VOID
ProcessMediaOverrides(
IN PNIC_INFORMATION Adapter,
IN USHORT OptionAvailable
);
VOID
tc90x_TickMediaHandler(
IN PNIC_INFORMATION Adapter
);
VOID
CheckTPLinkState(
IN PNIC_INFORMATION Adapter
);
VOID
CheckFXLinkState(
IN PNIC_INFORMATION Adapter
);
NIC_STATUS
tc90x_SetupNewDuplex(
IN PNIC_INFORMATION Adapter
);
VOID
tc90x_SetupNewSpeed(
IN PNIC_INFORMATION Adapter
);
VOID
IndicateToOSLinkStateChange(
IN PNIC_INFORMATION Adapter
);
/**************************** MIIPHY.C *********************************/
BOOLEAN
FindMIIPhy(
IN PNIC_INFORMATION Adapter
) ;
VOID
SendMIIPhyPreamble(
IN PNIC_INFORMATION Adapter
) ;
VOID
WriteMIIPhy(
IN PNIC_INFORMATION Adapter,
IN USHORT RegAddr,
IN USHORT Output
);
BOOLEAN
ReadMIIPhy(
IN PNIC_INFORMATION Adapter,
IN USHORT RegisterAddress,
OUT PUSHORT pInput
) ;
BOOLEAN
MIIMediaOverride(
IN PNIC_INFORMATION Adapter,
IN USHORT PhyModes,
OUT PUSHORT MiiType
);
BOOLEAN
ProgramMII(
IN PNIC_INFORMATION Adapter,
IN CONNECTOR_TYPE NewConnector
) ;
BOOLEAN
ConfigureMII(
IN PNIC_INFORMATION Adapter,
IN USHORT MediaOptions
);
BOOLEAN
CheckMIIConfiguration(
IN PNIC_INFORMATION Adapter,
IN USHORT MediaOptions
);
VOID
CheckMIIAutoNegotiationStatus(
IN PNIC_INFORMATION Adapter
);
/*++
Routine:
NIC_COMMAND_WAIT.
Description:
This routine issues a command and spins for the completion.
Arguments:
MiniportAdapterContext - Pointer to the adapter structure.
Command - Command to be issued.
Return Value:
NIC_STATUS_SUCCESS if hardware executes the command.
NIC_STATUS_FAILURE if hardware does not respond.
--*/
__inline
static
NIC_STATUS
NIC_COMMAND_WAIT(
IN PNIC_INFORMATION Adapter,
IN USHORT Command
)
{
PNIC_INFORMATION pAdapter = Adapter;
ULONG count;
USHORT value;
NIC_WRITE_PORT_USHORT(
pAdapter,
INTSTATUS_COMMAND_REGISTER,
Command);
count = jiffies + HZ;
do {
value = NIC_READ_PORT_USHORT(
pAdapter,
INTSTATUS_COMMAND_REGISTER);
NIC_DELAY(10);
} while ( (value & INTSTATUS_COMMAND_IN_PROGRESS) &&
(count > jiffies) );
if (count < jiffies) {
DBGPRINT_ERROR(("NIC_COMMAND_WAIT: timeout\n"));
return NIC_STATUS_FAILURE;
}
return NIC_STATUS_SUCCESS;
}
/*++
Routine Name:
tc90x_SetCountDownTimer.
Routine Description:
This routine sets the countdown timer on the hardware.
Arguments:
MiniportAdapterContext - Pointer to the adapter structure.
Return Value:
None.
--*/
__inline
static
VOID
tc90x_SetCountDownTimer(
IN PNIC_INFORMATION Adapter
)
{
PNIC_INFORMATION pAdapter = Adapter;
ULONG countDownValue;
countDownValue = pAdapter->BytesInDPDQueue /4;
if (countDownValue < 10)
countDownValue = 10;
NIC_WRITE_PORT_USHORT(
pAdapter,
COUNTDOWN_REGISTER,
(USHORT)countDownValue
);
}
/*++
Routine Name:
GetPacketFromPendingQueueAtHead
Routine Description:
This routine gets a packet from the pending queue.
Arguments:
pAdapter - Pointer to the adapter structure.
Return Value:
SocketBuffer - if there is a socket buffer in the queue.
NULL - if there is no socket buffer in the queue.
--*/
__inline
static
PSKB
GetPacketFromPendingQueueAtHead(
IN PNIC_INFORMATION Adapter
)
{
PSKB socketBuffer;
//
// Get the socket buffer from the queue head.
//
socketBuffer = Adapter->PendingQueue.Head;
if (socketBuffer) {
//
// Move the head.
//
Adapter->PendingQueue.Head = socketBuffer->next;
Adapter->TxPendingQueueCount--;
}
//
// return the socket buffer pointer.
//
socketBuffer->next = NULL;
return socketBuffer;
}
/*++
Routine Name:
PutPacketInPendingQueueAtHead
Routine Description:
This routine puts the packet in the pending queue.
Arguments:
Adapter - Pointer to the adapter structure.
SocketBuffer - Socket buffer
Return Value:
None.
--*/
__inline
static
VOID
PutPacketInPendingQueueAtHead(
IN PNIC_INFORMATION Adapter,
IN PSKB SocketBuffer
)
{
//
// This packet points to head.
//
SocketBuffer->next = Adapter->PendingQueue.Head;
if (NULL == Adapter->PendingQueue.Head) {
//
// Nothing in queue, tail points to this packet.
//
Adapter->PendingQueue.Tail = SocketBuffer;
}
//
// Point head to this packet.
//
Adapter->PendingQueue.Head = SocketBuffer;
Adapter->TxPendingQueueCount++;
}
/*++
Routine Name:
PutPacketPendingQueueAtTail.
Routine Description:
This routine puts the packet in the pending queue.
Arguments:
Adapter - Pointer to the adapter structure.
Packet - Packet pointer.
Return Value:
None.
--*/
__inline
static
VOID
PutPacketInPendingQueueAtTail(
IN PNIC_INFORMATION Adapter,
IN PSKB SocketBuffer
)
{
SocketBuffer->next = NULL;
if (NULL == Adapter->PendingQueue.Head) {
//
// Head is NULL, point head to this one.
//
Adapter->PendingQueue.Head = SocketBuffer ;
}
else {
//
// Head is valid, add this packet to the tail.
//
Adapter->PendingQueue.Tail->next = SocketBuffer;
}
//
// Point tail to this one.
//
Adapter->PendingQueue.Tail = SocketBuffer;
Adapter->TxPendingQueueCount++;
}
/*++
Routine Name:
SetRxTcpIpChecksumFlagsInPacket.
Routine Description:
This routine sets the checksum information.
Arguments:
Adapter - Pointer to the adapter structure.
SocketBuffer - Pointer to the socket buffer.
UpPacketStatus - UpPacketStatus given by hardware.
Return Value:
None.
--*/
__inline
static
VOID
SetRxTcpIpChecksumOffloadFlagsInSocketBuffer(
IN PNIC_INFORMATION Adapter,
IN PSKB SocketBuffer,
IN ULONG UpPacketStatus
)
{
PNIC_INFORMATION pAdapter = Adapter;
//
// Check if this is IP packet.
//
if (UpPacketStatus & UP_PACKET_STATUS_IP_CHECKSUM_CHECKED) {
if (UpPacketStatus & UP_PACKET_STATUS_IP_CHECKSUM_ERROR) {
DBGPRINT_ERROR((
KERN_CRIT "IP checksum error\n"));
SocketBuffer->ip_summed = CHECKSUM_NONE;
return;
}
//
// Check if packet is TCP packet.
//
if (UpPacketStatus & UP_PACKET_STATUS_TCP_CHECKSUM_CHECKED) {
//
// Check if TCP checksum has been offloaded to us.
//
if (UpPacketStatus &
UP_PACKET_STATUS_TCP_CHECKSUM_ERROR) {
DBGPRINT_ERROR((
KERN_CRIT "TCP Checksum error\n"));
SocketBuffer->ip_summed = CHECKSUM_NONE;
return;
}
}
//
// Check if this is UDP packet.
//
if (UpPacketStatus & UP_PACKET_STATUS_UDP_CHECKSUM_CHECKED) {
if (TRUE == pAdapter->Hardware.UDPChecksumErrDone) {
if (UpPacketStatus &
UP_PACKET_STATUS_UDP_CHECKSUM_ERROR) {
DBGPRINT_ERROR((
KERN_CRIT "UDP Error"));
SocketBuffer->ip_summed = CHECKSUM_NONE;
return;
}
else {
SocketBuffer->ip_summed = CHECKSUM_NONE;
return;
}
}
}
}
SocketBuffer->ip_summed = CHECKSUM_UNNECESSARY;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -