⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sar.h

📁 网络驱动开发
💻 H
📖 第 1 页 / 共 2 页
字号:
   {
       ULONG   Rx_Cell_Cnt:20;             // the least significant bit
       ULONG   reserved:12;
   };

   ULONG   reg;
}
   RX_CELLCNT,
   *PRX_CELLCNT,
   TX_CELLCNT,
   *PTX_CELLCNT;


typedef union  _RX_DROPPKTCNT_REG
{
   struct
   {
       ULONG   Rx_Drop_PktCnt:20;      // the least significant bit
       ULONG	reserved:12;
   };

   ULONG   reg;
}
   RX_AAL5_DROPPKTCNT,
   *PRX_AAL5_DROPPKTCNT,
   RX_RAW_DROPPKTCNT,
   *PRX_RAW_DROPPKTCNT;


typedef union  _REAL_TIME_REG
{
   struct
   {
       ULONG   Real_Time_30ns:8;       // the least significant bit
       ULONG   Real_Time_3p30us:22;
       ULONG   reserved:2;
   };

   ULONG   reg;
}
   REAL_TIME_REG,
   *PREAL_TIME_REG;


typedef union  _CURRENT_TIME_REG
{
   struct
   {
       ULONG   CBR_Current_Time:8;     // the least significant bit
       ULONG   ABR_Current_Time:8;     // the least significant bit
       ULONG   reserved:16;
   };

   ULONG   reg;
}
   CURRENT_TIME_REG,
   *PCURRENT_TIME_REG;


typedef union  _TEST_CNTRL_REG
{
   struct
   {
       ULONG   Rx_DMA_Disable:1;       // the least significant bit
       ULONG   Tx_DMA_Disable:1;
       ULONG   Counter_Segment:1;
       ULONG   Counter_Force_Count:1;
       ULONG   Force_All_Intr:1;
       ULONG   Ph_Test:1;
       ULONG   Ph_GFC_Set_A:1;
       ULONG   Ph_GFC_Halt:1;
       ULONG   RATO_Poll_Time:1;
       ULONG   LastRM_Poll_Time:1;
       ULONG   Tac_Timer_Speedup:1;
       ULONG   Tds_Wait:1;
       ULONG   Report_Segment:1;
       ULONG   reserved:19;
   };

   ULONG   reg;
}
   TEST_CNTRL_REG,
   *PTEST_CNTRL_REG;


typedef struct	_TX_PENDING_SLOT_REGS
{
   TX_PENDING_SLOTS_CTL    Cntrl;
   ULONG                   Base_Addr;
}
   TX_PENDING_SLOT,
   *PTX_PENDING_SLOT;


typedef struct	_RX_PENDING_SLOT_REGS
{
   RX_PENDING_SLOTS_CTL    Cntrl;
   ULONG                   Base_Addr;
}
   RX_PENDING_SLOT,
   *PRX_PENDING_SLOT;


#define	MAX_SLOTS_NUMBER        8

typedef struct	_TBATM155_SAR
{
   TX_PENDING_SLOT         Tx_Pending_Slots[MAX_SLOTS_NUMBER];
   RX_PENDING_SLOT         Rx_Pending_Slots[MAX_SLOTS_NUMBER];
   TB155PCISAR_CNTRL1      SAR_Cntrl1;
   TB155PCISAR_CNTRL2      SAR_Cntrl2;
   INTR_STATUS_REGISTER    Intr_Status;
   INTR_ENB_REGISTER       Intr_Enb;
   INTR_HLDOFF_REG         Intr_Hldoff;
   TX_FS_LIST_PTRS         Tx_FS_List_ptrs;
   TX_REPORT_BASE          Tx_Report_Base;
   RX_REPORT_BASE          Rx_Report_Base;
   TX_REPORT_PTR           Tx_Report_Ptr;
   RX_REPORT_PTR           Rx_Report_Ptr;
   RX_SLOT_CONG_TH         Rx_Slot_Cong_Th;
   TX_ABR_ADTF             Tx_ABR_ADTF;
   TX_ABR_NRM_TRM          Tx_ABR_Nrm_Trm;
   PEEPHOLE_CMD            PeepHole_Cmd;
   PEEPHOLE_DATA           PeepHole_Data;
   RX_RAW_SLOT_TAG         Rx_Raw_Slot_Tag;
   RX_CELLCNT              Rx_CellCnt;
   RX_AAL5_DROPPKTCNT      Rx_AAL5_DropPktCnt;
   RX_RAW_DROPPKTCNT       Rx_Raw_DropPktCnt;
   TX_CELLCNT              Tx_CellCnt;
   REAL_TIME_REG           Real_Time;
   CURRENT_TIME_REG        Current_Time;
   TEST_CNTRL_REG          Test_Cntrl;
}
	TBATM155_SAR,
	*PTBATM155_SAR;


