ethernet_internal.h

来自「ixp2400的一个小程序」· C头文件 代码 · 共 74 行

H
74
字号
/*  Copyright (C) 2002-2003 Intel Corporation, All Rights Reserved.
//  Permission is hereby granted to merge this program code with 
//  other program material to create a derivative work.  This 
//  derivative work may be distributed in compiled object form only.
//  Any other publication of this program, in any form, without the 
//  explicit permission of the copyright holder is prohibited.
//
//  Send questions and comments to erik.j.johnson@intel.com, 
//  aaron.kunze@intel.com

//-------------------------------------------------------------------
// ethernet_internal.h - Chapter 6
// This file defines the control block structure for the Ethernet
// microblocks
*/

#ifndef ETHERNET_INTERNAL_H
#define ETHERNET_INTERNAL_H

/* The number of entries in the top level hash array.  This
// number must be a power of 2.
*/
#define ARP_TABLE_ARRAY_SIZE	256

/* This is the ARP table entry format.  A hash table
// containing these entries is used to map destination
// IP addresses to Ethernet Destination MAC addresses.
*/
typedef struct _ethernet_arp_table_entry
{
	unsigned int ethernet_address_hi32;
	unsigned int ethernet_address_lo16 : 16;
	unsigned int pad				   : 8;
	unsigned int valid				   : 8;
} ethernet_arp_table_entry;

/* This structure contains the single MAC address of the
// device, along with a pointer to the hash table used
// for ARP.
*/
typedef struct
{
	unsigned int device_addr_hi32;
	unsigned int device_addr_lo16	: 16;
	unsigned int pad				: 16;
	ethernet_arp_table_entry	
	     arp_table_array[ARP_TABLE_ARRAY_SIZE];
} ethernet_control_block;

/* If we are using hardware, the ETHERNET_DATA symbol
// is an imported variable.  In the simulator, it is
// a #define in the compile options
*/
#ifdef HARDWARE
#define ETHERNET_SYMBOL_NAME	"ETHERNET_DATA"

#ifdef MICRO_C
int ETHERNET_DATA = 
			LoadTimeConstant(ETHERNET_SYMBOL_NAME);
#endif
#endif /* HARDWARE */

/* For now, the communication ID for packets going from
// the microblock to the core is set to 64.  When
// this path is actually implemented, it needs to be
// unique system-wide.  This is the exception ID used
// in the microblock and the communication ID in the
// core component
*/
#define ETHERNET_EXCEPTION_ID	64


#endif /*ETHERNET_INTERNAL_H*/

⌨️ 快捷键说明

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