XenevaOS
Loading...
Searching...
No Matches
e1000.h
Go to the documentation of this file.
1
30#ifndef __E1000_H__
31#define __E1000_H__
32
33#include <stdint.h>
34
35#define E1000_REG_CTRL 0x0000
36#define E1000_REG_STATUS 0x0008
37#define E1000_REG_EEPROM 0x0014
38#define E1000_REG_CTRL_EXT 0x0018
39#define E1000_REG_ICR 0x00C0
40#define E1000_REG_ITR 0x00c4
41#define E1000_REG_IMS 0x00d0
42#define E1000_REG_IMC 0x00d8
43
44#define E1000_REG_RCTRL 0x0100
45#define E1000_REG_RXDESCLO 0x2800
46#define E1000_REG_RXDESCHI 0x2804
47#define E1000_REG_RXDESCLEN 0x2808
48#define E1000_REG_RXDESCHEAD 0x2810
49#define E1000_REG_RXDESCTAIL 0x2818
50#define E1000_REG_RDTR 0x2820
51
52#define E1000_REG_TCTRL 0x0400
53#define E1000_REG_TXDESCLO 0x3800
54#define E1000_REG_TXDESCHI 0x3804
55#define E1000_REG_TXDESCLEN 0x3808
56#define E1000_REG_TXDESCHEAD 0x3810
57#define E1000_REG_TXDESCTAIL 0x3818
58
59#define E1000_REG_RXADDR 0x5400
60
61#define E1000_NUM_RX_DESC 512
62#define E1000_NUM_TX_DESC 512
63
64#define RCTL_EN (1 << 1) /* Receiver Enable */
65#define RCTL_SBP (1 << 2) /* Store Bad Packets */
66#define RCTL_UPE (1 << 3) /* Unicast Promiscuous Enabled */
67#define RCTL_MPE (1 << 4) /* Multicast Promiscuous Enabled */
68#define RCTL_LPE (1 << 5) /* Long Packet Reception Enable */
69#define RCTL_LBM_NONE (0 << 6) /* No Loopback */
70#define RCTL_LBM_PHY (3 << 6) /* PHY or external SerDesc loopback */
71#define RCTL_RDMTS_HALF (0 << 8) /* Free Buffer Threshold is 1/2 of RDLEN */
72#define RCTL_RDMTS_QUARTER (1 << 8) /* Free Buffer Threshold is 1/4 of RDLEN */
73#define RCTL_RDMTS_EIGHTH (2 << 8) /* Free Buffer Threshold is 1/8 of RDLEN */
74#define RCTL_MO_36 (0 << 12) /* Multicast Offset - bits 47:36 */
75#define RCTL_MO_35 (1 << 12) /* Multicast Offset - bits 46:35 */
76#define RCTL_MO_34 (2 << 12) /* Multicast Offset - bits 45:34 */
77#define RCTL_MO_32 (3 << 12) /* Multicast Offset - bits 43:32 */
78#define RCTL_BAM (1 << 15) /* Broadcast Accept Mode */
79#define RCTL_VFE (1 << 18) /* VLAN Filter Enable */
80#define RCTL_CFIEN (1 << 19) /* Canonical Form Indicator Enable */
81#define RCTL_CFI (1 << 20) /* Canonical Form Indicator Bit Value */
82#define RCTL_DPF (1 << 22) /* Discard Pause Frames */
83#define RCTL_PMCF (1 << 23) /* Pass MAC Control Frames */
84#define RCTL_SECRC (1 << 26) /* Strip Ethernet CRC */
85
86#define RCTL_BSIZE_256 (3 << 16)
87#define RCTL_BSIZE_512 (2 << 16)
88#define RCTL_BSIZE_1024 (1 << 16)
89#define RCTL_BSIZE_2048 (0 << 16)
90#define RCTL_BSIZE_4096 ((3 << 16) | (1 << 25))
91#define RCTL_BSIZE_8192 ((2 << 16) | (1 << 25))
92#define RCTL_BSIZE_16384 ((1 << 16) | (1 << 25))
93
94#define TCTL_EN (1 << 1) /* Transmit Enable */
95#define TCTL_PSP (1 << 3) /* Pad Short Packets */
96#define TCTL_CT_SHIFT 4 /* Collision Threshold */
97#define TCTL_COLD_SHIFT 12 /* Collision Distance */
98#define TCTL_SWXOFF (1 << 22) /* Software XOFF Transmission */
99#define TCTL_RTLC (1 << 24) /* Re-transmit on Late Collision */
100
101#define CMD_EOP (1 << 0) /* End of Packet */
102#define CMD_IFCS (1 << 1) /* Insert FCS */
103#define CMD_IC (1 << 2) /* Insert Checksum */
104#define CMD_RS (1 << 3) /* Report Status */
105#define CMD_RPS (1 << 4) /* Report Packet Sent */
106#define CMD_VLE (1 << 6) /* VLAN Packet Enable */
107#define CMD_IDE (1 << 7) /* Interrupt Delay Enable */
108
109#define ICR_TXDW (1 << 0)
110#define ICR_TXQE (1 << 1) /* Transmit queue is empty */
111#define ICR_LSC (1 << 2) /* Link status changed */
112#define ICR_RXSEQ (1 << 3) /* Receive sequence count error */
113#define ICR_RXDMT0 (1 << 4) /* Receive descriptor minimum threshold */
114/* what's 5 (0x20)? */
115#define ICR_RXO (1 << 6) /* Receive overrun */
116#define ICR_RXT0 (1 << 7) /* Receive timer interrupt? */
117#define ICR_ACK (1 << 17)
118#define ICR_SRPD (1 << 16)
119
120
121#pragma pack(push,1)
130#pragma pack(pop)
131
132#pragma pack(push,1)
133typedef struct _e1000_tx_desc_ {
134 volatile uint64_t addr;
135 volatile uint16_t length;
136 volatile uint8_t cso;
137 volatile uint8_t cmd;
138 volatile uint8_t status;
139 volatile uint8_t css;
142#pragma pack(pop)
143
144
145#endif
unsigned char uint8_t
Definition acefiex.h:161
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
unsigned short int uint16_t
Definition acefiex.h:162
struct _e1000_rx_desc_ e1000_rx_desc
struct _e1000_tx_desc_ e1000_tx_desc
Definition e1000.h:122
volatile uint8_t status
Definition e1000.h:126
volatile uint16_t checksum
Definition e1000.h:125
volatile uint8_t errors
Definition e1000.h:127
volatile uint16_t length
Definition e1000.h:124
volatile uint64_t addr
Definition e1000.h:123
volatile uint16_t special
Definition e1000.h:128
Definition e1000.h:133
volatile uint8_t status
Definition e1000.h:138
volatile uint8_t css
Definition e1000.h:139
volatile uint64_t addr
Definition e1000.h:134
volatile uint8_t cmd
Definition e1000.h:137
volatile uint16_t length
Definition e1000.h:135
volatile uint8_t cso
Definition e1000.h:136
volatile uint16_t special
Definition e1000.h:140