?? nicrxmode.c
字號(hào):
/*******************************************************************************
*** Note: Copy rights resevered to Beijing Pacific Linkair Communications Co.
***
*** File Name: NICRxMode.c
*** Purpose : set the receive mode for the NIC Card
***
*** Author : Guangzhao Tian
*** Modified : By Guangzhao Tian at 2000/9/11
***
**/
#include "NICMacro.h"
#include "NICWinReg.h"
#include "NICCommand.h"
#include "NICEeprom.h"
#include "NICData.h"
#include "NICHelper.h"
#include "NICExport.h"
/*****************************************************************
***This routine sets receive mode
**/
NIC_STATUS NIC_RxModeSet(IN PNIC_INFORMATION pAdapter , IN ULONG lRxMode )
{
pAdapter->RxMode.lReceiveMode=lRxMode ;
DebugMsg("\n**************\nNow Set the Rx Mode ... \n");
NIC_COMMAND( pAdapter->IoBaseAddress ,
COMMAND_SELECT_REGISTER_WINDOW |REGISTER_WINDOW_5);
/* Write the Rx filter */
NIC_COMMAND ( pAdapter->IoBaseAddress ,(USHORT)(COMMAND_SET_RX_FILTER | lRxMode) );
/*if we should receive individual packets, set the station address into the registers*/
if( lRxMode & RX_FILTER_INDIVIDUAL )
{
NIC_RxModeIndividal( pAdapter);
}
/*if we should receive the hash fileter multicast packets*/
if (lRxMode & RX_FILTER_MULTICAST_HASH)
{
NIC_RxModeMulticast(pAdapter);
}
DebugMsg("Rx Mode Set -- Done! \n*******************\n");
}
/*****************************************************************
*** Read the OEM Node Address from the EEPROM , and write into
*** Station Address Registers in Registers Window 2
**/
void NIC_RxModeIndividal ( IN PNIC_INFORMATION pAdapter )
{
/****--- Set OEM Station Address into NIC Registers ------****/
DebugMsg("Now Set Station Addresses ! \n");
NIC_COMMAND( pAdapter->IoBaseAddress ,
COMMAND_SELECT_REGISTER_WINDOW |REGISTER_WINDOW_2);
NIC_WRITE_PORT_USHORT(pAdapter->IoBaseAddress ,
STATION_ADDRESS_LOW_REGISTER , pAdapter->EEPROMInfo.wOEMNodeAddress[0] );
pAdapter->RxMode.wStationAddr[0]=pAdapter->EEPROMInfo.wOEMNodeAddress[0];
NIC_WRITE_PORT_USHORT(pAdapter->IoBaseAddress ,
STATION_ADDRESS_MID_REGISTER , pAdapter->EEPROMInfo.wOEMNodeAddress[1] );
pAdapter->RxMode.wStationAddr[1]=pAdapter->EEPROMInfo.wOEMNodeAddress[1];
NIC_WRITE_PORT_USHORT(pAdapter->IoBaseAddress ,
STATION_ADDRESS_HIGH_REGISTER , pAdapter->EEPROMInfo.wOEMNodeAddress[2] );
pAdapter->RxMode.wStationAddr[2]=pAdapter->EEPROMInfo.wOEMNodeAddress[2];
DebugMsg("Station Addresses Set-- Done ! \n");
DebugMsg(" Rx Mode Station Address:(H) 0x%04X : 0x%04X : 0x%04X (L)\n",
NIC_READ_PORT_USHORT(pAdapter->IoBaseAddress,STATION_ADDRESS_HIGH_REGISTER ) ,
NIC_READ_PORT_USHORT(pAdapter->IoBaseAddress,STATION_ADDRESS_MID_REGISTER ) ,
NIC_READ_PORT_USHORT(pAdapter->IoBaseAddress,STATION_ADDRESS_LOW_REGISTER )
);
return ;
}
/*****************************************************************
*** This routine sets up the multicast list on the adapter.
**/
NIC_STATUS NIC_RxModeMulticast ( IN PNIC_INFORMATION pAdapter )
{
return NIC_STATUS_SUCCESS;
}
/****************************************************************
*** Clear all bits in hash filter and setup the multicast address bit.
**/
void NIC_RxModeHashFilter(IN PNIC_INFORMATION pAdapter)
{
}
/***********************************************************************
*** This routine returns a bit corresponding to the hash address.
**/
USHORT NIC_RxModeHashAddr(IN PUCHAR Address)
{
ULONG crc, carry, count, bit;
UCHAR thisByte;
/* Intialize CRC.*/
crc = 0xffffffff;
for (count = 0; count < 6; count++)
{
thisByte = Address[count];
for ( bit = 0; bit < 8; bit++)
{
carry = ((crc & 0x80000000) ? 1 : 0) ^ (thisByte & 0x01);
crc <<= 1;
thisByte >>= 1;
if (carry) crc = ( crc ^ 0x04c11db6 ) | carry;
}
}
return (USHORT) (crc & 0x000003FF) ;
}
/** about are routines about set rx filter
*** end of multi.c
***************************************************************************************/
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -