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

📄 rclanmtl.h

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 H
📖 第 1 页 / 共 2 页
字号:
/*** *******************************************************************************     R C L A N M T L . H             $Revision: 6 $******  RedCreek I2O LAN Message Transport Layer header file.****  ---------------------------------------------------------------------**  ---     Copyright (c) 1997-1999, RedCreek Communications Inc.     ---**  ---                   All rights reserved.                        ---**  ---------------------------------------------------------------------****  File Description:****  Header file for host I2O (Intelligent I/O) LAN message transport layer **  API and data types.****  This program is free software; you can redistribute it and/or modify**  it under the terms of the GNU General Public License as published by**  the Free Software Foundation; either version 2 of the License, or**  (at your option) any later version.**  This program is distributed in the hope that it will be useful,**  but WITHOUT ANY WARRANTY; without even the implied warranty of**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the**  GNU General Public License for more details.**  You should have received a copy of the GNU General Public License**  along with this program; if not, write to the Free Software**  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.**** **************************************************************************/#ifndef RCLANMTL_H#define RCLANMTL_H/* Linux specific includes */#include <asm/types.h>#ifdef RC_LINUX_MODULE		/* linux modules need non-library version of string functions */#include <linux/string.h>#else#include <string.h>#endif#include <linux/delay.h>	/* for udelay() */#include <linux/netdevice.h>#include <linux/if_ether.h>#include <linux/etherdevice.h>#include <linux/skbuff.h>#include <asm/io.h>/* Debug stuff. Define for debug output */#undef RCDEBUG#ifdef RCDEBUG#define dprintk(args...) printk("rc: " args)#else#define dprintk(args...) { }#endif/* Typedefs */ /* scalar data types */typedef __u8 U8;typedef __u16 U16;typedef __u32 U32;typedef __u8 *PU8;typedef __u16 *PU16;typedef __u32 *PU32;typedef unsigned long BF;typedef int RC_RETURN; /*     ** type PFNWAITCALLBACK    **    ** pointer to void function - type used for WaitCallback in some functions   */typedef void (*PFNWAITCALLBACK) (void);	/* void argument avoids compiler complaint */ /*    ** type PFNTXCALLBACK     **    ** Pointer to user's transmit callback function.  This user function is    ** called from RCProcI2OMsgQ() when packet have been transmitted from buffers    ** given in the RCI2OSendPacket() function.  BufferContext is a pointer to    ** an array of 32 bit context values.  These are the values the user assigned    ** and passed in the TCB to the RCI2OSendPacket() function.  PcktCount    ** indicates the number of buffer context values in the BufferContext[] array.    ** The User's TransmitCallbackFunction should recover (put back in free queue)    ** the packet buffers associated with the buffer context values.  */typedef void (*PFNTXCALLBACK) (U32 Status,			       U16 PcktCount,			       PU32 BufferContext, struct net_device *); /*     ** type PFNRXCALLBACK     **    ** Pointer to user's receive callback function.  This user function    ** is called from RCProcI2OMsgQ() when packets have been received into    ** previously posted packet buffers throught the RCPostRecvBuffers() function.    ** The received callback function should process the Packet Descriptor Block    ** pointed to by PacketDescBlock. See Packet Decription Block below.  */typedef void (*PFNRXCALLBACK) (U32 Status,			       U8 PktCount,			       U32 BucketsRemain,			       PU32 PacketDescBlock, struct net_device *); /*     ** type PFNCALLBACK     **    ** Pointer to user's generic callback function.  This user function    ** can be passed to LANReset or LANShutdown and is called when the     ** the reset or shutdown is complete.    ** Param1 and Param2 are invalid for LANReset and LANShutdown.  */typedef void (*PFNCALLBACK) (U32 Status,			     U32 Param1, U32 Param2, struct net_device * dev);/***  Message Unit CSR definitions for RedCreek PCI45 board*/typedef struct tag_rcatu {	volatile unsigned long APICRegSel;	/* APIC Register Select */	volatile unsigned long reserved0;	volatile unsigned long APICWinReg;	/* APIC Window Register */	volatile unsigned long reserved1;	volatile unsigned long InMsgReg0;	/* inbound message register 0 */	volatile unsigned long InMsgReg1;	/* inbound message register 1 */	volatile unsigned long OutMsgReg0;	/* outbound message register 0 */	volatile unsigned long OutMsgReg1;	/* outbound message register 1 */	volatile unsigned long InDoorReg;	/* inbound doorbell register */	volatile unsigned long InIntStat;	/* inbound interrupt status register */	volatile unsigned long InIntMask;	/* inbound interrupt mask register */	volatile unsigned long OutDoorReg;	/* outbound doorbell register */	volatile unsigned long OutIntStat;	/* outbound interrupt status register */	volatile unsigned long OutIntMask;	/* outbound interrupt mask register */	volatile unsigned long reserved2;	volatile unsigned long reserved3;	volatile unsigned long InQueue;	/* inbound queue port */	volatile unsigned long OutQueue;	/* outbound queue port */	volatile unsigned long reserved4;	volatile unsigned long reserver5;	/* RedCreek extension */	volatile unsigned long EtherMacLow;	volatile unsigned long EtherMacHi;	volatile unsigned long IPaddr;	volatile unsigned long IPmask;} *PATU; /*     ** typedef PAB    **    ** PCI Adapter Block - holds instance specific information.  */typedef struct {	PATU p_atu;		/* ptr to  ATU register block */	PU8 pPci45LinBaseAddr;	PU8 pLinOutMsgBlock;	U32 outMsgBlockPhyAddr;	PFNTXCALLBACK pTransCallbackFunc;	PFNRXCALLBACK pRecvCallbackFunc;	PFNCALLBACK pRebootCallbackFunc;	PFNCALLBACK pCallbackFunc;	U16 IOPState;	U16 InboundMFrameSize;} *PPAB;/* * Driver Private Area, DPA. */typedef struct {	U8 id;			/* the AdapterID */	/* These two field are basically for the RCioctl function.	 * I could not determine if they could be avoided. (RAA)*/	U32 pci_addr;		/* the pci address of the adapter */	U32 pci_addr_len;	struct timer_list timer;	/*  timer */	struct net_device_stats stats;	/* the statistics structure */	unsigned long numOutRcvBuffers;	/* number of outstanding receive buffers */	unsigned char shutdown;	unsigned char reboot;	unsigned char nexus;	PU8 msgbuf;		/* Pointer to Lan Api Private Area */	PU8 PLanApiPA;		/* Pointer to Lan Api Private Area (aligned) */	PPAB pPab;		/* Pointer to the PCI Adapter Block */} *PDPA;/* PCI/45 Configuration space values */#define RC_PCI45_VENDOR_ID  0x4916#define RC_PCI45_DEVICE_ID  0x1960 /* RedCreek API function return values */#define RC_RTN_NO_ERROR             0#define RC_RTN_I2O_NOT_INIT         1#define RC_RTN_FREE_Q_EMPTY         2#define RC_RTN_TCB_ERROR            3#define RC_RTN_TRANSACTION_ERROR    4#define RC_RTN_ADAPTER_ALREADY_INIT 5#define RC_RTN_MALLOC_ERROR         6#define RC_RTN_ADPTR_NOT_REGISTERED 7#define RC_RTN_MSG_REPLY_TIMEOUT    8#define RC_RTN_NO_I2O_STATUS        9#define RC_RTN_NO_FIRM_VER         10#define RC_RTN_NO_LINK_SPEED       11/* Driver capability flags */#define WARM_REBOOT_CAPABLE      0x01/*** Status - Transmit and Receive callback status word **** A 32 bit Status is returned to the TX and RX callback functions.  This value** contains both the reply status and the detailed status as follows:****  32    24     16            0**  +------+------+------------+**  | Reply|      |  Detailed  |**  |Status|   0  |   Status   |**  +------+------+------------+**** Reply Status and Detailed Status of zero indicates No Errors.*/ /* reply message status defines */#define    I2O_REPLY_STATUS_SUCCESS                    0x00#define    I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER     0x02#define    I2O_REPLY_STATUS_TRANSACTION_ERROR          0x0A/* DetailedStatusCode defines */#define    I2O_LAN_DSC_SUCCESS                         0x0000#define    I2O_LAN_DSC_DEVICE_FAILURE                  0x0001#define    I2O_LAN_DSC_DESTINATION_NOT_FOUND           0x0002#define    I2O_LAN_DSC_TRANSMIT_ERROR                  0x0003#define    I2O_LAN_DSC_TRANSMIT_ABORTED                0x0004#define    I2O_LAN_DSC_RECEIVE_ERROR                   0x0005#define    I2O_LAN_DSC_RECEIVE_ABORTED                 0x0006#define    I2O_LAN_DSC_DMA_ERROR                       0x0007#define    I2O_LAN_DSC_BAD_PACKET_DETECTED             0x0008#define    I2O_LAN_DSC_OUT_OF_MEMORY                   0x0009#define    I2O_LAN_DSC_BUCKET_OVERRUN                  0x000A#define    I2O_LAN_DSC_IOP_INTERNAL_ERROR              0x000B#define    I2O_LAN_DSC_CANCELED                        0x000C#define    I2O_LAN_DSC_INVALID_TRANSACTION_CONTEXT     0x000D#define    I2O_LAN_DSC_DESTINATION_ADDRESS_DETECTED    0x000E#define    I2O_LAN_DSC_DESTINATION_ADDRESS_OMITTED     0x000F#define    I2O_LAN_DSC_PARTIAL_PACKET_RETURNED         0x0010/*** Packet Description Block   (Received packets)**** A pointer to this block structure is returned to the ReceiveCallback ** function.  It contains the list of packet buffers which have either been** filled with a packet or returned to host due to a LANReset function. ** Currently there will only be one packet per receive bucket (buffer) posted. ****   32   24               0     **  +-----------------------+  -\**  |   Buffer 1 Context    |    \**  +-----------------------+     \**  |      0xC0000000       |     / First Bucket Descriptor**  +-----+-----------------+    /**  |  0  | packet 1 length |   / **  +-----------------------+  -\**  |   Buffer 2 Context    |    \**  +-----------------------+     \**  |      0xC0000000       |     / Second Bucket Descriptor**  +-----+-----------------+    /**  |  0  | packet 2 length |   / **  +-----+-----------------+  -**  |         ...           |  ----- more bucket descriptors**  +-----------------------+  -\**  |   Buffer n Context    |    \**  +-----------------------+     \**  |      0xC0000000       |     / Last Bucket Descriptor**  +-----+-----------------+    /**  |  0  | packet n length |   / **  +-----+-----------------+  -**** Buffer Context values are those given to adapter in the TCB on calls to** RCPostRecvBuffers().**  *//*** Transaction Control Block (TCB) structure**** A structure like this is filled in by the user and passed by reference to ** RCI2OSendPacket() and RCPostRecvBuffers() functions.  Minimum size is five** 32-bit words for one buffer with one segment descriptor.  ** MAX_NMBR_POST_BUFFERS_PER_MSG defines the maximum single segment buffers** that can be described in a given TCB.****   32                    0**  +-----------------------+**  |   Buffer Count        |  Number of buffers in the TCB**  +-----------------------+**  |   Buffer 1 Context    |  first buffer reference**  +-----------------------+**  |   Buffer 1 Seg Count  |  number of segments in buffer**  +-----------------------+**  |   Buffer 1 Seg Desc 1 |  first segment descriptor (size, physical address)**  +-----------------------+**  |         ...           |  more segment descriptors (size, physical address)**  +-----------------------+**  |   Buffer 1 Seg Desc n |  last segment descriptor (size, physical address)**  +-----------------------+**  |   Buffer 2 Context    |  second buffer reference**  +-----------------------+**  |   Buffer 2 Seg Count  |  number of segments in buffer**  +-----------------------+**  |   Buffer 2 Seg Desc 1 |  segment descriptor (size, physical address)**  +-----------------------+**  |         ...           |  more segment descriptors (size, physical address)**  +-----------------------+**  |   Buffer 2 Seg Desc n |**  +-----------------------+**  |         ...           |  more buffer descriptor blocks ...**  +-----------------------+**  |   Buffer n Context    |**  +-----------------------+**  |   Buffer n Seg Count  |**  +-----------------------+**  |   Buffer n Seg Desc 1 |**  +-----------------------+**  |         ...           |**  +-----------------------+**  |   Buffer n Seg Desc n |**  +-----------------------+****** A TCB for one contigous packet buffer would look like the following:****   32                    0**  +-----------------------+**  |         1             |  one buffer in the TCB**  +-----------------------+**  |  <user's Context>     |  user's buffer reference**  +-----------------------+**  |         1             |  one segment buffer**  +-----------------------+                            _**  |    <buffer size>      |  size                       \ **  +-----------------------+                              \ segment descriptor**  |  <physical address>   |  physical address of buffer  /**  +-----------------------+                            _/

⌨️ 快捷键说明

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