57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
#ifndef __I825XX_H
|
|
#define __I825XX_H
|
|
|
|
#include "ether.h"
|
|
|
|
#define NUM_RX_DESCRIPTORS 32
|
|
#define NUM_TX_DESCRIPTORS 8
|
|
|
|
#define CTRL_FD (1 << 0)
|
|
#define CTRL_ASDE (1 << 5)
|
|
#define CTRL_SLU (1 << 6)
|
|
|
|
// RX and TX descriptor structures
|
|
struct i825xx_rx_desc_t
|
|
{
|
|
volatile unsigned long long address;
|
|
volatile unsigned short length;
|
|
volatile unsigned short checksum;
|
|
volatile unsigned char status;
|
|
volatile unsigned char error;
|
|
volatile unsigned short special;
|
|
}__attribute__((packed));
|
|
|
|
struct i825xx_tx_desc_t
|
|
{
|
|
volatile unsigned long long address;
|
|
volatile unsigned short length;
|
|
volatile unsigned char cso;
|
|
volatile unsigned char cmd;
|
|
volatile unsigned char sta;
|
|
volatile unsigned char css;
|
|
volatile unsigned short special;
|
|
} __attribute__((packed));
|
|
|
|
// Device-specific structure
|
|
struct i825xx_device_t
|
|
{
|
|
unsigned int mmio_address;
|
|
unsigned char bar_type;
|
|
unsigned char have_eeprom;
|
|
unsigned int io_address;
|
|
unsigned int rx_front;
|
|
unsigned int tx_front;
|
|
struct i825xx_rx_desc_t *rx_buff; // receive descriptor buffer
|
|
struct i825xx_tx_desc_t *tx_buff; // transmit descriptor buffer
|
|
struct i825xx_rx_desc_t *rx_descs[NUM_RX_DESCRIPTORS];
|
|
struct i825xx_tx_desc_t *tx_descs[NUM_TX_DESCRIPTORS];
|
|
unsigned char *rx_desc_phys_base, *tx_desc_phys_base;
|
|
unsigned char *rx_desc_virt_base, *tx_desc_virt_base;
|
|
struct ether_t *ether;
|
|
};
|
|
|
|
extern struct ether_t *init_i825xx(int count);
|
|
extern int i825xx_send(struct i825xx_device_t *i825xx_device, char *packet, int len);
|
|
extern void i825xx_enable(struct ether_t *ether);
|
|
#endif
|