@ -29,9 +29,10 @@ struct rx_header {
# define RdAddr 0xC0
# define HNib 0x10
enum page0_regs
{
/* The first six registers hold the ethernet physical station address. */
enum page0_regs {
/* The first six registers hold
* the ethernet physical station address .
*/
PAR0 = 0 , PAR1 = 1 , PAR2 = 2 , PAR3 = 3 , PAR4 = 4 , PAR5 = 5 ,
TxCNT0 = 6 , TxCNT1 = 7 , /* The transmit byte count. */
TxSTAT = 8 , RxSTAT = 9 , /* Tx and Rx status. */
@ -40,11 +41,13 @@ enum page0_regs
CMR2 = 13 , /* Command register 2. */
MODSEL = 14 , /* Mode select register. */
MAR = 14 , /* Memory address register (?). */
CMR2_h = 0x1d , } ;
enum eepage_regs
{ PROM_CMD = 6 , PROM_DATA = 7 } ; /* Note that PROM_CMD is in the "high" bits. */
CMR2_h = 0x1d ,
} ;
enum eepage_regs {
PROM_CMD = 6 ,
PROM_DATA = 7 /* Note that PROM_CMD is in the "high" bits. */
} ;
# define ISR_TxOK 0x01
# define ISR_RxOK 0x04
@ -72,20 +75,24 @@ enum eepage_regs
# define CMR2h_Normal 2 /* Accept physical and broadcast address. */
# define CMR2h_PROMISC 3 /* Promiscuous mode. */
/* An inline function used below: it differs from inb() by explicitly return an unsigned
char , saving a truncation . */
/* An inline function used below: it differs from inb() by explicitly
* return an unsigned char , saving a truncation .
*/
static inline unsigned char inbyte ( unsigned short port )
{
unsigned char _v ;
__asm__ __volatile__ ( " inb %w1,%b0 " : " =a " ( _v ) : " d " ( port ) ) ;
return _v ;
}
/* Read register OFFSET.
This command should always be terminated with read_end ( ) . */
* This command should always be terminated with read_end ( ) .
*/
static inline unsigned char read_nibble ( short port , unsigned char offset )
{
unsigned char retval ;
outb ( EOC + offset , port + PAR_DATA ) ;
outb ( RdAddr + offset , port + PAR_DATA ) ;
inbyte ( port + PAR_STATUS ) ; /* Settling time delay */
@ -151,6 +158,7 @@ static inline void
write_reg ( short port , unsigned char reg , unsigned char value )
{
unsigned char outval ;
outb ( EOC | reg , port + PAR_DATA ) ;
outval = WrAddr | reg ;
outb ( outval , port + PAR_DATA ) ;
@ -190,6 +198,7 @@ static inline void
write_reg_byte ( short port , unsigned char reg , unsigned char value )
{
unsigned char outval ;
outb ( EOC | reg , port + PAR_DATA ) ; /* Reset the address register. */
outval = WrAddr | reg ;
outb ( outval , port + PAR_DATA ) ;
@ -205,8 +214,7 @@ write_reg_byte(short port, unsigned char reg, unsigned char value)
outb ( EOC | value , port + PAR_DATA ) ; /* Reset the address register. */
}
/*
* Bulk data writes to the packet buffer . The interrupt line remains enabled .
/* Bulk data writes to the packet buffer. The interrupt line remains enabled.
* The first , faster method uses only the dataport ( data modes 0 , 2 & 4 ) .
* The second ( backup ) method uses data and control regs ( modes 1 , 3 & 5 ) .
* It should only be needed when there is skew between the individual data