fore_aali.h

来自「基于组件方式开发操作系统的OSKIT源代码」· C头文件 代码 · 共 605 行 · 第 1/2 页

H
605
字号
/* * * =================================== * HARP  |  Host ATM Research Platform * =================================== * * * This Host ATM Research Platform ("HARP") file (the "Software") is * made available by Network Computing Services, Inc. ("NetworkCS") * "AS IS".  NetworkCS does not provide maintenance, improvements or * support of any kind. * * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED, * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE. * In no event shall NetworkCS be responsible for any damages, including * but not limited to consequential damages, arising from or relating to * any use of the Software or related support. * * Copyright 1994-1998 Network Computing Services, Inc. * * Copies of this Software may be made, however, the above copyright * notice must be reproduced on all copies. * *	@(#) $Id: fore_aali.h,v 1.1 1998/09/15 08:22:54 phk Exp $ * *//* * FORE Systems 200-Series Adapter Support * --------------------------------------- * * ATM Adaptation Layer Interface (AALI) definitions * */#ifndef _FORE_AALI_H#define _FORE_AALI_H/* * This file contains the definitions required by the FORE ATM Adaptation * Layer Interface (AALI) specification. *//* * Addressing/Pointer definitions * * The CP memory only supports 32-bit word accesses (read and write) - thus, * all memory must be defined and accessed as 32-bit words.  Also, since the * data transfers are word-sized, we must take care of byte-swapping issues * from/to little-endian hosts (the CP is an i960 processor, ie big-endian). * * All pointers to CP memory areas are actually offsets from the start of  * the adapter RAM address space. * * All CP-resident data structures are declared volatile. */typedef void *		H_addr;		/* Host-resident address */typedef unsigned long	H_dma;		/* Host-resident DMA address */typedef unsigned long	CP_word;	/* CP-resident word */typedef unsigned long	CP_addr;	/* CP-resident CP memory offset */typedef unsigned long	CP_dma;		/* CP-resident DMA address */ /* * Structure defining the CP's shared memory interface to the mon960 program */struct mon960 {	CP_word		mon_xmitmon;	/* Uart - host to mon960 (see below) */	CP_word		mon_xmithost;	/* Uart - mon960 to host (see below) */	CP_word		mon_bstat;	/* Boot status word (see below) */	CP_addr		mon_appl;	/* Pointer to application memory area */	CP_word		mon_ver;	/* Mon960 firmware version */};typedef volatile struct mon960	Mon960;/* * Pseudo-UART usage */#define	UART_READY	0x00000000	/* UART is ready for more data */#define	UART_VALID	0x01000000	/* UART character is valid */#define	UART_DATAMASK	0x000000ff	/* UART character data mask *//* * Boot Status Word */#define	BOOT_COLDSTART	0xc01dc01d	/* CP is performing cold start */#define	BOOT_MONREADY	0x02201958	/* Monitor is waiting for commands */#define	BOOT_FAILTEST	0xadbadbad	/* Monitor failed self-test */#define	BOOT_RUNNING	0xce11feed	/* Microcode downloaded and running */#define	BOOT_LOOPS	20		/* Loops to wait for CP to boot */#define	BOOT_DELAY	100000		/* Delay (us) for each boot loop *//* * Supported AALs */enum fore_aal {	FORE_AAL_0 = 0,			/* Cell Service */	FORE_AAL_4 = 4,			/* AAL 3/4 */	FORE_AAL_5 = 5			/* AAL 5 */};typedef enum fore_aal Fore_aal;/* * Buffer strategy definition */struct buf_strategy {	CP_word		bfs_quelen;	/* Buffer supply queue entries */	CP_word		bfs_bufsize;	/* Buffer size */	CP_word		bfs_cppool;	/* Buffers in CP-resident pool */	CP_word		bfs_entsize;	/* Buffers in each supply queue entry */};typedef volatile struct buf_strategy	Buf_strategy;/* * Buffer strategy id */#define	BUF_STRAT_1	0		/* Buffer strategy one */#define	BUF_STRAT_2	1		/* Buffer strategy two */#ifdef ATM_KERNEL/* * Common Queue Element * * Used for Transmit, Receive and Buffer Supply Queues */struct com_queue {	CP_dma		cq_descr;	/* Pointer to element descriptor */	CP_dma		cq_status;	/* Pointer to element status word */};typedef volatile struct com_queue	Com_queue;/* * Queue element status word */typedef volatile unsigned long	Q_status;#define	QSTAT_PENDING	0x01		/* Operation is pending */#define	QSTAT_COMPLETED	0x02		/* Operation successfully completed */#define	QSTAT_FREE	0x04		/* Queue element is free/unused */#define	QSTAT_ERROR	0x08		/* Operation encountered an error */#define	QSTAT_ALIGN	4/* * PDU Transmit Queue *//* * PDU Transmit Queue Element */typedef volatile struct com_queue	Xmit_queue;/* * PDU Transmit buffer segment descriptor */struct xmit_seg_descr {	H_dma		xsd_buffer;	/* Buffer's DMA address */	u_int		xsd_len;	/* Data length in buffer */};typedef struct xmit_seg_descr	Xmit_seg_descr;#define	XMIT_SEG_ALIGN	4/* * PDU Transmit descriptor header */struct xmit_descr_hdr {	u_long		xdh_cell_hdr;	/* Cell header (minus HEC) */	u_long		xdh_spec;	/* Transmit specification (see below) */	u_long		xdh_rate;	/* Rate control (data/idle cell ratio)*/	u_long		xdh_pad;	/* Pad to quad-word boundary */};typedef struct xmit_descr_hdr	Xmit_descr_hdr;#define	XMIT_BLK_BITS		5		/* Bits to encode block size */#define	XMIT_MAX_BLK_BITS	4		/* Max bits we can use */#define	XMIT_BLK_SIZE		(1 << XMIT_BLK_BITS)#define	XMIT_SEGS_TO_BLKS(nseg) \		((((nseg) * sizeof(Xmit_seg_descr)) \		+ sizeof(Xmit_descr_hdr) + (XMIT_BLK_SIZE - 1)) \		>> XMIT_BLK_BITS)#define	XMIT_MAX_BLKS		((1 << XMIT_MAX_BLK_BITS) - 1)#define	XMIT_HDR_SEGS 		((XMIT_BLK_SIZE - sizeof(Xmit_descr_hdr)) \					/ sizeof(Xmit_seg_descr))#define	XMIT_BLK_SEGS		(XMIT_BLK_SIZE / sizeof(Xmit_seg_descr))#define	XMIT_EXTRA_SEGS		((XMIT_MAX_BLKS - 1) * XMIT_BLK_SEGS)#define	XMIT_MAX_SEGS		(XMIT_EXTRA_SEGS + XMIT_HDR_SEGS)/* * PDU Transmit descriptor */struct xmit_descr {	Xmit_descr_hdr	xd_hdr;		/* Descriptor header */	Xmit_seg_descr	xd_seg[XMIT_MAX_SEGS];	/* PDU segments */};typedef struct xmit_descr	Xmit_descr;#define	xd_cell_hdr	xd_hdr.xdh_cell_hdr#define	xd_spec		xd_hdr.xdh_spec#define	xd_rate		xd_hdr.xdh_rate/* * Transmit specification * *	Bits  0-15 - Total PDU length *	Bits 16-23 - Number of transmit segments *	Bits 24-27 - AAL type *	Bits 28-31 - Interrupt flag */#define	XDS_SET_SPEC(i,a,n,l)	(((i) << 28) | ((a) << 24) | ((n) << 16) | (l))#define	XDS_GET_LEN(s)		((s) & 0xffff)#define	XDS_GET_SEGS(s)		(((s) >> 16) & 0xff)#define	XDS_GET_AAL(s)		(((s) >> 24) & 0xf)#define	XDS_GET_INTR(s)		(((s) >> 28) & 0xf)#define	XMIT_MAX_PDULEN		65535#define	XMIT_DESCR_ALIGN	32/* * PDU Receive Queue *//* * PDU Receive Queue Element */typedef volatile struct com_queue	Recv_queue;/* * Receive PDU buffer segment description */struct recv_seg_descr {	H_addr		rsd_handle;	/* Buffer handle (from supply) */	u_int		rsd_len;	/* Data length in buffer */};typedef struct recv_seg_descr	Recv_seg_descr;/* * PDU Receive descriptor header */struct recv_descr_hdr {	u_long		rdh_cell_hdr;	/* Cell header (minus HEC) */	u_long		rdh_nsegs;	/* Number of receive segments */};typedef struct recv_descr_hdr	Recv_descr_hdr;#define	RECV_BLK_SIZE		32#define	RECV_HDR_SEGS 		((RECV_BLK_SIZE - sizeof(Recv_descr_hdr)) \					/ sizeof(Recv_seg_descr))#define	RECV_BLK_SEGS		(RECV_BLK_SIZE / sizeof(Recv_seg_descr))#define	RECV_MAX_LG_SEGS	((FORE_IFF_MTU - BUF1_SM_SIZE \					+ (BUF1_LG_SIZE - 1)) / BUF1_LG_SIZE)#define	RECV_EXTRA_BLKS		(((RECV_MAX_LG_SEGS + 1 - RECV_HDR_SEGS) \					+ (RECV_BLK_SEGS - 1)) / RECV_BLK_SEGS)#define RECV_EXTRA_SEGS		(RECV_EXTRA_BLKS * RECV_BLK_SEGS)#define	RECV_MAX_SEGS		(RECV_EXTRA_SEGS + RECV_HDR_SEGS)/* * PDU Receive descriptor */struct recv_descr {	Recv_descr_hdr	rd_hdr;		/* Descriptor header */	Recv_seg_descr	rd_seg[RECV_MAX_SEGS];	/* PDU segments */};typedef struct recv_descr	Recv_descr;#define	rd_cell_hdr	rd_hdr.rdh_cell_hdr#define	rd_nsegs	rd_hdr.rdh_nsegs#define	RECV_DESCR_ALIGN	32/* * Buffer Supply Queue *//* * Buffer Supply Queue Element */typedef volatile struct com_queue	Buf_queue;/*

⌨️ 快捷键说明

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