quinn-os/i825xx.h

54 lines
1.4 KiB
C

#ifndef __I825XX_H
#define __I825XX_H
#include "ether.h"
#define NUM_RX_DESCRIPTORS 768
#define NUM_TX_DESCRIPTORS 768
#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 int io_address;
unsigned int rx_front;
unsigned int tx_front;
struct i825xx_rx_desc_t *rx_desc; // receive descriptor buffe
struct i825xx_tx_desc_t *tx_desc; // transmit descriptor buffer
char *rx_buff[NUM_RX_DESCRIPTORS];
char *tx_buff[NUM_TX_DESCRIPTORS];
unsigned char *rx_desc_base, *tx_desc_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