//
//	The following defines are used for the interrupt registers.
//
//	Intr_Status	-   If a bit is set then the interrupt is pending.
//			        Write 1 to clear status bits.
//	Intr_En     -   If a bit is set then the interrupt is enabled.
//

#define TBATM155_INT_TX_FATAL_ERR          BIT(20)
#define TBATM155_INT_PCI_FATAL_ERR         BIT(19)
#define TBATM155_INT_PHY_INTR              BIT(18)
#define TBATM155_INT_PH_DONE               BIT(17)
#define TBATM155_INT_PH_ACCESS_ERR         BIT(16)
#define TBATM155_INT_HOST_ACCESS_ERR       BIT(15)
#define TBATM155_INT_TX_FREE_SLOT_UNFL     BIT(14)
#define TBATM155_INT_TX_IOC                BIT(13)
#define TBATM155_INT_FM_RESYNCH_DONE       BIT(12)
#define TBATM155_INT_RX_FREE_SLOT_OVFL     BIT(11)
#define TBATM155_INT_RX_DATA_FIFO_OVFL     BIT(10)
#define TBATM155_INT_RX_NO_BIG_SLOTS       BIT(9)
#define TBATM155_INT_RX_NO_SMALL_SLOTS     BIT(8)
#define TBATM155_INT_RX_NO_RAW_SLOTS       BIT(7)
#define TBATM155_INT_RX_BIG_SLOTS_LOW      BIT(6)
#define TBATM155_INT_RX_SMALL_SLOTS_LOW    BIT(5)
#define TBATM155_INT_RX_RAW_SLOTS_LOW      BIT(4)
#define TBATM155_INT_RX_UNOPENED_VC        BIT(3)
#define TBATM155_INT_RX_UNKNOWN_VC         BIT(2)
#define TBATM155_INT_RX_UNKNOWN_ACK        BIT(1)
#define TBATM155_INT_RX_IOC                BIT(0)


#define TBATM155_REG_INT_VALID (TBATM155_INT_TX_FATAL_ERR          |	\
                                TBATM155_INT_PCI_FATAL_ERR         | 	\
                                TBATM155_INT_PHY_INTR              | 	\
                                TBATM155_INT_HOST_ACCESS_ERR       | 	\
                                TBATM155_INT_TX_FREE_SLOT_UNFL     | 	\
                                TBATM155_INT_TX_IOC                | 	\
                                TBATM155_INT_RX_FREE_SLOT_OVFL     | 	\
                                TBATM155_INT_RX_DATA_FIFO_OVFL     | 	\
                                TBATM155_INT_RX_NO_BIG_SLOTS       | 	\
                                TBATM155_INT_RX_NO_SMALL_SLOTS     | 	\
                                TBATM155_INT_RX_BIG_SLOTS_LOW      | 	\
                                TBATM155_INT_RX_SMALL_SLOTS_LOW    |    \
                                TBATM155_INT_RX_UNOPENED_VC        | 	\
                                TBATM155_INT_RX_UNKNOWN_VC         |	\
                                TBATM155_INT_RX_IOC)

#define TBATM155_REG_INT_ERROR (TBATM155_INT_TX_FATAL_ERR          |	\
                                TBATM155_INT_PCI_FATAL_ERR         |    \
                                TBATM155_INT_TX_FREE_SLOT_UNFL     | 	\
                                TBATM155_INT_RX_FREE_SLOT_OVFL)
   


//
//	This structure contains informaiton for managing the transmit and
//	receive DMA queues.
//
typedef struct _RECV_BUFFER_QUEUE
{
   //
   //	Count of available receive buffers in the free list.
   //
   ULONG                   BufferCount;

   //
   //	Free Receive buffer queue.
   //
   //	This is a list of buffers that are no longer in use.
   //	When the buffer is first allocated this is NULL.  Once a VC
   //  is created and activated then this list will get "larger".
   //  Also, this list will get "smaller" if a VC is deactivated.
   //
	PRECV_BUFFER_HEADER     BufListHead;
	PRECV_BUFFER_HEADER     BufListTail;

	NDIS_SPIN_LOCK		    lock;

}
   RECV_BUFFER_QUEUE,
   *PRECV_BUFFER_QUEUE;


//
//	This structure contains informaiton for managing the transmit and
//	receive DMA queues.
//
struct _RECV_DMA_QUEUE
{
	//
	//	List of "Small" buffers that are awaiting DMA completion interrupt.
	//

   RECV_BUFFER_QUEUE       CompletingSmallBufQ;

   //
   //  Note:
   //      The field "Slot Tag" in entries of Rx report queue
   //      reflects whatever the value of driver writes to
   //      "Slot Tag" bits in Rx Pending control register, so driver
   //      assignes an unique "Slot Tag" for each receive buffer in 
   //      order to search the receive buffer from the queue.
   //
   //   The current Slot Tag of "Small" buffers that will be assigned to
   //   the next allocated receive buffer.
   //   1. Slot Tag range from 1 to 4095.
   //   2. Initialize after soft reset controller.
   //
   USHORT                  CurrentSlotTagOfSmallBufQ;

