📄 hsm.h
字号:
*//* * Address Structure. */typedef struct _AddrStruct { UCHAR *VirtAddr; /* pointer to Virtual address */ UCHAR *PhysAddr; /* pointer to Physical address */ UCHAR *OrigPtr; /* Pointer to the Virtual Address - before alingment */ UINT OrigSize; /* Size of the buffer - before alingment */ UINT BufSize; /* Size of the buffer */ /*UCHAR OrigPtr; Pointer to the Virtual Address - before alingment */ /*UCHAR OrigSize; Size of the buffer - before alingment */ /*USHORT BufSize; Size of the buffer */ PVOID pCookie; /* Pointer to the cookie. */} AddrStruct;/* * Descriptor structure. */typedef struct BufDesc { volatile UINT link; /* Link to the next descriptor. */ volatile UINT BufPtr; /* Pointer to the buffer/fragment. */ volatile UINT CmdSts; /* Status field */ volatile UINT ExtSts; /* Extended status field */} DevDesc;/* * Transmit Control Block. */typedef struct _HsmTCB { struct _HsmTCB *pNext; /* Pointer to the Next TCB in the list. */ PVOID pOsCtrlBlk; /* Pointer to the OS dependent packet structure eg. mblk pointer in Unix and pointer to NDIS in Windows. */ PVOID pOldOsCtrlBlk; /* Pointer to the old packet if pull up of the packet has been done. */ USHORT TxStatus; /* Transmit Status and error conditions. */ volatile DevDesc *pStartDesc; /* Pointer to the first transmit descriptor for the current packet. */ volatile DevDesc *pStartDescPa; /* Pointer to the first transmit descriptor for the current packet.*/ volatile DevDesc *pEndDesc; /* Pointer to the last transmit descriptor for the current packet. */ volatile DevDesc *pEndDescPa; /* Pointer to the last transmit descriptor for the current packet. */} HsmTCB;/* * Receive Control Block. */typedef struct _HsmRCB { struct _HsmRCB *pNext; /* Pointer to the Next TCB in the list. */ PVOID pOsCtrlBlk; /* Pointer to the OS dependent packet structure eg. mblk pointer in Unix and pointer to NDIS in Windows. */ volatile DevDesc *pRxDp; /*Pointer to the corresponding recv. desc */ volatile DevDesc *pRxDpPa; /*Pointer to the corresponding recv. desc */ UCHAR *pDataBuf; /* Starting address (virtual) of the buffer given to the descriptor */ UCHAR Status; /* Status of the HsmRCB (FREE / INUSE / BAD) */ UCHAR More; /* Set to 1 if more the packet is spread across to the next HsmRCB, 0 otherwise */ USHORT PktSize; UINT ExtSts;} HsmRCB;/* * Priority Queue structure. */typedef struct _PriorityQue { USHORT iMaxRxDesc; /* Max. Rx Desc. for this priority. */ USHORT iFreeRxDesc; /* No. of free Rx Desc. for this priority. */ USHORT iMaxTxDesc; /* Max. Rx Desc. for this priority. */ USHORT iFreeTxDesc; /* No of free Rx Desc. for this priority. */ volatile DevDesc *pTxdArray; /* Pointer to the Txd array. */ volatile DevDesc *pTxdArrayPa; /* Physical addr to Txd array. */ volatile DevDesc *pRxdArray; /* Pointer to the Rxd array. */ volatile DevDesc *pRxdArrayPa; /* Phys.Addr to Rxd array. */ HsmTCB *pTcbArray; /* Pointer to the TCB array. */ HsmRCB *pRcbArray; /* Pointer to the HsmRCB array. */ HsmTCB *pTcbListHead; /* Pointer to TCB head of this priority. */ HsmTCB *pTcbListNext; /* Pointer to TCB next of this priority. */ HsmRCB *pRcbListHead; /* Pointer to RCB head of this priority. */ HsmRCB *pRcbListNext; /* Pointer to RCB next of this priority. */ HsmRCB *pRcbListTail; /* Pointer to RCB tail next of this priority. */} PriorityQue;/* * Statistics Info structure */typedef struct _StatInfo{ UINT txOkCount; /* XMIT_OK */ UINT rxOkCount; /* RCV_OK */ UINT txErrorCount; /* XMIT_ERROR */ UINT rxErrorCount; /* RCV_ERROR */ UINT txDroppedCount; UINT rxDroppedCount; UINT rxNoBufferCount; /* RCV_NO_BUFFER */ /* RCV_OVERRUN */ UINT txDirectedByteCount; /* DIRECTED_BYTES_XMIT */ UINT txDirectedFrameCount; /* DIRECTED_FRAMES_XMIT */ UINT txMulticastByteCount; /* MULTICAST_BYTES_XMIT */ UINT txMulticastFrameCount; /* MULTICAST_FRAMES_XMIT */ UINT txBroadcastByteCount; /* BROADCAST_BYTES_XMIT */ UINT txBroadcastFrameCount; /* BROADCAST_FRAMES_XMIT */ UINT rxDirectedByteCount; /* DIRECTED_BYTES_RCV */ UINT rxDirectedFrameCount; /* DIRECTED_FRAMES_RCV */ UINT rxMulticastByteCount; /* MULTICAST_BYTES_RCV */ UINT rxMulticastFrameCount; /* MULTICAST_FRAMES_RCV */ UINT rxBroadcastByteCount; /* BROADCAST_BYTES_RCV */ UINT rxBroadcastFrameCount; /* BROADCAST_FRAMES_RCV */ UINT rxCrcErrorCount; /* RCV_CRC_ERROR */ UINT rxFaeCount; /* RCV_ERROR_ALIGNMENT */ UINT txAbortCount; /* RCV_ERROR_ALIGNMENT */ UINT txOneCollisionCount; /* XMIT_ONE_COLLISION */ UINT txTotCollisionCount; /* XMIT_ONE_COLLISION */ UINT txMultiCollisionCount; /* XMIT_MORE_COLLISIONS */ UINT txExcessiveCollisionCount;/* XMIT_EXCESS_COLLISIONS */ UINT txDeferredCount; /* XMIT_DEFERRED */ UINT txMaxCollisionCount; /* XMIT_MAX_COLLISIONS */ UINT txLateCollisionCount; /* XMIT_LATE_COLLISIONS */ UINT txUnderrunCount; /* XMIT_UNDERRUN */ UINT txHeartbeatFailureCount; /* XMIT_HEARTBEAT_FAILURE */ UINT txCrsLostCount; /* XMIT_TIMES_CRS_LOST */ UINT rxSymbolErrors; UINT rxFramesTooLong; UINT txSQEerrors; UINT AdapterReset; UINT rxIRLErrors; UINT rxBadOpcodes; UINT rxPauseFrames; UINT txPauseFrames; } StatInfo;typedef struct _mcast_hash_t { UCHAR MulticastAddr[6]; UINT refCount; struct _mcast_hash_t *next;} mca_hash_t;/* * Adapter Context structure. */typedef struct _AdapterContext {#ifdef _GA622T_ int TxDp[4][4]; int RxDp[4][4];#elif _FA31X_ int TxDp[1][4]; int RxDp[1][4];#endif UCHAR AdapterStatus; /* Status of the adapter. */ UINT interruptStatus; UCHAR PMFlag; /* Flag used for Power Management. */ PriorityQue *PriQue; /* Priority Queue. */ UCHAR NumPrio; /* Number of priority queues supported. */ UCHAR TxNumPrio; /* Number of priority queues supported in Tx.*/ UCHAR RxNumPrio; /* Number of priority queues supported in Rx.*/ UCHAR OsPrio; /* Number of priority queues supported by OS */ USHORT MaxPktSize; /* Size of the Rx buffer. */ UINT JumboPktSize; /* Size of the Packet. */ StatInfo MacStats; /* Statistics structure. */ mca_hash_t *mca_tbl[128][16]; /* Multicast table */ UCHAR TxPriMapVal; /* Priority mapping constant for Tx. */ UCHAR RxPriMapVal; /* Priority mapping constant for Rx. */ MacAddr PermMacAddr; /* Permanent MAC address. */ MacAddr CurrMacAddr; /* Current MAC address. */ USHORT MultiCastTableSize; /* Multicast Table size. */ USHORT MediaSpeed; /* Media Speed (10/100/1000 Mbps) */ /*Ramit : for INF speed */ USHORT InfMediaSpeed; /* INF Media Speed (10/100/1000 Mbps) */ UCHAR MediaType; /* Media Type */ UCHAR DuplexMode; /* Duplex Mode (FULL_DUPLEX / HALF_DUPLEX) */ /*Ramit : for INF speed */ UCHAR InfDuplexMode; /* INF Duplex Mode (FULL_DUPLEX / HALF_DUPLEX) */ UINT PhysCapabilities; /* Physical Capabilities of the adapter */ UINT rxMatchControl; /* Receive Filter value */ UCHAR IRQ; /* IRQ value. */ UCHAR *RegAddr; /* Memory space Address / IO space Address */ USHORT RegAddrSz; /* Size of the register mapping. */ PVOID AdapterLock; /* General purpose lock. */ PVOID TxLock; /* Lock used for synchronizing transmission.*/ USHORT CacheLineSize; /* Cache Line Size */ AddrStruct pDescList; /* Pointer to Descriptor pool (both Txd,Rxd)*/ PVOID pTcbArray; /* Pointer to TCB pool. */ PVOID pRcbArray; /* Pointer to HsmRCB pool. */ volatile UINT SWIFlag; /* Flag used for SWI processing. */ volatile UINT TxrcmpFlag;/* Flag used for Tx reset processing. */ volatile UINT TxEnableFlag;/* Flag used for Tx Idle. */ PVOID pCookie; /* Cookie for General purpose. */ PVOID pNsmContext; /* Pointer to NSM context */ UINT phyAddress; UINT TotTxdPhySz; /* Total size of the Tx descriptors */ /*Madhu : clean up*/ UINT CurrHoldOff; /*Ramit : Various Tunable parameters */ UINT NcBit; /* IEEE Non Compliance Bit */ UINT IntrHoldoff; /* Interruput Holdoff */ ULONG RxQueueSz[MAX_PRI_QUEUE]; /* The Recieve Descriptors for each priority*/ ULONG TxQueueSz[MAX_PRI_QUEUE]; /* The Transmit Descriptors for each priority*/ UINT TxDrth; /* Tx Drain Threshold */ UINT RxDrth; /* Rx Drain Threshold */ UINT TxFlth; /* Tx Fill Threshold */ UINT PauseCounterVal; /* Pause Frames Counter Delay */ UINT RxFFLO; UINT RxFFHI; UINT RxSTLO; UINT RxSTHI;#ifdef PM_WOL UINT CurrPowerStatus; UINT WakePatCount; UCHAR PowerPattern[MAX_POWER_PTRN][MAX_PAT_LEN]; /* Power pattern array */ UCHAR PatternCnt; /* Pattern count */ UINT PatLen[MAX_POWER_PTRN]; UCHAR MaskArray[MAX_POWER_PTRN][MAX_PAT_LEN/8 + 1]; /* Mask array */ UINT pmcsr_val; #endif#ifdef CHECKSUM /*Global variable to control Checksum offloading (this would be read from the registry)Initialized as all disabled*/ UINT TxTcpCheckSum; UINT TxUdpCheckSum; UINT TxIPCheckSum; UINT RxTcpCheckSum; UINT RxUdpCheckSum; UINT RxIPCheckSum; UINT ChksumFlags;#endif #ifdef FWARE_DOWNLOAD PVOID FileHandle; UINT FileLength;#endif } AdapterContext, *pAdapterContext;/* * Fragment Information Structure. */typedef struct _FragInfo { UCHAR *pFrag; /* Pointer to the fragment */ USHORT FragLen; /* Size of the fragment */}FragInfo;/* * Packet Information structure. */typedef struct _PktInfo { /*Madhu UCHAR NumFrags; Number of Fragments */ UINT NumFrags; /* Number of Fragments */ FragInfo FragArray[MAX_FRAGS]; /* Fragment Array */ PVOID pOSCtrlBlk; /* Pointer to OS control block */ UINT ChkSum; UINT TotalDataLength;} PktInfo;/* * Packet Structure. */typedef struct _PktStruct { USHORT PktCount; /* No.of Packets to be transmitted */ PktInfo PktArray[MAX_PKTS]; /* Array of packets */} PktStruct;/* * Multi List Structure used for Multicast address addition and deletion. */typedef struct _MultiList { struct _MultiList *Next; /* Link to next entry */ UCHAR MulticastAddr[6]; /* Multicast Address */} MultiList;/* Function prototypes */extern VOID HsmTxStart(AdapterContext *pAdapter, UINT Priority);extern VOID HsmRxStart(AdapterContext *pAdapter, UINT Priority);extern UCHAR HsmOpen(AdapterContext *pAdapter);extern UCHAR HsmClose(AdapterContext *pAdapter);/*MAdhu*/extern UCHAR HsmReset(AdapterContext *pAdapter, UINT aSynch);extern VOID HsmMaskIntr(AdapterContext *pAdapter, UINT Mask);extern UCHAR HsmInitialize(AdapterContext *pAdapter);extern UCHAR HsmTxInit(AdapterContext *pAdapter);extern CHAR HsmRxInit(AdapterContext *pAdapter);extern VOID HsmUnInitialize(AdapterContext *pAdapter);extern VOID HsmFreeResources(AdapterContext *pAdapter, UINT errcode);extern VOID HsmInitContext(AdapterContext *pAdapter);extern VOID HsmInitRegs(AdapterContext *pAdapter);extern VOID HsmCreateMapValue(AdapterContext *pAdapter);extern UCHAR HsmIsr(AdapterContext *pAdapter);extern UCHAR HsmInterruptPresent(AdapterContext *pAdapter);extern VOID HsmGetMacAddress( AdapterContext *pAdapter );extern UCHAR HsmSetMacAddress(AdapterContext *pAdapter, UCHAR *addr );extern UCHAR HsmGetStatistics(AdapterContext *pAdapter);extern UCHAR HsmClearStatistics(AdapterContext *pAdapter);extern UCHAR HsmRxFilter(AdapterContext *pAdapter, UINT RxFilterFlags);extern UCHAR HsmMulticastAdd(AdapterContext *pAdapter, MultiList *pMultiList, UCHAR ReloadFlag);extern UCHAR HsmMultiCastDelete( AdapterContext *pAdapter, MultiList *pMultiList);extern VOID ReadMIBCounters(AdapterContext *pAdapter);extern UCHAR GetHardwarePriority(AdapterContext *pAdap, UCHAR OsPriority);extern UCHAR GetOsPriority(AdapterContext *pAdap, UCHAR AdapPriority);extern USHORT HsmSendPkts(AdapterContext *pAdapter, PktStruct *pPkts, UCHAR Priority);extern UCHAR HsmSendPacket(AdapterContext *pAdapter, PktInfo *pPkt, UCHAR Priority);/*Madhu*/extern UCHAR HsmSetPhyCapabilities(AdapterContext *pAdapter, UINT PhysFlags,UINT SetSpeeed);/*extern UCHAR HsmSetPhyCapabilities(AdapterContext *pAdapter, UINT PhysFlags);*/extern VOID HsmTxCompleted(AdapterContext *pAdapter);extern VOID HsmReplenishRcbs(AdapterContext *pAdapter, UCHAR Priority, UINT LoadRxdp);extern VOID HsmRxPackets(AdapterContext *pAdapter);extern USHORT FreeTxDesc(AdapterContext *pAdapter,UCHAR Prio);#if 0extern UCHAR HsmAddWakeupPattern(AdapterContext *pAdapter, UCHAR *PowerPattern, UINT PatternLen, UINT MatchLen, UCHAR *MaskPtrn);extern UCHAR IsPowerPatternExsts(AdapterContext *pAdapter, UCHAR *PowerPattern, UCHAR *PatternIdx, UINT PatternLen );#endifextern VOID WriteMiiReg(AdapterContext *pAdapter, UINT phyReg, int phyData);extern UINT ReadMiiReg(AdapterContext *pAdapter, UINT phyReg);extern VOID WriteMiiPreamble(AdapterContext *pAdapter,UINT * pMear);extern VOID WriteMiiIdle(AdapterContext *pAdapter, UINT * pMear);extern VOID SetAutoNegOn(AdapterContext *pAdapter);extern VOID ReadEEWord (AdapterContext *, UINT *, UINT, USHORT *);#ifdef PM_WOLVOID HsmDumpPattern(AdapterContext *pAdapter);UCHAR IsPowerPatternExsts(AdapterContext *pAdapter,UCHAR *PowerPattern, UCHAR *pPatternIdx, UINT PatternLen); UCHAR HsmAddWakeupPattern(AdapterContext *pAdapter, UCHAR *PowerPattern, UINT PatternLen, UINT MatchLen, UCHAR *MaskPtrn);UCHAR HsmEnableWakeupPattern(AdapterContext *pAdapter, UCHAR *PowerPattern, UINT PatternLen);UCHAR HsmEnableWakeup(AdapterContext *pAdapter, UINT WakeType);UCHAR HsmDisableWakeup(AdapterContext *pAdapter, UINT WakeType);UCHAR HsmDisableWakeupPattern(AdapterContext *pAdapter, UCHAR *PowerPattern, UINT PatternLen);UCHAR HsmRemoveWakeupPattern(AdapterContext *pAdapter, UCHAR *PowerPattern, UINT PatternLen, UCHAR *MaskPtrn);UINT HsmGetWakeStatus(AdapterContext *pAdapter);VOID HsmChangeState(AdapterContext *pAdapter, UINT PmcsrVal);UINT HsmGetLowestPowerState(AdapterContext *pAdapter);UINT HsmPowerStateSupport(AdapterContext *pAdapter, UINT PowerState);USHORT AddPattern(AdapterContext *pAdapter, UCHAR PatternIdx, UCHAR *PowerPattern, UINT PatternLen, UINT MatchLen, UCHAR *MaskPtrn);#endif#ifdef FWARE_DOWNLOADVOID HsmDownLoadFirmwareInit(AdapterContext *pAdapter);VOID HsmDownLoadFirmwareWORD(AdapterContext *pAdapter, USHORT frData);UINT HsmStartFirmWareCode(AdapterContext *pAdapter);UCHAR HsmVerifyDownLoad(AdapterContext *pAdapter);#endif/* Function HsmgetMulticastSize added on 17072000 -Ravic */extern UINTHsmGetMulticastSize(AdapterContext *pAdapter);/* Function HsmGetMulticastList added on 17072000 -Ravic */UINTHsmGetMulticastList(AdapterContext *pAdapter,CHAR *Buffer,UINT Size);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -