Stop function, Control function, Available operations – Comtrol eCos User Manual

Page 605

Advertising
background image

Chapter 46. Generic Ethernet Device Driver

Stop function

static void HRDWR_stop(struct eth_drv_sc *sc)

This function is the inverse of “start.” It should shut down the hardware, disable the receiver, and keep it from
interacting with the physical network.

Control function

static int

HRDWR_control(

struct eth_drv_sc *sc, unsigned long key,

void *data, int len)

This function is used to perform low-level “control” operations on the interface. These operations would typically
be initiated via

ioctl()

calls in the BSD stack, and would be anything that might require the hardware setup to

change (i.e. cannot be performed totally by the platform-independent layers).

The

key

parameter selects the operation, and the

data

and

len

params point describe, as required, some data

for the operation in question.

Available Operations:

ETH_DRV_SET_MAC_ADDRESS

This operation sets the ethernet station address (ESA or MAC) for the device. Normally this address is kept
in non-volatile memory and is unique in the world. This function must at least set the interface to use the new
address. It may also update the NVM as appropriate.

ETH_DRV_GET_IF_STATS_UD
ETH_DRV_GET_IF_STATS

These acquire a set of statistical counters from the interface, and write the information into the memory
pointed to by

data

. The “UD” variant explicitly instructs the driver to acquire up-to-date values. This is a

separate option because doing so may take some time, depending on the hardware.

The definition of the data structure is in

cyg/io/eth/eth_drv_stats.h

.

This call is typically made by SNMP, see

Chapter 47

.

ETH_DRV_SET_MC_LIST

This entry instructs the device to set up multicast packet filtering to receive only packets addressed to the
multicast ESAs in the list pointed to by

data

.

The format of the data is a 32-bit count of the ESAs in the list, followed by packed bytes which are the ESAs
themselves, thus:

#define ETH_DRV_MAX_MC 8

struct eth_drv_mc_list {

int len;

unsigned char addrs[ETH_DRV_MAX_MC][ETHER_ADDR_LEN];

501

Advertising