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

📄 tms380tr.h

📁 linux-2.6.15.6
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * OPEN Command Parameter List (OCPL) (can be reused, if the adapter has to * be reopened) */#define BUFFER_SIZE	2048		/* Buffers on Adapter. */#define TPL_SIZE	8+6*TX_FRAG_NUM /* Depending on fragments per TPL. */#define RPL_SIZE	14		/* (with TI firmware v2.26 handling					 * up to nine fragments possible)					 */#define TX_BUF_MIN	20		/* ??? (Stephan: calculation with */#define TX_BUF_MAX	40		/* BUFFER_SIZE and MAX_FRAME_SIZE) ??? 					 */#define DISABLE_EARLY_TOKEN_RELEASE 	0x1000/* OPEN Options (high-low) */#define WRAP_INTERFACE		0x0080	/* Inserting omitted for test					 * purposes; transmit data appears					 * as receive data. (useful for					 * testing; change: CLOSE necessary)					 */#define DISABLE_HARD_ERROR	0x0040	/* On HARD_ERROR & TRANSMIT_BEACON					 * no RING.STATUS interrupt.					 */#define DISABLE_SOFT_ERROR	0x0020	/* On SOFT_ERROR, no RING.STATUS					 * interrupt.					 */#define PASS_ADAPTER_MAC_FRAMES	0x0010	/* Passing unsupported MAC frames					 * to system.					 */#define PASS_ATTENTION_FRAMES	0x0008	/* All changed attention MAC frames are					 * passed to the system.					 */#define PAD_ROUTING_FIELD	0x0004	/* Routing field is padded to 18					 * bytes.					 */#define FRAME_HOLD		0x0002	/*Adapter waits for entire frame before					 * initiating DMA transfer; otherwise:					 * DMA transfer initiation if internal					 * buffer filled.					 */#define CONTENDER		0x0001	/* Adapter participates in the monitor					 * contention process.					 */#define PASS_BEACON_MAC_FRAMES	0x8000	/* Adapter passes beacon MAC frames					 * to the system.					 */#define EARLY_TOKEN_RELEASE 	0x1000	/* Only valid in 16 Mbps operation;					 * 0 = ETR. (no effect in 4 Mbps					 * operation)					 */#define COPY_ALL_MAC_FRAMES	0x0400	/* All MAC frames are copied to					 * the system. (after OPEN: duplicate					 * address test (DAT) MAC frame is 					 * first received frame copied to the					 * system)					 */#define COPY_ALL_NON_MAC_FRAMES	0x0200	/* All non MAC frames are copied to					 * the system.					 */#define PASS_FIRST_BUF_ONLY	0x0100	/* Passes only first internal buffer					 * of each received frame; FrameSize					 * of RPLs must contain internal					 * BUFFER_SIZE bits for promiscous mode.					 */#define ENABLE_FULL_DUPLEX_SELECTION	0x2000  					/* Enable the use of full-duplex					 * settings with bits in byte 22 in					 * ocpl. (new feature in firmware					 * version 3.09)					 *//* Full-duplex settings */#define OPEN_FULL_DUPLEX_OFF	0x0000#define OPEN_FULL_DUPLEX_ON	0x00c0#define OPEN_FULL_DUPLEX_AUTO	0x0080#define PROD_ID_SIZE	18	/* Length of product ID. */#define TX_FRAG_NUM	3	 /* Number of fragments used in one TPL. */#define TX_MORE_FRAGMENTS 0x8000 /* Bit set in DataCount to indicate more				  * fragments following.				  *//* XXX is there some better way to do this? */#define ISA_MAX_ADDRESS 	0x00ffffff#define PCI_MAX_ADDRESS		0xffffffff#pragma pack(1)typedef struct {	u_int16_t OPENOptions;	u_int8_t  NodeAddr[6];	/* Adapter node address; use ROM 				 * address				 */	u_int32_t GroupAddr;	/* Multicast: high order				 * bytes = 0xC000				 */	u_int32_t FunctAddr;	/* High order bytes = 0xC000 */	u_int16_t RxListSize;	/* RPL size: 0 (=26), 14, 20 or				 * 26 bytes read by the adapter.				 * (Depending on the number of 				 * fragments/list)				 */	u_int16_t TxListSize;	/* TPL size */	u_int16_t BufSize;	/* Is automatically rounded up to the				 * nearest nK boundary.				 */	u_int16_t FullDuplex;	u_int16_t Reserved;	u_int8_t  TXBufMin;	/* Number of adapter buffers reserved				 * for transmission a minimum of 2				 * buffers must be allocated.				 */	u_int8_t  TXBufMax;	/* Maximum number of adapter buffers				 * for transmit; a minimum of 2 buffers				 * must be available for receive.				 * Default: 6				 */	u_int16_t ProdIDAddr[2];/* Pointer to product ID. */} OPB, *OPB_Ptr;#pragma pack()/* * SCB: adapter commands enabled by the host system started by writing * CMD_INTERRUPT_ADAPTER | CMD_EXECUTE (|SCB_REQUEST) to the SIFCMD IO * register. (special case: | CMD_SYSTEM_IRQ for initialization) */#pragma pack(1)typedef struct {	u_int16_t CMD;		/* Command code */	u_int16_t Parm[2];	/* Pointer to Command Parameter Block */} SCB;	/* System Command Block (32 bit physical address; big endian)*/#pragma pack()/* * SSB: adapter command return status can be evaluated after COMMAND_STATUS * adapter to system interrupt after reading SSB, the availability of the SSB * has to be told the adapter by writing CMD_INTERRUPT_ADAPTER | CMD_SSB_CLEAR * in the SIFCMD IO register. */#pragma pack(1)typedef struct {	u_int16_t STS;		/* Status code */	u_int16_t Parm[3];	/* Parameter or pointer to Status Parameter				 * Block.				 */} SSB;	/* System Status Block (big endian - physical address)  */#pragma pack()typedef struct {	unsigned short BurnedInAddrPtr;	/* Pointer to adapter burned in					 * address. (BIA)					 */	unsigned short SoftwareLevelPtr;/* Pointer to software level data. */	unsigned short AdapterAddrPtr;	/* Pointer to adapter addresses. */	unsigned short AdapterParmsPtr;	/* Pointer to adapter parameters. */	unsigned short MACBufferPtr;	/* Pointer to MAC buffer. (internal) */	unsigned short LLCCountersPtr;	/* Pointer to LLC counters.  */	unsigned short SpeedFlagPtr;	/* Pointer to data rate flag.					 * (4/16 Mbps)					 */	unsigned short AdapterRAMPtr;	/* Pointer to adapter RAM found. (KB) */} INTPTRS;	/* Adapter internal pointers */#pragma pack(1)typedef struct {	u_int8_t  Line_Error;		/* Line error: code violation in					 * frame or in a token, or FCS error.					 */	u_int8_t  Internal_Error;	/* IBM specific. (Reserved_1) */	u_int8_t  Burst_Error;	u_int8_t  ARI_FCI_Error;	/* ARI/FCI bit zero in AMP or					 * SMP MAC frame.					 */	u_int8_t  AbortDelimeters;	/* IBM specific. (Reserved_2) */	u_int8_t  Reserved_3;	u_int8_t  Lost_Frame_Error;	/* Receive of end of transmitted					 * frame failed.					 */	u_int8_t  Rx_Congest_Error;	/* Adapter in repeat mode has not					 * enough buffer space to copy incoming					 * frame.					 */	u_int8_t  Frame_Copied_Error;	/* ARI bit not zero in frame					 * addressed to adapter.					 */	u_int8_t  Frequency_Error;	/* IBM specific. (Reserved_4) */	u_int8_t  Token_Error;		/* (active only in monitor station) */	u_int8_t  Reserved_5;	u_int8_t  DMA_Bus_Error;	/* DMA bus errors not exceeding the					 * abort thresholds.					 */	u_int8_t  DMA_Parity_Error;	/* DMA parity errors not exceeding					 * the abort thresholds.					 */} ERRORTAB;	/* Adapter error counters */#pragma pack()/*--------------------- Send and Receive definitions -------------------*/#pragma pack(1)typedef struct {	u_int16_t DataCount;	/* Value 0, even and odd values are				 * permitted; value is unaltered most				 * significant bit set: following				 * fragments last fragment: most				 * significant bit is not evaluated.				 * (???)				 */	u_int32_t DataAddr;	/* Pointer to frame data fragment;				 * even or odd.				 */} Fragment;#pragma pack()#define MAX_FRAG_NUMBERS    9	/* Maximal number of fragments possible to use				 * in one RPL/TPL. (depending on TI firmware 				 * version)				 *//* * AC (1), FC (1), Dst (6), Src (6), RIF (18), Data (4472) = 4504 * The packet size can be one of the follows: 548, 1502, 2084, 4504, 8176, * 11439, 17832. Refer to TMS380 Second Generation Token Ring User's Guide * Page 2-27. */#define HEADER_SIZE		(1 + 1 + 6 + 6)#define SRC_SIZE		18#define MIN_DATA_SIZE		516#define DEFAULT_DATA_SIZE	4472#define MAX_DATA_SIZE		17800#define DEFAULT_PACKET_SIZE (HEADER_SIZE + SRC_SIZE + DEFAULT_DATA_SIZE)#define MIN_PACKET_SIZE     (HEADER_SIZE + SRC_SIZE + MIN_DATA_SIZE)#define MAX_PACKET_SIZE     (HEADER_SIZE + SRC_SIZE + MAX_DATA_SIZE)/* * Macros to deal with the frame status field. */#define AC_NOT_RECOGNIZED	0x00#define GROUP_BIT		0x80#define GET_TRANSMIT_STATUS_HIGH_BYTE(Ts) ((unsigned char)((Ts) >> 8))#define GET_FRAME_STATUS_HIGH_AC(Fs)	  ((unsigned char)(((Fs) & 0xC0) >> 6))#define GET_FRAME_STATUS_LOW_AC(Fs)       ((unsigned char)(((Fs) & 0x0C) >> 2))#define DIRECTED_FRAME(Context)           (!((Context)->MData[2] & GROUP_BIT))/*--------------------- Send Functions ---------------------------------*//* define TX_CSTAT _REQUEST (R) and _COMPLETE (C) values (high-low) */#define TX_VALID		0x0080	/* R: set via TRANSMIT.VALID interrupt.					 * C: always reset to zero!					 */#define TX_FRAME_COMPLETE	0x0040	/* R: must be reset to zero.					 * C: set to one.					 */#define TX_START_FRAME		0x0020  /* R: start of a frame: 1 					 * C: unchanged.					 */#define TX_END_FRAME		0x0010  /* R: end of a frame: 1					 * C: unchanged.					 */#define TX_FRAME_IRQ		0x0008  /* R: request interrupt generation					 * after transmission.					 * C: unchanged.					 */#define TX_ERROR		0x0004  /* R: reserved.					 * C: set to one if Error occurred.					 */#define TX_INTERFRAME_WAIT	0x0004#define TX_PASS_CRC		0x0002  /* R: set if CRC value is already					 * calculated. (valid only in					 * FRAME_START TPL)					 * C: unchanged.					 */#define TX_PASS_SRC_ADDR	0x0001  /* R: adapter uses explicit frame					 * source address and does not overwrite					 * with the adapter node address.					 * (valid only in FRAME_START TPL)					 *					 * C: unchanged.					 */#define TX_STRIP_FS		0xFF00  /* R: reserved.					 * C: if no Transmission Error,					 * field contains copy of FS byte after					 * stripping of frame.					 *//* * Structure of Transmit Parameter Lists (TPLs) (only one frame every TPL, * but possibly multiple TPLs for one frame) the length of the TPLs has to be * initialized in the OPL. (OPEN parameter list) */#define TPL_NUM		3	/* Number of Transmit Parameter Lists.				 * !! MUST BE >= 3 !!				 */#pragma pack(1)typedef struct s_TPL TPL;struct s_TPL {	/* Transmit Parameter List (align on even word boundaries) */	u_int32_t NextTPLAddr;		/* Pointer to next TPL in chain; if					 * pointer is odd: this is the last					 * TPL. Pointing to itself can cause					 * problems!					 */	volatile u_int16_t Status;	/* Initialized by the adapter:					 * CSTAT_REQUEST important: update least					 * significant bit first! Set by the					 * adapter: CSTAT_COMPLETE status.					 */	u_int16_t FrameSize;		/* Number of bytes to be transmitted					 * as a frame including AC/FC,					 * Destination, Source, Routing field					 * not including CRC, FS, End Delimiter					 * (valid only if START_FRAME bit in 					 * CSTAT nonzero) must not be zero in					 * any list; maximum value: (BUFFER_SIZE					 * - 8) * TX_BUF_MAX sum of DataCount					 * values in FragmentList must equal					 * Frame_Size value in START_FRAME TPL!					 * frame data fragment list.					 */	/* TPL/RPL size in OPEN parameter list depending on maximal	 * numbers of fragments used in one parameter list.	 */	Fragment FragList[TX_FRAG_NUM];	/* Maximum: nine frame fragments in one					 * TPL actual version of firmware: 9					 * fragments possible.					 */#pragma pack()	/* Special proprietary data and precalculations */	TPL *NextTPLPtr;		/* Pointer to next TPL in chain. */	unsigned char *MData;	struct sk_buff *Skb;	unsigned char TPLIndex;	volatile unsigned char BusyFlag;/* Flag: TPL busy? */	dma_addr_t DMABuff;		/* DMA IO bus address from dma_map */};/* ---------------------Receive Functions-------------------------------* * define RECEIVE_CSTAT_REQUEST (R) and RECEIVE_CSTAT_COMPLETE (C) values. * (high-low) */#define RX_VALID		0x0080	/* R: set; tell adapter with					 * RECEIVE.VALID interrupt.					 * C: reset to zero.					 */#define RX_FRAME_COMPLETE	0x0040  /* R: must be reset to zero,					 * C: set to one.					 */#define RX_START_FRAME		0x0020  /* R: must be reset to zero.					 * C: set to one on the list.					 */#define RX_END_FRAME		0x0010  /* R: must be reset to zero.					 * C: set to one on the list					 * that ends the frame.					 */#define RX_FRAME_IRQ		0x0008  /* R: request interrupt generation					 * after receive.					 * C: unchanged.					 */#define RX_INTERFRAME_WAIT	0x0004  /* R: after receiving a frame:					 * interrupt and wait for a					 * RECEIVE.CONTINUE.					 * C: unchanged.					 */#define RX_PASS_CRC		0x0002  /* R: if set, the adapter includes					 * the CRC in data passed. (last four 					 * bytes; valid only if FRAME_START is					 * set)					 * C: set, if CRC is included in					 * received data.					 */#define RX_PASS_SRC_ADDR	0x0001  /* R: adapter uses explicit frame					 * source address and does not					 * overwrite with the adapter node					 * address. (valid only if FRAME_START					 * is set)

⌨️ 快捷键说明

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