📄 nbuf.h
字号:
/********************************************************************* * * Copyright: * MOTOROLA, INC. All Rights Reserved. * You are hereby granted a copyright license to use, modify, and * distribute the SOFTWARE so long as this entire notice is * retained without alteration in any modified and/or redistributed * versions, and that such modified versions are clearly identified * as such. No licenses are granted by implication, estoppel or * otherwise under any patents or trademarks of Motorola, Inc. This * software is provided on an "AS IS" basis and without warranty. * * To the maximum extent permitted by applicable law, MOTOROLA * DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, INCLUDING * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR * PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH REGARD TO THE * SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) AND ANY * ACCOMPANYING WRITTEN MATERIALS. * * To the maximum extent permitted by applicable law, IN NO EVENT * SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING * WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS * INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY * LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. * * Motorola assumes no responsibility for the maintenance and support * of this software ********************************************************************//* * File: nbuf.h * Purpose: Definitions for Network Buffer Allocation. * * Notes: These routines implement a static buffer scheme. * The buffer descriptors are as specified by the * MPC860T/MCF5272 FEC. * */#ifndef _NBUF_H#define _NBUF_H/********************************************************************/#define Rx 1#define Tx 0/* * Buffer sizes in bytes -- The following values were chosen based * on TFTP maximum packet sizes. These sizes may need to be * increased to implement other protocols. */#define RX_BUFFER_SIZE 576 /* must be divisible by 16 */#define TX_BUFFER_SIZE 576/* Number of Receive and Transmit Buffers and Buffer Descriptors */#define NUM_RXBDS 8#define NUM_TXBDS 8/* Buffer Descriptor Format */typedef struct{ uint16 status; /* control and status */ uint16 length; /* transfer length */ uint8 *data; /* buffer address */} NBUF;/********************************************************************//* * Bit level Buffer Descriptor definitions */#define TX_BD_R 0x8000#define TX_BD_INUSE 0x4000#define TX_BD_TO1 0x4000#define TX_BD_W 0x2000#define TX_BD_TO2 0x1000#define TX_BD_L 0x0800#define TX_BD_TC 0x0400#define TX_BD_DEF 0x0200#define TX_BD_HB 0x0100#define TX_BD_LC 0x0080#define TX_BD_RL 0x0040#define TX_BD_UN 0x0002#define TX_BD_CSL 0x0001#define RX_BD_E 0x8000#define RX_BD_INUSE 0x4000#define RX_BD_R01 0x4000#define RX_BD_W 0x2000#define RX_BD_R02 0x1000#define RX_BD_L 0x0800#define RX_BD_M 0x0100#define RX_BD_BC 0x0080#define RX_BD_MC 0x0040#define RX_BD_LG 0x0020#define RX_BD_NO 0x0010#define RX_BD_SH 0x0008#define RX_BD_CR 0x0004#define RX_BD_OV 0x0002#define RX_BD_TR 0x0001/*******************************************************************//* * Functions to manipulate the network buffers. */voidnbuf_init (void);uint32nbuf_get_start(uint8);NBUF *nbuf_rx_allocate (void);NBUF *nbuf_tx_allocate (void);voidnbuf_rx_release (NBUF *);voidnbuf_tx_release (NBUF *);intnbuf_rx_next_ready(void);voidnbuf_tx_swap(NBUF **, NBUF **);/********************************************************************/#endif /* _NBUF_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -