📄 ez_lan_types.h
字号:
//##############################################################
//#
//# EZ_LAN_TYPES.H
//#
//# ADSP-21535 Embedded Web Server Project
//#
//# (c) ANALOG DEVICES 2002
//# eDSP Division
//# Stefan Hacker
//# 23-DEC-2002
//#
//# History
//# 16-APR-2003 HS release 1.0
//#
#ifndef __ez_lan_types_h__
#define __ez_lan_types_h__
////////////////////////////
// General Type Declarations
#define BYTE unsigned char
#define WORD unsigned short
#define DWORD unsigned int
////////////////////////////
// ATA CMD Buffer Structure
struct ATA_CMD_BUF {
BYTE CMD;
BYTE DH;
BYTE CH;
BYTE CL;
BYTE SN;
BYTE SC;
};
////////////////////////////
// ATA Drive Parameter Structure
struct ATA_DPARA {
DWORD BPB_HiddSec;
DWORD BPB_TotSec32;
DWORD BS_VolID;
WORD BPB_BytsPerSec;
WORD BPB_RsvdSecCnt;
WORD BPB_RootEntCnt;
WORD BPB_TotSec16;
WORD BPB_FATSz16;
WORD BPB_SecPerTrk;
WORD BPB_NumHeads;
WORD BPB_id1;
WORD BPB_id2;
BYTE BS_jmpBoot[3];
BYTE BS_OEMName[9];
BYTE BPB_SecPerClus;
BYTE BPB_NumFATs;
BYTE BPB_Media;
BYTE BS_DrvNum;
BYTE BS_Reserved1;
BYTE BS_BootSig;
BYTE BS_VolLab[12];
BYTE BS_FileSysType[9];
};
////////////////////////////
// ATA Drive Parameter Structure
struct ATA_DIRENTRY {
DWORD DIR_FileSize;
WORD DIR_FstClusHI;
WORD DIR_FstClusLO;
WORD DIR_CrtTime;
WORD DIR_CrtDate;
WORD DIR_LstAccDate;
WORD DIR_WrtTime;
WORD DIR_WrtDate;
BYTE DIR_Name[13];
BYTE DIR_Attr;
BYTE DIR_NTRes;
BYTE DIR_CrtTimeTenth;
};
////////////////////////////
// ATA Drive Parameter Structure
struct ATA_DIRSHORT {
DWORD DIR_FileSize;
WORD DIR_FstClusLO;
BYTE DIR_Name[13];
BYTE DIR_Attr;
};
////////////////////////////
// LAN Controller Structure
struct SMC_LOCAL {
// This keeps track of how many packets that I have
// sent out. When an TX_EMPTY interrupt comes, I know
// that all of these have been sent.
WORD packets_waiting;
// Last contents of PHY Register 18
WORD lastPhy18;
// Contains the current active transmission mode
WORD tcr_cur_mode;
// Contains the current active receive mode
WORD rcr_cur_mode;
// Contains the current active receive/phy mode
WORD rpc_cur_mode;
// Memory allocation for TX flag
WORD alloc_success;
////////////////
// DEBUG SECTION
// Contains the last packet size in receive
WORD rpsize;
// Set to true during the auto-negotiation sequence
BYTE autoneg_active;
// Debug of the IRQ Service
BYTE last_IRQ_serviced;
};
////////////////////////////
// Ethernet Packet
struct ETH_PACKET {
// max. 2048 bytes, here: actual length
#pragma align 4
WORD length;
// in use or available
WORD busy;
#ifndef USE_16_BIT
DWORD data[190];
#else
WORD data[320];
#endif
};
////////////////////////////
// Error Statistics
struct netdev_stats
{
unsigned short rx_packets; // total packets received
unsigned short tx_packets; // total packets transmitted
unsigned short rx_bytes; // total bytes received
unsigned short tx_bytes; // total bytes transmitted
unsigned short rx_errors; // bad packets received
unsigned short tx_errors; // packet transmit problems
unsigned short rx_dropped; // no space in linux buffers
unsigned short tx_dropped; // no space available in linux
unsigned short multicast; // multicast packets received
unsigned short collisions; // total collisions
/* detailed rx_errors: */
unsigned short rx_length_errors; // packet too long or too short
unsigned short rx_over_errors; // receiver ring buff overflow
unsigned short rx_crc_errors; // recved pkt with crc error
unsigned short rx_frame_errors; // recv'd frame alignment error
unsigned short rx_fifo_errors; // recv'r fifo overrun
unsigned short rx_missed_errors; // receiver missed packet
/* detailed tx_errors */
unsigned short tx_aborted_errors;
unsigned short tx_carrier_errors;
unsigned short tx_fifo_errors;
unsigned short tx_heartbeat_errors;
unsigned short tx_window_errors;
};
////////////////////////////
// TCP Statemachine according to RFC793
typedef enum {
CLOSED,
LISTENING,
SYN_SENT,
SYN_RECD,
ESTABLISHED,
FIN_WAIT_1,
FIN_WAIT_2,
CLOSE_WAIT,
CLOSING,
LAST_ACK,
TIME_WAIT
} tTCPStateMachine;
////////////////////////////
// type of last frame sent. used for retransmissions
typedef enum {
ARP_REQUEST,
TCP_SYN_FRAME,
TCP_SYN_ACK_FRAME,
TCP_FIN_FRAME,
TCP_DATA_FRAME
} tLastFrameSent;
#endif // __ez_lan_types.h__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -