Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

rtl8139.h File Reference

RTL8139C(L) single chip fast ethernet controller driver header. More...

#include <kernel/semaphore.h>

Go to the source code of this file.

Data Structures

struct  rtl8139
 The RTL8139 device structure. More...

struct  rxpacket
 A receive packet structure. More...

struct  txpacket
 A transmitted packet structure. More...


Defines

#define TX_FIFO_THRESH   256
 Threshold is bytes transferred to chip before transmission starts (rounded down to 32 byte units).

#define RX_FIFO_THRESH   4
 Rx buffer level before first PCI xfer.

#define RX_DMA_BURST   4
 Maximum PCI burst, '4' is 256 bytes.

#define TX_DMA_BURST   4
 Calculate as 16<<val.

#define NUM_TX_DESC   4
 Number of Tx descriptor registers.

#define TX_BUF_SIZE   1536
 Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4).

#define RX_BUF_LEN_IDX   0
 The receive buffer length code: 0, 1, 2 is allowed - 8, 16, 32KB.

#define RX_BUF_LEN   (8192 << RX_BUF_LEN_IDX)
 The receive buffer length in bytes.

#define EE_SHIFT_CLK   0x04
 EEPROM shift clock.

#define EE_CS   0x08
 EEPROM chip select.

#define EE_DATA_WRITE   0x02
 EEPROM chip data in.

#define EE_WRITE_0   0x00
 EEPROM write 0.

#define EE_WRITE_1   0x02
 EEPROM write 1.

#define EE_DATA_READ   0x01
 EEPROM chip data out.

#define EE_ENB   (0x80 | EE_CS)
#define eeprom_delay()   in32(ee_addr)
 Delay between EEPROM clock transitions. No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.

#define EE_WRITE_CMD   (5 << 6)
 EEPROM write command.

#define EE_READ_CMD   (6 << 6)
 EEPROM read command.

#define EE_ERASE_CMD   (7 << 6)
 EEPROM erase command.


Typedefs

typedef rxpacket rxpacket_t
 A receive packet structure.

typedef txpacket txpacket_t
 A transmitted packet structure.

typedef rtl8139 rtl8139_t
 The RTL8139 device structure.


Functions

uint8_tget_eth_mac_addr ()
 Get the MAC hardware address of the RTL8139 ethernet card.
Returns:
A pointer to the MAC address value.
Exceptions:
NULL  if a RTL8139 card has not been initialized.


rtl8139_tget_rtl8139_device ()
 Get the pointer of the RTL8139 device structure.
Returns:
  • a pointer of the RTL8139 structure if it has been initialized;
  • 0 if the RTL8139 card has not been initialized.


int send_rtl8139_packet (rtl8139_t *rtl, const void *data, size_t len)
 Send an ethernet packet to the physiscal layer.
Parameters:
rtl  The RTL8139 structure.
data  The data to be sent.
len  The size of the data to be sent in bytes.
Returns:
The number of bytes sent, or -1 if an error occurred.


int rtl8139_init (bool promisc)
 Initialize the RTL8139 driver.
Parameters:
promisc 
  • TRUE initialize the card and put it in promiscuous mode;
  • FALSE initialize the card and don't put it in promiscuous mode.
Returns:
  • 0 if we can successfully enable the RTL8139 ethernet card;
  • -ENXIO if the device if not present on PCI bus;
  • -EIO if we cannot read ethernet card informations;.


void rtl8139_close (rtl8139_t **rtl)
 Halt the RTL8139 card and free the logical device.
Parameters:
rtl  An indirect pointer to the RTL8139 structure. Must be passed as an indirect pointer because it will be modified inside this routine!!!


void rtl8139_promisc (rtl8139_t *rtl, bool on)
 Enable/disable the promiscuous mode for the RTL8139 card.
Parameters:
rtl  The RTL8139 structure.
on 
  • TRUE enable the promiscuous mode;
  • FALSE disable the promiscuous mode.


void rtl8139_dump_info (rtl8139_t *rtl)
 Print the current RTL8139 card configuration on the console.
Parameters:
rtl  The RTL8139 structure.


void rtl8139_handler ()
 The RTL8139 interrupt handler routine. It is invoked every time that an ethernet packet is received or when a packet has been transmitted.


Detailed Description

RTL8139C(L) single chip fast ethernet controller driver header.

Author:
Andrea Righi <drizzt@inwind.it>
Date:
Last update: 2003-11-09
Note:
Copyright (©) 2003 Andrea Righi
rtl8139.jpg

How the RTL8139C controller works

Definition in file rtl8139.h.


Define Documentation

#define EE_CS   0x08
 

EEPROM chip select.

Definition at line 37 of file rtl8139.h.

#define EE_DATA_READ   0x01
 

EEPROM chip data out.

Definition at line 41 of file rtl8139.h.

#define EE_DATA_WRITE   0x02
 

EEPROM chip data in.

Definition at line 38 of file rtl8139.h.

#define EE_ENB   (0x80 | EE_CS)
 

Definition at line 42 of file rtl8139.h.

#define EE_ERASE_CMD   (7 << 6)
 

EEPROM erase command.

Definition at line 54 of file rtl8139.h.

#define EE_READ_CMD   (6 << 6)
 

EEPROM read command.

Definition at line 52 of file rtl8139.h.

#define EE_SHIFT_CLK   0x04
 

EEPROM shift clock.

Definition at line 36 of file rtl8139.h.

#define EE_WRITE_0   0x00
 

EEPROM write 0.

Definition at line 39 of file rtl8139.h.

#define EE_WRITE_1   0x02
 

EEPROM write 1.

Definition at line 40 of file rtl8139.h.

#define EE_WRITE_CMD   (5 << 6)
 

EEPROM write command.

Definition at line 50 of file rtl8139.h.

 
#define eeprom_delay      in32(ee_addr)
 

Delay between EEPROM clock transitions. No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.

Definition at line 47 of file rtl8139.h.

#define NUM_TX_DESC   4
 

Number of Tx descriptor registers.

Definition at line 27 of file rtl8139.h.

#define RX_BUF_LEN   (8192 << RX_BUF_LEN_IDX)
 

The receive buffer length in bytes.

Definition at line 33 of file rtl8139.h.

#define RX_BUF_LEN_IDX   0
 

The receive buffer length code: 0, 1, 2 is allowed - 8, 16, 32KB.

Definition at line 31 of file rtl8139.h.

#define RX_DMA_BURST   4
 

Maximum PCI burst, '4' is 256 bytes.

Definition at line 23 of file rtl8139.h.

#define RX_FIFO_THRESH   4
 

Rx buffer level before first PCI xfer.

Definition at line 21 of file rtl8139.h.

#define TX_BUF_SIZE   1536
 

Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4).

Definition at line 29 of file rtl8139.h.

#define TX_DMA_BURST   4
 

Calculate as 16<<val.

Definition at line 25 of file rtl8139.h.

#define TX_FIFO_THRESH   256
 

Threshold is bytes transferred to chip before transmission starts (rounded down to 32 byte units).

Definition at line 19 of file rtl8139.h.


Generated on Fri Feb 20 15:32:19 2004 for Minirighi by doxygen1.2.18