Spec for Ethernet Driver Interface

SYNOPSIS

void *ether_driver(int op,void *vp1,void *vp2)

DESCRIPTION

The actual function and values passed depends on the value of op.

ETHER_INIT

int ether_driver(ETHER_INIT,Uchar *macAddr,void)
Perform initialization of the Ethernet controller. macAddr is the Ethernet hardware address as a 6-byte array.

ETHER_GETTBA

char *ether_driver(ETHER_GETTBA,void,int *len)
Get the address of a transmit buffer. Data for transmission may then be placed in the buffer. The buffer must be made ready for tranmission via TBRDY before another GETTBA is performed. The len parameter is the address of an int that holds the size of the actual amount of data to be transmitted.

ETHER_TBRDY

int ether_driver(ETHER_TBRDY,void,void)
The transmit buffer that was previously obtained using GETTBA is ready for transmission.

ETHER_RXRDY

int ether_driver(ETHER_RXRDY,void,void)
Check for any newly-arrived packets. Returns 1 if a receive packet is available; else 0.

ETHER_GETRXREC

RXREC *ether_driver(ETHER_GETRXREC,void,void)
Get the RXREC of the next receive packet to be processed. Treat this as a handle, do not attempt to dereference items from this pointer.

ETHER_GETRBA

char *ether_driver(ETHER_GETRBA,RXREC *q,int *len)
Get the address and length of the packet buffer from the RXREC structure that was previously obtained via GETRXREC.

ETHER_RXDONE

int ether_driver(ETHER_RXDONE,RXREC *q,void)
Return the receive buffer to the pool of available buffers.

APPLICATION EXAMPLES


DRIVER EXAMPLE

void *xxxx_driver(int op,void *vp1,void *vp2)
{
RXREC *q = vp1;
int *pLen = vp2;

switch (op) {
	case ETHER_INIT :
		/* int ether_driver(ETHER_INIT,Uchar *macadr,void) */
		return(0);

	case ETHER_GETTBA :
		/* char *ether_driver(ETHER_GETTBA,void,int *pLen) */
		return 0;

	case ETHER_TBARDY :
		/* int ether_driver(ETHER_TBRDY,void,void) */
		return((void *)1);

	case ETHER_GETRXREC :
		/* RXREC *ether_driver(ETHER_GETRXREC,void,void) */
		return(0);

	case ETHER_GETRBA :
		/* char *ether_driver(ETHER_GETRBA,RXREC *q,int *pLen) */
		return(0);

	case ETHER_RXDONE :
		/* int ether_driver(ETHER_RXDONE,RXREC *q,void) */
		return((void *)1);

	case ETHER_RXRDY :
		/* int ether_driver(ETHER_RXRDY,void,void) */
		return(0);

	default : return(0);
	}
return(0);
}

FILES

Protocol handler
Am79970 driver
Sonic driver


Navigation: Document Home | Document Contents | Document Index