   //
   //	List of "Big" buffers that are awaiting DMA completion interrupt.
   //
   RECV_BUFFER_QUEUE       CompletingBigBufQ;

   //
   //   The current Slot Tag of "Big" buffers that will be assigned to
   //   the next allocated receive buffer.
   //   1. Slot Tag range from 1 to 4095
   //   2. Initialize after soft reset controller.
   //
   USHORT                  CurrentSlotTagOfBigBufQ;
		
   //
   //	The following are for keeping track with the "Big" receive slots.
   //
   ULONG                   MaximumReceiveBigSlots;
   ULONG                   RemainingReceiveBigSlots;

	//
	//	The following are for keeping track with the "Small" receive slots.
	//
   ULONG                   MaximumReceiveSmallSlots;
   ULONG                   RemainingReceiveSmallSlots;

   //
   // The following are for keeping track with the informtion of
   // report queue handling.
   //
   // Keep track where was the stop point of last time we handled.
   //
   UINT                    PrevRxReportQIndex;

#if    DBG
   ULONG                   dbgTotalUsedSmallRxSlots;
   ULONG                   dbgTotalUsedBigRxSlots;
#endif // end of DBG

	NDIS_SPIN_LOCK			lock;
};


//
//	This structure contains informaiton for managing the transmit and
//	receive DMA queues.
//
struct _XMIT_DMA_QUEUE
{
   //
   //	List of packets that are waiting to be dma'd.
   //
   PACKET_QUEUE			DmaWait;


   //
   //	The following are for keeping track with the slots.
   //
   ULONG               MaximumTransmitSlots;

   ULONG               RemainingTransmitSlots;

#if    DBG
   ULONG               dbgTotalPostedTxSlots;
#endif // end of DBG

   //
   // The following are for keeping track with the informtion of
   // report queue handling.
   //
   // Keep track where was the stop point of last time we handled.
   //
   UINT                PrevTxReportQIndex;

	NDIS_SPIN_LOCK		lock;
};


//
//	Contains information about the Segmentation and Reassembly unit.
//
struct _SAR_INFO
{
   NDIS_SPIN_LOCK		lockFreeXmitSegment;

   //
   //	DMA queues for transmit and receive.
   //
   XMIT_DMA_QUEUE		XmitDmaQ;
   RECV_DMA_QUEUE		RecvDmaQ;


   //
   //  Free Receive "SMALL" buffer queue.
   //
   //  This is a list of buffers that are no longer in use.
   //  When the buffer is first allocated this is NULL.  Once a VC
   //  is created and activated then this list will get "larger".
   //  Also, this list will get "smaller" each VC is deactivated.
   //
   RECV_BUFFER_QUEUE      FreeSmallBufferQ;
   BOOLEAN                fSmallSlotsLowOrNone;

   //
   //	Free Receive "BIG" buffer queue.
   //
   //	This is a list of buffers that are no longer in use.
   //	When the buffer is first allocated this is NULL.  Once a VC
   //  is created and activated then this list will get "larger".
   //  Also, this list will get "smaller" each VC is deactivated.
   //
   RECV_BUFFER_QUEUE      FreeBigBufferQ;
   BOOLEAN                fBigllSlotsLowOrNone;


   //
   //	"BIG" Receive Pool queue.
   //
   //	This is a queue of RECV_BUF_POOL buffers that are allocated.
   //	When the buffer is first allocated this is NULL. After more
   //  VCs have been created, this queue will get "larger" until 
   //  allocated the maximum number of receive buffers .
	//
   PRECV_BUFFER_POOL      BigRecvPoolQ;

   //
   //  Point to the end of BigRecvPoolQ.
   //
   PRECV_BUFFER_POOL      BigRecvPoolTail;

   //
   //  Number of allocated Big Rx buffers.
   //
   USHORT                 AllocatedBigRecvBuffers;


   //
   //	"SMALL" Receive Pool queue.
   //
   //	This is a queue of RECV_BUF_POOL buffers that are allocated.
   //	When the buffer is first allocated this is NULL. After more
   //  VCs have been created, this queue will get "larger" until 
   //  allocated the maximum number of receive buffers .
   //
   PRECV_BUFFER_POOL      SmallRecvPoolQ;

   //
   //  Point to the end of SmallRecvPoolQ.
   //
   PRECV_BUFFER_POOL      SmallRecvPoolTail;

   //
   //  Number of allocated Small Rx buffers.
   //
   USHORT                  AllocatedSmallRecvBuffers;

   //
   //  The maximum number of allowed allocated Rx buffers for 
   //  each Small & Big sets of Rx buffers.
   //
   USHORT                  MaxRecvBufferCount;

#if    DBG

   //
   USHORT                  dbgTxPendingSlot;
   USHORT                  dbgRxPendingSlot;

#endif // end of DBG

};


#endif // __SAR_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -